Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS SDK: Bump version to v6.4.0 #20

Merged
merged 3 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:
branches: [main]
types: [ opened, reopened, synchronize ]
paths: [go]
paths: [ "go/**" ]

permissions:
contents: read # for checkout
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/js.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Run tests JS
name: JS
on:
workflow_dispatch:
pull_request:
branches: [main]
types: [ opened, reopened, synchronize ]
paths: [js]
paths: [ "js/**" ]

permissions:
contents: read # for checkout
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.idea
.idea
.vscode
6 changes: 4 additions & 2 deletions js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
"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"
Expand Down
21 changes: 19 additions & 2 deletions js/src/12_deploy_create.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
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;
Expand All @@ -20,6 +23,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()
Expand Down
19 changes: 18 additions & 1 deletion js/src/15_deploy_create2.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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()
Expand Down
8 changes: 4 additions & 4 deletions js/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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==