From a958d63b72117c2f1528596b10b9c5f1a37d0533 Mon Sep 17 00:00:00 2001 From: danijelTxFusion Date: Thu, 29 Feb 2024 20:16:31 +0100 Subject: [PATCH] fix(js): bump version to `v6.4.0` --- .gitignore | 3 ++- js/package.json | 7 +++++-- js/src/12_deploy_create.ts | 22 ++++++++++++++++++++-- js/src/15_deploy_create2.ts | 19 ++++++++++++++++++- js/yarn.lock | 8 ++++---- 5 files changed, 49 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 723ef36..d48c759 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -.idea \ No newline at end of file +.idea +.vscode \ No newline at end of file diff --git a/js/package.json b/js/package.json index 1ea9653..40843bd 100644 --- a/js/package.json +++ b/js/package.json @@ -12,9 +12,12 @@ "mocha": "^10.2.0", "prettier": "3.0.3", "ts-node": "^10.9.1", - "typescript": "^5.1.6", - "zksync-ethers": "6.3.0" + "typescript": "^5.1.6" }, + "dependencies": { + "zksync-ethers": "^6.4.0" + }, + "peerDependencies": { "ethers": "^6.7.1" }, diff --git a/js/src/12_deploy_create.ts b/js/src/12_deploy_create.ts index a8dd99b..eeb272e 100644 --- a/js/src/12_deploy_create.ts +++ b/js/src/12_deploy_create.ts @@ -1,10 +1,14 @@ -import { Provider, types, Wallet, ContractFactory, Contract } from "zksync-ethers"; -import { ethers, Typed } from "ethers"; +import {Provider, types, Wallet, ContractFactory, Contract, utils} from "zksync-ethers"; +import { Typed } from "ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); const PRIVATE_KEY = process.env.PRIVATE_KEY; const wallet = new Wallet(PRIVATE_KEY, provider); +const tokenAddress = "0x927488F48ffbc32112F1fF721759649A89721F8F"; // Crown token which can be minted for free +const paymasterAddress = "0x13D0D8550769f59aa241a41897D4859c87f7Dd46"; // Paymaster for Crown token + + async function main() { const conf = require("../../solidity/storage/build/combined.json"); const abi = conf.contracts["Storage.sol:Storage"].abi; @@ -20,6 +24,20 @@ async function main() { await tx.wait(); console.log(`Value: ${await storage.get()}`); + + const paymasterTx = await storage.set(Typed.uint256(500), { + customData: { + gasPerPubdata: utils.DEFAULT_GAS_PER_PUBDATA_LIMIT, + paymasterParams: utils.getPaymasterParams(paymasterAddress, { + type: "ApprovalBased", + token: tokenAddress, + minimalAllowance: 1, + innerInput: new Uint8Array(), + }), + } + }) + await paymasterTx.wait(); + console.log(`Value: ${await storage.get()}`); } main() diff --git a/js/src/15_deploy_create2.ts b/js/src/15_deploy_create2.ts index 4f5a84b..29e6eb9 100644 --- a/js/src/15_deploy_create2.ts +++ b/js/src/15_deploy_create2.ts @@ -1,10 +1,13 @@ -import { Provider, types, Wallet, ContractFactory, Contract } from "zksync-ethers"; +import { Provider, types, Wallet, ContractFactory, Contract, utils } from "zksync-ethers"; import { ethers, Typed } from "ethers"; const provider = Provider.getDefaultProvider(types.Network.Sepolia); const PRIVATE_KEY = process.env.PRIVATE_KEY; const wallet = new Wallet(PRIVATE_KEY, provider); +const tokenAddress = "0x927488F48ffbc32112F1fF721759649A89721F8F"; // Crown token which can be minted for free +const paymasterAddress = "0x13D0D8550769f59aa241a41897D4859c87f7Dd46"; // Paymaster for Crown token + async function main() { const conf = require("../../solidity/storage/build/combined.json"); const abi = conf.contracts["Storage.sol:Storage"].abi; @@ -22,6 +25,20 @@ async function main() { await tx.wait(); console.log(`Value: ${await storage.get()}`); + + const paymasterTx = await storage.set(Typed.uint256(500), { + customData: { + gasPerPubdata: utils.DEFAULT_GAS_PER_PUBDATA_LIMIT, + paymasterParams: utils.getPaymasterParams(paymasterAddress, { + type: "ApprovalBased", + token: tokenAddress, + minimalAllowance: 1, + innerInput: new Uint8Array(), + }), + } + }) + await paymasterTx.wait(); + console.log(`Value: ${await storage.get()}`); } main() diff --git a/js/yarn.lock b/js/yarn.lock index 3af0b56..9741e24 100644 --- a/js/yarn.lock +++ b/js/yarn.lock @@ -972,7 +972,7 @@ yocto-queue@^0.1.0: resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== -zksync-ethers@6.3.0: - version "6.3.0" - resolved "https://registry.yarnpkg.com/zksync-ethers/-/zksync-ethers-6.3.0.tgz#604c57250974ccad121510a2c84c1dd8b990722f" - integrity sha512-ApQIJSFevxFNVQTO1MxkmXxmx9N0qZHNvMzjFvu5v40QPFGkpUt09pY/WHy3b5BlsXzybQ3q2YnHaz/c/TgilA== +zksync-ethers@^6.4.0: + version "6.4.0" + resolved "https://registry.yarnpkg.com/zksync-ethers/-/zksync-ethers-6.4.0.tgz#2abb1000e15524dff4d7dbc3757bd470f8c611e2" + integrity sha512-/0JSJ9w71kGqkcnAg2eY3xD+WX4o9Pf5OwrM1cHvmy1QEzyHWAHBfhTLMJcTMoW0S9bkrF5YHACY/3LAZrkcig==