diff --git a/docs/.vuepress/sidebar/en.ts b/docs/.vuepress/sidebar/en.ts index 9461061da2..53c3196568 100644 --- a/docs/.vuepress/sidebar/en.ts +++ b/docs/.vuepress/sidebar/en.ts @@ -218,8 +218,8 @@ export const enSidebar = sidebar({ children: [ { text: "Getting Started", - link: "/build/tooling/zksync-cli/getting-started.md", - }, + link: "/build/tooling/zksync-cli/getting-started.md", + }, "/build/tooling/zksync-cli/commands.md", "/build/tooling/zksync-cli/examples/contract-interaction.md" ] @@ -304,7 +304,7 @@ export const enSidebar = sidebar({ }, ] }, - + ], }, { @@ -396,22 +396,7 @@ export const enSidebar = sidebar({ text: "Go", collapsible: true, children: [ - { - text: "Getting Started", - collapsible: true, - children: [ - "/build/sdks/go/getting-started", - "/build/sdks/go/examples/deposit", - "/build/sdks/go/examples/transfer", - "/build/sdks/go/examples/withdraw", - "/build/sdks/go/examples/get-confirmed-tokens", - "/build/sdks/go/examples/create", - "/build/sdks/go/examples/create2", - "/build/sdks/go/examples/custom-paymaster/deploy-token", - "/build/sdks/go/examples/custom-paymaster/deploy-account", - "/build/sdks/go/examples/custom-paymaster/use-paymaster", - ], - }, + "/build/sdks/go/getting-started", "/build/sdks/go/clients", "/build/sdks/go/accounts", "/build/sdks/go/accounts-l1-l2", @@ -596,7 +581,7 @@ export const enSidebar = sidebar({ { text: "Components", collapsible: true, - children: [ + children: [ { text: "Overview", link: "/zk-stack/components/overview.md", @@ -609,21 +594,21 @@ export const enSidebar = sidebar({ text: "Smart Contracts", link: "/zk-stack/components/smart-contracts/smart-contracts.md", }, - { + { text: "System Contracts", link: "/zk-stack/components/smart-contracts/system-contracts.md", - } + } ] }, { text: "Shared Bridge", link: "/zk-stack/components/shared-bridges.md" - + }, { text: "Sequencer / Server", link: "/zk-stack/components/sequencer-server.md" - + }, { text: "zkEVM", @@ -889,15 +874,15 @@ export const enSidebar = sidebar({ } ], }, - { + { text: "Fee Withdrawer", link: "/zk-stack/components/fee-withdrawer.md" }, - { + { text: "Portal - Wallet + Bridge", link: "/zk-stack/components/portal-wallet-bridge.md" }, - { + { text: "Block Explorer", link: "/zk-stack/components/block-explorer.md" }, diff --git a/docs/build/sdks/go/accounts-l1-l2.md b/docs/build/sdks/go/accounts-l1-l2.md index ad1f97f0d3..2511bf12a3 100644 --- a/docs/build/sdks/go/accounts-l1-l2.md +++ b/docs/build/sdks/go/accounts-l1-l2.md @@ -17,7 +17,10 @@ Full examples of actions below are available on the [getting started](./getting- `WalletL1` and `Wallet` objects provide a deposit workflow. For more information, please refer to the method specification [`Deposit`](accounts.md#deposit). -For a complete example of how to execute the deposit workflow, take a look at the following: [Deposit ETH and ERC20 token](examples/deposit.md). +For a comprehensive example demonstrating the deposit workflow, refer to the following: + +- [Deposit ETH](https://github.com/zksync-sdk/zksync2-examples/blob/main/go/01_deposit.go). +- [Deposit ERC20 tokens](https://github.com/zksync-sdk/zksync2-examples/blob/main/go/05_deposit_token.go). ## Request execute @@ -43,4 +46,7 @@ method specification [`BaseCost`](accounts.md#basecost). `WalletL2` and `Wallet` objects provide a withdrawal workflow. For more information, please refer to the method specification [`Deposit`](accounts.md#deposit). -For a complete example of how to execute the deposit workflow, take a look at the following: [Withdraw ETH and ERC20 token](examples/withdraw.md). +For a complete example of how to execute the deposit workflow, take a look at the following: + +- [Withdraw ETH](https://github.com/zksync-sdk/zksync2-examples/blob/main/go/03_withdraw.go). +- [Withdraw ERC20 token](https://github.com/zksync-sdk/zksync2-examples/blob/main/go/07_withdraw_token.go). diff --git a/docs/build/sdks/go/contracts.md b/docs/build/sdks/go/contracts.md index 4a59a220b8..1adbc9cec8 100644 --- a/docs/build/sdks/go/contracts.md +++ b/docs/build/sdks/go/contracts.md @@ -18,9 +18,10 @@ contracts and smart accounts. There are the following objects that implement the Contract instantiation is the same as in the [`geth`](https://geth.ethereum.org/docs/developers/dapp-developer/native-bindings) library. For examples of how to deploy and instantiate contracts and accounts, refer to the following: -- [Deploy smart contracts using CREATE opcode](examples/create.md). -- [Deploy smart contracts using CREATE2 opcode](examples/create2.md). -- [Deploy smart accounts using CREATE and CREATE2 opcode](examples/custom-paymaster/deploy-account.md) +- [Deploy smart contracts using CREATE opcode](https://github.com/zksync-sdk/zksync2-examples/blob/main/go/09_deploy_create.go). +- [Deploy smart contracts using CREATE2 opcode](https://github.com/zksync-sdk/zksync2-examples/blob/main/go/12_deploy_create2.go). +- [Deploy smart accounts using CREATE opcode](https://github.com/zksync-sdk/zksync2-examples/blob/main/go/17_deploy_create_account.go). +- [Deploy smart accounts using CREATE2 opcode](https://github.com/zksync-sdk/zksync2-examples/blob/main/go/18_deploy_create2_account.go). ## Contracts interfaces diff --git a/docs/build/sdks/go/examples/create.md b/docs/build/sdks/go/examples/create.md deleted file mode 100644 index 6e384cd312..0000000000 --- a/docs/build/sdks/go/examples/create.md +++ /dev/null @@ -1,375 +0,0 @@ ---- -head: - - - meta - - name: "twitter:title" - content: Go SDK Create Example | zkSync Docs ---- - -# Deploy Contract with CREATE Opcode - -With zkSync Era contract can be deployed using the CREATE by simply building the contract into a binary format and deploying it to the -zkSync Era network. - -- [Storage](https://github.com/zksync-sdk/zksync2-examples/blob/main/solidity/storage/Storage.sol): Contract without constructor. -- [Incrementer](https://github.com/zksync-sdk/zksync2-examples/blob/main/solidity/incrementer/Incrementer.sol): Contract with constructor. -- [Demo](https://github.com/zksync-sdk/zksync2-examples/blob/main/solidity/demo/Demo.sol): Contract that has a dependency on - [Foo](https://github.com/zksync-sdk/zksync2-examples/blob/main/solidity/demo/Foo.sol) contract. - -There is a [user guide](https://github.com/zksync-sdk/zksync2-examples/blob/main/solidity/README.md) on how to compile Solidity smart contracts using `zksolc` -compiler. `zksolc` compiler generates a `*.zbin` and a `combined.json` file that contains the bytecode and ABI of a smart contract. -The `combined.json` file is used by `abigen` tool to generate smart contract bindings. -Those files are used in the following examples. - -## Deploy contract - -```go -package main - -import ( - "context" - "fmt" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/zksync-sdk/zksync2-go/accounts" - "github.com/zksync-sdk/zksync2-go/clients" - "log" - "math/big" - "os" - "zksync2-examples/contracts/storage" -) - -func main() { - var ( - PrivateKey = os.Getenv("PRIVATE_KEY") - ZkSyncEraProvider = "https://sepolia.era.zksync.dev" - ) - - // Connect to zkSync network - client, err := clients.Dial(ZkSyncEraProvider) - if err != nil { - log.Panic(err) - } - defer client.Close() - - // Create wallet - wallet, err := accounts.NewWallet(common.Hex2Bytes(PrivateKey), &client, nil) - if err != nil { - log.Fatal(err) - } - - // Read smart contract bytecode - bytecode, err := os.ReadFile("../solidity/storage/build/Storage.zbin") - if err != nil { - log.Panic(err) - } - - //Deploy smart contract - hash, err := wallet.DeployWithCreate(nil, accounts.CreateTransaction{Bytecode: bytecode}) - if err != nil { - panic(err) - } - fmt.Println("Transaction: ", hash) - - // Wait unit transaction is finalized - _, err = client.WaitMined(context.Background(), hash) - if err != nil { - log.Panic(err) - } - - receipt, err := client.TransactionReceipt(context.Background(), hash) - if err != nil { - log.Panic(err) - } - contractAddress := receipt.ContractAddress - - if err != nil { - log.Panic(err) - } - fmt.Println("Smart contract address", contractAddress.String()) - - // INTERACT WITH SMART CONTRACT - - // Create instance of Storage smart contract - storageContract, err := storage.NewStorage(contractAddress, client) - if err != nil { - log.Panic(err) - } - - // Execute Get method from storage smart contract - value, err := storageContract.Get(nil) - if err != nil { - log.Panic(err) - } - fmt.Println("Value:", value) - - // Start configuring transaction parameters - opts, err := bind.NewKeyedTransactorWithChainID(wallet.Signer().PrivateKey(), wallet.Signer().Domain().ChainId) - if err != nil { - log.Panic(err) - } - - // Execute Set method from storage smart contract with configured transaction parameters - tx, err := storageContract.Set(opts, big.NewInt(200)) - if err != nil { - log.Panic(err) - } - // Wait for transaction to be finalized - _, err = client.WaitMined(context.Background(), tx.Hash()) - if err != nil { - log.Panic(err) - } - - // Execute Get method again to check if state is changed - value, err = storageContract.Get(nil) - if err != nil { - log.Panic(err) - } - fmt.Println("Value after first Set method execution: ", value) - - // INTERACT WITH SMART CONTRACT USING EIP712 TRANSACTIONS - abi, err := storage.StorageMetaData.GetAbi() - if err != nil { - log.Panic(err) - } - // Encode set function arguments - setArguments, err := abi.Pack("set", big.NewInt(500)) - if err != nil { - log.Panic(err) - } - // Execute set function - execute, err := wallet.SendTransaction(context.Background(), &accounts.Transaction{ - To: &contractAddress, - Data: setArguments, - }) - if err != nil { - log.Panic(err) - } - - _, err = client.WaitMined(context.Background(), execute) - if err != nil { - log.Panic(err) - } - - // Execute Get method again to check if state is changed - value, err = storageContract.Get(nil) - if err != nil { - log.Panic(err) - } - fmt.Println("Value after second Set method execution: ", value) -} - -``` - -## Deploy contract with constructor - -```go -package main - -import ( - "context" - "fmt" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/zksync-sdk/zksync2-go/accounts" - "github.com/zksync-sdk/zksync2-go/clients" - "log" - "math/big" - "os" - "zksync2-examples/contracts/incrementer" -) - -func main() { - var ( - PrivateKey = os.Getenv("PRIVATE_KEY") - ZkSyncEraProvider = "https://sepolia.era.zksync.dev" - ) - - // Connect to zkSync network - client, err := clients.Dial(ZkSyncEraProvider) - if err != nil { - log.Panic(err) - } - defer client.Close() - - // Create wallet - wallet, err := accounts.NewWallet(common.Hex2Bytes(PrivateKey), &client, nil) - if err != nil { - log.Fatal(err) - } - - // Read smart contract bytecode - bytecode, err := os.ReadFile("../solidity/incrementer/build/Incrementer.zbin") - if err != nil { - log.Panic(err) - } - - // Get ABI - abi, err := incrementer.IncrementerMetaData.GetAbi() - if err != nil { - log.Panic(err) - } - - // Encode constructor arguments - constructor, err := abi.Pack("", big.NewInt(2)) - if err != nil { - log.Panicf("error while encoding constructor arguments: %s", err) - } - - // Deploy smart contract - hash, err := wallet.DeployAccountWithCreate(nil, accounts.CreateTransaction{ - Bytecode: bytecode, - Calldata: constructor, - }) - if err != nil { - log.Panic(err) - } - fmt.Println("Transaction: ", hash) - - // Wait unit transaction is finalized - _, err = client.WaitMined(context.Background(), hash) - if err != nil { - log.Panic(err) - } - - receipt, err := client.TransactionReceipt(context.Background(), hash) - if err != nil { - log.Panic(err) - } - contractAddress := receipt.ContractAddress - - if err != nil { - panic(err) - } - fmt.Println("Smart contract address: ", contractAddress.String()) - - // INTERACT WITH SMART CONTRACT - - // Create instance of Incrementer contract - incrementerContract, err := incrementer.NewIncrementer(contractAddress, client) - if err != nil { - log.Panic(err) - } - - // Execute Get method - value, err := incrementerContract.Get(nil) - if err != nil { - log.Panic(err) - } - fmt.Println("Value before Increment method execution: ", value) - - // Start configuring transaction parameters - opts, err := bind.NewKeyedTransactorWithChainID(wallet.Signer().PrivateKey(), wallet.Signer().Domain().ChainId) - if err != nil { - log.Panic(err) - } - - // Execute Set method from storage smart contract with configured transaction parameters - tx, err := incrementerContract.Increment(opts) - if err != nil { - log.Panic(err) - } - // Wait for transaction to be finalized - _, err = client.WaitMined(context.Background(), tx.Hash()) - if err != nil { - log.Panic(err) - } - - // Execute Get method again to check if state is changed - value, err = incrementerContract.Get(nil) - if err != nil { - log.Panic(err) - } - fmt.Println("Value after Increment method execution: ", value) -} -``` - -## Deploy contract with dependencies - -```go -package main - -import ( - "context" - "fmt" - "github.com/ethereum/go-ethereum/common" - "github.com/zksync-sdk/zksync2-go/accounts" - "github.com/zksync-sdk/zksync2-go/clients" - "log" - "os" - "zksync2-examples/contracts/demo" -) - -func main() { - var ( - PrivateKey = os.Getenv("PRIVATE_KEY") - ZkSyncEraProvider = "https://sepolia.era.zksync.dev" - ) - - // Connect to zkSync network - client, err := clients.Dial(ZkSyncEraProvider) - if err != nil { - log.Panic(err) - } - defer client.Close() - - // Create wallet - wallet, err := accounts.NewWallet(common.Hex2Bytes(PrivateKey), &client, nil) - if err != nil { - log.Fatal(err) - } - - // Read bytecode of Demo contract - demoBytecode, err := os.ReadFile("../solidity/demo/build/Demo.zbin") - if err != nil { - log.Panic(err) - } - - // Read bytecode of Foo contract - fooBytecode, err := os.ReadFile("../solidity/demo/build/Foo.zbin") - if err != nil { - log.Panic(err) - } - - // Deploy smart contract - hash, err := wallet.DeployWithCreate(nil, accounts.CreateTransaction{ - Bytecode: demoBytecode, - Dependencies: [][]byte{fooBytecode}, - }) - if err != nil { - log.Panic(err) - } - fmt.Println("Transaction: ", hash) - - // Wait unit transaction is finalized - _, err = client.WaitMined(context.Background(), hash) - if err != nil { - log.Panic(err) - } - - receipt, err := client.TransactionReceipt(context.Background(), hash) - if err != nil { - log.Panic(err) - } - contractAddress := receipt.ContractAddress - - if err != nil { - panic(err) - } - fmt.Println("Smart contract address: ", contractAddress.String()) - - // INTERACT WITH SMART CONTRACT - - // Create instance of Demo contract - demoContract, err := demo.NewDemo(contractAddress, client) - if err != nil { - log.Panic(err) - } - - // Execute GetFooName method - value, err := demoContract.GetFooName(nil) - if err != nil { - log.Panic(err) - } - fmt.Println("Value:", value) -} -``` diff --git a/docs/build/sdks/go/examples/create2.md b/docs/build/sdks/go/examples/create2.md deleted file mode 100644 index f4d87f7e86..0000000000 --- a/docs/build/sdks/go/examples/create2.md +++ /dev/null @@ -1,363 +0,0 @@ ---- -head: - - - meta - - name: "twitter:title" - content: Go SDK Create2 Example | zkSync Docs ---- - -# Deploy Contract with CREATE2 Opcode - -With zkSync Era contract can be deployed using the CREATE2 by simply building the contract into a binary format and deploying it to the -zkSync Era network. - -- [Storage](https://github.com/zksync-sdk/zksync2-examples/blob/main/solidity/storage/Storage.sol): Contract without constructor. -- [Incrementer](https://github.com/zksync-sdk/zksync2-examples/blob/main/solidity/incrementer/Incrementer.sol): Contract with constructor. -- [Demo](https://github.com/zksync-sdk/zksync2-examples/blob/main/solidity/demo/Demo.sol): Contract that has a dependency on - [Foo](https://github.com/zksync-sdk/zksync2-examples/blob/main/solidity/demo/Foo.sol) contract. - -There is a [user guide](https://github.com/zksync-sdk/zksync2-examples/blob/main/solidity/README.md) on how to compile Solidity smart contracts using `zksolc` -compiler. `zksolc` compiler generates a `*.zbin` and a `combined.json` file that contains the bytecode and ABI of a smart contract. -The `combined.json` file is used by `abigen` tool to generate smart contract bindings. -Those files are used in the following examples. - -## Deploy contract - -```go -package main - -import ( - "context" - "fmt" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/zksync-sdk/zksync2-go/accounts" - "github.com/zksync-sdk/zksync2-go/clients" - "github.com/zksync-sdk/zksync2-go/utils" - "log" - "math/big" - "os" - "zksync2-examples/contracts/storage" -) - -func main() { - var ( - PrivateKey = os.Getenv("PRIVATE_KEY") - ZkSyncEraProvider = "https://sepolia.era.zksync.dev" - ) - - // Connect to zkSync network - client, err := clients.Dial(ZkSyncEraProvider) - if err != nil { - log.Panic(err) - } - defer client.Close() - - // Create wallet - wallet, err := accounts.NewWallet(common.Hex2Bytes(PrivateKey), &client, nil) - if err != nil { - log.Fatal(err) - } - - // Read smart contract bytecode - bytecode, err := os.ReadFile("../solidity/storage/build/Storage.zbin") - if err != nil { - log.Panic(err) - } - - //Deploy smart contract - hash, err := wallet.Deploy(nil, accounts.Create2Transaction{Bytecode: bytecode}) - if err != nil { - panic(err) - } - fmt.Println("Transaction: ", hash) - - // Wait unit transaction is finalized - _, err = client.WaitMined(context.Background(), hash) - if err != nil { - log.Panic(err) - } - - // Get address of deployed smart contract - contractAddress, err := utils.Create2Address( - wallet.Address(), - bytecode, - nil, - nil, - ) - if err != nil { - log.Panic(err) - } - fmt.Println("Smart contract address", contractAddress.String()) - - // INTERACT WITH SMART CONTRACT - - // Create instance of Storage smart contract - storageContract, err := storage.NewStorage(contractAddress, client) - if err != nil { - log.Panic(err) - } - - // Execute Get method from storage smart contract - value, err := storageContract.Get(nil) - if err != nil { - log.Panic(err) - } - fmt.Println("Value:", value) - - // Start configuring transaction parameters - opts, err := bind.NewKeyedTransactorWithChainID(wallet.Signer().PrivateKey(), wallet.Signer().Domain().ChainId) - if err != nil { - log.Panic(err) - } - - // Execute Set method from storage smart contract with configured transaction parameters - tx, err := storageContract.Set(opts, big.NewInt(200)) - if err != nil { - log.Panic(err) - } - // Wait for transaction to be finalized - _, err = client.WaitMined(context.Background(), tx.Hash()) - if err != nil { - log.Panic(err) - } - - // Execute Get method again to check if state is changed - value, err = storageContract.Get(nil) - if err != nil { - log.Panic(err) - } - fmt.Println("Value after Set method execution: ", value) -} - -``` - -## Deploy contract with constructor - -```go -package main - -import ( - "context" - "crypto/rand" - "fmt" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/zksync-sdk/zksync2-go/accounts" - "github.com/zksync-sdk/zksync2-go/clients" - "github.com/zksync-sdk/zksync2-go/utils" - "log" - "math/big" - "os" - "zksync2-examples/contracts/incrementer" -) - -func main() { - var ( - PrivateKey = os.Getenv("PRIVATE_KEY") - ZkSyncEraProvider = "https://sepolia.era.zksync.dev" - ) - - // Connect to zkSync network - client, err := clients.Dial(ZkSyncEraProvider) - if err != nil { - log.Panic(err) - } - defer client.Close() - - // Create wallet - wallet, err := accounts.NewWallet(common.Hex2Bytes(PrivateKey), &client, nil) - if err != nil { - log.Fatal(err) - } - - // Read smart contract bytecode - bytecode, err := os.ReadFile("../solidity/incrementer/build/Incrementer.zbin") - if err != nil { - log.Panic(err) - } - - // Get ABI - abi, err := incrementer.IncrementerMetaData.GetAbi() - if err != nil { - log.Panic(err) - } - - // Encode constructor arguments - constructor, err := abi.Pack("", big.NewInt(2)) - if err != nil { - log.Panicf("error while encoding constructor arguments: %s", err) - } - - // Generate salt - salt := make([]byte, 32) - _, err = rand.Read(salt) - if err != nil { - log.Panicf("error while generating salt: %s", err) - } - - // Deploy smart contract - hash, err := wallet.Deploy(nil, accounts.Create2Transaction{ - Bytecode: bytecode, - Calldata: constructor, - Salt: salt, - }) - if err != nil { - panic(err) - // When contract is deployed twice without salt the following error occurs: - // panic: failed to EstimateGas712: failed to query eth_estimateGas: execution reverted: Code hash is non-zero - } - fmt.Println("Transaction: ", hash) - - // Wait unit transaction is finalized - _, err = client.WaitMined(context.Background(), hash) - if err != nil { - log.Panic(err) - } - - // Get address of deployed smart contract - contractAddress, err := utils.Create2Address( - wallet.Address(), - bytecode, - constructor, - salt, - ) - if err != nil { - panic(err) - } - fmt.Println("Smart contract address: ", contractAddress.String()) - - // INTERACT WITH SMART CONTRACT - - // Create instance of Incrementer contract - incrementerContract, err := incrementer.NewIncrementer(contractAddress, client) - if err != nil { - log.Panic(err) - } - - // Execute Get method - value, err := incrementerContract.Get(nil) - if err != nil { - log.Panic(err) - } - fmt.Println("Value before Increment method execution: ", value) - - // Start configuring transaction parameters - opts, err := bind.NewKeyedTransactorWithChainID(wallet.Signer().PrivateKey(), wallet.Signer().Domain().ChainId) - if err != nil { - log.Panic(err) - } - - // Execute Set method from storage smart contract with configured transaction parameters - tx, err := incrementerContract.Increment(opts) - if err != nil { - log.Panic(err) - } - // Wait for transaction to be finalized - _, err = client.WaitMined(context.Background(), tx.Hash()) - if err != nil { - log.Panic(err) - } - - // Execute Get method again to check if state is changed - value, err = incrementerContract.Get(nil) - if err != nil { - log.Panic(err) - } - fmt.Println("Value after Increment method execution: ", value) -} - -``` - -## Deploy contract with dependencies - -```go -package main - -import ( - "context" - "fmt" - "github.com/ethereum/go-ethereum/common" - "github.com/zksync-sdk/zksync2-go/accounts" - "github.com/zksync-sdk/zksync2-go/clients" - "github.com/zksync-sdk/zksync2-go/utils" - "log" - "os" - "zksync2-examples/contracts/demo" -) - -func main() { - var ( - PrivateKey = os.Getenv("PRIVATE_KEY") - ZkSyncEraProvider = "https://sepolia.era.zksync.dev" - ) - - // Connect to zkSync network - client, err := clients.Dial(ZkSyncEraProvider) - if err != nil { - log.Panic(err) - } - defer client.Close() - - // Create wallet - wallet, err := accounts.NewWallet(common.Hex2Bytes(PrivateKey), &client, nil) - if err != nil { - log.Fatal(err) - } - - // Read bytecode of Demo contract - demoBytecode, err := os.ReadFile("../solidity/demo/build/Demo.zbin") - if err != nil { - log.Panic(err) - } - - // Read bytecode of Foo contract - fooBytecode, err := os.ReadFile("../solidity/demo/build/Foo.zbin") - if err != nil { - log.Panic(err) - } - - // Deploy smart contract - hash, err := wallet.Deploy(nil, accounts.Create2Transaction{ - Bytecode: demoBytecode, - Dependencies: [][]byte{fooBytecode}, - }) - if err != nil { - panic(err) - } - fmt.Println("Transaction: ", hash) - - // Wait unit transaction is finalized - _, err = client.WaitMined(context.Background(), hash) - if err != nil { - log.Panic(err) - } - - // Get address of deployed smart contract - contractAddress, err := utils.Create2Address( - wallet.Address(), - demoBytecode, - nil, - nil, - ) - if err != nil { - panic(err) - } - fmt.Println("Smart contract address: ", contractAddress.String()) - - // INTERACT WITH SMART CONTRACT - - // Create instance of Demo contract - demoContract, err := demo.NewDemo(contractAddress, client) - if err != nil { - log.Panic(err) - } - - // Execute GetFooName method - value, err := demoContract.GetFooName(nil) - if err != nil { - log.Panic(err) - } - fmt.Println("Value:", value) -} - -``` diff --git a/docs/build/sdks/go/examples/custom-paymaster/deploy-account.md b/docs/build/sdks/go/examples/custom-paymaster/deploy-account.md deleted file mode 100644 index d20489eaa7..0000000000 --- a/docs/build/sdks/go/examples/custom-paymaster/deploy-account.md +++ /dev/null @@ -1,157 +0,0 @@ ---- -head: - - - meta - - name: "twitter:title" - content: Go SDK Deploy Paymaster Example | zkSync Docs ---- - -# Deploy Paymaster - -Deploy the paymaster account, which will receive the token deployed in the [previous](deploy-token.md) step and pay the fee in ETH for the account that -sends the token. The token address on testnet that is deployed in previous step is `0x765F5AF819D818a8e8ee6ff63D8d0e8056DBE150` - -## Deploy paymaster with CREATE opcode - -```go -package main - -import ( - "context" - "fmt" - "github.com/ethereum/go-ethereum/common" - "github.com/zksync-sdk/zksync2-go/accounts" - "github.com/zksync-sdk/zksync2-go/clients" - "github.com/zksync-sdk/zksync2-go/utils" - "log" - "os" -) - -func main() { - var ( - PrivateKey = os.Getenv("PRIVATE_KEY") - ZkSyncEraProvider = "https://sepolia.era.zksync.dev" - TokenAddress = "0x765F5AF819D818a8e8ee6ff63D8d0e8056DBE150" // Crown token which can be minted for free - ) - - // Connect to zkSync network - client, err := clients.Dial(ZkSyncEraProvider) - if err != nil { - log.Panic(err) - } - defer client.Close() - - // Create wallet - wallet, err := accounts.NewWallet(common.Hex2Bytes(PrivateKey), &client, nil) - if err != nil { - log.Fatal(err) - } - - _, paymasterAbi, bytecode, err := utils.ReadStandardJson("../solidity/custom_paymaster/paymaster/build/Paymaster.json") - if err != nil { - log.Panic(err) - } - - constructor, err := paymasterAbi.Pack("", common.HexToAddress(TokenAddress)) - if err != nil { - log.Panic(err) - } - - // Deploy paymaster contract - hash, err := wallet.DeployAccountWithCreate(nil, accounts.CreateTransaction{ - Bytecode: bytecode, - Calldata: constructor, - }) - if err != nil { - log.Panic(err) - } - fmt.Println("Transaction: ", hash) - - // Wait unit transaction is finalized - _, err = client.WaitMined(context.Background(), hash) - if err != nil { - log.Panic(err) - } - - receipt, err := client.TransactionReceipt(context.Background(), hash) - if err != nil { - log.Panic(err) - } - contractAddress := receipt.ContractAddress - fmt.Println("Paymaster address", contractAddress.String()) -} - -``` - -## Deploy paymaster with CREATE2 opcode - -```go -package main - -import ( - "context" - "fmt" - "github.com/ethereum/go-ethereum/common" - "github.com/zksync-sdk/zksync2-go/accounts" - "github.com/zksync-sdk/zksync2-go/clients" - "github.com/zksync-sdk/zksync2-go/utils" - "log" - "os" -) - -func main() { - var ( - PrivateKey = os.Getenv("PRIVATE_KEY") - ZkSyncEraProvider = "https://sepolia.era.zksync.dev" - TokenAddress = "0xCd9BDa1d0FC539043D4C80103bdF4f9cb108931B" // Crown token which can be minted for free - ) - - // Connect to zkSync network - client, err := clients.Dial(ZkSyncEraProvider) - if err != nil { - log.Panic(err) - } - defer client.Close() - - // Create wallet - wallet, err := accounts.NewWallet(common.Hex2Bytes(PrivateKey), &client, nil) - if err != nil { - log.Fatal(err) - } - - // Read paymaster contract from standard json - _, paymasterAbi, bytecode, err := utils.ReadStandardJson("./delete-me/solidity/custom_paymaster/paymaster/build/Paymaster.json") - if err != nil { - log.Panic(err) - } - - // Encode paymaster constructor - constructor, err := paymasterAbi.Pack("", common.HexToAddress(TokenAddress)) - if err != nil { - log.Panic(err) - } - - // Deploy paymaster contract - hash, err := wallet.DeployAccount(nil, accounts.Create2Transaction{Bytecode: bytecode, Calldata: constructor}) - if err != nil { - log.Panic(err) - } - if err != nil { - log.Panic(err) - } - fmt.Println("Transaction: ", hash) - - // Wait unit transaction is finalized - _, err = client.WaitMined(context.Background(), hash) - if err != nil { - log.Panic(err) - } - - // Get address of deployed smart contract - contractAddress, err := utils.Create2Address(wallet.Address(), bytecode, constructor, nil) - if err != nil { - log.Panic(err) - } - fmt.Println("Paymaster address: ", contractAddress.String()) -} - -``` diff --git a/docs/build/sdks/go/examples/custom-paymaster/deploy-token.md b/docs/build/sdks/go/examples/custom-paymaster/deploy-token.md deleted file mode 100644 index cf846eec7c..0000000000 --- a/docs/build/sdks/go/examples/custom-paymaster/deploy-token.md +++ /dev/null @@ -1,210 +0,0 @@ ---- -head: - - - meta - - name: "twitter:title" - content: Go SDK Deploy Token Example | zkSync Docs ---- - -# Deploy Token - -Deploy the token which will be used to pay transaction fee. - -## Deploy token with CREATE opcode - -```go -package main - -import ( - "context" - "fmt" - "github.com/ethereum/go-ethereum/common" - "github.com/zksync-sdk/zksync2-go/accounts" - "github.com/zksync-sdk/zksync2-go/clients" - "github.com/zksync-sdk/zksync2-go/utils" - "log" - "os" - "zksync2-examples/contracts/crown" -) - -func main() { - var ( - PrivateKey = os.Getenv("PRIVATE_KEY") - ZkSyncEraProvider = "https://sepolia.era.zksync.dev" - ) - - // Connect to zkSync network - client, err := clients.Dial(ZkSyncEraProvider) - if err != nil { - log.Panic(err) - } - defer client.Close() - - // Create wallet - wallet, err := accounts.NewWallet(common.Hex2Bytes(PrivateKey), &client, nil) - if err != nil { - log.Fatal(err) - } - - _, tokenAbi, bytecode, err := utils.ReadStandardJson("../solidity/custom_paymaster/token/build/Token.json") - if err != nil { - log.Panic(err) - } - - constructor, err := tokenAbi.Pack("", "Crown", "Crown", uint8(18)) - if err != nil { - log.Panic(err) - } - - //Deploy smart contract - hash, err := wallet.DeployWithCreate(nil, accounts.CreateTransaction{Bytecode: bytecode, Calldata: constructor}) - if err != nil { - panic(err) - } - fmt.Println("Transaction: ", hash) - - // Wait unit transaction is finalized - tx, err := client.WaitMined(context.Background(), hash) - if err != nil { - log.Panic(err) - } - - // Get address of deployed smart contract - tokenAddress := tx.ContractAddress - - if err != nil { - panic(err) - } - fmt.Println("Token address", tokenAddress.String()) - - // Create instance of token contract - token, err := crown.NewCrown(tokenAddress, client) - if err != nil { - log.Panic(err) - } - - symbol, err := token.Symbol(nil) - if err != nil { - log.Panic(err) - } - - fmt.Println("Symbol: ", symbol) - - decimals, err := token.Decimals(nil) - if err != nil { - log.Panic(err) - } - - fmt.Println("Decimals: ", decimals) -} - -``` - -## Deploy token with CREATE2 opcode - -```go -package main - -import ( - "context" - "fmt" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/zksync-sdk/zksync2-go/accounts" - "github.com/zksync-sdk/zksync2-go/clients" - "github.com/zksync-sdk/zksync2-go/utils" - "log" - "math/big" - "os" - "zksync2-examples/contracts/crown" -) - -func main() { - var ( - PrivateKey = os.Getenv("PRIVATE_KEY") - ZkSyncEraProvider = "https://sepolia.era.zksync.dev" - ) - - // Connect to zkSync network - client, err := clients.Dial(ZkSyncEraProvider) - if err != nil { - log.Panic(err) - } - defer client.Close() - - // Create wallet - wallet, err := accounts.NewWallet(common.Hex2Bytes(PrivateKey), &client, nil) - if err != nil { - log.Fatal(err) - } - - // Read token contract from standard json - _, tokenAbi, bytecode, err := utils.ReadStandardJson("../solidity/custom_paymaster/token/build/Token.json") - if err != nil { - log.Panic(err) - } - - constructor, err := tokenAbi.Pack("", "Crown", "Crown", uint8(18)) - if err != nil { - log.Panic(err) - } - - //Deploy smart contract - hash, err := wallet.Deploy(nil, accounts.Create2Transaction{Bytecode: bytecode, Calldata: constructor}) - if err != nil { - panic(err) - } - fmt.Println("Transaction: ", hash) - - // Wait unit transaction is finalized - _, err = client.WaitMined(context.Background(), hash) - if err != nil { - log.Panic(err) - } - - // Get address of deployed smart contract - tokenAddress, err := utils.Create2Address( - wallet.Address(), - bytecode, - constructor, - nil, - ) - if err != nil { - panic(err) - } - fmt.Println("Token address", tokenAddress.String()) - - // Create instance of token contract - token, err := crown.NewCrown(tokenAddress, client) - if err != nil { - log.Panic(err) - } - - symbol, err := token.Symbol(nil) - if err != nil { - log.Panic(err) - } - fmt.Println("Symbol: ", symbol) - - decimals, err := token.Decimals(nil) - if err != nil { - log.Panic(err) - } - fmt.Println("Decimals: ", decimals) - - opts, err := bind.NewKeyedTransactorWithChainID(wallet.Signer().PrivateKey(), wallet.Signer().Domain().ChainId) - if err != nil { - log.Panic(err) - } - mint, err := token.Mint(opts, wallet.Address(), big.NewInt(5)) - if err != nil { - log.Panic(err) - } - - // Wait for transaction to be finalized - _, err = client.WaitMined(context.Background(), mint.Hash()) - if err != nil { - log.Panic(err) - } -} - -``` diff --git a/docs/build/sdks/go/examples/custom-paymaster/use-paymaster.md b/docs/build/sdks/go/examples/custom-paymaster/use-paymaster.md deleted file mode 100644 index cc14a39899..0000000000 --- a/docs/build/sdks/go/examples/custom-paymaster/use-paymaster.md +++ /dev/null @@ -1,185 +0,0 @@ ---- -head: - - - meta - - name: "twitter:title" - content: Go SDK Use Paymaster Example | zkSync Docs ---- - -# Use Paymaster - -This example demonstrates how to use a paymaster to facilitate fee payment with an ERC20 token. -The user initiates a mint transaction that is configured to be paid with an ERC20 token through the paymaster. -During transaction execution, the paymaster receives the ERC20 token from the user and covers the transaction fee using ETH. - -The token address used in this example is already [deployed](deploy-token.md) at: `0x765F5AF819D818a8e8ee6ff63D8d0e8056DBE150`. -The paymaster address used in this example is already [deployed](deploy-account.md) at: `0x3cb2b87d10ac01736a65688f3e0fb1b070b3eea3`. - -```go -package main - -import ( - "context" - "fmt" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/zksync-sdk/zksync2-go/accounts" - "github.com/zksync-sdk/zksync2-go/clients" - "github.com/zksync-sdk/zksync2-go/types" - "github.com/zksync-sdk/zksync2-go/utils" - "log" - "math/big" - "os" - "zksync2-examples/contracts/crown" -) - -func main() { - var ( - PrivateKey = os.Getenv("PRIVATE_KEY") - ZkSyncEraProvider = "https://sepolia.era.zksync.dev" - TokenAddress = common.HexToAddress("0x765F5AF819D818a8e8ee6ff63D8d0e8056DBE150") // Crown token which can be minted for free - PaymasterAddress = common.HexToAddress("0x3cb2b87d10ac01736a65688f3e0fb1b070b3eea3") // Paymaster for Crown token - ) - - // Connect to zkSync network - client, err := clients.Dial(ZkSyncEraProvider) - if err != nil { - log.Panic(err) - } - defer client.Close() - - // Create wallet - wallet, err := accounts.NewWallet(common.Hex2Bytes(PrivateKey), &client, nil) - if err != nil { - log.Panic(err) - } - - // Get token contract - token, err := crown.NewCrown(TokenAddress, client) - if err != nil { - log.Panic(token) - } - - // Transfer some ETH to paymaster, so it can pay fee with ETH - transferTx, err := wallet.Transfer(nil, accounts.TransferTransaction{ - To: PaymasterAddress, - Amount: big.NewInt(2_000_000_000_000_000_000), - Token: utils.EthAddress, - }) - if err != nil { - return - } - - _, err = client.WaitMined(context.Background(), transferTx.Hash()) - if err != nil { - log.Panic(err) - } - - // Also mint some tokens to user account, so it can offer to pay fee with it - opts, err := bind.NewKeyedTransactorWithChainID(wallet.Signer().PrivateKey(), wallet.Signer().Domain().ChainId) - if err != nil { - log.Panic(err) - } - tx, err := token.Mint(opts, wallet.Address(), big.NewInt(10)) - if err != nil { - log.Panic(err) - } - _, err = client.WaitMined(context.Background(), tx.Hash()) - if err != nil { - log.Panic(err) - } - - // Read token and ETH balances from user and paymaster accounts - balance, err := wallet.Balance(context.Background(), utils.EthAddress, nil) - if err != nil { - return - } - fmt.Println("Account balance before mint: ", balance) - - tokenBalance, err := token.BalanceOf(nil, wallet.Address()) - if err != nil { - log.Panic(err) - } - fmt.Println("Account token balance before mint: ", tokenBalance) - - balance, err = client.BalanceAt(context.Background(), PaymasterAddress, nil) - if err != nil { - return - } - fmt.Println("Paymaster balance before mint: ", balance) - - tokenBalance, err = token.BalanceOf(nil, TokenAddress) - if err != nil { - log.Panic(err) - } - fmt.Println("Paymaster token balance before mint: ", tokenBalance) - - abi, err := crown.CrownMetaData.GetAbi() - if err != nil { - log.Panic(err) - } - - // Encode mint function from token contract - calldata, err := abi.Pack("mint", wallet.Address(), big.NewInt(7)) - if err != nil { - log.Panic(err) - } - - // Create paymaster parameters with encoded paymaster input - paymasterParams, err := utils.GetPaymasterParams( - PaymasterAddress, - &types.ApprovalBasedPaymasterInput{ - Token: TokenAddress, - MinimalAllowance: big.NewInt(1), - InnerInput: []byte{}, - }) - if err != nil { - log.Panic(err) - } - - // In order to use paymaster, EIP712 transaction - // need to be created with configured paymaster parameters - hash, err := wallet.SendTransaction(context.Background(), &accounts.Transaction{ - To: &TokenAddress, - Data: calldata, - Meta: &types.Eip712Meta{ - PaymasterParams: paymasterParams, - }, - }) - if err != nil { - log.Panic(err) - } - - _, err = client.WaitMined(context.Background(), hash) - if err != nil { - log.Panic(err) - } - - fmt.Println("Tx: ", hash) - - balance, err = wallet.Balance(context.Background(), utils.EthAddress, nil) - if err != nil { - return - } - fmt.Println("Account balance after mint: ", balance) - - tokenBalance, err = token.BalanceOf(nil, wallet.Address()) - if err != nil { - log.Panic(err) - } - fmt.Println("Account token balance after mint: ", tokenBalance) - - balance, err = client.BalanceAt(context.Background(), PaymasterAddress, nil) - if err != nil { - return - } - fmt.Println("Paymaster balance after mint: ", balance) - - tokenBalance, err = token.BalanceOf(nil, TokenAddress) - if err != nil { - log.Panic(err) - } - fmt.Println("Paymaster token balance after mint: ", tokenBalance) - -} - -``` diff --git a/docs/build/sdks/go/examples/deposit.md b/docs/build/sdks/go/examples/deposit.md deleted file mode 100644 index 4384db2085..0000000000 --- a/docs/build/sdks/go/examples/deposit.md +++ /dev/null @@ -1,300 +0,0 @@ ---- -head: - - - meta - - name: "twitter:title" - content: Go SDK Deposit Example | zkSync Docs ---- - -# Deposit - -## Deposit ETH - -This is an example of how to deposit ETH from Ethereum network (L1) to zkSync Era network (L2): - -```go -package main - -import ( - "context" - "fmt" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/ethclient" - "github.com/zksync-sdk/zksync2-go/accounts" - "github.com/zksync-sdk/zksync2-go/clients" - "github.com/zksync-sdk/zksync2-go/utils" - "log" - "math/big" - "os" -) - -func main() { - var ( - PrivateKey = os.Getenv("PRIVATE_KEY") - ZkSyncEraProvider = "https://sepolia.era.zksync.dev" - EthereumProvider = "https://rpc.ankr.com/eth_sepolia" - ) - - // Connect to zkSync network - client, err := clients.Dial(ZkSyncEraProvider) - if err != nil { - log.Panic(err) - } - defer client.Close() - - // Connect to Ethereum network - ethClient, err := ethclient.Dial(EthereumProvider) - if err != nil { - log.Panic(err) - } - defer ethClient.Close() - - // Create wallet - wallet, err := accounts.NewWallet(common.Hex2Bytes(PrivateKey), &client, ethClient) - if err != nil { - log.Panic(err) - } - - // Show balance before deposit - balance, err := wallet.Balance(context.Background(), utils.EthAddress, nil) - if err != nil { - log.Panic(err) - } - fmt.Println("Balance before deposit: ", balance) - - // Perform deposit - tx, err := wallet.Deposit(nil, accounts.DepositTransaction{ - Token: utils.EthAddress, - Amount: big.NewInt(1_000_000_000), - To: wallet.Address(), - }) - if err != nil { - log.Panic(err) - } - fmt.Println("L1 transaction: ", tx.Hash()) - - // Wait for deposit transaction to be finalized on L1 network - fmt.Println("Waiting for deposit transaction to be finalized on L1 network") - _, err = bind.WaitMined(context.Background(), ethClient, tx) - if err != nil { - log.Panic(err) - } - - // Get transaction receipt for deposit transaction on L1 network - l1Receipt, err := ethClient.TransactionReceipt(context.Background(), tx.Hash()) - if err != nil { - log.Panic(err) - } - // Get deposit transaction on L2 network - l2Tx, err := client.L2TransactionFromPriorityOp(context.Background(), l1Receipt) - if err != nil { - log.Panic(err) - } - - fmt.Println("L2 transaction", l2Tx.Hash) - - // Wait for deposit transaction to be finalized on L2 network (5-7 minutes) - fmt.Println("Waiting for deposit transaction to be finalized on L2 network (5-7 minutes)") - _, err = client.WaitMined(context.Background(), l2Tx.Hash) - if err != nil { - log.Panic(err) - } - - balance, err = wallet.Balance(context.Background(), utils.EthAddress, nil) - if err != nil { - log.Panic(err) - } - fmt.Println("Balance after deposit: ", balance) -} -``` - -## Deposit tokens - -This is an example of how to deposit tokens from Ethereum network (L1) to zkSync Era network (L2): - -```go -package main - -import ( - "context" - "fmt" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/ethclient" - "github.com/zksync-sdk/zksync2-go/accounts" - "github.com/zksync-sdk/zksync2-go/clients" - "github.com/zksync-sdk/zksync2-go/contracts/erc20" - "github.com/zksync-sdk/zksync2-go/utils" - "log" - "math/big" - "os" -) - -func main() { - var ( - PrivateKey = os.Getenv("PRIVATE_KEY") - ZkSyncEraProvider = "https://testnet.era.zksync.dev" - EthereumProvider = "https://rpc.ankr.com/eth_goerli" - TokenL1Address = common.HexToAddress("0x56E69Fa1BB0d1402c89E3A4E3417882DeA6B14Be") - ) - - // Connect to zkSync network - client, err := clients.Dial(ZkSyncEraProvider) - if err != nil { - log.Panic(err) - } - defer client.Close() - - // Connect to Ethereum network - ethClient, err := ethclient.Dial(EthereumProvider) - if err != nil { - log.Panic(err) - } - defer ethClient.Close() - - // Create wallet - wallet, err := accounts.NewWallet(common.Hex2Bytes(PrivateKey), &client, ethClient) - if err != nil { - log.Panic(err) - } - - // Get token contract on Ethereum network - tokenL1, err := erc20.NewIERC20(TokenL1Address, ethClient) - if err != nil { - log.Panic(err) - } - - // Show balances before deposit - balance, err := wallet.Balance(context.Background(), utils.EthAddress, nil) - if err != nil { - log.Panic(err) - } - tokenBalance, err := tokenL1.BalanceOf(nil, wallet.Address()) - if err != nil { - log.Panic(err) - } - - fmt.Println("Balance before deposit on L1 network: ", balance) - fmt.Println("Token balance before deposit on L1 network: ", tokenBalance) - - tx, err := wallet.Deposit(nil, accounts.DepositTransaction{ - Token: TokenL1Address, - Amount: big.NewInt(5), - To: wallet.Address(), - ApproveERC20: true, - RefundRecipient: wallet.Address(), - }) - if err != nil { - log.Panic(err) - } - - fmt.Println("L1 deposit transaction: ", tx.Hash()) - - // Wait for deposit transaction to be finalized on L1 network - fmt.Println("Waiting for deposit transaction to be finalized on L1 network") - _, err = bind.WaitMined(context.Background(), ethClient, tx) - if err != nil { - log.Panic(err) - } - - // Get transaction receipt for deposit transaction on L1 network - l1Receipt, err := ethClient.TransactionReceipt(context.Background(), tx.Hash()) - if err != nil { - log.Panic(err) - } - - // Get deposit transaction hash on L2 network - l2Tx, err := client.L2TransactionFromPriorityOp(context.Background(), l1Receipt) - if err != nil { - log.Panic(err) - } - fmt.Println("L2 transaction", l2Tx.Hash) - - // Wait for deposit transaction to be finalized on L2 network (5-7 minutes) - fmt.Println("Waiting for deposit transaction to be finalized on L2 network (5-7 minutes)") - _, err = client.WaitMined(context.Background(), l2Tx.Hash) - if err != nil { - log.Panic(err) - } - - balance, err = wallet.Balance(context.Background(), utils.EthAddress, nil) - if err != nil { - log.Panic(err) - } - tokenBalance, err = tokenL1.BalanceOf(nil, wallet.Address()) - if err != nil { - log.Panic(err) - } - - fmt.Println("Balance after deposit on L1 network: ", balance) - fmt.Println("Token balance after deposit on L1 network: ", tokenBalance) - - tokenL2Address, err := client.L2TokenAddress(context.Background(), TokenL1Address) - if err != nil { - log.Panic(err) - } - - fmt.Println("Token L2 address: ", tokenL2Address) - - tokenL2Balance, err := wallet.Balance(context.Background(), tokenL2Address, nil) - if err != nil { - log.Panic(err) - } - - fmt.Println("Token balance on L2 network: ", tokenL2Balance) -} -``` - -## Claim failed deposit - -If the deposit L2 transaction has failed, execute the following script in order to withdraw funds to depositor: - -```go -package main - -import ( - "fmt" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/ethclient" - "github.com/zksync-sdk/zksync2-go/accounts" - "github.com/zksync-sdk/zksync2-go/clients" - "log" - "os" -) - -func main() { - var ( - PrivateKey = os.Getenv("PRIVATE_KEY") - ZkSyncEraProvider = "https://sepolia.era.zksync.dev" - EthereumProvider = "https://rpc.ankr.com/eth_sepolia" - DepositL2Tx = common.HexToHash("") - ) - - // Connect to zkSync network - client, err := clients.Dial(ZkSyncEraProvider) - if err != nil { - log.Panic(err) - } - defer client.Close() - - // Connect to Ethereum network - ethClient, err := ethclient.Dial(EthereumProvider) - if err != nil { - log.Panic(err) - } - defer ethClient.Close() - - // Create wallet - wallet, err := accounts.NewWallet(common.Hex2Bytes(PrivateKey), &client, ethClient) - if err != nil { - log.Panic(err) - } - - claimTx, err := wallet.ClaimFailedDeposit(nil, DepositL2Tx) - if err != nil { - fmt.Println(err) // this should be triggered if deposit was successful - } - fmt.Println("ClaimFailedDeposit hash: ", claimTx.Hash()) - -} -``` diff --git a/docs/build/sdks/go/examples/get-confirmed-tokens.md b/docs/build/sdks/go/examples/get-confirmed-tokens.md deleted file mode 100644 index f927a42a30..0000000000 --- a/docs/build/sdks/go/examples/get-confirmed-tokens.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -head: - - - meta - - name: "twitter:title" - content: Go SDK Get Tokens Example | zkSync Docs ---- - -# Get All Confirmed Tokens on zkSync Era - -Following example shows how to get all confirmed tokens on zkSync Era. - -```go -package main - -import ( - "context" - "fmt" - "github.com/zksync-sdk/zksync2-go/clients" - "log" -) - -func main() { - var ( - ZkSyncEraProvider = "https://sepolia.era.zksync.dev" - ) - - client, err := clients.Dial(ZkSyncEraProvider) - if err != nil { - log.Panic(err) - } - defer client.Close() - - // get first 255 tokens - tokens, err := client.ConfirmedTokens(context.Background(), 0, 255) - if err != nil { - log.Panic(err) - } - - for _, token := range tokens { - fmt.Printf("%+v\n", *token) - } -} - -``` diff --git a/docs/build/sdks/go/examples/transfer.md b/docs/build/sdks/go/examples/transfer.md deleted file mode 100644 index 4125d79a50..0000000000 --- a/docs/build/sdks/go/examples/transfer.md +++ /dev/null @@ -1,180 +0,0 @@ ---- -head: - - - meta - - name: "twitter:title" - content: Go SDK Transfer Example | zkSync Docs ---- - -# Transfer - -## Transfer ETH - -Here is an example on how to transfer ETH on zkSync Era network. - -```go -package main - -import ( - "context" - "fmt" - "github.com/ethereum/go-ethereum/common" - "github.com/zksync-sdk/zksync2-go/accounts" - "github.com/zksync-sdk/zksync2-go/clients" - "github.com/zksync-sdk/zksync2-go/utils" - "log" - "math/big" - "os" -) - -func main() { - var ( - PrivateKey1 = os.Getenv("PRIVATE_KEY") - PublicKey2 = "0x81E9D85b65E9CC8618D85A1110e4b1DF63fA30d9" - ZkSyncEraProvider = "https://sepolia.era.zksync.dev" - ) - - // Connect to zkSync network - client, err := clients.Dial(ZkSyncEraProvider) - if err != nil { - log.Panic(err) - } - defer client.Close() - - // Create wallet - wallet, err := accounts.NewWallet(common.Hex2Bytes(PrivateKey1), &client, nil) - if err != nil { - log.Panic(err) - } - - // Show balances before transfer for both accounts - account1Balance, err := wallet.Balance(context.Background(), utils.EthAddress, nil) - if err != nil { - log.Panic(err) - } - account2Balance, err := client.BalanceAt(context.Background(), common.HexToAddress(PublicKey2), nil) - if err != nil { - log.Panic(err) - } - fmt.Println("Account1 balance before transfer: ", account1Balance) - fmt.Println("Account2 balance before transfer: ", account2Balance) - - // Perform transfer - tx, err := wallet.Transfer(nil, accounts.TransferTransaction{ - To: common.HexToAddress(PublicKey2), - Amount: big.NewInt(1_000_000_000), - Token: utils.EthAddress, - }) - if err != nil { - log.Panic(err) - } - fmt.Println("Transaction: ", tx.Hash()) - - // Wait for transaction to be finalized on L2 network - _, err = client.WaitMined(context.Background(), tx.Hash()) - if err != nil { - log.Panic(err) - } - - // Show balances after transfer for both accounts - account1Balance, err = wallet.Balance(context.Background(), utils.EthAddress, nil) - if err != nil { - log.Panic(err) - } - account2Balance, err = client.BalanceAt(context.Background(), common.HexToAddress(PublicKey2), nil) - if err != nil { - log.Panic(err) - } - fmt.Println("Account1 balance after transfer: ", account1Balance) - fmt.Println("Account2 balance after transfer: ", account2Balance) -} -``` - -## Transfer tokens - -Here is an example on how to transfer tokens on zkSync Era network. - -```go -package main - -import ( - "context" - "fmt" - "github.com/ethereum/go-ethereum/common" - "github.com/zksync-sdk/zksync2-go/accounts" - "github.com/zksync-sdk/zksync2-go/clients" - "github.com/zksync-sdk/zksync2-go/contracts/erc20" - "log" - "math/big" - "os" -) - -func main() { - var ( - PrivateKey1 = os.Getenv("PRIVATE_KEY") - PublicKey2 = "0x81E9D85b65E9CC8618D85A1110e4b1DF63fA30d9" - ZkSyncEraProvider = "https://sepolia.era.zksync.dev" - TokenL2Address = common.HexToAddress("0x6a4Fb925583F7D4dF82de62d98107468aE846FD1") - ) - - // Connect to zkSync network - client, err := clients.Dial(ZkSyncEraProvider) - if err != nil { - log.Panic(err) - } - defer client.Close() - - // Create wallet - wallet, err := accounts.NewWallet(common.Hex2Bytes(PrivateKey1), &client, nil) - if err != nil { - log.Panic(err) - } - - // Get token contract on zkSync network - token, err := erc20.NewIERC20(TokenL2Address, client) - if err != nil { - log.Panic(err) - } - - account1TokenBalance, err := token.BalanceOf(nil, wallet.Address()) - if err != nil { - log.Panic(err) - } - account2TokenBalance, err := token.BalanceOf(nil, common.HexToAddress(PublicKey2)) - if err != nil { - log.Panic(err) - } - - fmt.Println("Account 1 token balance before transfer: ", account1TokenBalance) - fmt.Println("Account 2 token balance before transfer: ", account2TokenBalance) - - // Perform transfer - tx, err := wallet.Transfer(nil, accounts.TransferTransaction{ - To: common.HexToAddress(PublicKey2), - Amount: big.NewInt(1), - Token: TokenL2Address, - }) - if err != nil { - log.Panic(err) - } - fmt.Println("Transaction: ", tx.Hash()) - - // Wait for transaction to be finalized on L2 network - _, err = client.WaitMined(context.Background(), tx.Hash()) - if err != nil { - log.Panic(err) - } - - account1TokenBalance, err = token.BalanceOf(nil, wallet.Address()) - if err != nil { - log.Panic(err) - } - account2TokenBalance, err = token.BalanceOf(nil, common.HexToAddress(PublicKey2)) - if err != nil { - log.Panic(err) - } - - fmt.Println("Account 1 token balance after transfer: ", account1TokenBalance) - fmt.Println("Account 2 token balance after transfer: ", account2TokenBalance) - -} -``` diff --git a/docs/build/sdks/go/examples/withdraw.md b/docs/build/sdks/go/examples/withdraw.md deleted file mode 100644 index 4ae551026b..0000000000 --- a/docs/build/sdks/go/examples/withdraw.md +++ /dev/null @@ -1,204 +0,0 @@ ---- -head: - - - meta - - name: "twitter:title" - content: Go SDK Withdraw Example | zkSync Docs ---- - -# Withdrawal - -When it comes to withdrawals there are several notes that needs to be taken into account: - -- Withdrawal flow consist of two steps: - - Executing withdrawal transaction on L2 which initiates submission to L1. - - Executing finalize withdrawal after the withdrawal transaction is submitted to L1. -- The duration for [submitting a withdrawal transaction to L1](../../../support/withdrawal-delay.md) - can last up to 24 hours. -- On the testnet, withdrawals are [automatically finalized](../../../developer-reference/bridging-asset.md#withdrawals-to-l1). - There is no need to execute finalize withdrawal step, otherwise, an error with code `jj` would occur. - -## Withdraw ETH - -This is an example of how to withdraw ETH from zkSync Era network (L2) to Ethereum network (L1): - -```go -package main - -import ( - "fmt" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/ethclient" - "github.com/zksync-sdk/zksync2-go/accounts" - "github.com/zksync-sdk/zksync2-go/clients" - "github.com/zksync-sdk/zksync2-go/utils" - "log" - "math/big" - "os" -) - -func main() { - var ( - PrivateKey = os.Getenv("PRIVATE_KEY") - ZkSyncEraProvider = "https://sepolia.era.zksync.dev" - EthereumProvider = "https://rpc.ankr.com/eth_sepolia" - ) - - // Connect to zkSync network - client, err := clients.Dial(ZkSyncEraProvider) - if err != nil { - log.Panic(err) - } - defer client.Close() - - // Connect to Ethereum network - ethClient, err := ethclient.Dial(EthereumProvider) - if err != nil { - log.Panic(err) - } - defer ethClient.Close() - - // Create wallet - wallet, err := accounts.NewWallet(common.Hex2Bytes(PrivateKey), &client, ethClient) - if err != nil { - log.Panic(err) - } - - // Perform withdrawal - tx, err := wallet.Withdraw(nil, accounts.WithdrawalTransaction{ - To: wallet.Address(), - Amount: big.NewInt(1_000_000_000), - Token: utils.EthAddress, - }) - if err != nil { - log.Panic(err) - } - fmt.Println("Withdraw transaction: ", tx.Hash()) -} -``` - -## Withdraw tokens - -This is an example of how to withdraw tokens from zkSync Era network (L2) to Ethereum network (L1): - -```go -package main - -import ( - "fmt" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/ethclient" - "github.com/zksync-sdk/zksync2-go/accounts" - "github.com/zksync-sdk/zksync2-go/clients" - "log" - "math/big" - "os" -) - -func main() { - var ( - PrivateKey = os.Getenv("PRIVATE_KEY") - ZkSyncEraProvider = "https://sepolia.era.zksync.dev" - EthereumProvider = "https://rpc.ankr.com/eth_sepolia" - TokenL2Address = common.HexToAddress("0x6a4Fb925583F7D4dF82de62d98107468aE846FD1") - ) - - // Connect to zkSync network - client, err := clients.Dial(ZkSyncEraProvider) - if err != nil { - log.Panic(err) - } - defer client.Close() - - // Connect to Ethereum network - ethClient, err := ethclient.Dial(EthereumProvider) - if err != nil { - log.Panic(err) - } - defer ethClient.Close() - - // Create wallet - wallet, err := accounts.NewWallet(common.Hex2Bytes(PrivateKey), &client, ethClient) - if err != nil { - log.Panic(err) - } - - // Perform withdraw - tx, err := wallet.Withdraw(nil, accounts.WithdrawalTransaction{ - To: wallet.Address(), - Amount: big.NewInt(1), - Token: TokenL2Address, - }) - if err != nil { - log.Panic(err) - } - fmt.Println("Withdraw transaction: ", tx.Hash()) -} -``` - -## Finalize withdrawal - -```go -package main - -import ( - "context" - "fmt" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/ethclient" - "github.com/zksync-sdk/zksync2-go/accounts" - "github.com/zksync-sdk/zksync2-go/clients" - "log" - "os" -) - -func main() { - var ( - PrivateKey = os.Getenv("PRIVATE_KEY") - ZkSyncEraProvider = "https://sepolia.era.zksync.dev" - EthereumProvider = "https://rpc.ankr.com/eth_sepolia" - WithdrawTx = common.HexToHash("") - ) - - // Connect to zkSync network - client, err := clients.Dial(ZkSyncEraProvider) - if err != nil { - log.Panic(err) - } - defer client.Close() - - // Connect to Ethereum network - ethClient, err := ethclient.Dial(EthereumProvider) - if err != nil { - log.Panic(err) - } - defer ethClient.Close() - - // Create wallet - wallet, err := accounts.NewWallet(common.Hex2Bytes(PrivateKey), &client, ethClient) - if err != nil { - log.Panic(err) - } - - // Check if the withdrawal is finalized - if isFinalized, errFinalized := wallet.IsWithdrawFinalized(nil, WithdrawTx, 0); errFinalized != nil { - log.Panic(errFinalized) - } else if !isFinalized { - // Perform the finalize withdrawal - finalizeWithdrawTx, errWithdraw := wallet.FinalizeWithdraw(nil, WithdrawTx, 0) - if errWithdraw != nil { - log.Panic(errWithdraw) - } - fmt.Println("Finalize withdraw transaction: ", finalizeWithdrawTx.Hash()) - - // Wait for finalize withdraw transaction to be finalized on L1 network - fmt.Println("Waiting for finalize withdraw transaction to be finalized on L1 network") - _, err = bind.WaitMined(context.Background(), ethClient, finalizeWithdrawTx) - if err != nil { - log.Panic(err) - } - } - -} - -``` diff --git a/docs/build/sdks/go/getting-started.md b/docs/build/sdks/go/getting-started.md index 8b67fc9aaa..2d25c17639 100644 --- a/docs/build/sdks/go/getting-started.md +++ b/docs/build/sdks/go/getting-started.md @@ -102,15 +102,14 @@ fmt.Printf("%+v\n", transactionByHash) Also, the following examples demonstrate how to: -1. [Deposit ETH and tokens from Ethereum into zkSync Era](examples/deposit.md). -2. [Transfer ETH and tokens on zkSync Era](examples/transfer.md). -3. [Withdraw ETH and tokens from zkSync Era to Ethereum](examples/withdraw.md). -4. [Get confirmed tokens on zkSync Era](examples/get-confirmed-tokens.md). -5. [Deploy a smart contract using CREATE opcode](examples/create.md). -6. [Deploy a smart contract using CREATE2 opcode](examples/create2.md). -7. [Deploy custom token on zkSync Era](examples/custom-paymaster/deploy-token.md). -8. [Deploy smart account](examples/custom-paymaster/deploy-account.md). -9. [Use paymaster to pay fee with token](examples/custom-paymaster/use-paymaster.md). +1. [Deposit ETH and tokens from Ethereum into zkSync Era](https://github.com/zksync-sdk/zksync2-examples/blob/main/go/01_deposit.go). +2. [Transfer ETH and tokens on zkSync Era](https://github.com/zksync-sdk/zksync2-examples/blob/main/go/02_transfer.go). +3. [Withdraw ETH and tokens from zkSync Era to Ethereum](https://github.com/zksync-sdk/zksync2-examples/blob/main/go/03_withdraw.go). +4. [Deploy a smart contract using CREATE opcode](https://github.com/zksync-sdk/zksync2-examples/blob/main/go/09_deploy_create.go). +5. [Deploy a smart contract using CREATE2 opcode](https://github.com/zksync-sdk/zksync2-examples/blob/main/go/12_deploy_create2.go). +6. [Deploy custom token on zkSync Era](https://github.com/zksync-sdk/zksync2-examples/blob/main/go/15_deploy_token_create.go). +7. [Deploy smart account](https://github.com/zksync-sdk/zksync2-examples/blob/main/go/17_deploy_create_account.go). +8. [Use paymaster to pay fee with token](https://github.com/zksync-sdk/zksync2-examples/blob/main/go/19_use_paymaster.go). Full code for all examples is available [here](https://github.com/zksync-sdk/zksync2-examples/tree/main/go). Examples are configured to interact with `zkSync Era`, and `Sepolia` test networks. diff --git a/docs/build/sdks/go/paymaster-utils.md b/docs/build/sdks/go/paymaster-utils.md index 616c69d002..4036432e72 100644 --- a/docs/build/sdks/go/paymaster-utils.md +++ b/docs/build/sdks/go/paymaster-utils.md @@ -73,4 +73,4 @@ func GetPaymasterParams(paymasterAddress common.Address, paymasterInput types.Pa ``` Find out more about the [`PaymasterInput` type](types/types.md). -Check out the [example](examples/custom-paymaster/use-paymaster.md) how to use paymaster. +Check out the [example](https://github.com/zksync-sdk/zksync2-examples/blob/main/go/19_use_paymaster.go) how to use paymaster. diff --git a/firebase.json b/firebase.json index e1fed162c9..1852e99225 100644 --- a/firebase.json +++ b/firebase.json @@ -483,6 +483,76 @@ "destination": "/build/sdks/go/utils.html", "type": "302" }, + { + "source": "/docs/api/go/types/accounts.html", + "destination": "/build/sdks/go/types/accounts.html", + "type": "302" + }, + { + "source": "/docs/api/go/types/clients.html", + "destination": "/build/sdks/go/types/clients.html", + "type": "302" + }, + { + "source": "/docs/api/go/types/eip712.html", + "destination": "/build/sdks/go/types/eip712.html", + "type": "302" + }, + { + "source": "/docs/api/go/types/intro.html", + "destination": "/build/sdks/go/types/intro.html", + "type": "302" + }, + { + "source": "/docs/api/go/types/types.html", + "destination": "/build/sdks/go/types/types.html", + "type": "302" + }, + { + "source": "/docs/api/go/examples/create.html", + "destination": "/build/sdks/go/getting-started.html#examples", + "type": "302" + }, + { + "source": "/docs/api/go/examples/create2.html", + "destination": "/build/sdks/go/getting-started.html#examples", + "type": "302" + }, + { + "source": "/docs/api/go/examples/deposit.html", + "destination": "/build/sdks/go/getting-started.html#examples", + "type": "302" + }, + { + "source": "/docs/api/go/examples/get-confirmed-tokens.html", + "destination": "/build/sdks/go/getting-started.html#examples", + "type": "302" + }, + { + "source": "/docs/api/go/examples/transfer.html", + "destination": "/build/sdks/go/getting-started.html#examples", + "type": "302" + }, + { + "source": "/docs/api/go/examples/withdraw.html", + "destination": "/build/sdks/go/getting-started.html#examples", + "type": "302" + }, + { + "source": "/docs/api/go/examples/custom-paymaster/deploy-account.html", + "destination": "/build/sdks/go/getting-started.html#examples", + "type": "302" + }, + { + "source": "/docs/api/go/examples/custom-paymaster/deploy-token.html", + "destination": "/build/sdks/go/getting-started.html#examples", + "type": "302" + }, + { + "source": "/docs/api/go/examples/custom-paymaster/use-paymaster.html", + "destination": "/build/sdks/go/getting-started.html#examples", + "type": "302" + }, { "source": "/docs/api/java/", "destination": "/build/sdks/java/", @@ -998,61 +1068,6 @@ "destination": "/build/tooling/zksync-cli/getting-started.html", "type": "302" }, - { - "source": "/docs/api/go/examples/create.html", - "destination": "/build/sdks/go/examples/create.html", - "type": "302" - }, - { - "source": "/docs/api/go/examples/create2.html", - "destination": "/build/sdks/go/examples/create2.html", - "type": "302" - }, - { - "source": "/docs/api/go/examples/deposit.html", - "destination": "/build/sdks/go/examples/deposit.html", - "type": "302" - }, - { - "source": "/docs/api/go/examples/get-confirmed-tokens.html", - "destination": "/build/sdks/go/examples/get-confirmed-tokens.html", - "type": "302" - }, - { - "source": "/docs/api/go/examples/transfer.html", - "destination": "/build/sdks/go/examples/transfer.html", - "type": "302" - }, - { - "source": "/docs/api/go/examples/withdraw.html", - "destination": "/build/sdks/go/examples/withdraw.html", - "type": "302" - }, - { - "source": "/docs/api/go/types/accounts.html", - "destination": "/build/sdks/go/types/accounts.html", - "type": "302" - }, - { - "source": "/docs/api/go/types/clients.html", - "destination": "/build/sdks/go/types/clients.html", - "type": "302" - }, - { - "source": "/docs/api/go/types/eip712.html", - "destination": "/build/sdks/go/types/eip712.html", - "type": "302" - }, - { - "source": "/docs/api/go/types/intro.html", - "destination": "/build/sdks/go/types/intro.html", - "type": "302" - }, - { - "source": "/docs/api/go/types/types.html", - "destination": "/build/sdks/go/types/types.html", - "type": "302" - }, { "source": "/docs/api/js/zksync2-js/", "destination": "/build/sdks/js/zksync-ethers/getting-started.html", @@ -1128,21 +1143,6 @@ "destination": "/build/tooling/zksync-cli/examples/contract-interaction.html", "type": "302" }, - { - "source": "/docs/api/go/examples/custom-paymaster/deploy-account.html", - "destination": "/build/sdks/go/examples/custom-paymaster/deploy-account.html", - "type": "302" - }, - { - "source": "/docs/api/go/examples/custom-paymaster/deploy-token.html", - "destination": "/build/sdks/go/examples/custom-paymaster/deploy-token.html", - "type": "302" - }, - { - "source": "/docs/api/go/examples/custom-paymaster/use-paymaster.html", - "destination": "/build/sdks/go/examples/custom-paymaster/use-paymaster.html", - "type": "302" - }, { "source": "/docs/api/js/zksync2-js/examples/create.html", "destination": "/build/sdks/js/zksync-ethers/getting-started.html#examples", @@ -1698,6 +1698,76 @@ "destination": "/build/sdks/go/utils.html", "type": "302" }, + { + "source": "/docs/api/go/types/accounts.html", + "destination": "/build/sdks/go/types/accounts.html", + "type": "302" + }, + { + "source": "/docs/api/go/types/clients.html", + "destination": "/build/sdks/go/types/clients.html", + "type": "302" + }, + { + "source": "/docs/api/go/types/eip712.html", + "destination": "/build/sdks/go/types/eip712.html", + "type": "302" + }, + { + "source": "/docs/api/go/types/intro.html", + "destination": "/build/sdks/go/types/intro.html", + "type": "302" + }, + { + "source": "/docs/api/go/types/types.html", + "destination": "/build/sdks/go/types/types.html", + "type": "302" + }, + { + "source": "/docs/api/go/examples/create.html", + "destination": "/build/sdks/go/getting-started.html#examples", + "type": "302" + }, + { + "source": "/docs/api/go/examples/create2.html", + "destination": "/build/sdks/go/getting-started.html#examples", + "type": "302" + }, + { + "source": "/docs/api/go/examples/deposit.html", + "destination": "/build/sdks/go/getting-started.html#examples", + "type": "302" + }, + { + "source": "/docs/api/go/examples/get-confirmed-tokens.html", + "destination": "/build/sdks/go/getting-started.html#examples", + "type": "302" + }, + { + "source": "/docs/api/go/examples/transfer.html", + "destination": "/build/sdks/go/getting-started.html#examples", + "type": "302" + }, + { + "source": "/docs/api/go/examples/withdraw.html", + "destination": "/build/sdks/go/getting-started.html#examples", + "type": "302" + }, + { + "source": "/docs/api/go/examples/custom-paymaster/deploy-account.html", + "destination": "/build/sdks/go/getting-started.html#examples", + "type": "302" + }, + { + "source": "/docs/api/go/examples/custom-paymaster/deploy-token.html", + "destination": "/build/sdks/go/getting-started.html#examples", + "type": "302" + }, + { + "source": "/docs/api/go/examples/custom-paymaster/use-paymaster.html", + "destination": "/build/sdks/go/getting-started.html#examples", + "type": "302" + }, { "source": "/docs/api/java/", "destination": "/build/sdks/java/", @@ -2213,61 +2283,6 @@ "destination": "/build/tooling/zksync-cli/getting-started.html", "type": "302" }, - { - "source": "/docs/api/go/examples/create.html", - "destination": "/build/sdks/go/examples/create.html", - "type": "302" - }, - { - "source": "/docs/api/go/examples/create2.html", - "destination": "/build/sdks/go/examples/create2.html", - "type": "302" - }, - { - "source": "/docs/api/go/examples/deposit.html", - "destination": "/build/sdks/go/examples/deposit.html", - "type": "302" - }, - { - "source": "/docs/api/go/examples/get-confirmed-tokens.html", - "destination": "/build/sdks/go/examples/get-confirmed-tokens.html", - "type": "302" - }, - { - "source": "/docs/api/go/examples/transfer.html", - "destination": "/build/sdks/go/examples/transfer.html", - "type": "302" - }, - { - "source": "/docs/api/go/examples/withdraw.html", - "destination": "/build/sdks/go/examples/withdraw.html", - "type": "302" - }, - { - "source": "/docs/api/go/types/accounts.html", - "destination": "/build/sdks/go/types/accounts.html", - "type": "302" - }, - { - "source": "/docs/api/go/types/clients.html", - "destination": "/build/sdks/go/types/clients.html", - "type": "302" - }, - { - "source": "/docs/api/go/types/eip712.html", - "destination": "/build/sdks/go/types/eip712.html", - "type": "302" - }, - { - "source": "/docs/api/go/types/intro.html", - "destination": "/build/sdks/go/types/intro.html", - "type": "302" - }, - { - "source": "/docs/api/go/types/types.html", - "destination": "/build/sdks/go/types/types.html", - "type": "302" - }, { "source": "/docs/api/js/zksync2-js/", "destination": "/build/sdks/js/zksync-ethers/getting-started.html", @@ -2343,21 +2358,6 @@ "destination": "/build/tooling/zksync-cli/examples/contract-interaction.html", "type": "302" }, - { - "source": "/docs/api/go/examples/custom-paymaster/deploy-account.html", - "destination": "/build/sdks/go/examples/custom-paymaster/deploy-account.html", - "type": "302" - }, - { - "source": "/docs/api/go/examples/custom-paymaster/deploy-token.html", - "destination": "/build/sdks/go/examples/custom-paymaster/deploy-token.html", - "type": "302" - }, - { - "source": "/docs/api/go/examples/custom-paymaster/use-paymaster.html", - "destination": "/build/sdks/go/examples/custom-paymaster/use-paymaster.html", - "type": "302" - }, { "source": "/docs/api/js/zksync2-js/examples/create.html", "destination": "/build/sdks/js/zksync-ethers/getting-started.html#examples",