diff --git a/content/sdk/10.js/00.ethers/05.api/10.v5/00.providers/01.provider.md b/content/sdk/10.js/00.ethers/05.api/10.v5/00.providers/01.provider.md index 9c1df100..90c94f52 100644 --- a/content/sdk/10.js/00.ethers/05.api/10.v5/00.providers/01.provider.md +++ b/content/sdk/10.js/00.ethers/05.api/10.v5/00.providers/01.provider.md @@ -43,10 +43,8 @@ Returns an estimated [`Fee`](/sdk/js/ethers/api/v5/types#fee) for requested tran async estimateFee(transaction: TransactionRequest): Promise ``` -Helper function: [toJSON](/sdk/js/ethers/api/v5/providers/web3provider#tojson). - ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); const fee = await provider.estimateFee({ @@ -54,7 +52,7 @@ const fee = await provider.estimateFee({ to: "0xa61464658AfeAf65CccaaFD3a512b69A83B77618", value: `0x${BigNumber.from(7_000_000_000).toString(16)}`, }); -console.log(`Fee: ${toJSON(fee)}`); +console.log(`Fee: ${utils.toJSON(fee)}`); ``` ### `estimateGas` @@ -131,7 +129,7 @@ async estimateGasL1(transaction: TransactionRequest): Promise #### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); const gasL1 = await provider.estimateGasL1({ @@ -266,7 +264,7 @@ async estimateL1ToL2Execute(transaction: { #### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); const gasL1ToL2 = await provider.estimateL1ToL2Execute({ @@ -297,14 +295,12 @@ async getAllAccountBalances(address: Address): Promise #### Example -Helper function: [toJSON](/sdk/js/ethers/api/v5/providers/web3provider#tojson). - ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); const balances = await provider.getAllAccountBalances("0x36615Cf349d7F6344891B1e7CA7C72883F5dc049"); -console.log(`All balances: ${toJSON(balances)}`); +console.log(`All balances: ${utils.toJSON(balances)}`); ``` ### `getBalance` @@ -328,7 +324,7 @@ async getBalance(address: Address, blockTag?: BlockTag, tokenAddress?: Address) #### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); const account = "0x36615Cf349d7F6344891B1e7CA7C72883F5dc049"; @@ -350,7 +346,7 @@ async getBaseTokenContractAddress(): Promise
#### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Base token: ${await provider.getBaseTokenContractAddress()}`); @@ -366,13 +362,11 @@ async getBlock(blockHashOrBlockTag: BlockTag | string | Promise #### Example -Helper function: [toJSON](/sdk/js/ethers/api/v5/providers/web3provider#tojson). - ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); -console.log(`Block details: ${toJSON(await provider.getBlockDetails(90_000))}`); +console.log(`Block details: ${utils.toJSON(await provider.getBlockDetails(90_000))}`); ``` ### `getBridgehubContractAddress` @@ -415,7 +407,7 @@ async getBridgehubContractAddress(): Promise
#### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Bridgehub: ${await provider.getBridgehubContractAddress()}`); @@ -440,7 +432,7 @@ async getBytecodeByHash(bytecodeHash: BytesLike): Promise #### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; // Bytecode hash can be computed by following these steps: // const testnetPaymasterBytecode = await provider.getCode(await provider.getTestnetPaymasterAddress()); @@ -472,8 +464,6 @@ async getConfirmedTokens(start: number = 0, limit: number = 255): Promise #### Example -Helper function: [toJSON](/sdk/js/ethers/api/v5/providers/web3provider#tojson). - ```ts -import { Provider, types } from "zksync-ethers"; +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: ${toJSON(await provider.getContractAccountInfo(tokenAddress))}`); +console.log(`Contract account info: ${utils.toJSON(await provider.getContractAccountInfo(tokenAddress))}`); ``` ### `getDefaultBridgeAddresses` @@ -525,13 +513,11 @@ getDefaultBridgeAddresses(): Promise<{ #### Example -Helper function: [toJSON](/sdk/js/ethers/api/v5/providers/web3provider#tojson). - ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); -console.log(`Default bridges: ${toJSON(await provider.getDefaultBridgeAddresses())}`); +console.log(`Default bridges: ${utils.toJSON(await provider.getDefaultBridgeAddresses())}`); ``` ### `connectL2Bridge` @@ -552,7 +538,7 @@ async connectL2Bridge(address: Address): Promise #### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); const l2Bridge = await provider.connectL2Bridge(""); @@ -575,7 +561,7 @@ async isL2BridgeLegacy(address: Address): Promise #### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); const isBridgeLegacy = await provider.isL2BridgeLegacy(""); @@ -599,7 +585,7 @@ static getDefaultProvider(zksyncNetwork: ZkSyncNetwork = ZkSyncNetwork.Localhost #### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const providerMainnet = Provider.getDefaultProvider(types.Network.Mainnet); const providerTestnet = Provider.getDefaultProvider(types.Network.Sepolia); @@ -619,8 +605,6 @@ async getFeeParams(): Promise #### Example -Helper function: [toJSON](/sdk/js/ethers/api/v5/providers/web3provider#tojson). - ```ts import { Provider, types, utils } from "zksync-ethers"; @@ -668,7 +652,7 @@ static override getFormatter(): Formatter #### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const formatter = Provider.getFormatter(); ``` @@ -684,7 +668,7 @@ async getGasPrice(): Promise #### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Gas price: ${await provider.getGasPrice()}`); @@ -709,14 +693,12 @@ async getL1BatchBlockRange(l1BatchNumber: number): Promise<[number, number] | nu #### Example -Helper function: [toJSON](/sdk/js/ethers/api/v5/providers/web3provider#tojson). - ```ts -import { Provider, types } from "zksync-ethers"; +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: ${toJSON(await provider.getL1BatchBlockRange(l1BatchNumber))}`); +console.log(`L1 batch block range: ${utils.toJSON(await provider.getL1BatchBlockRange(l1BatchNumber))}`); ``` ### `getL1BatchDetails` @@ -737,14 +719,12 @@ async getL1BatchDetails(number: number): Promise #### Example -Helper function: [toJSON](/sdk/js/ethers/api/v5/providers/web3provider#tojson). - ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); const l1BatchNumber = await provider.getL1BatchNumber(); -console.log(`L1 batch details: ${toJSON(await provider.getL1BatchDetails(l1BatchNumber))}`); +console.log(`L1 batch details: ${utils.toJSON(await provider.getL1BatchDetails(l1BatchNumber))}`); ``` ### `getL1BatchNumber` @@ -760,7 +740,7 @@ async getL1BatchNumber(): Promise #### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`L1 batch number: ${await provider.getL1BatchNumber()}`); @@ -782,17 +762,15 @@ async getL2TransactionFromPriorityOp(l1TxResponse: ethers.TransactionResponse): #### Example -Helper function: [toJSON](/sdk/js/ethers/api/v5/providers/web3provider#tojson). - ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const l1Tx = "0xcca5411f3e514052f4a4ae1c2020badec6e0998adb52c09959c5f5ff15fba3a8"; const l1TxResponse = await ethProvider.getTransaction(l1Tx); if (l1TxResponse) { - console.log(`Tx: ${toJSON(await provider.getL2TransactionFromPriorityOp(l1TxResponse))}`); + console.log(`Tx: ${utils.toJSON(await provider.getL2TransactionFromPriorityOp(l1TxResponse))}`); } ``` @@ -815,16 +793,14 @@ async getLogProof(txHash: BytesLike, index ? : number): Promise L1 transaction can be used. // In this case, withdrawal transaction is used. const tx = "0x2a1c6c74b184965c0cb015aae9ea134fd96215d2e4f4979cfec12563295f610e"; -console.log(`Log ${toJSON(await provider.getLogProof(tx, 0))}`); +console.log(`Log ${utils.toJSON(await provider.getLogProof(tx, 0))}`); ``` ### `getLogs` @@ -844,13 +820,11 @@ getLogs(filter: Filter | FilterByBlockHash | Promise #### Example -Helper function: [toJSON](/sdk/js/ethers/api/v5/providers/web3provider#tojson). - ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); -console.log(`Logs: ${toJSON(await provider.getLogs({ fromBlock: 0, toBlock: 5, address: utils.L2_ETH_TOKEN_ADDRESS }))}`); +console.log(`Logs: ${utils.toJSON(await provider.getLogs({ fromBlock: 0, toBlock: 5, address: utils.L2_ETH_TOKEN_ADDRESS }))}`); ``` ### `getMainContractAddress` @@ -866,7 +840,7 @@ async getMainContractAddress(): Promise
#### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Main contract: ${await provider.getMainContractAddress()}`); @@ -894,8 +868,6 @@ async getPriorityOpConfirmation(txHash: string, index: number = 0): Promise<{ #### Example -Helper function: [toJSON](/sdk/js/ethers/api/v5/providers/web3provider#tojson). - ```ts import { Provider, types, utils } from "zksync-ethers"; @@ -923,17 +895,15 @@ async getPriorityOpResponse(l1TxResponse: ethers.TransactionResponse): Promise

#### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Protocol version: ${await provider.getProtocolVersion()}`); @@ -1031,13 +999,11 @@ async getRawBlockTransactions(number: number): Promise #### Example -Helper function: [toJSON](/sdk/js/ethers/api/v5/providers/web3provider#tojson). - ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); -console.log(`Raw block transactions: ${toJSON(await provider.getRawBlockTransactions(90_000))}`); +console.log(`Raw block transactions: ${utils.toJSON(await provider.getRawBlockTransactions(90_000))}`); ``` ### `getTestnetPaymasterAddress` @@ -1052,7 +1018,7 @@ async getTestnetPaymasterAddress(): Promise

#### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Testnet paymaster: ${await provider.getTestnetPaymasterAddress()}`); @@ -1076,7 +1042,7 @@ async getTransaction(hash: string | Promise): Promise #### Example -Helper function: [toJSON](/sdk/js/ethers/api/v5/providers/web3provider#tojson). - ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); const TX_HASH = ""; -console.log(`Transaction details: ${toJSON(await provider.getTransactionDetails(TX_HASH))}`); +console.log(`Transaction details: ${utils.toJSON(await provider.getTransactionDetails(TX_HASH))}`); ``` ### `getTransactionReceipt` @@ -1137,14 +1101,12 @@ async getTransactionReceipt(transactionHash: string | Promise): Promise< #### Example -Helper function: [toJSON](/sdk/js/ethers/api/v5/providers/web3provider#tojson). - ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); const TX_HASH = ""; -console.log(`Transaction receipt: ${toJSON(await provider.getTransactionReceipt(TX_HASH))}`); +console.log(`Transaction receipt: ${utils.toJSON(await provider.getTransactionReceipt(TX_HASH))}`); ``` ### `getTransactionStatus` @@ -1163,15 +1125,13 @@ async getTransactionStatus(txHash: string): Promise #### Example -Helper function: [toJSON](/sdk/js/ethers/api/v5/providers/web3provider#tojson). - ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); const TX_HASH = ""; -console.log(`Transaction status: ${toJSON(await provider.getTransactionStatus(TX_HASH))}`); +console.log(`Transaction status: ${utils.toJSON(await provider.getTransactionStatus(TX_HASH))}`); ``` ### `getTransferTx` @@ -1329,7 +1289,7 @@ async isBaseToken(token: Address): Promise #### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Is base token: ${await provider.isBaseToken("0x5C221E77624690fff6dd741493D735a17716c26B")}`); @@ -1346,7 +1306,7 @@ async isEthBasedChain(): Promise #### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Is ETH based chain: ${await provider.isEthBasedChain()}`); @@ -1365,7 +1325,7 @@ async l1ChainId(): Promise #### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`L1 chain ID: ${await provider.l1ChainId()}`); @@ -1393,7 +1353,7 @@ async l1TokenAddress(token: Address): Promise #### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`L1 token address: ${await provider.l1TokenAddress("0x3e7676937A7E96CFB7616f255b9AD9FF47363D4b")}`); @@ -1422,7 +1382,7 @@ async l2TokenAddress(token: Address): Promise #### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`L2 token address: ${await provider.l2TokenAddress("0x5C221E77624690fff6dd741493D735a17716c26B")}`); @@ -1440,7 +1400,7 @@ async newBlockFilter(): Promise #### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`New block filter: ${await provider.newBlockFilter()}`); @@ -1490,7 +1450,7 @@ async newPendingTransactionsFilter(): Promise #### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`New pending transaction filter: ${await provider.newPendingTransactionsFilter()}`); @@ -1523,8 +1483,6 @@ async sendRawTransactionWithDetailedOutput(signedTx: string): Promise { - if (typeof value === "bigint") { - return value.toString(); // Convert BigInt to string - } - return value; - }); -} -``` diff --git a/content/sdk/10.js/00.ethers/05.api/10.v5/01.accounts/01.wallet.md b/content/sdk/10.js/00.ethers/05.api/10.v5/01.accounts/01.wallet.md index 15bd23bf..8248dc33 100644 --- a/content/sdk/10.js/00.ethers/05.api/10.v5/01.accounts/01.wallet.md +++ b/content/sdk/10.js/00.ethers/05.api/10.v5/01.accounts/01.wallet.md @@ -1919,8 +1919,6 @@ async getPriorityOpConfirmation(txHash: string, index: number = 0): Promise<{ #### Example -Helper function: [toJSON](/sdk/js/ethers/api/v5/providers/web3provider#tojson). - ```ts import { Wallet, Provider, types, utils } from "zksync-ethers"; import { ethers } from "ethers"; diff --git a/content/sdk/10.js/00.ethers/05.api/10.v5/01.accounts/03.l1signer.md b/content/sdk/10.js/00.ethers/05.api/10.v5/01.accounts/03.l1signer.md index ce9cc61b..df37efc9 100644 --- a/content/sdk/10.js/00.ethers/05.api/10.v5/01.accounts/03.l1signer.md +++ b/content/sdk/10.js/00.ethers/05.api/10.v5/01.accounts/03.l1signer.md @@ -10,7 +10,7 @@ This class extends `ethers.providers.JsonRpcSigner` and so supports all the meth The easiest way to construct it is from an `Web3Provider` object. ```ts -import { Provider, L1Signer, types } from "zksync-ethers"; +import { Provider, L1Signer, types, utils } from "zksync-ethers"; import { ethers } from "ethers"; const provider = new ethers.providers.Web3Provider(window.ethereum); @@ -1073,8 +1073,6 @@ async getPriorityOpConfirmation(txHash: string, index: number = 0): Promise<{ #### Example -Helper function: [toJSON](/sdk/js/ethers/api/v5/providers/web3provider#tojson). - ```ts import { Provider, L1Signer, types } from "zksync-ethers"; import { ethers } from "ethers"; diff --git a/content/sdk/10.js/00.ethers/05.api/20.v6/00.providers/01.provider.md b/content/sdk/10.js/00.ethers/05.api/20.v6/00.providers/01.provider.md index 79e4f0b6..ccd43f13 100644 --- a/content/sdk/10.js/00.ethers/05.api/20.v6/00.providers/01.provider.md +++ b/content/sdk/10.js/00.ethers/05.api/20.v6/00.providers/01.provider.md @@ -91,7 +91,7 @@ async estimateFee(transaction: TransactionRequest): Promise **Example:** ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); const fee = await provider.estimateFee({ @@ -99,7 +99,7 @@ const fee = await provider.estimateFee({ to: "0xa61464658AfeAf65CccaaFD3a512b69A83B77618", value: `0x${BigInt(7_000_000_000).toString(16)}`, }); -console.log(`Fee: ${toJSON(fee)}`); +console.log(`Fee: ${utils.toJSON(fee)}`); ``` The `estimateFee` method estimates the fee required for a transaction. This is important for users to know how much they @@ -154,7 +154,7 @@ async estimateGasL1(transaction: TransactionRequest): Promise **Example:** ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); const gasL1 = await provider.estimateGasL1({ @@ -289,7 +289,7 @@ async estimateL1ToL2Execute(transaction: { #### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); const gasL1ToL2 = await provider.estimateL1ToL2Execute({ @@ -320,14 +320,12 @@ async getAllAccountBalances(address: Address): Promise #### Example -Helper function: [toJSON](/sdk/js/ethers/api/v6/providers/browser-provider#tojson). - ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); const balances = await provider.getAllAccountBalances("0x36615Cf349d7F6344891B1e7CA7C72883F5dc049"); -console.log(`All balances: ${toJSON(balances)}`); +console.log(`All balances: ${utils.toJSON(balances)}`); ``` ### `getBalance` @@ -351,7 +349,7 @@ async getBalance(address: Address, blockTag?: BlockTag, tokenAddress?: Address) #### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); const account = "0x36615Cf349d7F6344891B1e7CA7C72883F5dc049"; @@ -373,7 +371,7 @@ async getBaseTokenContractAddress(): Promise
#### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Base token: ${await provider.getBaseTokenContractAddress()}`); @@ -396,13 +394,11 @@ async getBlock(blockHashOrBlockTag: BlockTag, includeTxs?: boolean): Promise #### Example -Helper function: [toJSON](/sdk/js/ethers/api/v6/providers/browser-provider#tojson). - ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); -console.log(`Block details: ${toJSON(await provider.getBlockDetails(90_000))}`); +console.log(`Block details: ${utils.toJSON(await provider.getBlockDetails(90_000))}`); ``` ### `getBridgehubContractAddress` @@ -445,7 +439,7 @@ async getBridgehubContractAddress(): Promise
#### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Bridgehub: ${await provider.getBridgehubContractAddress()}`); @@ -470,7 +464,7 @@ async getBytecodeByHash(bytecodeHash: BytesLike): Promise #### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; // Bytecode hash can be computed by following these steps: // const testnetPaymasterBytecode = await provider.getCode(await provider.getTestnetPaymasterAddress()); @@ -502,8 +496,6 @@ async getConfirmedTokens(start: number = 0, limit: number = 255): Promise #### Example -Helper function: [toJSON](/sdk/js/ethers/api/v6/providers/browser-provider#tojson). - ```ts -import { Provider, types } from "zksync-ethers"; +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: ${toJSON(await provider.getContractAccountInfo(tokenAddress))}`); +console.log(`Contract account info: ${utils.toJSON(await provider.getContractAccountInfo(tokenAddress))}`); ``` ### `getDefaultBridgeAddresses` @@ -555,13 +545,11 @@ getDefaultBridgeAddresses(): Promise<{ #### Example -Helper function: [toJSON](/sdk/js/ethers/api/v6/providers/browser-provider#tojson). - ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); -console.log(`Default bridges: ${toJSON(await provider.getDefaultBridgeAddresses())}`); +console.log(`Default bridges: ${utils.toJSON(await provider.getDefaultBridgeAddresses())}`); ``` ### `connectL2Bridge` @@ -582,7 +570,7 @@ async connectL2Bridge(address: Address): Promise #### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); const l2Bridge = await provider.connectL2Bridge(""); @@ -605,7 +593,7 @@ async isL2BridgeLegacy(address: Address): Promise #### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); const isBridgeLegacy = await provider.isL2BridgeLegacy(""); @@ -629,7 +617,7 @@ static getDefaultProvider(zksyncNetwork: ZkSyncNetwork = ZkSyncNetwork.Localhost #### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const providerMainnet = Provider.getDefaultProvider(types.Network.Mainnet); const providerTestnet = Provider.getDefaultProvider(types.Network.Sepolia); @@ -649,8 +637,6 @@ async getFeeParams(): Promise #### Example -Helper function: [toJSON](/sdk/js/ethers/api/v6/providers/browser-provider#tojson). - ```ts import { Provider, types, utils } from "zksync-ethers"; @@ -697,7 +683,7 @@ async getGasPrice(): Promise #### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Gas price: ${await provider.getGasPrice()}`); @@ -722,14 +708,12 @@ async getL1BatchBlockRange(l1BatchNumber: number): Promise<[number, number] | nu #### Example -Helper function: [toJSON](/sdk/js/ethers/api/v6/providers/browser-provider#tojson). - ```ts -import { Provider, types } from "zksync-ethers"; +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: ${toJSON(await provider.getL1BatchBlockRange(l1BatchNumber))}`); +console.log(`L1 batch block range: ${utils.toJSON(await provider.getL1BatchBlockRange(l1BatchNumber))}`); ``` ### `getL1BatchDetails` @@ -750,14 +734,12 @@ async getL1BatchDetails(number: number): Promise #### Example -Helper function: [toJSON](/sdk/js/ethers/api/v6/providers/browser-provider#tojson). - ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); const l1BatchNumber = await provider.getL1BatchNumber(); -console.log(`L1 batch details: ${toJSON(await provider.getL1BatchDetails(l1BatchNumber))}`); +console.log(`L1 batch details: ${utils.toJSON(await provider.getL1BatchDetails(l1BatchNumber))}`); ``` ### `getL1BatchNumber` @@ -773,7 +755,7 @@ async getL1BatchNumber(): Promise #### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`L1 batch number: ${await provider.getL1BatchNumber()}`); @@ -795,17 +777,15 @@ async getL2TransactionFromPriorityOp(l1TxResponse: ethers.TransactionResponse): #### Example -Helper function: [toJSON](/sdk/js/ethers/api/v6/providers/browser-provider#tojson). - ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); const ethProvider = ethers.getDefaultProvider("sepolia"); const l1Tx = "0xcca5411f3e514052f4a4ae1c2020badec6e0998adb52c09959c5f5ff15fba3a8"; const l1TxResponse = await ethProvider.getTransaction(l1Tx); if (l1TxResponse) { - console.log(`Tx: ${toJSON(await provider.getL2TransactionFromPriorityOp(l1TxResponse))}`); + console.log(`Tx: ${utils.toJSON(await provider.getL2TransactionFromPriorityOp(l1TxResponse))}`); } ``` @@ -828,16 +808,14 @@ async getLogProof(txHash: BytesLike, index ? : number): Promise L1 transaction can be used. // In this case, withdrawal transaction is used. const tx = "0x2a1c6c74b184965c0cb015aae9ea134fd96215d2e4f4979cfec12563295f610e"; -console.log(`Log ${toJSON(await provider.getLogProof(tx, 0))}`); +console.log(`Log ${utils.toJSON(await provider.getLogProof(tx, 0))}`); ``` ### `getLogs` @@ -856,13 +834,11 @@ async getLogs(filter: Filter | FilterByBlockHash): Promise #### Example -Helper function: [toJSON](/sdk/js/ethers/api/v6/providers/browser-provider#tojson). - ```ts import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); -console.log(`Logs: ${toJSON(await provider.getLogs({ fromBlock: 0, toBlock: 5, address: utils.L2_ETH_TOKEN_ADDRESS }))}`); +console.log(`Logs: ${utils.toJSON(await provider.getLogs({ fromBlock: 0, toBlock: 5, address: utils.L2_ETH_TOKEN_ADDRESS }))}`); ``` ### `getMainContractAddress` @@ -878,7 +854,7 @@ async getMainContractAddress(): Promise
#### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Main contract: ${await provider.getMainContractAddress()}`); @@ -906,8 +882,6 @@ async getPriorityOpConfirmation(txHash: string, index: number = 0): Promise<{ #### Example -Helper function: [toJSON](/sdk/js/ethers/api/v6/providers/browser-provider#tojson). - ```ts import { Provider, types, utils } from "zksync-ethers"; @@ -935,17 +909,15 @@ async getPriorityOpResponse(l1TxResponse: ethers.TransactionResponse): Promise

#### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Protocol version: ${await provider.getProtocolVersion()}`); @@ -1043,13 +1013,11 @@ async getRawBlockTransactions(number: number): Promise #### Example -Helper function: [toJSON](/sdk/js/ethers/api/v6/providers/browser-provider#tojson). - ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); -console.log(`Raw block transactions: ${toJSON(await provider.getRawBlockTransactions(90_000))}`); +console.log(`Raw block transactions: ${utils.toJSON(await provider.getRawBlockTransactions(90_000))}`); ``` ### `getTestnetPaymasterAddress` @@ -1064,7 +1032,7 @@ async getTestnetPaymasterAddress(): Promise

#### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Testnet paymaster: ${await provider.getTestnetPaymasterAddress()}`); @@ -1088,7 +1056,7 @@ async getTransaction(txHash: string): Promise #### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); @@ -1120,15 +1088,13 @@ async getTransactionDetails(txHash: BytesLike): Promise #### Example -Helper function: [toJSON](/sdk/js/ethers/api/v6/providers/browser-provider#tojson). - ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); const TX_HASH = ""; -console.log(`Transaction details: ${toJSON(await provider.getTransactionDetails(TX_HASH))}`); +console.log(`Transaction details: ${utils.toJSON(await provider.getTransactionDetails(TX_HASH))}`); ``` ### `getTransactionReceipt` @@ -1149,14 +1115,12 @@ async getTransactionReceipt(txHash: string): Promise #### Example -Helper function: [toJSON](/sdk/js/ethers/api/v6/providers/browser-provider#tojson). - ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); const TX_HASH = ""; -console.log(`Transaction receipt: ${toJSON(await provider.getTransactionReceipt(TX_HASH))}`); +console.log(`Transaction receipt: ${utils.toJSON(await provider.getTransactionReceipt(TX_HASH))}`); ``` ### `getTransactionStatus` @@ -1175,15 +1139,13 @@ async getTransactionStatus(txHash: string): Promise #### Example -Helper function: [toJSON](/sdk/js/ethers/api/v6/providers/browser-provider#tojson). - ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); const TX_HASH = ""; -console.log(`Transaction status: ${toJSON(await provider.getTransactionStatus(TX_HASH))}`); +console.log(`Transaction status: ${utils.toJSON(await provider.getTransactionStatus(TX_HASH))}`); ``` ### `getTransferTx` @@ -1341,7 +1303,7 @@ async isBaseToken(token: Address): Promise #### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Is base token: ${await provider.isBaseToken("0x5C221E77624690fff6dd741493D735a17716c26B")}`); @@ -1358,7 +1320,7 @@ async isEthBasedChain(): Promise #### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`Is ETH based chain: ${await provider.isEthBasedChain()}`); @@ -1377,7 +1339,7 @@ async l1ChainId(): Promise #### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`L1 chain ID: ${await provider.l1ChainId()}`); @@ -1404,7 +1366,7 @@ async l1TokenAddress(token: Address): Promise #### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`L1 token address: ${await provider.l1TokenAddress("0x3e7676937A7E96CFB7616f255b9AD9FF47363D4b")}`); @@ -1432,7 +1394,7 @@ async l2TokenAddress(token: Address): Promise #### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`L2 token address: ${await provider.l2TokenAddress("0x5C221E77624690fff6dd741493D735a17716c26B")}`); @@ -1449,7 +1411,7 @@ async newBlockFilter(): Promise #### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`New block filter: ${await provider.newBlockFilter()}`); @@ -1499,7 +1461,7 @@ async newPendingTransactionsFilter(): Promise #### Example ```ts -import { Provider, types } from "zksync-ethers"; +import { Provider, types, utils } from "zksync-ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); console.log(`New pending transaction filter: ${await provider.newPendingTransactionsFilter()}`); @@ -1532,8 +1494,6 @@ async sendRawTransactionWithDetailedOutput(signedTx: string): Promise { - if (typeof value === "bigint") { - return value.toString(); // Convert BigInt to string - } - return value; - }); -} -``` diff --git a/content/sdk/10.js/00.ethers/05.api/20.v6/01.accounts/01.wallet.md b/content/sdk/10.js/00.ethers/05.api/20.v6/01.accounts/01.wallet.md index f7883bca..65145015 100644 --- a/content/sdk/10.js/00.ethers/05.api/20.v6/01.accounts/01.wallet.md +++ b/content/sdk/10.js/00.ethers/05.api/20.v6/01.accounts/01.wallet.md @@ -1830,8 +1830,6 @@ async getPriorityOpConfirmation(txHash: string, index: number = 0): Promise<{ #### Example -Helper function: [toJSON](/sdk/js/ethers/api/v6/providers/browser-provider#tojson). - ```ts import { Wallet, Provider, types, utils } from "zksync-ethers"; import { ethers } from "ethers"; diff --git a/content/sdk/10.js/00.ethers/05.api/20.v6/01.accounts/03.l1signer.md b/content/sdk/10.js/00.ethers/05.api/20.v6/01.accounts/03.l1signer.md index 28352263..ed5173d0 100644 --- a/content/sdk/10.js/00.ethers/05.api/20.v6/01.accounts/03.l1signer.md +++ b/content/sdk/10.js/00.ethers/05.api/20.v6/01.accounts/03.l1signer.md @@ -10,7 +10,7 @@ This class extends `ethers.JsonRpcSigner` and so supports all the methods availa The easiest way to construct it is from an `BrowserProvider` object. ```ts -import { Provider, L1Signer, types } from "zksync-ethers"; +import { Provider, L1Signer, types, utils } from "zksync-ethers"; import { ethers } from "ethers"; const provider = new ethers.BrowserProvider(window.ethereum); @@ -1084,8 +1084,6 @@ async getPriorityOpConfirmation(txHash: string, index: number = 0): Promise<{ #### Example -Helper function: [toJSON](/sdk/js/ethers/api/v6/providers/browser-provider#tojson). - ```ts import { Provider, L1Signer, types } from "zksync-ethers"; import { ethers } from "ethers";