Skip to content
This repository has been archived by the owner on Oct 3, 2024. It is now read-only.

Commit

Permalink
fix: refactor and improve zksync-cli docs (#951)
Browse files Browse the repository at this point in the history
  • Loading branch information
JackHamer09 authored Feb 23, 2024
1 parent 78e02b0 commit 36dd62f
Show file tree
Hide file tree
Showing 14 changed files with 684 additions and 119 deletions.
1 change: 1 addition & 0 deletions cspell-zksync.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ mainchain
offchain
processed
zcli
zkcli
blockchains
sidechain
sidechains
Expand Down
40 changes: 38 additions & 2 deletions docs/.vuepress/sidebar/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,44 @@ export const enSidebar = sidebar({
text: "Getting Started",
link: "/build/tooling/zksync-cli/getting-started.md",
},
"/build/tooling/zksync-cli/commands.md",
"/build/tooling/zksync-cli/examples/contract-interaction.md"
{
text: "Commands",
collapsible: false,
children: [
{
text: "Start Node Locally",
link: "/build/tooling/zksync-cli/commands/local-node.md",
},
{
text: "Create a Project",
link: "/build/tooling/zksync-cli/commands/create.md",
},
{
text: "Contract Interaction",
link: "/build/tooling/zksync-cli/commands/contract-interaction.md",
},
{
text: "Transaction Info",
link: "/build/tooling/zksync-cli/commands/transaction-info.md",
},
{
text: "Wallet Functionality",
link: "/build/tooling/zksync-cli/commands/wallet.md",
},
{
text: "Bridge Operations",
link: "/build/tooling/zksync-cli/commands/bridge.md",
},
{
text: "Custom Chains",
link: "/build/tooling/zksync-cli/commands/custom-chains.md",
},
]
},
{
text: "Troubleshooting",
link: "/build/tooling/zksync-cli/troubleshooting.md",
},
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion docs/build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Find user guides, code samples, SDKs & toolkits, tutorials, API & CLI references
/>
<div class="content">
<h3>zkSync CLI</h3>
<p>Easily interact and develop applications with zkSync Era using the zkSync CLI.</p>
<p>Local development, contract interaction, custom chains and more.</p>
</div>
</RouterLink>
<RouterLink
Expand Down
83 changes: 0 additions & 83 deletions docs/build/tooling/zksync-cli/commands.md

This file was deleted.

106 changes: 106 additions & 0 deletions docs/build/tooling/zksync-cli/commands/bridge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
---
head:
- - meta
- name: "twitter:title"
content: Bridge Operations with zksync-cli | zkSync Docs
---

# Bridge operations with zksync-cli

Leverage the [zksync-cli](../../zksync-cli/getting-started.md) to facilitate bridge operations between Ethereum (L1) and zkSync (L2), including token deposits, withdrawals, and finalizing withdrawals.

### Prerequisites

Before you start, make sure you have installed:

- [Node.js v18+](https://nodejs.org/en)

### Table of contents

- [Bridge Deposit](#bridge-deposit)
- [Deposit Options](#deposit-options)
- [Depositing ERC-20 Tokens](#depositing-erc-20-tokens)
- [Bridge Withdraw](#bridge-withdraw)
- [Withdraw Options](#withdraw-options)
- [Withdrawing ERC-20 Tokens](#withdrawing-erc-20-tokens)
- [Withdraw Finalize](#withdraw-finalize)
- [Finalize Withdraw Options](#finalize-withdraw-options)
- [Troubleshooting](#troubleshooting)

## Bridge Deposit

Transfer ETH from L1 to L2 using the deposit command.

```bash
npx zksync-cli bridge deposit
```

### Deposit Options

If options are not specified, you will be prompted to enter them.

- `--to, --recipient <0x address>`: Recipient address on L2.
- `--amount <0.1>`: Amount to deposit.
- `--token <0x address>`: ERC-20 token address.
- `--pk, --private-key <wallet private key>`: Private key of the sender.
- `--chain <chain>`: Chain to use.
- `--l1-rpc <URL>`: Override L1 RPC URL.
- `--rpc <URL>`: Override L2 RPC URL.

### Depositing ERC-20 Tokens

To deposit ERC-20 tokens, include the `--token` option with the token's contract address:

```bash
npx zksync-cli bridge deposit --token 0x3e622317f8C93f7328350cF0B56d9eD4C620C5d6
```

## Bridge Withdraw

Transfer tokens from L2 back to L1.

```bash
npx zksync-cli bridge withdraw
```

### Withdraw Options

You will be prompted to enter options if they are not specified.

- `--to, --recipient <0x address>`: Recipient address on L1.
- `--amount <0.1>`: Amount to withdraw.
- `--token <0x address>`: ERC-20 token address (omit this option to withdraw ETH).
- `--pk, --private-key <wallet private key>`: Private key of the sender.
- `--chain <chain>`: Chain to use.
- `--l1-rpc <URL>`: Override L1 RPC URL.
- `--rpc <URL>`: Override L2 RPC URL.

### Withdrawing ERC-20 Tokens

For withdrawing ERC-20 tokens, specify the token address using the `--token` option:

```bash
npx zksync-cli bridge withdraw --token 0x3e622317f8C93f7328350cF0B56d9eD4C620C5d6
```

## Withdraw Finalize

Finalize the withdrawal of funds with the following command. This step is necessary to complete the withdrawal process initiated on L2.

```bash
npx zksync-cli bridge withdraw-finalize
```

### Finalize Withdraw Options

Options will be prompted if not specified.

- `--hash <transaction_hash>`: L2 withdrawal transaction hash to finalize.
- `--pk, --private-key <wallet private key>`: Private key of the sender.
- `--chain <chain>`: Chain to use.
- `--l1-rpc <URL>`: Override L1 RPC URL.
- `--rpc <URL>`: Override L2 RPC URL.

## Troubleshooting

If you encounter any issues, please consult our [troubleshooting guide](../../zksync-cli/troubleshooting.md) or report them in our [GitHub discussions](https://github.com/zkSync-Community-Hub/zksync-developers/discussions/new?category=general).
Loading

0 comments on commit 36dd62f

Please sign in to comment.