diff --git a/.github/workflows/deploy-prod.yml b/.github/workflows/deploy-prod.yml new file mode 100644 index 00000000..309816cc --- /dev/null +++ b/.github/workflows/deploy-prod.yml @@ -0,0 +1,38 @@ +name: "deploy 🚀" +on: + push: + branches: [main] + +env: + HUSKY: 0 + CI: true + +concurrency: + group: production + cancel-in-progress: true + +jobs: + build_and_deploy: + env: + NUXT_UI_PRO_LICENSE: ${{ secrets.NUXT_UI_PRO_LICENSE }} + if: ${{ github.event.repository.full_name == github.repository }} + runs-on: ubuntu-latest + environment: production + steps: + - uses: actions/checkout@v4 # v4 + with: + persist-credentials: false # <--- checking this in commit context + + - uses: oven-sh/setup-bun@v1 + + - name: "Install dependencies" + run: bun install --production --frozen-lockfile + - name: "Deploy target: staging" + run: bun run build + + - uses: matter-labs/action-hosting-deploy@main + with: + repoToken: "${{ secrets.GITHUB_TOKEN }}" + firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_SDK_DOCS_7B113 }}" + projectId: sdk-docs-7b113 + channelId: live diff --git a/app.vue b/app.vue index 056eebe8..953b6d52 100644 --- a/app.vue +++ b/app.vue @@ -11,17 +11,17 @@ useHead({ }, }); +const seoDescription = + 'ZKsync SDK Docs is a collection of guides, references and resources on building with ZKsync SDKs.'; + useSeoMeta({ titleTemplate: `%s - ${seo?.siteName}`, ogSiteName: seo?.siteName, ogUrl: 'https://docs.zksync.io/', ogImageAlt: 'Hyperscaling Ethereum with ZK tech.', - ogDescription: - 'ZKsync Docs bring you all information you need about our protocol, APIs, SDKs, ZK Stack, and ZK Chains. Start with our guides and tutorials, or go deep into our architecture and protocol specification.', - description: - 'ZKsync Docs bring you all information you need about our protocol, APIs, SDKs, ZK Stack, and ZK Chains. Start with our guides and tutorials, or go deep into our architecture and protocol specification.', - twitterDescription: - 'ZKsync Docs bring you all information you need about our protocol, APIs, SDKs, ZK Stack, and ZK Chains. Start with our guides and tutorials, or go deep into our architecture and protocol specification.', + ogDescription: seoDescription, + description: seoDescription, + twitterDescription: seoDescription, twitterTitle: `%s`, twitterCard: 'summary_large_image', twitterSite: '@zksync', @@ -32,7 +32,7 @@ useSeoMeta({ defineOgImage({ component: 'OgImageZK', title: seo?.siteName, - description: 'Access detailed guides, references and resources that will help you build with ZKsync Era.', + description: 'Access detailed guides, references and resources that will help you build with ZKsync SDKs.', }); diff --git a/bun.lockb b/bun.lockb index b681a718..058119b5 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/content/sdk/00.index.md b/content/00.index.md similarity index 90% rename from content/sdk/00.index.md rename to content/00.index.md index b14e90f6..9a909bf2 100644 --- a/content/sdk/00.index.md +++ b/content/00.index.md @@ -12,7 +12,7 @@ tags: ["zksync", "sdks", "zksync Era SDK", "ethereum", "era network", "javascrip makes transactions faster and cheaper while keeping the security and trust of the Ethereum blockchain. ::div{class="text-center"} -![ZKsync Era SDKs](/images/sdk/zksync_era-sdk.png){ width="50%"} +![ZKsync Era SDKs](/images/zksync_era-sdk.png){ width="50%"} :: ### Key points @@ -44,7 +44,7 @@ These SDKs, available in various programming languages, streamline the process o and on-chain governance. ::callout{icon="i-heroicons-exclamation-triangle" color="amber"} -We strongly recommend reading [**the introduction**](/sdk#what-is-zksync-era-sdks) before moving on to the rest of the +We strongly recommend reading [**the introduction**](#what-is-zksync-era-sdks) before moving on to the rest of the documentation. :: @@ -58,7 +58,7 @@ can use ZKsync Era's scalable, secure, and low-cost transactions. --- title: JavaScript icon: i-heroicons-code-bracket -to: /sdk/js/ethers +to: /js/ethers --- Integrate JS with ZKsync Era for secure transactions. :: @@ -66,7 +66,7 @@ Integrate JS with ZKsync Era for secure transactions. --- title: GO icon: i-heroicons-cog -to: /sdk/go/introduction/overview +to: /go/introduction/overview --- Integrate ZKsync GO SDK for ZKsync Era features. :: @@ -74,7 +74,7 @@ Integrate ZKsync GO SDK for ZKsync Era features. --- title: Python icon: i-heroicons-circle-stack -to: /sdk/python/introduction/overview +to: /python/introduction/overview --- Explore Nuxt built-in components for pages, layouts, head, and more. :: @@ -82,7 +82,7 @@ Explore Nuxt built-in components for pages, layouts, head, and more. --- title: Java icon: i-heroicons-rectangle-group -to: /sdk/java/introduction/overview +to: /java/introduction/overview --- Integrate ZKsync Era with Java for cost-effective transactions. :: @@ -90,7 +90,7 @@ Integrate ZKsync Era with Java for cost-effective transactions. --- title: Swift icon: i-heroicons-rocket-launch -to: /sdk/swift/introduction/overview +to: /swift/introduction/overview --- Integrate ZKsync Era with Swift for efficiency. :: @@ -98,7 +98,7 @@ Integrate ZKsync Era with Swift for efficiency. --- title: Rust icon: i-heroicons-wrench -to: /sdk/rust/getting-started +to: /rust/getting-started --- Integrate ZKsync Era with Rust for scalable transactions. :: diff --git a/content/sdk/10.js/00.ethers/00.index.md b/content/10.js/00.ethers/00.index.md similarity index 92% rename from content/sdk/10.js/00.ethers/00.index.md rename to content/10.js/00.ethers/00.index.md index 55f53c3d..e40fd647 100644 --- a/content/sdk/10.js/00.ethers/00.index.md +++ b/content/10.js/00.ethers/00.index.md @@ -13,7 +13,7 @@ There are two main versions of the zksync-ethers SDK: V5 and V6. Each version ca distinct features and improvements. ::callout{icon="i-heroicons-light-bulb"} -Check the [installation guide](/sdk/js/ethers/installation-js) for instructions. +Check the [installation guide](/js/ethers/installation-js) for instructions. :: ## Choosing the right version @@ -29,5 +29,5 @@ Choosing the right version of the zksync-ethers SDK depends on your project requ | Community Support| Extensive community resources | Growing community support | ::callout{icon="i-heroicons-light-bulb"} -To use the `zksync-ethers` v5 or v6, visit the [Getting Started](/sdk/js/ethers/guides/getting-started) page. +To use the `zksync-ethers` v5 or v6, visit the [Getting Started](/js/ethers/guides/getting-started) page. :: diff --git a/content/sdk/10.js/00.ethers/01.why-zksync-ethers.md b/content/10.js/00.ethers/01.why-zksync-ethers.md similarity index 95% rename from content/sdk/10.js/00.ethers/01.why-zksync-ethers.md rename to content/10.js/00.ethers/01.why-zksync-ethers.md index 3187568e..277eb194 100644 --- a/content/sdk/10.js/00.ethers/01.why-zksync-ethers.md +++ b/content/10.js/00.ethers/01.why-zksync-ethers.md @@ -37,6 +37,6 @@ technologies. The SDK is regularly updated to incorporate the latest development powerful and flexible tool for building next-generation blockchain applications. ::callout{icon="i-heroicons-light-bulb"} -Explore the [zksync-ethers documentation](/sdk/js/ethers) to get started and take advantage of all the +Explore the [zksync-ethers documentation](/js/ethers) to get started and take advantage of all the features and benefits it offers. :: diff --git a/content/sdk/10.js/00.ethers/02.installation-js.md b/content/10.js/00.ethers/02.installation-js.md similarity index 95% rename from content/sdk/10.js/00.ethers/02.installation-js.md rename to content/10.js/00.ethers/02.installation-js.md index 66c2f7b4..f77c473f 100644 --- a/content/sdk/10.js/00.ethers/02.installation-js.md +++ b/content/10.js/00.ethers/02.installation-js.md @@ -8,7 +8,7 @@ Learn how to install and set up the `zksync-ethers` library to interact with the features for Ethereum scaling and Layer 2 solutions. ::callout{icon="i-heroicons-light-bulb"} -If you're migrating from `zksync-web3`, please refer to the [migration guide](/sdk/js/ethers/guides/migration) for +If you're migrating from `zksync-web3`, please refer to the [migration guide](/js/ethers/guides/migration) for detailed instructions. :: diff --git a/content/sdk/10.js/00.ethers/03.compatibility-js.md b/content/10.js/00.ethers/03.compatibility-js.md similarity index 93% rename from content/sdk/10.js/00.ethers/03.compatibility-js.md rename to content/10.js/00.ethers/03.compatibility-js.md index 14694a57..342dbbcd 100644 --- a/content/sdk/10.js/00.ethers/03.compatibility-js.md +++ b/content/10.js/00.ethers/03.compatibility-js.md @@ -27,5 +27,5 @@ environments (Node.js, React Native, Electron). Both versions offer robust platform compatibility, ensuring seamless integration with ZKsync across different environments. ::callout{icon="i-heroicons-light-bulb"} -For more detailed information and specific configurations, refer to the [official zksync-ethers documentation](https://zksync.io/sdk/js/ethers). +For more detailed information and specific configurations, refer to the [official zksync-ethers documentation](https://sdk.zksync.io/js/ethers). :: diff --git a/content/sdk/10.js/00.ethers/04.guides/00.getting-started.md b/content/10.js/00.ethers/04.guides/00.getting-started.md similarity index 100% rename from content/sdk/10.js/00.ethers/04.guides/00.getting-started.md rename to content/10.js/00.ethers/04.guides/00.getting-started.md diff --git a/content/sdk/10.js/00.ethers/04.guides/01.features.md b/content/10.js/00.ethers/04.guides/01.features.md similarity index 100% rename from content/sdk/10.js/00.ethers/04.guides/01.features.md rename to content/10.js/00.ethers/04.guides/01.features.md diff --git a/content/sdk/10.js/00.ethers/04.guides/02.accounts-l1-l2.md b/content/10.js/00.ethers/04.guides/02.accounts-l1-l2.md similarity index 91% rename from content/sdk/10.js/00.ethers/04.guides/02.accounts-l1-l2.md rename to content/10.js/00.ethers/04.guides/02.accounts-l1-l2.md index 0dbf04bf..78ae10c4 100644 --- a/content/sdk/10.js/00.ethers/04.guides/02.accounts-l1-l2.md +++ b/content/10.js/00.ethers/04.guides/02.accounts-l1-l2.md @@ -12,7 +12,7 @@ If you need background information on how L1<->L2 interactions work on ZKsync, c `Wallet` and `L1Signer` objects allow you to deposit funds from L1 to L2. -- **More Information**: See the method specification [`Deposit`](/sdk/js/ethers/api/v5/accounts/wallet#deposit). +- **More Information**: See the method specification [`Deposit`](/js/ethers/api/v5/accounts/wallet#deposit). - **Example**: Deposit ETH and ERC20 token ::collapsible @@ -54,31 +54,31 @@ main() `Wallet` and `L1Signer` objects let you request the execution of an L2 transaction from L1. -- **More Information**: See the method specification [`requestExecute`](/sdk/js/ethers/api/v5/accounts/wallet#requestexecute). +- **More Information**: See the method specification [`requestExecute`](/js/ethers/api/v5/accounts/wallet#requestexecute). ## Base cost `Wallet` and `L1Signer` objects can calculate the base cost for an L2 transaction. -- **More Information**: See the method specification [`getBaseCost`](/sdk/js/ethers/api/v5/accounts/wallet#getbasecost). +- **More Information**: See the method specification [`getBaseCost`](/js/ethers/api/v5/accounts/wallet#getbasecost). ## Claim failed deposit `Wallet` and `L1Signer` objects provide a way to claim a failed deposit. -- **More Information**: See the method specification [`claimFailedDeposit`](/sdk/js/ethers/api/v5/accounts/wallet#claimfaileddeposit). +- **More Information**: See the method specification [`claimFailedDeposit`](/js/ethers/api/v5/accounts/wallet#claimfaileddeposit). ## Finalize withdraw `Wallet` and `L1Signer` objects allow you to finalize a withdrawal from L2 to L1. -- **More Information**: See the method specification [`finalizeWithdrawal`](/sdk/js/ethers/api/v5/accounts/wallet#finalizewithdrawal). +- **More Information**: See the method specification [`finalizeWithdrawal`](/js/ethers/api/v5/accounts/wallet#finalizewithdrawal). ## Withdrawal `Wallet` and `Signer` objects enable you to withdraw funds from L2 to L1. -- **More Information**: See the method specification [`Withdraw`](/sdk/js/ethers/api/v5/accounts/wallet#withdraw). +- **More Information**: See the method specification [`Withdraw`](/js/ethers/api/v5/accounts/wallet#withdraw). - **Example**: Withdraw ETH and ERC20 token ::collapsible diff --git a/content/sdk/10.js/00.ethers/04.guides/03.front-end.md b/content/10.js/00.ethers/04.guides/03.front-end.md similarity index 93% rename from content/sdk/10.js/00.ethers/04.guides/03.front-end.md rename to content/10.js/00.ethers/04.guides/03.front-end.md index 837273ec..fce3f60f 100644 --- a/content/sdk/10.js/00.ethers/04.guides/03.front-end.md +++ b/content/10.js/00.ethers/04.guides/03.front-end.md @@ -14,4 +14,4 @@ infrastructure will work seamlessly. ## Using ZKsync Era features To deploy smart contracts or use advanced zksync features like account abstraction, you'll need the `zksync-ethers` -library. Learn the basics of `zksync-ethers` in the [ZKsync Era Features](/sdk/js/ethers/guides/features). +library. Learn the basics of `zksync-ethers` in the [ZKsync Era Features](/js/ethers/guides/features). diff --git a/content/sdk/10.js/00.ethers/04.guides/03.migration.md b/content/10.js/00.ethers/04.guides/03.migration.md similarity index 100% rename from content/sdk/10.js/00.ethers/04.guides/03.migration.md rename to content/10.js/00.ethers/04.guides/03.migration.md diff --git a/content/sdk/10.js/00.ethers/05.api/10.v5/00.providers/00.introduction.md b/content/10.js/00.ethers/05.api/10.v5/00.providers/00.introduction.md similarity index 79% rename from content/sdk/10.js/00.ethers/05.api/10.v5/00.providers/00.introduction.md rename to content/10.js/00.ethers/05.api/10.v5/00.providers/00.introduction.md index 5968d159..8eaf751d 100644 --- a/content/sdk/10.js/00.ethers/05.api/10.v5/00.providers/00.introduction.md +++ b/content/10.js/00.ethers/05.api/10.v5/00.providers/00.introduction.md @@ -12,14 +12,14 @@ the [`ethers.js`](https://docs.ethers.io/v5/api/providers) library and adds extr Two providers are available: -- [`Provider`](/sdk/js/ethers/api/v5/providers/web3provider): Functions +- [`Provider`](/js/ethers/api/v5/providers/web3provider): Functions like [`ethers.providers.JsonRpcProvider`](https://docs.ethers.org/v5/api/providers/jsonrpc-provider/#JsonRpcProvider) with added ZKsync-specific methods. -- [`Web3Provider`](/sdk/js/ethers/api/v5/providers/web3provider): Extends the ZKsync -Era [`Provider`](/sdk/js/ethers/api/v5/providers/provider) class for better compatibility with Web3 wallets. +- [`Web3Provider`](/js/ethers/api/v5/providers/web3provider): Extends the ZKsync +Era [`Provider`](/js/ethers/api/v5/providers/provider) class for better compatibility with Web3 wallets. ::callout{icon="i-heroicons-light-bulb"} -Use the [`Web3Provider`](/sdk/js/ethers/api/v5/providers/web3provider) for browser integrations. +Use the [`Web3Provider`](/js/ethers/api/v5/providers/web3provider) for browser integrations. :: ### `Provider` diff --git a/content/sdk/10.js/00.ethers/05.api/10.v5/00.providers/01.provider.md b/content/10.js/00.ethers/05.api/10.v5/00.providers/01.provider.md similarity index 97% rename from content/sdk/10.js/00.ethers/05.api/10.v5/00.providers/01.provider.md rename to content/10.js/00.ethers/05.api/10.v5/00.providers/01.provider.md index 5039367b..88416b37 100644 --- a/content/sdk/10.js/00.ethers/05.api/10.v5/00.providers/01.provider.md +++ b/content/10.js/00.ethers/05.api/10.v5/00.providers/01.provider.md @@ -26,7 +26,7 @@ async connectL2Bridge(address: Address): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const l2Bridge = await provider.connectL2Bridge(""); ``` @@ -50,13 +50,13 @@ constructor(url?: ConnectionInfo | string, network?: ethers.providers.Networkish ```ts import { Provider } from "zksync-ethers"; - + const provider = new Provider("https://sepolia.era.zksync.dev"); ``` ### `estimateFee` -Returns an estimated [`Fee`](/sdk/js/ethers/api/v5/types#fee) for requested transaction. +Returns an estimated [`Fee`](/js/ethers/api/v5/types#fee) for requested transaction. #### Inputs @@ -70,7 +70,7 @@ async estimateFee(transaction: TransactionRequest): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const fee = await provider.estimateFee({ from: "0x36615Cf349d7F6344891B1e7CA7C72883F5dc049", @@ -96,7 +96,7 @@ async estimateGas(transaction: utils.Deferrable): Promise @@ -155,7 +155,7 @@ async estimateGasL1(transaction: TransactionRequest): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const gasL1 = await provider.estimateGasL1({ from: "0x36615Cf349d7F6344891B1e7CA7C72883F5dc049", @@ -183,7 +183,7 @@ to get the transfer transaction and sends it to the [`estimateGas`](#estimategas | `amount` | `BigNumberish` | Amount of token. | | `from?` | `Address` | From address. | | `to?` | `Address` | To address. | -| `paymasterParams?` | [`PaymasterParams`](/sdk/js/ethers/api/v5/types#paymasterparams) | Paymaster parameters. | +| `paymasterParams?` | [`PaymasterParams`](/js/ethers/api/v5/types#paymasterparams) | Paymaster parameters. | | `overrides?` | `ethers.CallOverrides` | Transaction's overrides which may be used to pass l2 `gasLimit`, `gasPrice`, `value`, etc. | ```ts @@ -201,7 +201,7 @@ async estimateGasTransfer(transaction: { ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const gasTransfer = await provider.estimateGasTransfer({ token: utils.ETH_ADDRESS, @@ -228,7 +228,7 @@ withdrawal transaction and sends it to the [`estimateGas`](#estimategas) method. | `from?` | `Address` | From address. | | `to?` | `Address` | To address. | | `bridgeAddress?` | `Address` | Bridge address. | -| `paymasterParams?` | [`PaymasterParams`](/sdk/js/ethers/api/v5/types#paymasterparams) | Paymaster parameters. | +| `paymasterParams?` | [`PaymasterParams`](/js/ethers/api/v5/types#paymasterparams) | Paymaster parameters. | | `overrides?` | `ethers.CallOverrides` | Transaction's overrides which may be used to pass l2 `gasLimit`, `gasPrice`, `value`, etc. | ```ts @@ -247,7 +247,7 @@ async estimateGasWithdraw(transaction: { ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const gasWithdraw = await provider.estimateGasWithdraw({ token: utils.ETH_ADDRESS, @@ -290,7 +290,7 @@ async estimateL1ToL2Execute(transaction: { ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const gasL1ToL2 = await provider.estimateL1ToL2Execute({ contractAddress: await provider.getMainContractAddress(), @@ -322,7 +322,7 @@ async getAllAccountBalances(address: Address): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const balances = await provider.getAllAccountBalances("0x36615Cf349d7F6344891B1e7CA7C72883F5dc049"); console.log(`All balances: ${utils.toJSON(balances)}`); @@ -350,7 +350,7 @@ async getBalance(address: Address, blockTag?: BlockTag, tokenAddress?: Address) ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const account = "0x36615Cf349d7F6344891B1e7CA7C72883F5dc049"; const tokenAddress = "0x927488F48ffbc32112F1fF721759649A89721F8F"; // Crown token which can be minted for free @@ -372,7 +372,7 @@ async getBaseTokenContractAddress(): Promise
```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Base token: ${await provider.getBaseTokenContractAddress()}`); ``` @@ -389,7 +389,7 @@ async getBlock(blockHashOrBlockTag: BlockTag | string | Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Block details: ${utils.toJSON(await provider.getBlockDetails(90_000))}`); ``` @@ -433,7 +433,7 @@ async getBridgehubContractAddress(): Promise
```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Bridgehub: ${await provider.getBridgehubContractAddress()}`); ``` @@ -458,13 +458,13 @@ async getBytecodeByHash(bytecodeHash: BytesLike): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + // Bytecode hash can be computed by following these steps: // const testnetPaymasterBytecode = await provider.getCode(await provider.getTestnetPaymasterAddress()); // const testnetPaymasterBytecodeHash = ethers.utils.hexlify(utils.hashBytecode(testnetPaymasterBytecode)); - + const testnetPaymasterBytecodeHash = "0x010000f16d2b10ddeb1c32f2c9d222eb1aea0f638ec94a81d4e916c627720e30"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Bytecode: ${await provider.getBytecodeByHash(testnetPaymasterBytecodeHash)}`); ``` @@ -491,7 +491,7 @@ async getConfirmedTokens(start: number = 0, limit: number = 255): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const tokenAddress = "0x927488F48ffbc32112F1fF721759649A89721F8F"; // Crown token which can be minted for free console.log(`Contract account info: ${utils.toJSON(await provider.getContractAccountInfo(tokenAddress))}`); @@ -540,7 +540,7 @@ getDefaultBridgeAddresses(): Promise<{ ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Default bridges: ${utils.toJSON(await provider.getDefaultBridgeAddresses())}`); ``` @@ -553,7 +553,7 @@ Static method which returns a Provider object from the RPC URL or localhost. | Parameter | Type | Description | | --------------- | ------------------------------------- | ------------------------------------------------- | -| `zksyncNetwork` | [`ZkSyncNetwork`](/sdk/js/ethers/api/v5/types#network) | Type of ZKsync network. `Localhost` _by default_. | +| `zksyncNetwork` | [`ZkSyncNetwork`](/js/ethers/api/v5/types#network) | Type of ZKsync network. `Localhost` _by default_. | ```ts static getDefaultProvider(zksyncNetwork: ZkSyncNetwork = ZkSyncNetwork.Localhost) @@ -563,7 +563,7 @@ static getDefaultProvider(zksyncNetwork: ZkSyncNetwork = ZkSyncNetwork.Localhost ```ts import { Provider, types, utils } from "zksync-ethers"; - + const providerMainnet = Provider.getDefaultProvider(types.Network.Mainnet); const providerTestnet = Provider.getDefaultProvider(types.Network.Sepolia); const providerLocalnet = Provider.getDefaultProvider(types.Network.Localhost); @@ -584,7 +584,7 @@ async getFeeParams(): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const feeParams = await provider.getFeeParams(); console.log(`Fee: ${utils.toJSON(feeParams)}`); @@ -609,7 +609,7 @@ async getFilterChanges(idx: BigNumber): Promise> ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const filter = await provider.newFilter({ address: utils.L2_ETH_TOKEN_ADDRESS, @@ -630,7 +630,7 @@ static override getFormatter(): Formatter ```ts import { Provider, types, utils } from "zksync-ethers"; - + const formatter = Provider.getFormatter(); ``` @@ -646,7 +646,7 @@ async getGasPrice(): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Gas price: ${await provider.getGasPrice()}`); ``` @@ -672,7 +672,7 @@ async getL1BatchBlockRange(l1BatchNumber: number): Promise<[number, number] | nu ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const l1BatchNumber = await provider.getL1BatchNumber(); console.log(`L1 batch block range: ${utils.toJSON(await provider.getL1BatchBlockRange(l1BatchNumber))}`); @@ -698,7 +698,7 @@ async getL1BatchDetails(number: number): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const l1BatchNumber = await provider.getL1BatchNumber(); console.log(`L1 batch details: ${utils.toJSON(await provider.getL1BatchDetails(l1BatchNumber))}`); @@ -718,7 +718,7 @@ async getL1BatchNumber(): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`L1 batch number: ${await provider.getL1BatchNumber()}`); ``` @@ -741,7 +741,7 @@ async getL2TransactionFromPriorityOp(l1TxResponse: ethers.TransactionResponse): ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const l1Tx = "0xcca5411f3e514052f4a4ae1c2020badec6e0998adb52c09959c5f5ff15fba3a8"; @@ -772,7 +772,7 @@ async getLogProof(txHash: BytesLike, index ? : number): Promise L1 transaction can be used. // In this case, withdrawal transaction is used. @@ -799,7 +799,7 @@ getLogs(filter: Filter | FilterByBlockHash | Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Logs: ${utils.toJSON(await provider.getLogs({ fromBlock: 0, toBlock: 5, address: utils.L2_ETH_TOKEN_ADDRESS }))}`); ``` @@ -818,7 +818,7 @@ async getMainContractAddress(): Promise
```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Main contract: ${await provider.getMainContractAddress()}`); ``` @@ -847,7 +847,7 @@ async getPriorityOpConfirmation(txHash: string, index: number = 0): Promise<{ ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); // Any L2 -> L1 transaction can be used. // In this case, withdrawal transaction is used. @@ -874,7 +874,7 @@ async getPriorityOpResponse(l1TxResponse: ethers.TransactionResponse): Promise

uint256) internal rawNonces; - + // Ensure the address is a 256-bit number by padding it // because rawNonces slot uses uint256 for mapping addresses and their nonces. const addressPadded = ethers.utils.hexZeroPad(wallet.address, 32); - + // Convert the slot number to a hex string and pad it to 32 bytes. const slotPadded = ethers.utils.hexZeroPad(ethers.utils.hexlify(0), 32); - + // Concatenate the padded address and slot number. const concatenated = addressPadded + slotPadded.slice(2); // slice to remove '0x' from the slotPadded - + // Hash the concatenated string using Keccak-256. const storageKey = ethers.utils.keccak256(concatenated); - + const l1BatchNumber = await provider.getL1BatchNumber(); const storageProof = await provider.getProof(utils.NONCE_HOLDER_ADDRESS, [storageKey], l1BatchNumber); console.log(`Storage proof: ${utils.toJSON(storageProof)}`); @@ -952,7 +952,7 @@ async getProtocolVersion(id?: number): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Protocol version: ${await provider.getProtocolVersion()}`); ``` @@ -978,7 +978,7 @@ async getRawBlockTransactions(number: number): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Raw block transactions: ${utils.toJSON(await provider.getRawBlockTransactions(90_000))}`); ``` @@ -996,7 +996,7 @@ async getTestnetPaymasterAddress(): Promise

```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Testnet paymaster: ${await provider.getTestnetPaymasterAddress()}`); ``` @@ -1020,12 +1020,12 @@ async getTransaction(hash: string | Promise): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); - + const TX_HASH = ""; console.log(`Transaction details: ${utils.toJSON(await provider.getTransactionDetails(TX_HASH))}`); ``` @@ -1080,7 +1080,7 @@ async getTransactionReceipt(transactionHash: string | Promise): Promise< ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const TX_HASH = ""; console.log(`Transaction receipt: ${utils.toJSON(await provider.getTransactionReceipt(TX_HASH))}`); @@ -1104,9 +1104,9 @@ async getTransactionStatus(txHash: string): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); - + const TX_HASH = ""; console.log(`Transaction status: ${utils.toJSON(await provider.getTransactionStatus(TX_HASH))}`); ``` @@ -1123,7 +1123,7 @@ Returns the populated transfer transaction. | `amount` | `BigNumberish` | Amount of token. | | `from?` | `Address` | From address. | | `to?` | `Address` | To address. | -| `paymasterParams?` | [`PaymasterParams`](/sdk/js/ethers/api/v5/types#paymasterparams) | Paymaster parameters. | +| `paymasterParams?` | [`PaymasterParams`](/js/ethers/api/v5/types#paymasterparams) | Paymaster parameters. | | `overrides?` | `ethers.CallOverrides` | Transaction's overrides which may be used to pass l2 `gasLimit`, `gasPrice`, `value`, etc. | ```ts @@ -1143,9 +1143,9 @@ Retrieve populated ETH transfer transaction. ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); - + const tx = await provider.getTransferTx({ token: utils.ETH_ADDRESS, amount: 7_000_000_000, @@ -1159,11 +1159,11 @@ Retrieve populated ETH transfer transaction using paymaster to facilitate fee pa ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const token = "0x927488F48ffbc32112F1fF721759649A89721F8F"; // Crown token which can be minted for free const paymaster = "0x13D0D8550769f59aa241a41897D4859c87f7Dd46"; // Paymaster for Crown token - + const tx = await provider.getTransferTx({ token: utils.ETH_ADDRESS, amount: 7_000_000_000, @@ -1192,7 +1192,7 @@ Returns the populated withdrawal transaction. | `from?` | `Address` | From address. | | `to?` | `Address` | To address. | | `bridgeAddress?` | `Address` | Bridge address. | -| `paymasterParams?` | [`PaymasterParams`](/sdk/js/ethers/api/v5/types#paymasterparams) | Paymaster parameters. | +| `paymasterParams?` | [`PaymasterParams`](/js/ethers/api/v5/types#paymasterparams) | Paymaster parameters. | | `overrides?` | `ethers.CallOverrides` | Transaction's overrides which may be used to pass l2 `gasLimit`, `gasPrice`, `value`, etc. | ```ts @@ -1213,9 +1213,9 @@ Retrieve populated ETH withdrawal transactions. ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); - + const tx = await provider.getWithdrawTx({ token: utils.ETH_ADDRESS, amount: 7_000_000_000, @@ -1229,11 +1229,11 @@ Retrieve populated ETH withdrawal transaction using paymaster to facilitate fee ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const token = "0x927488F48ffbc32112F1fF721759649A89721F8F"; // Crown token which can be minted for free const paymaster = "0x13D0D8550769f59aa241a41897D4859c87f7Dd46"; // Paymaster for Crown token - + const tx = await provider.getWithdrawTx({ token: utils.ETH_ADDRESS, amount: 7_000_000_000, @@ -1267,7 +1267,7 @@ async isBaseToken(token: Address): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Is base token: ${await provider.isBaseToken("0x5C221E77624690fff6dd741493D735a17716c26B")}`); ``` @@ -1284,7 +1284,7 @@ async isEthBasedChain(): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Is ETH based chain: ${await provider.isEthBasedChain()}`); ``` @@ -1307,7 +1307,7 @@ async isL2BridgeLegacy(address: Address): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const isBridgeLegacy = await provider.isL2BridgeLegacy(""); console.log(isBridgeLegacy); @@ -1327,7 +1327,7 @@ async l1ChainId(): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`L1 chain ID: ${await provider.l1ChainId()}`); ``` @@ -1355,7 +1355,7 @@ async l1TokenAddress(token: Address): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`L1 token address: ${await provider.l1TokenAddress("0x3e7676937A7E96CFB7616f255b9AD9FF47363D4b")}`); ``` @@ -1384,7 +1384,7 @@ async l2TokenAddress(token: Address): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`L2 token address: ${await provider.l2TokenAddress("0x5C221E77624690fff6dd741493D735a17716c26B")}`); ``` @@ -1402,7 +1402,7 @@ async newBlockFilter(): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`New block filter: ${await provider.newBlockFilter()}`); ``` @@ -1417,7 +1417,7 @@ and passing a filter object. | Parameter | Type | Description | | --------- | --------------------------------------------------------------- | ------------- | -| `filter` | [`EventFilter`](/sdk/js/ethers/api/v5/types#eventfilter) or `Promise` | Filter query. | +| `filter` | [`EventFilter`](/js/ethers/api/v5/types#eventfilter) or `Promise` | Filter query. | ```ts async newFilter(filter: EventFilter | Promise): Promise @@ -1427,7 +1427,7 @@ async newFilter(filter: EventFilter | Promise): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log( `New filter: ${await provider.newFilter({ @@ -1452,7 +1452,7 @@ async newPendingTransactionsFilter(): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`New pending transaction filter: ${await provider.newPendingTransactionsFilter()}`); ``` @@ -1487,18 +1487,18 @@ async sendRawTransactionWithDetailedOutput(signedTx: string): Promise): Promise; ```ts import { Wallet, Provider, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + console.log(`Address: ${await wallet.getAddress()}`); ``` @@ -680,13 +680,13 @@ async getAllBalances(): Promise ```ts import { Wallet, Provider, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + const allBalances = await wallet.getAllBalances(); ``` @@ -715,13 +715,13 @@ async getAllowanceL1( ```ts import { Wallet, Provider, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + const tokenL1 = "0x5C221E77624690fff6dd741493D735a17716c26B"; console.log(`Token allowance: ${await wallet.getAllowanceL1(tokenL1)}`); ``` @@ -746,15 +746,15 @@ async getBalance(token?: Address, blockTag: BlockTag = 'committed'): Promise ```ts import { Wallet, Provider, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + const tokenL1 = "0x56E69Fa1BB0d1402c89E3A4E3417882DeA6B14Be"; - + console.log(`Token balance: ${await wallet.getBalanceL1(tokenL1)}`); ``` @@ -815,13 +815,13 @@ async getBaseCost(params: { ```ts import { Wallet, Provider, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + console.log(`Base cost: ${await wallet.getBaseCost({ gasLimit: 100_000 })}`); ``` @@ -838,13 +838,13 @@ async getBaseToken(): Promise ```ts import { Wallet, Provider, types, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + console.log(`Base token: ${await wallet.getBaseToken()}`); ``` @@ -861,13 +861,13 @@ async getBridgehubContract(): Promise ```ts import { Wallet, Provider, types, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + const bridgehub = await wallet.getBridgehubContract(); ``` @@ -884,13 +884,13 @@ async getDeploymentNonce(): Promise ```ts import { Wallet, Provider, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + console.log(`Nonce: ${await wallet.getDeploymentNonce()}`); ``` @@ -916,7 +916,7 @@ async getDepositAllowanceParams( token: Address; allowance: BigNumberish; }[] -> +> ``` #### Example @@ -926,17 +926,17 @@ Get allowance parameters for depositing token on ETH-based chain. ```ts import { Wallet, Provider, types, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + const token = ""; const amount = 5; const approveParams = await wallet.getDepositAllowanceParams(token, amount); - + await ( await wallet.approveERC20( approveParams[0].token, @@ -950,17 +950,17 @@ Get allowance parameters for depositing ETH on non-ETH-based chain. ```ts import { Wallet, Provider, types, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + const token = utils.LEGACY_ETH_ADDRESS; const amount = 5; const approveParams = await wallet.getDepositAllowanceParams(token, amount); - + await ( await wallet.approveERC20( approveParams[0].token, @@ -974,17 +974,17 @@ Get allowance parameters for depositing base token on non-ETH-based chain. ```ts import { Wallet, Provider, types, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + const token = await wallet.getBaseToken(); const amount = 5; const approveParams = await wallet.getDepositAllowanceParams(token, amount); - + await ( await wallet.approveERC20( approveParams[0].token, @@ -998,24 +998,24 @@ Get allowance parameters for depositing non-base token on non-ETH-based chain. ```ts import { Wallet, Provider, types, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + const token = ""; const amount = 5; const approveParams = await wallet.getDepositAllowanceParams(token, amount); - + await ( await wallet.approveERC20( approveParams[0].token, approveParams[0].allowance ) ).wait(); - + await ( await wallet.approveERC20( approveParams[1].token, @@ -1063,13 +1063,13 @@ async getDepositTx(transaction: { ```ts import { Wallet, Provider, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + const tokenL1 = "0x56E69Fa1BB0d1402c89E3A4E3417882DeA6B14Be"; const tx = await wallet.getDepositTx({ token: tokenL1, @@ -1079,7 +1079,7 @@ const tx = await wallet.getDepositTx({ ### `getFullRequiredDepositFee` -Retrieves the full needed ETH fee for the deposit. Returns the L1 fee and the L2 fee [`FullDepositFee`](/sdk/js/ethers/api/v5/types#fulldepositfee). +Retrieves the full needed ETH fee for the deposit. Returns the L1 fee and the L2 fee [`FullDepositFee`](/js/ethers/api/v5/types#fulldepositfee). #### Inputs @@ -1108,13 +1108,13 @@ async getFullRequiredDepositFee(transaction: { ```ts import { Wallet, Provider, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + const tokenL1 = "0x56E69Fa1BB0d1402c89E3A4E3417882DeA6B14Be"; const fee = await wallet.getFullRequiredDepositFee({ token: tokenL1, @@ -1140,13 +1140,13 @@ async getL1BridgeContracts(): Promise<{ ```ts import { Wallet, Provider, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + const l1BridgeContracts = await wallet.getL1BridgeContracts(); ``` @@ -1167,13 +1167,13 @@ async getL2BridgeContracts(): Promise<{ ```ts import { Wallet, Provider, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + const l2BridgeContracts = await wallet.getL2BridgeContracts(); ``` @@ -1190,13 +1190,13 @@ async getMainContract(): Promise ```ts import { Wallet, Provider, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + console.log(`Main contract: ${await wallet.getMainContract()}`); ``` @@ -1219,13 +1219,13 @@ async getNonce(blockTag?: BlockTag): Promise ```ts import { Wallet, Provider, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + console.log(`Nonce: ${await wallet.getNonce()}`); ``` @@ -1254,12 +1254,12 @@ async getPriorityOpConfirmation(txHash: string, index: number = 0): Promise<{ ```ts import { Wallet, Provider, types, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const wallet = new Wallet(PRIVATE_KEY, provider); - + // Any L2 -> L1 transaction can be used. // In this case, withdrawal transaction is used. const tx = "0x2a1c6c74b184965c0cb015aae9ea134fd96215d2e4f4979cfec12563295f610e"; @@ -1304,19 +1304,19 @@ async getRequestExecuteAllowanceParams(transaction: { ```ts import { Wallet, Provider, types, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + const tx = { contractAddress: await wallet.getAddress(), calldata: '0x', l2Value: 7_000_000_000, }; - + const approveParams = await wallet.getRequestExecuteAllowanceParams(tx); await ( await wallet.approveERC20( @@ -1365,16 +1365,16 @@ async getRequestExecuteTx(transaction: { ```ts import { Wallet, Provider, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; const CONTRACT_ADDRESS = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + const gasPrice = await wallet.providerL1.getGasPrice(); - + // The calldata can be encoded the same way as for Ethereum. // Here is an example of how to get the calldata from an ABI: const abi = [ @@ -1389,15 +1389,15 @@ const abi = [ const contractInterface = new ethers.utils.Interface(abi); const calldata = contractInterface.encodeFunctionData("increment", []); const l2GasLimit = BigNumber.from(1000); - + const txCostPrice = await wallet.getBaseCost({ gasPrice, calldataLength: ethers.utils.arrayify(calldata).length, l2GasLimit, }); - + console.log(`Executing the transaction will cost ${ethers.utils.formatEther(txCostPrice)} ETH`); - + const executeTx = await wallet.getRequestExecuteTx({ contractAddress: CONTRACT_ADDRESS, calldata, @@ -1423,13 +1423,13 @@ async isETHBasedChain(): Promise ```ts import { Wallet, Provider, types, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + console.log(`Is ETH-based chain: ${await wallet.isETHBasedChain()}`); ``` @@ -1453,13 +1453,13 @@ async isWithdrawalFinalized(withdrawalHash: BytesLike, index: number = 0): Promi ```ts import { Wallet, Provider, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + const WITHDRAWAL_HASH = ""; const isFinalized = await wallet.isWithdrawalFinalized(WITHDRAWAL_HASH); ``` @@ -1487,15 +1487,15 @@ async l2TokenAddress(token: Address): Promise ```ts import { Wallet, Provider, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + const tokenL1 = "0x5C221E77624690fff6dd741493D735a17716c26B"; - + console.log(`Token L2 address: ${await wallet.l2TokenAddress(tokenL1)}`); ``` @@ -1508,7 +1508,7 @@ Any other fields that are not set will be prepared by this method. | Parameter | Type | Description | | ------------- | ----------------------------------------------------- | -------------------- | -| `transaction` | [`TransactionRequest`](/sdk/js/ethers/api/v5/types#transactionrequest) | Transaction request. | +| `transaction` | [`TransactionRequest`](/js/ethers/api/v5/types#transactionrequest) | Transaction request. | ```ts async populateTransaction(transaction: TransactionRequest): Promise @@ -1519,15 +1519,15 @@ async populateTransaction(transaction: TransactionRequest): Promise @@ -1676,15 +1676,15 @@ async signTransaction(transaction: TransactionRequest): Promise ```ts import { Wallet, Provider, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider); - + const recipient = Wallet.createRandom(); - + const tx = await wallet.signTransaction({ type: utils.EIP712_TX_TYPE, to: recipient.address, @@ -1704,7 +1704,7 @@ For convenience, the `Wallet` class has `transfer` method, which can transfer | `transaction.to` | `Address` | The address of the recipient. | | `transaction.amount` | `BigNumberish` | The amount of the token to transfer. | | `transaction.token?` | `Address` | The address of the token. `ETH` by default. | -| `transaction.paymasterParams?` | [`PaymasterParams`](/sdk/js/ethers/api/v5/types#paymasterparams) | Paymaster parameters. | +| `transaction.paymasterParams?` | [`PaymasterParams`](/js/ethers/api/v5/types#paymasterparams) | Paymaster parameters. | | `transaction.overrides?` | `ethers.CallOverrides` | Transaction's overrides which may be used to pass L2 `gasLimit`, `gasPrice`, `value`, etc. | ```ts @@ -1723,19 +1723,19 @@ Transfer ETH. ```ts import { Wallet, Provider, types, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const wallet = new Wallet(PRIVATE_KEY, provider); - + const transferTx = await wallet.transfer({ to: Wallet.createRandom().address, amount: ethers.utils.parseEther("0.01"), }); - + const receipt = await transferHandle.wait(); - + console.log(`The sum of ${receipt.value} ETH was transferred to ${receipt.to}`); ``` @@ -1744,14 +1744,14 @@ Transfer ETH using paymaster to facilitate fee payment with an ERC20 token. ```ts import { Wallet, Provider, types, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; const token = "0x927488F48ffbc32112F1fF721759649A89721F8F"; // Crown token which can be minted for free const paymaster = "0x13D0D8550769f59aa241a41897D4859c87f7Dd46"; // Paymaster for Crown token - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const wallet = new Wallet(PRIVATE_KEY, provider); - + const transferTx = await wallet.transfer({ to: Wallet.createRandom().address, amount: ethers.utils.parseEther("0.01"), @@ -1762,9 +1762,9 @@ const transferTx = await wallet.transfer({ innerInput: new Uint8Array(), }), }); - + const receipt = await transferTx.wait(); - + console.log(`The sum of ${receipt.value} ETH was transferred to ${receipt.to}`); ``` @@ -1773,21 +1773,21 @@ Transfer token. ```ts import { Wallet, Provider, types, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const wallet = new Wallet(PRIVATE_KEY, provider); - + const tokenL2 = "0x6a4Fb925583F7D4dF82de62d98107468aE846FD1"; const transferTx = await wallet.transfer({ token: tokenL2, to: Wallet.createRandom().address, amount: ethers.utils.parseEther("0.01"), }); - + const receipt = await transferHandle.wait(); - + console.log(`The sum of ${receipt.value} token was transferred to ${receipt.to}`); ``` @@ -1796,14 +1796,14 @@ Transfer token using paymaster to facilitate fee payment with an ERC20 token. ```ts import { Wallet, Provider, types, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; const token = "0x927488F48ffbc32112F1fF721759649A89721F8F"; // Crown token which can be minted for free const paymaster = "0x13D0D8550769f59aa241a41897D4859c87f7Dd46"; // Paymaster for Crown token - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const wallet = new Wallet(PRIVATE_KEY, provider); - + const tokenL2 = "0x6a4Fb925583F7D4dF82de62d98107468aE846FD1"; const transferTx = await wallet.transfer({ token: tokenL2, @@ -1816,9 +1816,9 @@ const transferTx = await wallet.transfer({ innerInput: new Uint8Array(), }), }); - + const receipt = await transferTx.wait(); - + console.log(`The sum of ${receipt.value} token was transferred to ${receipt.to}`); ``` @@ -1835,7 +1835,7 @@ account on L2 network to the target account on L1 network. | `transaction.amount` | `BigNumberish` | The amount of the token to withdraw. | | `transaction.to?` | `Address` | The address of the recipient on L1. | | `transaction.bridgeAddress?` | `Address` | The address of the bridge contract to be used. | -| `transaction.paymasterParams?` | [`PaymasterParams`](/sdk/js/ethers/api/v5/types#paymasterparams) | Paymaster parameters. | +| `transaction.paymasterParams?` | [`PaymasterParams`](/js/ethers/api/v5/types#paymasterparams) | Paymaster parameters. | | `transaction.overrides?` | `ethers.CallOverrides` | Transaction's overrides which may be used to pass L2 `gasLimit`, `gasPrice`, `value`, etc. | ```ts @@ -1855,12 +1855,12 @@ Withdraw ETH. ```ts import { Wallet, Provider, types, utils } from "zksync-ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const wallet = new Wallet(PRIVATE_KEY, provider); - + const withdrawTx = await wallet.withdraw({ token: utils.ETH_ADDRESS, amount: 10_000_000, @@ -1871,14 +1871,14 @@ Withdraw ETH using paymaster to facilitate fee payment with an ERC20 token. ```ts import { Wallet, Provider, types, utils } from "zksync-ethers"; - + const PRIVATE_KEY = ""; const token = "0x927488F48ffbc32112F1fF721759649A89721F8F"; // Crown token which can be minted for free const paymaster = "0x13D0D8550769f59aa241a41897D4859c87f7Dd46"; // Paymaster for Crown token - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const wallet = new Wallet(PRIVATE_KEY, provider); - + const withdrawTx = await wallet.withdraw({ token: utils.ETH_ADDRESS, amount: 10_000_000, @@ -1895,12 +1895,12 @@ Withdraw token. ```ts import { Wallet, Provider, types, utils } from "zksync-ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const wallet = new Wallet(PRIVATE_KEY, provider); - + const tokenL2 = "0x6a4Fb925583F7D4dF82de62d98107468aE846FD1"; const withdrawTx = await wallet.withdraw({ token: tokenL2, @@ -1912,14 +1912,14 @@ Withdraw token using paymaster to facilitate fee payment with an ERC20 token. ```ts import { Wallet, Provider, types, utils } from "zksync-ethers"; - + const PRIVATE_KEY = ""; const token = "0x927488F48ffbc32112F1fF721759649A89721F8F"; // Crown token which can be minted for free const paymaster = "0x13D0D8550769f59aa241a41897D4859c87f7Dd46"; // Paymaster for Crown token - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const wallet = new Wallet(PRIVATE_KEY, provider); - + const tokenL2 = "0x6a4Fb925583F7D4dF82de62d98107468aE846FD1"; const withdrawTx = await wallet.withdraw({ token: tokenL2, diff --git a/content/sdk/10.js/00.ethers/05.api/10.v5/01.accounts/02.signer.md b/content/10.js/00.ethers/05.api/10.v5/01.accounts/02.signer.md similarity index 97% rename from content/sdk/10.js/00.ethers/05.api/10.v5/01.accounts/02.signer.md rename to content/10.js/00.ethers/05.api/10.v5/01.accounts/02.signer.md index 9da735a7..5f9850fb 100644 --- a/content/sdk/10.js/00.ethers/05.api/10.v5/01.accounts/02.signer.md +++ b/content/10.js/00.ethers/05.api/10.v5/01.accounts/02.signer.md @@ -157,7 +157,7 @@ But for convenience, the `Wallet` class has `transfer` method, which can transfe | `transaction.to` | `Address` | The address of the recipient. | | `transaction.amount` | `BigNumberish` | The amount of the token to transfer. | | `transaction.token?` | `Address` | The address of the token. `ETH` by default. | -| `transaction.paymasterParams?` | [`PaymasterParams`](/sdk/js/ethers/api/v5/types#paymasterparams) | Paymaster parameters. | +| `transaction.paymasterParams?` | [`PaymasterParams`](/js/ethers/api/v5/types#paymasterparams) | Paymaster parameters. | | `transaction.overrides?` | `ethers.CallOverrides` | Transaction's overrides which may be used to pass L2 `gasLimit`, `gasPrice`, `value`, etc. | ```ts @@ -292,7 +292,7 @@ account on L2 network to the target account on L1 network. | `transaction.amount` | `BigNumberish` | The amount of the token to withdraw. | | `transaction.to?` | `Address` | The address of the recipient on L1. | | `transaction.bridgeAddress?` | `Address` | The address of the bridge contract to be used. | -| `transaction.paymasterParams?` | [`PaymasterParams`](/sdk/js/ethers/api/v5/types#paymasterparams) | Paymaster parameters. | +| `transaction.paymasterParams?` | [`PaymasterParams`](/js/ethers/api/v5/types#paymasterparams) | Paymaster parameters. | | `transaction.overrides?` | `ethers.CallOverrides` | Transaction's overrides which may be used to pass L2 `gasLimit`, `gasPrice`, `value`, etc. | ```ts diff --git a/content/sdk/10.js/00.ethers/05.api/10.v5/01.accounts/03.l1signer.md b/content/10.js/00.ethers/05.api/10.v5/01.accounts/03.l1signer.md similarity index 99% rename from content/sdk/10.js/00.ethers/05.api/10.v5/01.accounts/03.l1signer.md rename to content/10.js/00.ethers/05.api/10.v5/01.accounts/03.l1signer.md index df4d9506..4cf5f8d2 100644 --- a/content/sdk/10.js/00.ethers/05.api/10.v5/01.accounts/03.l1signer.md +++ b/content/10.js/00.ethers/05.api/10.v5/01.accounts/03.l1signer.md @@ -43,10 +43,10 @@ async approveERC20( ```ts import { Provider, L1Signer, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const browserProvider = new ethers.providers.Web3Provider(window.ethereum); const signer = L1Signer.from(browserProvider.getSigner(), Provider.getDefaultProvider(types.Network.Sepolia)); - + const tokenL1 = "0x5C221E77624690fff6dd741493D735a17716c26B"; await signer.approveERC20(tokenL1, 5); ``` @@ -72,10 +72,10 @@ async claimFailedDeposit(depositHash: BytesLike): Promise ```ts import { Provider, L1Signer, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const browserProvider = new ethers.providers.Web3Provider(window.ethereum); const signer = L1Signer.from( browserProvider.getSigner(), Provider.getDefaultProvider(types.Network.Sepolia) ); - + console.log(`Base token: ${await signer.getBaseToken()}`); ``` @@ -532,13 +532,13 @@ async getBridgehubContract(): Promise ```ts import { Provider, L1Signer, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const browserProvider = new ethers.providers.Web3Provider(window.ethereum); const signer = L1Signer.from( browserProvider.getSigner(), Provider.getDefaultProvider(types.Network.Sepolia) ); - + const bridgehub = await signer.getBridgehubContract(); ``` @@ -564,7 +564,7 @@ async getDepositAllowanceParams( token: Address; allowance: BigNumberish; }[] -> +> ``` #### Example @@ -574,17 +574,17 @@ Get allowance parameters for depositing token on ETH-based chain. ```ts import { Provider, L1Signer, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const browserProvider = new ethers.providers.Web3Provider(window.ethereum); const signer = L1Signer.from( browserProvider.getSigner(), Provider.getDefaultProvider(types.Network.Sepolia) ); - + const token = ""; const amount = 5; const approveParams = await signer.getDepositAllowanceParams(token, amount); - + await ( await signer.approveERC20( approveParams[0].token, @@ -598,13 +598,13 @@ Get allowance parameters for depositing ETH on non-ETH-based chain. ```ts import { Provider, L1Signer, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const browserProvider = new ethers.providers.Web3Provider(window.ethereum); const signer = L1Signer.from( browserProvider.getSigner(), Provider.getDefaultProvider(types.Network.Sepolia) ); - + const token = utils.LEGACY_ETH_ADDRESS; const amount = 5; const approveParams = await signer.getDepositAllowanceParams(token, amount); @@ -621,13 +621,13 @@ Get allowance parameters for depositing base token on non-ETH-based chain. ```ts import { Provider, L1Signer, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const browserProvider = new ethers.providers.Web3Provider(window.ethereum); const signer = L1Signer.from( browserProvider.getSigner(), Provider.getDefaultProvider(types.Network.Sepolia) ); - + const token = await signer.getBaseToken(); const amount = 5; const approveParams = await signer.getDepositAllowanceParams(token, amount); @@ -644,24 +644,24 @@ Get allowance parameters for depositing non-base token on non-ETH-based chain. ```ts import { Provider, L1Signer, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const browserProvider = new ethers.providers.Web3Provider(window.ethereum); const signer = L1Signer.from( browserProvider.getSigner(), Provider.getDefaultProvider(types.Network.Sepolia) ); - + const token = ""; const amount = 5; const approveParams = await signer.getDepositAllowanceParams(token, amount); - + await ( await signer.approveERC20( approveParams[0].token, approveParams[0].allowance ) ).wait(); - + await ( await signer.approveERC20( approveParams[1].token, @@ -709,10 +709,10 @@ async getDepositTx(transaction: { ```ts import { Provider, L1Signer, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const browserProvider = new ethers.providers.Web3Provider(window.ethereum); const signer = L1Signer.from(browserProvider.getSigner(), Provider.getDefaultProvider(types.Network.Sepolia)); - + const tokenL1 = "0x56E69Fa1BB0d1402c89E3A4E3417882DeA6B14Be"; const tx = await signer.getDepositTx({ token: tokenL1, @@ -722,7 +722,7 @@ const tx = await signer.getDepositTx({ ### `getFullRequiredDepositFee` -Retrieves the full needed ETH fee for the deposit. Returns the L1 fee and the L2 fee [`FullDepositFee`](/sdk/js/ethers/api/v5/types#fulldepositfee). +Retrieves the full needed ETH fee for the deposit. Returns the L1 fee and the L2 fee [`FullDepositFee`](/js/ethers/api/v5/types#fulldepositfee). #### Inputs @@ -751,10 +751,10 @@ async getFullRequiredDepositFee(transaction: { ```ts import { Provider, L1Signer, Wallet, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const browserProvider = new ethers.providers.Web3Provider(window.ethereum); const signer = L1Signer.from(browserProvider.getSigner(), Provider.getDefaultProvider(types.Network.Sepolia)); - + const tokenL1 = "0x56E69Fa1BB0d1402c89E3A4E3417882DeA6B14Be"; const fee = await signer.getFullRequiredDepositFee({ token: tokenL1, @@ -780,10 +780,10 @@ async getL1BridgeContracts(): Promise<{ ```ts import { Provider, L1Signer, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const browserProvider = new ethers.providers.Web3Provider(window.ethereum); const signer = L1Signer.from(browserProvider.getSigner(), Provider.getDefaultProvider(types.Network.Sepolia)); - + const l1BridgeContracts = await signer.getL1BridgeContracts(); ``` @@ -800,10 +800,10 @@ async getMainContract(): Promise ```ts import { Provider, L1Signer, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const browserProvider = new ethers.providers.Web3Provider(window.ethereum); const signer = L1Signer.from(browserProvider.getSigner(), Provider.getDefaultProvider(types.Network.Sepolia)); - + const mainContract = await signer.getMainContract(); console.log(mainContract.address); ``` @@ -833,13 +833,13 @@ async getPriorityOpConfirmation(txHash: string, index: number = 0): Promise<{ ```ts import { Provider, L1Signer, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const browserProvider = new ethers.providers.Web3Provider(window.ethereum); const signer = L1Signer.from( browserProvider.getSigner(), Provider.getDefaultProvider(types.Network.Sepolia) ); - + // Any L2 -> L1 transaction can be used. // In this case, withdrawal transaction is used. const tx = "0x2a1c6c74b184965c0cb015aae9ea134fd96215d2e4f4979cfec12563295f610e"; @@ -884,19 +884,19 @@ async getRequestExecuteAllowanceParams(transaction: { ```ts import { Provider, L1Signer, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const browserProvider = new ethers.providers.Web3Provider(window.ethereum); const signer = L1Signer.from( browserProvider.getSigner(), Provider.getDefaultProvider(types.Network.Sepolia) ); - + const tx = { contractAddress: await signer.getAddress(), calldata: '0x', l2Value: 7_000_000_000, }; - + const approveParams = await signer.getRequestExecuteAllowanceParams(tx); await ( await signer.approveERC20( @@ -945,10 +945,10 @@ async getRequestExecuteTx(transaction: { ```ts import { Provider, L1Signer, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const browserProvider = new ethers.providers.Web3Provider(window.ethereum); const signer = L1Signer.from(browserProvider.getSigner(), Provider.getDefaultProvider(types.Network.Sepolia)); - + const tx = await signer.getRequestExecuteTx({ contractAddress: await signer.providerL2.getMainContractAddress(), calldata: "0x", @@ -969,13 +969,13 @@ async isETHBasedChain(): Promise ```ts import { Provider, L1Signer, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const browserProvider = new ethers.providers.Web3Provider(window.ethereum); const signer = L1Signer.from( browserProvider.getSigner(), Provider.getDefaultProvider(types.Network.Sepolia) ); - + console.log(`Is ETH-based chain: ${await signer.isETHBasedChain()}`); ``` @@ -999,10 +999,10 @@ async isWithdrawalFinalized(withdrawalHash: BytesLike, index: number = 0): Promi ```ts import { Provider, L1Signer, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const browserProvider = new ethers.providers.Web3Provider(window.ethereum); const signer = L1Signer.from(browserProvider.getSigner(), Provider.getDefaultProvider(types.Network.Sepolia)); - + const WITHDRAWAL_HASH = ""; const isFinalized = await signer.isWithdrawalFinalized(WITHDRAWAL_HASH); ``` @@ -1030,12 +1030,12 @@ async l2TokenAddress(token: Address): Promise ```ts import { Provider, L1Signer, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const browserProvider = new ethers.providers.Web3Provider(window.ethereum); const signer = L1Signer.from(browserProvider.getSigner(), Provider.getDefaultProvider(types.Network.Sepolia)); - + const tokenL1 = "0x5C221E77624690fff6dd741493D735a17716c26B"; - + console.log(`Token L2 address: ${await signer.l2TokenAddress(tokenL1)}`); ``` @@ -1078,10 +1078,10 @@ requestExecute(transaction: { ```ts import { Provider, L1Signer, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const browserProvider = new ethers.providers.Web3Provider(window.ethereum); const signer = L1Signer.from(browserProvider.getSigner(), Provider.getDefaultProvider(types.Network.Sepolia)); - + await signer.requestExecute({ contractAddress: await signer.providerL2.getMainContractAddress(), calldata: "0x", diff --git a/content/sdk/10.js/00.ethers/05.api/10.v5/01.accounts/04.l2voidsigner.md b/content/10.js/00.ethers/05.api/10.v5/01.accounts/04.l2voidsigner.md similarity index 100% rename from content/sdk/10.js/00.ethers/05.api/10.v5/01.accounts/04.l2voidsigner.md rename to content/10.js/00.ethers/05.api/10.v5/01.accounts/04.l2voidsigner.md diff --git a/content/sdk/10.js/00.ethers/05.api/10.v5/01.accounts/05. l1voidsigner.md b/content/10.js/00.ethers/05.api/10.v5/01.accounts/05. l1voidsigner.md similarity index 100% rename from content/sdk/10.js/00.ethers/05.api/10.v5/01.accounts/05. l1voidsigner.md rename to content/10.js/00.ethers/05.api/10.v5/01.accounts/05. l1voidsigner.md diff --git a/content/sdk/10.js/00.ethers/05.api/10.v5/01.accounts/06.eip712signer.md b/content/10.js/00.ethers/05.api/10.v5/01.accounts/06.eip712signer.md similarity index 84% rename from content/sdk/10.js/00.ethers/05.api/10.v5/01.accounts/06.eip712signer.md rename to content/10.js/00.ethers/05.api/10.v5/01.accounts/06.eip712signer.md index cb60d416..2864895a 100644 --- a/content/sdk/10.js/00.ethers/05.api/10.v5/01.accounts/06.eip712signer.md +++ b/content/10.js/00.ethers/05.api/10.v5/01.accounts/06.eip712signer.md @@ -22,7 +22,7 @@ Generates the EIP-712 typed data from provided transaction. Optional fields are | Parameter | Type | Description | | ------------- | ----------------------------------------------------- | -------------------- | -| `transaction` | [`TransactionRequest`](/sdk/js/ethers/api/v5/types#transactionrequest) | Transaction request. | +| `transaction` | [`TransactionRequest`](/js/ethers/api/v5/types#transactionrequest) | Transaction request. | ```ts static getSignInput(transaction: TransactionRequest) @@ -52,7 +52,7 @@ Generates the signed digest of an Ethereum transaction using EIP-712. | Parameter | Type | Description | | ------------- | ----------------------------------------------------- | -------------------- | -| `transaction` | [`TransactionRequest`](/sdk/js/ethers/api/v5/types#transactionrequest) | Transaction request. | +| `transaction` | [`TransactionRequest`](/js/ethers/api/v5/types#transactionrequest) | Transaction request. | ```ts static getSignedDigest(transaction: TransactionRequest): ethers.BytesLike @@ -66,7 +66,7 @@ Signs an Ethereum transaction using EIP-712. | Parameter | Type | Description | | ------------- | ----------------------------------------------------- | -------------------- | -| `transaction` | [`TransactionRequest`](/sdk/js/ethers/api/v5/types#transactionrequest) | Transaction request. | +| `transaction` | [`TransactionRequest`](/js/ethers/api/v5/types#transactionrequest) | Transaction request. | ```ts async sign(transaction: TransactionRequest): Promise diff --git a/content/sdk/10.js/00.ethers/05.api/10.v5/01.accounts/07.smartaccount.md b/content/10.js/00.ethers/05.api/10.v5/01.accounts/07.smartaccount.md similarity index 89% rename from content/sdk/10.js/00.ethers/05.api/10.v5/01.accounts/07.smartaccount.md rename to content/10.js/00.ethers/05.api/10.v5/01.accounts/07.smartaccount.md index b88b0b4c..fd4fd3ab 100644 --- a/content/sdk/10.js/00.ethers/05.api/10.v5/01.accounts/07.smartaccount.md +++ b/content/10.js/00.ethers/05.api/10.v5/01.accounts/07.smartaccount.md @@ -14,7 +14,7 @@ for interacting with contracts/accounts using provided ABI along with custom tra ### `_signTypedData` -Signs a typed data using the provided [`PayloadSigner`](/sdk/js/ethers/api/v5/types#payloadsigner) function. +Signs a typed data using the provided [`PayloadSigner`](/js/ethers/api/v5/types#payloadsigner) function. #### Inputs @@ -37,13 +37,13 @@ async signTypedData( ```ts import { SmartAccount, Provider, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const ADDRESS = "
"; const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const account = new SmartAccount({ address: ADDRESS, secret: PRIVATE_KEY }, provider); - + const signedTypedData = await account._signTypedData( { name: "Example", version: "1", chainId: 270 }, { @@ -64,7 +64,7 @@ Creates a new instance of `SmartAccount` connected to a provider. | Parameter | Type | Description | | ---------- | ------------------------------------- | ---------------------------------------------- | -| `provider` | [`Provider`](/sdk/js/ethers/api/v5/providers/provider) | The provider to connect the `SmartAccount` to. | +| `provider` | [`Provider`](/js/ethers/api/v5/providers/provider) | The provider to connect the `SmartAccount` to. | ```ts connect(provider: Provider): SmartAccount @@ -74,13 +74,13 @@ connect(provider: Provider): SmartAccount ```ts import { Wallet, Provider, types } from "zksync-ethers"; - + const ADDRESS = "
"; const PRIVATE_KEY = ""; - + const sepoliaProvider = Provider.getDefaultProvider(types.Network.Sepolia); const sepoliaAccount = new SmartAccount({ address: ADDRESS, secret: PRIVATE_KEY }, sepoliaProvider); - + const mainnetProvider = Provider.getDefaultProvider(types.Network.Mainnet); const mainnetAccount = sepoliaAccount.connect(mainnetProvider); ``` @@ -88,15 +88,15 @@ const mainnetAccount = sepoliaAccount.connect(mainnetProvider); ### `constructor` Creates a `SmartAccount` instance with provided `signer` and `provider`. -By default, uses [`signPayloadWithECDSA`](/sdk/js/ethers/api/v5/utilities/smart-account-utils#populatetransactionecdsa) -and [`populateTransactionECDSA`](/sdk/js/ethers/api/v5/utilities/smart-account-utils#populatetransactionecdsa). +By default, uses [`signPayloadWithECDSA`](/js/ethers/api/v5/utilities/smart-account-utils#populatetransactionecdsa) +and [`populateTransactionECDSA`](/js/ethers/api/v5/utilities/smart-account-utils#populatetransactionecdsa). #### Inputs | Parameter | Type | Description | | ---------- | ----------------------------------------------------- | --------------------------------------------------- | -| `signer` | [`SmartAccountSigner`](/sdk/js/ethers/api/v5/types#smartaccountsigner) | Contains necessary properties for signing payloads. | -| `provider` | [`Provider`](/sdk/js/ethers/api/v5/providers/provider) | The provider to connect to (optional). | +| `signer` | [`SmartAccountSigner`](/js/ethers/api/v5/types#smartaccountsigner) | Contains necessary properties for signing payloads. | +| `provider` | [`Provider`](/js/ethers/api/v5/providers/provider) | The provider to connect to (optional). | ```ts constructor(signer: SmartAccountSigner, provider: Provider) @@ -106,10 +106,10 @@ constructor(signer: SmartAccountSigner, provider: Provider) ```ts import { SmartAccount, Provider, types } from "zksync-ethers"; - + const ADDRESS = "
"; const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const account = new SmartAccount({ address: ADDRESS, secret: PRIVATE_KEY }, provider); ``` @@ -126,13 +126,13 @@ getAddress(): Promise ```ts import { SmartAccount, Provider, types } from "zksync-ethers"; - + const ADDRESS = "
"; const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const account = new SmartAccount({ address: ADDRESS, secret: PRIVATE_KEY }, provider); - + const address = await account.getAddress(); ``` @@ -148,13 +148,13 @@ async getAllBalances(): Promise ```ts import { SmartAccount, Provider, types } from "zksync-ethers"; - + const ADDRESS = "
"; const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const account = new SmartAccount({ address: ADDRESS, secret: PRIVATE_KEY }, provider); - + const balances = await account.getAllBalances(); ``` @@ -177,13 +177,13 @@ async getBalance(token?: Address, blockTag: BlockTag = 'committed'): Promise ```ts import { SmartAccount, Provider, types } from "zksync-ethers"; - + const ADDRESS = "
"; const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const account = new SmartAccount({ address: ADDRESS, secret: PRIVATE_KEY }, provider); - + const nonce = await account.getDeploymentNonce(); ``` @@ -228,28 +228,28 @@ async getNonce(blockTag?: BlockTag): Promise ```ts import { SmartAccount, Provider, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const ADDRESS = "
"; const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const account = new SmartAccount({ address: ADDRESS, secret: PRIVATE_KEY }, provider); - + const nonce = await account.getNonce(); ``` ### `populateTransaction` Populates the transaction `tx` using the -provided [`TransactionBuilder`](/sdk/js/ethers/api/v5/types#transactionbuilder) function. +provided [`TransactionBuilder`](/js/ethers/api/v5/types#transactionbuilder) function. If `tx.from` is not set, it sets the value from the `getAddress` method which can -be utilized in the [`TransactionBuilder`](/sdk/js/ethers/api/v5/types#transactionbuilder) function. +be utilized in the [`TransactionBuilder`](/js/ethers/api/v5/types#transactionbuilder) function. #### Inputs | Parameter | Type | Description | | --------- | ----------------------------------------------------- | ------------------------------------------- | -| `tx` | [`TransactionRequest`](/sdk/js/ethers/api/v5/types#transactionrequest) | The transaction that needs to be populated. | +| `tx` | [`TransactionRequest`](/js/ethers/api/v5/types#transactionrequest) | The transaction that needs to be populated. | ```ts async populateTransaction(tx: TransactionRequest): Promise @@ -259,13 +259,13 @@ async populateTransaction(tx: TransactionRequest): Promise ```ts import { SmartAccount, Provider, types, utils } from "zksync-ethers"; - + const ADDRESS = "
"; const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const account = new SmartAccount({ address: ADDRESS, secret: PRIVATE_KEY }, provider); - + const populatedTx = await account.populateTransaction({ type: utils.EIP712_TX_TYPE, to: "", @@ -282,7 +282,7 @@ is called first to ensure transaction is properly signed. | Parameter | Type | Description | | --------- | ----------------------------------------------------- | -------------------------------------- | -| `tx` | [`TransactionRequest`](/sdk/js/ethers/api/v5/types#transactionrequest) | The transaction that needs to be sent. | +| `tx` | [`TransactionRequest`](/js/ethers/api/v5/types#transactionrequest) | The transaction that needs to be sent. | ```ts async sendTransaction(tx: TransactionRequest): Promise @@ -293,13 +293,13 @@ async sendTransaction(tx: TransactionRequest): Promise ```ts import { SmartAccount, Provider, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const ADDRESS = "
"; const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const account = new SmartAccount({ address: ADDRESS, secret: PRIVATE_KEY }, provider); - + const signedTx = await account.sendTransaction({ to: "", value: ethers.utils.parseEther("1"), @@ -308,7 +308,7 @@ const signedTx = await account.sendTransaction({ ### `signMessage` -Signs a `message` using the provided [`PayloadSigner`](/sdk/js/ethers/api/v5/types#payloadsigner) function. +Signs a `message` using the provided [`PayloadSigner`](/js/ethers/api/v5/types#payloadsigner) function. #### Inputs @@ -325,19 +325,19 @@ signMessage(message: string | Uint8Array): Promise ```ts import { SmartAccount, Provider, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const ADDRESS = "
"; const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const account = new SmartAccount({ address: ADDRESS, secret: PRIVATE_KEY }, provider); - + const signedMessage = await account.signMessage("Hello World!"); ``` ### `signTransaction` -Signs the transaction `tx` using the provided [`PayloadSigner`](/sdk/js/ethers/api/v5/types#payloadsigner) function, +Signs the transaction `tx` using the provided [`PayloadSigner`](/js/ethers/api/v5/types#payloadsigner) function, returning the fully signed transaction. The `populateTransaction` method is called first to ensure that all necessary properties for the transaction to be valid have been populated. @@ -346,7 +346,7 @@ have been populated. | Parameter | Type | Description | | --------- | ----------------------------------------------------- | ---------------------------------------- | -| `tx` | [`TransactionRequest`](/sdk/js/ethers/api/v5/types#transactionrequest) | The transaction that needs to be signed. | +| `tx` | [`TransactionRequest`](/js/ethers/api/v5/types#transactionrequest) | The transaction that needs to be signed. | ```ts async signTransaction(tx: TransactionRequest): Promise @@ -357,13 +357,13 @@ async signTransaction(tx: TransactionRequest): Promise ```ts import { SmartAccount, Provider, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const ADDRESS = "
"; const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const account = new SmartAccount({ address: ADDRESS, secret: PRIVATE_KEY }, provider); - + const signedTx = await account.signTransaction({ to: "", value: ethers.utils.parseEther("1"), @@ -379,7 +379,7 @@ Transfer ETH or any ERC20 token within the same interface. | `transaction.to` | `Address` | The address of the recipient. | | `transaction.amount` | `BigNumberish` | The amount of the token to transfer. | | `transaction.token?` | `Address` | The address of the token. `ETH` by default. | -| `transaction.paymasterParams?` | [`PaymasterParams`](/sdk/js/ethers/api/v5/types#paymasterparams) | Paymaster parameters. | +| `transaction.paymasterParams?` | [`PaymasterParams`](/js/ethers/api/v5/types#paymasterparams) | Paymaster parameters. | | `transaction.overrides?` | `ethers.CallOverrides` | Transaction's overrides which may be used to pass L2 `gasLimit`, `gasPrice`, `value`, etc. | ```ts @@ -398,24 +398,24 @@ Transfer ETH. ```ts import { SmartAccount, Wallet, Provider, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const ADDRESS = "
"; const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const account = new SmartAccount( {address: ADDRESS, secret: PRIVATE_KEY}, provider ); - + const transferTx = await account.transfer({ token: utils.ETH_ADDRESS, to: Wallet.createRandom().address, amount: ethers.utils.parseEther("0.01"), }); - + const receipt = await transferTx.wait(); - + console.log(`The sum of ${receipt.value} ETH was transferred to ${receipt.to}`); ``` @@ -424,19 +424,19 @@ Transfer ETH using paymaster to facilitate fee payment with an ERC20 token. ```ts import { SmartAccount, Wallet, Provider, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const ADDRESS = "
"; const PRIVATE_KEY = ""; - + const token = "0x927488F48ffbc32112F1fF721759649A89721F8F"; // Crown token which can be minted for free const paymaster = "0x13D0D8550769f59aa241a41897D4859c87f7Dd46"; // Paymaster for Crown token - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const account = new SmartAccount( {address: ADDRESS, secret: PRIVATE_KEY}, provider ); - + const transferTx = await account.transfer({ to: Wallet.createRandom().address, amount: ethers.utils.parseEther("0.01"), @@ -447,9 +447,9 @@ const transferTx = await account.transfer({ innerInput: new Uint8Array(), }), }); - + const receipt = await transferTx.wait(); - + console.log(`The sum of ${receipt.value} ETH was transferred to ${receipt.to}`); ``` @@ -466,7 +466,7 @@ account on L2 network to the target account on L1 network. | `transaction.amount` | `BigNumberish` | The amount of the token to withdraw. | | `transaction.to?` | `Address` | The address of the recipient on L1. | | `transaction.bridgeAddress?` | `Address` | The address of the bridge contract to be used. | -| `transaction.paymasterParams?` | [`PaymasterParams`](/sdk/js/ethers/api/v5/types#paymasterparams) | Paymaster parameters. | +| `transaction.paymasterParams?` | [`PaymasterParams`](/js/ethers/api/v5/types#paymasterparams) | Paymaster parameters. | | `transaction.overrides?` | `ethers.CallOverrides` | Transaction's overrides which may be used to pass L2 `gasLimit`, `gasPrice`, `value`, etc. | ```ts @@ -486,16 +486,16 @@ Withdraw ETH. ```ts import { SmartAccount, Provider, types, utils } from "zksync-ethers"; - + const ADDRESS = "
"; const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const account = new SmartAccount( {address: ADDRESS, secret: PRIVATE_KEY}, provider ); - + const withdrawTx = await account.withdraw({ token: utils.ETH_ADDRESS, amount: 10_000_000, @@ -506,19 +506,19 @@ Withdraw ETH using paymaster to facilitate fee payment with an ERC20 token. ```ts import { SmartAccount, Provider, types, utils } from "zksync-ethers"; - + const ADDRESS = "
"; const PRIVATE_KEY = ""; - + const token = "0x927488F48ffbc32112F1fF721759649A89721F8F"; // Crown token which can be minted for free const paymaster = "0x13D0D8550769f59aa241a41897D4859c87f7Dd46"; // Paymaster for Crown token - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const account = new SmartAccount( {address: ADDRESS, secret: PRIVATE_KEY}, provider ); - + const withdrawTx = await account.withdraw({ token: utils.ETH_ADDRESS, amount: 10_000_000, diff --git a/content/sdk/10.js/00.ethers/05.api/10.v5/01.accounts/08.smartaccount-factories.md b/content/10.js/00.ethers/05.api/10.v5/01.accounts/08.smartaccount-factories.md similarity index 91% rename from content/sdk/10.js/00.ethers/05.api/10.v5/01.accounts/08.smartaccount-factories.md rename to content/10.js/00.ethers/05.api/10.v5/01.accounts/08.smartaccount-factories.md index da4ba8d0..77b6dd61 100644 --- a/content/sdk/10.js/00.ethers/05.api/10.v5/01.accounts/08.smartaccount-factories.md +++ b/content/10.js/00.ethers/05.api/10.v5/01.accounts/08.smartaccount-factories.md @@ -19,7 +19,7 @@ Creates a `SmartAccount` instance that uses a single ECDSA key for signing paylo | ---------- | ------------------------------------- | --------------------------- | | `address` | `string` | The account address. | | `secret` | `string` or `ethers.utils.SigningKey` | The ECDSA private key. | -| `provider` | [`Provider`](/sdk/js/ethers/api/v5/providers/provider) | The provider to connect to. | +| `provider` | [`Provider`](/js/ethers/api/v5/providers/provider) | The provider to connect to. | ```ts static create(address: string, secret: string | utils.SigningKey, provider: Provider): SmartAccount @@ -53,7 +53,7 @@ Creates a `SmartAccount` instance that uses multiple ECDSA keys for signing payl | ---------- | ------------------------------------------ | ----------------------------------- | | `address` | `string` | The account address. | | `secret` | `string[]` or `ethers.utils.SigningKeyp[]` | The list of the ECDSA private keys. | -| `provider` | [`Provider`](/sdk/js/ethers/api/v5/providers/provider) | The provider to connect to. | +| `provider` | [`Provider`](/js/ethers/api/v5/providers/provider) | The provider to connect to. | ```ts static create(address: string, secret: string[] | utils.SigningKey[], provider: Provider): SmartAccount diff --git a/content/sdk/10.js/00.ethers/05.api/10.v5/02.contract/00.contract-factory.md b/content/10.js/00.ethers/05.api/10.v5/02.contract/00.contract-factory.md similarity index 100% rename from content/sdk/10.js/00.ethers/05.api/10.v5/02.contract/00.contract-factory.md rename to content/10.js/00.ethers/05.api/10.v5/02.contract/00.contract-factory.md diff --git a/content/sdk/10.js/00.ethers/05.api/10.v5/02.contract/01.contracts.md b/content/10.js/00.ethers/05.api/10.v5/02.contract/01.contracts.md similarity index 94% rename from content/sdk/10.js/00.ethers/05.api/10.v5/02.contract/01.contracts.md rename to content/10.js/00.ethers/05.api/10.v5/02.contract/01.contracts.md index eaa5fa2c..76de28e5 100644 --- a/content/sdk/10.js/00.ethers/05.api/10.v5/02.contract/01.contracts.md +++ b/content/10.js/00.ethers/05.api/10.v5/02.contract/01.contracts.md @@ -11,4 +11,4 @@ Since deploying smart contracts on ZKsync has some differences from deploying on a specific `ContractFactory` method. It supports the same interface as `ethers.ContractFactory`. In order to pay for smart contract interactions in ERC20 tokens, `customData` override should be used. -You can read more about accessing ZKsync features in [ZKsync Era features](/sdk/js/ethers/guides/features). +You can read more about accessing ZKsync features in [ZKsync Era features](/js/ethers/guides/features). diff --git a/content/sdk/10.js/00.ethers/05.api/10.v5/03.abi/_dir.yml b/content/10.js/00.ethers/05.api/10.v5/03.abi/_dir.yml similarity index 100% rename from content/sdk/10.js/00.ethers/05.api/10.v5/03.abi/_dir.yml rename to content/10.js/00.ethers/05.api/10.v5/03.abi/_dir.yml diff --git a/content/sdk/10.js/00.ethers/05.api/10.v5/04.utilities/00.utils.md b/content/10.js/00.ethers/05.api/10.v5/04.utilities/00.utils.md similarity index 98% rename from content/sdk/10.js/00.ethers/05.api/10.v5/04.utilities/00.utils.md rename to content/10.js/00.ethers/05.api/10.v5/04.utilities/00.utils.md index 4dd22629..b10f12fb 100644 --- a/content/sdk/10.js/00.ethers/05.api/10.v5/04.utilities/00.utils.md +++ b/content/10.js/00.ethers/05.api/10.v5/04.utilities/00.utils.md @@ -270,7 +270,7 @@ const l2ContractAddress = utils.applyL1ToL2Alias(l1ContractAddress); ``` ::callout -See also [`undol1tol2alias`](/sdk/js/ethers/api/v5/utilities/utils#undol1tol2alias). +See also [`undol1tol2alias`](/js/ethers/api/v5/utilities/utils#undol1tol2alias). :: ### `checkBaseCost` @@ -364,7 +364,7 @@ Returns the hash of an EIP712 transaction. | Parameter | Type | Description | | --------------- | --------------------------------------------------- | ---------------------------------------------- | | `transaction` | `any` | EIP-712 transaction. | -| `ethSignature?` | [`EthereumSignature`](/sdk/js/ethers/api/v5/types#ethereumsignature) | ECDSA signature of the transaction. | +| `ethSignature?` | [`EthereumSignature`](/js/ethers/api/v5/types#ethereumsignature) | ECDSA signature of the transaction. | ```ts function eip712TxHash(transaction: any, ethSignature?: EthereumSignature): string; @@ -411,7 +411,7 @@ Returns a log containing details of all deployed contracts related to a transact | Parameter | Type | Description | | --------- | ----------------------------------------------------- | -------------------- | -| `receipt` | [`TransactionReceipt`](/sdk/js/ethers/api/v5/types#transactionreceipt) | Transaction receipt. | +| `receipt` | [`TransactionReceipt`](/js/ethers/api/v5/types#transactionreceipt) | Transaction receipt. | ```ts function getDeployedContracts(receipt: ethers.providers.TransactionReceipt): DeploymentInfo[]; @@ -467,7 +467,7 @@ Returns the hash of the L2 priority operation from a given transaction receipt a | Parameter | Type | Description | | --------------- | ----------------------------------------------------- | ------------------------------------ | -| `txReceipt` | [`TransactionReceipt`](/sdk/js/ethers/api/v5/types#transactionreceipt) | Receipt of the L1 transaction. | +| `txReceipt` | [`TransactionReceipt`](/js/ethers/api/v5/types#transactionreceipt) | Receipt of the L1 transaction. | | `zkSyncAddress` | `Address` | Address of ZKsync Era main contract. | ```ts @@ -523,7 +523,7 @@ function isAddressEq(a: Address, b: Address): boolean ```ts import { Wallet, utils } from "zksync-ethers"; - + utils.isAddressEq("0x36615Cf349d7F6344891B1e7CA7C72883F5dc049", "0x36615cf349d7f6344891b1e7ca7c72883f5dc049") // true ``` @@ -551,15 +551,15 @@ function isECDSASignatureCorrect(address: string, msgHash: string, signature: Si ```ts import { Wallet, utils } from "zksync-ethers"; - + const ADDRESS = ""; const PRIVATE_KEY = ""; - + const message = "Hello, world!"; const signature = await new Wallet(PRIVATE_KEY).signMessage(message); // ethers.Wallet can be used as well // const signature = await new ethers.Wallet(PRIVATE_KEY).signMessage(message); - + const isValidSignature = await utils.isECDSASignatureCorrect(ADDRESS, message, signature); // isValidSignature = true ``` @@ -639,16 +639,16 @@ async function isMessageSignatureCorrect(provider: Provider, address: string, me ```ts import { Wallet, utils, Provider } from "zksync-ethers"; - + const ADDRESS = ""; const PRIVATE_KEY = ""; const provider = Provider.getDefaultProvider(types.Network.Sepolia); - + const message = "Hello, world!"; const signature = await new Wallet(PRIVATE_KEY).signMessage(message); // ethers.Wallet can be used as well // const signature = await new ethers.Wallet(PRIVATE_KEY).signMessage(message); - + const isValidSignature = await utils.isMessageSignatureCorrect(provider, ADDRESS, message, signature); // isValidSignature = true ``` @@ -703,11 +703,11 @@ async function isTypedDataSignatureCorrect( ```ts import { Wallet, utils, Provider, EIP712Signer } from "zksync-ethers"; - + const ADDRESS = ""; const PRIVATE_KEY = ""; const provider = Provider.getDefaultProvider(types.Network.Sepolia); - + const tx: types.TransactionRequest = { type: 113, chainId: 270, @@ -715,14 +715,14 @@ const tx: types.TransactionRequest = { to: "0xa61464658AfeAf65CccaaFD3a512b69A83B77618", value: BigInt(7_000_000), }; - + const eip712Signer = new EIP712Signer( new Wallet(PRIVATE_KEY), // or new ethers.Wallet(PRIVATE_KEY), Number((await provider.getNetwork()).chainId) ); - + const signature = await eip712Signer.sign(tx); - + const isValidSignature = await utils.isTypedDataSignatureCorrect(provider, ADDRESS, await eip712Signer.getDomain(), utils.EIP712_TYPES, EIP712Signer.getSignInput(tx), signature); // isValidSignature = true ``` @@ -745,7 +745,7 @@ function parseTransaction(payload: ethers.BytesLike): ethers.Transaction; ```ts import { types } from "zksync-ethers"; - + const serializedTx = "0x71f87f8080808094a61464658afeaf65cccaafd3a512b69a83b77618830f42408001a073a20167b8d23b610b058c05368174495adf7da3a4ed4a57eb6dbdeb1fafc24aa02f87530d663a0d061f69bb564d2c6fb46ae5ae776bbd4bd2a2a4478b9cd1b42a82010e9436615cf349d7f6344891b1e7ca7c72883f5dc04982c350c080c0"; const tx: types.TransactionLike = utils.parseEip712(serializedTx); @@ -799,7 +799,7 @@ Serialize EIP712 transaction without signature. ```ts const serializedTx = utils.serializeEip712({ chainId: 270, from: "0x36615Cf349d7F6344891B1e7CA7C72883F5dc049" }, null); - + // serializedTx = "0x71ea8080808080808082010e808082010e9436615cf349d7f6344891b1e7ca7c72883f5dc04982c350c080c0" ``` @@ -807,7 +807,7 @@ Serialize EIP712 transaction with signature. ```ts const signature = ethers.Signature.from("0x73a20167b8d23b610b058c05368174495adf7da3a4ed4a57eb6dbdeb1fafc24aaf87530d663a0d061f69bb564d2c6fb46ae5ae776bbd4bd2a2a4478b9cd1b42a"); - + const serializedTx = utils.serializeEip712( { chainId: 270, @@ -852,7 +852,7 @@ function toJSON(object: any): string; ```ts import { utils } from "zksync-ethers"; - + const json = utils.toJSON({gasLimit: 1_000n}) // {"gasLimit": 1000} ``` diff --git a/content/sdk/10.js/00.ethers/05.api/10.v5/04.utilities/01.paymaster-utils.md b/content/10.js/00.ethers/05.api/10.v5/04.utilities/01.paymaster-utils.md similarity index 84% rename from content/sdk/10.js/00.ethers/05.api/10.v5/04.utilities/01.paymaster-utils.md rename to content/10.js/00.ethers/05.api/10.v5/04.utilities/01.paymaster-utils.md index 31eda29e..adf09035 100644 --- a/content/sdk/10.js/00.ethers/05.api/10.v5/04.utilities/01.paymaster-utils.md +++ b/content/10.js/00.ethers/05.api/10.v5/04.utilities/01.paymaster-utils.md @@ -25,7 +25,7 @@ Returns encoded input for an approval-based paymaster. | Parameter | Type | Description | | ---------------- | ----------------------------------------------------------------------- | -------------------------------- | -| `paymasterInput` | [`ApprovalBasedPaymasterInput`](/sdk/js/ethers/api/v5/types#approvalbasedpaymasterinput) | The input data to the paymaster. | +| `paymasterInput` | [`ApprovalBasedPaymasterInput`](/js/ethers/api/v5/types#approvalbasedpaymasterinput) | The input data to the paymaster. | ```ts function getApprovalBasedPaymasterInput(paymasterInput: ApprovalBasedPaymasterInput): BytesLike; @@ -39,7 +39,7 @@ Returns encoded input for a general-based paymaster. | Parameter | Type | Description | | ---------------- | ----------------------------------------------------------- | -------------------------------- | -| `paymasterInput` | [`GeneralPaymasterInput`](/sdk/js/ethers/api/v5/types#generalpaymasterinput) | The input data to the paymaster. | +| `paymasterInput` | [`GeneralPaymasterInput`](/js/ethers/api/v5/types#generalpaymasterinput) | The input data to the paymaster. | ```ts function getGeneralPaymasterInput(paymasterInput: GeneralPaymasterInput): BytesLike; @@ -54,14 +54,14 @@ Returns a correctly-formed `paymasterParams` object for common [paymaster flows] | Parameter | Type | Description | | ------------------ | --------------------------------------------- | --------------------------------- | | `paymasterAddress` | `Address` | The non-zero `paymaster` address. | -| `paymasterInput` | [`PaymasterInput`](/sdk/js/ethers/api/v5/types#paymasterinput) | The input data to the paymaster. | +| `paymasterInput` | [`PaymasterInput`](/js/ethers/api/v5/types#paymasterinput) | The input data to the paymaster. | ```ts function getPaymasterParams(paymasterAddress: Address, paymasterInput: PaymasterInput): PaymasterParams; ``` ::callout -Find out more about the [`PaymasterInput` type](/sdk/js/ethers/api/v5/types#paymasterinput). +Find out more about the [`PaymasterInput` type](/js/ethers/api/v5/types#paymasterinput). :: #### Examples diff --git a/content/sdk/10.js/00.ethers/05.api/10.v5/04.utilities/02.smart-account-utils.md b/content/10.js/00.ethers/05.api/10.v5/04.utilities/02.smart-account-utils.md similarity index 96% rename from content/sdk/10.js/00.ethers/05.api/10.v5/04.utilities/02.smart-account-utils.md rename to content/10.js/00.ethers/05.api/10.v5/04.utilities/02.smart-account-utils.md index 8e3f6ad1..74443501 100644 --- a/content/sdk/10.js/00.ethers/05.api/10.v5/04.utilities/02.smart-account-utils.md +++ b/content/10.js/00.ethers/05.api/10.v5/04.utilities/02.smart-account-utils.md @@ -28,7 +28,7 @@ derived from the ECDSA private key. | ---------- | ------------------------------------- | ---------------------------------------------------------------------------------- | | `tx` | `BytesLike` | The transaction that needs to be populated. | | `secret` | `string` or `ethers.utils.SigningKey` | The ECDSA private key. | -| `provider` | [`Provider`](/sdk/js/ethers/api/v5/providers/provider) | The provider is used to fetch data from the network if it is required for signing. | +| `provider` | [`Provider`](/js/ethers/api/v5/providers/provider) | The provider is used to fetch data from the network if it is required for signing. | ```ts const populateTransactionECDSA: TransactionBuilder = async (tx, secret: string | utils.SigningKey, provider) @@ -66,7 +66,7 @@ set as the `secret` argument. | ---------- | ----------------------------------------- | ---------------------------------------------------------------------------------- | | `tx` | `BytesLike` | The transaction that needs to be populated. | | `secret` | `string[]` or `ethers.utils.SigningKey[]` | The list of the ECDSA private keys used for populating the transaction. | -| `provider` | [`Provider`](/sdk/js/ethers/api/v5/providers/provider) | The provider is used to fetch data from the network if it is required for signing. | +| `provider` | [`Provider`](/js/ethers/api/v5/providers/provider) | The provider is used to fetch data from the network if it is required for signing. | ```ts const populateTransactionMultisigECDSA: TransactionBuilder = async (tx, secret: string[] | SigningKey[], provider) diff --git a/content/sdk/10.js/00.ethers/05.api/10.v5/05.types.md b/content/10.js/00.ethers/05.api/10.v5/05.types.md similarity index 99% rename from content/sdk/10.js/00.ethers/05.api/10.v5/05.types.md rename to content/10.js/00.ethers/05.api/10.v5/05.types.md index 411d78f5..2773e1ff 100644 --- a/content/sdk/10.js/00.ethers/05.api/10.v5/05.types.md +++ b/content/10.js/00.ethers/05.api/10.v5/05.types.md @@ -129,7 +129,7 @@ definition with additional fields. The timestamp of the batch on L1. :: :: -:: +:: ## `BlockDetails` @@ -773,7 +773,7 @@ Interface representation of raw block with transactions. ## `SmartAccountSigner` -Encapsulates the required input parameters for creating a signer for [`SmartAccount`](/sdk/js/ethers/api/v5/accounts/smartaccount). +Encapsulates the required input parameters for creating a signer for [`SmartAccount`](/js/ethers/api/v5/accounts/smartaccount). ::field-group ::collapsible diff --git a/content/sdk/10.js/00.ethers/05.api/10.v5/_dir.yml b/content/10.js/00.ethers/05.api/10.v5/_dir.yml similarity index 100% rename from content/sdk/10.js/00.ethers/05.api/10.v5/_dir.yml rename to content/10.js/00.ethers/05.api/10.v5/_dir.yml diff --git a/content/sdk/10.js/00.ethers/05.api/20.v6/00.providers/00.introduction.md b/content/10.js/00.ethers/05.api/20.v6/00.providers/00.introduction.md similarity index 100% rename from content/sdk/10.js/00.ethers/05.api/20.v6/00.providers/00.introduction.md rename to content/10.js/00.ethers/05.api/20.v6/00.providers/00.introduction.md diff --git a/content/sdk/10.js/00.ethers/05.api/20.v6/00.providers/01.provider.md b/content/10.js/00.ethers/05.api/20.v6/00.providers/01.provider.md similarity index 97% rename from content/sdk/10.js/00.ethers/05.api/20.v6/00.providers/01.provider.md rename to content/10.js/00.ethers/05.api/20.v6/00.providers/01.provider.md index 4c1a7ff8..919ccbd9 100644 --- a/content/sdk/10.js/00.ethers/05.api/20.v6/00.providers/01.provider.md +++ b/content/10.js/00.ethers/05.api/20.v6/00.providers/01.provider.md @@ -24,11 +24,11 @@ async broadcastTransaction(signedTx: string): Promise ```ts import { Provider, types, Wallet } from "zksync-ethers"; - + const PRIVATE_KEY = ""; const provider = Provider.getDefaultProvider(types.Network.Sepolia); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + const signedTx = await wallet.signTransaction({ to: "0xa61464658AfeAf65CccaaFD3a512b69A83B77618", value: ethers.parseEther("0.01"), @@ -64,7 +64,7 @@ async connectL2Bridge(address: Address): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const l2Bridge = await provider.connectL2Bridge(""); ``` @@ -89,7 +89,7 @@ constructor(url ? : ethers.FetchRequest | string, network ? : Networkish, option ```ts import { Provider } from "zksync-ethers"; - + const provider = new Provider("https://sepolia.era.zksync.dev"); ``` @@ -99,7 +99,7 @@ parameter allows you to define the network details, and `options` provides addit ### `estimateFee` -Returns an estimated [`Fee`](/sdk/js/ethers/api/v6/types#fee) for the requested transaction. +Returns an estimated [`Fee`](/js/ethers/api/v6/types#fee) for the requested transaction. **Parameters:** @@ -115,7 +115,7 @@ async estimateFee(transaction: TransactionRequest): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const fee = await provider.estimateFee({ from: "0x36615Cf349d7F6344891B1e7CA7C72883F5dc049", @@ -147,7 +147,7 @@ async estimateGas(_tx: TransactionRequest): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const gasTokenApprove = await provider.estimateGas({ from: "0x36615Cf349d7F6344891B1e7CA7C72883F5dc049", @@ -168,7 +168,7 @@ Returns an estimate of the gas required to submit a transaction from L1 to L2. | Parameter | Type | Description | | ------------- | -------------------------------------------------------- | ---------------------- | -| `transaction` | [`TransactionRequest`](/sdk/js/ethers/api/v6/types#transactionrequest) | Transaction request. | +| `transaction` | [`TransactionRequest`](/js/ethers/api/v6/types#transactionrequest) | Transaction request. | ```ts async estimateGasL1(transaction: TransactionRequest): Promise @@ -178,7 +178,7 @@ async estimateGasL1(transaction: TransactionRequest): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const gasL1 = await provider.estimateGasL1({ from: "0x36615Cf349d7F6344891B1e7CA7C72883F5dc049", @@ -206,7 +206,7 @@ Returns the gas estimation for a transfer transaction. | `amount` | `BigNumberish` | Amount of token. | | `from?` | `Address` | From address. | | `to?` | `Address` | To address. | -| `paymasterParams?` | [`PaymasterParams`](/sdk/js/ethers/api/v6/types#paymasterparams) | Paymaster parameters. | +| `paymasterParams?` | [`PaymasterParams`](/js/ethers/api/v6/types#paymasterparams) | Paymaster parameters. | | `overrides?` | [`ethers.Overrides`](https://docs.ethers.org/v6/api/contract/#Overrides) | Ethers overrides object.| ```ts @@ -224,7 +224,7 @@ async estimateGasTransfer(transaction: { ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const gasTransfer = await provider.estimateGasTransfer({ token: utils.ETH_ADDRESS, @@ -251,7 +251,7 @@ Returns the gas estimation for a withdrawal transaction. | `from?` | `Address` | From address. | | `to?` | `Address` | To address. | | `bridgeAddress?` | `Address` | Bridge address. | -| `paymasterParams?` | [`PaymasterParams`](/sdk/js/ethers/api/v6/types#paymasterparams) | Paymaster parameters. | +| `paymasterParams?` | [`PaymasterParams`](/js/ethers/api/v6/types#paymasterparams) | Paymaster parameters. | | `overrides?` | [`ethers.Overrides`](https://docs.ethers.org/v6/api/contract/#Overrides) | Transaction's overrides which may be used to pass l2 `gasLimit`, `gasPrice`, `value`, etc. | ```ts @@ -270,7 +270,7 @@ async estimateGasWithdraw(transaction: { ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const gasWithdraw = await provider.estimateGasWithdraw({ token: utils.ETH_ADDRESS, @@ -313,7 +313,7 @@ async estimateL1ToL2Execute(transaction: { ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const gasL1ToL2 = await provider.estimateL1ToL2Execute({ contractAddress: await provider.getMainContractAddress(), @@ -345,7 +345,7 @@ async getAllAccountBalances(address: Address): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const balances = await provider.getAllAccountBalances("0x36615Cf349d7F6344891B1e7CA7C72883F5dc049"); console.log(`All balances: ${utils.toJSON(balances)}`); @@ -373,7 +373,7 @@ async getBalance(address: Address, blockTag?: BlockTag, tokenAddress?: Address) ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const account = "0x36615Cf349d7F6344891B1e7CA7C72883F5dc049"; const tokenAddress = "0x927488F48ffbc32112F1fF721759649A89721F8F"; // Crown token which can be minted for free @@ -395,7 +395,7 @@ async getBaseTokenContractAddress(): Promise
```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Base token: ${await provider.getBaseTokenContractAddress()}`); ``` @@ -419,7 +419,7 @@ async getBlock(blockHashOrBlockTag: BlockTag, includeTxs?: boolean): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Block details: ${utils.toJSON(await provider.getBlockDetails(90_000))}`); ``` @@ -463,7 +463,7 @@ async getBridgehubContractAddress(): Promise
```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Bridgehub: ${await provider.getBridgehubContractAddress()}`); ``` @@ -488,13 +488,13 @@ async getBytecodeByHash(bytecodeHash: BytesLike): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + // Bytecode hash can be computed by following these steps: // const testnetPaymasterBytecode = await provider.getCode(await provider.getTestnetPaymasterAddress()); // const testnetPaymasterBytecodeHash = ethers.hexlify(utils.hashBytecode(testnetPaymasterBytecode)); - + const testnetPaymasterBytecodeHash = "0x010000f16d2b10ddeb1c32f2c9d222eb1aea0f638ec94a81d4e916c627720e30"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Bytecode: ${await provider.getBytecodeByHash(testnetPaymasterBytecodeHash)}`); ``` @@ -521,7 +521,7 @@ async getConfirmedTokens(start: number = 0, limit: number = 255): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const tokenAddress = "0x927488F48ffbc32112F1fF721759649A89721F8F"; // Crown token which can be minted for free console.log(`Contract account info: ${utils.toJSON(await provider.getContractAccountInfo(tokenAddress))}`); @@ -570,7 +570,7 @@ getDefaultBridgeAddresses(): Promise<{ ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Default bridges: ${utils.toJSON(await provider.getDefaultBridgeAddresses())}`); ``` @@ -583,7 +583,7 @@ Static method which returns a Provider object from the RPC URL or localhost. | Parameter | Type | Description | | --------------- | ------------------------------------- | ------------------------------------------------- | -| `zksyncNetwork` | [`ZkSyncNetwork`](/sdk/js/ethers/api/v6/types#network) | Type of ZKsync network. `Localhost` _by default_. | +| `zksyncNetwork` | [`ZkSyncNetwork`](/js/ethers/api/v6/types#network) | Type of ZKsync network. `Localhost` _by default_. | ```ts static getDefaultProvider(zksyncNetwork: ZkSyncNetwork = ZkSyncNetwork.Localhost) @@ -593,7 +593,7 @@ static getDefaultProvider(zksyncNetwork: ZkSyncNetwork = ZkSyncNetwork.Localhost ```ts import { Provider, types, utils } from "zksync-ethers"; - + const providerMainnet = Provider.getDefaultProvider(types.Network.Mainnet); const providerTestnet = Provider.getDefaultProvider(types.Network.Sepolia); const providerLocalnet = Provider.getDefaultProvider(types.Network.Localhost); @@ -614,7 +614,7 @@ async getFeeParams(): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const feeParams = await provider.getFeeParams(); console.log(`Fee: ${utils.toJSON(feeParams)}`); @@ -638,7 +638,7 @@ async getFilterChanges(idx: bigint): Promise> ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const filter = await provider.newFilter({ address: utils.L2_ETH_TOKEN_ADDRESS, @@ -659,7 +659,7 @@ async getGasPrice(): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Gas price: ${await provider.getGasPrice()}`); ``` @@ -685,7 +685,7 @@ async getL1BatchBlockRange(l1BatchNumber: number): Promise<[number, number] | nu ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const l1BatchNumber = await provider.getL1BatchNumber(); console.log(`L1 batch block range: ${utils.toJSON(await provider.getL1BatchBlockRange(l1BatchNumber))}`); @@ -711,7 +711,7 @@ async getL1BatchDetails(number: number): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const l1BatchNumber = await provider.getL1BatchNumber(); console.log(`L1 batch details: ${utils.toJSON(await provider.getL1BatchDetails(l1BatchNumber))}`); @@ -731,7 +731,7 @@ async getL1BatchNumber(): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`L1 batch number: ${await provider.getL1BatchNumber()}`); ``` @@ -754,7 +754,7 @@ async getL2TransactionFromPriorityOp(l1TxResponse: ethers.TransactionResponse): ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const l1Tx = "0xcca5411f3e514052f4a4ae1c2020badec6e0998adb52c09959c5f5ff15fba3a8"; @@ -785,7 +785,7 @@ async getLogProof(txHash: BytesLike, index ? : number): Promise L1 transaction can be used. // In this case, withdrawal transaction is used. @@ -811,7 +811,7 @@ async getLogs(filter: Filter | FilterByBlockHash): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Logs: ${utils.toJSON(await provider.getLogs({ fromBlock: 0, toBlock: 5, address: utils.L2_ETH_TOKEN_ADDRESS }))}`); ``` @@ -830,7 +830,7 @@ async getMainContractAddress(): Promise
```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Main contract: ${await provider.getMainContractAddress()}`); ``` @@ -859,7 +859,7 @@ async getPriorityOpConfirmation(txHash: string, index: number = 0): Promise<{ ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); // Any L2 -> L1 transaction can be used. // In this case, withdrawal transaction is used. @@ -886,7 +886,7 @@ async getPriorityOpResponse(l1TxResponse: ethers.TransactionResponse): Promise

uint256) internal rawNonces; - + // Ensure the address is a 256-bit number by padding it // because rawNonces slot uses uint256 for mapping addresses and their nonces. const addressPadded = ethers.zeroPadValue(address, 32); - + // Convert the slot number to a hex string and pad it to 32 bytes. const slotPadded = ethers.zeroPadValue(ethers.toBeHex(0), 32); - + // Concatenate the padded address and slot number. const concatenated = addressPadded + slotPadded.slice(2); // slice to remove '0x' from the slotPadded - + // Hash the concatenated string using Keccak-256. const storageKey = ethers.keccak256(concatenated); - + const l1BatchNumber = await provider.getL1BatchNumber(); const storageProof = await provider.getProof(utils.NONCE_HOLDER_ADDRESS, [storageKey], l1BatchNumber); console.log(`Storage proof: ${utils.toJSON(storageProof)}`); @@ -964,7 +964,7 @@ async getProtocolVersion(id?: number): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Protocol version: ${await provider.getProtocolVersion()}`); ``` @@ -990,7 +990,7 @@ async getRawBlockTransactions(number: number): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Raw block transactions: ${utils.toJSON(await provider.getRawBlockTransactions(90_000))}`); ``` @@ -1008,7 +1008,7 @@ async getTestnetPaymasterAddress(): Promise

```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Testnet paymaster: ${await provider.getTestnetPaymasterAddress()}`); ``` @@ -1032,12 +1032,12 @@ async getTransaction(txHash: string): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); - + const TX_HASH = ""; const txHandle = await provider.getTransaction(TX_HASH); - + // Wait until the transaction is processed by the server. await txHandle.wait(); // Wait until the transaction is finalized. @@ -1065,9 +1065,9 @@ async getTransactionDetails(txHash: BytesLike): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); - + const TX_HASH = ""; console.log(`Transaction details: ${utils.toJSON(await provider.getTransactionDetails(TX_HASH))}`); ``` @@ -1092,7 +1092,7 @@ async getTransactionReceipt(txHash: string): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const TX_HASH = ""; console.log(`Transaction receipt: ${utils.toJSON(await provider.getTransactionReceipt(TX_HASH))}`); @@ -1116,9 +1116,9 @@ async getTransactionStatus(txHash: string): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); - + const TX_HASH = ""; console.log(`Transaction status: ${utils.toJSON(await provider.getTransactionStatus(TX_HASH))}`); ``` @@ -1135,7 +1135,7 @@ Returns the populated transfer transaction. | `amount` | `BigNumberish` | Amount of token. | | `from?` | `Address` | From address. | | `to?` | `Address` | To address. | -| `paymasterParams?` | [`PaymasterParams`](/sdk/js/ethers/api/v6/types#paymasterparams) | Paymaster parameters. | +| `paymasterParams?` | [`PaymasterParams`](/js/ethers/api/v6/types#paymasterparams) | Paymaster parameters. | | `overrides?` | [`ethers.Overrides`](https://docs.ethers.org/v6/api/contract/#Overrides) | Transaction's overrides which may be used to pass l2 `gasLimit`, `gasPrice`, `value`, etc. | ```ts @@ -1155,9 +1155,9 @@ Retrieve populated ETH transfer transaction. ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); - + const tx = await provider.getTransferTx({ token: utils.ETH_ADDRESS, amount: 7_000_000_000, @@ -1171,11 +1171,11 @@ Retrieve populated ETH transfer transaction using paymaster to facilitate fee pa ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const token = "0x927488F48ffbc32112F1fF721759649A89721F8F"; // Crown token which can be minted for free const paymaster = "0x13D0D8550769f59aa241a41897D4859c87f7Dd46"; // Paymaster for Crown token - + const tx = await provider.getTransferTx({ token: utils.ETH_ADDRESS, amount: 7_000_000_000, @@ -1204,7 +1204,7 @@ Returns the populated withdrawal transaction. | `from?` | `Address` | From address. | | `to?` | `Address` | To address. | | `bridgeAddress?` | `Address` | Bridge address. | -| `paymasterParams?` | [`PaymasterParams`](/sdk/js/ethers/api/v6/types#paymasterparams) | Paymaster parameters. | +| `paymasterParams?` | [`PaymasterParams`](/js/ethers/api/v6/types#paymasterparams) | Paymaster parameters. | | `overrides?` | [`ethers.Overrides`](https://docs.ethers.org/v6/api/contract/#Overrides) | Transaction's overrides which may be used to pass l2 `gasLimit`, `gasPrice`, `value`, etc. | ```ts @@ -1225,9 +1225,9 @@ Retrieve populated ETH withdrawal transactions. ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); - + const tx = await provider.getWithdrawTx({ token: utils.ETH_ADDRESS, amount: 7_000_000_000, @@ -1241,11 +1241,11 @@ Retrieve populated ETH withdrawal transaction using paymaster to facilitate fee ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const token = "0x927488F48ffbc32112F1fF721759649A89721F8F"; // Crown token which can be minted for free const paymaster = "0x13D0D8550769f59aa241a41897D4859c87f7Dd46"; // Paymaster for Crown token - + const tx = await provider.getWithdrawTx({ token: utils.ETH_ADDRESS, amount: 7_000_000_000, @@ -1279,7 +1279,7 @@ async isBaseToken(token: Address): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Is base token: ${await provider.isBaseToken("0x5C221E77624690fff6dd741493D735a17716c26B")}`); ``` @@ -1296,7 +1296,7 @@ async isEthBasedChain(): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Is ETH based chain: ${await provider.isEthBasedChain()}`); ``` @@ -1319,7 +1319,7 @@ async isL2BridgeLegacy(address: Address): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const isBridgeLegacy = await provider.isL2BridgeLegacy(""); console.log(isBridgeLegacy); @@ -1339,7 +1339,7 @@ async l1ChainId(): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`L1 chain ID: ${await provider.l1ChainId()}`); ``` @@ -1366,7 +1366,7 @@ async l1TokenAddress(token: Address): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`L1 token address: ${await provider.l1TokenAddress("0x3e7676937A7E96CFB7616f255b9AD9FF47363D4b")}`); ``` @@ -1394,7 +1394,7 @@ async l2TokenAddress(token: Address): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`L2 token address: ${await provider.l2TokenAddress("0x5C221E77624690fff6dd741493D735a17716c26B")}`); ``` @@ -1411,7 +1411,7 @@ async newBlockFilter(): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`New block filter: ${await provider.newBlockFilter()}`); ``` @@ -1436,7 +1436,7 @@ async newFilter(filter: FilterByBlockHash | Filter): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log( `New filter: ${await provider.newFilter({ @@ -1461,7 +1461,7 @@ async newPendingTransactionsFilter(): Promise ```ts import { Provider, types, utils } from "zksync-ethers"; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`New pending transaction filter: ${await provider.newPendingTransactionsFilter()}`); ``` @@ -1496,17 +1496,17 @@ async sendRawTransactionWithDetailedOutput(signedTx: string): Promise ```ts import { BrowserProvider, utils } from "zksync-ethers"; - + const provider = new BrowserProvider(window.ethereum); const fee = await provider.estimateFee - + ({ from: "0x36615Cf349d7F6344891B1e7CA7C72883F5dc049", to: "0xa61464658AfeAf65CccaaFD3a512b69A83B77618", @@ -70,7 +70,7 @@ Returns an estimate of the amount of gas required to submit a transaction from L | Parameter | Type | Description | | ------------- | -------------------------------------------------------- | ---------------------- | -| `transaction` | [`TransactionRequest`](/sdk/js/ethers/api/v6/types#transactionrequest) | Transaction request. | +| `transaction` | [`TransactionRequest`](/js/ethers/api/v6/types#transactionrequest) | Transaction request. | ```ts async estimateGasL1(transaction: TransactionRequest): Promise @@ -80,7 +80,7 @@ async estimateGasL1(transaction: TransactionRequest): Promise ```ts import { BrowserProvider } from "zksync-ethers"; - + const provider = new BrowserProvider(window.ethereum); const gasL1 = await provider.estimateGasL1({ from: "0x36615Cf349d7F6344891B1e7CA7C72883F5dc049", @@ -111,7 +111,7 @@ async getAllAccountBalances(address: Address): Promise ```ts import { BrowserProvider, utils } from "zksync-ethers"; - + const provider = new BrowserProvider(window.ethereum); const balances = await provider.getAllAccountBalances("0x36615Cf349d7F6344891B1e7CA7C72883F5dc049"); console.log(`All balances: ${utils.toJSON(balances)}`); @@ -137,7 +137,7 @@ async getBalance(address: Address, blockTag?: BlockTag, tokenAddress?: Address): ```ts import { BrowserProvider } from "zksync-ethers"; - + const provider = new BrowserProvider(window.ethereum); const account = "0x36615Cf349d7F6344891B1e7CA7C72883F5dc049"; const tokenAddress = "0x927488F48ffbc32112F1fF721759649A89721F8F"; // Crown token which can be minted for free @@ -157,7 +157,7 @@ async getBaseTokenContractAddress(): Promise
```ts import { BrowserProvider } from "zksync-ethers"; - + const provider = new BrowserProvider(window.ethereum); console.log(`Base token: ${await provider.getBaseTokenContractAddress()}`); ``` @@ -181,7 +181,7 @@ async getBlock(blockHashOrBlockTag: BlockTag, includeTxs?: boolean): Promise ```ts import { BrowserProvider, utils } from "zksync - + -ethers"; - + const provider = new BrowserProvider(window.ethereum); console.log(`Block details: ${utils.toJSON(await provider.getBlockDetails(90_000))}`); ``` @@ -223,7 +223,7 @@ async getBridgehubContractAddress(): Promise
```ts import { BrowserProvider } from "zksync-ethers"; - + const provider = new BrowserProvider(window.ethereum); console.log(`Bridgehub: ${await provider.getBridgehubContractAddress()}`); ``` @@ -246,13 +246,13 @@ async getBytecodeByHash(bytecodeHash: BytesLike): Promise ```ts import { BrowserProvider, utils } from "zksync-ethers"; - + // Bytecode hash can be computed by following these steps: // const testnetPaymasterBytecode = await provider.getCode(await provider.getTestnetPaymasterAddress()); // const testnetPaymasterBytecodeHash = ethers.hexlify(utils.hashBytecode(testnetPaymasterBytecode)); - + const testnetPaymasterBytecodeHash = "0x010000f16d2b10ddeb1c32f2c9d222eb1aea0f638ec94a81d4e916c627720e30"; - + const provider = new BrowserProvider(window.ethereum); console.log(`Bytecode: ${await provider.getBytecodeByHash(testnetPaymasterBytecodeHash)}`); ``` @@ -276,7 +276,7 @@ async getConfirmedTokens(start = 0, limit = 255): Promise ```ts import { BrowserProvider, utils } from "zksync-ethers"; - + const provider = new BrowserProvider(window.ethereum); const tokens = await provider.getConfirmedTokens(); console.log(`Confirmed tokens: ${utils.toJSON(tokens)}`); @@ -301,7 +301,7 @@ async getDefaultBridgeAddresses(): Promise<{ ```ts import { BrowserProvider, utils } from "zksync-ethers"; - + const provider = new BrowserProvider(window.ethereum); const bridgeAddresses = await provider.getDefaultBridgeAddresses(); console.log(`Default bridges: ${utils.toJSON(bridgeAddresses)}`); @@ -319,7 +319,7 @@ async getFeeParams(): Promise ```ts import { BrowserProvider, utils } from "zksync-ethers"; - + const provider = new BrowserProvider(window.ethereum); const feeParams = await provider.getFeeParams(); console.log(`Fee: ${utils.toJSON(feeParams)}`); @@ -337,7 +337,7 @@ async getGasPrice(): Promise ```ts import { BrowserProvider } from "zksync-ethers"; - + const provider = new BrowserProvider(window.ethereum); console.log(`Gas price: ${await provider.getGasPrice()}`); ``` @@ -360,7 +360,7 @@ async getL1BatchBlockRange(l1BatchNumber: number): Promise<[number, number] | nu ```ts import { BrowserProvider, utils } from "zksync-ethers"; - + const provider = new BrowserProvider(window.ethereum); const l1BatchNumber = await provider.getL1BatchNumber(); console.log(`L1 batch block range: ${utils.toJSON(await provider.getL1BatchBlockRange(l1BatchNumber))}`); @@ -386,7 +386,7 @@ async getL1BatchDetails(number: number): Promise ```ts import { BrowserProvider, utils } from "zksync-ethers"; - + const provider = new BrowserProvider(window.ethereum); const l1BatchNumber = await provider.getL1BatchNumber(); console.log(`L1 batch details: ${utils.toJSON(await provider.getL1BatchDetails(l1BatchNumber))}`); @@ -404,7 +404,7 @@ async getL1BatchNumber(): Promise ```ts import { BrowserProvider } from "zksync-ethers"; - + const provider = new BrowserProvider(window.ethereum); console.log(`L1 batch number: ${await provider.getL1BatchNumber()}`); ``` @@ -428,7 +428,7 @@ async getLogProof(txHash: BytesLike, index?: number): Promise ```ts import { BrowserProvider, utils } from "zksync-ethers"; - + const provider = new BrowserProvider(window.ethereum); const tx = "0x2a1c6c74b184965c0cb015aae9ea134fd96215d2e4f4979cfec12563295f610e"; console.log(`Log ${utils.toJSON(await provider.getLogProof(tx, 0))}`); @@ -452,7 +452,7 @@ async getLogs(filter: Filter | FilterByBlockHash): Promise ```ts import { BrowserProvider, utils } from "zksync-ethers"; - + const provider = new BrowserProvider(window.ethereum); console.log(`Logs: ${utils.toJSON(await provider.getLogs({ fromBlock: 0, toBlock: 5, address: utils.L2_ETH_TOKEN_ADDRESS }))}`); ``` @@ -469,7 +469,7 @@ async getMainContractAddress(): Promise
```ts import { BrowserProvider } from "zksync-ethers"; - + const provider = new BrowserProvider(window.ethereum); console.log(`Main contract: ${await provider.getMainContractAddress()}`); ``` @@ -495,26 +495,26 @@ async getProof(address: Address, keys: string[], l1BatchNumber: number): Promise ```ts import { BrowserProvider, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const provider = new BrowserProvider(window.ethereum); const address = "0x082b1BB53fE43810f646dDd71AA2AB201b4C6b04"; - + // Fetching the storage proof for rawNonces storage slot in NonceHolder system contract. // mapping(uint256 => uint256) internal rawNonces; - + // Ensure the address is a 256-bit number by padding it // because rawNonces slot uses uint256 for mapping addresses and their nonces. const addressPadded = ethers.zeroPadValue(address, 32); - + // Convert the slot number to a hex string and pad it to 32 bytes. const slotPadded = ethers.zeroPadValue(ethers.toBeHex(0), 32); - + // Concatenate the padded address and slot number. const concatenated = addressPadded + slotPadded.slice(2); // slice to remove '0x' from the slotPadded - + // Hash the concatenated string using Keccak-256. const storageKey = ethers.keccak256(concatenated); - + const l1BatchNumber = await provider.getL1BatchNumber(); const proof = await provider.getProof(address, [storageKey], l1BatchNumber); console.log(`Proof: ${utils.toJSON(proof)}`); @@ -538,7 +538,7 @@ async getProtocolVersion(id?: number): Promise ```ts import { BrowserProvider } from "zksync-ethers"; - + const provider = new BrowserProvider(window.ethereum); console.log(`Protocol version: ${await provider.getProtocolVersion()}`); ``` @@ -561,7 +561,7 @@ async getRawBlockTransactions(number: number): Promise ```ts import { BrowserProvider, utils } from "zksync-ethers"; - + const provider = new BrowserProvider(window.ethereum); console.log(`Raw block transactions: ${utils.toJSON(await provider.getRawBlockTransactions(90_000))}`); ``` @@ -584,10 +584,10 @@ async getSigner(address?: Address): Promise ```ts import { BrowserProvider, Wallet } from "zksync-ethers"; - + const provider = new BrowserProvider(window.ethereum); const signer = await provider.getSigner(); - + // Verify that signer matches the expected wallet address. console.log(`Signer address: ${await signer.getAddress()}`); ``` @@ -596,7 +596,7 @@ console.log(`Signer address: ${await signer.getAddress()}`); ```ts import { BrowserProvider } from "zksync-ethers"; - + const provider = new BrowserProvider(window.ethereum); console.log(`L2 token address: ${await provider.l2TokenAddress("0x5C221E77624690fff6dd741493D735a17716c26B")}`); ``` @@ -613,7 +613,7 @@ async getTestnetPaymasterAddress(): Promise
```ts import { BrowserProvider } from "zksync-ethers"; - + const provider = new BrowserProvider(window.ethereum); console.log(`Testnet paymaster: ${await provider.getTestnetPaymasterAddress()}`); ``` @@ -636,12 +636,12 @@ async getTransaction(txHash: string): Promise ```ts import { BrowserProvider } from "zksync-ethers"; - + const provider = new BrowserProvider(window.ethereum); - + const TX_HASH = ""; const tx = await provider.getTransaction(TX_HASH); - + // Wait until the transaction is processed by the server. await tx.wait(); // Wait until the transaction is finalized. @@ -666,9 +666,9 @@ async getTransactionDetails(txHash: BytesLike): Promise ```ts import { BrowserProvider, utils } from "zksync-ethers"; - + const provider = new BrowserProvider(window.ethereum); - + const TX_HASH = ""; console.log(`Transaction details: ${utils.toJSON(await provider.getTransactionDetails(TX_HASH))}`); ``` @@ -691,7 +691,7 @@ async getTransactionReceipt(txHash: string): Promise ```ts import { BrowserProvider, utils } from "zksync-ethers"; - + const provider = new BrowserProvider(window.ethereum); const TX_HASH = ""; console.log(`Transaction receipt: ${utils.toJSON(await provider.getTransactionReceipt(TX_HASH))}`); @@ -715,7 +715,7 @@ async isBaseToken(token: Address): Promise ```ts import { BrowserProvider } from "zksync-ethers"; - + const provider = new BrowserProvider(window.ethereum); console.log(`Is base token: ${await provider.isBaseToken("0x5C221E77624690fff6dd741493D735a17716c26B")}`); ``` @@ -732,7 +732,7 @@ async isEthBasedChain(): Promise ```ts import { BrowserProvider } from "zksync-ethers"; - + const provider = new BrowserProvider(window.ethereum); console.log(`Is ETH based chain: ${await provider.isEthBasedChain()}`); ``` @@ -749,7 +749,7 @@ async l1ChainId(): Promise ```ts import { BrowserProvider } from "zksync-ethers"; - + const provider = new BrowserProvider(window.ethereum); const l1ChainId = await provider.l1ChainId(); console.log(`All balances: ${l1ChainId}`); @@ -773,7 +773,7 @@ async l1TokenAddress(token: Address): Promise ```ts import { BrowserProvider } from "zksync-ethers"; - + const provider = new BrowserProvider(window.ethereum); console.log(`L1 token address: ${await provider.l1TokenAddress("0x3e7676937A7E96CFB7616f255b9AD9FF47363D4b")}`); ``` diff --git a/content/sdk/10.js/00.ethers/05.api/20.v6/01.accounts/00.introduction.md b/content/10.js/00.ethers/05.api/20.v6/01.accounts/00.introduction.md similarity index 100% rename from content/sdk/10.js/00.ethers/05.api/20.v6/01.accounts/00.introduction.md rename to content/10.js/00.ethers/05.api/20.v6/01.accounts/00.introduction.md diff --git a/content/sdk/10.js/00.ethers/05.api/20.v6/01.accounts/01.wallet.md b/content/10.js/00.ethers/05.api/20.v6/01.accounts/01.wallet.md similarity index 98% rename from content/sdk/10.js/00.ethers/05.api/20.v6/01.accounts/01.wallet.md rename to content/10.js/00.ethers/05.api/20.v6/01.accounts/01.wallet.md index 0684627d..e3ac0ec2 100644 --- a/content/sdk/10.js/00.ethers/05.api/20.v6/01.accounts/01.wallet.md +++ b/content/10.js/00.ethers/05.api/20.v6/01.accounts/01.wallet.md @@ -31,16 +31,16 @@ async approveERC20( ```ts import { Wallet, Provider, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + const tokenL1 = "0x56E69Fa1BB0d1402c89E3A4E3417882DeA6B14Be"; const txHandle = await wallet.approveERC20(tokenL1, "10000000"); - + await txHandle.wait(); ``` @@ -65,13 +65,13 @@ async claimFailedDeposit(depositHash: BytesLike): Promise; ```ts import { Wallet, Provider, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + console.log(`Address: ${await wallet.getAddress()}`); ``` @@ -651,13 +651,13 @@ async getAllBalances(): Promise ```ts import { Wallet, Provider, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + const allBalances = await wallet.getAllBalances(); ``` @@ -686,13 +686,13 @@ async getAllowanceL1( ```ts import { Wallet, Provider, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + const tokenL1 = "0x5C221E77624690fff6dd741493D735a17716c26B"; console.log(`Token allowance: ${await wallet.getAllowanceL1(tokenL1)}`); ``` @@ -717,15 +717,15 @@ async getBalance(token?: Address, blockTag: BlockTag = 'committed'): Promise ```ts import { Wallet, Provider, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + const tokenL1 = "0x56E69Fa1BB0d1402c89E3A4E3417882DeA6B14Be"; - + console.log(`Token balance: ${await wallet.getBalanceL1(tokenL1)}`); ``` @@ -786,13 +786,13 @@ async getBaseCost(params: { ```ts import { Wallet, Provider, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + console.log(`Base cost: ${await wallet.getBaseCost({ gasLimit: 100_000 })}`); ``` @@ -809,13 +809,13 @@ async getBaseToken(): Promise ```ts import { Wallet, Provider, types, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + console.log(`Base token: ${await wallet.getBaseToken()}`); ``` @@ -832,13 +832,13 @@ async getBridgehubContract(): Promise ```ts import { Wallet, Provider, types, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + const bridgehub = await wallet.getBridgehubContract(); ``` @@ -855,13 +855,13 @@ async getDeploymentNonce(): Promise ```ts import { Wallet, Provider, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + console.log(`Nonce: ${await wallet.getDeploymentNonce()}`); ``` @@ -887,7 +887,7 @@ async getDepositAllowanceParams( token: Address; allowance: BigNumberish; }[] -> +> ``` #### Example @@ -897,17 +897,17 @@ Get allowance parameters for depositing token on ETH-based chain. ```ts import { Wallet, Provider, types, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + const token = ""; const amount = 5; const approveParams = await wallet.getDepositAllowanceParams(token, amount); - + await ( await wallet.approveERC20( approveParams[0].token, @@ -921,17 +921,17 @@ Get allowance parameters for depositing ETH on non-ETH-based chain. ```ts import { Wallet, Provider, types, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + const token = utils.LEGACY_ETH_ADDRESS; const amount = 5; const approveParams = await wallet.getDepositAllowanceParams(token, amount); - + await ( await wallet.approveERC20( approveParams[0].token, @@ -945,17 +945,17 @@ Get allowance parameters for depositing base token on non-ETH-based chain. ```ts import { Wallet, Provider, types, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + const token = await wallet.getBaseToken(); const amount = 5; const approveParams = await wallet.getDepositAllowanceParams(token, amount); - + await ( await wallet.approveERC20( approveParams[0].token, @@ -969,24 +969,24 @@ Get allowance parameters for depositing non-base token on non-ETH-based chain. ```ts import { Wallet, Provider, types, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + const token = ""; const amount = 5; const approveParams = await wallet.getDepositAllowanceParams(token, amount); - + await ( await wallet.approveERC20( approveParams[0].token, approveParams[0].allowance ) ).wait(); - + await ( await wallet.approveERC20( approveParams[1].token, @@ -1034,13 +1034,13 @@ async getDepositTx(transaction: { ```ts import { Wallet, Provider, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + const tokenL1 = "0x56E69Fa1BB0d1402c89E3A4E3417882DeA6B14Be"; const tx = await wallet.getDepositTx({ token: tokenL1, @@ -1050,7 +1050,7 @@ const tx = await wallet.getDepositTx({ ### `getFullRequiredDepositFee` -Retrieves the full needed ETH fee for the deposit. Returns the L1 fee and the L2 fee [`FullDepositFee`](/sdk/js/ethers/api/v6/types#fulldepositfee). +Retrieves the full needed ETH fee for the deposit. Returns the L1 fee and the L2 fee [`FullDepositFee`](/js/ethers/api/v6/types#fulldepositfee). #### Inputs @@ -1079,13 +1079,13 @@ async getFullRequiredDepositFee(transaction: { ```ts import { Wallet, Provider, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + const tokenL1 = "0x56E69Fa1BB0d1402c89E3A4E3417882DeA6B14Be"; const fee = await wallet.getFullRequiredDepositFee({ token: tokenL1, @@ -1111,13 +1111,13 @@ async getL1BridgeContracts(): Promise<{ ```ts import { Wallet, Provider, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + const l1BridgeContracts = await wallet.getL1BridgeContracts(); ``` @@ -1138,13 +1138,13 @@ async getL2BridgeContracts(): Promise<{ ```ts import { Wallet, Provider, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + const l2BridgeContracts = await wallet.getL2BridgeContracts(); ``` @@ -1161,13 +1161,13 @@ async getMainContract(): Promise ```ts import { Wallet, Provider, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + console.log(`Main contract: ${await wallet.getMainContract()}`); ``` @@ -1190,13 +1190,13 @@ async getNonce(blockTag?: BlockTag): Promise ```ts import { Wallet, Provider, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + console.log(`Nonce: ${await wallet.getNonce()}`); ``` @@ -1225,12 +1225,12 @@ async getPriorityOpConfirmation(txHash: string, index: number = 0): Promise<{ ```ts import { Wallet, Provider, types, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const wallet = new Wallet(PRIVATE_KEY, provider); - + // Any L2 -> L1 transaction can be used. // In this case, withdrawal transaction is used. const tx = "0x2a1c6c74b184965c0cb015aae9ea134fd96215d2e4f4979cfec12563295f610e"; @@ -1275,19 +1275,19 @@ async getRequestExecuteAllowanceParams(transaction: { ```ts import { Wallet, Provider, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + const tx = { contractAddress: await wallet.getAddress(), calldata: '0x', l2Value: 7_000_000_000, }; - + const approveParams = await wallet.getRequestExecuteAllowanceParams(tx); await ( await wallet.approveERC20( @@ -1336,14 +1336,14 @@ async getRequestExecuteTx(transaction: { ```ts import { Wallet, Provider, types, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; const CONTRACT_ADDRESS = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + const tx = await wallet.getRequestExecuteTx({ contractAddress: await provider.getMainContractAddress(), calldata: "0x", @@ -1364,13 +1364,13 @@ async isETHBasedChain(): Promise ```ts import { Wallet, Provider, types, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + console.log(`Is ETH-based chain: ${await wallet.isETHBasedChain()}`); ``` @@ -1394,13 +1394,13 @@ async isWithdrawalFinalized(withdrawalHash: BytesLike, index: number = 0): Promi ```ts import { Wallet, Provider, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + const WITHDRAWAL_HASH = ""; const isFinalized = await wallet.isWithdrawalFinalized(WITHDRAWAL_HASH); ``` @@ -1428,15 +1428,15 @@ async l2TokenAddress(token: Address): Promise ```ts import { Wallet, Provider, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider, ethProvider); - + const tokenL1 = "0x5C221E77624690fff6dd741493D735a17716c26B"; - + console.log(`Token L2 address: ${await wallet.l2TokenAddress(tokenL1)}`); ``` @@ -1448,7 +1448,7 @@ The only required fields are `transaction.to` and either `transaction.data` or ` | Parameter | Type | Description | | ------------- | ----------------------------------------------------- | -------------------- | -| `transaction` | [`TransactionRequest`](/sdk/js/ethers/api/v6/types#transactionrequest) | Transaction request. | +| `transaction` | [`TransactionRequest`](/js/ethers/api/v6/types#transactionrequest) | Transaction request. | ```ts async populateTransaction(transaction: TransactionRequest): Promise @@ -1459,15 +1459,15 @@ async populateTransaction(transaction: TransactionRequest): Promise @@ -1549,15 +1549,15 @@ async sendTransaction(tx: TransactionRequest): Promise ```ts import { Wallet, Provider, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider); - + const recipient = Wallet.createRandom(); - + const tx = await wallet.sendTransaction({ type: utils.EIP712_TX_TYPE, to: recipient.address, @@ -1574,7 +1574,7 @@ Throws an error when `transaction.from` is mismatched from the private key. | Parameter | Type | Description | | ------------- | ----------------------------------------------------- | -------------------- | -| `transaction` | [`TransactionRequest`](/sdk/js/ethers/api/v6/types#transactionrequest) | Transaction request. | +| `transaction` | [`TransactionRequest`](/js/ethers/api/v6/types#transactionrequest) | Transaction request. | ```ts async signTransaction(transaction: TransactionRequest): Promise @@ -1585,15 +1585,15 @@ async signTransaction(transaction: TransactionRequest): Promise ```ts import { Wallet, Provider, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const wallet = new Wallet(PRIVATE_KEY, provider); - + const recipient = Wallet.createRandom(); - + const tx = await wallet.signTransaction({ type: utils.EIP712_TX_TYPE, to: recipient.address, @@ -1613,7 +1613,7 @@ token within the same interface. | `transaction.to` | `Address` | The address of the recipient. | | `transaction.amount` | `BigNumberish` | The amount of the token to transfer. | | `transaction.token?` | `Address` | The address of the token. `ETH` by default. | -| `transaction.paymasterParams?` | [`PaymasterParams`](/sdk/js/ethers/api/v6/types#paymasterparams) | Paymaster parameters. | +| `transaction.paymasterParams?` | [`PaymasterParams`](/js/ethers/api/v6/types#paymasterparams) | Paymaster parameters. | | `transaction.overrides?` | [`ethers.Overrides`](https://docs.ethers.org/v6/api/contract/#Overrides) | Transaction's overrides which may be used to pass L2 `gasLimit`, `gasPrice`, `value`, etc. | ```ts @@ -1632,21 +1632,21 @@ Transfer ETH. ```ts import { Wallet, Provider, utils } from "zksync-ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const wallet = new Wallet(PRIVATE_KEY, provider); - + const recipient = Wallet.createRandom(); - + const transferTx = await wallet.transfer({ to: recipient.address, amount: ethers.parseEther("0.01"), }); - + const receipt = await transferTx.wait(); - + console.log(`The sum of ${receipt.value} ETH was transferred to ${receipt.to}`); ``` @@ -1654,16 +1654,16 @@ Transfer ETH using paymaster to facilitate fee payment with an ERC20 token. ```ts import { Wallet, Provider, utils } from "zksync-ethers"; - + const PRIVATE_KEY = ""; const token = "0x927488F48ffbc32112F1fF721759649A89721F8F"; // Crown token which can be minted for free const paymaster = "0x13D0D8550769f59aa241a41897D4859c87f7Dd46"; // Paymaster for Crown token - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const wallet = new Wallet(PRIVATE_KEY, provider); - + const recipient = Wallet.createRandom(); - + const transferTx = await wallet.transfer({ to: Wallet.createRandom().address, amount: ethers.parseEther("0.01"), @@ -1674,9 +1674,9 @@ const transferTx = await wallet.transfer({ innerInput: new Uint8Array(), }), }); - + const receipt = await transferTx.wait(); - + console.log(`The sum of ${receipt.value} ETH was transferred to ${receipt.to}`); ``` @@ -1685,21 +1685,21 @@ Transfer token. ```ts import { Wallet, Provider, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const wallet = new Wallet(PRIVATE_KEY, provider); - + const tokenL2 = "0x6a4Fb925583F7D4dF82de62d98107468aE846FD1"; const transferTx = await wallet.transfer({ token: tokenL2, to: Wallet.createRandom().address, amount: ethers.parseEther("0.01"), }); - + const receipt = await transferTx.wait(); - + console.log(`The sum of ${receipt.value} token was transferred to ${receipt.to}`); ``` @@ -1708,14 +1708,14 @@ Transfer token using paymaster to facilitate fee payment with an ERC20 token. ```ts import { Wallet, Provider, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const PRIVATE_KEY = ""; const token = "0x927488F48ffbc32112F1fF721759649A89721F8F"; // Crown token which can be minted for free const paymaster = "0x13D0D8550769f59aa241a41897D4859c87f7Dd46"; // Paymaster for Crown token - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const wallet = new Wallet(PRIVATE_KEY, provider); - + const tokenL2 = "0x6a4Fb925583F7D4dF82de62d98107468aE846FD1"; const transferTx = await wallet.transfer({ token: tokenL2, @@ -1728,9 +1728,9 @@ const transferTx = await wallet.transfer({ innerInput: new Uint8Array(), }), }); - + const receipt = await transferTx.wait(); - + console.log(`The sum of ${receipt.value} token was transferred to ${receipt.to}`); ``` @@ -1747,7 +1747,7 @@ network to the target account on L1 network. | `transaction.amount` | `BigNumberish` | The amount of the token to withdraw. | | `transaction.to?` | `Address` | The address of the recipient on L1. | | `transaction.bridgeAddress?` | `Address` | The address of the bridge contract to be used. | -| `transaction.paymasterParams?` | [`PaymasterParams`](/sdk/js/ethers/api/v6/types#paymasterparams) | Paymaster parameters. | +| `transaction.paymasterParams?` | [`PaymasterParams`](/js/ethers/api/v6/types#paymasterparams) | Paymaster parameters. | | `transaction.overrides?` | [`ethers.Overrides`](https://docs.ethers.org/v6/api/contract/#Overrides) | Transaction's overrides which may be used to pass L2 `gasLimit`, `gasPrice`, `value`, etc. | ```ts @@ -1767,12 +1767,12 @@ Withdraw ETH. ```ts import { Wallet, Provider, types, utils } from "zksync-ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const wallet = new Wallet(PRIVATE_KEY, provider); - + const withdrawTx = await wallet.withdraw({ token: utils.ETH_ADDRESS, amount: 10_000_000n, @@ -1783,14 +1783,14 @@ Withdraw ETH using paymaster to facilitate fee payment with an ERC20 token. ```ts import { Wallet, Provider, types, utils } from "zksync-ethers"; - + const PRIVATE_KEY = ""; const token = "0x927488F48ffbc32112F1fF721759649A89721F8F"; // Crown token which can be minted for free const paymaster = "0x13D0D8550769f59aa241a41897D4859c87f7Dd46"; // Paymaster for Crown token - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const wallet = new Wallet(PRIVATE_KEY, provider); - + const withdrawTx = await wallet.withdraw({ token: utils.ETH_ADDRESS, amount: 10_000_000n, @@ -1807,12 +1807,12 @@ Withdraw token. ```ts import { Wallet, Provider, types } from "zksync-ethers"; - + const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const wallet = new Wallet(PRIVATE_KEY, provider); - + const tokenL2 = "0x6a4Fb925583F7D4dF82de62d98107468aE846FD1"; const withdrawTx = await wallet.withdraw({ token: tokenL2, @@ -1824,14 +1824,14 @@ Withdraw token using paymaster to facilitate fee payment with an ERC20 token. ```ts import { Wallet, Provider, types, utils } from "zksync-ethers"; - + const PRIVATE_KEY = ""; const token = "0x927488F48ffbc32112F1fF721759649A89721F8F"; // Crown token which can be minted for free const paymaster = "0x13D0D8550769f59aa241a41897D4859c87f7Dd46"; // Paymaster for Crown token - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const wallet = new Wallet(PRIVATE_KEY, provider); - + const tokenL2 = "0x6a4Fb925583F7D4dF82de62d98107468aE846FD1"; const withdrawTx = await wallet.withdraw({ token: tokenL2, diff --git a/content/sdk/10.js/00.ethers/05.api/20.v6/01.accounts/02.signer.md b/content/10.js/00.ethers/05.api/20.v6/01.accounts/02.signer.md similarity index 97% rename from content/sdk/10.js/00.ethers/05.api/20.v6/01.accounts/02.signer.md rename to content/10.js/00.ethers/05.api/20.v6/01.accounts/02.signer.md index bff959be..0da1cbbe 100644 --- a/content/sdk/10.js/00.ethers/05.api/20.v6/01.accounts/02.signer.md +++ b/content/10.js/00.ethers/05.api/20.v6/01.accounts/02.signer.md @@ -157,7 +157,7 @@ But for convenience, the `Wallet` class has `transfer` method, which can transfe | `transaction.to` | `Address` | The address of the recipient. | | `transaction.amount` | `BigNumberish` | The amount of the token to transfer. | | `transaction.token?` | `Address` | The address of the token. `ETH` by default. | -| `transaction.paymasterParams?` | [`PaymasterParams`](/sdk/js/ethers/api/v6/types#paymasterparams) | Paymaster parameters. | +| `transaction.paymasterParams?` | [`PaymasterParams`](/js/ethers/api/v6/types#paymasterparams) | Paymaster parameters. | | `transaction.overrides?` | [`ethers.Overrides`](https://docs.ethers.org/v6/api/contract/#Overrides) | Transaction's overrides which may be used to pass L2 `gasLimit`,
`gasPrice`, `value`, etc. | ```ts @@ -299,7 +299,7 @@ to the target account on L1 network. | `transaction.amount` | `BigNumberish` | The amount of the token to withdraw. | | `transaction.to?` | `Address` | The address of the recipient on L1. | | `transaction.bridgeAddress?` | `Address` | The address of the bridge contract to be used. | -| `transaction.paymasterParams?` | [`PaymasterParams`](/sdk/js/ethers/api/v6/types#paymasterparams) | Paymaster parameters. | +| `transaction.paymasterParams?` | [`PaymasterParams`](/js/ethers/api/v6/types#paymasterparams) | Paymaster parameters. | | `overrides?` | [`ethers.Overrides`](https://docs.ethers.org/v6/api/contract/#Overrides) | Transaction's overrides which may be used to pass L2 `gasLimit`, `gasPrice`, `value`, etc. | ```ts diff --git a/content/sdk/10.js/00.ethers/05.api/20.v6/01.accounts/03.l1signer.md b/content/10.js/00.ethers/05.api/20.v6/01.accounts/03.l1signer.md similarity index 99% rename from content/sdk/10.js/00.ethers/05.api/20.v6/01.accounts/03.l1signer.md rename to content/10.js/00.ethers/05.api/20.v6/01.accounts/03.l1signer.md index 0c6bcc77..b81c0a80 100644 --- a/content/sdk/10.js/00.ethers/05.api/20.v6/01.accounts/03.l1signer.md +++ b/content/10.js/00.ethers/05.api/20.v6/01.accounts/03.l1signer.md @@ -43,10 +43,10 @@ async approveERC20( ```ts import { Provider, L1Signer, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const browserProvider = new ethers.BrowserProvider(window.ethereum); const signer = L1Signer.from(await browserProvider.getSigner(), Provider.getDefaultProvider(types.Network.Sepolia)); - + const tokenL1 = "0x5C221E77624690fff6dd741493D735a17716c26B"; await signer.approveERC20(tokenL1, 5); ``` @@ -72,10 +72,10 @@ async claimFailedDeposit(depositHash: BytesLike): Promise ```ts import { Provider, L1Signer, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const browserProvider = new ethers.BrowserProvider(window.ethereum); const signer = L1Signer.from( await browserProvider.getSigner(), Provider.getDefaultProvider(types.Network.Sepolia) ); - + console.log(`Base token: ${await signer.getBaseToken()}`); ``` @@ -537,13 +537,13 @@ async getBridgehubContract(): Promise ```ts import { Provider, L1Signer, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const browserProvider = new ethers.BrowserProvider(window.ethereum); const signer = L1Signer.from( await browserProvider.getSigner(), Provider.getDefaultProvider(types.Network.Sepolia) ); - + const bridgehub = await signer.getBridgehubContract(); ``` @@ -569,7 +569,7 @@ async getDepositAllowanceParams( token: Address; allowance: BigNumberish; }[] -> +> ``` #### Example @@ -579,17 +579,17 @@ Get allowance parameters for depositing token on ETH-based chain. ```ts import { Provider, L1Signer, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const browserProvider = new ethers.BrowserProvider(window.ethereum); const signer = L1Signer.from( await browserProvider.getSigner(), Provider.getDefaultProvider(types.Network.Sepolia) ); - + const token = ""; const amount = 5; const approveParams = await signer.getDepositAllowanceParams(token, amount); - + await ( await signer.approveERC20( approveParams[0].token, @@ -603,13 +603,13 @@ Get allowance parameters for depositing ETH on non-ETH-based chain. ```ts import { Provider, L1Signer, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const browserProvider = new ethers.BrowserProvider(window.ethereum); const signer = L1Signer.from( await browserProvider.getSigner(), Provider.getDefaultProvider(types.Network.Sepolia) ); - + const token = utils.LEGACY_ETH_ADDRESS; const amount = 5; const approveParams = await signer.getDepositAllowanceParams(token, amount); @@ -626,13 +626,13 @@ Get allowance parameters for depositing base token on non-ETH-based chain. ```ts import { Provider, L1Signer, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const browserProvider = new ethers.BrowserProvider(window.ethereum); const signer = L1Signer.from( await browserProvider.getSigner(), Provider.getDefaultProvider(types.Network.Sepolia) ); - + const token = await signer.getBaseToken(); const amount = 5; const approveParams = await signer.getDepositAllowanceParams(token, amount); @@ -649,24 +649,24 @@ Get allowance parameters for depositing non-base token on non-ETH-based chain. ```ts import { Provider, L1Signer, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const browserProvider = new ethers.BrowserProvider(window.ethereum); const signer = L1Signer.from( await browserProvider.getSigner(), Provider.getDefaultProvider(types.Network.Sepolia) ); - + const token = ""; const amount = 5; const approveParams = await signer.getDepositAllowanceParams(token, amount); - + await ( await signer.approveERC20( approveParams[0].token, approveParams[0].allowance ) ).wait(); - + await ( await signer.approveERC20( approveParams[1].token, @@ -714,10 +714,10 @@ async getDepositTx(transaction: { ```ts import { Provider, L1Signer, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const browserProvider = new ethers.BrowserProvider(window.ethereum); const signer = L1Signer.from(await browserProvider.getSigner(), Provider.getDefaultProvider(types.Network.Sepolia)); - + const tokenL1 = "0x56E69Fa1BB0d1402c89E3A4E3417882DeA6B14Be"; const tx = await signer.getDepositTx({ token: tokenL1, @@ -727,7 +727,7 @@ const tx = await signer.getDepositTx({ ### `getFullRequiredDepositFee` -Retrieves the full needed ETH fee for the deposit. Returns the L1 fee and the L2 fee [`FullDepositFee`](/sdk/js/ethers/api/v6/types#fulldepositfee). +Retrieves the full needed ETH fee for the deposit. Returns the L1 fee and the L2 fee [`FullDepositFee`](/js/ethers/api/v6/types#fulldepositfee). #### Inputs @@ -756,10 +756,10 @@ async getFullRequiredDepositFee(transaction: { ```ts import { Provider, L1Signer, Wallet, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const browserProvider = new ethers.BrowserProvider(window.ethereum); const signer = L1Signer.from(await browserProvider.getSigner(), Provider.getDefaultProvider(types.Network.Sepolia)); - + const tokenL1 = "0x56E69Fa1BB0d1402c89E3A4E3417882DeA6B14Be"; const fee = await signer.getFullRequiredDepositFee({ token: tokenL1, @@ -785,10 +785,10 @@ async getL1BridgeContracts(): Promise<{ ```ts import { Provider, L1Signer, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const browserProvider = new ethers.BrowserProvider(window.ethereum); const signer = L1Signer.from(await browserProvider.getSigner(), Provider.getDefaultProvider(types.Network.Sepolia)); - + const l1BridgeContracts = await signer.getL1BridgeContracts(); ``` @@ -805,10 +805,10 @@ async getMainContract(): Promise ```ts import { Provider, L1Signer, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const browserProvider = new ethers.BrowserProvider(window.ethereum); const signer = L1Signer.from(await browserProvider.getSigner(), Provider.getDefaultProvider(types.Network.Sepolia)); - + const mainContract = await signer.getMainContract(); console.log(mainContract.address); ``` @@ -838,13 +838,13 @@ async getPriorityOpConfirmation(txHash: string, index: number = 0): Promise<{ ```ts import { Provider, L1Signer, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const browserProvider = new ethers.BrowserProvider(window.ethereum); const signer = L1Signer.from( await browserProvider.getSigner(), Provider.getDefaultProvider(types.Network.Sepolia) ); - + // Any L2 -> L1 transaction can be used. // In this case, withdrawal transaction is used. const tx = "0x2a1c6c74b184965c0cb015aae9ea134fd96215d2e4f4979cfec12563295f610e"; @@ -889,19 +889,19 @@ async getRequestExecuteAllowanceParams(transaction: { ```ts import { Provider, L1Signer, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const browserProvider = new ethers.BrowserProvider(window.ethereum); const signer = L1Signer.from( await browserProvider.getSigner(), Provider.getDefaultProvider(types.Network.Sepolia) ); - + const tx = { contractAddress: await signer.getAddress(), calldata: '0x', l2Value: 7_000_000_000, }; - + const approveParams = await signer.getRequestExecuteAllowanceParams(tx); await ( await signer.approveERC20( @@ -950,13 +950,13 @@ async getRequestExecuteTx(transaction: { ```ts import { Provider, L1Signer, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const browserProvider = new ethers.BrowserProvider(window.ethereum); const signer = L1Signer.from( await browserProvider.getSigner(), Provider.getDefaultProvider(types.Network.Sepolia) ); - + const tx = await signer.getRequestExecuteTx({ contractAddress: await signer.providerL2.getMainContractAddress(), calldata: "0x", @@ -977,13 +977,13 @@ async isETHBasedChain(): Promise ```ts import { Provider, L1Signer, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const browserProvider = new ethers.BrowserProvider(window.ethereum); const signer = L1Signer.from( await browserProvider.getSigner(), Provider.getDefaultProvider(types.Network.Sepolia) ); - + console.log(`Is ETH-based chain: ${await signer.isETHBasedChain()}`); ``` @@ -1007,10 +1007,10 @@ async isWithdrawalFinalized(withdrawalHash: BytesLike, index: number = 0): Promi ```ts import { Provider, L1Signer, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const browserProvider = new ethers.BrowserProvider(window.ethereum); const signer = L1Signer.from(await browserProvider.getSigner(), Provider.getDefaultProvider(types.Network.Sepolia)); - + const WITHDRAWAL_HASH = ""; const isFinalized = await signer.isWithdrawalFinalized(WITHDRAWAL_HASH); ``` @@ -1038,12 +1038,12 @@ async l2TokenAddress(token: Address): Promise ```ts import { Provider, L1Signer, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const browserProvider = new ethers.BrowserProvider(window.ethereum); const signer = L1Signer.from(await browserProvider.getSigner(), Provider.getDefaultProvider(types.Network.Sepolia)); - + const tokenL1 = "0x5C221E77624690fff6dd741493D735a17716c26B"; - + console.log(`Token L2 address: ${await signer.l2TokenAddress(tokenL1)}`); ``` @@ -1086,13 +1086,13 @@ async requestExecute(transaction: { ```ts import { Provider, L1Signer, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const browserProvider = new ethers.BrowserProvider(window.ethereum); const signer = L1Signer.from( await browserProvider.getSigner(), Provider.getDefaultProvider(types.Network.Sepolia) ); - + await signer.requestExecute({ contractAddress: await signer.providerL2.getMainContractAddress(), calldata: "0x", diff --git a/content/sdk/10.js/00.ethers/05.api/20.v6/01.accounts/04.l2voidsigner.md b/content/10.js/00.ethers/05.api/20.v6/01.accounts/04.l2voidsigner.md similarity index 100% rename from content/sdk/10.js/00.ethers/05.api/20.v6/01.accounts/04.l2voidsigner.md rename to content/10.js/00.ethers/05.api/20.v6/01.accounts/04.l2voidsigner.md diff --git a/content/sdk/10.js/00.ethers/05.api/20.v6/01.accounts/05.l1voidsigner.md b/content/10.js/00.ethers/05.api/20.v6/01.accounts/05.l1voidsigner.md similarity index 100% rename from content/sdk/10.js/00.ethers/05.api/20.v6/01.accounts/05.l1voidsigner.md rename to content/10.js/00.ethers/05.api/20.v6/01.accounts/05.l1voidsigner.md diff --git a/content/sdk/10.js/00.ethers/05.api/20.v6/01.accounts/06.eip712signer.md b/content/10.js/00.ethers/05.api/20.v6/01.accounts/06.eip712signer.md similarity index 84% rename from content/sdk/10.js/00.ethers/05.api/20.v6/01.accounts/06.eip712signer.md rename to content/10.js/00.ethers/05.api/20.v6/01.accounts/06.eip712signer.md index f88fa9f5..266e423d 100644 --- a/content/sdk/10.js/00.ethers/05.api/20.v6/01.accounts/06.eip712signer.md +++ b/content/10.js/00.ethers/05.api/20.v6/01.accounts/06.eip712signer.md @@ -23,7 +23,7 @@ Signs an Ethereum transaction using EIP-712. | Parameter | Type | Description | | ------------- | ----------------------------------------------------- | -------------------- | -| `transaction` | [`TransactionRequest`](/sdk/js/ethers/api/v6/types#transactionrequest) | Transaction request. | +| `transaction` | [`TransactionRequest`](/js/ethers/api/v6/types#transactionrequest) | Transaction request. | ```ts async sign(transaction: TransactionRequest): Promise @@ -37,7 +37,7 @@ Generates the signed digest of an Ethereum transaction using EIP-712. | Parameter | Type | Description | | ------------- | ----------------------------------------------------- | -------------------- | -| `transaction` | [`TransactionRequest`](/sdk/js/ethers/api/v6/types#transactionrequest) | Transaction request. | +| `transaction` | [`TransactionRequest`](/js/ethers/api/v6/types#transactionrequest) | Transaction request. | ```ts static getSignedDigest(transaction: TransactionRequest): ethers.BytesLike @@ -51,7 +51,7 @@ Generates the EIP-712 typed data from provided transaction. Optional fields are | Parameter | Type | Description | | ------------- | ----------------------------------------------------- | -------------------- | -| `transaction` | [`TransactionRequest`](/sdk/js/ethers/api/v6/types#transactionrequest) | Transaction request. | +| `transaction` | [`TransactionRequest`](/js/ethers/api/v6/types#transactionrequest) | Transaction request. | ```ts static getSignInput(transaction: TransactionRequest) diff --git a/content/sdk/10.js/00.ethers/05.api/20.v6/01.accounts/07.smartaccount.md b/content/10.js/00.ethers/05.api/20.v6/01.accounts/07.smartaccount.md similarity index 88% rename from content/sdk/10.js/00.ethers/05.api/20.v6/01.accounts/07.smartaccount.md rename to content/10.js/00.ethers/05.api/20.v6/01.accounts/07.smartaccount.md index 0102af10..1138300a 100644 --- a/content/sdk/10.js/00.ethers/05.api/20.v6/01.accounts/07.smartaccount.md +++ b/content/10.js/00.ethers/05.api/20.v6/01.accounts/07.smartaccount.md @@ -21,7 +21,7 @@ from any provider if `null` is provided. | Parameter | Type | Description | | ---------- | ----------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | -| `provider` | [`Provider`](/sdk/js/ethers/api/v6/providers/provider) or `null` | The provider to connect the `SmartAccount` to. If `null`, the `SmartAccount` will be detached from any provider. | +| `provider` | [`Provider`](/js/ethers/api/v6/providers/provider) or `null` | The provider to connect the `SmartAccount` to. If `null`, the `SmartAccount` will be detached from any provider. | ```ts connect(provider: null | Provider): SmartAccount @@ -31,13 +31,13 @@ connect(provider: null | Provider): SmartAccount ```ts import { Wallet, Provider, types } from "zksync-ethers"; - + const ADDRESS = "
"; const PRIVATE_KEY = ""; - + const sepoliaProvider = Provider.getDefaultProvider(types.Network.Sepolia); const sepoliaAccount = new SmartAccount({ address: ADDRESS, secret: PRIVATE_KEY }, sepoliaProvider); - + const mainnetProvider = Provider.getDefaultProvider(types.Network.Mainnet); const mainnetAccount = sepoliaAccount.connect(mainnetProvider); ``` @@ -45,14 +45,14 @@ const mainnetAccount = sepoliaAccount.connect(mainnetProvider); ### `constructor` Creates a `SmartAccount` instance with provided `signer` and `provider`. -By default, uses [`signPayloadWithECDSA`](/sdk/js/ethers/api/v6/utilities/smart-account-utils#signpayloadwithecdsa) and [`populateTransactionECDSA`](/sdk/js/ethers/api/v6/utilities/smart-account-utils#populatetransactionecdsa). +By default, uses [`signPayloadWithECDSA`](/js/ethers/api/v6/utilities/smart-account-utils#signpayloadwithecdsa) and [`populateTransactionECDSA`](/js/ethers/api/v6/utilities/smart-account-utils#populatetransactionecdsa). #### Inputs | Parameter | Type | Description | | ----------- | ----------------------------------------------------- | ----------------------------------------------------------------------- | -| `signer` | [`SmartAccountSigner`](/sdk/js/ethers/api/v6/types#smartaccountsigner) | Contains necessary properties for signing payloads. | -| `provider?` | [`Provider`](/sdk/js/ethers/api/v6/providers/provider) or `null` | The provider to connect to. Can be `null` for offline usage. | +| `signer` | [`SmartAccountSigner`](/js/ethers/api/v6/types#smartaccountsigner) | Contains necessary properties for signing payloads. | +| `provider?` | [`Provider`](/js/ethers/api/v6/providers/provider) or `null` | The provider to connect to. Can be `null` for offline usage. | ```ts constructor(signer: SmartAccountSigner, provider?: null | Provider) @@ -62,10 +62,10 @@ constructor(signer: SmartAccountSigner, provider?: null | Provider) ```ts import { SmartAccount, Provider, types } from "zksync-ethers"; - + const ADDRESS = "
"; const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const account = new SmartAccount({ address: ADDRESS, secret: PRIVATE_KEY }, provider); ``` @@ -82,13 +82,13 @@ getAddress(): Promise ```ts import { SmartAccount, Provider, types } from "zksync-ethers"; - + const ADDRESS = "
"; const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const account = new SmartAccount({ address: ADDRESS, secret: PRIVATE_KEY }, provider); - + const address = await account.getAddress(); ``` @@ -104,13 +104,13 @@ async getAllBalances(): Promise ```ts import { SmartAccount, Provider, types } from "zksync-ethers"; - + const ADDRESS = "
"; const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const account = new SmartAccount({ address: ADDRESS, secret: PRIVATE_KEY }, provider); - + const balances = await account.getAllBalances(); ``` @@ -133,13 +133,13 @@ async getBalance(token?: Address, blockTag: BlockTag = 'committed'): Promise ```ts import { SmartAccount, Provider, types } from "zksync-ethers"; - + const ADDRESS = "
"; const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const account = new SmartAccount({ address: ADDRESS, secret: PRIVATE_KEY }, provider); - + const nonce = await account.getDeploymentNonce(); ``` ### `populateTransaction` Populates the transaction `tx` using the -provided [`TransactionBuilder`](/sdk/js/ethers/api/v6/types#transactionbuilder) function. +provided [`TransactionBuilder`](/js/ethers/api/v6/types#transactionbuilder) function. If `tx.from` is not set, it sets the value from the `getAddress` method which can -be utilized in the [`TransactionBuilder`](/sdk/js/ethers/api/v6/types#transactionbuilder) function. +be utilized in the [`TransactionBuilder`](/js/ethers/api/v6/types#transactionbuilder) function. #### Inputs | Parameter | Type | Description | | --------- | ----------------------------------------------------- | ------------------------------------------- | -| `tx` | [`TransactionRequest`](/sdk/js/ethers/api/v6/types#transactionrequest) | The transaction that needs to be populated. | +| `tx` | [`TransactionRequest`](/js/ethers/api/v6/types#transactionrequest) | The transaction that needs to be populated. | ```ts async populateTransaction(tx: TransactionRequest): Promise @@ -186,13 +186,13 @@ async populateTransaction(tx: TransactionRequest): Promise ```ts import { SmartAccount, Provider, types, utils } from "zksync-ethers"; - + const ADDRESS = "
"; const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const account = new SmartAccount({ address: ADDRESS, secret: PRIVATE_KEY }, provider); - + const populatedTx = await account.populateTransaction({ type: utils.EIP712_TX_TYPE, to: "", @@ -209,7 +209,7 @@ is called first to ensure transaction is properly signed. | Parameter | Type | Description | | --------- | ----------------------------------------------------- | -------------------------------------- | -| `tx` | [`TransactionRequest`](/sdk/js/ethers/api/v6/types#transactionrequest) | The transaction that needs to be sent. | +| `tx` | [`TransactionRequest`](/js/ethers/api/v6/types#transactionrequest) | The transaction that needs to be sent. | ```ts async sendTransaction(tx: TransactionRequest): Promise @@ -220,13 +220,13 @@ async sendTransaction(tx: TransactionRequest): Promise ```ts import { SmartAccount, Provider, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const ADDRESS = "
"; const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const account = new SmartAccount({ address: ADDRESS, secret: PRIVATE_KEY }, provider); - + const signedTx = await account.sendTransaction({ to: "", value: ethers.parseEther("1"), @@ -235,7 +235,7 @@ const signedTx = await account.sendTransaction({ ### `signMessage` -Signs a `message` using the provided [`PayloadSigner`](/sdk/js/ethers/api/v6/types#payloadsigner) function. +Signs a `message` using the provided [`PayloadSigner`](/js/ethers/api/v6/types#payloadsigner) function. #### Inputs @@ -252,19 +252,19 @@ signMessage(message: string | Uint8Array): Promise ```ts import { SmartAccount, Provider, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const ADDRESS = "
"; const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const account = new SmartAccount({ address: ADDRESS, secret: PRIVATE_KEY }, provider); - + const signedMessage = await account.signMessage("Hello World!"); ``` ### `signTransaction` -Signs the transaction `tx` using the provided [`PayloadSigner`](/sdk/js/ethers/api/v6/types#payloadsigner) function, +Signs the transaction `tx` using the provided [`PayloadSigner`](/js/ethers/api/v6/types#payloadsigner) function, returning the fully signed transaction. The `populateTransaction` method is called first to ensure that all necessary properties for the transaction to be valid have been populated. @@ -273,7 +273,7 @@ have been populated. | Parameter | Type | Description | | --------- | ----------------------------------------------------- | ---------------------------------------- | -| `tx` | [`TransactionRequest`](/sdk/js/ethers/api/v6/types#transactionrequest) | The transaction that needs to be signed. | +| `tx` | [`TransactionRequest`](/js/ethers/api/v6/types#transactionrequest) | The transaction that needs to be signed. | ```ts async signTransaction(tx: TransactionRequest): Promise @@ -284,13 +284,13 @@ async signTransaction(tx: TransactionRequest): Promise ```ts import { SmartAccount, Provider, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const ADDRESS = "
"; const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const account = new SmartAccount({ address: ADDRESS, secret: PRIVATE_KEY }, provider); - + const signedTx = await account.signTransaction({ to: "", value: ethers.parseEther("1"), @@ -299,7 +299,7 @@ const signedTx = await account.signTransaction({ ### `signTypedData` -Signs a typed data using the provided [`PayloadSigner`](/sdk/js/ethers/api/v6/types#payloadsigner) function. +Signs a typed data using the provided [`PayloadSigner`](/js/ethers/api/v6/types#payloadsigner) function. #### Inputs @@ -322,13 +322,13 @@ async signTypedData( ```ts import { SmartAccount, Provider, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const ADDRESS = "
"; const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const account = new SmartAccount({ address: ADDRESS, secret: PRIVATE_KEY }, provider); - + const signedTypedData = await account.signTypedData( { name: "Example", version: "1", chainId: 270 }, { @@ -352,7 +352,7 @@ Transfer ETH or any ERC20 token within the same interface. | `transaction.to` | `Address` | The address of the recipient. | | `transaction.amount` | `BigNumberish` | The amount of the token to transfer. | | `transaction.token?` | `Address` | The address of the token. `ETH` by default. | -| `transaction.paymasterParams?` | [`PaymasterParams`](/sdk/js/ethers/api/v6/types#paymasterparams) | Paymaster parameters. | +| `transaction.paymasterParams?` | [`PaymasterParams`](/js/ethers/api/v6/types#paymasterparams) | Paymaster parameters. | | `transaction.overrides?` | [`ethers.Overrides`](https://docs.ethers.org/v6/api/contract/#Overrides) | Transaction's overrides which may be used to pass l2 `gasLimit`,
`gasPrice`, `value`, etc. | ```ts @@ -372,24 +372,24 @@ Transfer ETH. ```ts import { SmartAccount, Wallet, Provider, types } from "zksync-ethers"; import { ethers } from "ethers"; - + const ADDRESS = "
"; const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const account = new SmartAccount( {address: ADDRESS, secret: PRIVATE_KEY}, provider ); - + const transferTx = await account.transfer({ token: utils.ETH_ADDRESS, to: Wallet.createRandom().address, amount: ethers.parseEther("0.01"), }); - + const receipt = await transferTx.wait(); - + console.log(`The sum of ${receipt.value} ETH was transferred to ${receipt.to}`); ``` @@ -398,19 +398,19 @@ Transfer ETH using paymaster to facilitate fee payment with an ERC20 token. ```ts import { SmartAccount, Wallet, Provider, utils } from "zksync-ethers"; import { ethers } from "ethers"; - + const ADDRESS = "
"; const PRIVATE_KEY = ""; - + const token = "0x927488F48ffbc32112F1fF721759649A89721F8F"; // Crown token which can be minted for free const paymaster = "0x13D0D8550769f59aa241a41897D4859c87f7Dd46"; // Paymaster for Crown token - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const account = new SmartAccount( {address: ADDRESS, secret: PRIVATE_KEY}, provider ); - + const transferTx = await account.transfer({ to: Wallet.createRandom().address, amount: ethers.parseEther("0.01"), @@ -421,9 +421,9 @@ const transferTx = await account.transfer({ innerInput: new Uint8Array(), }), }); - + const receipt = await transferTx.wait(); - + console.log(`The sum of ${receipt.value} ETH was transferred to ${receipt.to}`); ``` @@ -440,7 +440,7 @@ network to the target account on L1 network. | `transaction.amount` | `BigNumberish` | The amount of the token to withdraw. | | `transaction.to?` | `Address` | The address of the recipient on L1. | | `transaction.bridgeAddress?` | `Address` | The address of the bridge contract to be used. | -| `transaction.paymasterParams?` | [`PaymasterParams`](/sdk/js/ethers/api/v6/types#paymasterparams) | Paymaster parameters. | +| `transaction.paymasterParams?` | [`PaymasterParams`](/js/ethers/api/v6/types#paymasterparams) | Paymaster parameters. | | `transaction.overrides?` | [`ethers.Overrides`](https://docs.ethers.org/v6/api/contract/#Overrides) | Transaction's overrides which may be used to pass l2 `gasLimit`, `gasPrice`, `value`, etc. | ```ts @@ -460,16 +460,16 @@ Withdraw ETH. ```ts import { SmartAccount, Provider, types, utils } from "zksync-ethers"; - + const ADDRESS = "
"; const PRIVATE_KEY = ""; - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const account = new SmartAccount( {address: ADDRESS, secret: PRIVATE_KEY}, provider ); - + const withdrawTx = await account.withdraw({ token: utils.ETH_ADDRESS, amount: 10_000_000n, @@ -480,19 +480,19 @@ Withdraw ETH using paymaster to facilitate fee payment with an ERC20 token. ```ts import { SmartAccount, Provider, types, utils } from "zksync-ethers"; - + const ADDRESS = "
"; const PRIVATE_KEY = ""; - + const token = "0x927488F48ffbc32112F1fF721759649A89721F8F"; // Crown token which can be minted for free const paymaster = "0x13D0D8550769f59aa241a41897D4859c87f7Dd46"; // Paymaster for Crown token - + const provider = Provider.getDefaultProvider(types.Network.Sepolia); const account = new SmartAccount( {address: ADDRESS, secret: PRIVATE_KEY}, provider ); - + const withdrawTx = await account.withdraw({ token: utils.ETH_ADDRESS, amount: 10_000_000n, diff --git a/content/sdk/10.js/00.ethers/05.api/20.v6/01.accounts/08.smartaccount-factories.md b/content/10.js/00.ethers/05.api/20.v6/01.accounts/08.smartaccount-factories.md similarity index 90% rename from content/sdk/10.js/00.ethers/05.api/20.v6/01.accounts/08.smartaccount-factories.md rename to content/10.js/00.ethers/05.api/20.v6/01.accounts/08.smartaccount-factories.md index 893e5f67..00390bdc 100644 --- a/content/sdk/10.js/00.ethers/05.api/20.v6/01.accounts/08.smartaccount-factories.md +++ b/content/10.js/00.ethers/05.api/20.v6/01.accounts/08.smartaccount-factories.md @@ -19,7 +19,7 @@ Creates a `SmartAccount` instance that uses a single ECDSA key for signing paylo | ---------- | ------------------------------------------------------------------------------------ | --------------------------- | | `address` | `string` | The account address. | | `secret` | `string` or [`ethers.SigningKey`](https://docs.ethers.org/v6/api/crypto/#SigningKey) | The ECDSA private key. | -| `provider` | [`Provider`](/sdk/js/ethers/api/v6/providers/provider) | The provider to connect to. | +| `provider` | [`Provider`](/js/ethers/api/v6/providers/provider) | The provider to connect to. | ```ts static create(address: string, secret: string | SigningKey, provider: Provider): SmartAccount @@ -53,7 +53,7 @@ Creates a `SmartAccount` instance that uses multiple ECDSA keys for signing payl | ---------- | ----------------------------------------------------------------------------------------- | ----------------------------------- | | `address` | `string` | The account address. | | `secret` | `string[]` or [`ethers.SigningKeyp[]`](https://docs.ethers.org/v6/api/crypto/#SigningKey) | The list of the ECDSA private keys. | -| `provider` | [`Provider`](/sdk/js/ethers/api/v6/providers/provider) | The provider to connect to. | +| `provider` | [`Provider`](/js/ethers/api/v6/providers/provider) | The provider to connect to. | ```ts static create(address: string, secret: string[] | SigningKey[], provider: Provider): SmartAccount diff --git a/content/sdk/10.js/00.ethers/05.api/20.v6/02.contract/00.contract-factory.md b/content/10.js/00.ethers/05.api/20.v6/02.contract/00.contract-factory.md similarity index 100% rename from content/sdk/10.js/00.ethers/05.api/20.v6/02.contract/00.contract-factory.md rename to content/10.js/00.ethers/05.api/20.v6/02.contract/00.contract-factory.md diff --git a/content/sdk/10.js/00.ethers/05.api/20.v6/02.contract/01.contracts.md b/content/10.js/00.ethers/05.api/20.v6/02.contract/01.contracts.md similarity index 95% rename from content/sdk/10.js/00.ethers/05.api/20.v6/02.contract/01.contracts.md rename to content/10.js/00.ethers/05.api/20.v6/02.contract/01.contracts.md index 3b2397ce..4a3afa53 100644 --- a/content/sdk/10.js/00.ethers/05.api/20.v6/02.contract/01.contracts.md +++ b/content/10.js/00.ethers/05.api/20.v6/02.contract/01.contracts.md @@ -22,4 +22,4 @@ essential due to the unique requirements of deploying contracts on ZKsync compar To pay for smart contract interactions using ERC20 tokens, the `customData` override should be utilized. This feature allows for more flexible payment options within the ZKsync network. -For more details on accessing ZKsync-specific features, refer to the [ZKsync Era Features](/sdk/js/ethers/guides/features). +For more details on accessing ZKsync-specific features, refer to the [ZKsync Era Features](/js/ethers/guides/features). diff --git a/content/sdk/10.js/00.ethers/05.api/20.v6/03.abi/_dir.yml b/content/10.js/00.ethers/05.api/20.v6/03.abi/_dir.yml similarity index 100% rename from content/sdk/10.js/00.ethers/05.api/20.v6/03.abi/_dir.yml rename to content/10.js/00.ethers/05.api/20.v6/03.abi/_dir.yml diff --git a/content/sdk/10.js/00.ethers/05.api/20.v6/04.utilities/00.utils.md b/content/10.js/00.ethers/05.api/20.v6/04.utilities/00.utils.md similarity index 98% rename from content/sdk/10.js/00.ethers/05.api/20.v6/04.utilities/00.utils.md rename to content/10.js/00.ethers/05.api/20.v6/04.utilities/00.utils.md index b8cb0b87..da0b31e7 100644 --- a/content/sdk/10.js/00.ethers/05.api/20.v6/04.utilities/00.utils.md +++ b/content/10.js/00.ethers/05.api/20.v6/04.utilities/00.utils.md @@ -270,7 +270,7 @@ const l2ContractAddress = utils.applyL1ToL2Alias(l1ContractAddress); ``` ::callout -See also [`undol1tol2alias`](/sdk/js/ethers/api/v6/utilities/utils#undol1tol2alias). +See also [`undol1tol2alias`](/js/ethers/api/v6/utilities/utils#undol1tol2alias). :: ### `checkBaseCost` @@ -351,8 +351,8 @@ Returns the hash of an EIP712 transaction. | Parameter | Type | Description | | --------------- | ---------------------------------------------------------------------- | ---------------------------------------------- | -| `transaction` | `Transaction` or [`TransactionRequest`](/sdk/js/ethers/api/v6/types#transactionrequest) | EIP-712 transaction. | -| `ethSignature?` | [`EthereumSignature`](/sdk/js/ethers/api/v6/types#ethereumsignature) | ECDSA signature of the transaction. | +| `transaction` | `Transaction` or [`TransactionRequest`](/js/ethers/api/v6/types#transactionrequest) | EIP-712 transaction. | +| `ethSignature?` | [`EthereumSignature`](/js/ethers/api/v6/types#ethereumsignature) | ECDSA signature of the transaction. | ```ts function eip712TxHash(transaction: any, ethSignature?: EthereumSignature): string; @@ -510,7 +510,7 @@ function isAddressEq(a: Address, b: Address): boolean ```ts import { Wallet, utils } from "zksync-ethers"; - + utils.isAddressEq("0x36615Cf349d7F6344891B1e7CA7C72883F5dc049", "0x36615cf349d7f6344891b1e7ca7c72883f5dc049") // true ``` @@ -538,15 +538,15 @@ function isECDSASignatureCorrect(address: string, msgHash: string, signature: Si ```ts import { Wallet, utils } from "zksync-ethers"; - + const ADDRESS = ""; const PRIVATE_KEY = ""; - + const message = "Hello, world!"; const signature = await new Wallet(PRIVATE_KEY).signMessage(message); // ethers.Wallet can be used as well // const signature = await new ethers.Wallet(PRIVATE_KEY).signMessage(message); - + const isValidSignature = await utils.isECDSASignatureCorrect(ADDRESS, message, signature); // isValidSignature = true ``` @@ -625,16 +625,16 @@ async function isMessageSignatureCorrect(provider: Provider, address: string, me ```ts import { Wallet, utils, Provider } from "zksync-ethers"; - + const ADDRESS = ""; const PRIVATE_KEY = ""; const provider = Provider.getDefaultProvider(types.Network.Sepolia); - + const message = "Hello, world!"; const signature = await new Wallet(PRIVATE_KEY).signMessage(message); // ethers.Wallet can be used as well // const signature = await new ethers.Wallet(PRIVATE_KEY).signMessage(message); - + const isValidSignature = await utils.isMessageSignatureCorrect(provider, ADDRESS, message, signature); // isValidSignature = true ``` @@ -688,11 +688,11 @@ async function isTypedDataSignatureCorrect( ```ts import { Wallet, utils, Provider, EIP712Signer } from "zksync-ethers"; - + const ADDRESS = ""; const PRIVATE_KEY = ""; const provider = Provider.getDefaultProvider(types.Network.Sepolia); - + const tx: types.TransactionRequest = { type: 113, chainId: 270, @@ -700,14 +700,14 @@ const tx: types.TransactionRequest = { to: "0xa61464658AfeAf65CccaaFD3a512b69A83B77618", value: BigInt(7_000_000), }; - + const eip712Signer = new EIP712Signer( new Wallet(PRIVATE_KEY), // or new ethers.Wallet(PRIVATE_KEY), Number((await provider.getNetwork()).chainId) ); - + const signature = await eip712Signer.sign(tx); - + const isValidSignature = await utils.isTypedDataSignatureCorrect(provider, ADDRESS, await eip712Signer.getDomain(), utils.EIP712_TYPES, EIP712Signer.getSignInput(tx), signature); // isValidSignature = true ``` @@ -753,7 +753,7 @@ Serialize EIP712 transaction without signature. ```ts const serializedTx = utils.serializeEip712({ chainId: 270, from: "0x36615Cf349d7F6344891B1e7CA7C72883F5dc049" }, null); - + // serializedTx = "0x71ea8080808080808082010e808082010e9436615cf349d7f6344891b1e7ca7c72883f5dc04982c350c080c0" ``` @@ -761,7 +761,7 @@ Serialize EIP712 transaction with signature. ```ts const signature = ethers.Signature.from("0x73a20167b8d23b610b058c05368174495adf7da3a4ed4a57eb6dbdeb1fafc24aaf87530d663a0d061f69bb564d2c6fb46ae5ae776bbd4bd2a2a4478b9cd1b42a"); - + const serializedTx = utils.serializeEip712( { chainId: 270, @@ -806,7 +806,7 @@ function toJSON(object: any): string; ```ts import { utils } from "zksync-ethers"; - + const json = utils.toJSON({gasLimit: 1_000n}) // {"gasLimit": 1000} ``` @@ -853,7 +853,7 @@ try { ```ts import { types } from "zksync-ethers"; - + const serializedTx = "0x71f87f8080808094a61464658afeaf65cccaafd3a512b69a83b77618830f42408001a073a20167b8d23b610b058c05368174495adf7da3a4ed4a57eb6dbdeb1fafc24aa02f87530d663a0d061f69bb564d2c6fb46ae5ae776bbd4bd2a2a4478b9cd1b42a82010e9436615cf349d7f6344891b1e7ca7c72883f5dc04982c350c080c0"; const tx: types.TransactionLike = utils.parseEip712(serializedTx); diff --git a/content/sdk/10.js/00.ethers/05.api/20.v6/04.utilities/01.paymaster-utils.md b/content/10.js/00.ethers/05.api/20.v6/04.utilities/01.paymaster-utils.md similarity index 84% rename from content/sdk/10.js/00.ethers/05.api/20.v6/04.utilities/01.paymaster-utils.md rename to content/10.js/00.ethers/05.api/20.v6/04.utilities/01.paymaster-utils.md index 88a608db..1ffcf148 100644 --- a/content/sdk/10.js/00.ethers/05.api/20.v6/04.utilities/01.paymaster-utils.md +++ b/content/10.js/00.ethers/05.api/20.v6/04.utilities/01.paymaster-utils.md @@ -25,7 +25,7 @@ Returns the encoded input for an approval-based paymaster. | Parameter | Type | Description | | ---------------- | ----------------------------------------------------------------------- | -------------------------------- | -| `paymasterInput` | [`ApprovalBasedPaymasterInput`](/sdk/js/ethers/api/v6/types#approvalbasedpaymasterinput) | The input data to the paymaster. | +| `paymasterInput` | [`ApprovalBasedPaymasterInput`](/js/ethers/api/v6/types#approvalbasedpaymasterinput) | The input data to the paymaster. | ```ts function getApprovalBasedPaymasterInput(paymasterInput: ApprovalBasedPaymasterInput): BytesLike; @@ -39,7 +39,7 @@ Returns the encoded input for a general-based paymaster. | Parameter | Type | Description | | ---------------- | ----------------------------------------------------------- | -------------------------------- | -| `paymasterInput` | [`GeneralPaymasterInput`](/sdk/js/ethers/api/v6/types#generalpaymasterinput) | The input data to the paymaster. | +| `paymasterInput` | [`GeneralPaymasterInput`](/js/ethers/api/v6/types#generalpaymasterinput) | The input data to the paymaster. | ```ts function getGeneralPaymasterInput(paymasterInput: GeneralPaymasterInput): BytesLike; @@ -54,13 +54,13 @@ Returns a correctly-formed `paymasterParams` object for common [paymaster flows] | Parameter | Type | Description | | ------------------ | --------------------------------------------- | --------------------------------- | | `paymasterAddress` | `Address` | The non-zero `paymaster` address. | -| `paymasterInput` | [`PaymasterInput`](/sdk/js/ethers/api/v6/types#paymasterinput) | The input data to the paymaster. | +| `paymasterInput` | [`PaymasterInput`](/js/ethers/api/v6/types#paymasterinput) | The input data to the paymaster. | ```ts function getPaymasterParams(paymasterAddress: Address, paymasterInput: PaymasterInput): PaymasterParams; ``` -Find out more about the [`PaymasterInput` type](/sdk/js/ethers/api/v6/types#paymasterinput). +Find out more about the [`PaymasterInput` type](/js/ethers/api/v6/types#paymasterinput). #### Examples diff --git a/content/sdk/10.js/00.ethers/05.api/20.v6/04.utilities/02.smart-account-utils.md b/content/10.js/00.ethers/05.api/20.v6/04.utilities/02.smart-account-utils.md similarity index 95% rename from content/sdk/10.js/00.ethers/05.api/20.v6/04.utilities/02.smart-account-utils.md rename to content/10.js/00.ethers/05.api/20.v6/04.utilities/02.smart-account-utils.md index 8a525ec2..70e7ae16 100644 --- a/content/sdk/10.js/00.ethers/05.api/20.v6/04.utilities/02.smart-account-utils.md +++ b/content/10.js/00.ethers/05.api/20.v6/04.utilities/02.smart-account-utils.md @@ -28,7 +28,7 @@ Populates missing properties meant for signing using an ECDSA private key: | ---------- | ------------------------------------------------------------------------------------ |---------------------------------------------------| | `tx` | `BytesLike` | The transaction that needs to be populated. | | `secret` | `string` or [`ethers.SigningKey`](https://docs.ethers.org/v6/api/crypto/#SigningKey) | The ECDSA private key. | -| `provider` | [`Provider`](/sdk/js/ethers/api/v6/providers/provider) | The provider which fetches data from the network. | +| `provider` | [`Provider`](/js/ethers/api/v6/providers/provider) | The provider which fetches data from the network. | ```ts const populateTransactionECDSA: TransactionBuilder = async (tx, secret: string | SigningKey, provider) @@ -66,7 +66,7 @@ of the first ECDSA key is set as the `secret` argument. | ---------- | ---------------------------------------------------------------------------------------- |-------------------------------------------------------------------------| | `tx` | `BytesLike` | The transaction that needs to be populated. | | `secret` | `string[]` or [`ethers.SigningKey[]`](https://docs.ethers.org/v6/api/crypto/#SigningKey) | The list of the ECDSA private keys used for populating the transaction. | -| `provider` | [`Provider`](/sdk/js/ethers/api/v6/providers/provider) | The provider which fetches data from the network. | +| `provider` | [`Provider`](/js/ethers/api/v6/providers/provider) | The provider which fetches data from the network. | ```ts const populateTransactionMultisigECDSA: TransactionBuilder = async (tx, secret: string[] | SigningKey[], provider) diff --git a/content/sdk/10.js/00.ethers/05.api/20.v6/05.types.md b/content/10.js/00.ethers/05.api/20.v6/05.types.md similarity index 99% rename from content/sdk/10.js/00.ethers/05.api/20.v6/05.types.md rename to content/10.js/00.ethers/05.api/20.v6/05.types.md index 401d4c0f..31829354 100644 --- a/content/sdk/10.js/00.ethers/05.api/20.v6/05.types.md +++ b/content/10.js/00.ethers/05.api/20.v6/05.types.md @@ -730,7 +730,7 @@ Interface representation of raw block with transactions. ## `SmartAccountSigner` -Encapsulates the required input parameters for creating a signer for [`SmartAccount`](/sdk/js/ethers/api/v6/accounts/smartaccount). +Encapsulates the required input parameters for creating a signer for [`SmartAccount`](/js/ethers/api/v6/accounts/smartaccount). ::field-group ::collapsible diff --git a/content/sdk/10.js/00.ethers/05.api/20.v6/_dir.yml b/content/10.js/00.ethers/05.api/20.v6/_dir.yml similarity index 100% rename from content/sdk/10.js/00.ethers/05.api/20.v6/_dir.yml rename to content/10.js/00.ethers/05.api/20.v6/_dir.yml diff --git a/content/sdk/10.js/00.ethers/05.api/_dir.yml b/content/10.js/00.ethers/05.api/_dir.yml similarity index 100% rename from content/sdk/10.js/00.ethers/05.api/_dir.yml rename to content/10.js/00.ethers/05.api/_dir.yml diff --git a/content/sdk/10.js/00.ethers/_dir.yml b/content/10.js/00.ethers/_dir.yml similarity index 100% rename from content/sdk/10.js/00.ethers/_dir.yml rename to content/10.js/00.ethers/_dir.yml diff --git a/content/sdk/10.js/_dir.yml b/content/10.js/_dir.yml similarity index 100% rename from content/sdk/10.js/_dir.yml rename to content/10.js/_dir.yml diff --git a/content/sdk/100.release-note.md b/content/100.release-note.md similarity index 100% rename from content/sdk/100.release-note.md rename to content/100.release-note.md diff --git a/content/sdk/20.go/00.introduction/00.overview.md b/content/20.go/00.introduction/00.overview.md similarity index 92% rename from content/sdk/20.go/00.introduction/00.overview.md rename to content/20.go/00.introduction/00.overview.md index bb9c518c..0f5b8121 100644 --- a/content/sdk/20.go/00.introduction/00.overview.md +++ b/content/20.go/00.introduction/00.overview.md @@ -20,5 +20,5 @@ interfaces and comprehensive documentation. - **Interoperability**: Compatible with existing Ethereum tools and infrastructure. ::callout{icon="i-heroicons-light-bulb"} -To use the `zksync2-go`, visit the [Getting Started](/sdk/go/guides/getting-started) page. +To use the `zksync2-go`, visit the [Getting Started](/go/guides/getting-started) page. :: diff --git a/content/sdk/20.go/00.introduction/01.why-zksync2-go.md b/content/20.go/00.introduction/01.why-zksync2-go.md similarity index 100% rename from content/sdk/20.go/00.introduction/01.why-zksync2-go.md rename to content/20.go/00.introduction/01.why-zksync2-go.md diff --git a/content/sdk/20.go/00.introduction/02.installation.md b/content/20.go/00.introduction/02.installation.md similarity index 100% rename from content/sdk/20.go/00.introduction/02.installation.md rename to content/20.go/00.introduction/02.installation.md diff --git a/content/sdk/20.go/01.guides/00.getting-started.md b/content/20.go/01.guides/00.getting-started.md similarity index 99% rename from content/sdk/20.go/01.guides/00.getting-started.md rename to content/20.go/01.guides/00.getting-started.md index b8c53b5f..9f2cadbc 100644 --- a/content/sdk/20.go/01.guides/00.getting-started.md +++ b/content/20.go/01.guides/00.getting-started.md @@ -8,7 +8,7 @@ This guide provides an overview of the most common operations developers need to ::callout{icon="i-heroicons-light-bulb"} Ensure you have installed the `zksync2-go` SDK. If you still need to do so, please refer to -the [installation guide](/sdk/go/introduction/installation) for detailed instructions. +the [installation guide](/go/introduction/installation) for detailed instructions. :: ## Overview @@ -338,7 +338,7 @@ func main() { // please refer to the documentation: https://era.zksync.io/docs/reference/troubleshooting/withdrawal-delay.html. // Once the withdrawal transaction is submitted on L1, it needs to be finalized. // To learn more about how to achieve this, please take a look at the 04_finalize_withdraw.go script. -} +} :: 4. Deploy a smart contract using CREATE method @@ -606,7 +606,7 @@ func main() { log.Panic(err) } fmt.Println("Value after Set method execution: ", value) -} +} :: 6. Deploy custom token on ZKsync Era @@ -693,7 +693,7 @@ func main() { log.Panic(err) } fmt.Println("Decimals: ", decimals) -} +} :: 7. Deploy smart account diff --git a/content/sdk/20.go/01.guides/01.features.md b/content/20.go/01.guides/01.features.md similarity index 90% rename from content/sdk/20.go/01.guides/01.features.md rename to content/20.go/01.guides/01.features.md index ffee8c41..f06bdec7 100644 --- a/content/sdk/20.go/01.guides/01.features.md +++ b/content/20.go/01.guides/01.features.md @@ -21,14 +21,14 @@ This document will focus solely on how to pass these arguments to the SDK. ## EIP-712 Metadata -[`EIP712Meta`](/sdk/go/api/types#eip712meta) contains EIP-712 transaction metadata. +[`EIP712Meta`](/go/api/types#eip712meta) contains EIP-712 transaction metadata. The following objects contain `EIP712Meta` and provides working with EIP-712 transactions: -- [`types.CallMsg`](/sdk/go/api/types#callmsg) -- [`types.Transaction712`](/sdk/go/api/types#transaction712) -- [`accounts.CallMsg`](/sdk/go/api/types#callmsg) -- [`accounts.Transaction`](/sdk/go/api/types#transactiondetails) +- [`types.CallMsg`](/go/api/types#callmsg) +- [`types.Transaction712`](/go/api/types#transaction712) +- [`accounts.CallMsg`](/go/api/types#callmsg) +- [`accounts.Transaction`](/go/api/types#transactiondetails) ## Encoding paymaster params @@ -38,7 +38,7 @@ the Matter Labs team endorses certain types of that are processable by EOAs. ZKsync SDK provides a utility method that can be used to get the correctly formed `PaymasterParams` object: -[GetPaymasterParams](/sdk/go/api/utilities/paymaster-utils#getpaymasterparams). +[GetPaymasterParams](/go/api/utilities/paymaster-utils#getpaymasterparams). ## See in action diff --git a/content/sdk/20.go/01.guides/02.accounts-l1-l2.md b/content/20.go/01.guides/02.accounts-l1-l2.md similarity index 94% rename from content/sdk/20.go/01.guides/02.accounts-l1-l2.md rename to content/20.go/01.guides/02.accounts-l1-l2.md index f932b666..20294165 100644 --- a/content/sdk/20.go/01.guides/02.accounts-l1-l2.md +++ b/content/20.go/01.guides/02.accounts-l1-l2.md @@ -4,19 +4,19 @@ description: Methods for handling transactions between L1 and L2 networks on ZKs tags: ["zksync", "l1", "l2", "transactions", "go", "sdk"] --- -This section explores the methods which allow the [account](/sdk/go/api/accounts/introduction) to send transactions +This section explores the methods which allow the [account](/go/api/accounts/introduction) to send transactions among both L1 to L2 networks. For background on how L1<->L2 interaction works on ZKsync, go through the [introduction](https://docs.zksync.io/build/developer-reference/l1-l2-interoperability). ::callout{icon="i-heroicons-light-bulb"} -Full examples of actions below are available on the [getting started](/sdk/go/guides/getting-started) page. +Full examples of actions below are available on the [getting started](/go/guides/getting-started) page. :: ## Deposit `WalletL1` and `Wallet` objects provide a deposit workflow. For more information, please refer to the method -specification [`Deposit`](/sdk/go/api/accounts/walletl1#deposit). +specification [`Deposit`](/go/api/accounts/walletl1#deposit). For a comprehensive example demonstrating the deposit workflow, refer to the following: @@ -263,33 +263,33 @@ func main() { } fmt.Println("Token balance on L2 network: ", tokenL2Balance) -} +} :: ## Request execute `WalletL1` and `Wallet` objects provide an option to request execution of L2 transaction from L1. -For more information, please refer to the method specification [`RequestExecute`](/sdk/go/api/accounts/walletl1#requestexecute). +For more information, please refer to the method specification [`RequestExecute`](/go/api/accounts/walletl1#requestexecute). ## Base cost `WalletL1` and `Wallet` objects provide an option to calculate base cost for L2 transaction. -For more information, please refer to the method specification [`BaseCost`](/sdk/go/api/accounts/walletl1#basecost). +For more information, please refer to the method specification [`BaseCost`](/go/api/accounts/walletl1#basecost). ## Claim failed deposit `WalletL1` and `Wallet` objects provide a claim fail deposit workflow. For more information, -please refer to the method specification [`ClaimFailedDeposit`](/sdk/go/api/accounts/walletl1#claimfaileddeposit). +please refer to the method specification [`ClaimFailedDeposit`](/go/api/accounts/walletl1#claimfaileddeposit). ## Finalize withdraw `WalletL1` and `Wallet` objects provide a finalize withdraw workflow. For more information, -please refer to the method specification [`FinalizeWithdraw`](/sdk/go/api/accounts/introduction#finalizewithdraw). +please refer to the method specification [`FinalizeWithdraw`](/go/api/accounts/introduction#finalizewithdraw). ## Withdrawal `WalletL2` and `Wallet` objects provide a withdrawal workflow. For more information, -please refer to the method specification [`Deposit`](/sdk/go/api/accounts/walletl1#deposit). +please refer to the method specification [`Deposit`](/go/api/accounts/walletl1#deposit). For a complete example of how to execute the deposit workflow, take a look at the following: @@ -354,7 +354,7 @@ func main() { // please refer to the documentation: https://era.zksync.io/docs/reference/troubleshooting/withdrawal-delay.html. // Once the withdrawal transaction is submitted on L1, it needs to be finalized. // To learn more about how to achieve this, please take a look at the 04_finalize_withdraw.go script. -} +} :: - Withdraw ERC20 token @@ -417,5 +417,5 @@ func main() { // please refer to the documentation: https://era.zksync.io/docs/reference/troubleshooting/withdrawal-delay.html. // Once the withdrawal transaction is submitted on L1, it needs to be finalized. // To learn more about how to achieve this, please take a look at the 04_finalize_withdraw.go script. -} +} :: diff --git a/content/sdk/20.go/02.api/00.clients/00.introduction.md b/content/20.go/02.api/00.clients/00.introduction.md similarity index 100% rename from content/sdk/20.go/02.api/00.clients/00.introduction.md rename to content/20.go/02.api/00.clients/00.introduction.md diff --git a/content/sdk/20.go/02.api/00.clients/01.baseclient.md b/content/20.go/02.api/00.clients/01.baseclient.md similarity index 95% rename from content/sdk/20.go/02.api/00.clients/01.baseclient.md rename to content/20.go/02.api/00.clients/01.baseclient.md index 8c266ed2..41592199 100644 --- a/content/sdk/20.go/02.api/00.clients/01.baseclient.md +++ b/content/20.go/02.api/00.clients/01.baseclient.md @@ -158,12 +158,12 @@ testnetPaymasterBytecode, err := client.CodeAt(context.Background(), testnetPaym if err != nil { log.Panic(err) } - + testnetPaymasterBytecodeHash, err := utils.HashBytecode(testnetPaymasterBytecode) if err != nil { log.Panic(err) } - + bytecode, err := client.BytecodeByHash(context.Background(), common.BytesToHash(testnetPaymasterBytecodeHash)) if err != nil { log.Panic(err) @@ -181,7 +181,7 @@ block height. | Parameter | Type | Description | | ----------- | ---------------------------------------- | ---------------------------------------------------------------- | | `ctx` | `context.Context` | Context. | -| `msg` | [`zkTypes.CallMsg`](/sdk/go/api/types#callmsg) | Contains parameters for contract call using EIP-712 transaction. | +| `msg` | [`zkTypes.CallMsg`](/go/api/types#callmsg) | Contains parameters for contract call using EIP-712 transaction. | | `blockHash` | `common.Hash` | Block hash. | ```go @@ -198,7 +198,7 @@ but never mined into the blockchain. | Parameter | Type | Description | | ------------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `ctx` | `context.Context` | Context. | -| `msg` | [`zkTypes.CallMsg`](/sdk/go/api/types#callmsg) | Contains parameters for contract call using EIP-712 transaction. | +| `msg` | [`zkTypes.CallMsg`](/go/api/types#callmsg) | Contains parameters for contract call using EIP-712 transaction. | | `blockNumber` | `*big.Int` (optional) | Selects the block height at which the call runs. It can be `nil`, in which case the code is taken from the latest known block. Note that state from very old blocks might not be available. | ```go @@ -210,7 +210,7 @@ CallContractL2(ctx context.Context, msg zkTypes.CallMsg, blockNumber *big.Int) ( ```go // The Crown token on testnet TokenAddress := common.HexToAddress("0x927488F48ffbc32112F1fF721759649A89721F8F") - + tokenAbi, err := erc20.IERC20MetaData.GetAbi() if err != nil { log.Panic(err) @@ -219,7 +219,7 @@ symbolCalldata, err := tokenAbi.Pack("symbol") if err != nil { log.Panic(err) } - + result, err := client.CallContractL2(context.Background(), types.CallMsg{ CallMsg: ethereum.CallMsg{ To: &TokenAddress, @@ -262,7 +262,7 @@ tokens, err := client.ConfirmedTokens(context.Background(), 0, 255) if err != nil { log.Panic(err) } - + for _, token := range tokens { fmt.Printf("%+v\n", *token) } @@ -304,7 +304,7 @@ Returns the fee for the transaction. | Parameter | Type | Description | | --------- | ---------------------------------------- | ---------------------------------------------------------------- | | `ctx` | `context.Context` | Context. | -| `msg` | [`zkTypes.CallMsg`](/sdk/go/api/types#callmsg) | Contains parameters for contract call using EIP-712 transaction. | +| `msg` | [`zkTypes.CallMsg`](/go/api/types#callmsg) | Contains parameters for contract call using EIP-712 transaction. | ```go EstimateFee(ctx context.Context, tx zkTypes.CallMsg) (*zkTypes.Fee, error) @@ -337,7 +337,7 @@ Estimates the amount of gas required to submit a transaction from L1 to L2. | Parameter | Type | Description | | --------- | ---------------------------------------- | ---------------------------------------------------------------- | | `ctx` | `context.Context` | Context. | -| `msg` | [`zkTypes.CallMsg`](/sdk/go/api/types#callmsg) | Contains parameters for contract call using EIP-712 transaction. | +| `msg` | [`zkTypes.CallMsg`](/go/api/types#callmsg) | Contains parameters for contract call using EIP-712 transaction. | ```go EstimateGasL1(ctx context.Context, tx zkTypes.CallMsg) (uint64, error) @@ -374,7 +374,7 @@ transactions may be added or removed by miners, but it should provide a basis fo | Parameter | Type | Description | | --------- | ---------------------------------------- | ---------------------------------------------------------------- | | `ctx` | `context.Context` | Context. | -| `msg` | [`zkTypes.CallMsg`](/sdk/go/api/types#callmsg) | Contains parameters for contract call using EIP-712 transaction. | +| `msg` | [`zkTypes.CallMsg`](/go/api/types#callmsg) | Contains parameters for contract call using EIP-712 transaction. | ```go EstimateGasL2(ctx context.Context, msg zkTypes.CallMsg) (uint64, error) @@ -388,18 +388,18 @@ TokenAddress := common.HexToAddress("0x927488F48ffbc32112F1fF721759649A89721F8F" // Paymaster for Crown token on testnet PaymasterAddress := common.HexToAddress("0x13D0D8550769f59aa241a41897D4859c87f7Dd46") ReceiptAddress := common.HexToAddress("0xa61464658AfeAf65CccaaFD3a512b69A83B77618") - + abi, err := erc20.IERC20MetaData.GetAbi() if err != nil { log.Panic(err) } - + // Encode transfer function from token contract calldata, err := abi.Pack("transfer", ReceiptAddress, big.NewInt(7)) if err != nil { log.Panic(err) } - + // Create paymaster parameters with encoded paymaster input paymasterParams, err := utils.GetPaymasterParams( PaymasterAddress, @@ -411,7 +411,7 @@ paymasterParams, err := utils.GetPaymasterParams( if err != nil { log.Panic(err) } - + gas, err := client.EstimateGasL2(context.Background(), zkTypes.CallMsg{ CallMsg: ethereum.CallMsg{ To: &TokenAddress, @@ -436,7 +436,7 @@ Estimates the amount of gas required for a transfer transaction. | Parameter | Type | Description | | --------- | -------------------------------------------------- | -------------------------------------- | | `ctx` | `context.Context` | Context. | -| `msg` | [`TransferCallMsg`](/sdk/go/api/accounts/types#transfercallmsg) | Contains parameters for transfer call. | +| `msg` | [`TransferCallMsg`](/go/api/accounts/types#transfercallmsg) | Contains parameters for transfer call. | ```go EstimateGasTransfer(ctx context.Context, msg TransferCallMsg) (uint64, error) @@ -466,7 +466,7 @@ Estimates the amount of gas required for a withdrawal transaction. | Parameter | Type | Description | | --------- | ------------------------------------------------------ | ---------------------------------------- | | `ctx` | `context.Context` | Context. | -| `msg` | [`WithdrawalCallMsg`](/sdk/go/api/accounts/types#withdrawalcallmsg) | Contains parameters for withdrawal call. | +| `msg` | [`WithdrawalCallMsg`](/go/api/accounts/types#withdrawalcallmsg) | Contains parameters for withdrawal call. | ```go EstimateGasWithdraw(ctx context.Context, msg WithdrawalCallMsg) (uint64, error) @@ -496,7 +496,7 @@ Estimates the amount of gas required for an L1 to L2 execute operation. | Parameter | Type | Description | | --------- | ------------------------------------------- | ---------------------------------------------------------------- | | `ctx` | `context.Context` | Context. | -| `msg` | [`zkTypes.CallMsg`](/sdk/go/api/accounts/types#callmsg) | Contains parameters for contract call using EIP-712 transaction. | +| `msg` | [`zkTypes.CallMsg`](/go/api/accounts/types#callmsg) | Contains parameters for contract call using EIP-712 transaction. | ```go EstimateL1ToL2Execute(ctx context.Context, msg zkTypes.CallMsg) (uint64, error) @@ -523,7 +523,7 @@ fmt.Println("Gas: ", gas) Executes a log filter operation, blocking during execution, and returns all the results in one batch. This method is a replacement for `FilterLogs` because the returned `types.Log` type does not contain additional data specific to L2, -as found in [`Log`](/sdk/go/api/types#log). The `FilterLogs` method is kept in order to be compatible with `bind.ContractBackend`, +as found in [`Log`](/go/api/types#log). The `FilterLogs` method is kept in order to be compatible with `bind.ContractBackend`, and this method can be used, but additional L2 data won't be retrieved. #### Inputs @@ -552,7 +552,7 @@ zkLogs, err := client.FilterLogsL2(context.Background(), ethereum.FilterQuery{ if err != nil { log.Panic(err) } - + for _, l := range zkLogs { fmt.Println("Log address:", l.Address.Hex()) fmt.Println("Log data:", l.Data) @@ -585,14 +585,14 @@ func NewClient(c *rpc.Client) Client ```go ZkSyncEraProvider := "https://testnet.era.zksync.dev" ZkSyncEraWSProvider := "ws://testnet.era.zksync.dev:3051" - + // Connect to ZKsync network client, err := clients.DialBase(ZkSyncEraProvider) if err != nil { log.Panic(err) } defer client.Close() - + // Connect to ZKsync network using Web Socket wsClient, err := clients.DialBase(ZkSyncEraWSProvider) if err != nil { @@ -829,13 +829,13 @@ if err != nil { log.Panic(err) } defer ethClient.Close() - + txHash := common.HexToHash("0xcca5411f3e514052f4a4ae1c2020badec6e0998adb52c09959c5f5ff15fba3a8") l1Receipt, err := ethClient.TransactionReceipt(context.Background(), txHash) if err != nil { log.Panic(err) } - + l2Tx, err := client.L2TransactionFromPriorityOp(context.Background(), l1Receipt) if err != nil { log.Panic(err) @@ -904,7 +904,7 @@ pending state. | Parameter | Type | Description | | --------- | ---------------------------------------- | ---------------------------------------------------------------- | | `ctx` | `context.Context` | Context. | -| `msg` | [`zkTypes.CallMsg`](/sdk/go/api/types#callmsg) | Contains parameters for contract call using EIP-712 transaction. | +| `msg` | [`zkTypes.CallMsg`](/go/api/types#callmsg) | Contains parameters for contract call using EIP-712 transaction. | ```go PendingCallContractL2(ctx context.Context, msg zkTypes.CallMsg) ([]byte, error) @@ -965,31 +965,31 @@ Proof(ctx context.Context, address common.Address, keys []common.Hash, l1BatchNu ```go // Fetching the storage proof for rawNonces storage slot in NonceHolder system contract. // mapping(uint256 => uint256) internal rawNonces; - + baseClient, ok := client.(*clients.BaseClient) if !ok { log.Panic("casting could not be performed") } - + address := common.HexToAddress("
") - + // Ensure the address is a 256-bit number by padding it // because rawNonces slot uses uint256 for mapping addresses and their nonces. addressPadded := common.LeftPadBytes(address.Bytes(), 32) - + // Convert the slot number to a hex string and pad it to 32 bytes slotBytes := common.Hex2Bytes("0x00") // slot with index 0 slotPadded := common.LeftPadBytes(slotBytes, 32) - + // Concatenate the padded address and slot number concatenated := append(addressPadded, slotPadded...) storageKey := crypto.Keccak256(concatenated) - + l1BatchNumber, err := client.L1BatchNumber(context.Background()) if err != nil { log.Panic(err) } - + storageProof, err := baseClient.Proof( context.Background(), utils.NonceHolderAddress, @@ -1022,7 +1022,7 @@ blockNumber, err := client.BlockNumber(context.Background()) if err != nil { log.Panic(err) } - + rawBlockTransactions, err := client.RawBlockTransactions(context.Background(), blockNumber) if err != nil { log.Panic(err) @@ -1054,23 +1054,23 @@ TokenAddress := common.HexToAddress("0x927488F48ffbc32112F1fF721759649A89721F8F" // Paymaster for Crown token on testnet PaymasterAddress := common.HexToAddress("0x13D0D8550769f59aa241a41897D4859c87f7Dd46") ReceiptAddress := common.HexToAddress("0xa61464658AfeAf65CccaaFD3a512b69A83B77618") - + w, err := accounts.NewWallet(common.Hex2Bytes(), &client, nil) if err != nil { log.Panic(err) } - + abi, err := erc20.IERC20MetaData.GetAbi() if err != nil { log.Panic(err) } - + // Encode mint function from token contract calldata, err := abi.Pack("transfer", ReceiptAddress, big.NewInt(7)) if err != nil { log.Panic(err) } - + // Create paymaster parameters with encoded paymaster input paymasterParams, err := utils.GetPaymasterParams( PaymasterAddress, @@ -1082,7 +1082,7 @@ paymasterParams, err := utils.GetPaymasterParams( if err != nil { log.Panic(err) } - + hash, err := w.SendTransaction(context.Background(), &accounts.Transaction{ To: &TokenAddress, Data: calldata, @@ -1101,7 +1101,7 @@ fmt.Println("Tx: ", hash) Creates a background log filtering operation, returning a subscription immediately, which can be used to stream the found events. This method is a replacement for `SubscribeFilterLogs` because the returned `types.Log` type does not contain additional data specific to L2, as found -in [`Log`](/sdk/go/api/types#log). The `SubscribeFilterLogs` method is +in [`Log`](/go/api/types#log). The `SubscribeFilterLogs` method is kept in order to be compatible with `bind.ContractBackend`, and this method can be used, but additional L2 data won't be retrieved. @@ -1111,7 +1111,7 @@ won't be retrieved. | --------- | --------------------------------------------------------------------------------------------- | -------------------------- | | `ctx` | `context.Context` | Context. | | `query` | [`ethereum.FilterQuery`](https://pkg.go.dev/github.com/ethereum/go-ethereum@v1.12.0#FilterQuery) | Filter query parameters. | -| `ch` | [`chan<- zkTypes.Log`](/sdk/go/api/types#log) | Channel that receives Log. | +| `ch` | [`chan<- zkTypes.Log`](/go/api/types#log) | Channel that receives Log. | ```go SubscribeFilterLogsL2(ctx context.Context, query ethereum.FilterQuery, ch chan<- zkTypes.Log) (ethereum.Subscription, error) @@ -1124,7 +1124,7 @@ contracts, err := client.BridgeContracts(context.Background()) if err != nil { log.Panic(err) } - + filterLogs := make(chan zkTypes.Log) sub, err := wsClient.SubscribeFilterLogsL2(context.Background(), ethereum.FilterQuery{ FromBlock: big.NewInt(0), @@ -1135,7 +1135,7 @@ if err != nil { log.Panic(err) } defer sub.Unsubscribe() - + for { select { case err := <-sub.Err(): @@ -1221,7 +1221,7 @@ w, err := accounts.NewWallet(common.Hex2Bytes(), &client, nil) if err != nil { log.Panic(err) } - + tx, err := w.Transfer(accounts.TransferTransaction{ To: common.HexToAddress(
), Amount: big.NewInt(7_000_000_000), @@ -1230,7 +1230,7 @@ tx, err := w.Transfer(accounts.TransferTransaction{ if err != nil { log.Panic(err) } - + // Wait for transaction to be finalized on L2 network _, err = client.WaitFinalized(context.Background(), tx.Hash()) if err != nil { @@ -1261,7 +1261,7 @@ w, err := accounts.NewWallet(common.Hex2Bytes(), &client, nil) if err != nil { log.Panic(err) } - + tx, err := w.Transfer(accounts.TransferTransaction{ To: common.HexToAddress(
), Amount: big.NewInt(7_000_000_000), @@ -1270,7 +1270,7 @@ tx, err := w.Transfer(accounts.TransferTransaction{ if err != nil { log.Panic(err) } - + // Wait for transaction to be mined on L2 network _, err = client.WaitMined(context.Background(), tx.Hash()) if err != nil { diff --git a/content/sdk/20.go/02.api/00.clients/02.types.md b/content/20.go/02.api/00.clients/02.types.md similarity index 100% rename from content/sdk/20.go/02.api/00.clients/02.types.md rename to content/20.go/02.api/00.clients/02.types.md diff --git a/content/sdk/20.go/02.api/01.accounts/00.introduction.md b/content/20.go/02.api/01.accounts/00.introduction.md similarity index 100% rename from content/sdk/20.go/02.api/01.accounts/00.introduction.md rename to content/20.go/02.api/01.accounts/00.introduction.md diff --git a/content/sdk/20.go/02.api/01.accounts/01.basesigner.md b/content/20.go/02.api/01.accounts/01.basesigner.md similarity index 100% rename from content/sdk/20.go/02.api/01.accounts/01.basesigner.md rename to content/20.go/02.api/01.accounts/01.basesigner.md diff --git a/content/sdk/20.go/02.api/01.accounts/02.basedeployer.md b/content/20.go/02.api/01.accounts/02.basedeployer.md similarity index 80% rename from content/sdk/20.go/02.api/01.accounts/02.basedeployer.md rename to content/20.go/02.api/01.accounts/02.basedeployer.md index 362b2eff..ed8aca8a 100644 --- a/content/sdk/20.go/02.api/01.accounts/02.basedeployer.md +++ b/content/20.go/02.api/01.accounts/02.basedeployer.md @@ -24,8 +24,8 @@ Deploys smart contract using CREATE2 method. | Parameter | Type | Description | | --------- | --------------------------------------------------------- | ------------------------------- | -| `auth` | [`*TransactOpts`](/sdk/go/api/accounts/types#transactopts) (optional) | Transaction options. | -| `tx` | [`Create2Transaction`](/sdk/go/api/accounts/types#create2transaction) | CREATE2 transaction parameters. | +| `auth` | [`*TransactOpts`](/go/api/accounts/types#transactopts) (optional) | Transaction options. | +| `tx` | [`Create2Transaction`](/go/api/accounts/types#create2transaction) | CREATE2 transaction parameters. | ```go Deploy(auth *TransactOpts, tx Create2Transaction) (common.Hash, error) @@ -55,8 +55,8 @@ Deploys smart account using CREATE2 method. | Parameter | Type | Description | | --------- | --------------------------------------------------------- | ------------------------------- | -| `auth` | [`*TransactOpts`](/sdk/go/api/accounts/types#transactopts) (optional) | Transaction options. | -| `tx` | [`Create2Transaction`](/sdk/go/api/accounts/types#create2transaction) | CREATE2 transaction parameters. | +| `auth` | [`*TransactOpts`](/go/api/accounts/types#transactopts) (optional) | Transaction options. | +| `tx` | [`Create2Transaction`](/go/api/accounts/types#create2transaction) | CREATE2 transaction parameters. | ```go DeployAccount(auth *TransactOpts, tx Create2Transaction) (common.Hash, error) @@ -99,8 +99,8 @@ Deploys smart account using CREATE method. | Parameter | Type | Description | | --------- | ------------------------------------------------------- | ------------------------------ | -| `auth` | [`*TransactOpts`](/sdk/go/api/accounts/types#transactopts) (optional) | Transaction options. | -| `tx` | [`CreateTransaction`](/sdk/go/api/accounts/types#createtransaction) | CREATE transaction parameters. | +| `auth` | [`*TransactOpts`](/go/api/accounts/types#transactopts) (optional) | Transaction options. | +| `tx` | [`CreateTransaction`](/go/api/accounts/types#createtransaction) | CREATE transaction parameters. | ```go DeployAccountWithCreate(auth *TransactOpts, tx CreateTransaction) (common.Hash, error) @@ -141,8 +141,8 @@ Deploys smart contract using CREATE method. | Parameter | Type | Description | | --------- | ------------------------------------------------------- | ------------------------------ | -| `auth` | [`*TransactOpts`](/sdk/go/api/accounts/types#transactopts) (optional) | Transaction options. | -| `tx` | [`CreateTransaction`](/sdk/go/api/accounts/types#createtransaction) | CREATE transaction parameters. | +| `auth` | [`*TransactOpts`](/go/api/accounts/types#transactopts) (optional) | Transaction options. | +| `tx` | [`CreateTransaction`](/go/api/accounts/types#createtransaction) | CREATE transaction parameters. | ```go DeployWithCreate(auth *TransactOpts, tx CreateTransaction) (common.Hash, error) diff --git a/content/sdk/20.go/02.api/01.accounts/03.wallet.md b/content/20.go/02.api/01.accounts/03.wallet.md similarity index 96% rename from content/sdk/20.go/02.api/01.accounts/03.wallet.md rename to content/20.go/02.api/01.accounts/03.wallet.md index 6cc04be0..211703b2 100644 --- a/content/sdk/20.go/02.api/01.accounts/03.wallet.md +++ b/content/20.go/02.api/01.accounts/03.wallet.md @@ -5,7 +5,7 @@ tags: ["zksync", "wallet", "account management", "go", "sdk"] --- It contains the same functions -as [`WalletL1`](/sdk/go/api/accounts/walletl1), [`WalletL2`](/sdk/go/api/accounts/walletl2), and [`BaseDeployer`](/sdk/go/api/accounts/basedeployer) +as [`WalletL1`](/go/api/accounts/walletl1), [`WalletL2`](/go/api/accounts/walletl2), and [`BaseDeployer`](/go/api/accounts/basedeployer) since it implements the Adapter interface, and the usage of those methods is the same. ### `Init` @@ -93,7 +93,7 @@ Returns a new instance of `Wallet` with the provided client for the L2 network. | Parameter | Type | Description | | --------- | ---------------------------- | ----------- | -| `client` | [`*clients.Client`](/sdk/go/api/clients/introduction) | L2 client. | +| `client` | [`*clients.Client`](/go/api/clients/introduction) | L2 client. | ```go Connect(client *clients.Client) (*Wallet, error) diff --git a/content/sdk/20.go/02.api/01.accounts/04.walletl1.md b/content/20.go/02.api/01.accounts/04.walletl1.md similarity index 92% rename from content/sdk/20.go/02.api/01.accounts/04.walletl1.md rename to content/20.go/02.api/01.accounts/04.walletl1.md index 4a3f89ff..56b3874f 100644 --- a/content/sdk/20.go/02.api/01.accounts/04.walletl1.md +++ b/content/20.go/02.api/01.accounts/04.walletl1.md @@ -15,7 +15,7 @@ Returns the amount of approved tokens for a specific L1 bridge. | Parameter | Type | Description | | --------------- | ------------------------------------------------ | --------------- | -| `opts` | [`CallOpts`](/sdk/go/api/accounts/types#callopts) (optional) | Call options. | +| `opts` | [`CallOpts`](/go/api/accounts/types#callopts) (optional) | Call options. | | `token` | `common.Address` | Token address. | | `bridgeAddress` | `common.Address` | Bridge address. | @@ -28,7 +28,7 @@ AllowanceL1(opts *CallOpts, token common.Address, bridgeAddress common.Address) ```go // The Crown token on testnet TokenAddress := common.HexToAddress("0x927488F48ffbc32112F1fF721759649A89721F8F") - + contracts, err := client.BridgeContracts(context.Background()) if err != nil { log.Panic(err) @@ -61,7 +61,7 @@ ApproveERC20(auth *TransactOpts, token common.Address, amount *big.Int, bridgeAd ```go // The Crown token on testnet TokenAddress := common.HexToAddress("0x927488F48ffbc32112F1fF721759649A89721F8F") - + contracts, err := client.BridgeContracts(context.Background()) if err != nil { log.Panic(err) @@ -81,7 +81,7 @@ Returns the balance of the specified token on L1 that can be either ETH or any E | Parameter | Type | Description | | --------- | ------------------------------------------------ | -------------- | -| `opts` | [`CallOpts`](/sdk/go/api/accounts/types#callopts) (optional) | Call options. | +| `opts` | [`CallOpts`](/go/api/accounts/types#callopts) (optional) | Call options. | | `token` | `common.Address` | Token address. | ```go @@ -106,7 +106,7 @@ Returns base cost for L2 transaction. | Parameter | Type | Description | | ------------------- | ------------------------------------------------ | -------------------------------------------------------------------------------------- | -| `opts` | [`CallOpts`](/sdk/go/api/accounts/types#callopts) (optional) | Call options. | +| `opts` | [`CallOpts`](/go/api/accounts/types#callopts) (optional) | Call options. | | `gasLimit` | `*big.Int` | The gasLimit for the the L2 contract call. | | `gasPerPubdataByte` | `*big.Int` | The L2 gas price for each published L1 calldata byte. | | `gasPrice` | `*big.Int` (optional) | The L1 gas price of the L1 transaction that will send the request for an execute call. | @@ -122,7 +122,7 @@ gasPrice, err := client.SuggestGasPrice(context.Background()) if err != nil { log.Panic(err) } - + baseCost, err := wallet.BaseCost(nil, big.NewInt(9000), utils.RequiredL1ToL2GasPerPubdataLimit, gasPrice) if err != nil { log.Panic(err) @@ -138,7 +138,7 @@ Returns the address of the base token on L1. | Parameter | Type | Description | |-----------|----------------------------------------------------------| ----------- | -| `opts` | [`CallOpts`](/sdk/go/api/accounts/types#callopts) (optional) | Call options. | +| `opts` | [`CallOpts`](/go/api/accounts/types#callopts) (optional) | Call options. | ```go BaseToken(opts *CallOpts) (common.Address, error) @@ -187,7 +187,7 @@ L1 tokens back to the depositor, otherwise throws the error. | Parameter | Type | Description | | ------------- | --------------------------------------------------------- | ---------------------------------------------- | -| `auth` | [`*TransactOpts`](/sdk/go/api/accounts/types#transactopts) (optional) | Transaction options. | +| `auth` | [`*TransactOpts`](/go/api/accounts/types#transactopts) (optional) | Transaction options. | | `depositHash` | `common.Hash` | The L2 transaction hash of the failed deposit. | ```go @@ -218,8 +218,8 @@ skipped. To check the amount of approved tokens for a specific bridge, use the [ | Parameter | Type | Description | | --------- | --------------------------------------------------------- |--------------------------------| -| `auth` | [`*TransactOpts`](/sdk/go/api/accounts/types#transactopts) (optional) | Transaction options. | -| `tx` | [`DepositTransaction`](/sdk/go/api/accounts/types#deposittransaction) | Deposit transaction parameters.| +| `auth` | [`*TransactOpts`](/go/api/accounts/types#transactopts) (optional) | Transaction options. | +| `tx` | [`DepositTransaction`](/go/api/accounts/types#deposittransaction) | Deposit transaction parameters.| ```go Deposit(auth *TransactOpts, tx DepositTransaction) (*types.Transaction, error) @@ -239,17 +239,17 @@ tx, err := wallet.Deposit(nil, accounts.DepositTransaction{ if err != nil { log.Panic(err) } - + l1Receipt, err := bind.WaitMined(context.Background(), ethClient, tx) if err != nil { log.Panic(err) } - + l2Tx, err := client.L2TransactionFromPriorityOp(context.Background(), l1Receipt) if err != nil { log.Panic(err) } - + l2Receipt, err := client.WaitMined(context.Background(), l2Tx.Hash) if err != nil { log.Panic(err) @@ -269,17 +269,17 @@ tx, err := wallet.Deposit(nil, accounts.DepositTransaction{ if err != nil { log.Panic(err) } - + l1Receipt, err := bind.WaitMined(context.Background(), ethClient, tx) if err != nil { log.Panic(err) } - + l2Tx, err := client.L2TransactionFromPriorityOp(context.Background(), l1Receipt) if err != nil { log.Panic(err) } - + l2Receipt, err := client.WaitMined(context.Background(), l2Tx.Hash) if err != nil { log.Panic(err) @@ -299,17 +299,17 @@ tx, err := wallet.Deposit(nil, accounts.DepositTransaction{ if err != nil { log.Panic(err) } - + l1Receipt, err := bind.WaitMined(context.Background(), ethClient, tx) if err != nil { log.Panic(err) } - + l2Tx, err := client.L2TransactionFromPriorityOp(context.Background(), l1Receipt) if err != nil { log.Panic(err) } - + l2Receipt, err := client.WaitMined(context.Background(), l2Tx.Hash) if err != nil { log.Panic(err) @@ -323,7 +323,7 @@ baseToken, err := wallet.BaseToken(nil) if err != nil { log.Panic(err) } - + tx, err := wallet.Deposit(nil, accounts.DepositTransaction{ To: wallet.Address(), Token: baseToken, @@ -334,17 +334,17 @@ tx, err := wallet.Deposit(nil, accounts.DepositTransaction{ if err != nil { log.Panic(err) } - + l1Receipt, err := bind.WaitMined(context.Background(), ethClient, tx) if err != nil { log.Panic(err) } - + l2Tx, err := client.L2TransactionFromPriorityOp(context.Background(), l1Receipt) if err != nil { log.Panic(err) } - + l2Receipt, err := client.WaitMined(context.Background(), l2Tx.Hash) if err != nil { log.Panic(err) @@ -365,17 +365,17 @@ tx, err := wallet.Deposit(nil, accounts.DepositTransaction{ if err != nil { log.Panic(err) } - + l1Receipt, err := bind.WaitMined(context.Background(), ethClient, tx) if err != nil { log.Panic(err) } - + l2Tx, err := client.L2TransactionFromPriorityOp(context.Background(), l1Receipt) if err != nil { log.Panic(err) } - + l2Receipt, err := client.WaitMined(context.Background(), l2Tx.Hash) if err != nil { log.Panic(err) @@ -392,8 +392,8 @@ allowance is calculated solely based on the specified amount. | Parameter | Type | Description | |---------------------| ---------------------------------------- | -------------------------------------------------------------------------------------- | -| `opts` | [`CallOpts`](/sdk/go/api/accounts/types#callopts) (optional) | Call options. | -| `msg` | [`DepositCallMsg`](/sdk/go/api/accounts/types#depositcallmsg) | Deposit call parameters. | +| `opts` | [`CallOpts`](/go/api/accounts/types#callopts) (optional) | Call options. | +| `msg` | [`DepositCallMsg`](/go/api/accounts/types#depositcallmsg) | Deposit call parameters. | ```go DepositAllowanceParams(opts *CallOpts, msg DepositCallMsg) ([]struct { @@ -412,7 +412,7 @@ msg := accounts.DepositCallMsg{ To: Receiver, Amount: big.NewInt(5), } - + allowanceParams, err := wallet.DepositAllowanceParams(nil, msg) if err != nil { log.Panic(err) @@ -439,7 +439,7 @@ msg := accounts.DepositCallMsg{ To: Receiver, Amount: big.NewInt(7_000_000_000), } - + allowanceParams, err := wallet.DepositAllowanceParams(nil, msg) if err != nil { log.Panic(err) @@ -465,13 +465,13 @@ token, err := wallet.BaseToken(nil) if err != nil { log.Panic(err) } - + msg := accounts.DepositCallMsg{ Token: token, To: Receiver, Amount: big.NewInt(7_000_000_000), } - + allowanceParams, err := wallet.DepositAllowanceParams(nil, msg) if err != nil { log.Panic(err) @@ -498,7 +498,7 @@ msg := accounts.DepositCallMsg{ To: Receiver, Amount: big.NewInt(5), } - + allowanceParams, err := wallet.DepositAllowanceParams(nil, msg) if err != nil { log.Panic(err) @@ -527,18 +527,18 @@ if err != nil { ```go ZkSyncEraProvider := "https://testnet.era.zksync.dev" - + client, err := clients.Dial(ZkSyncEraProvider) if err != nil { log.Panic(err) } defer client.Close() - + gasPrice, err := client.SuggestGasPrice(context.Background()) if err != nil { log.Panic(err) } - + baseCost, err := wallet.BaseCost(nil, big.NewInt(9000), utils.RequiredL1ToL2GasPerPubdataLimit, gasPrice) if err != nil { log.Panic(err) @@ -581,7 +581,7 @@ L1BridgeAddress := common.HexToAddress("") Token := common.HexToAddress("") From := common.HexToAddress("") To := common.HexToAddress("") - + bridge, err := l1bridge.NewIL1Bridge(L1BridgeAddress, ethClient) if err != nil { log.Panic(err) @@ -594,7 +594,7 @@ customBridgeData, err := utils.Erc20DefaultBridgeData(Token, ethClient) if err != nil { log.Panic(err) } - + gas, err := wallet1.EstimateCustomBridgeDepositL2Gas(context.Background(), L1BridgeAddress, l2BridgeAddress, Token, big.NewInt(7), To, customBridgeData, From, utils.RequiredL1ToL2GasPerPubdataLimit) if err != nil { @@ -654,7 +654,7 @@ included in the estimation. | Parameter | Type | Description | | --------- | ------------------------------------------------- | ------------------------ | | `ctx` | `context.Context` | Context. | -| `msg` | [`DepositCallMsg`](/sdk/go/api/accounts/types#depositcallmsg) | Deposit call parameters. | +| `msg` | [`DepositCallMsg`](/go/api/accounts/types#depositcallmsg) | Deposit call parameters. | ```go EstimateGasDeposit(ctx context.Context, msg DepositCallMsg) (uint64, error) @@ -683,7 +683,7 @@ Estimates the amount of gas required for a request execute transaction. | Parameter | Type | Description | | --------- | --------------------------------------------------------------- | -------------------------------- | | `ctx` | `context.Context` | Context. | -| `msg` | [`RequestExecuteCallMsg`](/sdk/go/api/accounts/types#requestexecutecallmsg) | Request execute call parameters. | +| `msg` | [`RequestExecuteCallMsg`](/go/api/accounts/types#requestexecutecallmsg) | Request execute call parameters. | ```go EstimateGasRequestExecute(ctx context.Context, msg RequestExecuteCallMsg) (uint64, error) @@ -714,7 +714,7 @@ Proves the inclusion of the L2 -> L1 withdrawal message. | Parameter | Type | Description | | ---------------- | --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | -| `auth` | [`*TransactOpts`](/sdk/go/api/accounts/types#transactopts) (optional) | Transaction options. | +| `auth` | [`*TransactOpts`](/go/api/accounts/types#transactopts) (optional) | Transaction options. | | `withdrawalHash` | `common.Hash` | Hash of the L2 transaction where the withdrawal was initiated. | | `index` | `int` | In case there were multiple withdrawals in one transaction, you may pass an index of the withdrawal you want to finalize. | @@ -742,7 +742,7 @@ Retrieves the full needed ETH fee for the deposit on both L1 and L2 networks. | Parameter | Type | Description | | --------- | ------------------------------------------------- | ------------------------ | | `ctx` | `context.Context` | Context. | -| `msg` | [`DepositCallMsg`](/sdk/go/api/accounts/types#depositcallmsg) | Deposit call parameters. | +| `msg` | [`DepositCallMsg`](/go/api/accounts/types#depositcallmsg) | Deposit call parameters. | ```go FullRequiredDepositFee(ctx context.Context, msg DepositCallMsg) (*FullDepositFee, error) @@ -782,19 +782,19 @@ NewWalletL1FromSigner(signer *Signer, clientL1 *ethclient.Client, clientL2 *clie PrivateKey := os.Getenv("PRIVATE_KEY") ZkSyncEraProvider := "https://sepolia.era.zksync.dev" EthereumProvider := "https://rpc.ankr.com/eth_sepolia" - + client, err := clients.Dial(ZkSyncEraProvider) if err != nil { log.Panic(err) } defer client.Close() - + ethClient, err := ethclient.Dial(EthereumProvider) if err != nil { log.Panic(err) } defer ethClient.Close() - + wallet, err := accounts.NewWalletL1(common.Hex2Bytes(PrivateKey), &client, ethClient) if err != nil { log.Panic(err) @@ -833,7 +833,7 @@ Checks if the withdrawal finalized on L1 network. | Parameter | Type | Description | | ---------------- | ------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------- | -| `opts` | [`CallOpts`](/sdk/go/api/accounts/types#callopts) (optional) | Call options. | +| `opts` | [`CallOpts`](/go/api/accounts/types#callopts) (optional) | Call options. | | `withdrawalHash` | `common.Hash` | Hash of the L2 transaction where the withdrawal was initiated. | | `index` | `int` | In case there where multiple withdrawals in one transaction, you may pass an index of the withdrawal you want to finalize. | @@ -932,8 +932,8 @@ Request execution of L2 transaction from L1. | Parameter | Type | Description | | --------- | ----------------------------------------------------------------------- | --------------------------------------- | -| `auth` | [`*TransactOpts`](/sdk/go/api/accounts/types#transactopts) (optional) | Transaction options. | -| `tx` | [`RequestExecuteTransaction`](/sdk/go/api/accounts/types#requestexecutetransaction) | Request execute transaction parameters. | +| `auth` | [`*TransactOpts`](/go/api/accounts/types#transactopts) (optional) | Transaction options. | +| `tx` | [`RequestExecuteTransaction`](/go/api/accounts/types#requestexecutetransaction) | Request execute transaction parameters. | ```go RequestExecute(auth *TransactOpts, tx RequestExecuteTransaction) (*types.Transaction, error) @@ -965,8 +965,8 @@ Existing allowance for the bridge is not checked; allowance is calculated solely | Parameter | Type | Description | | --------- | --------------------------------------------------------------- | -------------------------------- | -| `opts` | [`CallOpts`](/sdk/go/api/accounts/types#callopts) (optional) | Call options. | -| `msg` | [`RequestExecuteCallMsg`](/sdk/go/api/accounts/types#requestexecutecallmsg) | Request execute call parameters. | +| `opts` | [`CallOpts`](/go/api/accounts/types#callopts) (optional) | Call options. | +| `msg` | [`RequestExecuteCallMsg`](/go/api/accounts/types#requestexecutecallmsg) | Request execute call parameters. | ```go RequestExecuteAllowanceParams(opts *CallOpts, msg RequestExecuteCallMsg) (AllowanceParams, error) @@ -984,17 +984,17 @@ allowanceParams, err := wallet.RequestExecuteAllowanceParams(nil, msg) if err != nil { log.Panic(err) } - + bridgeContracts, err := client.BridgeContracts(context.Background()) if err != nil { log.Panic(err) } - + approveTx, err := wallet.ApproveERC20(nil, allowanceParams.Token, allowanceParams.Allowance, bridgeContracts.L1SharedBridge) if err != nil { log.Panic(err) } - + _, err = bind.WaitMined(context.Background(), ethClient, approveTx) if err != nil { log.Panic(err) diff --git a/content/sdk/20.go/02.api/01.accounts/05.walletl2.md b/content/20.go/02.api/01.accounts/05.walletl2.md similarity index 90% rename from content/sdk/20.go/02.api/01.accounts/05.walletl2.md rename to content/20.go/02.api/01.accounts/05.walletl2.md index 720fcb72..36b43aea 100644 --- a/content/sdk/20.go/02.api/01.accounts/05.walletl2.md +++ b/content/20.go/02.api/01.accounts/05.walletl2.md @@ -82,7 +82,7 @@ into the blockchain. | Parameter | Type | Description | | ------------- | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `ctx` | `context.Context` | Context. | -| `msg` | [`CallMsg`](/sdk/go/api/accounts/types#callmsg) | Contains parameters for contract call using EIP-712 transaction. | +| `msg` | [`CallMsg`](/go/api/accounts/types#callmsg) | Contains parameters for contract call using EIP-712 transaction. | | `blockNumber` | `*big.Int` (optional) | Selects the block height at which the call runs. It can be `nil`, in which case the code is taken from the latest known block. Note that state from very old blocks might not be available. | ```go @@ -94,7 +94,7 @@ CallContract(ctx context.Context, msg CallMsg, blockNumber *big.Int) ([]byte, er ```go // The Crown token on testnet TokenAddress := common.HexToAddress("0x927488F48ffbc32112F1fF721759649A89721F8F") - + tokenAbi, err := erc20.IERC20MetaData.GetAbi() if err != nil { log.Panic(err) @@ -103,7 +103,7 @@ symbolCalldata, err := tokenAbi.Pack("symbol") if err != nil { log.Panic(err) } - + result, err := wallet.CallContract(context.Background(), types.CallMsg{ CallMsg: ethereum.CallMsg{ To: &TokenAddress, @@ -129,7 +129,7 @@ Returns the deployment nonce of the account. | Parameter | Type | Description | | --------- | ------------------------------------------------ | ------------- | -| `opts` | [`CallOpts`](/sdk/go/api/accounts/types#callopts) (optional) | Call options. | +| `opts` | [`CallOpts`](/go/api/accounts/types#callopts) (optional) | Call options. | ```go func (a *WalletL2) DeploymentNonce(opts *CallOpts) (*big.Int, error) @@ -153,7 +153,7 @@ Estimates the amount of gas required for a transfer transaction. | Parameter | Type | Description | | --------- | --------------------------------------------------- | ------------------------- | | `ctx` | `context.Context` | Context. | -| `msg` | [`TransferCallMsg`](/sdk/go/api/accounts/types#transfercallmsg) | Transfer call parameters. | +| `msg` | [`TransferCallMsg`](/go/api/accounts/types#transfercallmsg) | Transfer call parameters. | ```go EstimateGasTransfer(ctx context.Context, msg TransferCallMsg) (uint64, error) @@ -182,7 +182,7 @@ Estimates the amount of gas required for a withdrawal transaction. | Parameter | Type | Description | | --------- | ------------------------------------------------------- | --------------------------- | | `ctx` | `context.Context` | Context. | -| `msg` | [`WithdrawalCallMsg`](/sdk/go/api/accounts/types#withdrawalcallmsg) | Withdrawal call parameters. | +| `msg` | [`WithdrawalCallMsg`](/go/api/accounts/types#withdrawalcallmsg) | Withdrawal call parameters. | ```go EstimateGasWithdraw(ctx context.Context, msg WithdrawalCallMsg) (uint64, error) @@ -223,18 +223,18 @@ func NewWalletL2FromSigner(signer *Signer, client *clients.Client) (*WalletL2, e ```go PrivateKey := os.Getenv("PRIVATE_KEY") ZkSyncEraProvider := "https://testnet.era.zksync.dev" - + client, err := clients.Dial(ZkSyncEraProvider) if err != nil { log.Panic(err) } defer client.Close() - + wallet, err := accounts.NewWallet(common.Hex2Bytes(PrivateKey), &client) if err != nil { log.Panic(err) } - + ``` ### `IsBaseToken` @@ -298,7 +298,7 @@ Injects a transaction into the pending pool for execution. Any unset transaction | Parameter | Type | Description | | --------- | ------------------------------------------- | ----------------------- | | `ctx` | `context.Context` | Context. | -| `tx` | [`Transaction`](/sdk/go/api/accounts/types#transaction) | Transaction parameters. | +| `tx` | [`Transaction`](/go/api/accounts/types#transaction) | Transaction parameters. | ```go SendTransaction(ctx context.Context, tx *Transaction) (common.Hash, error) @@ -312,18 +312,18 @@ TokenAddress := common.HexToAddress("0x927488F48ffbc32112F1fF721759649A89721F8F" // Paymaster for Crown token on testnet PaymasterAddress := common.HexToAddress("0x13D0D8550769f59aa241a41897D4859c87f7Dd46") ReceiptAddress := common.HexToAddress("0xa61464658AfeAf65CccaaFD3a512b69A83B77618") - + abi, err := erc20.IERC20MetaData.GetAbi() if err != nil { log.Panic(err) } - + // Encode transfer function from token contract calldata, err := abi.Pack("transfer", ReceiptAddress, big.NewInt(7)) if err != nil { log.Panic(err) } - + // Create paymaster parameters with encoded paymaster input paymasterParams, err := utils.GetPaymasterParams( PaymasterAddress, @@ -335,7 +335,7 @@ paymasterParams, err := utils.GetPaymasterParams( if err != nil { log.Panic(err) } - + hash, err := wallet.SendTransaction(context.Background(), &accounts.Transaction{ To: &TokenAddress, Data: calldata, @@ -346,12 +346,12 @@ hash, err := wallet.SendTransaction(context.Background(), &accounts.Transaction{ if err != nil { log.Panic(err) } - + _, err = client.WaitMined(context.Background(), hash) if err != nil { log.Panic(err) } - + fmt.Println("Tx: ", hash) ``` @@ -379,7 +379,7 @@ transaction with all fields having appropriate values. To obtain a valid transac | Parameter | Type | Description | | --------- |----------------------------------------------------------------| ------------------------------- | -| `tx` | [`zkTypes.Transaction712`](/sdk/go/api/types#transaction712) | EIP-712 transaction parameters. | +| `tx` | [`zkTypes.Transaction712`](/go/api/types#transaction712) | EIP-712 transaction parameters. | ```go SignTransaction(tx *zkTypes.Transaction712) ([]byte, error) @@ -393,23 +393,23 @@ TokenAddress := common.HexToAddress("0x927488F48ffbc32112F1fF721759649A89721F8F" // Paymaster for Crown token on testnet PaymasterAddress := common.HexToAddress("0x13D0D8550769f59aa241a41897D4859c87f7Dd46") ReceiptAddress := common.HexToAddress("0xa61464658AfeAf65CccaaFD3a512b69A83B77618") - + abi, err := erc20.IERC20MetaData.GetAbi() if err != nil { log.Panic(err) } - + // Encode transfer function from token contract calldata, err := abi.Pack("transfer", ReceiptAddress, big.NewInt(7)) if err != nil { log.Panic(err) } - + preparedTx, err := wallet.PopulateTransaction(context.Background(), &accounts.Transaction{ To: &TokenAddress, Data: calldata, }) - + signedTx, err := wallet.SignTransaction(preparedTx) if err != nil { log.Panic(err) @@ -425,8 +425,8 @@ Moves the ETH or any ERC20 token from the associated account to the target accou | Parameter | Type | Description | | --------- | ----------------------------------------------------------- | -------------------------------- | -| `auth` | [`*TransactOpts`](/sdk/go/api/accounts/types#transactopts) (optional) | Transaction options. | -| `tx` | [`TransferTransaction`](/sdk/go/api/accounts/types#transfertransaction) | Transfer transaction parameters. | +| `auth` | [`*TransactOpts`](/go/api/accounts/types#transactopts) (optional) | Transaction options. | +| `tx` | [`TransferTransaction`](/go/api/accounts/types#transfertransaction) | Transfer transaction parameters. | ```go Transfer(auth *TransactOpts, tx TransferTransaction) (*types.Transaction, error) @@ -455,8 +455,8 @@ to the target account on L1 network. | Parameter | Type | Description | | --------- | --------------------------------------------------------------- | ---------------------------------- | -| `auth` | [`*TransactOpts`](/sdk/go/api/accounts/types#transactopts) (optional) | Transaction options. | -| `tx` | [`WithdrawalTransaction`](/sdk/go/api/accounts/types#withdrawaltransaction) | Withdrawal transaction parameters. | +| `auth` | [`*TransactOpts`](/go/api/accounts/types#transactopts) (optional) | Transaction options. | +| `tx` | [`WithdrawalTransaction`](/go/api/accounts/types#withdrawaltransaction) | Withdrawal transaction parameters. | ```go Withdraw(auth *TransactOpts, tx WithdrawalTransaction) (*types.Transaction, error) @@ -479,7 +479,7 @@ fmt.Println("Withdraw transaction: ", tx.Hash()) ### PopulateTransaction Designed for users who prefer a simplified approach by providing only the necessary data to create a valid -[EIP-712 transaction](/sdk/go/api/types#transaction712). The only required fields are `Transaction.To` and either +[EIP-712 transaction](/go/api/types#transaction712). The only required fields are `Transaction.To` and either `Transaction.Data` or `Transaction.Value` (or both, if the method is payable). Any other fields that are not set will be prepared by this method. @@ -488,7 +488,7 @@ Any other fields that are not set will be prepared by this method. | Parameter | Type | Description | | --------- | ------------------------------------------- | ----------------------- | | `ctx` | `context.Context` | Context. | -| `tx` | [`Transaction`](/sdk/go/api/accounts/types#transaction) | Transaction parameters. | +| `tx` | [`Transaction`](/go/api/accounts/types#transaction) | Transaction parameters. | ```go PopulateTransaction(ctx context.Context, tx Transaction) (*zkTypes.Transaction712, error) @@ -502,18 +502,18 @@ TokenAddress := common.HexToAddress("0x927488F48ffbc32112F1fF721759649A89721F8F" // Paymaster for Crown token on testnet PaymasterAddress := common.HexToAddress("0x13D0D8550769f59aa241a41897D4859c87f7Dd46") ReceiptAddress := common.HexToAddress("0xa61464658AfeAf65CccaaFD3a512b69A83B77618") - + abi, err := erc20.IERC20MetaData.GetAbi() if err != nil { log.Panic(err) } - + // Encode transfer function from token contract calldata, err := abi.Pack("transfer", ReceiptAddress, big.NewInt(7)) if err != nil { log.Panic(err) } - + preparedTx, err := wallet.PopulateTransaction(context.Background(), &accounts.Transaction{ To: &TokenAddress, Data: calldata, diff --git a/content/sdk/20.go/02.api/01.accounts/06.smartaccount.md b/content/20.go/02.api/01.accounts/06.smartaccount.md similarity index 86% rename from content/sdk/20.go/02.api/01.accounts/06.smartaccount.md rename to content/20.go/02.api/01.accounts/06.smartaccount.md index 075f5f8f..52e56624 100644 --- a/content/sdk/20.go/02.api/01.accounts/06.smartaccount.md +++ b/content/20.go/02.api/01.accounts/06.smartaccount.md @@ -82,7 +82,7 @@ detached from any provider if `nil` is provided. | Parameter | Type | Description | | --------- |---------------------------------------------------|---------------------------------------------------------------------------------------------------------------| -| `client` | [`*clients.DialBase`](/sdk/go/api/clients/baseclient) | The client to connect the `SmartAccount` to. If `nil`, the `SmartAccount` will be detached from any provider. | +| `client` | [`*clients.DialBase`](/go/api/clients/baseclient) | The client to connect the `SmartAccount` to. If `nil`, the `SmartAccount` will be detached from any provider. | ```go Connect(client *clients.BaseClient) *SmartAccount @@ -93,13 +93,13 @@ Connect(client *clients.BaseClient) *SmartAccount ```go privateKey := os.Getenv("PRIVATE_KEY") ZkSyncEraProvider := "https://testnet.era.zksync.dev" - + client, err := clients.Dial(ZkSyncEraProvider) if err != nil { log.Panic(err) } defer client.Close() - + account := accounts.NewECDSASmartAccount(Address1, PrivateKey1, nil) account = account.Connect(client) ``` @@ -112,7 +112,7 @@ Returns the deployment nonce of the account. | Parameter | Type | Description | | --------- | ------------------------------------------------ | ------------- | -| `opts` | [`CallOpts`](/sdk/go/api/accounts/types#callopts) (optional) | Call options. | +| `opts` | [`CallOpts`](/go/api/accounts/types#callopts) (optional) | Call options. | ```go DeploymentNonce(opts *CallOpts) (*big.Int, error) @@ -129,8 +129,8 @@ if err != nil { ### `Init` -Creates a new `SmartAccount` instance. By default, it uses [`SignPayloadWithECDSA`](/sdk/go/api/accounts/smart-account-utils#signpayloadwithecdsa) -as a signer and [`PopulateTransactionECDSA`](/sdk/go/api/accounts/smart-account-utils#populatetransactionecdsa) as +Creates a new `SmartAccount` instance. By default, it uses [`SignPayloadWithECDSA`](/go/api/accounts/smart-account-utils#signpayloadwithecdsa) +as a signer and [`PopulateTransactionECDSA`](/go/api/accounts/smart-account-utils#populatetransactionecdsa) as a builder and requires private key in hex format to be provided. @@ -140,12 +140,12 @@ requires private key in hex format to be provided. |-----------|--------------------------------------------------------------------|---------------------------------------------------------| | `address` | `common.Address` | Account address. | | `secret` | `interface{}` | Secret used for signing. | -| `signer` | [`*PayloadSigner`](/sdk/go/api/accounts/types#payloadsigner) | Function used for signing payload. | -| `builder` | [`*TransactionBuilder`](/sdk/go/api/accounts/types#transactionbuilder) | Function used for populating transaction. | -| `client` | [`*clients.BaseClient`](/sdk/go/api/clients/baseclient) | The client to connect to. Can be `nil` for offline usage. | +| `signer` | [`*PayloadSigner`](/go/api/accounts/types#payloadsigner) | Function used for signing payload. | +| `builder` | [`*TransactionBuilder`](/go/api/accounts/types#transactionbuilder) | Function used for populating transaction. | +| `client` | [`*clients.BaseClient`](/go/api/clients/baseclient) | The client to connect to. Can be `nil` for offline usage. | ```go - + func NewSmartAccount( address common.Address, secret interface{}, @@ -160,13 +160,13 @@ func NewSmartAccount( privateKey := os.Getenv("PRIVATE_KEY") address := common.HexToAddress("") ZkSyncEraProvider := "https://sepolia.era.zksync.dev" - + client, err := clients.DialBase(ZkSyncEraProvider) if err != nil { log.Panic(err) } defer client.Close() - + account := accounts.NewSmartAccount( address, privateKey, @@ -203,7 +203,7 @@ fmt.Println("Nonce: ", nonce) ### `PopulateTransaction` -Populates the transaction `tx` using the provided [`TransactionBuilder`](/sdk/go/api/accounts/types#transactionbuilder) function. +Populates the transaction `tx` using the provided [`TransactionBuilder`](/go/api/accounts/types#transactionbuilder) function. If `tx.From` is not set, it sets the value from the `Address()` method which can be utilized in the `TransactionBuilder` function. @@ -212,7 +212,7 @@ be utilized in the `TransactionBuilder` function. | Parameter | Type | Description | |-----------|----------------------------------------------------------|------------------------------------| | `ctx` | `context.Context` | Context. | -| `tx` | [`*zkTypes.Transaction712`](/sdk/go/api/types#transaction712) | The transaction that needs to be populated. | +| `tx` | [`*zkTypes.Transaction712`](/go/api/types#transaction712) | The transaction that needs to be populated. | ```go PopulateTransaction(ctx context.Context, tx *zkTypes.Transaction712) error @@ -226,7 +226,7 @@ tx := &zkTypes.Transaction712{ To: &address, Value: big.NewInt(7_000_000_000), } - + err = account.PopulateTransaction(context.Background(), tx) if err != nil { log.Panic(err) @@ -243,7 +243,7 @@ The `SignTransaction` is called first to ensure transaction is properly signed. | Parameter | Type | Description | |-----------|---------------------------------------------------------|------------------------------------------| | `ctx` | `context.Context` | Context. | -| `tx` | [`*zkTypes.Transaction712`](/sdk/go/api/types#transaction712) | The transaction that needs to be signed. | +| `tx` | [`*zkTypes.Transaction712`](/go/api/types#transaction712) | The transaction that needs to be signed. | ```go SendTransaction(ctx context.Context, tx *zkTypes.Transaction712) (common.Hash, error) @@ -264,7 +264,7 @@ if err != nil { ### `SignMessage` -Signs a message using the provided [`PayloadSigner`](/sdk/go/api/accounts/types#payloadsigner) function. +Signs a message using the provided [`PayloadSigner`](/go/api/accounts/types#payloadsigner) function. #### Inputs @@ -297,10 +297,10 @@ necessary properties for the transaction to be valid have been populated. | Parameter | Type | Description | |-----------|---------------------------------------------------------|------------------------------------------| | `ctx` | `context.Context` | Context. | -| `tx` | [`*zkTypes.Transaction712`](/sdk/go/api/types#transaction712) | The transaction that needs to be signed. | +| `tx` | [`*zkTypes.Transaction712`](/go/api/types#transaction712) | The transaction that needs to be signed. | ```go - + SignTransaction(ctx context.Context, tx *zkTypes.Transaction712) ([]byte, error) ``` @@ -319,7 +319,7 @@ if err != nil { ### `SignTypedData` -signs a typed data using the provided [`PayloadSigner`](/sdk/go/api/accounts/types#payloadsigner) function. +signs a typed data using the provided [`PayloadSigner`](/go/api/accounts/types#payloadsigner) function. #### Inputs @@ -371,8 +371,8 @@ Moves the ETH or any ERC20 token from the associated account to the target accou | Parameter | Type | Description | | --------- | ----------------------------------------------------------- | -------------------------------- | -| `auth` | [`*TransactOpts`](/sdk/go/api/accounts/types#transactopts) (optional) | Transaction options. | -| `tx` | [`TransferTransaction`](/sdk/go/api/accounts/types#transfertransaction) | Transfer transaction parameters. | +| `auth` | [`*TransactOpts`](/go/api/accounts/types#transactopts) (optional) | Transaction options. | +| `tx` | [`TransferTransaction`](/go/api/accounts/types#transfertransaction) | Transfer transaction parameters. | ```go Transfer(auth *TransactOpts, tx TransferTransaction) (common.Hash, error) @@ -399,7 +399,7 @@ Transfer ETH using paymaster to facilitate fee payment with an ERC20 token. ```go token := common.HexToAddress("0x927488F48ffbc32112F1fF721759649A89721F8F"); // Crown token which can be minted for free paymaster := common.HexToAddress("0x13D0D8550769f59aa241a41897D4859c87f7Dd46"); // Paymaster for Crown token - + paymasterParams, err := utils.GetPaymasterParams( paymaster, &zkTypes.ApprovalBasedPaymasterInput{ @@ -410,7 +410,7 @@ paymasterParams, err := utils.GetPaymasterParams( if err != nil { log.Panic(err) } - + txHash, err := account.Transfer(nil, accounts.TransferTransaction{ To: Address2, Amount: amount, @@ -432,8 +432,8 @@ to the target account on L1 network. | Parameter | Type | Description | | --------- | --------------------------------------------------------------- | ---------------------------------- | -| `auth` | [`*TransactOpts`](/sdk/go/api/accounts/types#transactopts) (optional) | Transaction options. | -| `tx` | [`WithdrawalTransaction`](/sdk/go/api/accounts/types#withdrawaltransaction) | Withdrawal transaction parameters. | +| `auth` | [`*TransactOpts`](/go/api/accounts/types#transactopts) (optional) | Transaction options. | +| `tx` | [`WithdrawalTransaction`](/go/api/accounts/types#withdrawaltransaction) | Withdrawal transaction parameters. | ```go Withdraw(auth *TransactOpts, tx WithdrawalTransaction) (common.Hash, error) @@ -460,7 +460,7 @@ Withdraw ETH using paymaster to facilitate fee payment with an ERC20 token. ```go token := common.HexToAddress("0x927488F48ffbc32112F1fF721759649A89721F8F"); // Crown token which can be minted for free paymaster := common.HexToAddress("0x13D0D8550769f59aa241a41897D4859c87f7Dd46"); // Paymaster for Crown token - + paymasterParams, err := utils.GetPaymasterParams( paymaster, &zkTypes.ApprovalBasedPaymasterInput{ @@ -471,7 +471,7 @@ paymasterParams, err := utils.GetPaymasterParams( if err != nil { log.Panic(err) } - + txHash, err := account.Withdraw(nil, accounts.WithdrawalTransaction{ To: account.Address(), Amount: big.NewInt(1_000_000_000_000_000_000), diff --git a/content/sdk/20.go/02.api/01.accounts/07.smartaccount-factories.md b/content/20.go/02.api/01.accounts/07.smartaccount-factories.md similarity index 90% rename from content/sdk/20.go/02.api/01.accounts/07.smartaccount-factories.md rename to content/20.go/02.api/01.accounts/07.smartaccount-factories.md index 471cd049..175d572b 100644 --- a/content/sdk/20.go/02.api/01.accounts/07.smartaccount-factories.md +++ b/content/20.go/02.api/01.accounts/07.smartaccount-factories.md @@ -12,7 +12,7 @@ Creates a `SmartAccount` instance that uses single ECDSA key for signing payload |--------------|-----------------------------------------------------|----------------------------------------------------------| | `address` | `common.Address` | Account address. | | `privateKey` | `string` | The ECDSA private key. | -| `client` | [`*clients.BaseClient`](/sdk/go/api/clients/baseclient) | The client to connect to. Can be `nil` for offline usage. | +| `client` | [`*clients.BaseClient`](/go/api/clients/baseclient) | The client to connect to. Can be `nil` for offline usage. | ```go @@ -44,7 +44,7 @@ The signature is generated by concatenating signatures created by signing with e |---------------|-----------------------------------------------------|-----------------------------------------------------------| | `address` | `common.Address` | Account address. | | `privateKeys` | `[]string` | The list of the ECDSA private keys. | -| `client` | [`*clients.BaseClient`](/sdk/go/api/clients/baseclient) | The client to connect to. Can be `nil` for offline usage. | +| `client` | [`*clients.BaseClient`](/go/api/clients/baseclient) | The client to connect to. Can be `nil` for offline usage. | ```go NewMultisigECDSASmartAccount(address common.Address, privateKeys []string, client *clients.BaseClient) *SmartAccount diff --git a/content/sdk/20.go/02.api/01.accounts/08.smart-account-utils.md b/content/20.go/02.api/01.accounts/08.smart-account-utils.md similarity index 91% rename from content/sdk/20.go/02.api/01.accounts/08.smart-account-utils.md rename to content/20.go/02.api/01.accounts/08.smart-account-utils.md index b062d8d2..e7d46b68 100644 --- a/content/sdk/20.go/02.api/01.accounts/08.smart-account-utils.md +++ b/content/20.go/02.api/01.accounts/08.smart-account-utils.md @@ -31,9 +31,9 @@ Expects the secret to be ECDSA private in hex format. | Parameter | Type | Description | |-----------|-----------------------------------------------------------------|------------------------------------| | `ctx` | `context.Context` | Context. | -| `tx` | [`*zkTypes.Transaction712`](/sdk/go/api/types#transaction712) | The transaction that needs to be populated. | +| `tx` | [`*zkTypes.Transaction712`](/go/api/types#transaction712) | The transaction that needs to be populated. | | `secret` | `string` | The ECDSA private key. | -| `client` | [`*clients.BaseClient`](/sdk/go/api/clients/baseclient) | The client which fetches data from the network. | +| `client` | [`*clients.BaseClient`](/go/api/clients/baseclient) | The client which fetches data from the network. | ```go var PopulateTransactionECDSA TransactionBuilder = func(ctx context.Context, tx *zkTypes.Transaction712, secret interface{}, client *clients.BaseClient) error @@ -73,9 +73,9 @@ Expects the secret to be a slice of ECDSA private in hex format. | Parameter | Type | Description | |-----------|-----------------------------------------------------------------|-------------------------------------------------| | `ctx` | `context.Context` | Context. | -| `tx` | [`*zkTypes.Transaction712`](/sdk/go/api/types#transaction712) | The transaction that needs to be populated. | +| `tx` | [`*zkTypes.Transaction712`](/go/api/types#transaction712) | The transaction that needs to be populated. | | `secret` | `[]string` | The list of the ECDSA private keys. | -| `client` | [`*clients.BaseClient`](/sdk/go/api/clients/baseclient) | The client which fetches data from the network. | +| `client` | [`*clients.BaseClient`](/go/api/clients/baseclient) | The client which fetches data from the network. | ```go var PopulateTransactionMultipleECDSA TransactionBuilder = func(ctx context.Context, tx *zkTypes.Transaction712, secret interface{}, client *clients.BaseClient) error @@ -106,7 +106,7 @@ if err != nil { ### `SignPayloadWithECDSA` -Implementation of [`PayloadSigner`](/sdk/go/api/accounts/types#payloadsigner) which signs the payload using +Implementation of [`PayloadSigner`](/go/api/accounts/types#payloadsigner) which signs the payload using an ECDSA private key. #### Inputs @@ -116,7 +116,7 @@ an ECDSA private key. | `ctx` | `context.Context` | Context. | | `payload` | `[]byte` | The payload that needs to be signed. | | `secret` | `string` | The ECDSA private key. | -| `client` | [`*clients.BaseClient`](/sdk/go/api/clients/baseclient) | Not used and should be `nil`. | +| `client` | [`*clients.BaseClient`](/go/api/clients/baseclient) | Not used and should be `nil`. | ```go var SignPayloadWithECDSA PayloadSigner = func(ctx context.Context, payload []byte, secret interface{}, client *clients.BaseClient) ([]byte, error) @@ -240,7 +240,7 @@ if err != nil { ### `SignPayloadWithMultipleECDSA` -Implementation of [`PayloadSigner`](/sdk/go/api/accounts/types#payloadsigner) which signs the payload using +Implementation of [`PayloadSigner`](/go/api/accounts/types#payloadsigner) which signs the payload using multiple ECDSA private keys. The signature is generated by concatenating signatures created by signing with each key individually. The length of the resulting signature is `len(secret) * 65`. @@ -252,7 +252,7 @@ The length of the resulting signature is `len(secret) * 65`. | `ctx` | `context.Context` | Context. | | `payload` | `[]byte` | The payload that needs to be signed. | | `secret` | `[]string` | The list of the ECDSA private keys. | -| `client` | [`*clients.BaseClient`](/sdk/go/api/clients/baseclient) | Not used and should be `nil`. | +| `client` | [`*clients.BaseClient`](/go/api/clients/baseclient) | Not used and should be `nil`. | ```go var SignPayloadWithMultipleECDSA PayloadSigner = func(ctx context.Context, payload []byte, secret interface{}, client *clients.BaseClient) ([]byte, error) diff --git a/content/sdk/20.go/02.api/01.accounts/09.types.md b/content/20.go/02.api/01.accounts/09.types.md similarity index 98% rename from content/sdk/20.go/02.api/01.accounts/09.types.md rename to content/20.go/02.api/01.accounts/09.types.md index 125a1ac8..7d7d9385 100644 --- a/content/sdk/20.go/02.api/01.accounts/09.types.md +++ b/content/20.go/02.api/01.accounts/09.types.md @@ -35,7 +35,7 @@ type CallMsg struct { AccessList types.AccessList // EIP-2930 access list. Meta *zkTypes.Eip712Meta // EIP-712 metadata. } - + func (m *CallMsg) ToCallMsg(from common.Address) zkTypes.CallMsg ``` @@ -66,7 +66,7 @@ type Create2Transaction struct { Dependencies [][]byte // The bytecode of dependent smart contracts or smart accounts. Auth *TransactOpts // Authorization data. } - + func (t *Create2Transaction) ToTransaction(deploymentType DeploymentType) (*Transaction, error) ``` @@ -82,7 +82,7 @@ type CreateTransaction struct { Dependencies [][]byte // The bytecode of dependent smart contracts or smart accounts. Auth *TransactOpts // Authorization data. } - + func (t *CreateTransaction) ToTransaction(deploymentType DeploymentType) (*Transaction, error) ``` @@ -92,7 +92,7 @@ Represents an enumeration of deployment types. ```go type DeploymentType string - + const ( DeployContract DeploymentType = "CONTRACT" DeployAccount DeploymentType = "ACCOUNT" @@ -109,36 +109,36 @@ type DepositCallMsg struct { To common.Address // The address that will receive the deposited tokens on L2. Token common.Address // The address of the token to deposit. Amount *big.Int // The amount of the token to be deposited. - + // If the ETH value passed with the transaction is not explicitly stated Value, // this field will be equal to the tip the operator will receive on top of the base cost // of the transaction. OperatorTip *big.Int - + // The address of the bridge contract to be used. Defaults to the default ZKsync bridge // (either L1EthBridge or L1Erc20Bridge). BridgeAddress *common.Address - + L2GasLimit *big.Int // Maximum amount of L2 gas that transaction can consume during execution on L2. - + // The maximum amount L2 gas that the operator may charge the user for single byte of pubdata. GasPerPubdataByte *big.Int - + // The address on L2 that will receive the refund for the transaction. // If the transaction fails, it will also be the address to receive L2Value. RefundRecipient common.Address - + CustomBridgeData []byte // Additional data that can be sent to a bridge. - + Value *big.Int // The amount of wei sent along with the call. Gas uint64 // If 0, the call executes with near-infinite gas. GasPrice *big.Int // Wei <-> gas exchange ratio. GasFeeCap *big.Int // EIP-1559 fee cap per gas. GasTipCap *big.Int // EIP-1559 tip per gas. - + AccessList types.AccessList // EIP-2930 access list. } - + func (m *DepositCallMsg) ToDepositTransaction() DepositTransaction func (m *DepositCallMsg) ToRequestExecuteCallMsg() RequestExecuteCallMsg func (m *DepositCallMsg) ToCallMsg(from, l1Bridge common.Address) (ethereum.CallMsg, error) @@ -154,39 +154,39 @@ type DepositTransaction struct { To common.Address // The address of the token to deposit. Token common.Address // The address of the token to deposit. Amount *big.Int // The amount of the token to be deposited. - + // If the ETH value passed with the transaction is not explicitly stated Auth.Value, // this field will be equal to the tip the operator will receive on top of the base cost // of the transaction. OperatorTip *big.Int - + // The address of the bridge contract to be used. Defaults to the default ZKsync bridge // (either L1EthBridge or L1Erc20Bridge). BridgeAddress *common.Address - + // Whether should the token approval be performed under the hood. Set this flag to true if you // bridge an ERC20 token and didn't call the approveERC20 function beforehand. ApproveERC20 bool - + // Whether should the base token approval be performed under the hood. Set this flag to true if you // bridge an ERC20 token and didn't call the approveERC20 function beforehand. ApproveBaseERC20 bool - + L2GasLimit *big.Int // Maximum amount of L2 gas that transaction can consume during execution on L2. - + // The maximum amount L2 gas that the operator may charge the user for single byte of pubdata. GasPerPubdataByte *big.Int - + // The address on L2 that will receive the refund for the transaction. // If the transaction fails, it will also be the address to receive L2Value. RefundRecipient common.Address - + CustomBridgeData []byte // Additional data that can be sent to the bridge. - + ApproveAuth *TransactOpts // Authorization data for the token approval transaction. ApproveBaseAuth *TransactOpts // Authorization data for the base token approval transaction. } - + func (t *DepositTransaction) ToRequestExecuteTransaction() *RequestExecuteTransaction func (t *DepositTransaction) ToDepositCallMsg(opts *TransactOpts) DepositCallMsg func (t *DepositTransaction) PopulateEmptyFields(from common.Address) @@ -230,28 +230,28 @@ type RequestExecuteCallMsg struct { MintValue *big.Int // The amount of base token that needs to be minted on non-ETH-based L2. L2Value *big.Int // `msg.value` of L2 transaction. FactoryDeps [][]byte // An array of L2 bytecodes that will be marked as known on L2. - + // If the ETH value passed with the transaction is not explicitly stated Value, // this field will be equal to the tip the operator will receive on top of the base cost // of the transaction. OperatorTip *big.Int - + // The maximum amount L2 gas that the operator may charge the user for single byte of pubdata. GasPerPubdataByte *big.Int - + // The address on L2 that will receive the refund for the transaction. // If the transaction fails, it will also be the address to receive L2Value. RefundRecipient common.Address - + Value *big.Int // The amount of wei sent along with the call. Gas uint64 // If 0, the call executes with near-infinite gas. GasPrice *big.Int // Wei <-> gas exchange ratio. GasFeeCap *big.Int // EIP-1559 fee cap per gas. GasTipCap *big.Int // EIP-1559 tip per gas. - + AccessList types.AccessList // EIP-2930 access list. } - + func (m *RequestExecuteCallMsg) ToRequestExecuteTransaction() RequestExecuteTransaction // Deprecated in favor of ToCallMsgWithChainID func (m *RequestExecuteCallMsg) ToCallMsg(from common.Address) (ethereum.CallMsg, error) @@ -271,27 +271,27 @@ type RequestExecuteTransaction struct { MintValue *big.Int // The amount of base token that needs to be minted on non-ETH-based L2. L2Value *big.Int // `msg.value` of L2 transaction. FactoryDeps [][]byte // An array of L2 bytecodes that will be marked as known on L2. - + // If the ETH value passed with the transaction is not explicitly stated Auth.Value, // this field will be equal to the tip the operator will receive on top of the base cost // of the transaction. OperatorTip *big.Int - + // The maximum amount L2 gas that the operator may charge the user for single byte of pubdata. GasPerPubdataByte *big.Int - + // The address on L2 that will receive the refund for the transaction. // If the transaction fails, it will also be the address to receive L2Value. RefundRecipient common.Address } - + func (t *RequestExecuteTransaction) ToRequestExecuteCallMsg(opts *TransactOpts) RequestExecuteCallMsg func (t *RequestExecuteTransaction) ToCallMsg(from common.Address, opts *TransactOpts) zkTypes.CallMsg ``` ### `Transaction` -Transaction is similar to [`types.Transaction712`](/sdk/go/api/types#eip712txtype) but does not include the From field. +Transaction is similar to [`types.Transaction712`](/go/api/types#eip712txtype) but does not include the From field. This design is intended for use abstraction which already have an associated account with `AdapterL2`. The From field is bound to the specific account, and thus, it is not included in this type. @@ -304,13 +304,13 @@ type Transaction struct { GasTipCap *big.Int // EIP-1559 tip per gas. GasFeeCap *big.Int // EIP-1559 fee cap per gas. Gas uint64 // Gas limit to set for the transaction execution. - + AccessList types.AccessList // EIP-2930 access list. - + ChainID *big.Int // Chain ID of the network. Meta *zkTypes.Eip712Meta // EIP-712 metadata. } - + func (t *Transaction) ToTransaction712(from common.Address) *zkTypes.Transaction712 func (t *Transaction) ToCallMsg(from common.Address) zkTypes.CallMsg ``` @@ -341,7 +341,7 @@ type TransactOpts struct { GasLimit uint64 // Gas limit to set for the transaction execution (0 = estimate). Context context.Context // Network context to support cancellation and timeouts (nil = no timeout). } - + func (t *TransactOpts) ToTransactOpts(from common.Address, signer bind.SignerFn) *bind.TransactOpts ``` @@ -355,15 +355,15 @@ type TransferCallMsg struct { To common.Address // The address of the recipient. Amount *big.Int // The amount of the token to transfer. Token common.Address // The address of the token. ETH by default. - + Gas uint64 // If 0, the call executes with near-infinite gas. GasPrice *big.Int // Wei <-> gas exchange ratio. GasFeeCap *big.Int // EIP-1559 fee cap per gas. GasTipCap *big.Int // EIP-1559 tip per gas. - + AccessList types.AccessList // EIP-2930 access list. } - + func (m *TransferCallMsg) ToTransferCallMsg(from common.Address) clients.TransferCallMsg ``` @@ -377,7 +377,7 @@ type TransferTransaction struct { Amount *big.Int // The amount of the token to transfer. Token common.Address // The address of the token. ETH by default. } - + func (t *TransferTransaction) ToTransaction(opts *TransactOpts) *Transaction func (t *TransferTransaction) ToTransferCallMsg(from common.Address, opts *TransactOpts) clients.TransferCallMsg ``` @@ -393,15 +393,15 @@ type WithdrawalCallMsg struct { Amount *big.Int // The amount of the token to transfer. Token common.Address // The address of the token. ETH by default. BridgeAddress *common.Address // The address of the bridge contract to be used. - + Gas uint64 // If 0, the call executes with near-infinite gas. GasPrice *big.Int // Wei <-> gas exchange ratio. GasFeeCap *big.Int // EIP-1559 fee cap per gas. GasTipCap *big.Int // EIP-1559 tip per gas. - + AccessList types.AccessList // EIP-2930 access list. } - + func (m *WithdrawalCallMsg) ToWithdrawalCallMsg(from common.Address) clients.WithdrawalCallMsg ``` @@ -414,11 +414,11 @@ type WithdrawalTransaction struct { To common.Address // The address that will receive the withdrawn tokens on L1. Token common.Address // The address of the token to withdraw. Amount *big.Int // The amount of the token to withdraw. - + // The address of the bridge contract to be used. Defaults to the default ZKsync bridge // (either L2EthBridge or L2Erc20Bridge). BridgeAddress *common.Address } - + func (t *WithdrawalTransaction) ToWithdrawalCallMsg(from common.Address, opts *TransactOpts) *clients.WithdrawalCallMsg ``` diff --git a/content/sdk/20.go/02.api/02.eip712/00.eip712.md b/content/20.go/02.api/02.eip712/00.eip712.md similarity index 100% rename from content/sdk/20.go/02.api/02.eip712/00.eip712.md rename to content/20.go/02.api/02.eip712/00.eip712.md diff --git a/content/sdk/20.go/02.api/03.contracts/00.contracts.md b/content/20.go/02.api/03.contracts/00.contracts.md similarity index 99% rename from content/sdk/20.go/02.api/03.contracts/00.contracts.md rename to content/20.go/02.api/03.contracts/00.contracts.md index 7af131d6..ef3eacc7 100644 --- a/content/sdk/20.go/02.api/03.contracts/00.contracts.md +++ b/content/20.go/02.api/03.contracts/00.contracts.md @@ -10,8 +10,8 @@ an EIP-712 transaction, the deployment function generated with the `abigen` tool the `Deploy` interface is created, which provides methods for the deployment of smart contracts and smart accounts. There are the following objects that implement the `Deploy` interface: -- [`BaseDeployer`](/sdk/go/api/accounts/basedeployer), -- [`Wallet`](/sdk/go/api/accounts/wallet). +- [`BaseDeployer`](/go/api/accounts/basedeployer), +- [`Wallet`](/go/api/accounts/wallet). Contract instantiation is the same as in the [`geth`](https://geth.ethereum.org/docs/developers/dapp-developer/native-bindings) @@ -179,7 +179,7 @@ func main() { log.Panic(err) } fmt.Println("Value after second Set method execution: ", value) -} +} :: - Deploy smart contracts using `CREATE2` method @@ -349,7 +349,7 @@ func main() { contractAddress := receipt.ContractAddress fmt.Println("Paymaster address", contractAddress.String()) -} +} :: - Deploy smart accounts using `CREATE2` method diff --git a/content/sdk/20.go/02.api/04.utilities/00.utils.md b/content/20.go/02.api/04.utilities/00.utils.md similarity index 97% rename from content/sdk/20.go/02.api/04.utilities/00.utils.md rename to content/20.go/02.api/04.utilities/00.utils.md index bc240521..756538e9 100644 --- a/content/sdk/20.go/02.api/04.utilities/00.utils.md +++ b/content/20.go/02.api/04.utilities/00.utils.md @@ -209,7 +209,7 @@ Returns the encoded constructor data for CREATE method used for smart account de | ---------- | -------------------------------------------------------------------------- | ---------------------------------- | | `bytecode` | `[]byte` | Output from zkSolc. | | `calldata` | `[]byte` | ABI encoded constructor arguments. | -| `version` | [`types.AccountAbstractionVersion`](/sdk/go/api/types#accountabstractionversion) | Account abstraction version. | +| `version` | [`types.AccountAbstractionVersion`](/go/api/types#accountabstractionversion) | Account abstraction version. | ```go EncodeCreate2Account(bytecode, calldata, version types.AccountAbstractionVersion) ([]byte, error) @@ -226,7 +226,7 @@ Returns the encoded constructor data for CREATE2 method used for smart account d | `bytecode` | `[]byte` | Output from zkSolc. | | `calldata` | `[]byte` | ABI encoded constructor arguments. | | `salt` | `[]byte` | Randomization element. | -| `version` | [`types.AccountAbstractionVersion`](/sdk/go/api/types#accountabstractionversion) | Account abstraction version. | +| `version` | [`types.AccountAbstractionVersion`](/go/api/types#accountabstractionversion) | Account abstraction version. | ```go EncodeCreate2Account(bytecode, calldata, salt []byte, version types.AccountAbstractionVersion) ([]byte, error) diff --git a/content/sdk/20.go/02.api/04.utilities/01.paymaster-utils.md b/content/20.go/02.api/04.utilities/01.paymaster-utils.md similarity index 99% rename from content/sdk/20.go/02.api/04.utilities/01.paymaster-utils.md rename to content/20.go/02.api/04.utilities/01.paymaster-utils.md index fd1b00c8..f6e7b3c6 100644 --- a/content/sdk/20.go/02.api/04.utilities/01.paymaster-utils.md +++ b/content/20.go/02.api/04.utilities/01.paymaster-utils.md @@ -71,7 +71,7 @@ Returns a correctly-formed `paymasterParams` object for common paymaster flows. func GetPaymasterParams(paymasterAddress common.Address, paymasterInput types.PaymasterInput) (*types.PaymasterParams, error) ``` -Find out more about the [`PaymasterInput` type](/sdk/go/api/types). +Find out more about the [`PaymasterInput` type](/go/api/types). Check out the example on how to use paymaster. @@ -248,5 +248,5 @@ func main() { } fmt.Println("Paymaster tokenContract balance after mint: ", tokenBalance) -} +} :: diff --git a/content/sdk/20.go/02.api/05.types.md b/content/20.go/02.api/05.types.md similarity index 96% rename from content/sdk/20.go/02.api/05.types.md rename to content/20.go/02.api/05.types.md index 121df241..0381fb32 100644 --- a/content/sdk/20.go/02.api/05.types.md +++ b/content/20.go/02.api/05.types.md @@ -6,11 +6,11 @@ tags: ["go", "zksync", "sdk", "types"] Types are placed in three packages for different purposes: -- [`types`](/sdk/go/api/types): Contains common and general types used to build basic features and other types. -- [`eip712`](/sdk/go/api/eip712/eip712): Contains types used for EIP-712 implementation. -- [`clients`](/sdk/go/api/clients/types): Contains types that are meant to be used along with [`Client`](/sdk/go/api/clients/introduction). -- [`accounts`](/sdk/go/api/accounts/types): Contains types that are meant to be used along with an account, specifically -with the [`Adapter`](/sdk/go/api/accounts/types) abstraction. Many types are similar to those from the `geth` library, but +- [`types`](/go/api/types): Contains common and general types used to build basic features and other types. +- [`eip712`](/go/api/eip712/eip712): Contains types used for EIP-712 implementation. +- [`clients`](/go/api/clients/types): Contains types that are meant to be used along with [`Client`](/go/api/clients/introduction). +- [`accounts`](/go/api/accounts/types): Contains types that are meant to be used along with an account, specifically +with the [`Adapter`](/go/api/accounts/types) abstraction. Many types are similar to those from the `geth` library, but the `From` or `Signer` fields are omitted because these fields are inherited from `Adapter`, which already has an associated account. diff --git a/content/sdk/20.go/02.api/_dir.yml b/content/20.go/02.api/_dir.yml similarity index 100% rename from content/sdk/20.go/02.api/_dir.yml rename to content/20.go/02.api/_dir.yml diff --git a/content/sdk/30.python/00.introduction/00.overview.md b/content/30.python/00.introduction/00.overview.md similarity index 86% rename from content/sdk/30.python/00.introduction/00.overview.md rename to content/30.python/00.introduction/00.overview.md index 80dbc3dc..e09f293c 100644 --- a/content/sdk/30.python/00.introduction/00.overview.md +++ b/content/30.python/00.introduction/00.overview.md @@ -14,7 +14,7 @@ features in their applications. Most existing SDKs work right away, but deploying smart contracts or using unique ZKsync features, like account abstraction, needs extra fields that Ethereum transactions don't have by default. -To make it easy to use all ZKsync Era features, we created the `zksync2` Python SDK. This SDK has an interface similar +To make it easy to use all ZKsync Era features, we created the `zksync2-python` Python SDK. This SDK has an interface similar to [web3.py](https://web3py.readthedocs.io/en/latest/index.html). In fact, `web3.py` is a peer dependency of our library. Most objects exported by `zksync2` inherit from `web3.py` objects and only change the fields that need adjustments. @@ -30,8 +30,6 @@ library. Most objects exported by `zksync2` inherit from `web3.py` objects and o ### Additional resources -For more detailed information and advanced usage, refer to the [official ZKsync documentation](https://docs.zksync.io/sdk). - ::callout{icon="i-heroicons-light-bulb"} -To use the `zksync2-python`, visit the [Getting Started](/sdk/python/guides/getting-started) page. +To use the `zksync2-python`, visit the [Getting Started](/python/guides/getting-started) page. :: diff --git a/content/sdk/30.python/00.introduction/01.why-zksync-python.md b/content/30.python/00.introduction/01.why-zksync-python.md similarity index 93% rename from content/sdk/30.python/00.introduction/01.why-zksync-python.md rename to content/30.python/00.introduction/01.why-zksync-python.md index 4f0d3741..780d7ef6 100644 --- a/content/sdk/30.python/00.introduction/01.why-zksync-python.md +++ b/content/30.python/00.introduction/01.why-zksync-python.md @@ -40,6 +40,6 @@ The SDK is actively developed and maintained by the ZKsync team. This ensures th latest features and improvements, keeping your projects up to date with the evolving blockchain landscape. ::callout{icon="i-heroicons-light-bulb"} -Explore the [Python SDK documentation](/sdk/python/guides/getting-started) to get started and take advantage of all the +Explore the [Python SDK documentation](/python/guides/getting-started) to get started and take advantage of all the features and benefits it offers. :: diff --git a/content/sdk/30.python/00.introduction/02.installation.md b/content/30.python/00.introduction/02.installation.md similarity index 100% rename from content/sdk/30.python/00.introduction/02.installation.md rename to content/30.python/00.introduction/02.installation.md diff --git a/content/sdk/30.python/01.guides/00.getting-started.md b/content/30.python/01.guides/00.getting-started.md similarity index 99% rename from content/sdk/30.python/01.guides/00.getting-started.md rename to content/30.python/01.guides/00.getting-started.md index 8a3e3263..fd26f920 100644 --- a/content/sdk/30.python/01.guides/00.getting-started.md +++ b/content/30.python/01.guides/00.getting-started.md @@ -7,7 +7,7 @@ tags: ["zksync", "python", "sdk", "getting started"] This guide will help you get started with the `zksync2-python`, from connecting to the network to performing basic operations. ::callout{icon="i-heroicons-light-bulb"} -Check the [installation guide](/sdk/python/introduction/installation) for instructions. +Check the [installation guide](/python/introduction/installation) for instructions. :: ## Connecting to ZKsync Era diff --git a/content/sdk/30.python/01.guides/01.features.md b/content/30.python/01.guides/01.features.md similarity index 96% rename from content/sdk/30.python/01.guides/01.features.md rename to content/30.python/01.guides/01.features.md index 2fc28bd9..17f90df4 100644 --- a/content/sdk/30.python/01.guides/01.features.md +++ b/content/30.python/01.guides/01.features.md @@ -23,7 +23,7 @@ While the paymaster feature by itself does not impose any limitations on values the Matter Labs team endorses certain types of paymaster flows that are processable by EOAs. ZKsync SDK provides a utility method that can be used to get the correctly formed `paymasterParams` object: -[PaymasterFlowEncoder](/sdk/python/api/utilities/paymaster-utils#paymasterflowencoder). +[PaymasterFlowEncoder](/python/api/utilities/paymaster-utils#paymasterflowencoder). ## See in action diff --git a/content/sdk/30.python/01.guides/02.accounts-l1-l2.md b/content/30.python/01.guides/02.accounts-l1-l2.md similarity index 89% rename from content/sdk/30.python/01.guides/02.accounts-l1-l2.md rename to content/30.python/01.guides/02.accounts-l1-l2.md index ac7944e9..2f59d654 100644 --- a/content/sdk/30.python/01.guides/02.accounts-l1-l2.md +++ b/content/30.python/01.guides/02.accounts-l1-l2.md @@ -4,7 +4,7 @@ description: Methods to facilitate transactions between L1 and L2 networks tags: ["zksync", "l1", "l2", "transactions", "python", "sdk"] --- -This section explores the methods which allow the [account](/sdk/python/api/accounts/wallet) +This section explores the methods which allow the [account](/python/api/accounts/wallet) classes to send transactions from L1 to L2. If you want to get some background on how L1->L2 interaction works on ZKsync Era, go through the @@ -15,7 +15,7 @@ Full examples of actions below are available on the getting started page. ## Deposit `Wallet` object provides a deposit workflow. For more information, please refer to the -method specification [`Deposit`](/sdk/python/api/accounts/wallet#deposit). +method specification [`Deposit`](/python/api/accounts/wallet#deposit). For a complete example of how to execute the deposit workflow, take a look at the following: Deposit ETH and ERC20 token @@ -79,26 +79,26 @@ if __name__ == "__main__": ## Request execute `Wallet` and `L1Signer` objects provide an option to request execution of L2 transaction from L1. -For more information, please refer to the method specification [`request_execute`](/sdk/python/api/accounts/wallet#requestexecute). +For more information, please refer to the method specification [`request_execute`](/python/api/accounts/wallet#requestexecute). ## Base cost `Wallet` object provides an option to calculate base cost for L2 transaction. For more information, please refer to the -method specification [`getBaseCost`](/sdk/python/api/accounts/wallet#getbasecost). +method specification [`getBaseCost`](/python/api/accounts/wallet#getbasecost). ## Claim failed deposit `Wallet` object provides a claim fail deposit workflow. For more information, please refer to the method specification -[`claimFailedDeposit`](/sdk/python/api/accounts/wallet#claimfaileddeposit). +[`claimFailedDeposit`](/python/api/accounts/wallet#claimfaileddeposit). ## Finalize withdraw `Wallet` object provides a finalize withdraw workflow. For more information, please refer to the method specification -[`finalizeWithdrawal`](/sdk/python/api/accounts/wallet#finalizewithdrawal). +[`finalizeWithdrawal`](/python/api/accounts/wallet#finalizewithdrawal). ## Withdrawal -`Wallet` object provides a withdrawal workflow. For more information, please refer to the method specification [`Deposit`](/sdk/python/api/accounts/wallet#deposit). +`Wallet` object provides a withdrawal workflow. For more information, please refer to the method specification [`Deposit`](/python/api/accounts/wallet#deposit). For a complete example of how to execute the deposit workflow, take a look at the following: Withdraw ETH and ERC20 token @@ -153,5 +153,5 @@ if __name__ == "__main__": print("Wait for withdraw transaction to be finalized on L2 network (11-24 hours)") print("Read more about withdrawal delay: https://era.zksync.io/docs/dev/troubleshooting/withdrawal-delay.html") print("When withdraw transaction is finalized, execute 10_finalize_withdrawal.py script " - "with WITHDRAW_TX_HASH environment variable set") + "with WITHDRAW_TX_HASH environment variable set") :: diff --git a/content/sdk/30.python/02.api/00.providers/00.introduction.md b/content/30.python/02.api/00.providers/00.introduction.md similarity index 100% rename from content/sdk/30.python/02.api/00.providers/00.introduction.md rename to content/30.python/02.api/00.providers/00.introduction.md diff --git a/content/sdk/30.python/02.api/00.providers/01.provider.md b/content/30.python/02.api/00.providers/01.provider.md similarity index 95% rename from content/sdk/30.python/02.api/00.providers/01.provider.md rename to content/30.python/02.api/00.providers/01.provider.md index c6f88a5d..cd00d4da 100644 --- a/content/sdk/30.python/02.api/00.providers/01.provider.md +++ b/content/30.python/02.api/00.providers/01.provider.md @@ -34,13 +34,13 @@ zksync = ZkSyncBuilder.build("https://sepolia.era.zksync.dev") ### `zks_estimate_fee` -Returns an estimated [`Fee`](/sdk/python/api/types#fee) for requested transaction. +Returns an estimated [`Fee`](/python/api/types#fee) for requested transaction. #### Inputs | Parameter | Type | Description | | ------------- | --------------------------------------- | -------------------- | -| `transaction` | [`Transaction`](/sdk/python/api/types#transaction) | Transaction request. | +| `transaction` | [`Transaction`](/python/api/types#transaction) | Transaction request. | #### Example @@ -62,7 +62,7 @@ Returns an estimate(`int`) of the amount of gas required to submit a transaction | Parameter | Type | Description | | ------------- |-----------------------------------------| -------------------- | -| `transaction` | [`Transaction`](/sdk/python/api/types#transaction) | Transaction request. | +| `transaction` | [`Transaction`](/python/api/types#transaction) | Transaction request. | [web3.py implementation.](https://web3py.readthedocs.io/en/stable/web3.eth.html#web3.eth.Eth.estimate_gas) @@ -110,7 +110,7 @@ to get the transfer transaction and sends it to the `eth_estimate_gas` method. | Parameter | Type | Description | | ------------- | --------------------------------------- | ------------------------- | -| `transaction` | [`Transaction`](/sdk/python/api/types#transaction) | Transaction. | +| `transaction` | [`Transaction`](/python/api/types#transaction) | Transaction. | | `token` | Address string | Token address (optional). | #### Example @@ -134,7 +134,7 @@ Returns gas estimation for an L1 to L2 execute operation. | Parameter | Type | | ------------- | --------------------------------------- | -| `Transaction` | [`Transaction`](/sdk/python/api/types#transaction) | +| `Transaction` | [`Transaction`](/python/api/types#transaction) | #### Example @@ -211,7 +211,7 @@ if __name__ == "__main__": ### `zks_get_block_details` -Returns [`BlockDetails`](/sdk/python/api/types#blockdetails) additional ZKsync-specific information about the L2 block. +Returns [`BlockDetails`](/python/api/types#blockdetails) additional ZKsync-specific information about the L2 block. Calls the [`zks_getBlockDetails`](https://docs.zksync.io/build/api-reference/zks-rpc#zks_getblockdetailss) JSON-RPC method. @@ -276,7 +276,7 @@ if __name__ == "__main__": ### `getContractAccountInfo` -Returns [`ContractAccountInfo`](/sdk/python/api/types#contractaccountinfo) class with version of the supported account +Returns [`ContractAccountInfo`](/python/api/types#contractaccountinfo) class with version of the supported account abstraction and nonce ordering from a given contract address. #### Inputs @@ -295,7 +295,7 @@ result = zksync_web3.zksync.get_contract_account_info(contract_address) ### `zks_get_bridge_contracts` -Returns [`BridgeAddresses`](/sdk/python/api/types#bridgeaddresses) class containing addresses of the default ZKsync Era +Returns [`BridgeAddresses`](/python/api/types#bridgeaddresses) class containing addresses of the default ZKsync Era bridge contracts on both L1 and L2. ```python @@ -477,7 +477,7 @@ Returns the populated transfer transaction. | Name | Description | | ---------- |------------------------------------------------------| -| transaction | [`TransferTransaction`](/sdk/python/api/types#withdrawtransaction) | +| transaction | [`TransferTransaction`](/python/api/types#withdrawtransaction) | | `from` | From address. | #### Examples @@ -515,7 +515,7 @@ Returns the populated withdrawal transaction. | Name | Description | | ---------- |------------------------------------------------------| -| transaction | [`WithdrawTransaction`](/sdk/python/api/types#withdrawtransaction) | +| transaction | [`WithdrawTransaction`](/python/api/types#withdrawtransaction) | | `from` | From address. | #### Examples diff --git a/content/sdk/30.python/02.api/01.accounts/00.introduction.md b/content/30.python/02.api/01.accounts/00.introduction.md similarity index 100% rename from content/sdk/30.python/02.api/01.accounts/00.introduction.md rename to content/30.python/02.api/01.accounts/00.introduction.md diff --git a/content/sdk/30.python/02.api/01.accounts/01.wallet.md b/content/30.python/02.api/01.accounts/01.wallet.md similarity index 97% rename from content/sdk/30.python/02.api/01.accounts/01.wallet.md rename to content/30.python/02.api/01.accounts/01.wallet.md index e0bfb31b..ddaecb6e 100644 --- a/content/sdk/30.python/02.api/01.accounts/01.wallet.md +++ b/content/30.python/02.api/01.accounts/01.wallet.md @@ -82,7 +82,7 @@ Returns `Contract` wrapper of the ZKsync smart contract. | Name | Description | | ------- | ----------------------------------------------------------- | -| returns | [`L1BridgeContracts`](/sdk/python/api/types#l1bridgecontracts) object. | +| returns | [`L1BridgeContracts`](/python/api/types#l1bridgecontracts) object. | #### Example @@ -352,7 +352,7 @@ token within the same interface. | Name | Description | | ------- | -------------------------------------------------------- | -| tx | [`TransferTransaction`](/sdk/python/api/types#transfertransaction). | +| tx | [`TransferTransaction`](/python/api/types#transfertransaction). | | returns | A `HexStr` of transaction. | #### Example @@ -741,7 +741,7 @@ To check the amount of approved tokens for a specific bridge, use the [`get_allo | Name | Description | | ----------- | ----------------------------------------------------- | -| transaction | [`Deposittransaction`](/sdk/python/api/types#deposittransaction) | +| transaction | [`Deposittransaction`](/python/api/types#deposittransaction) | | returns | `Hash` of the transaction. | #### Example @@ -897,7 +897,7 @@ Returns populated deposit transaction. | Name | Description | | ----------- | ----------------------------------------------------- | -| transaction | [`Deposittransaction`](/sdk/python/api/types#deposittransaction) | +| transaction | [`Deposittransaction`](/python/api/types#deposittransaction) | #### Example @@ -939,7 +939,7 @@ Gas of approving ERC20 token is not included in estimation. | Name | Description | | ----------- | ----------------------------------------------------- | -| transaction | [`Deposittransaction`](/sdk/python/api/types#deposittransaction) | +| transaction | [`Deposittransaction`](/python/api/types#deposittransaction) | #### Example @@ -974,13 +974,13 @@ estimated_gas_eth = wallet.estimate_gas_deposit(DepositTransaction(token=ADDRESS ### `getFullRequiredDepositFee` -Retrieves the full needed ETH fee for the deposit. Returns the L1 fee and the L2 fee [`FullDepositFee`](/sdk/python/api/types#fulldepositfee). +Retrieves the full needed ETH fee for the deposit. Returns the L1 fee and the L2 fee [`FullDepositFee`](/python/api/types#fulldepositfee). #### Inputs | Name | Description | | ----------- | ----------------------------------------------------- | -| transaction | [`Deposittransaction`](/sdk/python/api/types#deposittransaction) | +| transaction | [`Deposittransaction`](/python/api/types#deposittransaction) | #### Example @@ -1048,7 +1048,7 @@ L2 network to the target account on L1 network. | Name | Description | | ----------- | ------------------------------------------------------- | -| transaction | [`WithdrawTransaction`](/sdk/python/api/types#withdrawtransaction) | +| transaction | [`WithdrawTransaction`](/python/api/types#withdrawtransaction) | #### Example @@ -1168,7 +1168,7 @@ Existing allowance for the bridge is not checked; allowance is calculated solely | Name | Description | | ----------- | ------------------------------------------------------------------ | -| transaction | [`RequestExecuteCallMsg`](/sdk/python/api/types#requestexecutecallmsg) object | +| transaction | [`RequestExecuteCallMsg`](/python/api/types#requestexecutecallmsg) object | #### Example @@ -1236,7 +1236,7 @@ Request execution of L2 transaction from L1. Return hash of the transaction | Name | Description | | ----------- | ------------------------------------------------------------------ | -| transaction | [`RequestExecuteCallMsg`](/sdk/python/api/types#requestexecutecallmsg) object | +| transaction | [`RequestExecuteCallMsg`](/python/api/types#requestexecutecallmsg) object | #### Example @@ -1276,7 +1276,7 @@ Returns populated request execute transaction. | Name | Description | | ----------- | ------------------------------------------------------------------ | -| transaction | [`RequestExecuteCallMsg`](/sdk/python/api/types#requestexecutecallmsg) object | +| transaction | [`RequestExecuteCallMsg`](/python/api/types#requestexecutecallmsg) object | #### Example @@ -1314,7 +1314,7 @@ Estimates the amount of gas required for a request execute transaction. | Name | Description | | ----------- | ------------------------------------------------------------------ | -| transaction | [`RequestExecuteCallMsg`](/sdk/python/api/types#requestexecutecallmsg) object | +| transaction | [`RequestExecuteCallMsg`](/python/api/types#requestexecutecallmsg) object | #### Example diff --git a/content/sdk/30.python/02.api/01.accounts/02.ethsigner.md b/content/30.python/02.api/01.accounts/02.ethsigner.md similarity index 100% rename from content/sdk/30.python/02.api/01.accounts/02.ethsigner.md rename to content/30.python/02.api/01.accounts/02.ethsigner.md diff --git a/content/sdk/30.python/02.api/01.accounts/03.smartaccount.md b/content/30.python/02.api/01.accounts/03.smartaccount.md similarity index 98% rename from content/sdk/30.python/02.api/01.accounts/03.smartaccount.md rename to content/30.python/02.api/01.accounts/03.smartaccount.md index 73902263..a50d3297 100644 --- a/content/sdk/30.python/02.api/01.accounts/03.smartaccount.md +++ b/content/30.python/02.api/01.accounts/03.smartaccount.md @@ -280,7 +280,7 @@ L2 network to the target account on L1 network. | Name | Description | | ----------- | ------------------------------------------------------- | -| transaction | [`WithdrawTransaction`](/sdk/python/api/types#withdrawtransaction) | +| transaction | [`WithdrawTransaction`](/python/api/types#withdrawtransaction) | #### Example @@ -361,7 +361,7 @@ token within the same interface. | Name | Description | | ------- | -------------------------------------------------------- | -| tx | [`TransferTransaction`](/sdk/python/api/types#transfertransaction). | +| tx | [`TransferTransaction`](/python/api/types#transfertransaction). | | returns | A `HexStr` of transaction. | #### Example diff --git a/content/sdk/30.python/02.api/01.accounts/04.smart-account-utils.md b/content/30.python/02.api/01.accounts/04.smart-account-utils.md similarity index 100% rename from content/sdk/30.python/02.api/01.accounts/04.smart-account-utils.md rename to content/30.python/02.api/01.accounts/04.smart-account-utils.md diff --git a/content/sdk/30.python/02.api/01.accounts/05.smartaccount-factories.md b/content/30.python/02.api/01.accounts/05.smartaccount-factories.md similarity index 100% rename from content/sdk/30.python/02.api/01.accounts/05.smartaccount-factories.md rename to content/30.python/02.api/01.accounts/05.smartaccount-factories.md diff --git a/content/sdk/30.python/02.api/02.contracts/00.contracts.md b/content/30.python/02.api/02.contracts/00.contracts.md similarity index 100% rename from content/sdk/30.python/02.api/02.contracts/00.contracts.md rename to content/30.python/02.api/02.contracts/00.contracts.md diff --git a/content/sdk/30.python/02.api/03.utilities/00.utils.md b/content/30.python/02.api/03.utilities/00.utils.md similarity index 100% rename from content/sdk/30.python/02.api/03.utilities/00.utils.md rename to content/30.python/02.api/03.utilities/00.utils.md diff --git a/content/sdk/30.python/02.api/03.utilities/01.paymaster-utils.md b/content/30.python/02.api/03.utilities/01.paymaster-utils.md similarity index 99% rename from content/sdk/30.python/02.api/03.utilities/01.paymaster-utils.md rename to content/30.python/02.api/03.utilities/01.paymaster-utils.md index 73a53ba2..c69154b2 100644 --- a/content/sdk/30.python/02.api/03.utilities/01.paymaster-utils.md +++ b/content/30.python/02.api/03.utilities/01.paymaster-utils.md @@ -58,7 +58,7 @@ paymaster_params = PaymasterParams(**{ }) ``` -Find out more about the [`PaymasterParams` type](/sdk/python/api/types). +Find out more about the [`PaymasterParams` type](/python/api/types). Check out the example on how to use paymaster. ::collapsible diff --git a/content/sdk/30.python/02.api/04.types.md b/content/30.python/02.api/04.types.md similarity index 100% rename from content/sdk/30.python/02.api/04.types.md rename to content/30.python/02.api/04.types.md diff --git a/content/sdk/30.python/02.api/_dir.yml b/content/30.python/02.api/_dir.yml similarity index 100% rename from content/sdk/30.python/02.api/_dir.yml rename to content/30.python/02.api/_dir.yml diff --git a/content/sdk/40.java/00.introduction/00.overview.md b/content/40.java/00.introduction/00.overview.md similarity index 94% rename from content/sdk/40.java/00.introduction/00.overview.md rename to content/40.java/00.introduction/00.overview.md index ee07c90b..c035200a 100644 --- a/content/sdk/40.java/00.introduction/00.overview.md +++ b/content/40.java/00.introduction/00.overview.md @@ -41,5 +41,5 @@ The `zksync2-java` library is designed with simplicity in mind, offering straigh documentation to help developers get started quickly and efficiently. ::callout{icon="i-heroicons-light-bulb"} -To use the `zksync2-java`, visit the [Getting started](/sdk/java/guides/getting-started) page. +To use the `zksync2-java`, visit the [Getting started](/java/guides/getting-started) page. :: diff --git a/content/sdk/40.java/00.introduction/01.why-java-sdk.md b/content/40.java/00.introduction/01.why-java-sdk.md similarity index 100% rename from content/sdk/40.java/00.introduction/01.why-java-sdk.md rename to content/40.java/00.introduction/01.why-java-sdk.md diff --git a/content/sdk/40.java/00.introduction/02.installation.md b/content/40.java/00.introduction/02.installation.md similarity index 100% rename from content/sdk/40.java/00.introduction/02.installation.md rename to content/40.java/00.introduction/02.installation.md diff --git a/content/sdk/40.java/01.guides/00.getting-started.md b/content/40.java/01.guides/00.getting-started.md similarity index 95% rename from content/sdk/40.java/01.guides/00.getting-started.md rename to content/40.java/01.guides/00.getting-started.md index 635828a0..6c039f46 100644 --- a/content/sdk/40.java/01.guides/00.getting-started.md +++ b/content/40.java/01.guides/00.getting-started.md @@ -21,7 +21,7 @@ blockchain functions. ::callout{icon="i-heroicons-light-bulb"} Ensure you have installed the `zksync2-java` SDK. If you still need to do so, please refer to -the [installation guide](/sdk/java/introduction/installation) for detailed instructions. +the [installation guide](/java/introduction/installation) for detailed instructions. :: ## Examples diff --git a/content/sdk/40.java/01.guides/01.features.md b/content/40.java/01.guides/01.features.md similarity index 91% rename from content/sdk/40.java/01.guides/01.features.md rename to content/40.java/01.guides/01.features.md index 086a574b..751bc16d 100644 --- a/content/sdk/40.java/01.guides/01.features.md +++ b/content/40.java/01.guides/01.features.md @@ -26,4 +26,4 @@ the Matter Labs team endorses certain types of that are processable by EOAs. ZKsync SDK provides a utility method that can be used to get the correctly formed `paymasterParams` object: -[approvalBased](/sdk/java/api/utilities/paymaster-utils#encodeapprovalbased), [general](/sdk/java/api/utilities/paymaster-utils#encodegeneral). +[approvalBased](/java/api/utilities/paymaster-utils#encodeapprovalbased), [general](/java/api/utilities/paymaster-utils#encodegeneral). diff --git a/content/sdk/40.java/01.guides/02.accounts-l1-l2.md b/content/40.java/01.guides/02.accounts-l1-l2.md similarity index 91% rename from content/sdk/40.java/01.guides/02.accounts-l1-l2.md rename to content/40.java/01.guides/02.accounts-l1-l2.md index 9c61e9cd..c8eaaf6b 100644 --- a/content/sdk/40.java/01.guides/02.accounts-l1-l2.md +++ b/content/40.java/01.guides/02.accounts-l1-l2.md @@ -4,7 +4,7 @@ description: Methods for handling transactions between L1 and L2 networks on ZKs tags: ["zksync", "l1", "l2", "transactions", "java", "sdk"] --- -This section explores the methods which allow the [account](/sdk/java/api/accounts/wallet) to send transactions +This section explores the methods which allow the [account](/java/api/accounts/wallet) to send transactions among both L1 to L2 networks. If you want some background on how L1<->L2 interaction works on ZKsync, go through the @@ -13,7 +13,7 @@ If you want some background on how L1<->L2 interaction works on ZKsync, go throu ## Deposit `Wallet` and `L1Signer` objects provide a deposit workflow. -For more information, please refer to the method specification [`Deposit`](/sdk/java/api/accounts/wallet#deposit). +For more information, please refer to the method specification [`Deposit`](/java/api/accounts/wallet#deposit). For a complete example of how to execute the deposit workflow, take a look at the following: Deposit ETH and ERC20 token @@ -56,17 +56,17 @@ main() ## Request execute `Wallet` and `L1Signer` objects provide an option to request execution of L2 transaction from L1. -For more information, please refer to the method specification [`requestExecute`](/sdk/java/api/accounts/wallet#requestexecute). +For more information, please refer to the method specification [`requestExecute`](/java/api/accounts/wallet#requestexecute). ## Base cost `Wallet` and `L1Signer` objects provide an option to calculate base cost for L2 transaction. -For more information, please refer to the method specification [`getBaseCost`](/sdk/java/api/accounts/wallet#getbasecost). +For more information, please refer to the method specification [`getBaseCost`](/java/api/accounts/wallet#getbasecost). ## Withdrawal `Wallet` and `Signer` objects provide a withdrawal workflow. -For more information, please refer to the method specification [`Deposit`](/sdk/java/api/accounts/wallet#deposit). +For more information, please refer to the method specification [`Deposit`](/java/api/accounts/wallet#deposit). For a complete example of how to execute the deposit workflow, take a look at the following: Withdraw ETH and ERC20 token diff --git a/content/sdk/40.java/02.api/00.providers/00.introduction.md b/content/40.java/02.api/00.providers/00.introduction.md similarity index 100% rename from content/sdk/40.java/02.api/00.providers/00.introduction.md rename to content/40.java/02.api/00.providers/00.introduction.md diff --git a/content/sdk/40.java/02.api/00.providers/01.provider.md b/content/40.java/02.api/00.providers/01.provider.md similarity index 99% rename from content/sdk/40.java/02.api/00.providers/01.provider.md rename to content/40.java/02.api/00.providers/01.provider.md index 3f2cffb1..f2762565 100644 --- a/content/sdk/40.java/02.api/00.providers/01.provider.md +++ b/content/40.java/02.api/00.providers/01.provider.md @@ -41,7 +41,7 @@ public class Main { ### `estimateFee` -Returns an estimated [`ZksEstimateFee`](/sdk/java/api/types#fee) for requested transaction. +Returns an estimated [`ZksEstimateFee`](/java/api/types#fee) for requested transaction. #### Inputs diff --git a/content/sdk/40.java/02.api/01.accounts/00.introduction.md b/content/40.java/02.api/01.accounts/00.introduction.md similarity index 100% rename from content/sdk/40.java/02.api/01.accounts/00.introduction.md rename to content/40.java/02.api/01.accounts/00.introduction.md diff --git a/content/sdk/40.java/02.api/01.accounts/01.wallet.md b/content/40.java/02.api/01.accounts/01.wallet.md similarity index 99% rename from content/sdk/40.java/02.api/01.accounts/01.wallet.md rename to content/40.java/02.api/01.accounts/01.wallet.md index 4fa8cc2e..84a14b9e 100644 --- a/content/sdk/40.java/02.api/01.accounts/01.wallet.md +++ b/content/40.java/02.api/01.accounts/01.wallet.md @@ -394,7 +394,7 @@ BigInteger result = testWallet.estimateGasDeposit(transaction); ### `getFullRequiredDepositFee` -Retrieves the full needed ETH fee for the deposit. Returns the L1 fee and the L2 fee [`FullDepositFee`](/sdk/java/api/types#fulldepositfee). +Retrieves the full needed ETH fee for the deposit. Returns the L1 fee and the L2 fee [`FullDepositFee`](/java/api/types#fulldepositfee). #### Inputs diff --git a/content/sdk/40.java/02.api/01.accounts/02.ethsigner.md b/content/40.java/02.api/01.accounts/02.ethsigner.md similarity index 100% rename from content/sdk/40.java/02.api/01.accounts/02.ethsigner.md rename to content/40.java/02.api/01.accounts/02.ethsigner.md diff --git a/content/sdk/40.java/02.api/01.accounts/03.smartaccount.md b/content/40.java/02.api/01.accounts/03.smartaccount.md similarity index 98% rename from content/sdk/40.java/02.api/01.accounts/03.smartaccount.md rename to content/40.java/02.api/01.accounts/03.smartaccount.md index 6ef90c44..34ef1659 100644 --- a/content/sdk/40.java/02.api/01.accounts/03.smartaccount.md +++ b/content/40.java/02.api/01.accounts/03.smartaccount.md @@ -151,7 +151,7 @@ L2 network to the target account on L1 network. | Name | Description | | ----------- |------------------------------------------------------------------| -| transaction | [`WithdrawTransaction`](/sdk/java/api/types#withdrawtransaction) | +| transaction | [`WithdrawTransaction`](/java/api/types#withdrawtransaction) | #### Example @@ -189,7 +189,7 @@ token within the same interface. | Name | Description | | ------- |-------------------------------------------------------------------| -| tx | [`TransferTransaction`](/sdk/java/api/types#transfertransaction). | +| tx | [`TransferTransaction`](/java/api/types#transfertransaction). | | returns | A `TransactionReceipt` of transaction. | #### Example diff --git a/content/sdk/40.java/02.api/01.accounts/04.smart-account-utils.md b/content/40.java/02.api/01.accounts/04.smart-account-utils.md similarity index 100% rename from content/sdk/40.java/02.api/01.accounts/04.smart-account-utils.md rename to content/40.java/02.api/01.accounts/04.smart-account-utils.md diff --git a/content/sdk/40.java/02.api/01.accounts/05.smartaccount-factories.md b/content/40.java/02.api/01.accounts/05.smartaccount-factories.md similarity index 100% rename from content/sdk/40.java/02.api/01.accounts/05.smartaccount-factories.md rename to content/40.java/02.api/01.accounts/05.smartaccount-factories.md diff --git a/content/sdk/40.java/02.api/02.contract/00.contracts.md b/content/40.java/02.api/02.contract/00.contracts.md similarity index 100% rename from content/sdk/40.java/02.api/02.contract/00.contracts.md rename to content/40.java/02.api/02.contract/00.contracts.md diff --git a/content/sdk/40.java/02.api/03.utilities/00.utils.md b/content/40.java/02.api/03.utilities/00.utils.md similarity index 100% rename from content/sdk/40.java/02.api/03.utilities/00.utils.md rename to content/40.java/02.api/03.utilities/00.utils.md diff --git a/content/sdk/40.java/02.api/03.utilities/01.paymaster-utils.md b/content/40.java/02.api/03.utilities/01.paymaster-utils.md similarity index 100% rename from content/sdk/40.java/02.api/03.utilities/01.paymaster-utils.md rename to content/40.java/02.api/03.utilities/01.paymaster-utils.md diff --git a/content/sdk/40.java/02.api/04.types.md b/content/40.java/02.api/04.types.md similarity index 100% rename from content/sdk/40.java/02.api/04.types.md rename to content/40.java/02.api/04.types.md diff --git a/content/sdk/40.java/02.api/_dir.yml b/content/40.java/02.api/_dir.yml similarity index 100% rename from content/sdk/40.java/02.api/_dir.yml rename to content/40.java/02.api/_dir.yml diff --git a/content/sdk/50.swift/00.introduction/00.overview.md b/content/50.swift/00.introduction/00.overview.md similarity index 92% rename from content/sdk/50.swift/00.introduction/00.overview.md rename to content/50.swift/00.introduction/00.overview.md index e806a11e..73eb3d10 100644 --- a/content/sdk/50.swift/00.introduction/00.overview.md +++ b/content/50.swift/00.introduction/00.overview.md @@ -21,5 +21,5 @@ interactions, and account management. ensures robust security and scalability, enabling applications to handle a high volume of transactions with minimal overhead. ::callout{icon="i-heroicons-light-bulb"} -To use the `zksync2-swift`, visit the [Getting started](/sdk/swift/introduction/installation) page. +To use the `zksync2-swift`, visit the [Getting started](/swift/introduction/installation) page. :: diff --git a/content/sdk/50.swift/00.introduction/01.why-swift-sdk.md b/content/50.swift/00.introduction/01.why-swift-sdk.md similarity index 100% rename from content/sdk/50.swift/00.introduction/01.why-swift-sdk.md rename to content/50.swift/00.introduction/01.why-swift-sdk.md diff --git a/content/sdk/50.swift/00.introduction/02.installation.md b/content/50.swift/00.introduction/02.installation.md similarity index 98% rename from content/sdk/50.swift/00.introduction/02.installation.md rename to content/50.swift/00.introduction/02.installation.md index 40836b5d..315dc5fd 100644 --- a/content/sdk/50.swift/00.introduction/02.installation.md +++ b/content/50.swift/00.introduction/02.installation.md @@ -19,7 +19,7 @@ Check out the [Java installation guide](https://www.swift.org/download) for more To install `zksync2-swift` via CocoaPods, add the `zksync2-swift` pod to your Podfile: -```ruby +```sh pod 'zksync2-swift' ``` @@ -37,7 +37,7 @@ To install `zksync2-swift` via Swift Package Manager, add `zksync2-swift` to you 2. Select `File > Swift Packages > Add Package Dependency`. 3. Enter the following URL: - ```url + ```text https://github.com/zksync-sdk/zksync2-swift.git ``` diff --git a/content/sdk/50.swift/01.guides/00.getting-started.md b/content/50.swift/01.guides/00.getting-started.md similarity index 96% rename from content/sdk/50.swift/01.guides/00.getting-started.md rename to content/50.swift/01.guides/00.getting-started.md index 6cd02a6e..cd9a7ec0 100644 --- a/content/sdk/50.swift/01.guides/00.getting-started.md +++ b/content/50.swift/01.guides/00.getting-started.md @@ -8,7 +8,7 @@ This guide provides an overview of the most common operations developers need to ::callout{icon="i-heroicons-light-bulb"} Ensure you have installed the `zksync2-s` SDK. If you still need to do so, please refer to -the [installation guide](/sdk/swift/introduction/installation) for detailed instructions. +the [installation guide](/swift/introduction/installation) for detailed instructions. :: ### Overview diff --git a/content/sdk/50.swift/01.guides/01.features.md b/content/50.swift/01.guides/01.features.md similarity index 94% rename from content/sdk/50.swift/01.guides/01.features.md rename to content/50.swift/01.guides/01.features.md index 7a1887e8..d4071fef 100644 --- a/content/sdk/50.swift/01.guides/01.features.md +++ b/content/50.swift/01.guides/01.features.md @@ -22,4 +22,4 @@ This document will focus solely on how to pass these arguments to the SDK. While the paymaster feature by itself does not impose any limitations on values of the `paymasterInput`. ZKsync SDK provides a utility method that can be used to get the correctly formed `paymasterParams` object: -[getPaymasterParams](/sdk/swift/api/types#paymasterparams). +[getPaymasterParams](/swift/api/types#paymasterparams). diff --git a/content/sdk/50.swift/01.guides/02.accounts-l1-l2.md b/content/50.swift/01.guides/02.accounts-l1-l2.md similarity index 73% rename from content/sdk/50.swift/01.guides/02.accounts-l1-l2.md rename to content/50.swift/01.guides/02.accounts-l1-l2.md index b482e6e1..b6845536 100644 --- a/content/sdk/50.swift/01.guides/02.accounts-l1-l2.md +++ b/content/50.swift/01.guides/02.accounts-l1-l2.md @@ -4,28 +4,28 @@ description: Methods for handling transactions between L1 and L2 networks on ZKs tags: ["zksync", "l1", "l2", "transactions", "swift", "sdk"] --- -This section explores the methods which allow the [account](/sdk/swift/api/accounts/introduction) +This section explores the methods which allow the [account](/swift/api/accounts/introduction) to send transactions among both L1 to L2 networks. If you want some background on how L1<->L2 interaction works on ZKsync, go through the [introduction](https://docs.zksync.io/build/developer-reference/l1-l2-interoperability). -Full examples of actions below are available on the [getting started](/sdk/swift/guides/getting-started) page. +Full examples of actions below are available on the [getting started](/swift/guides/getting-started) page. ## Deposit `WalletL1` and `Wallet` objects provide a deposit workflow. For more information, -please refer to the method specification [`Deposit`](/sdk/swift/api/accounts/introduction#deposit). +please refer to the method specification [`Deposit`](/swift/api/accounts/introduction#deposit). ## Request execute `WalletL1` and `Wallet` objects provide an option to request execution of L2 transaction from L1. -For more information, please refer to the method specification [`RequestExecute`](/sdk/swift/api/accounts/introduction#requestexecute). +For more information, please refer to the method specification [`RequestExecute`](/swift/api/accounts/introduction#requestexecute). ## Base cost `WalletL1` and `Wallet` objects provide an option to calculate base cost for L2 transaction. -For more information, please refer to the method specification [`BaseCost`](/sdk/swift/api/accounts/introduction#getbasecost). +For more information, please refer to the method specification [`BaseCost`](/swift/api/accounts/introduction#getbasecost). ## Claim failed deposit @@ -34,4 +34,4 @@ For more information, please refer to the method specification [`BaseCost`](/sdk ## Withdrawal `WalletL2` and `Wallet` objects provide a withdrawal workflow. For more information, please refer to the method specification -[`Withdraw`](/sdk/swift/api/accounts/introduction#withdraw). +[`Withdraw`](/swift/api/accounts/introduction#withdraw). diff --git a/content/sdk/50.swift/02.api/00.clients/00.introduction.md b/content/50.swift/02.api/00.clients/00.introduction.md similarity index 88% rename from content/sdk/50.swift/02.api/00.clients/00.introduction.md rename to content/50.swift/02.api/00.clients/00.introduction.md index 6548197d..16799b49 100644 --- a/content/sdk/50.swift/02.api/00.clients/00.introduction.md +++ b/content/50.swift/02.api/00.clients/00.introduction.md @@ -11,7 +11,7 @@ from the [`web3swift`](https://github.com/web3swift-team/web3swift) library and Two providers are available: -- **[`ZkSyncClient`](/sdk/swift/api/clients/client#zksyncclient)**: Supplies the same functionality as `Web3` and +- **[`ZkSyncClient`](/swift/api/clients/client#zksyncclient)**: Supplies the same functionality as `Web3` and extends it with ZKsync-specific methods. The `ZkSyncClient` component in `zksync2-swift` offers enhanced interaction capabilities with the ZKsync Era diff --git a/content/sdk/50.swift/02.api/00.clients/01.client.md b/content/50.swift/02.api/00.clients/01.client.md similarity index 96% rename from content/sdk/50.swift/02.api/00.clients/01.client.md rename to content/50.swift/02.api/00.clients/01.client.md index 3dbc9e59..7cb24dad 100644 --- a/content/sdk/50.swift/02.api/00.clients/01.client.md +++ b/content/50.swift/02.api/00.clients/01.client.md @@ -27,7 +27,7 @@ var ZKsync: ZKsyncClient= BaseClient(URL(string: "https://sepolia.era.zksync.dev ### `estimateFee` -Returns an estimated [`Fee`](/sdk/swift/api/types#fee) for requested transaction. +Returns an estimated [`Fee`](/swift/api/types#fee) for requested transaction. #### Inputs @@ -140,7 +140,7 @@ it to the [`estimateGas`](#estimategas) method. | `from` | `String` | From address. | | `token` | `String` | Token address (optional). | | `options` | [`TransactionOption`](https://docs.ethers.org/v6/api/contract/#Overrides) | TransactionOption (optional). | -| `paymasterParams` | [`PaymasterParams`](/sdk/swift/api/types#paymasterparams) | Paymaster parameters (optional). | +| `paymasterParams` | [`PaymasterParams`](/swift/api/types#paymasterparams) | Paymaster parameters (optional). | #### Example @@ -164,7 +164,7 @@ withdrawal transaction and sends it to the [`estimateGas`](#estimategas) method. | `to` | `String` | To address (optional). | | `token` | `String` | Token address (optional). | | `options` | [`TransactionOption`](https://docs.ethers.org/v6/api/contract/#Overrides) | TransactionOption (optional). | -| `paymasterParams` | [`PaymasterParams`](/sdk/swift/api/types#paymasterparams) | Paymaster parameters (optional). | +| `paymasterParams` | [`PaymasterParams`](/swift/api/types#paymasterparams) | Paymaster parameters (optional). | #### Example @@ -410,7 +410,7 @@ Returns the populated transfer transaction. | `from` | `String` | From address. | | `token` | `String` | Token address (optional). | | `options` | [`TransactionOption`](https://docs.ethers.org/v6/api/contract/#Overrides) | TransactionOption (optional). | -| `paymasterParams` | [`PaymasterParams`](/sdk/swift/api/types#paymasterparams) | Paymaster parameters (optional). | +| `paymasterParams` | [`PaymasterParams`](/swift/api/types#paymasterparams) | Paymaster parameters (optional). | #### Example @@ -454,7 +454,7 @@ Returns the populated withdrawal transaction. | `to` | `String` | To address. | | `token` | `String` | Token address (optional). | | `options` | [`TransactionOption`](https://docs.ethers.org/v6/api/contract/#Overrides) | TransactionOption (optional). | -| `paymasterParams` | [`PaymasterParams`](/sdk/swift/api/types#paymasterparams) | Paymaster parameters (optional). | +| `paymasterParams` | [`PaymasterParams`](/swift/api/types#paymasterparams) | Paymaster parameters (optional). | #### Examples diff --git a/content/sdk/50.swift/02.api/01.accounts/00.introduction.md b/content/50.swift/02.api/01.accounts/00.introduction.md similarity index 100% rename from content/sdk/50.swift/02.api/01.accounts/00.introduction.md rename to content/50.swift/02.api/01.accounts/00.introduction.md diff --git a/content/sdk/50.swift/02.api/01.accounts/01.wallet.md b/content/50.swift/02.api/01.accounts/01.wallet.md similarity index 100% rename from content/sdk/50.swift/02.api/01.accounts/01.wallet.md rename to content/50.swift/02.api/01.accounts/01.wallet.md diff --git a/content/sdk/50.swift/02.api/01.accounts/02.basedeployer.md b/content/50.swift/02.api/01.accounts/02.basedeployer.md similarity index 92% rename from content/sdk/50.swift/02.api/01.accounts/02.basedeployer.md rename to content/50.swift/02.api/01.accounts/02.basedeployer.md index 395c67e0..da626090 100644 --- a/content/sdk/50.swift/02.api/01.accounts/02.basedeployer.md +++ b/content/50.swift/02.api/01.accounts/02.basedeployer.md @@ -224,8 +224,8 @@ token within the same interface. | `to` | `String` | The address of the recipient. | | `amount` | `BigUInt` | The amount of the token to transfer (optional). | | `token` | `String` | The address of the token. `ETH` by default (optional). | -| `options` | [`TransactionOption`](/sdk/swift/api/types#transactionoption) | Transaction's options which may be used to pass l2 `gasLimit`, `gasPrice`, `value`, etc (optional). | -| `paymasterParams` | [`PaymasterParams`](/sdk/swift/api/types#paymasterparams) | Paymaster parameters (optional). | +| `options` | [`TransactionOption`](/swift/api/types#transactionoption) | Transaction's options which may be used to pass l2 `gasLimit`, `gasPrice`, `value`, etc (optional). | +| `paymasterParams` | [`PaymasterParams`](/swift/api/types#paymasterparams) | Paymaster parameters (optional). | #### Examples @@ -327,7 +327,7 @@ To check the amount of approved tokens for a specific bridge, use the [`allowanc | Parameter | Type | Description | | ------------- | ----------------------------------------------------- | -------------------------- | -| `transaction` | [`Deposittransaction`](/sdk/swift/api/types#deposittransaction) | DepositTransaction struct. | +| `transaction` | [`Deposittransaction`](/swift/api/types#deposittransaction) | DepositTransaction struct. | #### Example @@ -358,7 +358,7 @@ Returns populated deposit transaction. | Parameter | Type | Description | | ------------- | ----------------------------------------------------- | -------------------------- | -| `transaction` | [`Deposittransaction`](/sdk/swift/api/types#deposittransaction) | DepositTransaction struct. | +| `transaction` | [`Deposittransaction`](/swift/api/types#deposittransaction) | DepositTransaction struct. | #### Example @@ -378,7 +378,7 @@ Gas of approving ERC20 token is not included in estimation. | Parameter | Type | Description | | ------------- | ----------------------------------------------------- | -------------------------- | -| `transaction` | [`Deposittransaction`](/sdk/swift/api/types#deposittransaction) | DepositTransaction struct. | +| `transaction` | [`Deposittransaction`](/swift/api/types#deposittransaction) | DepositTransaction struct. | #### Example @@ -391,13 +391,13 @@ let gas = try! await wallet.walletL1.estimateGasDeposit(transaction: tx) ### `getFullRequiredDepositFee` -Retrieves the full needed ETH fee for the deposit. Returns the L1 fee and the L2 fee [`FullDepositFee`](/sdk/swift/api/types#fulldepositfee). +Retrieves the full needed ETH fee for the deposit. Returns the L1 fee and the L2 fee [`FullDepositFee`](/swift/api/types#fulldepositfee). #### Inputs | Parameter | Type | Description | | ------------- | ----------------------------------------------------- | -------------------------- | -| `transaction` | [`Deposittransaction`](/sdk/swift/api/types#deposittransaction) | DepositTransaction struct. | +| `transaction` | [`Deposittransaction`](/swift/api/types#deposittransaction) | DepositTransaction struct. | #### Example @@ -420,8 +420,8 @@ L2 network to the target account on L1 network. | `amount` | `BigNumberish` | The amount of the token to withdraw. | | `token` | `Address` | The address of the token. `ETH` by default. | | `to` | `Address` | The address of the recipient on L1 (optional). | -| `options` | [`TransactionOption`](/sdk/swift/api/types#transactionoption) | Transaction's options which may be used to pass l2 `gasLimit`, `gasPrice`, `value`, etc (optional). | -| `paymasterParams` | [`PaymasterParams`](/sdk/swift/api/types#paymasterparams) | Paymaster parameters (optional). | +| `options` | [`TransactionOption`](/swift/api/types#transactionoption) | Transaction's options which may be used to pass l2 `gasLimit`, `gasPrice`, `value`, etc (optional). | +| `paymasterParams` | [`PaymasterParams`](/swift/api/types#paymasterparams) | Paymaster parameters (optional). | #### Examples @@ -503,7 +503,7 @@ Proves the inclusion of the L2 -> L1 withdrawal message. | ---------------- | --------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | | `withdrawalHash` | `String` | Hash of the L2 transaction where the withdrawal was initiated. | | `index` | `Int` | In case there were multiple withdrawals in one transaction, you may pass an index of the withdrawal you want to finalize. Defaults to 0 (optional). | -| `options` | [`TransactionOption`](/sdk/swift/api/types#transactionoption) | Transaction's options which may be used to pass l2 `gasLimit`, `gasPrice`, `value`, etc (optional). | +| `options` | [`TransactionOption`](/swift/api/types#transactionoption) | Transaction's options which may be used to pass l2 `gasLimit`, `gasPrice`, `value`, etc (optional). | #### Example @@ -536,7 +536,7 @@ Request execution of L2 transaction from L1. | Parameter | Type | Description | | ------------- | ------------------------------------------------------------------- | --------------------------------- | -| `transaction` | [`RequestExecuteTransaction`](/sdk/swift/api/types#requestexecutetransaction) | RequestExecuteTransaction struct. | +| `transaction` | [`RequestExecuteTransaction`](/swift/api/types#requestexecutetransaction) | RequestExecuteTransaction struct. | #### Example @@ -558,7 +558,7 @@ Returns populated CodableTransaction. | Parameter | Type | Description | | ------------- | ------------------------------------------------------------------- | --------------------------------- | -| `transaction` | [`RequestExecuteTransaction`](/sdk/swift/api/types#requestexecutetransaction) | RequestExecuteTransaction struct. | +| `transaction` | [`RequestExecuteTransaction`](/swift/api/types#requestexecutetransaction) | RequestExecuteTransaction struct. | #### Example @@ -576,7 +576,7 @@ Estimates the amount of gas required for a request execute transaction. | Parameter | Type | Description | | ------------- | ------------------------------------------------------------------- | --------------------------------- | -| `transaction` | [`RequestExecuteTransaction`](/sdk/swift/api/types#requestexecutetransaction) | RequestExecuteTransaction struct. | +| `transaction` | [`RequestExecuteTransaction`](/swift/api/types#requestexecutetransaction) | RequestExecuteTransaction struct. | #### Example diff --git a/content/sdk/50.swift/02.api/01.accounts/03.ethsigner.md b/content/50.swift/02.api/01.accounts/03.ethsigner.md similarity index 100% rename from content/sdk/50.swift/02.api/01.accounts/03.ethsigner.md rename to content/50.swift/02.api/01.accounts/03.ethsigner.md diff --git a/content/sdk/50.swift/02.api/02.contracts/00.contract.md b/content/50.swift/02.api/02.contracts/00.contract.md similarity index 93% rename from content/sdk/50.swift/02.api/02.contracts/00.contract.md rename to content/50.swift/02.api/02.contracts/00.contract.md index 76774e5b..4b5b070d 100644 --- a/content/sdk/50.swift/02.api/02.contracts/00.contract.md +++ b/content/50.swift/02.api/02.contracts/00.contract.md @@ -10,4 +10,4 @@ With ZKsync, you can deploy a contract using the `create` and `create2` methods, by simply building the contract into a binary format and deploying it to the ZKsync network. In order to pay for smart contract interactions in ERC20 tokens, `customData` override should be used. -You can read more about accessing ZKsync features in [the features chapter](/sdk/swift/guides/features). +You can read more about accessing ZKsync features in [the features chapter](/swift/guides/features). diff --git a/content/sdk/50.swift/02.api/03.utilities/00.utils.md b/content/50.swift/02.api/03.utilities/00.utils.md similarity index 100% rename from content/sdk/50.swift/02.api/03.utilities/00.utils.md rename to content/50.swift/02.api/03.utilities/00.utils.md diff --git a/content/sdk/50.swift/02.api/03.utilities/01.paymaster-utils.md b/content/50.swift/02.api/03.utilities/01.paymaster-utils.md similarity index 97% rename from content/sdk/50.swift/02.api/03.utilities/01.paymaster-utils.md rename to content/50.swift/02.api/03.utilities/01.paymaster-utils.md index 1edebdd9..87070b8f 100644 --- a/content/sdk/50.swift/02.api/03.utilities/01.paymaster-utils.md +++ b/content/50.swift/02.api/03.utilities/01.paymaster-utils.md @@ -29,7 +29,7 @@ Returns a correctly-formed `paymasterParams` object for common paymaster flows. export function getPaymasterParams(paymasterAddress: Address, paymasterInput: PaymasterInput): PaymasterParams; ``` -Find out more about the [`PaymasterInput` type](/sdk/swift/api/types). +Find out more about the [`PaymasterInput` type](/swift/api/types). #### Examples diff --git a/content/sdk/50.swift/02.api/04.types.md b/content/50.swift/02.api/04.types.md similarity index 100% rename from content/sdk/50.swift/02.api/04.types.md rename to content/50.swift/02.api/04.types.md diff --git a/content/sdk/50.swift/02.api/_dir.yml b/content/50.swift/02.api/_dir.yml similarity index 100% rename from content/sdk/50.swift/02.api/_dir.yml rename to content/50.swift/02.api/_dir.yml diff --git a/content/sdk/60.rust/00.getting-started.md b/content/60.rust/00.getting-started.md similarity index 100% rename from content/sdk/60.rust/00.getting-started.md rename to content/60.rust/00.getting-started.md diff --git a/content/sdk/60.rust/contract-deployment-and-interaction.md b/content/60.rust/contract-deployment-and-interaction.md similarity index 99% rename from content/sdk/60.rust/contract-deployment-and-interaction.md rename to content/60.rust/contract-deployment-and-interaction.md index 9265fa1f..b4fc87e1 100644 --- a/content/sdk/60.rust/contract-deployment-and-interaction.md +++ b/content/60.rust/contract-deployment-and-interaction.md @@ -22,7 +22,7 @@ which is [available under the `examples/` directory][code] in the [`zksync-web3- ## Prerequisites This tutorial assumes that you know how to create a rust project and add [`zksync-web3-rs`][repo] as a dependency. -We recommend having followed the [Rust SDK Getting started](/sdk/rust/getting-started) tutorial first. +We recommend having followed the [Rust SDK Getting started](/rust/getting-started) tutorial first. Also, since our SDK does not provide wrappers for the compiler, building the `Greeter` contract is out of the scope of this tutorial. We will provide the ABI and compilation output together with the source code for the smart contract. diff --git a/content/sdk/70.faq.md b/content/70.faq.md similarity index 91% rename from content/sdk/70.faq.md rename to content/70.faq.md index 10b6fdcb..6f5a6014 100644 --- a/content/sdk/70.faq.md +++ b/content/70.faq.md @@ -17,7 +17,7 @@ ZKsync Era SDKs are toolkits designed to help developers build decentralized app Era network. They provide the necessary libraries and tools to interact with ZKsync. ### How do I get started with ZKsync Era SDKs? -You can start by visiting the [official ZKsync documentation](/sdk), which provides comprehensive guides, tutorials, +You can start by visiting the [official ZKsync documentation](/), which provides comprehensive guides, tutorials, and API references to help you begin building dApps on ZKsync Era. ### How do I connect to ZKsync Era using the Python SDK? diff --git a/content/sdk/80.troubleshooting.md b/content/80.troubleshooting.md similarity index 100% rename from content/sdk/80.troubleshooting.md rename to content/80.troubleshooting.md diff --git a/content/sdk/90.glossary.md b/content/90.glossary.md similarity index 100% rename from content/sdk/90.glossary.md rename to content/90.glossary.md diff --git a/content/_dir.yml b/content/_dir.yml new file mode 100644 index 00000000..6ba061b4 --- /dev/null +++ b/content/_dir.yml @@ -0,0 +1 @@ +title: Introduction diff --git a/content/sdk/_dir.yml b/content/sdk/_dir.yml deleted file mode 100644 index 1f3319fa..00000000 --- a/content/sdk/_dir.yml +++ /dev/null @@ -1 +0,0 @@ -title: SDK diff --git a/layouts/sdk.vue b/layouts/default.vue similarity index 74% rename from layouts/sdk.vue rename to layouts/default.vue index 85fac0e1..77594454 100644 --- a/layouts/sdk.vue +++ b/layouts/default.vue @@ -3,7 +3,8 @@ import type { NavItem } from '@nuxt/content/dist/runtime/types'; const nav = inject>('navigation', ref([])); -const navigation = computed(() => nav!.value.find((item) => item._path.startsWith('/sdk'))?.children || []); +// const navigation = computed(() => nav!.value.find((item) => item._path.startsWith('/'))?.children || []); +const navigation = computed(() => nav!.value || []);