From b1bbaa7d560191cbac14920d18d4cbfb14cfdf80 Mon Sep 17 00:00:00 2001 From: Dan Forbes Date: Thu, 12 Sep 2024 14:12:32 -0400 Subject: [PATCH] fix(web3js-plugin): update-custom-data --- content/10.js/01.web3js/05.custom-data.md | 14 +++++++------- content/10.js/01.web3js/06.paymasters.md | 12 ++++++------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/content/10.js/01.web3js/05.custom-data.md b/content/10.js/01.web3js/05.custom-data.md index 306c84d..f2181cd 100644 --- a/content/10.js/01.web3js/05.custom-data.md +++ b/content/10.js/01.web3js/05.custom-data.md @@ -14,18 +14,18 @@ ZKsync-specific parameters: ## Add custom data to a transaction -Any transaction made to the ZKsync Era network with the Web3.js plugin for ZKsync can include the above ZKsync-specific +Transactions made to the ZKsync Era network with the Web3.js plugin for ZKsync can include the above ZKsync-specific parameters by specifying a `customData` property of the [type `Eip712Meta`](https://chainsafe.github.io/web3-plugin-zksync/types/types.Eip712Meta.html). -The following code snippet demonstrates specifying the `gasPerpPubdata` parameter for a [deposit transaction](/js/web3js/wallet#deposit): +The following code snippet demonstrates specifying the `gasPerPubdata` parameter: ```ts -const tx: types.PriorityOpResponse = await wallet.deposit({ - token: "", +const transactionRequest: types.TransactionRequest = { to: "", - amount: 2_000_000_000n, - refundRecipient: wallet.getAddress(), + value: 1, customData: { gasPerPubdata: 50_000, }, -}); +}; +const response: types.PriorityOpResponse = + await wallet.signAndSend(transactionRequest); ``` diff --git a/content/10.js/01.web3js/06.paymasters.md b/content/10.js/01.web3js/06.paymasters.md index 1417459..c2b0fa4 100644 --- a/content/10.js/01.web3js/06.paymasters.md +++ b/content/10.js/01.web3js/06.paymasters.md @@ -19,14 +19,12 @@ which expects two parameters: the address of the paymaster account and an object or the [`GeneralPaymasterInput` interface](https://chainsafe.github.io/web3-plugin-zksync/interfaces/types.GeneralPaymasterInput.html) (for [general paymaster flows](https://docs.zksync.io/build/developer-reference/account-abstraction/paymasters#general-paymaster-flow)). -The following code snippet demonstrates using an approval-based paymaster to cover the fees of a [deposit transaction](/js/web3js/wallet#deposit): +The following code snippet demonstrates using an approval-based paymaster to cover the fees of a transaction: ```ts -const tx: types.PriorityOpResponse = await wallet.deposit({ - token: "", +const transactionRequest: types.TransactionRequest = { to: "", - amount: 2_000_000_000n, - refundRecipient: wallet.getAddress(), + value: 1, customData: { paymasterParams: getPaymasterParams("", { innerInput: new Uint8Array(), @@ -35,5 +33,7 @@ const tx: types.PriorityOpResponse = await wallet.deposit({ type: "ApprovalBased", }), }, -}); +}; +const response: types.PriorityOpResponse = + await wallet.signAndSend(transactionRequest); ```