diff --git a/js/README.md b/js/README.md index 47f54cf..4de95e2 100644 --- a/js/README.md +++ b/js/README.md @@ -1,10 +1,10 @@ # zkSync Era JavaScript Examples -Examples are made to demonstrate how [zksync-ethers](https://github.com/zksync-sdk/zksync-ethers) +Examples are made to demonstrate how [zksync-ethers](https://github.com/zksync-sdk/zksync-ethers) SDK can be used for development. The examples demonstrate how to: 1. Deposit ETH from Ethereum to zkSync Era. -2. Transfer ETH on zkSync Era. +2. Transfer ETH on zkSync Era. 3. Withdraw ETH from zkSync Era to Ethereum. 4. Deploy a smart contract using create opcode. 5. Deploy a smart contract with constructor using create opcode. @@ -21,7 +21,7 @@ SDK can be used for development. The examples demonstrate how to: 16. Use paymaster to pay fee with token. Smart contract deployment use already generated bytecodes and ABIs and go bindings. -There is a [user guide](../solidity/README.md) on how those artifacts +There is a [user guide](../solidity/README.md) on how those artifacts are generated. Same approach can be used to generate required artifact for other smart contracts. @@ -29,4 +29,4 @@ for other smart contracts. ```shell yarn install -``` \ No newline at end of file +``` diff --git a/js/tests/contract_factory.test.ts b/js/tests/contract_factory.test.ts index dc3902a..ea80fe7 100644 --- a/js/tests/contract_factory.test.ts +++ b/js/tests/contract_factory.test.ts @@ -1,11 +1,10 @@ import * as chai from "chai"; import "./custom-matchers"; import { Provider, types, ContractFactory, Wallet, Contract } from "zksync-ethers"; -import {ethers, Typed} from "ethers"; +import { ethers, Typed } from "ethers"; const { expect } = chai; - describe("ContractFactory", () => { const PRIVATE_KEY = "0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110"; @@ -21,7 +20,7 @@ describe("ContractFactory", () => { const bytecode: string = conf.contracts["Storage.sol:Storage"].bin; const factory = new ContractFactory(abi, bytecode, wallet); - const storage = await factory.deploy() as Contract; + const storage = (await factory.deploy()) as Contract; const code = await provider.getCode(await storage.getAddress()); expect(code).not.to.be.null; @@ -42,7 +41,7 @@ describe("ContractFactory", () => { const bytecode: string = conf.contracts["Incrementer.sol:Incrementer"].bin; const factory = new ContractFactory(abi, bytecode, wallet); - const incrementer = await factory.deploy(2) as Contract; + const incrementer = (await factory.deploy(2)) as Contract; const code = await provider.getCode(await incrementer.getAddress()); expect(code).not.to.be.null; @@ -92,12 +91,7 @@ describe("ContractFactory", () => { const abi = conf.abi; const bytecode: string = conf.bytecode; - const accountFactory = new ContractFactory( - abi, - bytecode, - wallet, - "createAccount", - ); + const accountFactory = new ContractFactory(abi, bytecode, wallet, "createAccount"); const paymasterContract = await accountFactory.deploy(await provider.l2TokenAddress(l1DAI)); const code = await provider.getCode(await paymasterContract.getAddress()); @@ -190,16 +184,10 @@ describe("ContractFactory", () => { const abi = conf.abi; const bytecode: string = conf.bytecode; - const factory = new ContractFactory( - abi, - bytecode, - wallet, - "create2Account", - ); - const account = await factory.deploy( - await provider.l2TokenAddress(l1DAI), - { customData: { salt: ethers.hexlify(ethers.randomBytes(32)) } }, - ); + const factory = new ContractFactory(abi, bytecode, wallet, "create2Account"); + const account = await factory.deploy(await provider.l2TokenAddress(l1DAI), { + customData: { salt: ethers.hexlify(ethers.randomBytes(32)) }, + }); const code = await provider.getCode(await account.getAddress()); expect(code).not.to.be.null; diff --git a/js/tests/paymaster.test.ts b/js/tests/paymaster.test.ts index 283c2a9..849c9aa 100644 --- a/js/tests/paymaster.test.ts +++ b/js/tests/paymaster.test.ts @@ -1,9 +1,9 @@ import * as chai from "chai"; import "./custom-matchers"; -import {ContractFactory, Provider, types, utils, Wallet} from "zksync-ethers"; -import {Contract, ethers, Typed} from "ethers"; +import { ContractFactory, Provider, types, utils, Wallet } from "zksync-ethers"; +import { Contract, ethers, Typed } from "ethers"; -const {expect} = chai; +const { expect } = chai; describe("Paymaster", () => { const PRIVATE_KEY = "0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110"; @@ -95,7 +95,7 @@ describe("Paymaster", () => { expect(walletBalanceBeforeTx - walletBalanceAfterTx >= BigInt(0)).to.be.true; expect( walletTokenBalanceAfterTx == - walletTokenBalanceBeforeTx - BigInt(MINIMAL_ALLOWANCE) + BigInt(MINT_AMOUNT), + walletTokenBalanceBeforeTx - BigInt(MINIMAL_ALLOWANCE) + BigInt(MINT_AMOUNT), ).to.be.true; }).timeout(30_000); });