From 36675b0beb54c1d54f3c69f8cdee20d1e8a72560 Mon Sep 17 00:00:00 2001 From: amelnytskyi Date: Fri, 23 Feb 2024 19:47:45 +0200 Subject: [PATCH 01/28] test: covering UI tests for Deposit --- packages/integration-tests/src/entities.ts | 2 + .../scenarios/deposit/depositERC20.ts | 8 +-- .../playbook/scenarios/deposit/depositETH.ts | 12 +++-- .../tests/ui/deposit.spec.ts | 52 +++++++++++++++++++ 4 files changed, 65 insertions(+), 9 deletions(-) create mode 100644 packages/integration-tests/tests/ui/deposit.spec.ts diff --git a/packages/integration-tests/src/entities.ts b/packages/integration-tests/src/entities.ts index 5c1879e5b1..f5008ddbf5 100644 --- a/packages/integration-tests/src/entities.ts +++ b/packages/integration-tests/src/entities.ts @@ -30,6 +30,8 @@ export enum Buffer { emptyWalletAddress = "./buffer/emptyWalletAddress.txt", failedState = "./buffer/failedState.txt", customToken = "./buffer/customToken.txt", + txEthDeposit = "./buffer/txEthDeposit.txt", + txERC20Deposit = "./buffer/txERC20Deposit.txt", } export enum Logger { diff --git a/packages/integration-tests/src/playbook/scenarios/deposit/depositERC20.ts b/packages/integration-tests/src/playbook/scenarios/deposit/depositERC20.ts index f18724a450..7d4338a61f 100644 --- a/packages/integration-tests/src/playbook/scenarios/deposit/depositERC20.ts +++ b/packages/integration-tests/src/playbook/scenarios/deposit/depositERC20.ts @@ -12,6 +12,7 @@ const ethProvider = ethers.getDefaultProvider(localConfig.L1Network); const syncWallet = new zksync.Wallet(localConfig.privateKey, syncProvider, ethProvider); const playbookRoot = "src/playbook"; const bufferFile = playbookRoot + "/" + Buffer.L2deposited; +const bufferDepositErc20File = playbookRoot + "/" + Buffer.txERC20Deposit; export const depositERC20 = async function (sum = "0.5", tokenAddress: string, units = 18) { const deposit = await syncWallet.deposit({ @@ -23,15 +24,14 @@ export const depositERC20 = async function (sum = "0.5", tokenAddress: string, u overrides: localConfig.gasLimit, }); - const txHash = deposit.hash; - await deposit.wait(1); - await deposit.waitL1Commit(1); const l2TokenAddress = await syncProvider.l2TokenAddress(tokenAddress); console.log("L2 token address ", l2TokenAddress); await fs.writeFile(bufferFile, l2TokenAddress); - await helper.txHashLogger(Logger.deposit, txHash, "ERC20 token"); + const txHash = await deposit.waitFinalize(); + await helper.txHashLogger(Logger.deposit, txHash.transactionHash, "ERC20 token"); + await fs.writeFile(bufferDepositErc20File, txHash.transactionHash); return txHash; }; diff --git a/packages/integration-tests/src/playbook/scenarios/deposit/depositETH.ts b/packages/integration-tests/src/playbook/scenarios/deposit/depositETH.ts index e35e6b6259..f15e27b30b 100644 --- a/packages/integration-tests/src/playbook/scenarios/deposit/depositETH.ts +++ b/packages/integration-tests/src/playbook/scenarios/deposit/depositETH.ts @@ -1,8 +1,9 @@ import * as ethers from "ethers"; +import { promises as fs } from "fs"; import * as zksync from "zksync-web3"; import { localConfig } from "../../../config"; -import { Logger } from "../../../entities"; +import { Buffer, Logger } from "../../../entities"; import { Helper } from "../../../helper"; export const depositEth = async function (sum = "0.000009") { @@ -10,17 +11,18 @@ export const depositEth = async function (sum = "0.000009") { const syncProvider = new zksync.Provider(localConfig.L2Network); const ethProvider = ethers.getDefaultProvider(localConfig.L1Network); const syncWallet = new zksync.Wallet(localConfig.privateKey, syncProvider, ethProvider); + const playbookRoot = "src/playbook/"; + const bufferFile = playbookRoot + Buffer.txEthDeposit; const deposit = await syncWallet.deposit({ token: zksync.utils.ETH_ADDRESS, amount: ethers.utils.parseEther(sum), l2GasLimit: localConfig.l2GasLimit, }); - - const txHash = deposit.hash; - await deposit.wait(1); - await helper.txHashLogger(Logger.deposit, txHash, "ETH"); + const txHash = await deposit.waitFinalize(); + await helper.txHashLogger(Logger.deposit, txHash.transactionHash, "ETH"); + await fs.writeFile(bufferFile, txHash.transactionHash); return txHash; }; diff --git a/packages/integration-tests/tests/ui/deposit.spec.ts b/packages/integration-tests/tests/ui/deposit.spec.ts new file mode 100644 index 0000000000..1663c0cc07 --- /dev/null +++ b/packages/integration-tests/tests/ui/deposit.spec.ts @@ -0,0 +1,52 @@ +import { expect, test } from "@playwright/test"; + +import { config } from "./config"; +import { BlockExplorer, Buffer, Wallets } from "../../src/entities"; +import { Helper } from "../../src/helper"; + +const bufferRoute = "src/playbook/"; +const helper = new Helper(); +let url: string; +let bufferFile; +let depositTxHash: string; +let fromAddress: string; + +//@id1660 +test("Check Deposit ETH transaction on BE", async ({ page }) => { + bufferFile = bufferRoute + Buffer.txEthDeposit; + depositTxHash = await helper.getStringFromFile(bufferFile); + url = BlockExplorer.baseUrl + `/tx/${depositTxHash}` + BlockExplorer.localNetwork; + fromAddress = Wallets.richWalletAddress; + console.log(url); + + await page.goto(url); + + const hash = await page.locator(`//*[text()="Transaction Hash"]/..//..//*[text()="${depositTxHash}"]`).first(); + const fromAddressElement = await page.locator(`text=${fromAddress}`).first(); + const ethValue = await page.locator(`text=0.0000001`).first(); + + await expect(hash).toBeVisible(config.extraTimeout); + await expect(ethValue).toBeVisible(config.extraTimeout); + await expect(fromAddressElement).toBeVisible(config.extraTimeout); +}); + +//@id1681 +test("Check on BE Deposit the custom ERC-20 token", async ({ page }) => { + bufferFile = bufferRoute + Buffer.txERC20Deposit; + depositTxHash = await helper.getStringFromFile(bufferFile); + url = BlockExplorer.baseUrl + `/tx/${depositTxHash}` + BlockExplorer.localNetwork; + fromAddress = Wallets.richWalletAddress; + console.log(url); + + await page.goto(url); + + const hash = await page.locator(`//*[text()="Transaction Hash"]/..//..//*[text()="${depositTxHash}"]`).first(); + const fromAddressElement = await page.locator( + `//*[text()="From"]/..//*[text()="L1"]/..//*[text()="0x36615Cf349d...c049"]` + ); + const erc20Value = await page.locator(`//*[text()="0x36615Cf349d...c049"]/..//..//*[text()="100"]`); + + await expect(hash).toBeVisible(config.extraTimeout); + await expect(erc20Value).toBeVisible(config.extraTimeout); + await expect(fromAddressElement).toBeVisible(config.extraTimeout); +}); From a640ca93ba98d05b8cd578ff9576b1b35b7fb22a Mon Sep 17 00:00:00 2001 From: Artem Melnytskyi <112873874+amelnytskyi@users.noreply.github.com> Date: Tue, 27 Feb 2024 18:26:39 +0200 Subject: [PATCH 02/28] test: refactor and actualise Transactions tests (#182) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # What ❔ Added coverage for all 0 items in responses for Transaction endpoints ## Why ❔ ## Checklist - [x] PR title corresponds to the body of PR (we generate changelog entries from PRs). - [x] Tests for the changes have been added / updated. - [ ] Documentation comments have been added / updated. --- .../tests/api/transactions.test.ts | 523 +++++++++++++++++- 1 file changed, 522 insertions(+), 1 deletion(-) diff --git a/packages/integration-tests/tests/api/transactions.test.ts b/packages/integration-tests/tests/api/transactions.test.ts index cdf0d08f96..7510bceddd 100644 --- a/packages/integration-tests/tests/api/transactions.test.ts +++ b/packages/integration-tests/tests/api/transactions.test.ts @@ -42,6 +42,33 @@ describe("Transactions", () => { response = await helper.performGETrequest(apiRoute); expect(response.status).toBe(200); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_PULL_Address })); + expect(typeof response.body.items[0].blockNumber).toStrictEqual("number"); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); + expect(typeof response.body.items[0].timestamp).toStrictEqual("string"); + expect(typeof response.body.items[0].amount).toStrictEqual("string"); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) + ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: "fee" })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenType: "ETH" })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ isInternal: false })); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ + token: { + decimals: 18, + iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", + l1Address: Token.ETHER_Address, + l2Address: Token.ETHER_ERC20_Address, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); expect(response.body.items[1].from).toBe(Wallets.richWalletAddress); expect(response.body.items[1].to).toBe(Wallets.mainWalletAddress); expect(response.body.items[1].transactionHash).toBe(txHash); @@ -62,6 +89,29 @@ describe("Transactions", () => { expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_PULL_Address })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: "fee" })); + expect(typeof response.body.items[0].blockNumber).toStrictEqual("number"); + expect(typeof response.body.items[0].timestamp).toStrictEqual("string"); + expect(typeof response.body.items[0].amount).toStrictEqual("string"); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) + ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenType: "ETH" })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ isInternal: false })); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ + token: { + decimals: 18, + iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", + l1Address: Token.ETHER_Address, + l2Address: Token.ETHER_ERC20_Address, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_ERC20_Address })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); @@ -91,6 +141,29 @@ describe("Transactions", () => { expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_PULL_Address })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: "fee" })); + expect(typeof response.body.items[0].blockNumber).toStrictEqual("number"); + expect(typeof response.body.items[0].timestamp).toStrictEqual("string"); + expect(typeof response.body.items[0].amount).toStrictEqual("string"); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) + ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenType: "ETH" })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ isInternal: false })); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ + token: { + decimals: 18, + iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", + l1Address: Token.ETHER_Address, + l2Address: Token.ETHER_ERC20_Address, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_ERC20_Address })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); @@ -263,6 +336,37 @@ describe("Transactions", () => { expect(response.body.to).toBe("0x000000000000000000000000000000000000800A"); expect(response.body.from).toBe(Wallets.richWalletAddress); expect(response.body.value).toBe("9000000000000"); + expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); + expect(typeof response.body.fee).toStrictEqual("string"); + expect(typeof response.body.nonce).toStrictEqual("number"); + expect(typeof response.body.data).toStrictEqual("string"); + expect(typeof response.body.gasLimit).toStrictEqual("string"); + expect(typeof response.body.gasPrice).toStrictEqual("string"); + expect(typeof response.body.gasPerPubdata).toStrictEqual("string"); + expect(typeof response.body.maxFeePerGas).toStrictEqual("string"); + expect(typeof response.body.maxPriorityFeePerGas).toStrictEqual("string"); + expect(typeof response.body.blockNumber).toStrictEqual("number"); + expect(response.body.blockNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.l1BatchNumber).toStrictEqual("number"); + expect(response.body.l1BatchNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.blockHash).toStrictEqual("string"); + expect(response.body.blockHash.length).toBe(66); + expect(typeof response.body.type).toStrictEqual("number"); + expect(response.body.type).toBeGreaterThanOrEqual(0); + expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); + expect(typeof response.body.receivedAt).toStrictEqual("string"); + expect(response.body.receivedAt.length).toBe(24); + expect(response.body).toStrictEqual(expect.objectContaining({ error: null })); + expect(response.body).toStrictEqual(expect.objectContaining({ revertReason: null })); + expect(typeof response.body.status).toStrictEqual("string"); + expect(typeof response.body.commitTxHash).toStrictEqual("string"); + expect(response.body.commitTxHash.length).toBe(66); + expect(typeof response.body.executeTxHash).toStrictEqual("string"); + expect(response.body.executeTxHash.length).toBe(66); + expect(typeof response.body.proveTxHash).toStrictEqual("string"); + expect(response.body.proveTxHash.length).toBe(66); + expect(typeof response.body.isL1BatchSealed).toStrictEqual("boolean"); + expect(typeof response.body.gasUsed).toStrictEqual("string"); }); }); @@ -276,6 +380,39 @@ describe("Transactions", () => { expect(response.status).toBe(200); expect(response.body.hash).toBe(txHash); expect(response.body.from).toBe(Wallets.richWalletAddress); + expect(typeof response.body.to).toStrictEqual("string"); + expect(response.body.value).toBe("0"); + expect(typeof response.body.data).toStrictEqual("string"); + expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); + expect(typeof response.body.fee).toStrictEqual("string"); + expect(typeof response.body.nonce).toStrictEqual("number"); + expect(typeof response.body.gasLimit).toStrictEqual("string"); + expect(typeof response.body.gasPrice).toStrictEqual("string"); + expect(typeof response.body.gasPerPubdata).toStrictEqual("string"); + expect(typeof response.body.maxFeePerGas).toStrictEqual("string"); + expect(typeof response.body.maxPriorityFeePerGas).toStrictEqual("string"); + expect(typeof response.body.blockNumber).toStrictEqual("number"); + expect(response.body.blockNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.l1BatchNumber).toStrictEqual("number"); + expect(response.body.l1BatchNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.blockHash).toStrictEqual("string"); + expect(response.body.blockHash.length).toBe(66); + expect(typeof response.body.type).toStrictEqual("number"); + expect(response.body.type).toBeGreaterThanOrEqual(0); + expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); + expect(typeof response.body.receivedAt).toStrictEqual("string"); + expect(response.body.receivedAt.length).toBe(24); + expect(response.body).toStrictEqual(expect.objectContaining({ error: null })); + expect(response.body).toStrictEqual(expect.objectContaining({ revertReason: null })); + expect(typeof response.body.status).toStrictEqual("string"); + expect(typeof response.body.commitTxHash).toStrictEqual("string"); + expect(response.body.commitTxHash.length).toBe(66); + expect(typeof response.body.executeTxHash).toStrictEqual("string"); + expect(response.body.executeTxHash.length).toBe(66); + expect(typeof response.body.proveTxHash).toStrictEqual("string"); + expect(response.body.proveTxHash.length).toBe(66); + expect(typeof response.body.isL1BatchSealed).toStrictEqual("boolean"); + expect(typeof response.body.gasUsed).toStrictEqual("string"); }); }); @@ -291,6 +428,37 @@ describe("Transactions", () => { expect(response.body.to).toBe("0x000000000000000000000000000000000000800A"); expect(response.body.from).toBe(Wallets.richWalletAddress); expect(response.body.value).toBe("9000000000000"); + expect(typeof response.body.data).toStrictEqual("string"); + expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); + expect(typeof response.body.fee).toStrictEqual("string"); + expect(typeof response.body.nonce).toStrictEqual("number"); + expect(typeof response.body.gasLimit).toStrictEqual("string"); + expect(typeof response.body.gasPrice).toStrictEqual("string"); + expect(typeof response.body.gasPerPubdata).toStrictEqual("string"); + expect(typeof response.body.maxFeePerGas).toStrictEqual("string"); + expect(typeof response.body.maxPriorityFeePerGas).toStrictEqual("string"); + expect(typeof response.body.blockNumber).toStrictEqual("number"); + expect(response.body.blockNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.l1BatchNumber).toStrictEqual("number"); + expect(response.body.l1BatchNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.blockHash).toStrictEqual("string"); + expect(response.body.blockHash.length).toBe(66); + expect(typeof response.body.type).toStrictEqual("number"); + expect(response.body.type).toBeGreaterThanOrEqual(0); + expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); + expect(typeof response.body.receivedAt).toStrictEqual("string"); + expect(response.body.receivedAt.length).toBe(24); + expect(response.body).toStrictEqual(expect.objectContaining({ error: null })); + expect(response.body).toStrictEqual(expect.objectContaining({ revertReason: null })); + expect(typeof response.body.status).toStrictEqual("string"); + expect(typeof response.body.commitTxHash).toStrictEqual("string"); + expect(response.body.commitTxHash.length).toBe(66); + expect(typeof response.body.executeTxHash).toStrictEqual("string"); + expect(response.body.executeTxHash.length).toBe(66); + expect(typeof response.body.proveTxHash).toStrictEqual("string"); + expect(response.body.proveTxHash.length).toBe(66); + expect(typeof response.body.isL1BatchSealed).toStrictEqual("boolean"); + expect(typeof response.body.gasUsed).toStrictEqual("string"); }); }); @@ -307,6 +475,37 @@ describe("Transactions", () => { expect(response.body).toStrictEqual(expect.objectContaining({ to: contract })); expect(response.body).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); + expect(response.body.value).toBe("101000000000000000"); + expect(typeof response.body.data).toStrictEqual("string"); + expect(typeof response.body.fee).toStrictEqual("string"); + expect(typeof response.body.nonce).toStrictEqual("number"); + expect(typeof response.body.gasLimit).toStrictEqual("string"); + expect(typeof response.body.gasPrice).toStrictEqual("string"); + expect(typeof response.body.gasPerPubdata).toStrictEqual("string"); + expect(typeof response.body.maxFeePerGas).toStrictEqual("string"); + expect(typeof response.body.maxPriorityFeePerGas).toStrictEqual("string"); + expect(typeof response.body.blockNumber).toStrictEqual("number"); + expect(response.body.blockNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.l1BatchNumber).toStrictEqual("number"); + expect(response.body.l1BatchNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.blockHash).toStrictEqual("string"); + expect(response.body.blockHash.length).toBe(66); + expect(typeof response.body.type).toStrictEqual("number"); + expect(response.body.type).toBeGreaterThanOrEqual(0); + expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); + expect(typeof response.body.receivedAt).toStrictEqual("string"); + expect(response.body.receivedAt.length).toBe(24); + expect(response.body).toStrictEqual(expect.objectContaining({ error: null })); + expect(response.body).toStrictEqual(expect.objectContaining({ revertReason: null })); + expect(typeof response.body.status).toStrictEqual("string"); + expect(typeof response.body.commitTxHash).toStrictEqual("string"); + expect(response.body.commitTxHash.length).toBe(66); + expect(typeof response.body.executeTxHash).toStrictEqual("string"); + expect(response.body.executeTxHash.length).toBe(66); + expect(typeof response.body.proveTxHash).toStrictEqual("string"); + expect(response.body.proveTxHash.length).toBe(66); + expect(typeof response.body.isL1BatchSealed).toStrictEqual("boolean"); + expect(typeof response.body.gasUsed).toStrictEqual("string"); }); }); @@ -320,9 +519,40 @@ describe("Transactions", () => { expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); - // expect(response.body).toStrictEqual(expect.objectContaining({ to: contract })) //unstable on CI + expect(response.body).toStrictEqual(expect.objectContaining({ to: contract })); expect(response.body).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); + expect(response.body.value).toBe("0"); + expect(typeof response.body.data).toStrictEqual("string"); + expect(typeof response.body.fee).toStrictEqual("string"); + expect(typeof response.body.nonce).toStrictEqual("number"); + expect(typeof response.body.gasLimit).toStrictEqual("string"); + expect(typeof response.body.gasPrice).toStrictEqual("string"); + expect(typeof response.body.gasPerPubdata).toStrictEqual("string"); + expect(typeof response.body.maxFeePerGas).toStrictEqual("string"); + expect(typeof response.body.maxPriorityFeePerGas).toStrictEqual("string"); + expect(typeof response.body.blockNumber).toStrictEqual("number"); + expect(response.body.blockNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.l1BatchNumber).toStrictEqual("number"); + expect(response.body.l1BatchNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.blockHash).toStrictEqual("string"); + expect(response.body.blockHash.length).toBe(66); + expect(typeof response.body.type).toStrictEqual("number"); + expect(response.body.type).toBeGreaterThanOrEqual(0); + expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); + expect(typeof response.body.receivedAt).toStrictEqual("string"); + expect(response.body.receivedAt.length).toBe(24); + expect(response.body).toStrictEqual(expect.objectContaining({ error: null })); + expect(response.body).toStrictEqual(expect.objectContaining({ revertReason: null })); + expect(typeof response.body.status).toStrictEqual("string"); + expect(typeof response.body.commitTxHash).toStrictEqual("string"); + expect(response.body.commitTxHash.length).toBe(66); + expect(typeof response.body.executeTxHash).toStrictEqual("string"); + expect(response.body.executeTxHash.length).toBe(66); + expect(typeof response.body.proveTxHash).toStrictEqual("string"); + expect(response.body.proveTxHash.length).toBe(66); + expect(typeof response.body.isL1BatchSealed).toStrictEqual("boolean"); + expect(typeof response.body.gasUsed).toStrictEqual("string"); }); }); @@ -339,6 +569,37 @@ describe("Transactions", () => { expect(response.body).toStrictEqual(expect.objectContaining({ to: contract })); expect(response.body).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); + expect(response.body.value).toBe("0"); + expect(typeof response.body.data).toStrictEqual("string"); + expect(typeof response.body.fee).toStrictEqual("string"); + expect(typeof response.body.nonce).toStrictEqual("number"); + expect(typeof response.body.gasLimit).toStrictEqual("string"); + expect(typeof response.body.gasPrice).toStrictEqual("string"); + expect(typeof response.body.gasPerPubdata).toStrictEqual("string"); + expect(typeof response.body.maxFeePerGas).toStrictEqual("string"); + expect(typeof response.body.maxPriorityFeePerGas).toStrictEqual("string"); + expect(typeof response.body.blockNumber).toStrictEqual("number"); + expect(response.body.blockNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.l1BatchNumber).toStrictEqual("number"); + expect(response.body.l1BatchNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.blockHash).toStrictEqual("string"); + expect(response.body.blockHash.length).toBe(66); + expect(typeof response.body.type).toStrictEqual("number"); + expect(response.body.type).toBeGreaterThanOrEqual(0); + expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); + expect(typeof response.body.receivedAt).toStrictEqual("string"); + expect(response.body.receivedAt.length).toBe(24); + expect(response.body).toStrictEqual(expect.objectContaining({ error: null })); + expect(response.body).toStrictEqual(expect.objectContaining({ revertReason: null })); + expect(typeof response.body.status).toStrictEqual("string"); + expect(typeof response.body.commitTxHash).toStrictEqual("string"); + expect(response.body.commitTxHash.length).toBe(66); + expect(typeof response.body.executeTxHash).toStrictEqual("string"); + expect(response.body.executeTxHash.length).toBe(66); + expect(typeof response.body.proveTxHash).toStrictEqual("string"); + expect(response.body.proveTxHash.length).toBe(66); + expect(typeof response.body.isL1BatchSealed).toStrictEqual("boolean"); + expect(typeof response.body.gasUsed).toStrictEqual("string"); }); }); @@ -355,6 +616,38 @@ describe("Transactions", () => { expect(response.body).toStrictEqual(expect.objectContaining({ to: contract })); expect(response.body).toStrictEqual(expect.objectContaining({ value: "0" })); expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); + expect(response.body).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); + expect(typeof response.body.from).toStrictEqual("string"); + expect(typeof response.body.data).toStrictEqual("string"); + expect(typeof response.body.fee).toStrictEqual("string"); + expect(typeof response.body.nonce).toStrictEqual("number"); + expect(typeof response.body.gasLimit).toStrictEqual("string"); + expect(typeof response.body.gasPrice).toStrictEqual("string"); + expect(typeof response.body.gasPerPubdata).toStrictEqual("string"); + expect(typeof response.body.maxFeePerGas).toStrictEqual("string"); + expect(typeof response.body.maxPriorityFeePerGas).toStrictEqual("string"); + expect(typeof response.body.blockNumber).toStrictEqual("number"); + expect(response.body.blockNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.l1BatchNumber).toStrictEqual("number"); + expect(response.body.l1BatchNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.blockHash).toStrictEqual("string"); + expect(response.body.blockHash.length).toBe(66); + expect(typeof response.body.type).toStrictEqual("number"); + expect(response.body.type).toBeGreaterThanOrEqual(0); + expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); + expect(typeof response.body.receivedAt).toStrictEqual("string"); + expect(response.body.receivedAt.length).toBe(24); + expect(response.body).toStrictEqual(expect.objectContaining({ error: null })); + expect(response.body).toStrictEqual(expect.objectContaining({ revertReason: null })); + expect(typeof response.body.status).toStrictEqual("string"); + expect(typeof response.body.commitTxHash).toStrictEqual("string"); + expect(response.body.commitTxHash.length).toBe(66); + expect(typeof response.body.executeTxHash).toStrictEqual("string"); + expect(response.body.executeTxHash.length).toBe(66); + expect(typeof response.body.proveTxHash).toStrictEqual("string"); + expect(response.body.proveTxHash.length).toBe(66); + expect(typeof response.body.isL1BatchSealed).toStrictEqual("boolean"); + expect(typeof response.body.gasUsed).toStrictEqual("string"); }); }); @@ -371,6 +664,38 @@ describe("Transactions", () => { expect(response.body).toStrictEqual(expect.objectContaining({ value: "0" })); expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); + expect(response.body).toStrictEqual( + expect.objectContaining({ to: "0x0000000000000000000000000000000000008006" }) + ); + expect(typeof response.body.data).toStrictEqual("string"); + expect(typeof response.body.fee).toStrictEqual("string"); + expect(typeof response.body.nonce).toStrictEqual("number"); + expect(typeof response.body.gasLimit).toStrictEqual("string"); + expect(typeof response.body.gasPrice).toStrictEqual("string"); + expect(typeof response.body.gasPerPubdata).toStrictEqual("string"); + expect(typeof response.body.maxFeePerGas).toStrictEqual("string"); + expect(typeof response.body.maxPriorityFeePerGas).toStrictEqual("string"); + expect(typeof response.body.blockNumber).toStrictEqual("number"); + expect(response.body.blockNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.l1BatchNumber).toStrictEqual("number"); + expect(response.body.l1BatchNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.blockHash).toStrictEqual("string"); + expect(response.body.blockHash.length).toBe(66); + expect(typeof response.body.type).toStrictEqual("number"); + expect(response.body.type).toBeGreaterThanOrEqual(0); + expect(typeof response.body.receivedAt).toStrictEqual("string"); + expect(response.body.receivedAt.length).toBe(24); + expect(response.body).toStrictEqual(expect.objectContaining({ error: null })); + expect(response.body).toStrictEqual(expect.objectContaining({ revertReason: null })); + expect(typeof response.body.status).toStrictEqual("string"); + expect(typeof response.body.commitTxHash).toStrictEqual("string"); + expect(response.body.commitTxHash.length).toBe(66); + expect(typeof response.body.executeTxHash).toStrictEqual("string"); + expect(response.body.executeTxHash.length).toBe(66); + expect(typeof response.body.proveTxHash).toStrictEqual("string"); + expect(response.body.proveTxHash.length).toBe(66); + expect(typeof response.body.isL1BatchSealed).toStrictEqual("boolean"); + expect(typeof response.body.gasUsed).toStrictEqual("string"); }); }); @@ -387,6 +712,38 @@ describe("Transactions", () => { expect(response.body).toStrictEqual(expect.objectContaining({ value: "0" })); expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); + expect(response.body).toStrictEqual( + expect.objectContaining({ to: "0x0000000000000000000000000000000000008006" }) + ); + expect(typeof response.body.data).toStrictEqual("string"); + expect(typeof response.body.fee).toStrictEqual("string"); + expect(typeof response.body.nonce).toStrictEqual("number"); + expect(typeof response.body.gasLimit).toStrictEqual("string"); + expect(typeof response.body.gasPrice).toStrictEqual("string"); + expect(typeof response.body.gasPerPubdata).toStrictEqual("string"); + expect(typeof response.body.maxFeePerGas).toStrictEqual("string"); + expect(typeof response.body.maxPriorityFeePerGas).toStrictEqual("string"); + expect(typeof response.body.blockNumber).toStrictEqual("number"); + expect(response.body.blockNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.l1BatchNumber).toStrictEqual("number"); + expect(response.body.l1BatchNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.blockHash).toStrictEqual("string"); + expect(response.body.blockHash.length).toBe(66); + expect(typeof response.body.type).toStrictEqual("number"); + expect(response.body.type).toBeGreaterThanOrEqual(0); + expect(typeof response.body.receivedAt).toStrictEqual("string"); + expect(response.body.receivedAt.length).toBe(24); + expect(response.body).toStrictEqual(expect.objectContaining({ error: null })); + expect(response.body).toStrictEqual(expect.objectContaining({ revertReason: null })); + expect(typeof response.body.status).toStrictEqual("string"); + expect(typeof response.body.commitTxHash).toStrictEqual("string"); + expect(response.body.commitTxHash.length).toBe(66); + expect(typeof response.body.executeTxHash).toStrictEqual("string"); + expect(response.body.executeTxHash.length).toBe(66); + expect(typeof response.body.proveTxHash).toStrictEqual("string"); + expect(response.body.proveTxHash.length).toBe(66); + expect(typeof response.body.isL1BatchSealed).toStrictEqual("boolean"); + expect(typeof response.body.gasUsed).toStrictEqual("string"); }); }); @@ -403,6 +760,38 @@ describe("Transactions", () => { expect(response.body).toStrictEqual(expect.objectContaining({ value: "0" })); expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); + expect(response.body).toStrictEqual( + expect.objectContaining({ to: "0x0000000000000000000000000000000000008006" }) + ); + expect(typeof response.body.data).toStrictEqual("string"); + expect(typeof response.body.fee).toStrictEqual("string"); + expect(typeof response.body.nonce).toStrictEqual("number"); + expect(typeof response.body.gasLimit).toStrictEqual("string"); + expect(typeof response.body.gasPrice).toStrictEqual("string"); + expect(typeof response.body.gasPerPubdata).toStrictEqual("string"); + expect(typeof response.body.maxFeePerGas).toStrictEqual("string"); + expect(typeof response.body.maxPriorityFeePerGas).toStrictEqual("string"); + expect(typeof response.body.blockNumber).toStrictEqual("number"); + expect(response.body.blockNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.l1BatchNumber).toStrictEqual("number"); + expect(response.body.l1BatchNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.blockHash).toStrictEqual("string"); + expect(response.body.blockHash.length).toBe(66); + expect(typeof response.body.type).toStrictEqual("number"); + expect(response.body.type).toBeGreaterThanOrEqual(0); + expect(typeof response.body.receivedAt).toStrictEqual("string"); + expect(response.body.receivedAt.length).toBe(24); + expect(response.body).toStrictEqual(expect.objectContaining({ error: null })); + expect(response.body).toStrictEqual(expect.objectContaining({ revertReason: null })); + expect(typeof response.body.status).toStrictEqual("string"); + expect(typeof response.body.commitTxHash).toStrictEqual("string"); + expect(response.body.commitTxHash.length).toBe(66); + expect(typeof response.body.executeTxHash).toStrictEqual("string"); + expect(response.body.executeTxHash.length).toBe(66); + expect(typeof response.body.proveTxHash).toStrictEqual("string"); + expect(response.body.proveTxHash.length).toBe(66); + expect(typeof response.body.isL1BatchSealed).toStrictEqual("boolean"); + expect(typeof response.body.gasUsed).toStrictEqual("string"); }); }); @@ -419,6 +808,36 @@ describe("Transactions", () => { expect(response.body).toStrictEqual(expect.objectContaining({ value: "0" })); expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); + expect(typeof response.body.to).toStrictEqual("string"); + expect(typeof response.body.data).toStrictEqual("string"); + expect(typeof response.body.fee).toStrictEqual("string"); + expect(typeof response.body.nonce).toStrictEqual("number"); + expect(typeof response.body.gasLimit).toStrictEqual("string"); + expect(typeof response.body.gasPrice).toStrictEqual("string"); + expect(typeof response.body.gasPerPubdata).toStrictEqual("string"); + expect(typeof response.body.maxFeePerGas).toStrictEqual("string"); + expect(typeof response.body.maxPriorityFeePerGas).toStrictEqual("string"); + expect(typeof response.body.blockNumber).toStrictEqual("number"); + expect(response.body.blockNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.l1BatchNumber).toStrictEqual("number"); + expect(response.body.l1BatchNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.blockHash).toStrictEqual("string"); + expect(response.body.blockHash.length).toBe(66); + expect(typeof response.body.type).toStrictEqual("number"); + expect(response.body.type).toBeGreaterThanOrEqual(0); + expect(typeof response.body.receivedAt).toStrictEqual("string"); + expect(response.body.receivedAt.length).toBe(24); + expect(response.body).toStrictEqual(expect.objectContaining({ error: null })); + expect(response.body).toStrictEqual(expect.objectContaining({ revertReason: null })); + expect(typeof response.body.status).toStrictEqual("string"); + expect(typeof response.body.commitTxHash).toStrictEqual("string"); + expect(response.body.commitTxHash.length).toBe(66); + expect(typeof response.body.executeTxHash).toStrictEqual("string"); + expect(response.body.executeTxHash.length).toBe(66); + expect(typeof response.body.proveTxHash).toStrictEqual("string"); + expect(response.body.proveTxHash.length).toBe(66); + expect(typeof response.body.isL1BatchSealed).toStrictEqual("boolean"); + expect(typeof response.body.gasUsed).toStrictEqual("string"); }); }); @@ -435,6 +854,39 @@ describe("Transactions", () => { expect(response.body.to).toStrictEqual(token); expect(response.body.hash).toStrictEqual(txHash); expect(response.body.status).toStrictEqual(TransactionsStatus.failed); + expect(response.body).toStrictEqual(expect.objectContaining({ value: "0" })); + expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); + expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); + expect(typeof response.body.data).toStrictEqual("string"); + expect(typeof response.body.fee).toStrictEqual("string"); + expect(typeof response.body.nonce).toStrictEqual("number"); + expect(typeof response.body.gasLimit).toStrictEqual("string"); + expect(typeof response.body.gasPrice).toStrictEqual("string"); + expect(typeof response.body.gasPerPubdata).toStrictEqual("string"); + expect(typeof response.body.maxFeePerGas).toStrictEqual("string"); + expect(typeof response.body.maxPriorityFeePerGas).toStrictEqual("string"); + expect(typeof response.body.blockNumber).toStrictEqual("number"); + expect(response.body.blockNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.l1BatchNumber).toStrictEqual("number"); + expect(response.body.l1BatchNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.blockHash).toStrictEqual("string"); + expect(response.body.blockHash.length).toBe(66); + expect(typeof response.body.type).toStrictEqual("number"); + expect(response.body.type).toBeGreaterThanOrEqual(0); + expect(typeof response.body.receivedAt).toStrictEqual("string"); + expect(response.body.receivedAt.length).toBe(24); + expect(response.body).toStrictEqual(expect.objectContaining({ error: null })); + expect(response.body).toStrictEqual( + expect.objectContaining({ revertReason: "ERC20: transfer to the zero address" }) + ); + expect(typeof response.body.commitTxHash).toStrictEqual("string"); + expect(response.body.commitTxHash.length).toBe(66); + expect(typeof response.body.executeTxHash).toStrictEqual("string"); + expect(response.body.executeTxHash.length).toBe(66); + expect(typeof response.body.proveTxHash).toStrictEqual("string"); + expect(response.body.proveTxHash.length).toBe(66); + expect(typeof response.body.isL1BatchSealed).toStrictEqual("boolean"); + expect(typeof response.body.gasUsed).toStrictEqual("string"); }); }); }); @@ -461,7 +913,12 @@ describe("Transactions", () => { expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) ); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ isInternal: false })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenType: "ETH" })); + expect(typeof response.body.items[0].blockNumber).toStrictEqual("number"); + expect(typeof response.body.items[0].timestamp).toStrictEqual("string"); + expect(typeof response.body.items[0].amount).toStrictEqual("string"); expect(response.body.items[0]).toStrictEqual( expect.objectContaining({ token: { @@ -541,6 +998,25 @@ describe("Transactions", () => { ); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ isInternal: false })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenType: "ETH" })); + expect(typeof response.body.items[0].blockNumber).toStrictEqual("number"); + expect(typeof response.body.items[0].timestamp).toStrictEqual("string"); + expect(typeof response.body.items[0].amount).toStrictEqual("string"); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ + token: { + decimals: 18, + iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", + l1Address: Token.ETHER_Address, + l2Address: Token.ETHER_ERC20_Address, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: contract })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); @@ -605,6 +1081,25 @@ describe("Transactions", () => { ); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ isInternal: false })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenType: "ETH" })); + expect(typeof response.body.items[0].blockNumber).toStrictEqual("number"); + expect(typeof response.body.items[0].timestamp).toStrictEqual("string"); + expect(typeof response.body.items[0].amount).toStrictEqual("string"); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ + token: { + decimals: 18, + iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", + l1Address: Token.ETHER_Address, + l2Address: Token.ETHER_ERC20_Address, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: contract })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); @@ -668,6 +1163,11 @@ describe("Transactions", () => { expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenAddress: token })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.transfer })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ isInternal: false })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenType: "ERC20" })); + expect(typeof response.body.items[0].blockNumber).toStrictEqual("number"); + expect(typeof response.body.items[0].timestamp).toStrictEqual("string"); + expect(typeof response.body.items[0].amount).toStrictEqual("string"); expect(response.body.items[0]).toStrictEqual( expect.objectContaining({ token: { @@ -750,6 +1250,7 @@ describe("Transactions", () => { expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) ); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenType: "ETH" })); expect(response.body.items[0]).toStrictEqual( expect.objectContaining({ token: { @@ -825,6 +1326,11 @@ describe("Transactions", () => { ); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ isInternal: false })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenType: "ETH" })); + expect(typeof response.body.items[0].blockNumber).toStrictEqual("number"); + expect(typeof response.body.items[0].timestamp).toStrictEqual("string"); + expect(typeof response.body.items[0].amount).toStrictEqual("string"); expect(response.body.items[0]).toStrictEqual( expect.objectContaining({ token: { @@ -881,6 +1387,11 @@ describe("Transactions", () => { ); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ isInternal: false })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenType: "ETH" })); + expect(typeof response.body.items[0].blockNumber).toStrictEqual("number"); + expect(typeof response.body.items[0].timestamp).toStrictEqual("string"); + expect(typeof response.body.items[0].amount).toStrictEqual("string"); expect(response.body.items[0]).toStrictEqual( expect.objectContaining({ token: { @@ -937,6 +1448,11 @@ describe("Transactions", () => { ); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ isInternal: false })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenType: "ETH" })); + expect(typeof response.body.items[0].blockNumber).toStrictEqual("number"); + expect(typeof response.body.items[0].timestamp).toStrictEqual("string"); + expect(typeof response.body.items[0].amount).toStrictEqual("string"); expect(response.body.items[0]).toStrictEqual( expect.objectContaining({ token: { @@ -992,6 +1508,11 @@ describe("Transactions", () => { ); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ isInternal: false })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenType: "ETH" })); + expect(typeof response.body.items[0].blockNumber).toStrictEqual("number"); + expect(typeof response.body.items[0].timestamp).toStrictEqual("string"); + expect(typeof response.body.items[0].amount).toStrictEqual("string"); expect(response.body.items[0]).toStrictEqual( expect.objectContaining({ token: { From 4babcacb7c0c540a5cebeecbe01712f7dafdf566 Mon Sep 17 00:00:00 2001 From: amelnytskyi Date: Mon, 4 Mar 2024 19:08:36 +0200 Subject: [PATCH 03/28] test: covering UI tests for Deposit Changed timeout value in Deposit UI tests Renamed variables to suggested values as per review results Removed obsolete console.log --- .../scenarios/deposit/depositERC20.ts | 8 ++--- .../tests/ui/deposit.spec.ts | 35 ++++++++++--------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/packages/integration-tests/src/playbook/scenarios/deposit/depositERC20.ts b/packages/integration-tests/src/playbook/scenarios/deposit/depositERC20.ts index 7d4338a61f..0d3a48d1cb 100644 --- a/packages/integration-tests/src/playbook/scenarios/deposit/depositERC20.ts +++ b/packages/integration-tests/src/playbook/scenarios/deposit/depositERC20.ts @@ -11,8 +11,8 @@ const syncProvider = new zksync.Provider(localConfig.L2Network); const ethProvider = ethers.getDefaultProvider(localConfig.L1Network); const syncWallet = new zksync.Wallet(localConfig.privateKey, syncProvider, ethProvider); const playbookRoot = "src/playbook"; -const bufferFile = playbookRoot + "/" + Buffer.L2deposited; -const bufferDepositErc20File = playbookRoot + "/" + Buffer.txERC20Deposit; +const bufferAddressL2DepositedFile = playbookRoot + "/" + Buffer.L2deposited; +const bufferTxErc20DepositFile = playbookRoot + "/" + Buffer.txERC20Deposit; export const depositERC20 = async function (sum = "0.5", tokenAddress: string, units = 18) { const deposit = await syncWallet.deposit({ @@ -28,10 +28,10 @@ export const depositERC20 = async function (sum = "0.5", tokenAddress: string, u const l2TokenAddress = await syncProvider.l2TokenAddress(tokenAddress); console.log("L2 token address ", l2TokenAddress); - await fs.writeFile(bufferFile, l2TokenAddress); const txHash = await deposit.waitFinalize(); await helper.txHashLogger(Logger.deposit, txHash.transactionHash, "ERC20 token"); - await fs.writeFile(bufferDepositErc20File, txHash.transactionHash); + await fs.writeFile(bufferAddressL2DepositedFile, l2TokenAddress); + await fs.writeFile(bufferTxErc20DepositFile, txHash.transactionHash); return txHash; }; diff --git a/packages/integration-tests/tests/ui/deposit.spec.ts b/packages/integration-tests/tests/ui/deposit.spec.ts index 1663c0cc07..5d6f5f2431 100644 --- a/packages/integration-tests/tests/ui/deposit.spec.ts +++ b/packages/integration-tests/tests/ui/deposit.spec.ts @@ -4,30 +4,32 @@ import { config } from "./config"; import { BlockExplorer, Buffer, Wallets } from "../../src/entities"; import { Helper } from "../../src/helper"; +import type { Locator } from "@playwright/test"; + const bufferRoute = "src/playbook/"; const helper = new Helper(); let url: string; let bufferFile; let depositTxHash: string; -let fromAddress: string; +let initiatorAddress: string; +let hash, initiatorAddressElement, ethValue, erc20Value: Locator; //@id1660 test("Check Deposit ETH transaction on BE", async ({ page }) => { bufferFile = bufferRoute + Buffer.txEthDeposit; depositTxHash = await helper.getStringFromFile(bufferFile); url = BlockExplorer.baseUrl + `/tx/${depositTxHash}` + BlockExplorer.localNetwork; - fromAddress = Wallets.richWalletAddress; - console.log(url); + initiatorAddress = Wallets.richWalletAddress; await page.goto(url); - const hash = await page.locator(`//*[text()="Transaction Hash"]/..//..//*[text()="${depositTxHash}"]`).first(); - const fromAddressElement = await page.locator(`text=${fromAddress}`).first(); - const ethValue = await page.locator(`text=0.0000001`).first(); + hash = await page.locator(`//*[text()="Transaction Hash"]/..//..//*[text()="${depositTxHash}"]`).first(); + initiatorAddressElement = await page.locator(`text=${initiatorAddress}`).first(); + ethValue = await page.locator(`text=0.0000001`).first(); - await expect(hash).toBeVisible(config.extraTimeout); - await expect(ethValue).toBeVisible(config.extraTimeout); - await expect(fromAddressElement).toBeVisible(config.extraTimeout); + await expect(hash).toBeVisible(config.defaultTimeout); + await expect(ethValue).toBeVisible(config.defaultTimeout); + await expect(initiatorAddressElement).toBeVisible(config.defaultTimeout); }); //@id1681 @@ -35,18 +37,17 @@ test("Check on BE Deposit the custom ERC-20 token", async ({ page }) => { bufferFile = bufferRoute + Buffer.txERC20Deposit; depositTxHash = await helper.getStringFromFile(bufferFile); url = BlockExplorer.baseUrl + `/tx/${depositTxHash}` + BlockExplorer.localNetwork; - fromAddress = Wallets.richWalletAddress; - console.log(url); + initiatorAddress = Wallets.richWalletAddress; await page.goto(url); - const hash = await page.locator(`//*[text()="Transaction Hash"]/..//..//*[text()="${depositTxHash}"]`).first(); - const fromAddressElement = await page.locator( + hash = await page.locator(`//*[text()="Transaction Hash"]/..//..//*[text()="${depositTxHash}"]`).first(); + initiatorAddressElement = await page.locator( `//*[text()="From"]/..//*[text()="L1"]/..//*[text()="0x36615Cf349d...c049"]` ); - const erc20Value = await page.locator(`//*[text()="0x36615Cf349d...c049"]/..//..//*[text()="100"]`); + erc20Value = await page.locator(`//*[text()="0x36615Cf349d...c049"]/..//..//*[text()="100"]`); - await expect(hash).toBeVisible(config.extraTimeout); - await expect(erc20Value).toBeVisible(config.extraTimeout); - await expect(fromAddressElement).toBeVisible(config.extraTimeout); + await expect(hash).toBeVisible(config.defaultTimeout); + await expect(erc20Value).toBeVisible(config.defaultTimeout); + await expect(initiatorAddressElement).toBeVisible(config.defaultTimeout); }); From dd3af36dc5c01b6883e8344e809123c5b0aa6677 Mon Sep 17 00:00:00 2001 From: pcheremu <51121511+pcheremu@users.noreply.github.com> Date: Wed, 6 Mar 2024 11:27:41 +0100 Subject: [PATCH 04/28] Update package.json Co-authored-by: Roman Petriv --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 66f4518ed2..000991962d 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "test": "lerna run test", "test:ci": "lerna run test:ci", "test:e2e": "lerna run test:e2e", - "test:integration:ui": "lerna run integration-test:ui", + "test:integration:ui": "lerna run integration-tests:ui", "test:integration:api": "lerna run integration-test:api", "dev": "lerna run dev", "build": "lerna run build", From 87e31045e85e4adc88b4a1c119dec394d6a6bf79 Mon Sep 17 00:00:00 2001 From: pcheremu <51121511+pcheremu@users.noreply.github.com> Date: Wed, 6 Mar 2024 11:27:53 +0100 Subject: [PATCH 05/28] Update package.json Co-authored-by: Roman Petriv --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 000991962d..811b4cc761 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "test:ci": "lerna run test:ci", "test:e2e": "lerna run test:e2e", "test:integration:ui": "lerna run integration-tests:ui", - "test:integration:api": "lerna run integration-test:api", + "test:integration:api": "lerna run integration-tests:api", "dev": "lerna run dev", "build": "lerna run build", "start": "lerna run start", From fae3657f5084cb7f3d7d87485497885d4519b577 Mon Sep 17 00:00:00 2001 From: pcheremu <51121511+pcheremu@users.noreply.github.com> Date: Wed, 6 Mar 2024 11:28:38 +0100 Subject: [PATCH 06/28] Update packages/integration-tests/README.md Co-authored-by: Roman Petriv --- packages/integration-tests/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/integration-tests/README.md b/packages/integration-tests/README.md index 14ee629b25..ee5f8ea3e2 100644 --- a/packages/integration-tests/README.md +++ b/packages/integration-tests/README.md @@ -15,7 +15,7 @@ npm install cp .env.example packages/integration-tests/src/playbook/.env ``` -- Add your private wallet key to `WALLET_PRIVATE_KEY=` By default we use `richWalletPrivateKey` private key in `integration-tests/src/playbook/utils/getWallet.ts` from `integration-tests/src/entities.ts`. +- Add your private wallet key to `WALLET_PRIVATE_KEY={YOUR_PRIVATE_KEY}`. By default we use `richWalletPrivateKey` private key in `integration-tests/src/playbook/utils/getWallet.ts` from `integration-tests/src/entities.ts`. ## Preparing a local environment From 2f2d13fcbb6b932237d0499bde3d2723d1d4a4af Mon Sep 17 00:00:00 2001 From: pcheremu <51121511+pcheremu@users.noreply.github.com> Date: Wed, 6 Mar 2024 11:29:05 +0100 Subject: [PATCH 07/28] Update packages/integration-tests/README.md Co-authored-by: Roman Petriv --- packages/integration-tests/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/integration-tests/README.md b/packages/integration-tests/README.md index ee5f8ea3e2..e989cf1693 100644 --- a/packages/integration-tests/README.md +++ b/packages/integration-tests/README.md @@ -42,7 +42,7 @@ npm run integration-test:ui If you need to run the exact test or/and suite you can change key-words from `it` to `fit` (for the test) and `describe` to `fdescribe` for suite. -If you need to exclude some specific test/suites, you can change keywords `it` to `xit` and/or +If you need to exclude some specific test/suite, you can change keywords `it` to `xit` and/or `describe` to `xdescribe`. The test solution contains two main folders: [src](./src) and [tests](./tests). From b31711c87c0015b1217a68a1731f84d26713a877 Mon Sep 17 00:00:00 2001 From: pcheremu <51121511+pcheremu@users.noreply.github.com> Date: Wed, 6 Mar 2024 11:30:24 +0100 Subject: [PATCH 08/28] Update packages/integration-tests/src/entities.ts Co-authored-by: Roman Petriv --- packages/integration-tests/src/entities.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/integration-tests/src/entities.ts b/packages/integration-tests/src/entities.ts index f5008ddbf5..05988e8fe6 100644 --- a/packages/integration-tests/src/entities.ts +++ b/packages/integration-tests/src/entities.ts @@ -60,7 +60,7 @@ export enum TransactionsType { withdrawal = "withdrawal", } -export enum TransactionsStatus { +export enum TransactionStatus { failed = "failed", } From 410e4919a765e17d6658ece8c091b66038d691b3 Mon Sep 17 00:00:00 2001 From: pcheremu <51121511+pcheremu@users.noreply.github.com> Date: Wed, 6 Mar 2024 11:30:55 +0100 Subject: [PATCH 09/28] Update packages/integration-tests/src/helper.ts Co-authored-by: Roman Petriv --- packages/integration-tests/src/helper.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/integration-tests/src/helper.ts b/packages/integration-tests/src/helper.ts index 71dc978a5a..f78265816b 100644 --- a/packages/integration-tests/src/helper.ts +++ b/packages/integration-tests/src/helper.ts @@ -61,7 +61,7 @@ export class Helper { return new Promise((resolve) => setTimeout(resolve, ms)); } - async performGETrequest(apiRoute: string) { + async performBlockExplorerApiGetRequest(apiRoute: string) { return request(environment.blockExplorerAPI).get(apiRoute); } From 99a893356c8ba772250d1bc3dc96d7a15648e662 Mon Sep 17 00:00:00 2001 From: pcheremu <51121511+pcheremu@users.noreply.github.com> Date: Wed, 6 Mar 2024 11:31:39 +0100 Subject: [PATCH 10/28] Update packages/integration-tests/src/helper.ts Co-authored-by: Roman Petriv --- packages/integration-tests/src/helper.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/integration-tests/src/helper.ts b/packages/integration-tests/src/helper.ts index f78265816b..7f4a97c8c7 100644 --- a/packages/integration-tests/src/helper.ts +++ b/packages/integration-tests/src/helper.ts @@ -73,7 +73,7 @@ export class Helper { * with a delay between attempts (localConfig.intervalAPIretries). * Throws an error if the action consistently fails after all retries. */ - async retryTestAction(action) { + async runRetriableTestAction(action) { for (let i = 0; i < localConfig.maxAPIretries; i++) { try { await action(); From 4790844b67af14c2150436044b4a2d6cf7fe572e Mon Sep 17 00:00:00 2001 From: pcheremu <51121511+pcheremu@users.noreply.github.com> Date: Wed, 6 Mar 2024 11:32:50 +0100 Subject: [PATCH 11/28] Update packages/integration-tests/src/entities.ts Co-authored-by: Roman Petriv --- packages/integration-tests/src/entities.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/integration-tests/src/entities.ts b/packages/integration-tests/src/entities.ts index 05988e8fe6..df52e69d1c 100644 --- a/packages/integration-tests/src/entities.ts +++ b/packages/integration-tests/src/entities.ts @@ -69,7 +69,7 @@ export enum Wallets { secondWalletAddress = "0x26A4c5Dfe2cA3c9E7E8C417B689F41b6b5745C37", richWalletAddress = "0x36615Cf349d7F6344891B1e7CA7C72883F5dc049", mainWalletPrivateKey = "0x06ac1584dd1cf69f97a784b2b7812cd0c65a867ec997add028cdf56483c1c299", - secondWalletPrivateKey = "e14e6e0b3b610411cf15c3a5aa3252cac9e0a40a9bbe67ceb3b5d506f56576fd", + secondaryWalletPrivateKey = "e14e6e0b3b610411cf15c3a5aa3252cac9e0a40a9bbe67ceb3b5d506f56576fd", richWalletPrivateKey = "0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110", } From 4ed7c4f10b8de57da02d02ffc71914027e2bfe09 Mon Sep 17 00:00:00 2001 From: pcheremu <51121511+pcheremu@users.noreply.github.com> Date: Wed, 6 Mar 2024 11:33:03 +0100 Subject: [PATCH 12/28] Update packages/integration-tests/src/entities.ts Co-authored-by: Roman Petriv --- packages/integration-tests/src/entities.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/integration-tests/src/entities.ts b/packages/integration-tests/src/entities.ts index df52e69d1c..132773d91e 100644 --- a/packages/integration-tests/src/entities.ts +++ b/packages/integration-tests/src/entities.ts @@ -66,7 +66,7 @@ export enum TransactionStatus { export enum Wallets { mainWalletAddress = "0x586607935E1462ab762F438E0A7b2968A4158975", - secondWalletAddress = "0x26A4c5Dfe2cA3c9E7E8C417B689F41b6b5745C37", + secondaryWalletAddress = "0x26A4c5Dfe2cA3c9E7E8C417B689F41b6b5745C37", richWalletAddress = "0x36615Cf349d7F6344891B1e7CA7C72883F5dc049", mainWalletPrivateKey = "0x06ac1584dd1cf69f97a784b2b7812cd0c65a867ec997add028cdf56483c1c299", secondaryWalletPrivateKey = "e14e6e0b3b610411cf15c3a5aa3252cac9e0a40a9bbe67ceb3b5d506f56576fd", From 64cc6f25551cc75ea0af29005324717d03581479 Mon Sep 17 00:00:00 2001 From: pcheremu Date: Thu, 7 Mar 2024 10:19:55 +0100 Subject: [PATCH 13/28] test: fix names --- .../src/playbook/deploy/use-multitransferETH.ts | 6 +++--- .../src/playbook/scenarios/transfers/transferERC20.ts | 2 +- packages/integration-tests/tests/api/tokens.test.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/integration-tests/src/playbook/deploy/use-multitransferETH.ts b/packages/integration-tests/src/playbook/deploy/use-multitransferETH.ts index 5995db64d5..b28765f570 100644 --- a/packages/integration-tests/src/playbook/deploy/use-multitransferETH.ts +++ b/packages/integration-tests/src/playbook/deploy/use-multitransferETH.ts @@ -20,7 +20,7 @@ export default async function callMultiTransferETH(hre: HardhatRuntimeEnvironmen //wallets, To const richWalletAddress = Wallets.richWalletAddress; const mainWalletAddress = Wallets.mainWalletAddress; - const secondWalletAddress = Wallets.secondWalletAddress; + const secondaryWalletAddress = Wallets.secondaryWalletAddress; // type of coin, contract const etherAddress = Token.ETHER_Address; //ETH const customTokenI = await helper.getStringFromFile(firstToken); @@ -60,7 +60,7 @@ export default async function callMultiTransferETH(hre: HardhatRuntimeEnvironmen //call the deployed contract. const transferFromContract = await attachedContract.multiTransfer( - [richWalletAddress, mainWalletAddress, secondWalletAddress], + [richWalletAddress, mainWalletAddress, secondaryWalletAddress], [etherAddress, customTokenI, customTokenII], [ethAmount, customTokenIAmount, customTokenIIAmount] ); @@ -90,7 +90,7 @@ export default async function callMultiTransferETH(hre: HardhatRuntimeEnvironmen ); console.log( `balance of wallet 3 is: "${ethers.utils.formatUnits( - await provider.getBalance(secondWalletAddress, "latest", customTokenII), + await provider.getBalance(secondaryWalletAddress, "latest", customTokenII), 18 )}" Custom token II` ); diff --git a/packages/integration-tests/src/playbook/scenarios/transfers/transferERC20.ts b/packages/integration-tests/src/playbook/scenarios/transfers/transferERC20.ts index 13a1ab0ed3..80f19d3905 100644 --- a/packages/integration-tests/src/playbook/scenarios/transfers/transferERC20.ts +++ b/packages/integration-tests/src/playbook/scenarios/transfers/transferERC20.ts @@ -11,7 +11,7 @@ export const transferERC20 = async function (sum: string, tokenAddress: string, const syncProvider = new zksync.Provider(localConfig.L2Network); const ethProvider = ethers.getDefaultProvider(localConfig.L1Network); const syncWallet = new zksync.Wallet(localConfig.privateKey, syncProvider, ethProvider); - const syncWallet2 = new zksync.Wallet(Wallets.secondWalletPrivateKey, syncProvider, ethProvider); + const syncWallet2 = new zksync.Wallet(Wallets.secondaryWalletPrivateKey, syncProvider, ethProvider); const playbookRoot = "src/playbook/"; const bufferFile = playbookRoot + Buffer.txEthTransfer; diff --git a/packages/integration-tests/tests/api/tokens.test.ts b/packages/integration-tests/tests/api/tokens.test.ts index b708f03f21..6dbb897fc3 100644 --- a/packages/integration-tests/tests/api/tokens.test.ts +++ b/packages/integration-tests/tests/api/tokens.test.ts @@ -87,7 +87,7 @@ describe("Tokens", () => { expect(response.status).toBe(200); expect(response.body.items[0].amount).toBe("10000000000000000"); expect(response.body.items[0].from).toBe(Wallets.richWalletAddress); - expect(response.body.items[0].to).toBe(Wallets.secondWalletAddress); + expect(response.body.items[0].to).toBe(Wallets.secondaryWalletAddress); expect(response.body.items[0].token).toEqual(expect.objectContaining({ l2Address: l2Token })); expect(response.body.items[0]).toEqual(expect.objectContaining({ transactionHash: txHash })); expect(response.body.items[0]).toEqual(expect.objectContaining({ type: "transfer" })); From 7e43c4610c48df69b1e3d3a7817e96113913b967 Mon Sep 17 00:00:00 2001 From: pcheremu Date: Thu, 7 Mar 2024 11:22:02 +0100 Subject: [PATCH 14/28] test: fix names --- .../tests/api/accounts.test.ts | 36 +++--- .../tests/api/addresses.test.ts | 32 ++--- .../tests/api/batches.test.ts | 10 +- .../tests/api/blocks.test.ts | 26 ++-- .../tests/api/contracts.test.ts | 4 +- .../integration-tests/tests/api/logs.test.ts | 4 +- .../integration-tests/tests/api/stats.test.ts | 4 +- .../tests/api/tokens.test.ts | 20 +-- .../tests/api/transactions.test.ts | 116 +++++++++--------- 9 files changed, 126 insertions(+), 126 deletions(-) diff --git a/packages/integration-tests/tests/api/accounts.test.ts b/packages/integration-tests/tests/api/accounts.test.ts index 401b1c702d..11440a8520 100644 --- a/packages/integration-tests/tests/api/accounts.test.ts +++ b/packages/integration-tests/tests/api/accounts.test.ts @@ -25,13 +25,13 @@ describe("API module: Account", () => { //@id1704 it("Verify /api?module=account&action=balancemulti response", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { apiRoute = `/api?module=account&action=balancemulti&address=${Wallets.richWalletAddress},${Wallets.mainWalletAddress}`; const richWalletBalance = await helper.getBalanceETH(Wallets.richWalletAddress, "L2"); const mainWalletBalance = await helper.getBalanceETH(Wallets.mainWalletAddress, "L2"); const richWalletLowerCase = Wallets.richWalletAddress.toLowerCase(); const mainWalletLowerCase = Wallets.mainWalletAddress.toLowerCase(); - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.result.length).toBeGreaterThan(1); @@ -48,10 +48,10 @@ describe("API module: Account", () => { //@id1703 it("Verify /api?module=account&action=balance response", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { const balance = await helper.getBalanceETH(Wallets.richWalletAddress, "L2"); apiRoute = `/api?module=account&action=balance&address=${Wallets.richWalletAddress}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" })); @@ -62,9 +62,9 @@ describe("API module: Account", () => { //@id1705 it("Verify /api?module=account&action=tokenbalance response", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { apiRoute = `/api?module=account&action=tokenbalance&contractaddress=${Token.ETHER_ERC20_Address}&address=${Wallets.richWalletAddress}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" })); @@ -75,11 +75,11 @@ describe("API module: Account", () => { //@id1702 it("Verify /api?module=account&action=txlist response", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { const blocks = await request(environment.blockExplorerAPI).get("/blocks"); const blockNumber = blocks.body.items[0].number; apiRoute = `/api?module=account&action=txlist&page=1&offset=10&sort=desc&endblock=${blockNumber}&startblock=0&address=${Wallets.richWalletAddress}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.result.length).toBeGreaterThan(1); @@ -116,11 +116,11 @@ describe("API module: Account", () => { //@id1852 it("Verify /api?module=account&action=txlistinternal&address=", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { const blocks = await request(environment.blockExplorerAPI).get("/blocks"); const blockNumber = blocks.body.items[0].number; apiRoute = `/api?module=account&action=txlistinternal&page=1&offset=10&sort=desc&endblock=${blockNumber}&startblock=0&address=${Wallets.richWalletAddress}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" })); @@ -147,11 +147,11 @@ describe("API module: Account", () => { //@id1804 it("Verify /api?module=account&action=txlistinternal", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { const blocks = await request(environment.blockExplorerAPI).get("/blocks"); const blockNumber = blocks.body.items[0].number; apiRoute = `/api?module=account&action=txlistinternal&page=1&offset=10&sort=desc&endblock=${blockNumber}&startblock=1`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" })); @@ -173,11 +173,11 @@ describe("API module: Account", () => { //@id1805 it("Verify /api?module=account&action=tokentx", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { const blocks = await request(environment.blockExplorerAPI).get("/blocks"); const blockNumber = blocks.body.items[0].number; apiRoute = `/api?module=account&action=tokentx&page=1&offset=10&sort=desc&endblock=${blockNumber}&startblock=0&contractaddress=${Token.ETHER_ERC20_Address}&address=${Wallets.richWalletAddress}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); console.log(apiRoute); expect(response.status).toBe(200); @@ -212,12 +212,12 @@ describe("API module: Account", () => { //@id1806 it("Verify /api?module=account&action=tokennfttx", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { const blocks = await request(environment.blockExplorerAPI).get("/blocks"); const blockNumber = blocks.body.items[0].number; const nftAddress = await helper.getStringFromFile(bufferFile + Buffer.NFTtoL2); apiRoute = `/api?module=account&action=tokennfttx&page=1&offset=10&sort=desc&endblock=${blockNumber}&startblock=0&contractaddress=${nftAddress}&address=${nftAddress}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" })); @@ -246,9 +246,9 @@ describe("API module: Account", () => { //@id1807 it("Verify /api?module=account&action=getminedblocks", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { apiRoute = `/api?module=account&action=getminedblocks&page=1&offset=10&address=0x0000000000000000000000000000000000000000`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" })); diff --git a/packages/integration-tests/tests/api/addresses.test.ts b/packages/integration-tests/tests/api/addresses.test.ts index bcf615b88a..daf65881a3 100644 --- a/packages/integration-tests/tests/api/addresses.test.ts +++ b/packages/integration-tests/tests/api/addresses.test.ts @@ -28,10 +28,10 @@ describe("Address", () => { //@id1457 it("Verify deployed to L2 NFT via /address/{address}", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { token = await helper.getStringFromFile(bufferFile + Buffer.NFTtoL2); apiRoute = `/address/${token}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toEqual( @@ -51,11 +51,11 @@ describe("Address", () => { //@id1464 it("Verify the deployed Root contract via /address/{address}", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiCallRoot); txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallRoot); apiRoute = `/address/${contract}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toEqual(expect.objectContaining({ type: "contract" })); @@ -68,11 +68,11 @@ describe("Address", () => { //@id1465 it("Verify the deployed Middle contract via /address/{address}", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiCallMiddle); txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallMiddle); apiRoute = `/address/${contract}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toEqual(expect.objectContaining({ type: "contract" })); @@ -85,11 +85,11 @@ describe("Address", () => { //@id1466 it("Verify the deployed Caller contract via /address/{address}", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiCallCaller); txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallCaller); apiRoute = `/address/${contract}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toEqual(expect.objectContaining({ type: "contract" })); @@ -102,10 +102,10 @@ describe("Address", () => { //@id1476 it("Verify the deployed multitransfer contract via /address/{address}", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiTransferETH); apiRoute = `/address/${contract}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toEqual(expect.objectContaining({ address: contract })); @@ -115,10 +115,10 @@ describe("Address", () => { //@id1449 it("Verify the deployed Greeter contract via /address/{address}", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { contract = await helper.getStringFromFile(bufferFile + Buffer.greeterL2); apiRoute = `/address/${contract}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toEqual(expect.objectContaining({ address: contract })); @@ -134,12 +134,12 @@ describe("Address", () => { //@id1510 it("Verify the transaction via /address/{address}/logs", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { contract = await helper.getStringFromFile(bufferFile + Buffer.greeterL2); txHash = await helper.getStringFromFile(bufferFile + Buffer.executeGreeterTx); apiRoute = `/address/${contract}/logs`; const decapitalizedAddress = apiRoute.slice(1).toLowerCase(); - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.items[0]).toEqual(expect.objectContaining({ address: contract })); @@ -175,14 +175,14 @@ describe("Address", () => { //@id1509 it("Verify the transaction via /address/{address}/transfers", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { contract = await helper.getStringFromFile(bufferFile + Buffer.paymaster); const emptyWallet = await helper.getStringFromFile(bufferFile + Buffer.emptyWalletAddress); txHash = await helper.getStringFromFile(bufferFile + Buffer.paymasterTx); const customTokenAddress = await helper.getStringFromFile(bufferFile + Buffer.customToken); apiRoute = `/address/${contract}/transfers`; const decapitalizedAddress = apiRoute.slice(1).toLowerCase(); - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: emptyWallet })); diff --git a/packages/integration-tests/tests/api/batches.test.ts b/packages/integration-tests/tests/api/batches.test.ts index 26dc85af5c..b0182d7b61 100644 --- a/packages/integration-tests/tests/api/batches.test.ts +++ b/packages/integration-tests/tests/api/batches.test.ts @@ -10,9 +10,9 @@ describe("Batches", () => { //@id1513 it("Verify the response via /batches", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { apiRoute = `/batches`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(Array.isArray(response.body.items)).toStrictEqual(true); @@ -48,12 +48,12 @@ describe("Batches", () => { //@id1514 //unstable due to null issue with timestamp it("Verify the response via /batches/{batchNumber}", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { apiRoute = `/batches`; - const batches = await helper.performGETrequest(apiRoute); + const batches = await helper.performBlockExplorerApiGetRequest(apiRoute); const batchNumber = batches.body.items[0].number; apiRoute = apiRoute + `/${batchNumber}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.number).toStrictEqual(batchNumber); diff --git a/packages/integration-tests/tests/api/blocks.test.ts b/packages/integration-tests/tests/api/blocks.test.ts index 6aabac5609..e0a6281c7b 100644 --- a/packages/integration-tests/tests/api/blocks.test.ts +++ b/packages/integration-tests/tests/api/blocks.test.ts @@ -10,9 +10,9 @@ describe("Blocks", () => { jest.setTimeout(localConfig.standardTimeout); //@id1511 it("Verify the response via /blocks", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { apiRoute = `/blocks`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(Array.isArray(response.body.items)).toStrictEqual(true); @@ -31,11 +31,11 @@ describe("Blocks", () => { //@id1512 //unstable on CI it("Verify the response via /blocks/{/blockNumber}", async () => { - await helper.retryTestAction(async () => { - const blocks = await helper.performGETrequest("/blocks"); + await helper.runRetriableTestAction(async () => { + const blocks = await helper.performBlockExplorerApiGetRequest("/blocks"); const blockNumber = blocks.body.items[0].number; apiRoute = `/blocks/${blockNumber}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.number).toStrictEqual(blockNumber); @@ -65,11 +65,11 @@ describe("Blocks", () => { describe("/api?module=block", () => { //@id1700 it("Verify /api?module=block&action=getblockcountdown&blockno={block_number} response", async () => { - await helper.retryTestAction(async () => { - const blocks = await helper.performGETrequest("/blocks"); + await helper.runRetriableTestAction(async () => { + const blocks = await helper.performBlockExplorerApiGetRequest("/blocks"); const blockNumber = blocks.body.items[0].number + 1; apiRoute = `/api?module=block&action=getblockcountdown&blockno=${blockNumber}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" })); @@ -83,9 +83,9 @@ describe("Blocks", () => { //@id1699 it("Verify /api?module=block&action=getblocknobytime&closest=before×tamp={timestamp} response", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { apiRoute = `/api?module=block&action=getblocknobytime&closest=before×tamp=1635934550`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" })); @@ -96,11 +96,11 @@ describe("Blocks", () => { //@id1701 it("Verify /api?module=block&action=getblockreward&blockno={blockNumber} response", async () => { - await helper.retryTestAction(async () => { - const blocks = await helper.performGETrequest("/blocks"); + await helper.runRetriableTestAction(async () => { + const blocks = await helper.performBlockExplorerApiGetRequest("/blocks"); const blockNumber = blocks.body.items[0].number; apiRoute = `/api?module=block&action=getblockreward&blockno=${blockNumber}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" })); diff --git a/packages/integration-tests/tests/api/contracts.test.ts b/packages/integration-tests/tests/api/contracts.test.ts index dbff398343..c1b984bcb3 100644 --- a/packages/integration-tests/tests/api/contracts.test.ts +++ b/packages/integration-tests/tests/api/contracts.test.ts @@ -24,13 +24,13 @@ describe("API module: Contract", () => { //@id1696 it("Verify /api?module=contract&action=getcontractcreation&contractaddresses={address1},{address2} response", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { paymasterContract = await helper.getStringFromFile(bufferFile + Buffer.paymaster); paymasterTx = await helper.getStringFromFile(bufferFile + Buffer.paymasterDeployTx); multicallCallerContract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiCallCaller); multicallCallerTx = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallCaller); apiRoute = `/api?module=contract&action=getcontractcreation&contractaddresses=${paymasterContract},${multicallCallerContract}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.result[0]).toStrictEqual(expect.objectContaining({ contractAddress: paymasterContract })); diff --git a/packages/integration-tests/tests/api/logs.test.ts b/packages/integration-tests/tests/api/logs.test.ts index 3a4bcd4bb2..7edbcbf30d 100644 --- a/packages/integration-tests/tests/api/logs.test.ts +++ b/packages/integration-tests/tests/api/logs.test.ts @@ -22,11 +22,11 @@ describe("API module: Logs", () => { //@id1808 it("Verify /api?module=logs&action=getLogs&page={page}&offset={offset}0&toBlock={toBlock}&fromBlock={fromBlock}&address={address} response", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { contractAddress = await helper.getStringFromFile(bufferFile + Buffer.greeterL2); txHash = await helper.getStringFromFile(bufferFile + Buffer.executeGreeterTx); apiRoute = `/api?module=logs&action=getLogs&page=1&offset=10&toBlock=10000&fromBlock=1&address=${contractAddress}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.result[0]).toStrictEqual(expect.objectContaining({ address: contractAddress })); diff --git a/packages/integration-tests/tests/api/stats.test.ts b/packages/integration-tests/tests/api/stats.test.ts index 5f2704ea35..1a8482f4cd 100644 --- a/packages/integration-tests/tests/api/stats.test.ts +++ b/packages/integration-tests/tests/api/stats.test.ts @@ -10,9 +10,9 @@ describe("Stats", () => { //@id1515 it("Verify the response via /stats", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { apiRoute = `/stats`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(typeof response.body.lastSealedBatch).toStrictEqual("number"); diff --git a/packages/integration-tests/tests/api/tokens.test.ts b/packages/integration-tests/tests/api/tokens.test.ts index 6dbb897fc3..60c2375ef5 100644 --- a/packages/integration-tests/tests/api/tokens.test.ts +++ b/packages/integration-tests/tests/api/tokens.test.ts @@ -21,11 +21,11 @@ describe("Tokens", () => { describe("/tokens", () => { //@id1508 it("Verify the response via /tokens", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { const l2DepositedToken = await helper.getStringFromFile(bufferFile + Buffer.L2deposited); const l1Token = await helper.getStringFromFile(bufferFile + Buffer.L1); apiRoute = `/tokens`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(Array.isArray(response.body.items)).toStrictEqual(true); @@ -53,9 +53,9 @@ describe("Tokens", () => { //@id1456 it("Verify deployed to L2 custom token via /tokens/{tokenAddress}", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { apiRoute = `/tokens/${l2Token}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual({ @@ -80,9 +80,9 @@ describe("Tokens", () => { //@id1448 it("Verify the custom ERC20 token transfer via /tokens/{address}/transfers", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { apiRoute = `/tokens/${l2Token}/transfers?page=1&limit=10`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.items[0].amount).toBe("10000000000000000"); @@ -96,13 +96,13 @@ describe("Tokens", () => { //@id1451 it("Verify the custom token includes paymaster transaction via /tokens/{address}/transfers", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { l2Token = await helper.getStringFromFile(bufferFile + Buffer.customToken); const emptyWallet = await helper.getStringFromFile(bufferFile + Buffer.emptyWalletAddress); const paymaster = await helper.getStringFromFile(bufferFile + Buffer.paymaster); txHash = await helper.getStringFromFile(bufferFile + Buffer.paymasterTx); apiRoute = `/tokens/${l2Token}/transfers?page=1&limit=10`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: emptyWallet })); @@ -115,14 +115,14 @@ describe("Tokens", () => { //id1803 it("Verify the response via /tokens/{address}/transfers", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { l2Token = await helper.getStringFromFile(bufferFile + Buffer.customToken); const emptyWallet = await helper.getStringFromFile(bufferFile + Buffer.emptyWalletAddress); const paymaster = await helper.getStringFromFile(bufferFile + Buffer.paymaster); txHash = await helper.getStringFromFile(bufferFile + Buffer.paymasterTx); const apiRoute = `/tokens/${l2Token}/transfers?page=1&limit=10`; const decapitalizedTokenAddress = l2Token.toLowerCase(); - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: emptyWallet })); diff --git a/packages/integration-tests/tests/api/transactions.test.ts b/packages/integration-tests/tests/api/transactions.test.ts index 7510bceddd..b7c3613bea 100644 --- a/packages/integration-tests/tests/api/transactions.test.ts +++ b/packages/integration-tests/tests/api/transactions.test.ts @@ -36,10 +36,10 @@ describe("Transactions", () => { //@id1447 it("Verify transfer ETH L2-L2 via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { txHash = await helper.getStringFromFile(bufferFile + Buffer.txEthTransfer); apiRoute = `/transactions/${txHash}/transfers`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); @@ -79,10 +79,10 @@ describe("Transactions", () => { //@id1459 it("Verify the ETH withdrawal via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { txHash = await helper.getStringFromFile(bufferFile + Buffer.txEthWithdraw); apiRoute = `/transactions/${txHash}/transfers`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); @@ -131,10 +131,10 @@ describe("Transactions", () => { //@id1461 it("Verify the ETH withdrawal to the other address via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { txHash = await helper.getStringFromFile(bufferFile + Buffer.txEthWithdrawOtherAddress); apiRoute = `/transactions/${txHash}/transfers`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); @@ -183,7 +183,7 @@ describe("Transactions", () => { //@id1463 it("Verify the custom token withdrawal via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { const l1Token = bufferFile + "/" + Buffer.L1; const customTokenL1 = await helper.getStringFromFile(l1Token); const l2Token = bufferFile + "/" + Buffer.L2deposited; @@ -191,7 +191,7 @@ describe("Transactions", () => { txHash = await helper.getStringFromFile(bufferFile + Buffer.txERC20WithdrawOtherAddress); apiRoute = `/transactions/${txHash}/transfers`; const decapitalizedAddress = apiRoute.slice(1).toLowerCase(); - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(typeof response.body.items[0].amount).toStrictEqual("string"); @@ -326,10 +326,10 @@ describe("Transactions", () => { //@id1460 it("Verify the ETH withdrawal to the other address via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { txHash = await helper.getStringFromFile(bufferFile + Buffer.txEthWithdrawOtherAddress); apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.hash).toBe(txHash); @@ -372,10 +372,10 @@ describe("Transactions", () => { //@id1462 it("Verify the custom token withdrawal via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { txHash = await helper.getStringFromFile(bufferFile + Buffer.txERC20Withdraw); apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.hash).toBe(txHash); @@ -418,10 +418,10 @@ describe("Transactions", () => { //@id1458 it("Verify the ETH withdrawal via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { txHash = await helper.getStringFromFile(bufferFile + Buffer.txEthWithdraw); apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.hash).toBe(txHash); @@ -464,11 +464,11 @@ describe("Transactions", () => { //@id1478 it("Verify transaction for the ETH via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiTransferETH); contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiTransferETH); apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); @@ -511,11 +511,11 @@ describe("Transactions", () => { //@id1479 it("Verify transaction for the Custom Token I via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { contract = await helper.getStringFromFile(bufferFile + Buffer.L2); txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiTransferCustomTokenI); apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); @@ -558,11 +558,11 @@ describe("Transactions", () => { //@id1480 it("Verify transaction for the Custom Token II via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { contract = await helper.getStringFromFile(bufferFile + Buffer.L2deposited); txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiTransferCustomTokenII); apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); @@ -605,11 +605,11 @@ describe("Transactions", () => { //@id1454 it("Verify the transaction after SetGreeting execution via transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { contract = await helper.getStringFromFile(bufferFile + Buffer.greeterL2); txHash = await helper.getStringFromFile(bufferFile + Buffer.executeGreeterTx); apiRoute = `/transactions/${txHash}?page=1&limit=10`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); @@ -653,10 +653,10 @@ describe("Transactions", () => { //@id1464:I --> @id1468 it("Verify transaction for the Root contract via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallRoot); apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); @@ -701,10 +701,10 @@ describe("Transactions", () => { //@id1465:I --> @id1469 it("Verify transaction for the Middle contract via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallMiddle); apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); @@ -749,10 +749,10 @@ describe("Transactions", () => { //@id1466:I --> @id1470 it("Verify transaction for the Caller contract via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallCaller); apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); @@ -797,10 +797,10 @@ describe("Transactions", () => { //@id1471 it("Verify transaction for the use multicall contract via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { txHash = await helper.getStringFromFile(bufferFile + Buffer.txUseMultiCallContracts); apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); @@ -843,11 +843,11 @@ describe("Transactions", () => { //@id645 it("Verify the transactions with failed state via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { token = await helper.getStringFromFile(bufferFile + Buffer.L2deposited); txHash = await helper.getStringFromFile(bufferFile + Buffer.failedState); apiRoute = `/transactions/${txHash}?page=1&limit=10`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.from).toStrictEqual(Wallets.richWalletAddress); @@ -899,11 +899,11 @@ describe("Transactions", () => { //@id1481 it("Verify transaction for the ETH via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiTransferETH); txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiTransferETH); apiRoute = `/transactions/${txHash}/transfers?page=1&limit=10`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); @@ -982,12 +982,12 @@ describe("Transactions", () => { //@id1482 it("Verify transaction for the Custom tokenI via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { token = await helper.getStringFromFile(bufferFile + Buffer.L2); contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiTransferETH); txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiTransferCustomTokenI); apiRoute = `/transactions/${txHash}/transfers?page=1&limit=10`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); @@ -1064,13 +1064,13 @@ describe("Transactions", () => { //@id1483 it("Verify transaction for the Custom tokenII via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { const tokenL1 = await helper.getStringFromFile(bufferFile + Buffer.L1); token = await helper.getStringFromFile(bufferFile + Buffer.L2deposited); contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiTransferETH); txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiTransferCustomTokenII); apiRoute = `/transactions/${txHash}/transfers?page=1&limit=10`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); @@ -1147,13 +1147,13 @@ describe("Transactions", () => { //@id1452 it("Verify transaction through Paymaster via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { const paymasterAddress = await helper.getStringFromFile(bufferFile + Buffer.paymaster); const emptyWallet = await helper.getStringFromFile(bufferFile + Buffer.emptyWalletAddress); token = await helper.getStringFromFile(bufferFile + Buffer.customToken); txHash = await helper.getStringFromFile(bufferFile + Buffer.paymasterTx); apiRoute = `/transactions/${txHash}/transfers?page=1&limit=10`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: emptyWallet })); @@ -1231,11 +1231,11 @@ describe("Transactions", () => { //@id1455 it("Verify the transaction after SetGreeting execution via transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { txHash = await helper.getStringFromFile(bufferFile + Buffer.executeGreeterTx); apiRoute = `/transactions/${txHash}/transfers`; const decapitalizedAddress = apiRoute.slice(1).toLowerCase(); - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(typeof response.body.items[0].amount).toStrictEqual("string"); @@ -1311,11 +1311,11 @@ describe("Transactions", () => { //@id1472 it("Verify transaction for the Root contract via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiCallRoot); txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallRoot); apiRoute = `/transactions/${txHash}/transfers?page=1&limit=10`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); @@ -1372,11 +1372,11 @@ describe("Transactions", () => { //@id1473 it("Verify transaction for the Middle contract via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiCallRoot); txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallMiddle); apiRoute = `/transactions/${txHash}/transfers?page=1&limit=10`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); @@ -1433,11 +1433,11 @@ describe("Transactions", () => { //@id1474 it("Verify transaction for the Caller contract via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiCallRoot); txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallCaller); apiRoute = `/transactions/${txHash}/transfers?page=1&limit=10`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); @@ -1494,10 +1494,10 @@ describe("Transactions", () => { //@id1475 it("Verify transaction for the use multicall contract via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { txHash = await helper.getStringFromFile(bufferFile + Buffer.txUseMultiCallContracts); apiRoute = `/transactions/${txHash}/transfers?page=1&limit=10`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); @@ -1556,12 +1556,12 @@ describe("Transactions", () => { describe("/transactions/${txHash}/logs", () => { //@id1507 it("Verify the transaction via /transactions/{transactionHash}/logs", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { contract = await helper.getStringFromFile(bufferFile + Buffer.greeterL2); txHash = await helper.getStringFromFile(bufferFile + Buffer.executeGreeterTx); apiRoute = `/transactions/${txHash}/logs`; const decapitalizedAddress = apiRoute.slice(1).toLowerCase(); - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ address: Token.ETHER_ERC20_Address })); @@ -1608,9 +1608,9 @@ describe("Transactions", () => { describe("/transactions", () => { //@id1506 it("Verify the transaction via /transactions", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { apiRoute = `/transactions`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(Array.isArray(response.body.items)).toStrictEqual(true); @@ -1672,10 +1672,10 @@ describe("Transactions", () => { describe("/api?module=transaction", () => { //@id1697 it("Verify /api?module=transaction&action=getstatus response", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { txHash = await helper.getStringFromFile(bufferFile + Buffer.txEthTransfer); apiRoute = `/api?module=transaction&action=getstatus&txhash=${txHash}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" })); @@ -1686,10 +1686,10 @@ describe("Transactions", () => { //@id1698 it("Verify /api?module=transaction&action=gettxreceiptstatus response", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { txHash = await helper.getStringFromFile(bufferFile + Buffer.txEthTransfer); apiRoute = `/api?module=transaction&action=gettxreceiptstatus&txhash=${txHash}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" })); From a433dc905672208601cedeb6e793cca3bd429d4f Mon Sep 17 00:00:00 2001 From: pcheremu Date: Thu, 7 Mar 2024 11:44:41 +0100 Subject: [PATCH 15/28] test: fix names --- packages/integration-tests/tests/api/transactions.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/integration-tests/tests/api/transactions.test.ts b/packages/integration-tests/tests/api/transactions.test.ts index b7c3613bea..16e975652a 100644 --- a/packages/integration-tests/tests/api/transactions.test.ts +++ b/packages/integration-tests/tests/api/transactions.test.ts @@ -1,5 +1,5 @@ import { localConfig } from "../../src/config"; -import { Buffer, Token, TransactionsStatus, TransactionsType, Wallets } from "../../src/entities"; +import { Buffer, Token, TransactionStatus, TransactionsType, Wallets } from "../../src/entities"; import { Helper } from "../../src/helper"; import { Playbook } from "../../src/playbook/playbook"; @@ -853,7 +853,7 @@ describe("Transactions", () => { expect(response.body.from).toStrictEqual(Wallets.richWalletAddress); expect(response.body.to).toStrictEqual(token); expect(response.body.hash).toStrictEqual(txHash); - expect(response.body.status).toStrictEqual(TransactionsStatus.failed); + expect(response.body.status).toStrictEqual(TransactionStatus.failed); expect(response.body).toStrictEqual(expect.objectContaining({ value: "0" })); expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); From 13804431b7d07c6b37c1bac5919806229f69e941 Mon Sep 17 00:00:00 2001 From: pcheremu Date: Thu, 7 Mar 2024 12:17:53 +0100 Subject: [PATCH 16/28] test: update entities to constants name --- packages/integration-tests/README.md | 4 ++-- packages/integration-tests/src/config.ts | 2 +- packages/integration-tests/src/{entities.ts => constants.ts} | 0 packages/integration-tests/src/helper.ts | 2 +- .../integration-tests/src/playbook/deploy/deploy-greeter.ts | 2 +- .../integration-tests/src/playbook/deploy/deploy-paymaster.ts | 2 +- packages/integration-tests/src/playbook/deploy/erc20toL1.ts | 2 +- packages/integration-tests/src/playbook/deploy/erc20toL2.ts | 2 +- .../integration-tests/src/playbook/deploy/multiTransferETH.ts | 2 +- .../integration-tests/src/playbook/deploy/multicallCaller.ts | 2 +- .../integration-tests/src/playbook/deploy/multicallMiddle.ts | 2 +- .../integration-tests/src/playbook/deploy/multicallRoot.ts | 2 +- packages/integration-tests/src/playbook/deploy/nftToL1.ts | 2 +- packages/integration-tests/src/playbook/deploy/nftToL2.ts | 2 +- packages/integration-tests/src/playbook/deploy/use-greeter.ts | 4 ++-- .../integration-tests/src/playbook/deploy/use-multiCall.ts | 2 +- .../src/playbook/deploy/use-multitransferETH.ts | 2 +- .../integration-tests/src/playbook/deploy/use-paymaster.ts | 2 +- .../src/playbook/scenarios/deploy/deployERC20toL1.ts | 2 +- .../src/playbook/scenarios/deploy/deployERC20toL2.ts | 2 +- .../src/playbook/scenarios/deploy/deployGreeterToL2.ts | 2 +- .../src/playbook/scenarios/deploy/deployMulticallContracts.ts | 2 +- .../src/playbook/scenarios/deploy/deployMultitransferETH.ts | 2 +- .../src/playbook/scenarios/deploy/deployNFTtoL1.ts | 2 +- .../src/playbook/scenarios/deploy/deployNFTtoL2.ts | 2 +- .../src/playbook/scenarios/deploy/deployViaPaymaster.ts | 2 +- .../src/playbook/scenarios/deposit/depositERC20.ts | 2 +- .../src/playbook/scenarios/deposit/depositETH.ts | 2 +- .../src/playbook/scenarios/transfers/transferERC20.ts | 2 +- .../src/playbook/scenarios/transfers/transferETH.ts | 2 +- .../src/playbook/scenarios/transfers/transferFailedState.ts | 2 +- .../src/playbook/scenarios/transfers/useGreeter.ts | 2 +- .../src/playbook/scenarios/transfers/useMultiCall.ts | 2 +- .../src/playbook/scenarios/transfers/useMultitransferETH.ts | 2 +- .../src/playbook/scenarios/transfers/usePaymaster.ts | 2 +- .../src/playbook/scenarios/withdrawal/withdrawERC20.ts | 2 +- .../scenarios/withdrawal/withdrawERC20toOtherAddress.ts | 2 +- .../src/playbook/scenarios/withdrawal/withdrawETH.ts | 2 +- .../scenarios/withdrawal/withdrawETHtoOtherAddress.ts | 2 +- packages/integration-tests/src/playbook/utils/getWallet.ts | 2 +- packages/integration-tests/tests/api/accounts.test.ts | 2 +- packages/integration-tests/tests/api/addresses.test.ts | 2 +- packages/integration-tests/tests/api/contracts.test.ts | 2 +- packages/integration-tests/tests/api/logs.test.ts | 2 +- packages/integration-tests/tests/api/tokens.test.ts | 2 +- packages/integration-tests/tests/api/transactions.test.ts | 2 +- packages/integration-tests/tests/hooks/global.ts | 2 +- packages/integration-tests/tests/ui/deposit.spec.ts | 2 +- packages/integration-tests/tests/ui/multiCall.spec.ts | 2 +- packages/integration-tests/tests/ui/nft.spec.ts | 2 +- packages/integration-tests/tests/ui/transactions.spec.ts | 2 +- 51 files changed, 52 insertions(+), 52 deletions(-) rename packages/integration-tests/src/{entities.ts => constants.ts} (100%) diff --git a/packages/integration-tests/README.md b/packages/integration-tests/README.md index e989cf1693..494310f4dd 100644 --- a/packages/integration-tests/README.md +++ b/packages/integration-tests/README.md @@ -15,7 +15,7 @@ npm install cp .env.example packages/integration-tests/src/playbook/.env ``` -- Add your private wallet key to `WALLET_PRIVATE_KEY={YOUR_PRIVATE_KEY}`. By default we use `richWalletPrivateKey` private key in `integration-tests/src/playbook/utils/getWallet.ts` from `integration-tests/src/entities.ts`. +- Add your private wallet key to `WALLET_PRIVATE_KEY={YOUR_PRIVATE_KEY}`. By default we use `richWalletPrivateKey` private key in `integration-tests/src/playbook/utils/getWallet.ts` from `integration-tests/src/constants.ts`. ## Preparing a local environment @@ -48,7 +48,7 @@ If you need to exclude some specific test/suite, you can change keywords `it` to The test solution contains two main folders: [src](./src) and [tests](./tests). [src](./src) folder contains: - essential [scenarios](./src/playbook/scenarios/) -- predefined [entities](./src/entities.ts) and [config](./src/config.ts) config files +- predefined [constants](./src/constants.ts) and [config](./src/config.ts) config files - [contracts](./src/playbook/contracts/) folder with a set of contracts - [deploy](./src/playbook/deploy/) folder with a set of deploy scripts - [buffer](./src/playbook/buffer/) folder as a temporary storage of transaction hashes and addresses diff --git a/packages/integration-tests/src/config.ts b/packages/integration-tests/src/config.ts index fd139570c2..561f6b9694 100644 --- a/packages/integration-tests/src/config.ts +++ b/packages/integration-tests/src/config.ts @@ -1,4 +1,4 @@ -import { Wallets } from "./entities"; +import { Wallets } from "./constants"; export const localConfig = { gasLimit: { gasLimit: 10000000 }, diff --git a/packages/integration-tests/src/entities.ts b/packages/integration-tests/src/constants.ts similarity index 100% rename from packages/integration-tests/src/entities.ts rename to packages/integration-tests/src/constants.ts diff --git a/packages/integration-tests/src/helper.ts b/packages/integration-tests/src/helper.ts index 7f4a97c8c7..6342a76f86 100644 --- a/packages/integration-tests/src/helper.ts +++ b/packages/integration-tests/src/helper.ts @@ -6,7 +6,7 @@ import * as request from "supertest"; import { Provider } from "zksync-web3"; import { environment, localConfig } from "./config"; -import { Logger } from "./entities"; +import { Logger } from "./constants"; import type { BaseProvider } from "@ethersproject/providers/src.ts/base-provider"; diff --git a/packages/integration-tests/src/playbook/deploy/deploy-greeter.ts b/packages/integration-tests/src/playbook/deploy/deploy-greeter.ts index ae4d4d9da6..c9291e7c6e 100644 --- a/packages/integration-tests/src/playbook/deploy/deploy-greeter.ts +++ b/packages/integration-tests/src/playbook/deploy/deploy-greeter.ts @@ -2,7 +2,7 @@ import { Deployer } from "@matterlabs/hardhat-zksync-deploy"; import { promises as fs } from "fs"; import { localConfig } from "../../config"; -import { Buffer } from "../../entities"; +import { Buffer } from "../../constants"; import getWallet from "../utils/getWallet"; import type { HardhatRuntimeEnvironment } from "hardhat/types"; diff --git a/packages/integration-tests/src/playbook/deploy/deploy-paymaster.ts b/packages/integration-tests/src/playbook/deploy/deploy-paymaster.ts index 468e7cc9d5..7c82c1f8b3 100644 --- a/packages/integration-tests/src/playbook/deploy/deploy-paymaster.ts +++ b/packages/integration-tests/src/playbook/deploy/deploy-paymaster.ts @@ -3,7 +3,7 @@ import * as ethers from "ethers"; import { promises as fs } from "fs"; import { Wallet } from "zksync-web3"; -import { Buffer, Wallets } from "../../entities"; +import { Buffer, Wallets } from "../../constants"; import type { HardhatRuntimeEnvironment } from "hardhat/types"; diff --git a/packages/integration-tests/src/playbook/deploy/erc20toL1.ts b/packages/integration-tests/src/playbook/deploy/erc20toL1.ts index 63b7b72200..b675e55207 100644 --- a/packages/integration-tests/src/playbook/deploy/erc20toL1.ts +++ b/packages/integration-tests/src/playbook/deploy/erc20toL1.ts @@ -2,7 +2,7 @@ import { promises as fs } from "fs"; import { ethers } from "hardhat"; import { localConfig } from "../../config"; -import { Buffer, Wallets } from "../../entities"; +import { Buffer, Wallets } from "../../constants"; async function main() { const [deployer] = await ethers.getSigners(); diff --git a/packages/integration-tests/src/playbook/deploy/erc20toL2.ts b/packages/integration-tests/src/playbook/deploy/erc20toL2.ts index cbebe93761..13964be03f 100644 --- a/packages/integration-tests/src/playbook/deploy/erc20toL2.ts +++ b/packages/integration-tests/src/playbook/deploy/erc20toL2.ts @@ -2,7 +2,7 @@ import { Deployer } from "@matterlabs/hardhat-zksync-deploy"; import { promises as fs } from "fs"; import { localConfig } from "../../config"; -import { Buffer } from "../../entities"; +import { Buffer } from "../../constants"; import getWallet from "../utils/getWallet"; import type { HardhatRuntimeEnvironment } from "hardhat/types"; diff --git a/packages/integration-tests/src/playbook/deploy/multiTransferETH.ts b/packages/integration-tests/src/playbook/deploy/multiTransferETH.ts index 73b1924d62..6a8dd60492 100644 --- a/packages/integration-tests/src/playbook/deploy/multiTransferETH.ts +++ b/packages/integration-tests/src/playbook/deploy/multiTransferETH.ts @@ -1,7 +1,7 @@ import { Deployer } from "@matterlabs/hardhat-zksync-deploy"; import { promises as fs } from "fs"; -import { Buffer, Wallets } from "../../entities"; +import { Buffer, Wallets } from "../../constants"; import verify from "../utils/displayVerificationInfo"; import getWallet from "../utils/getWallet"; diff --git a/packages/integration-tests/src/playbook/deploy/multicallCaller.ts b/packages/integration-tests/src/playbook/deploy/multicallCaller.ts index d609e8e28a..d88d228e6d 100644 --- a/packages/integration-tests/src/playbook/deploy/multicallCaller.ts +++ b/packages/integration-tests/src/playbook/deploy/multicallCaller.ts @@ -1,7 +1,7 @@ import { Deployer } from "@matterlabs/hardhat-zksync-deploy"; import { promises as fs } from "fs"; -import { Buffer } from "../../entities"; +import { Buffer } from "../../constants"; import { Helper } from "../../helper"; import getWallet from "../utils/getWallet"; diff --git a/packages/integration-tests/src/playbook/deploy/multicallMiddle.ts b/packages/integration-tests/src/playbook/deploy/multicallMiddle.ts index c4feb61249..7eb8e9ad99 100644 --- a/packages/integration-tests/src/playbook/deploy/multicallMiddle.ts +++ b/packages/integration-tests/src/playbook/deploy/multicallMiddle.ts @@ -1,7 +1,7 @@ import { Deployer } from "@matterlabs/hardhat-zksync-deploy"; import { promises as fs } from "fs"; -import { Buffer } from "../../entities"; +import { Buffer } from "../../constants"; import { Helper } from "../../helper"; import getWallet from "../utils/getWallet"; diff --git a/packages/integration-tests/src/playbook/deploy/multicallRoot.ts b/packages/integration-tests/src/playbook/deploy/multicallRoot.ts index b0236342a9..d06b991af9 100644 --- a/packages/integration-tests/src/playbook/deploy/multicallRoot.ts +++ b/packages/integration-tests/src/playbook/deploy/multicallRoot.ts @@ -1,7 +1,7 @@ import { Deployer } from "@matterlabs/hardhat-zksync-deploy"; import { promises as fs } from "fs"; -import { Buffer } from "../../entities"; +import { Buffer } from "../../constants"; import getWallet from "../utils/getWallet"; import type { HardhatRuntimeEnvironment } from "hardhat/types"; diff --git a/packages/integration-tests/src/playbook/deploy/nftToL1.ts b/packages/integration-tests/src/playbook/deploy/nftToL1.ts index fb1af7d58b..c08f68dfb8 100644 --- a/packages/integration-tests/src/playbook/deploy/nftToL1.ts +++ b/packages/integration-tests/src/playbook/deploy/nftToL1.ts @@ -2,7 +2,7 @@ import { promises as fs } from "fs"; import { ethers } from "hardhat"; import * as hardhatConfig from "hardhat"; -import { Buffer, Wallets } from "../../entities"; +import { Buffer, Wallets } from "../../constants"; import type { HardhatRuntimeEnvironment } from "hardhat/types"; diff --git a/packages/integration-tests/src/playbook/deploy/nftToL2.ts b/packages/integration-tests/src/playbook/deploy/nftToL2.ts index 6ae5c15547..4b90bc5073 100644 --- a/packages/integration-tests/src/playbook/deploy/nftToL2.ts +++ b/packages/integration-tests/src/playbook/deploy/nftToL2.ts @@ -1,7 +1,7 @@ import { Deployer } from "@matterlabs/hardhat-zksync-deploy"; import { promises as fs } from "fs"; -import { Buffer, Wallets } from "../../entities"; +import { Buffer, Wallets } from "../../constants"; import displayVerificationInfo from "../utils/displayVerificationInfo"; import getWallet from "../utils/getWallet"; diff --git a/packages/integration-tests/src/playbook/deploy/use-greeter.ts b/packages/integration-tests/src/playbook/deploy/use-greeter.ts index d11a3b6610..3b07fcbe85 100644 --- a/packages/integration-tests/src/playbook/deploy/use-greeter.ts +++ b/packages/integration-tests/src/playbook/deploy/use-greeter.ts @@ -3,8 +3,8 @@ import { promises as fs } from "fs"; import { Provider, Wallet } from "zksync-web3"; import { localConfig } from "../../config"; -import { Wallets } from "../../entities"; -import { Buffer } from "../../entities"; +import { Wallets } from "../../constants"; +import { Buffer } from "../../constants"; import { Helper } from "../../helper"; import type { HardhatRuntimeEnvironment } from "hardhat/types"; diff --git a/packages/integration-tests/src/playbook/deploy/use-multiCall.ts b/packages/integration-tests/src/playbook/deploy/use-multiCall.ts index 5941892677..9df21e5fb6 100644 --- a/packages/integration-tests/src/playbook/deploy/use-multiCall.ts +++ b/packages/integration-tests/src/playbook/deploy/use-multiCall.ts @@ -3,7 +3,7 @@ import { promises as fs } from "fs"; import { Provider } from "zksync-web3"; import { localConfig } from "../../config"; -import { Buffer } from "../../entities"; +import { Buffer } from "../../constants"; import { Helper } from "../../helper"; import getWallet from "../utils/getWallet"; diff --git a/packages/integration-tests/src/playbook/deploy/use-multitransferETH.ts b/packages/integration-tests/src/playbook/deploy/use-multitransferETH.ts index b28765f570..4eafe6cb14 100644 --- a/packages/integration-tests/src/playbook/deploy/use-multitransferETH.ts +++ b/packages/integration-tests/src/playbook/deploy/use-multitransferETH.ts @@ -3,7 +3,7 @@ import { promises as fs } from "fs"; import { Provider, Wallet } from "zksync-web3"; import { localConfig } from "../../config"; -import { Buffer, Token, Wallets } from "../../entities"; +import { Buffer, Token, Wallets } from "../../constants"; import { Helper } from "../../helper"; import type { HardhatRuntimeEnvironment } from "hardhat/types"; diff --git a/packages/integration-tests/src/playbook/deploy/use-paymaster.ts b/packages/integration-tests/src/playbook/deploy/use-paymaster.ts index c98d397eaa..64a760f322 100644 --- a/packages/integration-tests/src/playbook/deploy/use-paymaster.ts +++ b/packages/integration-tests/src/playbook/deploy/use-paymaster.ts @@ -3,7 +3,7 @@ import { promises as fs } from "fs"; import { Provider, utils, Wallet } from "zksync-web3"; import { localConfig } from "../../config"; -import { Buffer } from "../../entities"; +import { Buffer } from "../../constants"; import { Helper } from "../../helper"; import type { HardhatRuntimeEnvironment } from "hardhat/types"; diff --git a/packages/integration-tests/src/playbook/scenarios/deploy/deployERC20toL1.ts b/packages/integration-tests/src/playbook/scenarios/deploy/deployERC20toL1.ts index 5860c7bc50..bea9cab022 100644 --- a/packages/integration-tests/src/playbook/scenarios/deploy/deployERC20toL1.ts +++ b/packages/integration-tests/src/playbook/scenarios/deploy/deployERC20toL1.ts @@ -1,4 +1,4 @@ -import { Buffer, Logger } from "../../../entities"; +import { Buffer, Logger } from "../../../constants"; import { Helper } from "../../../helper"; export const deployERC20toL1 = async function () { diff --git a/packages/integration-tests/src/playbook/scenarios/deploy/deployERC20toL2.ts b/packages/integration-tests/src/playbook/scenarios/deploy/deployERC20toL2.ts index 469ae20867..d893ce7e2a 100644 --- a/packages/integration-tests/src/playbook/scenarios/deploy/deployERC20toL2.ts +++ b/packages/integration-tests/src/playbook/scenarios/deploy/deployERC20toL2.ts @@ -1,4 +1,4 @@ -import { Buffer, Logger } from "../../../entities"; +import { Buffer, Logger } from "../../../constants"; import { Helper } from "../../../helper"; export const deployERC20toL2 = async function () { diff --git a/packages/integration-tests/src/playbook/scenarios/deploy/deployGreeterToL2.ts b/packages/integration-tests/src/playbook/scenarios/deploy/deployGreeterToL2.ts index 934b175849..85ee571822 100644 --- a/packages/integration-tests/src/playbook/scenarios/deploy/deployGreeterToL2.ts +++ b/packages/integration-tests/src/playbook/scenarios/deploy/deployGreeterToL2.ts @@ -1,4 +1,4 @@ -import { Buffer, Logger } from "../../../entities"; +import { Buffer, Logger } from "../../../constants"; import { Helper } from "../../../helper"; let deployedContract: string; diff --git a/packages/integration-tests/src/playbook/scenarios/deploy/deployMulticallContracts.ts b/packages/integration-tests/src/playbook/scenarios/deploy/deployMulticallContracts.ts index bded14535f..5414e0a948 100644 --- a/packages/integration-tests/src/playbook/scenarios/deploy/deployMulticallContracts.ts +++ b/packages/integration-tests/src/playbook/scenarios/deploy/deployMulticallContracts.ts @@ -1,4 +1,4 @@ -import { Buffer } from "../../../entities"; +import { Buffer } from "../../../constants"; import { Helper } from "../../../helper"; export const deployMulticallContracts = async function () { diff --git a/packages/integration-tests/src/playbook/scenarios/deploy/deployMultitransferETH.ts b/packages/integration-tests/src/playbook/scenarios/deploy/deployMultitransferETH.ts index f86b1a1e73..2a5112cd6b 100644 --- a/packages/integration-tests/src/playbook/scenarios/deploy/deployMultitransferETH.ts +++ b/packages/integration-tests/src/playbook/scenarios/deploy/deployMultitransferETH.ts @@ -1,4 +1,4 @@ -import { Buffer } from "../../../entities"; +import { Buffer } from "../../../constants"; import { Helper } from "../../../helper"; export const deployMultitransferETH = async function () { diff --git a/packages/integration-tests/src/playbook/scenarios/deploy/deployNFTtoL1.ts b/packages/integration-tests/src/playbook/scenarios/deploy/deployNFTtoL1.ts index ad59eb971a..25ab4f3756 100644 --- a/packages/integration-tests/src/playbook/scenarios/deploy/deployNFTtoL1.ts +++ b/packages/integration-tests/src/playbook/scenarios/deploy/deployNFTtoL1.ts @@ -1,4 +1,4 @@ -import { Buffer, Logger } from "../../../entities"; +import { Buffer, Logger } from "../../../constants"; import { Helper } from "../../../helper"; export const deployNFTtoL1 = async function () { diff --git a/packages/integration-tests/src/playbook/scenarios/deploy/deployNFTtoL2.ts b/packages/integration-tests/src/playbook/scenarios/deploy/deployNFTtoL2.ts index 25925e28b0..856e2f48df 100644 --- a/packages/integration-tests/src/playbook/scenarios/deploy/deployNFTtoL2.ts +++ b/packages/integration-tests/src/playbook/scenarios/deploy/deployNFTtoL2.ts @@ -1,4 +1,4 @@ -import { Buffer, Logger } from "../../../entities"; +import { Buffer, Logger } from "../../../constants"; import { Helper } from "../../../helper"; export const deployNFTtoL2 = async function () { diff --git a/packages/integration-tests/src/playbook/scenarios/deploy/deployViaPaymaster.ts b/packages/integration-tests/src/playbook/scenarios/deploy/deployViaPaymaster.ts index d047685687..71a1807344 100644 --- a/packages/integration-tests/src/playbook/scenarios/deploy/deployViaPaymaster.ts +++ b/packages/integration-tests/src/playbook/scenarios/deploy/deployViaPaymaster.ts @@ -1,4 +1,4 @@ -import { Buffer } from "../../../entities"; +import { Buffer } from "../../../constants"; import { Helper } from "../../../helper"; export const deployViaPaymaster = async function () { diff --git a/packages/integration-tests/src/playbook/scenarios/deposit/depositERC20.ts b/packages/integration-tests/src/playbook/scenarios/deposit/depositERC20.ts index 0d3a48d1cb..ab36021949 100644 --- a/packages/integration-tests/src/playbook/scenarios/deposit/depositERC20.ts +++ b/packages/integration-tests/src/playbook/scenarios/deposit/depositERC20.ts @@ -3,7 +3,7 @@ import { promises as fs } from "fs"; import * as zksync from "zksync-web3"; import { localConfig } from "../../../config"; -import { Buffer, Logger, Wallets } from "../../../entities"; +import { Buffer, Logger, Wallets } from "../../../constants"; import { Helper } from "../../../helper"; const helper = new Helper(); diff --git a/packages/integration-tests/src/playbook/scenarios/deposit/depositETH.ts b/packages/integration-tests/src/playbook/scenarios/deposit/depositETH.ts index f15e27b30b..c5d966adc7 100644 --- a/packages/integration-tests/src/playbook/scenarios/deposit/depositETH.ts +++ b/packages/integration-tests/src/playbook/scenarios/deposit/depositETH.ts @@ -3,7 +3,7 @@ import { promises as fs } from "fs"; import * as zksync from "zksync-web3"; import { localConfig } from "../../../config"; -import { Buffer, Logger } from "../../../entities"; +import { Buffer, Logger } from "../../../constants"; import { Helper } from "../../../helper"; export const depositEth = async function (sum = "0.000009") { diff --git a/packages/integration-tests/src/playbook/scenarios/transfers/transferERC20.ts b/packages/integration-tests/src/playbook/scenarios/transfers/transferERC20.ts index 80f19d3905..8b8e524694 100644 --- a/packages/integration-tests/src/playbook/scenarios/transfers/transferERC20.ts +++ b/packages/integration-tests/src/playbook/scenarios/transfers/transferERC20.ts @@ -3,7 +3,7 @@ import { promises as fs } from "fs"; import * as zksync from "zksync-web3"; import { localConfig } from "../../../config"; -import { Buffer, Logger, Wallets } from "../../../entities"; +import { Buffer, Logger, Wallets } from "../../../constants"; import { Helper } from "../../../helper"; export const transferERC20 = async function (sum: string, tokenAddress: string, tokenName?: string /*, units = 18*/) { diff --git a/packages/integration-tests/src/playbook/scenarios/transfers/transferETH.ts b/packages/integration-tests/src/playbook/scenarios/transfers/transferETH.ts index fdd21c6e51..6367b87a3a 100644 --- a/packages/integration-tests/src/playbook/scenarios/transfers/transferETH.ts +++ b/packages/integration-tests/src/playbook/scenarios/transfers/transferETH.ts @@ -3,7 +3,7 @@ import { promises as fs } from "fs"; import * as zksync from "zksync-web3"; import { localConfig } from "../../../config"; -import { Buffer, Logger, Wallets } from "../../../entities"; +import { Buffer, Logger, Wallets } from "../../../constants"; import { Helper } from "../../../helper"; export const transferEth = async function (sum = "0.000009", address: string = Wallets.mainWalletPrivateKey) { diff --git a/packages/integration-tests/src/playbook/scenarios/transfers/transferFailedState.ts b/packages/integration-tests/src/playbook/scenarios/transfers/transferFailedState.ts index c798cf6a61..29ae716d39 100644 --- a/packages/integration-tests/src/playbook/scenarios/transfers/transferFailedState.ts +++ b/packages/integration-tests/src/playbook/scenarios/transfers/transferFailedState.ts @@ -3,7 +3,7 @@ import { promises as fs } from "fs"; import * as zksync from "zksync-web3"; import { localConfig } from "../../../config"; -import { Buffer, Logger } from "../../../entities"; +import { Buffer, Logger } from "../../../constants"; import { Helper } from "../../../helper"; export const transferFailedState = async function (tokenAddress: string, tokenName?: string) { diff --git a/packages/integration-tests/src/playbook/scenarios/transfers/useGreeter.ts b/packages/integration-tests/src/playbook/scenarios/transfers/useGreeter.ts index f9f77d2e36..03f05fb217 100644 --- a/packages/integration-tests/src/playbook/scenarios/transfers/useGreeter.ts +++ b/packages/integration-tests/src/playbook/scenarios/transfers/useGreeter.ts @@ -1,4 +1,4 @@ -import { Buffer } from "../../../entities"; +import { Buffer } from "../../../constants"; import { Helper } from "../../../helper"; export const useGreeter = async function () { diff --git a/packages/integration-tests/src/playbook/scenarios/transfers/useMultiCall.ts b/packages/integration-tests/src/playbook/scenarios/transfers/useMultiCall.ts index 6abde94494..c17807d568 100644 --- a/packages/integration-tests/src/playbook/scenarios/transfers/useMultiCall.ts +++ b/packages/integration-tests/src/playbook/scenarios/transfers/useMultiCall.ts @@ -1,4 +1,4 @@ -import { Buffer } from "../../../entities"; +import { Buffer } from "../../../constants"; import { Helper } from "../../../helper"; export const useMultiCallContracts = async function () { diff --git a/packages/integration-tests/src/playbook/scenarios/transfers/useMultitransferETH.ts b/packages/integration-tests/src/playbook/scenarios/transfers/useMultitransferETH.ts index 40ed959414..31b2917654 100644 --- a/packages/integration-tests/src/playbook/scenarios/transfers/useMultitransferETH.ts +++ b/packages/integration-tests/src/playbook/scenarios/transfers/useMultitransferETH.ts @@ -1,4 +1,4 @@ -import { Buffer } from "../../../entities"; +import { Buffer } from "../../../constants"; import { Helper } from "../../../helper"; export const useMultitransferETH = async function () { diff --git a/packages/integration-tests/src/playbook/scenarios/transfers/usePaymaster.ts b/packages/integration-tests/src/playbook/scenarios/transfers/usePaymaster.ts index 8c667be1c5..cce46c4bc1 100644 --- a/packages/integration-tests/src/playbook/scenarios/transfers/usePaymaster.ts +++ b/packages/integration-tests/src/playbook/scenarios/transfers/usePaymaster.ts @@ -1,4 +1,4 @@ -import { Buffer } from "../../../entities"; +import { Buffer } from "../../../constants"; import { Helper } from "../../../helper"; export const usePaymaster = async function () { diff --git a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20.ts b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20.ts index 7bcb910033..ecd33fe152 100644 --- a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20.ts +++ b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20.ts @@ -3,7 +3,7 @@ import { promises as fs } from "fs"; import * as zksync from "zksync-web3"; import { localConfig } from "../../../config"; -import { Buffer, Logger, Wallets } from "../../../entities"; +import { Buffer, Logger, Wallets } from "../../../constants"; import { Helper } from "../../../helper"; export const withdrawERC20 = async function (tokenAddress: string, sum = "0.2") { diff --git a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20toOtherAddress.ts b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20toOtherAddress.ts index cf377733b6..66de2badc9 100644 --- a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20toOtherAddress.ts +++ b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20toOtherAddress.ts @@ -3,7 +3,7 @@ import { promises as fs } from "fs"; import * as zksync from "zksync-web3"; import { localConfig } from "../../../config"; -import { Buffer, Logger, Wallets } from "../../../entities"; +import { Buffer, Logger, Wallets } from "../../../constants"; import { Helper } from "../../../helper"; export const withdrawERC20toOtherAddress = async function (tokenAddress: string, sum = "0.2") { diff --git a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETH.ts b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETH.ts index 5c2598a6d6..4bd76049ab 100644 --- a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETH.ts +++ b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETH.ts @@ -3,7 +3,7 @@ import { promises as fs } from "fs"; import * as zksync from "zksync-web3"; import { localConfig } from "../../../config"; -import { Buffer, Logger } from "../../../entities"; +import { Buffer, Logger } from "../../../constants"; import { Helper } from "../../../helper"; export const withdrawETH = async function (sum = "0.000009") { diff --git a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETHtoOtherAddress.ts b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETHtoOtherAddress.ts index 6adde5510c..f4ed657ae0 100644 --- a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETHtoOtherAddress.ts +++ b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETHtoOtherAddress.ts @@ -3,7 +3,7 @@ import { promises as fs } from "fs"; import * as zksync from "zksync-web3"; import { localConfig } from "../../../config"; -import { Buffer, Logger, Wallets } from "../../../entities"; +import { Buffer, Logger, Wallets } from "../../../constants"; import { Helper } from "../../../helper"; export const withdrawETHtoOtherAddress = async function (sum = "0.000009") { diff --git a/packages/integration-tests/src/playbook/utils/getWallet.ts b/packages/integration-tests/src/playbook/utils/getWallet.ts index c956b5148e..cee3ccef70 100644 --- a/packages/integration-tests/src/playbook/utils/getWallet.ts +++ b/packages/integration-tests/src/playbook/utils/getWallet.ts @@ -1,7 +1,7 @@ import { getDefaultProvider, utils } from "ethers"; import { Provider, Wallet } from "zksync-web3"; -import { Wallets } from "../../entities"; +import { Wallets } from "../../constants"; // eslint-disable-next-line @typescript-eslint/no-explicit-any export default async function (hre: any) { diff --git a/packages/integration-tests/tests/api/accounts.test.ts b/packages/integration-tests/tests/api/accounts.test.ts index 11440a8520..065363a605 100644 --- a/packages/integration-tests/tests/api/accounts.test.ts +++ b/packages/integration-tests/tests/api/accounts.test.ts @@ -2,7 +2,7 @@ import * as request from "supertest"; import { environment } from "../../src/config"; import { localConfig } from "../../src/config"; -import { Buffer, Token, Wallets } from "../../src/entities"; +import { Buffer, Token, Wallets } from "../../src/constants"; import { Helper } from "../../src/helper"; import { Playbook } from "../../src/playbook/playbook"; diff --git a/packages/integration-tests/tests/api/addresses.test.ts b/packages/integration-tests/tests/api/addresses.test.ts index daf65881a3..8b26ea85a1 100644 --- a/packages/integration-tests/tests/api/addresses.test.ts +++ b/packages/integration-tests/tests/api/addresses.test.ts @@ -1,5 +1,5 @@ import { localConfig } from "../../src/config"; -import { Buffer, Token, Wallets } from "../../src/entities"; +import { Buffer, Token, Wallets } from "../../src/constants"; import { Helper } from "../../src/helper"; import { Playbook } from "../../src/playbook/playbook"; diff --git a/packages/integration-tests/tests/api/contracts.test.ts b/packages/integration-tests/tests/api/contracts.test.ts index c1b984bcb3..09169f6db4 100644 --- a/packages/integration-tests/tests/api/contracts.test.ts +++ b/packages/integration-tests/tests/api/contracts.test.ts @@ -1,5 +1,5 @@ import { localConfig } from "../../src/config"; -import { Buffer, Wallets } from "../../src/entities"; +import { Buffer, Wallets } from "../../src/constants"; import { Helper } from "../../src/helper"; import { Playbook } from "../../src/playbook/playbook"; diff --git a/packages/integration-tests/tests/api/logs.test.ts b/packages/integration-tests/tests/api/logs.test.ts index 7edbcbf30d..ff881c81ec 100644 --- a/packages/integration-tests/tests/api/logs.test.ts +++ b/packages/integration-tests/tests/api/logs.test.ts @@ -1,5 +1,5 @@ import { localConfig } from "../../src/config"; -import { Buffer } from "../../src/entities"; +import { Buffer } from "../../src/constants"; import { Helper } from "../../src/helper"; import { Playbook } from "../../src/playbook/playbook"; diff --git a/packages/integration-tests/tests/api/tokens.test.ts b/packages/integration-tests/tests/api/tokens.test.ts index 60c2375ef5..cea4b6a50e 100644 --- a/packages/integration-tests/tests/api/tokens.test.ts +++ b/packages/integration-tests/tests/api/tokens.test.ts @@ -1,5 +1,5 @@ import { localConfig } from "../../src/config"; -import { Buffer, Token, TransactionsType, Wallets } from "../../src/entities"; +import { Buffer, Token, TransactionsType, Wallets } from "../../src/constants"; import { Helper } from "../../src/helper"; import { Playbook } from "../../src/playbook/playbook"; diff --git a/packages/integration-tests/tests/api/transactions.test.ts b/packages/integration-tests/tests/api/transactions.test.ts index 16e975652a..fef4d32a84 100644 --- a/packages/integration-tests/tests/api/transactions.test.ts +++ b/packages/integration-tests/tests/api/transactions.test.ts @@ -1,5 +1,5 @@ import { localConfig } from "../../src/config"; -import { Buffer, Token, TransactionStatus, TransactionsType, Wallets } from "../../src/entities"; +import { Buffer, Token, TransactionStatus, TransactionsType, Wallets } from "../../src/constants"; import { Helper } from "../../src/helper"; import { Playbook } from "../../src/playbook/playbook"; diff --git a/packages/integration-tests/tests/hooks/global.ts b/packages/integration-tests/tests/hooks/global.ts index 2512d8878f..0ec0903f5c 100644 --- a/packages/integration-tests/tests/hooks/global.ts +++ b/packages/integration-tests/tests/hooks/global.ts @@ -1,4 +1,4 @@ -import { Buffer } from "../../src/entities"; +import { Buffer } from "../../src/constants"; import { Helper } from "../../src/helper"; import { Playbook } from "../../src/playbook/playbook"; diff --git a/packages/integration-tests/tests/ui/deposit.spec.ts b/packages/integration-tests/tests/ui/deposit.spec.ts index 5d6f5f2431..57aac180cf 100644 --- a/packages/integration-tests/tests/ui/deposit.spec.ts +++ b/packages/integration-tests/tests/ui/deposit.spec.ts @@ -1,7 +1,7 @@ import { expect, test } from "@playwright/test"; import { config } from "./config"; -import { BlockExplorer, Buffer, Wallets } from "../../src/entities"; +import { BlockExplorer, Buffer, Wallets } from "../../src/constants"; import { Helper } from "../../src/helper"; import type { Locator } from "@playwright/test"; diff --git a/packages/integration-tests/tests/ui/multiCall.spec.ts b/packages/integration-tests/tests/ui/multiCall.spec.ts index 38e723834d..bd7607943f 100644 --- a/packages/integration-tests/tests/ui/multiCall.spec.ts +++ b/packages/integration-tests/tests/ui/multiCall.spec.ts @@ -1,7 +1,7 @@ import { expect, test } from "@playwright/test"; import { config } from "./config"; -import { BlockExplorer, Buffer } from "../../src/entities"; +import { BlockExplorer, Buffer } from "../../src/constants"; import { Helper } from "../../src/helper"; import type { Locator } from "@playwright/test"; diff --git a/packages/integration-tests/tests/ui/nft.spec.ts b/packages/integration-tests/tests/ui/nft.spec.ts index 2e301ed232..ea24620a62 100644 --- a/packages/integration-tests/tests/ui/nft.spec.ts +++ b/packages/integration-tests/tests/ui/nft.spec.ts @@ -1,7 +1,7 @@ import { expect, test } from "@playwright/test"; import { config } from "./config"; -import { BlockExplorer, Buffer } from "../../src/entities"; +import { BlockExplorer, Buffer } from "../../src/constants"; import { Helper } from "../../src/helper"; import type { Locator } from "@playwright/test"; diff --git a/packages/integration-tests/tests/ui/transactions.spec.ts b/packages/integration-tests/tests/ui/transactions.spec.ts index 22f923bf1e..8ac394b2ff 100644 --- a/packages/integration-tests/tests/ui/transactions.spec.ts +++ b/packages/integration-tests/tests/ui/transactions.spec.ts @@ -1,7 +1,7 @@ import { expect, test } from "@playwright/test"; import { config } from "./config"; -import { BlockExplorer, Buffer } from "../../src/entities"; +import { BlockExplorer, Buffer } from "../../src/constants"; import { Helper } from "../../src/helper"; import type { Locator } from "@playwright/test"; From d589cc01fd6371e87d71275ff5a44afbca5f45ba Mon Sep 17 00:00:00 2001 From: pcheremu Date: Thu, 7 Mar 2024 12:24:17 +0100 Subject: [PATCH 17/28] test: update enum Token names --- packages/integration-tests/src/constants.ts | 8 +- .../playbook/deploy/use-multitransferETH.ts | 2 +- .../tests/api/accounts.test.ts | 4 +- .../tests/api/addresses.test.ts | 4 +- .../tests/api/transactions.test.ts | 252 +++++++----------- 5 files changed, 110 insertions(+), 160 deletions(-) diff --git a/packages/integration-tests/src/constants.ts b/packages/integration-tests/src/constants.ts index 132773d91e..33a89704a7 100644 --- a/packages/integration-tests/src/constants.ts +++ b/packages/integration-tests/src/constants.ts @@ -44,13 +44,13 @@ export enum Logger { } export enum Token { - CUST_Address = "0x0928008B245A76E105E02C522b5d309c0887ecA5", + // CUST_Address = "0x0928008B245A76E105E02C522b5d309c0887ecA5",// probably unused customL2TokenName = "L2 ERC20 token", customL2TokenSymbol = "L2", customL2TokenDecimals = 18, - ETHER_PULL_Address = "0x0000000000000000000000000000000000008001", - ETHER_Address = "0x0000000000000000000000000000000000000000", - ETHER_ERC20_Address = "0x000000000000000000000000000000000000800A", + pullAddressETH = "0x0000000000000000000000000000000000008001", + addressETH = "0x0000000000000000000000000000000000000000", + ERC20AddressETH = "0x000000000000000000000000000000000000800A", } export enum TransactionsType { diff --git a/packages/integration-tests/src/playbook/deploy/use-multitransferETH.ts b/packages/integration-tests/src/playbook/deploy/use-multitransferETH.ts index 4eafe6cb14..752426a319 100644 --- a/packages/integration-tests/src/playbook/deploy/use-multitransferETH.ts +++ b/packages/integration-tests/src/playbook/deploy/use-multitransferETH.ts @@ -22,7 +22,7 @@ export default async function callMultiTransferETH(hre: HardhatRuntimeEnvironmen const mainWalletAddress = Wallets.mainWalletAddress; const secondaryWalletAddress = Wallets.secondaryWalletAddress; // type of coin, contract - const etherAddress = Token.ETHER_Address; //ETH + const etherAddress = Token.addressETH; //ETH const customTokenI = await helper.getStringFromFile(firstToken); const customTokenII = await helper.getStringFromFile(secondToken); // amount of funds diff --git a/packages/integration-tests/tests/api/accounts.test.ts b/packages/integration-tests/tests/api/accounts.test.ts index 065363a605..6d6a3da7ad 100644 --- a/packages/integration-tests/tests/api/accounts.test.ts +++ b/packages/integration-tests/tests/api/accounts.test.ts @@ -63,7 +63,7 @@ describe("API module: Account", () => { //@id1705 it("Verify /api?module=account&action=tokenbalance response", async () => { await helper.runRetriableTestAction(async () => { - apiRoute = `/api?module=account&action=tokenbalance&contractaddress=${Token.ETHER_ERC20_Address}&address=${Wallets.richWalletAddress}`; + apiRoute = `/api?module=account&action=tokenbalance&contractaddress=${Token.ERC20AddressETH}&address=${Wallets.richWalletAddress}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); @@ -176,7 +176,7 @@ describe("API module: Account", () => { await helper.runRetriableTestAction(async () => { const blocks = await request(environment.blockExplorerAPI).get("/blocks"); const blockNumber = blocks.body.items[0].number; - apiRoute = `/api?module=account&action=tokentx&page=1&offset=10&sort=desc&endblock=${blockNumber}&startblock=0&contractaddress=${Token.ETHER_ERC20_Address}&address=${Wallets.richWalletAddress}`; + apiRoute = `/api?module=account&action=tokentx&page=1&offset=10&sort=desc&endblock=${blockNumber}&startblock=0&contractaddress=${Token.ERC20AddressETH}&address=${Wallets.richWalletAddress}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); console.log(apiRoute); diff --git a/packages/integration-tests/tests/api/addresses.test.ts b/packages/integration-tests/tests/api/addresses.test.ts index 8b26ea85a1..6ebf5a9533 100644 --- a/packages/integration-tests/tests/api/addresses.test.ts +++ b/packages/integration-tests/tests/api/addresses.test.ts @@ -203,9 +203,7 @@ describe("Address", () => { expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: contract })); expect(typeof response.body.items[1].timestamp).toStrictEqual("string"); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ amount: "30000000000000000" })); - expect(response.body.items[1]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ type: "transfer" })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ fields: null })); expect(response.body.meta).toStrictEqual(expect.objectContaining({ totalItems: 2 })); diff --git a/packages/integration-tests/tests/api/transactions.test.ts b/packages/integration-tests/tests/api/transactions.test.ts index fef4d32a84..f5875cf311 100644 --- a/packages/integration-tests/tests/api/transactions.test.ts +++ b/packages/integration-tests/tests/api/transactions.test.ts @@ -43,14 +43,12 @@ describe("Transactions", () => { expect(response.status).toBe(200); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_PULL_Address })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.pullAddressETH })); expect(typeof response.body.items[0].blockNumber).toStrictEqual("number"); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); expect(typeof response.body.items[0].timestamp).toStrictEqual("string"); expect(typeof response.body.items[0].amount).toStrictEqual("string"); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: "fee" })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenType: "ETH" })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); @@ -60,8 +58,8 @@ describe("Transactions", () => { token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -86,15 +84,13 @@ describe("Transactions", () => { expect(response.status).toBe(200); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_PULL_Address })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.pullAddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: "fee" })); expect(typeof response.body.items[0].blockNumber).toStrictEqual("number"); expect(typeof response.body.items[0].timestamp).toStrictEqual("string"); expect(typeof response.body.items[0].amount).toStrictEqual("string"); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenType: "ETH" })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ isInternal: false })); @@ -103,8 +99,8 @@ describe("Transactions", () => { token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -113,7 +109,7 @@ describe("Transactions", () => { }) ); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_ERC20_Address })); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: Token.ERC20AddressETH })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ amount: "9000000000000" })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ type: "transfer" })); @@ -122,7 +118,7 @@ describe("Transactions", () => { expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ amount: "9000000000000" })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ type: "withdrawal" })); - expect(response.body.items[3]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + expect(response.body.items[3]).toStrictEqual(expect.objectContaining({ from: Token.pullAddressETH })); expect(response.body.items[3]).toStrictEqual(expect.objectContaining({ to: Wallets.richWalletAddress })); expect(response.body.items[3]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); expect(response.body.items[3]).toStrictEqual(expect.objectContaining({ type: "refund" })); @@ -138,15 +134,13 @@ describe("Transactions", () => { expect(response.status).toBe(200); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_PULL_Address })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.pullAddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: "fee" })); expect(typeof response.body.items[0].blockNumber).toStrictEqual("number"); expect(typeof response.body.items[0].timestamp).toStrictEqual("string"); expect(typeof response.body.items[0].amount).toStrictEqual("string"); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenType: "ETH" })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ isInternal: false })); @@ -155,8 +149,8 @@ describe("Transactions", () => { token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -165,7 +159,7 @@ describe("Transactions", () => { }) ); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_ERC20_Address })); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: Token.ERC20AddressETH })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ amount: "9000000000000" })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ type: "transfer" })); @@ -174,7 +168,7 @@ describe("Transactions", () => { expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ amount: "9000000000000" })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ type: "withdrawal" })); - expect(response.body.items[3]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + expect(response.body.items[3]).toStrictEqual(expect.objectContaining({ from: Token.pullAddressETH })); expect(response.body.items[3]).toStrictEqual(expect.objectContaining({ to: Wallets.richWalletAddress })); expect(response.body.items[3]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); expect(response.body.items[3]).toStrictEqual(expect.objectContaining({ type: "refund" })); @@ -200,19 +194,17 @@ describe("Transactions", () => { expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ isInternal: false })); expect(typeof response.body.items[0].timestamp).toStrictEqual("string"); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_PULL_Address })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.pullAddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); expect(response.body.items[0]).toStrictEqual( expect.objectContaining({ token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -228,7 +220,7 @@ describe("Transactions", () => { expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ isInternal: false })); expect(typeof response.body.items[1].timestamp).toStrictEqual("string"); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_Address })); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: Token.addressETH })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ tokenAddress: customTokenL2 })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ type: TransactionsType.transfer })); @@ -277,22 +269,20 @@ describe("Transactions", () => { expect(typeof response.body.items[3].amount).toStrictEqual("string"); expect(typeof response.body.items[3].blockNumber).toStrictEqual("number"); expect(response.body.items[3]).toStrictEqual(expect.objectContaining({ fields: null })); - expect(response.body.items[3]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + expect(response.body.items[3]).toStrictEqual(expect.objectContaining({ from: Token.pullAddressETH })); expect(response.body.items[3]).toStrictEqual(expect.objectContaining({ isInternal: false })); expect(typeof response.body.items[3].timestamp).toStrictEqual("string"); expect(response.body.items[3]).toStrictEqual(expect.objectContaining({ to: Wallets.richWalletAddress })); expect(response.body.items[3]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[3]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[3]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[3]).toStrictEqual(expect.objectContaining({ type: TransactionsType.refund })); expect(response.body.items[3]).toStrictEqual( expect.objectContaining({ token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -907,11 +897,9 @@ describe("Transactions", () => { expect(response.status).toBe(200); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_PULL_Address })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.pullAddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ isInternal: false })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); @@ -924,8 +912,8 @@ describe("Transactions", () => { token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -936,9 +924,7 @@ describe("Transactions", () => { expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: contract })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[1]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ type: TransactionsType.transfer })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ fields: null })); expect(response.body.items[1]).toStrictEqual( @@ -946,8 +932,8 @@ describe("Transactions", () => { token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -955,12 +941,10 @@ describe("Transactions", () => { }, }) ); - expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ from: Token.pullAddressETH })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ to: Wallets.richWalletAddress })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[2]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ type: TransactionsType.refund })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ fields: null })); expect(response.body.items[2]).toStrictEqual( @@ -968,8 +952,8 @@ describe("Transactions", () => { token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -991,11 +975,9 @@ describe("Transactions", () => { expect(response.status).toBe(200); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_PULL_Address })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.pullAddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ isInternal: false })); @@ -1008,8 +990,8 @@ describe("Transactions", () => { token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -1037,12 +1019,10 @@ describe("Transactions", () => { }, }) ); - expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ from: Token.pullAddressETH })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ to: Wallets.richWalletAddress })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[2]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ type: TransactionsType.refund })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ fields: null })); expect(response.body.items[2]).toStrictEqual( @@ -1050,8 +1030,8 @@ describe("Transactions", () => { token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -1074,11 +1054,9 @@ describe("Transactions", () => { expect(response.status).toBe(200); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_PULL_Address })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.pullAddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ isInternal: false })); @@ -1091,8 +1069,8 @@ describe("Transactions", () => { token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -1120,12 +1098,10 @@ describe("Transactions", () => { }, }) ); - expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ from: Token.pullAddressETH })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ to: Wallets.richWalletAddress })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[2]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ type: TransactionsType.refund })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ fields: null })); expect(response.body.items[2]).toStrictEqual( @@ -1133,8 +1109,8 @@ describe("Transactions", () => { token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -1183,11 +1159,9 @@ describe("Transactions", () => { }) ); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: paymasterAddress })); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_PULL_Address })); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: Token.pullAddressETH })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[1]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ fields: null })); expect(response.body.items[1]).toStrictEqual( @@ -1195,8 +1169,8 @@ describe("Transactions", () => { token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -1204,12 +1178,10 @@ describe("Transactions", () => { }, }) ); - expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ from: Token.pullAddressETH })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ to: paymasterAddress })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[2]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ type: TransactionsType.refund })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ fields: null })); expect(response.body.items[2]).toStrictEqual( @@ -1217,8 +1189,8 @@ describe("Transactions", () => { token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -1244,11 +1216,9 @@ describe("Transactions", () => { expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ isInternal: false })); expect(typeof response.body.items[0].timestamp).toStrictEqual("string"); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_PULL_Address })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.pullAddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenType: "ETH" })); expect(response.body.items[0]).toStrictEqual( @@ -1256,8 +1226,8 @@ describe("Transactions", () => { token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -1269,22 +1239,20 @@ describe("Transactions", () => { expect(typeof response.body.items[1].amount).toStrictEqual("string"); expect(typeof response.body.items[1].blockNumber).toStrictEqual("number"); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ fields: null })); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Token.pullAddressETH })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ isInternal: false })); expect(typeof response.body.items[1].timestamp).toStrictEqual("string"); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: Wallets.richWalletAddress })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[1]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ type: TransactionsType.refund })); expect(response.body.items[1]).toStrictEqual( expect.objectContaining({ token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -1319,11 +1287,9 @@ describe("Transactions", () => { expect(response.status).toBe(200); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_PULL_Address })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.pullAddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ isInternal: false })); @@ -1336,8 +1302,8 @@ describe("Transactions", () => { token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -1345,12 +1311,10 @@ describe("Transactions", () => { }, }) ); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Token.pullAddressETH })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: Wallets.richWalletAddress })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[1]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ type: TransactionsType.refund })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ fields: null })); expect(response.body.items[1]).toStrictEqual( @@ -1358,8 +1322,8 @@ describe("Transactions", () => { token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -1380,11 +1344,9 @@ describe("Transactions", () => { expect(response.status).toBe(200); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_PULL_Address })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.pullAddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ isInternal: false })); @@ -1397,8 +1359,8 @@ describe("Transactions", () => { token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -1406,12 +1368,10 @@ describe("Transactions", () => { }, }) ); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Token.pullAddressETH })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: Wallets.richWalletAddress })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[1]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ type: TransactionsType.refund })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ fields: null })); expect(response.body.items[1]).toStrictEqual( @@ -1419,8 +1379,8 @@ describe("Transactions", () => { token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -1441,11 +1401,9 @@ describe("Transactions", () => { expect(response.status).toBe(200); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_PULL_Address })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.pullAddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ isInternal: false })); @@ -1458,8 +1416,8 @@ describe("Transactions", () => { token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -1467,12 +1425,10 @@ describe("Transactions", () => { }, }) ); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Token.pullAddressETH })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: Wallets.richWalletAddress })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[1]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ type: TransactionsType.refund })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ fields: null })); expect(response.body.items[1]).toStrictEqual( @@ -1480,8 +1436,8 @@ describe("Transactions", () => { token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -1501,11 +1457,9 @@ describe("Transactions", () => { expect(response.status).toBe(200); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_PULL_Address })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.pullAddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ isInternal: false })); @@ -1518,8 +1472,8 @@ describe("Transactions", () => { token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -1527,12 +1481,10 @@ describe("Transactions", () => { }, }) ); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Token.pullAddressETH })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: Wallets.richWalletAddress })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[1]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ type: TransactionsType.refund })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ fields: null })); expect(response.body.items[1]).toStrictEqual( @@ -1540,8 +1492,8 @@ describe("Transactions", () => { token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -1564,7 +1516,7 @@ describe("Transactions", () => { response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ address: Token.ETHER_ERC20_Address })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ address: Token.ERC20AddressETH })); expect(Array.isArray(response.body.items[0].topics)).toStrictEqual(true); expect(typeof response.body.items[0].data).toStrictEqual("string"); expect(typeof response.body.items[0].blockNumber).toStrictEqual("number"); @@ -1580,7 +1532,7 @@ describe("Transactions", () => { expect(typeof response.body.items[1].transactionIndex).toStrictEqual("number"); expect(typeof response.body.items[1].logIndex).toStrictEqual("number"); expect(typeof response.body.items[1].timestamp).toStrictEqual("string"); - expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ address: Token.ETHER_ERC20_Address })); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ address: Token.ERC20AddressETH })); expect(Array.isArray(response.body.items[2].topics)).toStrictEqual(true); expect(typeof response.body.items[2].data).toStrictEqual("string"); expect(typeof response.body.items[2].blockNumber).toStrictEqual("number"); From aa893c030ed20651f366f1b895a1f7277676b952 Mon Sep 17 00:00:00 2001 From: pcheremu Date: Thu, 7 Mar 2024 12:35:36 +0100 Subject: [PATCH 18/28] test: update executeScript function to exec() method --- packages/integration-tests/src/helper.ts | 30 +++++++++++++------ .../scenarios/deposit/depositERC20.ts | 2 +- .../playbook/scenarios/deposit/depositETH.ts | 2 +- .../scenarios/transfers/transferERC20.ts | 2 +- .../scenarios/transfers/transferETH.ts | 2 +- .../transfers/transferFailedState.ts | 2 +- .../scenarios/withdrawal/withdrawERC20.ts | 2 +- .../withdrawal/withdrawERC20toOtherAddress.ts | 2 +- .../scenarios/withdrawal/withdrawETH.ts | 2 +- .../withdrawal/withdrawETHtoOtherAddress.ts | 2 +- 10 files changed, 30 insertions(+), 18 deletions(-) diff --git a/packages/integration-tests/src/helper.ts b/packages/integration-tests/src/helper.ts index 6342a76f86..d18ad051ff 100644 --- a/packages/integration-tests/src/helper.ts +++ b/packages/integration-tests/src/helper.ts @@ -1,4 +1,4 @@ -import { execSync } from "child_process"; +import { exec } from "child_process"; import { ethers } from "ethers"; import { promises as fs } from "fs"; import * as path from "path"; @@ -11,7 +11,7 @@ import { Logger } from "./constants"; import type { BaseProvider } from "@ethersproject/providers/src.ts/base-provider"; export class Helper { - async txHashLogger(txType: string, txValue: string, tokenName?: string) { + async logTransaction(txType: string, txValue: string, tokenName?: string) { const logMessage = `TxHash for ${txType} ${Logger.textSeparator} ${txValue}`; if (tokenName === undefined) { @@ -22,14 +22,26 @@ export class Helper { } async executeScript(script: string) { - const output = execSync(script, { encoding: "utf-8" }); + return new Promise((resolve, reject) => { + exec(script, { encoding: "utf-8" }, (error, stdout, stderr) => { + if (error) { + console.error(`Error executing script "${script}":`, error); + reject(error); + } else { + console.log(`> Run NPM Script "${script}":\n`, stdout); + resolve(stdout); + } + }); + }); - try { - console.log(`> Run NPM Script "${script}":\n`, output); - return output; - } catch (e) { - console.log(e); - } + // const output = execSync(script, { encoding: "utf-8" }); + + // try { + // console.log(`> Run NPM Script "${script}":\n`, output); + // return output; + // } catch (e) { + // console.log(e); + // } } async getStringFromFile(fileName: string) { diff --git a/packages/integration-tests/src/playbook/scenarios/deposit/depositERC20.ts b/packages/integration-tests/src/playbook/scenarios/deposit/depositERC20.ts index ab36021949..98d1f1701d 100644 --- a/packages/integration-tests/src/playbook/scenarios/deposit/depositERC20.ts +++ b/packages/integration-tests/src/playbook/scenarios/deposit/depositERC20.ts @@ -29,7 +29,7 @@ export const depositERC20 = async function (sum = "0.5", tokenAddress: string, u const l2TokenAddress = await syncProvider.l2TokenAddress(tokenAddress); console.log("L2 token address ", l2TokenAddress); const txHash = await deposit.waitFinalize(); - await helper.txHashLogger(Logger.deposit, txHash.transactionHash, "ERC20 token"); + await helper.logTransaction(Logger.deposit, txHash.transactionHash, "ERC20 token"); await fs.writeFile(bufferAddressL2DepositedFile, l2TokenAddress); await fs.writeFile(bufferTxErc20DepositFile, txHash.transactionHash); diff --git a/packages/integration-tests/src/playbook/scenarios/deposit/depositETH.ts b/packages/integration-tests/src/playbook/scenarios/deposit/depositETH.ts index c5d966adc7..98d99f8aa1 100644 --- a/packages/integration-tests/src/playbook/scenarios/deposit/depositETH.ts +++ b/packages/integration-tests/src/playbook/scenarios/deposit/depositETH.ts @@ -21,7 +21,7 @@ export const depositEth = async function (sum = "0.000009") { }); await deposit.wait(1); const txHash = await deposit.waitFinalize(); - await helper.txHashLogger(Logger.deposit, txHash.transactionHash, "ETH"); + await helper.logTransaction(Logger.deposit, txHash.transactionHash, "ETH"); await fs.writeFile(bufferFile, txHash.transactionHash); return txHash; diff --git a/packages/integration-tests/src/playbook/scenarios/transfers/transferERC20.ts b/packages/integration-tests/src/playbook/scenarios/transfers/transferERC20.ts index 8b8e524694..3ab4e41e36 100644 --- a/packages/integration-tests/src/playbook/scenarios/transfers/transferERC20.ts +++ b/packages/integration-tests/src/playbook/scenarios/transfers/transferERC20.ts @@ -23,7 +23,7 @@ export const transferERC20 = async function (sum: string, tokenAddress: string, }); const txHash = transfer.hash; - await helper.txHashLogger(Logger.transfer, txHash, tokenName); + await helper.logTransaction(Logger.transfer, txHash, tokenName); await fs.writeFile(bufferFile, txHash); return txHash; diff --git a/packages/integration-tests/src/playbook/scenarios/transfers/transferETH.ts b/packages/integration-tests/src/playbook/scenarios/transfers/transferETH.ts index 6367b87a3a..e616a84c44 100644 --- a/packages/integration-tests/src/playbook/scenarios/transfers/transferETH.ts +++ b/packages/integration-tests/src/playbook/scenarios/transfers/transferETH.ts @@ -22,7 +22,7 @@ export const transferEth = async function (sum = "0.000009", address: string = W }); const txHash = transfer.hash; - await helper.txHashLogger(Logger.transfer, txHash, "ETH"); + await helper.logTransaction(Logger.transfer, txHash, "ETH"); await fs.writeFile(bufferFile, txHash); return txHash; diff --git a/packages/integration-tests/src/playbook/scenarios/transfers/transferFailedState.ts b/packages/integration-tests/src/playbook/scenarios/transfers/transferFailedState.ts index 29ae716d39..6a90a2241e 100644 --- a/packages/integration-tests/src/playbook/scenarios/transfers/transferFailedState.ts +++ b/packages/integration-tests/src/playbook/scenarios/transfers/transferFailedState.ts @@ -23,7 +23,7 @@ export const transferFailedState = async function (tokenAddress: string, tokenNa }); const txHash = transfer.hash; - await helper.txHashLogger(Logger.txFailedState, txHash, tokenName); + await helper.logTransaction(Logger.txFailedState, txHash, tokenName); await fs.writeFile(bufferFile, txHash); return txHash; diff --git a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20.ts b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20.ts index ecd33fe152..08be5788a9 100644 --- a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20.ts +++ b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20.ts @@ -36,7 +36,7 @@ export const withdrawERC20 = async function (tokenAddress: string, sum = "0.2") console.log(`Your balance is ${balanceAfter.toString()}`); - await helper.txHashLogger(Logger.withdraw, txHash, "Custom token"); + await helper.logTransaction(Logger.withdraw, txHash, "Custom token"); await fs.writeFile(bufferFile, txHash); return txHash; diff --git a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20toOtherAddress.ts b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20toOtherAddress.ts index 66de2badc9..9d93e74dc1 100644 --- a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20toOtherAddress.ts +++ b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20toOtherAddress.ts @@ -36,7 +36,7 @@ export const withdrawERC20toOtherAddress = async function (tokenAddress: string, console.log(`Your balance is ${balanceAfter.toString()}`); - await helper.txHashLogger(Logger.withdraw, txHash, "Custom token"); + await helper.logTransaction(Logger.withdraw, txHash, "Custom token"); await fs.writeFile(bufferFile, txHash); return txHash; diff --git a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETH.ts b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETH.ts index 4bd76049ab..d2faa8ffab 100644 --- a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETH.ts +++ b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETH.ts @@ -22,7 +22,7 @@ export const withdrawETH = async function (sum = "0.000009") { const txHash = withdrawL2.hash; await withdrawL2.waitFinalize(); - await helper.txHashLogger(Logger.withdraw, txHash, "ETH"); + await helper.logTransaction(Logger.withdraw, txHash, "ETH"); await fs.writeFile(bufferFile, txHash); return txHash; diff --git a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETHtoOtherAddress.ts b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETHtoOtherAddress.ts index f4ed657ae0..847ebafd87 100644 --- a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETHtoOtherAddress.ts +++ b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETHtoOtherAddress.ts @@ -23,7 +23,7 @@ export const withdrawETHtoOtherAddress = async function (sum = "0.000009") { const txHash = withdrawL2.hash; await withdrawL2.waitFinalize(); - await helper.txHashLogger(Logger.withdraw, txHash, "ETH"); + await helper.logTransaction(Logger.withdraw, txHash, "ETH"); await fs.writeFile(bufferFile, txHash); return txHash; From 0ccaf8fdfb56bcc5326f737aeb4957386010fdde Mon Sep 17 00:00:00 2001 From: pcheremu Date: Thu, 7 Mar 2024 14:18:01 +0100 Subject: [PATCH 19/28] test: big change in path to set it constants and make them crossplatform --- packages/integration-tests/src/constants.ts | 73 +++++++------ packages/integration-tests/src/helper.ts | 15 +-- .../src/playbook/deploy/multicallCaller.ts | 5 +- .../src/playbook/deploy/multicallMiddle.ts | 5 +- .../src/playbook/deploy/use-greeter.ts | 2 +- .../src/playbook/deploy/use-multiCall.ts | 8 +- .../playbook/deploy/use-multitransferETH.ts | 12 +-- .../src/playbook/deploy/use-paymaster.ts | 6 +- .../scenarios/deploy/deployERC20toL1.ts | 10 +- .../scenarios/deploy/deployERC20toL2.ts | 10 +- .../scenarios/deploy/deployGreeterToL2.ts | 10 +- .../deploy/deployMulticallContracts.ts | 20 ++-- .../deploy/deployMultitransferETH.ts | 13 +-- .../scenarios/deploy/deployNFTtoL1.ts | 10 +- .../scenarios/deploy/deployNFTtoL2.ts | 10 +- .../scenarios/deploy/deployViaPaymaster.ts | 13 +-- .../scenarios/deposit/depositERC20.ts | 8 +- .../playbook/scenarios/deposit/depositETH.ts | 6 +- .../scenarios/transfers/transferERC20.ts | 6 +- .../scenarios/transfers/transferETH.ts | 6 +- .../transfers/transferFailedState.ts | 6 +- .../scenarios/transfers/useGreeter.ts | 10 +- .../scenarios/transfers/useMultiCall.ts | 10 +- .../transfers/useMultitransferETH.ts | 22 ++-- .../scenarios/transfers/usePaymaster.ts | 10 +- .../scenarios/withdrawal/withdrawERC20.ts | 6 +- .../withdrawal/withdrawERC20toOtherAddress.ts | 6 +- .../scenarios/withdrawal/withdrawETH.ts | 6 +- .../withdrawal/withdrawETHtoOtherAddress.ts | 6 +- .../tests/api/accounts.test.ts | 2 +- .../tests/api/addresses.test.ts | 30 +++--- .../tests/api/contracts.test.ts | 8 +- .../integration-tests/tests/api/logs.test.ts | 4 +- .../tests/api/tokens.test.ts | 25 +++-- .../tests/api/transactions.test.ts | 100 +++++++++--------- .../integration-tests/tests/hooks/global.ts | 2 +- .../tests/ui/deposit.spec.ts | 4 +- .../tests/ui/multiCall.spec.ts | 6 +- .../integration-tests/tests/ui/nft.spec.ts | 4 +- .../tests/ui/transactions.spec.ts | 4 +- 40 files changed, 246 insertions(+), 273 deletions(-) diff --git a/packages/integration-tests/src/constants.ts b/packages/integration-tests/src/constants.ts index 33a89704a7..1ad300052c 100644 --- a/packages/integration-tests/src/constants.ts +++ b/packages/integration-tests/src/constants.ts @@ -1,39 +1,46 @@ +import * as path from "path"; + export enum Buffer { - greeterL2 = "./buffer/greeterL2.txt", - executeGreeterTx = "./buffer/executeGreeterTx.txt", - NFTtoL1 = "./buffer/NFTtoL1.txt", - NFTtoL2 = "./buffer/NFTtoL2.txt", - L1 = "./buffer/L1.txt", - L2 = "./buffer/L2.txt", - L2deposited = "./buffer/L2deposited.txt", - paymaster = "./buffer/paymaster.txt", - paymasterDeployTx = "./buffer/paymasterDeployTx.txt", - paymasterTx = "./buffer/paymasterTx.txt", - addressMultiTransferETH = "./buffer/multiTransferETH.txt", - txMultiTransferETH = "./buffer/txMultiTransferETH.txt", - txMultiTransferCustomTokenI = "./buffer/txMultiTransferCustomTokenI.txt", - txMultiTransferCustomTokenII = "./buffer/txMultiTransferCustomTokenII.txt", - addressMultiCallMiddle = "./buffer/multiCallMiddle.txt", - addressMultiCallCaller = "./buffer/multiCallCaller.txt", - addressMultiCallRoot = "./buffer/multiCallRoot.txt", - txMultiCallMiddle = "./buffer/txMultiCallMiddle.txt", - txMultiCallCaller = "./buffer/txMultiCallCaller.txt", - txMultiCallRoot = "./buffer/txmultiCallRoot.txt", - txUseMultiCallContracts = "./buffer/txUseMultiCallContracts.txt", - txEthTransfer = "./buffer/txEthTransfer.txt", - txERC20Withdraw = "./buffer/txERC20Withdraw.txt", - txERC20WithdrawOtherAddress = "./buffer/txERC20WithdrawOtherAddress.txt", - txEthWithdraw = "./buffer/txEthWithdraw.txt", - txEthWithdrawOtherAddress = "./buffer/txEthWithdrawOtherAddress.txt", - txERC20Transfer = "./buffer/txERC20Transfer.txt", - emptyWalletPrivateKey = "./buffer/emptyWalletPrivateKey.txt", - emptyWalletAddress = "./buffer/emptyWalletAddress.txt", - failedState = "./buffer/failedState.txt", - customToken = "./buffer/customToken.txt", - txEthDeposit = "./buffer/txEthDeposit.txt", - txERC20Deposit = "./buffer/txERC20Deposit.txt", + greeterL2 = "greeterL2.txt", + executeGreeterTx = "executeGreeterTx.txt", + NFTtoL1 = "NFTtoL1.txt", + NFTtoL2 = "NFTtoL2.txt", + L1 = "L1.txt", + L2 = "L2.txt", + L2deposited = "L2deposited.txt", + paymaster = "paymaster.txt", + paymasterDeployTx = "paymasterDeployTx.txt", + paymasterTx = "paymasterTx.txt", + addressMultiTransferETH = "multiTransferETH.txt", + txMultiTransferETH = "txMultiTransferETH.txt", + txMultiTransferCustomTokenI = "txMultiTransferCustomTokenI.txt", + txMultiTransferCustomTokenII = "txMultiTransferCustomTokenII.txt", + addressMultiCallMiddle = "multiCallMiddle.txt", + addressMultiCallCaller = "multiCallCaller.txt", + addressMultiCallRoot = "multiCallRoot.txt", + txMultiCallMiddle = "txMultiCallMiddle.txt", + txMultiCallCaller = "txMultiCallCaller.txt", + txMultiCallRoot = "txmultiCallRoot.txt", + txUseMultiCallContracts = "txUseMultiCallContracts.txt", + txEthTransfer = "txEthTransfer.txt", + txERC20Withdraw = "txERC20Withdraw.txt", + txERC20WithdrawOtherAddress = "txERC20WithdrawOtherAddress.txt", + txEthWithdraw = "txEthWithdraw.txt", + txEthWithdrawOtherAddress = "txEthWithdrawOtherAddress.txt", + txERC20Transfer = "txERC20Transfer.txt", + emptyWalletPrivateKey = "emptyWalletPrivateKey.txt", + emptyWalletAddress = "emptyWalletAddress.txt", + failedState = "failedState.txt", + customToken = "customToken.txt", + txEthDeposit = "txEthDeposit.txt", + txERC20Deposit = "txERC20Deposit.txt", } +export const Path = { + playbookRoot: path.join("src", "playbook"), + absolutePathToBufferFiles: path.join(__dirname, "..", "src", "playbook", "buffer"), +}; + export enum Logger { deposit = "DEPOSIT", withdraw = "WITHDRAW", diff --git a/packages/integration-tests/src/helper.ts b/packages/integration-tests/src/helper.ts index d18ad051ff..8b26397289 100644 --- a/packages/integration-tests/src/helper.ts +++ b/packages/integration-tests/src/helper.ts @@ -33,24 +33,15 @@ export class Helper { } }); }); - - // const output = execSync(script, { encoding: "utf-8" }); - - // try { - // console.log(`> Run NPM Script "${script}":\n`, output); - // return output; - // } catch (e) { - // console.log(e); - // } } - async getStringFromFile(fileName: string) { - const absoluteRoute = path.join(__dirname, "..", fileName); + async readFile(filePath: string, fileName: string) { + const absoluteRoute = path.join(filePath + fileName); try { return await fs.readFile(absoluteRoute, { encoding: "utf-8" }); } catch { - console.log(`There is no the expected file: ${fileName}`); + console.log(`There is no the expected file: ${fileName} in ${filePath}`); } } diff --git a/packages/integration-tests/src/playbook/deploy/multicallCaller.ts b/packages/integration-tests/src/playbook/deploy/multicallCaller.ts index d88d228e6d..537e7abb37 100644 --- a/packages/integration-tests/src/playbook/deploy/multicallCaller.ts +++ b/packages/integration-tests/src/playbook/deploy/multicallCaller.ts @@ -1,7 +1,7 @@ import { Deployer } from "@matterlabs/hardhat-zksync-deploy"; import { promises as fs } from "fs"; -import { Buffer } from "../../constants"; +import { Buffer, Path } from "../../constants"; import { Helper } from "../../helper"; import getWallet from "../utils/getWallet"; @@ -10,7 +10,6 @@ import type { HardhatRuntimeEnvironment } from "hardhat/types"; export default async function (hre: HardhatRuntimeEnvironment) { console.log(`Running deploy script for the contract`); const helper = new Helper(); - const playbookRoot = "src/playbook/"; const wallet = await getWallet(hre); // Create deployer object and load the artifact of the contract we want to deploy. @@ -18,7 +17,7 @@ export default async function (hre: HardhatRuntimeEnvironment) { const artifact = await deployer.loadArtifact("GCaller"); // Deploy this contract. The returned object will be of a `Contract` type, similarly to ones in `ethers`. - const addressContractMiddle = await helper.getStringFromFile(playbookRoot + Buffer.addressMultiCallMiddle); + const addressContractMiddle = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiCallMiddle); const contractConstructorArguments = [addressContractMiddle]; console.log(`Arguments for the contract constructor: ${JSON.stringify(contractConstructorArguments)}`); const deployedContract = await deployer.deploy(artifact, contractConstructorArguments); diff --git a/packages/integration-tests/src/playbook/deploy/multicallMiddle.ts b/packages/integration-tests/src/playbook/deploy/multicallMiddle.ts index 7eb8e9ad99..c694f3407a 100644 --- a/packages/integration-tests/src/playbook/deploy/multicallMiddle.ts +++ b/packages/integration-tests/src/playbook/deploy/multicallMiddle.ts @@ -1,7 +1,7 @@ import { Deployer } from "@matterlabs/hardhat-zksync-deploy"; import { promises as fs } from "fs"; -import { Buffer } from "../../constants"; +import { Buffer, Path } from "../../constants"; import { Helper } from "../../helper"; import getWallet from "../utils/getWallet"; @@ -11,7 +11,6 @@ export default async function (hre: HardhatRuntimeEnvironment) { console.log(`Running deploy script for the contract`); const helper = new Helper(); - const playbookRoot = "src/playbook/"; const wallet = await getWallet(hre); // Create deployer object and load the artifact of the contract we want to deploy. @@ -19,7 +18,7 @@ export default async function (hre: HardhatRuntimeEnvironment) { const artifact = await deployer.loadArtifact("Middle"); // Deploy this contract. The returned object will be of a `Contract` type, similarly to ones in `ethers`. - const addressContractRoot = await helper.getStringFromFile(playbookRoot + Buffer.addressMultiCallRoot); + const addressContractRoot = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiCallRoot); const contractConstructorArguments = [addressContractRoot]; console.log(`Arguments for the contract constructor: ${JSON.stringify(contractConstructorArguments)}`); const deployedContract = await deployer.deploy(artifact, contractConstructorArguments); diff --git a/packages/integration-tests/src/playbook/deploy/use-greeter.ts b/packages/integration-tests/src/playbook/deploy/use-greeter.ts index 3b07fcbe85..38a91fb9f7 100644 --- a/packages/integration-tests/src/playbook/deploy/use-greeter.ts +++ b/packages/integration-tests/src/playbook/deploy/use-greeter.ts @@ -14,7 +14,7 @@ export default async function (hre: HardhatRuntimeEnvironment) { const helper = new Helper(); let contract: any; // eslint-disable-line - const greeterContractAddress = await helper.getStringFromFile(bufferRoute + Buffer.greeterL2); + const greeterContractAddress = await helper.readFile(bufferRoute + Buffer.greeterL2); const provider = new Provider(localConfig.L2Network); const wallet = new Wallet(Wallets.richWalletPrivateKey, provider); diff --git a/packages/integration-tests/src/playbook/deploy/use-multiCall.ts b/packages/integration-tests/src/playbook/deploy/use-multiCall.ts index 9df21e5fb6..cf72140aae 100644 --- a/packages/integration-tests/src/playbook/deploy/use-multiCall.ts +++ b/packages/integration-tests/src/playbook/deploy/use-multiCall.ts @@ -3,7 +3,7 @@ import { promises as fs } from "fs"; import { Provider } from "zksync-web3"; import { localConfig } from "../../config"; -import { Buffer } from "../../constants"; +import { Buffer, Path } from "../../constants"; import { Helper } from "../../helper"; import getWallet from "../utils/getWallet"; @@ -11,8 +11,10 @@ import type { HardhatRuntimeEnvironment } from "hardhat/types"; export default async function (hre: HardhatRuntimeEnvironment) { const helper = new Helper(); - const playbookRoot = "src/playbook/"; - const TRANSFER_CONTRACT_ADDRESS = await helper.getStringFromFile(playbookRoot + Buffer.addressMultiCallCaller); + const TRANSFER_CONTRACT_ADDRESS = await helper.readFile( + Path.absolutePathToBufferFiles, + Buffer.addressMultiCallCaller + ); const CONTRACT_NAME = "GCaller"; console.log(`Running deploy script for the contract`); diff --git a/packages/integration-tests/src/playbook/deploy/use-multitransferETH.ts b/packages/integration-tests/src/playbook/deploy/use-multitransferETH.ts index 752426a319..0cf2f076fd 100644 --- a/packages/integration-tests/src/playbook/deploy/use-multitransferETH.ts +++ b/packages/integration-tests/src/playbook/deploy/use-multitransferETH.ts @@ -3,19 +3,15 @@ import { promises as fs } from "fs"; import { Provider, Wallet } from "zksync-web3"; import { localConfig } from "../../config"; -import { Buffer, Token, Wallets } from "../../constants"; +import { Buffer, Path, Token, Wallets } from "../../constants"; import { Helper } from "../../helper"; import type { HardhatRuntimeEnvironment } from "hardhat/types"; export default async function callMultiTransferETH(hre: HardhatRuntimeEnvironment) { const helper = new Helper(); - const playbookRoot = "src/playbook/"; - const firstToken = playbookRoot + Buffer.L2; - const secondToken = playbookRoot + Buffer.L2deposited; - const buffer = playbookRoot + Buffer.addressMultiTransferETH; const contractName = "TokenF2L2"; // insert the name of the contract you want to deploy - const contractAddress = await helper.getStringFromFile(buffer); + const contractAddress = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiTransferETH); //wallets, To const richWalletAddress = Wallets.richWalletAddress; @@ -23,8 +19,8 @@ export default async function callMultiTransferETH(hre: HardhatRuntimeEnvironmen const secondaryWalletAddress = Wallets.secondaryWalletAddress; // type of coin, contract const etherAddress = Token.addressETH; //ETH - const customTokenI = await helper.getStringFromFile(firstToken); - const customTokenII = await helper.getStringFromFile(secondToken); + const customTokenI = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.L2); + const customTokenII = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.L2deposited); // amount of funds const ethAmount = ethers.utils.parseEther("0.0001"); const customTokenIAmount = ethers.utils.parseUnits("0.01", 18); diff --git a/packages/integration-tests/src/playbook/deploy/use-paymaster.ts b/packages/integration-tests/src/playbook/deploy/use-paymaster.ts index 64a760f322..0315bcb78b 100644 --- a/packages/integration-tests/src/playbook/deploy/use-paymaster.ts +++ b/packages/integration-tests/src/playbook/deploy/use-paymaster.ts @@ -12,9 +12,9 @@ const helper = new Helper(); export default async function (hre: HardhatRuntimeEnvironment) { const bufferRoute = "src/playbook/"; - const PAYMASTER_ADDRESS = await helper.getStringFromFile(bufferRoute + Buffer.paymaster); - const TOKEN_ADDRESS = await helper.getStringFromFile(bufferRoute + Buffer.customToken); - const EMPTY_WALLET_PRIVATE_KEY = await helper.getStringFromFile(bufferRoute + Buffer.emptyWalletPrivateKey); + const PAYMASTER_ADDRESS = await helper.readFile(bufferRoute + Buffer.paymaster); + const TOKEN_ADDRESS = await helper.readFile(bufferRoute + Buffer.customToken); + const EMPTY_WALLET_PRIVATE_KEY = await helper.readFile(bufferRoute + Buffer.emptyWalletPrivateKey); const provider = new Provider(localConfig.L2Network); const emptyWallet = new Wallet(EMPTY_WALLET_PRIVATE_KEY, provider); diff --git a/packages/integration-tests/src/playbook/scenarios/deploy/deployERC20toL1.ts b/packages/integration-tests/src/playbook/scenarios/deploy/deployERC20toL1.ts index bea9cab022..e93e06f5a6 100644 --- a/packages/integration-tests/src/playbook/scenarios/deploy/deployERC20toL1.ts +++ b/packages/integration-tests/src/playbook/scenarios/deploy/deployERC20toL1.ts @@ -1,15 +1,13 @@ -import { Buffer, Logger } from "../../../constants"; +import { Buffer, Logger, Path } from "../../../constants"; import { Helper } from "../../../helper"; export const deployERC20toL1 = async function () { const helper = new Helper(); - const playbookRoot = "src/playbook"; - const bufferFile = playbookRoot + "/" + Buffer.L1; - await helper.executeScript(`cd ${playbookRoot} && npm run compile`); - await helper.executeScript(`cd ${playbookRoot} && npm run deployToL1`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run compile`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run deployToL1`); - const deployedToken = await helper.getStringFromFile(bufferFile); + const deployedToken = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.L1); console.log("The custom ERC20 token has been deployed to L1: ", Logger.textSeparator, deployedToken); return deployedToken; diff --git a/packages/integration-tests/src/playbook/scenarios/deploy/deployERC20toL2.ts b/packages/integration-tests/src/playbook/scenarios/deploy/deployERC20toL2.ts index d893ce7e2a..1a6a837493 100644 --- a/packages/integration-tests/src/playbook/scenarios/deploy/deployERC20toL2.ts +++ b/packages/integration-tests/src/playbook/scenarios/deploy/deployERC20toL2.ts @@ -1,15 +1,13 @@ -import { Buffer, Logger } from "../../../constants"; +import { Buffer, Logger, Path } from "../../../constants"; import { Helper } from "../../../helper"; export const deployERC20toL2 = async function () { const helper = new Helper(); - const playbookRoot = "src/playbook"; - const bufferFile = playbookRoot + "/" + Buffer.L2; - await helper.executeScript(`cd ${playbookRoot} && npm run compile`); - await helper.executeScript(`cd ${playbookRoot} && npm run deployToL2`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run compile`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run deployToL2`); - const deployedToken = await helper.getStringFromFile(bufferFile); + const deployedToken = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.L2); console.log("The custom ERC20 token has been deployed to L2: ", Logger.textSeparator, deployedToken); return deployedToken; diff --git a/packages/integration-tests/src/playbook/scenarios/deploy/deployGreeterToL2.ts b/packages/integration-tests/src/playbook/scenarios/deploy/deployGreeterToL2.ts index 85ee571822..071cc1c88a 100644 --- a/packages/integration-tests/src/playbook/scenarios/deploy/deployGreeterToL2.ts +++ b/packages/integration-tests/src/playbook/scenarios/deploy/deployGreeterToL2.ts @@ -1,17 +1,15 @@ -import { Buffer, Logger } from "../../../constants"; +import { Buffer, Logger, Path } from "../../../constants"; import { Helper } from "../../../helper"; let deployedContract: string; export const deployGreeterToL2 = async function () { const helper = new Helper(); - const playbookRoot = "src/playbook"; - const bufferFile = playbookRoot + "/" + Buffer.greeterL2; - await helper.executeScript(`cd ${playbookRoot} && npm run compile`); - await helper.executeScript(`cd ${playbookRoot} && npm run deploy:greeter`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run compile`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run deploy:greeter`); - deployedContract = await helper.getStringFromFile(bufferFile); + deployedContract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.greeterL2); console.log("The Greeter contract has been deployed to L2: ", Logger.textSeparator, deployedContract); return deployedContract; diff --git a/packages/integration-tests/src/playbook/scenarios/deploy/deployMulticallContracts.ts b/packages/integration-tests/src/playbook/scenarios/deploy/deployMulticallContracts.ts index 5414e0a948..9f3b7ca499 100644 --- a/packages/integration-tests/src/playbook/scenarios/deploy/deployMulticallContracts.ts +++ b/packages/integration-tests/src/playbook/scenarios/deploy/deployMulticallContracts.ts @@ -1,21 +1,17 @@ -import { Buffer } from "../../../constants"; +import { Buffer, Path } from "../../../constants"; import { Helper } from "../../../helper"; export const deployMulticallContracts = async function () { const helper = new Helper(); - const playbookRoot = "src/playbook"; - const bufferFileRoot = playbookRoot + "/" + Buffer.addressMultiCallRoot; - const bufferFileMiddle = playbookRoot + "/" + Buffer.addressMultiCallMiddle; - const bufferFileCaller = playbookRoot + "/" + Buffer.addressMultiCallCaller; - await helper.executeScript(`cd ${playbookRoot} && npm run compile`); - await helper.executeScript(`cd ${playbookRoot} && npm run deploy:multicall:root`); - await helper.executeScript(`cd ${playbookRoot} && npm run deploy:multicall:middle`); - await helper.executeScript(`cd ${playbookRoot} && npm run deploy:multicall:caller`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run compile`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run deploy:multicall:root`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run deploy:multicall:middle`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run deploy:multicall:caller`); - const multiCallRoot = await helper.getStringFromFile(bufferFileRoot); - const multiCallMiddle = await helper.getStringFromFile(bufferFileMiddle); - const multiCallCaller = await helper.getStringFromFile(bufferFileCaller); + const multiCallRoot = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiCallRoot); + const multiCallMiddle = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiCallMiddle); + const multiCallCaller = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiCallCaller); console.log( "Multicall contracts (Root, Middle and Caller) have been deployed to the address: ", diff --git a/packages/integration-tests/src/playbook/scenarios/deploy/deployMultitransferETH.ts b/packages/integration-tests/src/playbook/scenarios/deploy/deployMultitransferETH.ts index 2a5112cd6b..63c8145a42 100644 --- a/packages/integration-tests/src/playbook/scenarios/deploy/deployMultitransferETH.ts +++ b/packages/integration-tests/src/playbook/scenarios/deploy/deployMultitransferETH.ts @@ -1,15 +1,16 @@ -import { Buffer } from "../../../constants"; +import { Buffer, Path } from "../../../constants"; import { Helper } from "../../../helper"; export const deployMultitransferETH = async function () { const helper = new Helper(); - const playbookRoot = "src/playbook"; - const bufferFile = playbookRoot + "/" + Buffer.addressMultiTransferETH; - await helper.executeScript(`cd ${playbookRoot} && npm run compile`); - await helper.executeScript(`cd ${playbookRoot} && npm run deploy:multitransfer`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run compile`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run deploy:multitransfer`); - const multiTransferContractETH = await helper.getStringFromFile(bufferFile); + const multiTransferContractETH = await helper.readFile( + Path.absolutePathToBufferFiles, + Buffer.addressMultiTransferETH + ); console.log("The custom multitransfer contract ETH has been deployed to the address: ", multiTransferContractETH); diff --git a/packages/integration-tests/src/playbook/scenarios/deploy/deployNFTtoL1.ts b/packages/integration-tests/src/playbook/scenarios/deploy/deployNFTtoL1.ts index 25ab4f3756..cefbe8752e 100644 --- a/packages/integration-tests/src/playbook/scenarios/deploy/deployNFTtoL1.ts +++ b/packages/integration-tests/src/playbook/scenarios/deploy/deployNFTtoL1.ts @@ -1,15 +1,13 @@ -import { Buffer, Logger } from "../../../constants"; +import { Buffer, Logger, Path } from "../../../constants"; import { Helper } from "../../../helper"; export const deployNFTtoL1 = async function () { const helper = new Helper(); - const playbookRoot = "src/playbook"; - const bufferFile = playbookRoot + "/" + Buffer.NFTtoL1; - await helper.executeScript(`cd ${playbookRoot} && npm run compile`); - await helper.executeScript(`cd ${playbookRoot} && npm run deployNFTtoL1`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run compile`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run deployNFTtoL1`); - const deployedNFT = await helper.getStringFromFile(bufferFile); + const deployedNFT = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.NFTtoL1); console.log("The NFT has been deployed to L1: ", Logger.textSeparator, deployedNFT); return deployedNFT; diff --git a/packages/integration-tests/src/playbook/scenarios/deploy/deployNFTtoL2.ts b/packages/integration-tests/src/playbook/scenarios/deploy/deployNFTtoL2.ts index 856e2f48df..b3c8419c91 100644 --- a/packages/integration-tests/src/playbook/scenarios/deploy/deployNFTtoL2.ts +++ b/packages/integration-tests/src/playbook/scenarios/deploy/deployNFTtoL2.ts @@ -1,15 +1,13 @@ -import { Buffer, Logger } from "../../../constants"; +import { Buffer, Logger, Path } from "../../../constants"; import { Helper } from "../../../helper"; export const deployNFTtoL2 = async function () { const helper = new Helper(); - const playbookRoot = "src/playbook"; - const bufferFile = playbookRoot + "/" + Buffer.NFTtoL2; - await helper.executeScript(`cd ${playbookRoot} && npm run compile`); - await helper.executeScript(`cd ${playbookRoot} && npm run deployNFTtoL2`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run compile`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run deployNFTtoL2`); - const deployedNFT = await helper.getStringFromFile(bufferFile); + const deployedNFT = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.NFTtoL2); console.log("The NFT has been deployed to L2: ", Logger.textSeparator, deployedNFT); return deployedNFT; diff --git a/packages/integration-tests/src/playbook/scenarios/deploy/deployViaPaymaster.ts b/packages/integration-tests/src/playbook/scenarios/deploy/deployViaPaymaster.ts index 71a1807344..e8587a12c3 100644 --- a/packages/integration-tests/src/playbook/scenarios/deploy/deployViaPaymaster.ts +++ b/packages/integration-tests/src/playbook/scenarios/deploy/deployViaPaymaster.ts @@ -1,17 +1,14 @@ -import { Buffer } from "../../../constants"; +import { Buffer, Path } from "../../../constants"; import { Helper } from "../../../helper"; export const deployViaPaymaster = async function () { const helper = new Helper(); - const playbookRoot = "src/playbook/"; - const bufferPaymaster = playbookRoot + Buffer.paymaster; - const bufferCustomToken = playbookRoot + Buffer.paymaster; - await helper.executeScript(`cd ${playbookRoot} && npm run compile`); - await helper.executeScript(`cd ${playbookRoot} && npm run deploy:paymaster`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run compile`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run deploy:paymaster`); - const paymasterAddress = await helper.getStringFromFile(bufferPaymaster); - const deployedToken = await helper.getStringFromFile(bufferCustomToken); + const paymasterAddress = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.paymaster); + const deployedToken = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.customToken); console.log("The custom token has been deployed via Paymaster: ", deployedToken); console.log("The Paymaster transaction: ", paymasterAddress); diff --git a/packages/integration-tests/src/playbook/scenarios/deposit/depositERC20.ts b/packages/integration-tests/src/playbook/scenarios/deposit/depositERC20.ts index 98d1f1701d..e62a1fe700 100644 --- a/packages/integration-tests/src/playbook/scenarios/deposit/depositERC20.ts +++ b/packages/integration-tests/src/playbook/scenarios/deposit/depositERC20.ts @@ -1,18 +1,18 @@ import * as ethers from "ethers"; import { promises as fs } from "fs"; +import * as path from "path"; import * as zksync from "zksync-web3"; import { localConfig } from "../../../config"; -import { Buffer, Logger, Wallets } from "../../../constants"; +import { Buffer, Logger, Path, Wallets } from "../../../constants"; import { Helper } from "../../../helper"; const helper = new Helper(); const syncProvider = new zksync.Provider(localConfig.L2Network); const ethProvider = ethers.getDefaultProvider(localConfig.L1Network); const syncWallet = new zksync.Wallet(localConfig.privateKey, syncProvider, ethProvider); -const playbookRoot = "src/playbook"; -const bufferAddressL2DepositedFile = playbookRoot + "/" + Buffer.L2deposited; -const bufferTxErc20DepositFile = playbookRoot + "/" + Buffer.txERC20Deposit; +const bufferAddressL2DepositedFile = path.join(Path.absolutePathToBufferFiles, Buffer.L2deposited); +const bufferTxErc20DepositFile = path.join(Path.absolutePathToBufferFiles, Buffer.txERC20Deposit); export const depositERC20 = async function (sum = "0.5", tokenAddress: string, units = 18) { const deposit = await syncWallet.deposit({ diff --git a/packages/integration-tests/src/playbook/scenarios/deposit/depositETH.ts b/packages/integration-tests/src/playbook/scenarios/deposit/depositETH.ts index 98d99f8aa1..294ec402f8 100644 --- a/packages/integration-tests/src/playbook/scenarios/deposit/depositETH.ts +++ b/packages/integration-tests/src/playbook/scenarios/deposit/depositETH.ts @@ -1,9 +1,10 @@ import * as ethers from "ethers"; import { promises as fs } from "fs"; +import * as path from "path"; import * as zksync from "zksync-web3"; import { localConfig } from "../../../config"; -import { Buffer, Logger } from "../../../constants"; +import { Buffer, Logger, Path } from "../../../constants"; import { Helper } from "../../../helper"; export const depositEth = async function (sum = "0.000009") { @@ -11,8 +12,7 @@ export const depositEth = async function (sum = "0.000009") { const syncProvider = new zksync.Provider(localConfig.L2Network); const ethProvider = ethers.getDefaultProvider(localConfig.L1Network); const syncWallet = new zksync.Wallet(localConfig.privateKey, syncProvider, ethProvider); - const playbookRoot = "src/playbook/"; - const bufferFile = playbookRoot + Buffer.txEthDeposit; + const bufferFile = path.join(Path.playbookRoot, Buffer.txEthDeposit); const deposit = await syncWallet.deposit({ token: zksync.utils.ETH_ADDRESS, diff --git a/packages/integration-tests/src/playbook/scenarios/transfers/transferERC20.ts b/packages/integration-tests/src/playbook/scenarios/transfers/transferERC20.ts index 3ab4e41e36..7a6053a5df 100644 --- a/packages/integration-tests/src/playbook/scenarios/transfers/transferERC20.ts +++ b/packages/integration-tests/src/playbook/scenarios/transfers/transferERC20.ts @@ -1,9 +1,10 @@ import * as ethers from "ethers"; import { promises as fs } from "fs"; +import * as path from "path"; import * as zksync from "zksync-web3"; import { localConfig } from "../../../config"; -import { Buffer, Logger, Wallets } from "../../../constants"; +import { Buffer, Logger, Path, Wallets } from "../../../constants"; import { Helper } from "../../../helper"; export const transferERC20 = async function (sum: string, tokenAddress: string, tokenName?: string /*, units = 18*/) { @@ -12,8 +13,7 @@ export const transferERC20 = async function (sum: string, tokenAddress: string, const ethProvider = ethers.getDefaultProvider(localConfig.L1Network); const syncWallet = new zksync.Wallet(localConfig.privateKey, syncProvider, ethProvider); const syncWallet2 = new zksync.Wallet(Wallets.secondaryWalletPrivateKey, syncProvider, ethProvider); - const playbookRoot = "src/playbook/"; - const bufferFile = playbookRoot + Buffer.txEthTransfer; + const bufferFile = path.join(Path.playbookRoot, Buffer.txEthTransfer); const transfer = await syncWallet.transfer({ to: syncWallet2.address, diff --git a/packages/integration-tests/src/playbook/scenarios/transfers/transferETH.ts b/packages/integration-tests/src/playbook/scenarios/transfers/transferETH.ts index e616a84c44..da98e9b0b1 100644 --- a/packages/integration-tests/src/playbook/scenarios/transfers/transferETH.ts +++ b/packages/integration-tests/src/playbook/scenarios/transfers/transferETH.ts @@ -1,9 +1,10 @@ import * as ethers from "ethers"; import { promises as fs } from "fs"; +import * as path from "path"; import * as zksync from "zksync-web3"; import { localConfig } from "../../../config"; -import { Buffer, Logger, Wallets } from "../../../constants"; +import { Buffer, Logger, Path, Wallets } from "../../../constants"; import { Helper } from "../../../helper"; export const transferEth = async function (sum = "0.000009", address: string = Wallets.mainWalletPrivateKey) { @@ -12,8 +13,7 @@ export const transferEth = async function (sum = "0.000009", address: string = W const ethProvider = ethers.getDefaultProvider(localConfig.L1Network); const syncWallet = new zksync.Wallet(localConfig.privateKey, syncProvider, ethProvider); const syncWallet2 = new zksync.Wallet(address, syncProvider, ethProvider); - const playbookRoot = "src/playbook/"; - const bufferFile = playbookRoot + Buffer.txEthTransfer; + const bufferFile = path.join(Path.playbookRoot + Buffer.txEthTransfer); const transfer = await syncWallet.transfer({ to: syncWallet2.address, diff --git a/packages/integration-tests/src/playbook/scenarios/transfers/transferFailedState.ts b/packages/integration-tests/src/playbook/scenarios/transfers/transferFailedState.ts index 6a90a2241e..e085fbe8a6 100644 --- a/packages/integration-tests/src/playbook/scenarios/transfers/transferFailedState.ts +++ b/packages/integration-tests/src/playbook/scenarios/transfers/transferFailedState.ts @@ -1,9 +1,10 @@ import * as ethers from "ethers"; import { promises as fs } from "fs"; +import * as path from "path"; import * as zksync from "zksync-web3"; import { localConfig } from "../../../config"; -import { Buffer, Logger } from "../../../constants"; +import { Buffer, Logger, Path } from "../../../constants"; import { Helper } from "../../../helper"; export const transferFailedState = async function (tokenAddress: string, tokenName?: string) { @@ -12,8 +13,7 @@ export const transferFailedState = async function (tokenAddress: string, tokenNa const ethProvider = ethers.getDefaultProvider(localConfig.L1Network); const syncWallet = new zksync.Wallet(localConfig.privateKey, syncProvider, ethProvider); const amount = ethers.utils.parseEther("1.0"); - const playbookRoot = "src/playbook/"; - const bufferFile = playbookRoot + Buffer.failedState; + const bufferFile = path.join(Path.playbookRoot + Buffer.failedState); const transfer = await syncWallet.transfer({ to: "0x0000000000000000000000000000000000000000", diff --git a/packages/integration-tests/src/playbook/scenarios/transfers/useGreeter.ts b/packages/integration-tests/src/playbook/scenarios/transfers/useGreeter.ts index 03f05fb217..e58757066f 100644 --- a/packages/integration-tests/src/playbook/scenarios/transfers/useGreeter.ts +++ b/packages/integration-tests/src/playbook/scenarios/transfers/useGreeter.ts @@ -1,15 +1,13 @@ -import { Buffer } from "../../../constants"; +import { Buffer, Path } from "../../../constants"; import { Helper } from "../../../helper"; export const useGreeter = async function () { const helper = new Helper(); - const playbookRoot = "src/playbook/"; - const txBuffer = playbookRoot + Buffer.executeGreeterTx; - await helper.executeScript(`cd ${playbookRoot} && npm run compile`); - await helper.executeScript(`cd ${playbookRoot} && npm run deploy:use:greeter`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run compile`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run deploy:use:greeter`); - const txGreeting = await helper.getStringFromFile(txBuffer); + const txGreeting = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.executeGreeterTx); console.log("Execute the SetGreeting transaction: ", txGreeting); diff --git a/packages/integration-tests/src/playbook/scenarios/transfers/useMultiCall.ts b/packages/integration-tests/src/playbook/scenarios/transfers/useMultiCall.ts index c17807d568..2a70065122 100644 --- a/packages/integration-tests/src/playbook/scenarios/transfers/useMultiCall.ts +++ b/packages/integration-tests/src/playbook/scenarios/transfers/useMultiCall.ts @@ -1,15 +1,13 @@ -import { Buffer } from "../../../constants"; +import { Buffer, Path } from "../../../constants"; import { Helper } from "../../../helper"; export const useMultiCallContracts = async function () { const helper = new Helper(); - const playbookRoot = "src/playbook/"; - const txBufferUseMultiCall = playbookRoot + Buffer.txUseMultiCallContracts; - await helper.executeScript(`cd ${playbookRoot} && npm run compile`); - await helper.executeScript(`cd ${playbookRoot} && npm run deploy:use:multicall`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run compile`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run deploy:use:multicall`); - const txUseMultiCallContracts = await helper.getStringFromFile(txBufferUseMultiCall); + const txUseMultiCallContracts = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txUseMultiCallContracts); return txUseMultiCallContracts; }; diff --git a/packages/integration-tests/src/playbook/scenarios/transfers/useMultitransferETH.ts b/packages/integration-tests/src/playbook/scenarios/transfers/useMultitransferETH.ts index 31b2917654..34143923fd 100644 --- a/packages/integration-tests/src/playbook/scenarios/transfers/useMultitransferETH.ts +++ b/packages/integration-tests/src/playbook/scenarios/transfers/useMultitransferETH.ts @@ -1,19 +1,21 @@ -import { Buffer } from "../../../constants"; +import { Buffer, Path } from "../../../constants"; import { Helper } from "../../../helper"; export const useMultitransferETH = async function () { const helper = new Helper(); - const playbookRoot = "src/playbook/"; - const txBufferETH = playbookRoot + Buffer.txMultiTransferETH; - const txBufferCustomTokenI = playbookRoot + Buffer.txMultiTransferCustomTokenI; - const txBufferCustomTokenII = playbookRoot + Buffer.txMultiTransferCustomTokenII; - await helper.executeScript(`cd ${playbookRoot} && npm run compile`); - await helper.executeScript(`cd ${playbookRoot} && npm run deploy:use:multitransfer`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run compile`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run deploy:use:multitransfer`); - const txMultiTransferETH = await helper.getStringFromFile(txBufferETH); - const txMultiTransferCustomTokenI = await helper.getStringFromFile(txBufferCustomTokenI); - const txMultiTransferCustomTokenII = await helper.getStringFromFile(txBufferCustomTokenII); + const txMultiTransferETH = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txMultiTransferETH); + const txMultiTransferCustomTokenI = await helper.readFile( + Path.absolutePathToBufferFiles, + Buffer.txMultiTransferCustomTokenI + ); + const txMultiTransferCustomTokenII = await helper.readFile( + Path.absolutePathToBufferFiles, + Buffer.txMultiTransferCustomTokenII + ); console.log("The multi transfer transaction for ETH: ", txMultiTransferETH); console.log("The multi transfer transaction for the Custom token I: ", txMultiTransferCustomTokenI); diff --git a/packages/integration-tests/src/playbook/scenarios/transfers/usePaymaster.ts b/packages/integration-tests/src/playbook/scenarios/transfers/usePaymaster.ts index cce46c4bc1..3cf2da7c6f 100644 --- a/packages/integration-tests/src/playbook/scenarios/transfers/usePaymaster.ts +++ b/packages/integration-tests/src/playbook/scenarios/transfers/usePaymaster.ts @@ -1,15 +1,13 @@ -import { Buffer } from "../../../constants"; +import { Buffer, Path } from "../../../constants"; import { Helper } from "../../../helper"; export const usePaymaster = async function () { const helper = new Helper(); - const playbookRoot = "src/playbook/"; - const txBuffer = playbookRoot + Buffer.paymasterTx; - await helper.executeScript(`cd ${playbookRoot} && npm run compile`); - await helper.executeScript(`cd ${playbookRoot} && npm run deploy:use:paymaster`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run compile`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run deploy:use:paymaster`); - const txPaymaster = await helper.getStringFromFile(txBuffer); + const txPaymaster = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.paymasterTx); console.log("The Paymaster transaction: ", txPaymaster); diff --git a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20.ts b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20.ts index 08be5788a9..cc7e38795b 100644 --- a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20.ts +++ b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20.ts @@ -1,9 +1,10 @@ import * as ethers from "ethers"; import { promises as fs } from "fs"; +import * as path from "path"; import * as zksync from "zksync-web3"; import { localConfig } from "../../../config"; -import { Buffer, Logger, Wallets } from "../../../constants"; +import { Buffer, Logger, Path, Wallets } from "../../../constants"; import { Helper } from "../../../helper"; export const withdrawERC20 = async function (tokenAddress: string, sum = "0.2") { @@ -12,8 +13,7 @@ export const withdrawERC20 = async function (tokenAddress: string, sum = "0.2") const ethProvider = ethers.getDefaultProvider(localConfig.L1Network); const syncWallet = new zksync.Wallet(localConfig.privateKey, syncProvider, ethProvider); const bridges = await syncProvider.getDefaultBridgeAddresses(); - const playbookRoot = "src/playbook/"; - const bufferFile = playbookRoot + Buffer.txERC20Withdraw; + const bufferFile = path.join(Path.playbookRoot, Buffer.txERC20Withdraw); const balance = await syncWallet.getBalance(tokenAddress); diff --git a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20toOtherAddress.ts b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20toOtherAddress.ts index 9d93e74dc1..f5bcf605b2 100644 --- a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20toOtherAddress.ts +++ b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20toOtherAddress.ts @@ -1,9 +1,10 @@ import * as ethers from "ethers"; import { promises as fs } from "fs"; +import * as path from "path"; import * as zksync from "zksync-web3"; import { localConfig } from "../../../config"; -import { Buffer, Logger, Wallets } from "../../../constants"; +import { Buffer, Logger, Path, Wallets } from "../../../constants"; import { Helper } from "../../../helper"; export const withdrawERC20toOtherAddress = async function (tokenAddress: string, sum = "0.2") { @@ -12,8 +13,7 @@ export const withdrawERC20toOtherAddress = async function (tokenAddress: string, const ethProvider = ethers.getDefaultProvider(localConfig.L1Network); const syncWallet = new zksync.Wallet(localConfig.privateKey, syncProvider, ethProvider); const bridges = await syncProvider.getDefaultBridgeAddresses(); - const playbookRoot = "src/playbook/"; - const bufferFile = playbookRoot + Buffer.txERC20WithdrawOtherAddress; + const bufferFile = path.join(Path.playbookRoot, Buffer.txERC20WithdrawOtherAddress); const balance = await syncWallet.getBalance(tokenAddress); diff --git a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETH.ts b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETH.ts index d2faa8ffab..d57f1806a8 100644 --- a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETH.ts +++ b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETH.ts @@ -1,9 +1,10 @@ import * as ethers from "ethers"; import { promises as fs } from "fs"; +import * as path from "path"; import * as zksync from "zksync-web3"; import { localConfig } from "../../../config"; -import { Buffer, Logger } from "../../../constants"; +import { Buffer, Logger, Path } from "../../../constants"; import { Helper } from "../../../helper"; export const withdrawETH = async function (sum = "0.000009") { @@ -11,8 +12,7 @@ export const withdrawETH = async function (sum = "0.000009") { const syncProvider = new zksync.Provider(localConfig.L2Network); const ethProvider = ethers.getDefaultProvider(localConfig.L1Network); const syncWallet = new zksync.Wallet(localConfig.privateKey, syncProvider, ethProvider); - const playbookRoot = "src/playbook/"; - const bufferFile = playbookRoot + Buffer.txEthWithdraw; + const bufferFile = path.join(Path.playbookRoot, Buffer.txEthWithdraw); const withdrawL2 = await syncWallet.withdraw({ token: zksync.utils.ETH_ADDRESS, diff --git a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETHtoOtherAddress.ts b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETHtoOtherAddress.ts index 847ebafd87..7d62429711 100644 --- a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETHtoOtherAddress.ts +++ b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETHtoOtherAddress.ts @@ -1,9 +1,10 @@ import * as ethers from "ethers"; import { promises as fs } from "fs"; +import * as path from "path"; import * as zksync from "zksync-web3"; import { localConfig } from "../../../config"; -import { Buffer, Logger, Wallets } from "../../../constants"; +import { Buffer, Logger, Path, Wallets } from "../../../constants"; import { Helper } from "../../../helper"; export const withdrawETHtoOtherAddress = async function (sum = "0.000009") { @@ -11,8 +12,7 @@ export const withdrawETHtoOtherAddress = async function (sum = "0.000009") { const syncProvider = new zksync.Provider(localConfig.L2Network); const ethProvider = ethers.getDefaultProvider(localConfig.L1Network); const syncWallet = new zksync.Wallet(localConfig.privateKey, syncProvider, ethProvider); - const playbookRoot = "src/playbook/"; - const bufferFile = playbookRoot + Buffer.txEthWithdrawOtherAddress; + const bufferFile = path.join(Path.playbookRoot + Buffer.txEthWithdrawOtherAddress); const withdrawL2 = await syncWallet.withdraw({ token: zksync.utils.ETH_ADDRESS, diff --git a/packages/integration-tests/tests/api/accounts.test.ts b/packages/integration-tests/tests/api/accounts.test.ts index 6d6a3da7ad..e75aab0ae8 100644 --- a/packages/integration-tests/tests/api/accounts.test.ts +++ b/packages/integration-tests/tests/api/accounts.test.ts @@ -215,7 +215,7 @@ describe("API module: Account", () => { await helper.runRetriableTestAction(async () => { const blocks = await request(environment.blockExplorerAPI).get("/blocks"); const blockNumber = blocks.body.items[0].number; - const nftAddress = await helper.getStringFromFile(bufferFile + Buffer.NFTtoL2); + const nftAddress = await helper.readFile(bufferFile + Buffer.NFTtoL2); apiRoute = `/api?module=account&action=tokennfttx&page=1&offset=10&sort=desc&endblock=${blockNumber}&startblock=0&contractaddress=${nftAddress}&address=${nftAddress}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); diff --git a/packages/integration-tests/tests/api/addresses.test.ts b/packages/integration-tests/tests/api/addresses.test.ts index 6ebf5a9533..4fb9a73a94 100644 --- a/packages/integration-tests/tests/api/addresses.test.ts +++ b/packages/integration-tests/tests/api/addresses.test.ts @@ -29,7 +29,7 @@ describe("Address", () => { //@id1457 it("Verify deployed to L2 NFT via /address/{address}", async () => { await helper.runRetriableTestAction(async () => { - token = await helper.getStringFromFile(bufferFile + Buffer.NFTtoL2); + token = await helper.readFile(bufferFile + Buffer.NFTtoL2); apiRoute = `/address/${token}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -52,8 +52,8 @@ describe("Address", () => { //@id1464 it("Verify the deployed Root contract via /address/{address}", async () => { await helper.runRetriableTestAction(async () => { - contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiCallRoot); - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallRoot); + contract = await helper.readFile(bufferFile + Buffer.addressMultiCallRoot); + txHash = await helper.readFile(bufferFile + Buffer.txMultiCallRoot); apiRoute = `/address/${contract}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -69,8 +69,8 @@ describe("Address", () => { //@id1465 it("Verify the deployed Middle contract via /address/{address}", async () => { await helper.runRetriableTestAction(async () => { - contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiCallMiddle); - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallMiddle); + contract = await helper.readFile(bufferFile + Buffer.addressMultiCallMiddle); + txHash = await helper.readFile(bufferFile + Buffer.txMultiCallMiddle); apiRoute = `/address/${contract}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -86,8 +86,8 @@ describe("Address", () => { //@id1466 it("Verify the deployed Caller contract via /address/{address}", async () => { await helper.runRetriableTestAction(async () => { - contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiCallCaller); - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallCaller); + contract = await helper.readFile(bufferFile + Buffer.addressMultiCallCaller); + txHash = await helper.readFile(bufferFile + Buffer.txMultiCallCaller); apiRoute = `/address/${contract}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -103,7 +103,7 @@ describe("Address", () => { //@id1476 it("Verify the deployed multitransfer contract via /address/{address}", async () => { await helper.runRetriableTestAction(async () => { - contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiTransferETH); + contract = await helper.readFile(bufferFile + Buffer.addressMultiTransferETH); apiRoute = `/address/${contract}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -116,7 +116,7 @@ describe("Address", () => { //@id1449 it("Verify the deployed Greeter contract via /address/{address}", async () => { await helper.runRetriableTestAction(async () => { - contract = await helper.getStringFromFile(bufferFile + Buffer.greeterL2); + contract = await helper.readFile(bufferFile + Buffer.greeterL2); apiRoute = `/address/${contract}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -135,8 +135,8 @@ describe("Address", () => { //@id1510 it("Verify the transaction via /address/{address}/logs", async () => { await helper.runRetriableTestAction(async () => { - contract = await helper.getStringFromFile(bufferFile + Buffer.greeterL2); - txHash = await helper.getStringFromFile(bufferFile + Buffer.executeGreeterTx); + contract = await helper.readFile(bufferFile + Buffer.greeterL2); + txHash = await helper.readFile(bufferFile + Buffer.executeGreeterTx); apiRoute = `/address/${contract}/logs`; const decapitalizedAddress = apiRoute.slice(1).toLowerCase(); response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -176,10 +176,10 @@ describe("Address", () => { //@id1509 it("Verify the transaction via /address/{address}/transfers", async () => { await helper.runRetriableTestAction(async () => { - contract = await helper.getStringFromFile(bufferFile + Buffer.paymaster); - const emptyWallet = await helper.getStringFromFile(bufferFile + Buffer.emptyWalletAddress); - txHash = await helper.getStringFromFile(bufferFile + Buffer.paymasterTx); - const customTokenAddress = await helper.getStringFromFile(bufferFile + Buffer.customToken); + contract = await helper.readFile(bufferFile + Buffer.paymaster); + const emptyWallet = await helper.readFile(bufferFile + Buffer.emptyWalletAddress); + txHash = await helper.readFile(bufferFile + Buffer.paymasterTx); + const customTokenAddress = await helper.readFile(bufferFile + Buffer.customToken); apiRoute = `/address/${contract}/transfers`; const decapitalizedAddress = apiRoute.slice(1).toLowerCase(); response = await helper.performBlockExplorerApiGetRequest(apiRoute); diff --git a/packages/integration-tests/tests/api/contracts.test.ts b/packages/integration-tests/tests/api/contracts.test.ts index 09169f6db4..9c17f8c0ac 100644 --- a/packages/integration-tests/tests/api/contracts.test.ts +++ b/packages/integration-tests/tests/api/contracts.test.ts @@ -25,10 +25,10 @@ describe("API module: Contract", () => { //@id1696 it("Verify /api?module=contract&action=getcontractcreation&contractaddresses={address1},{address2} response", async () => { await helper.runRetriableTestAction(async () => { - paymasterContract = await helper.getStringFromFile(bufferFile + Buffer.paymaster); - paymasterTx = await helper.getStringFromFile(bufferFile + Buffer.paymasterDeployTx); - multicallCallerContract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiCallCaller); - multicallCallerTx = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallCaller); + paymasterContract = await helper.readFile(bufferFile + Buffer.paymaster); + paymasterTx = await helper.readFile(bufferFile + Buffer.paymasterDeployTx); + multicallCallerContract = await helper.readFile(bufferFile + Buffer.addressMultiCallCaller); + multicallCallerTx = await helper.readFile(bufferFile + Buffer.txMultiCallCaller); apiRoute = `/api?module=contract&action=getcontractcreation&contractaddresses=${paymasterContract},${multicallCallerContract}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); diff --git a/packages/integration-tests/tests/api/logs.test.ts b/packages/integration-tests/tests/api/logs.test.ts index ff881c81ec..e7348f48e2 100644 --- a/packages/integration-tests/tests/api/logs.test.ts +++ b/packages/integration-tests/tests/api/logs.test.ts @@ -23,8 +23,8 @@ describe("API module: Logs", () => { //@id1808 it("Verify /api?module=logs&action=getLogs&page={page}&offset={offset}0&toBlock={toBlock}&fromBlock={fromBlock}&address={address} response", async () => { await helper.runRetriableTestAction(async () => { - contractAddress = await helper.getStringFromFile(bufferFile + Buffer.greeterL2); - txHash = await helper.getStringFromFile(bufferFile + Buffer.executeGreeterTx); + contractAddress = await helper.readFile(bufferFile + Buffer.greeterL2); + txHash = await helper.readFile(bufferFile + Buffer.executeGreeterTx); apiRoute = `/api?module=logs&action=getLogs&page=1&offset=10&toBlock=10000&fromBlock=1&address=${contractAddress}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); diff --git a/packages/integration-tests/tests/api/tokens.test.ts b/packages/integration-tests/tests/api/tokens.test.ts index cea4b6a50e..b7d4b33cfa 100644 --- a/packages/integration-tests/tests/api/tokens.test.ts +++ b/packages/integration-tests/tests/api/tokens.test.ts @@ -1,5 +1,5 @@ import { localConfig } from "../../src/config"; -import { Buffer, Token, TransactionsType, Wallets } from "../../src/constants"; +import { Buffer, Path, Token, TransactionsType, Wallets } from "../../src/constants"; import { Helper } from "../../src/helper"; import { Playbook } from "../../src/playbook/playbook"; @@ -8,22 +8,21 @@ describe("Tokens", () => { const helper = new Helper(); const playbook = new Playbook(); - const bufferFile = "src/playbook/"; let apiRoute: string; let l2Token: string; let txHash: string; let response; beforeAll(async () => { - l2Token = await helper.getStringFromFile(bufferFile + Buffer.L2); + l2Token = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.L2); }); describe("/tokens", () => { //@id1508 it("Verify the response via /tokens", async () => { await helper.runRetriableTestAction(async () => { - const l2DepositedToken = await helper.getStringFromFile(bufferFile + Buffer.L2deposited); - const l1Token = await helper.getStringFromFile(bufferFile + Buffer.L1); + const l2DepositedToken = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.L2deposited); + const l1Token = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.L1); apiRoute = `/tokens`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -97,10 +96,10 @@ describe("Tokens", () => { //@id1451 it("Verify the custom token includes paymaster transaction via /tokens/{address}/transfers", async () => { await helper.runRetriableTestAction(async () => { - l2Token = await helper.getStringFromFile(bufferFile + Buffer.customToken); - const emptyWallet = await helper.getStringFromFile(bufferFile + Buffer.emptyWalletAddress); - const paymaster = await helper.getStringFromFile(bufferFile + Buffer.paymaster); - txHash = await helper.getStringFromFile(bufferFile + Buffer.paymasterTx); + l2Token = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.customToken); + const emptyWallet = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.emptyWalletAddress); + const paymaster = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.paymaster); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.paymasterTx); apiRoute = `/tokens/${l2Token}/transfers?page=1&limit=10`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -116,10 +115,10 @@ describe("Tokens", () => { //id1803 it("Verify the response via /tokens/{address}/transfers", async () => { await helper.runRetriableTestAction(async () => { - l2Token = await helper.getStringFromFile(bufferFile + Buffer.customToken); - const emptyWallet = await helper.getStringFromFile(bufferFile + Buffer.emptyWalletAddress); - const paymaster = await helper.getStringFromFile(bufferFile + Buffer.paymaster); - txHash = await helper.getStringFromFile(bufferFile + Buffer.paymasterTx); + l2Token = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.customToken); + const emptyWallet = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.emptyWalletAddress); + const paymaster = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.paymaster); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.paymasterTx); const apiRoute = `/tokens/${l2Token}/transfers?page=1&limit=10`; const decapitalizedTokenAddress = l2Token.toLowerCase(); response = await helper.performBlockExplorerApiGetRequest(apiRoute); diff --git a/packages/integration-tests/tests/api/transactions.test.ts b/packages/integration-tests/tests/api/transactions.test.ts index f5875cf311..eb39d4ab4f 100644 --- a/packages/integration-tests/tests/api/transactions.test.ts +++ b/packages/integration-tests/tests/api/transactions.test.ts @@ -16,7 +16,7 @@ describe("Transactions", () => { let response; beforeAll(async () => { - const customToken = await helper.getStringFromFile(bufferFile + Buffer.L2deposited); + const customToken = await helper.readFile(bufferFile + Buffer.L2deposited); await playbook.withdrawETHtoOtherAddress(); await playbook.withdrawERC20(customToken); await playbook.withdrawERC20toOtherAddress(customToken); @@ -37,7 +37,7 @@ describe("Transactions", () => { //@id1447 it("Verify transfer ETH L2-L2 via /transactions/{transactionHash}/transfers", async () => { await helper.runRetriableTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txEthTransfer); + txHash = await helper.readFile(bufferFile + Buffer.txEthTransfer); apiRoute = `/transactions/${txHash}/transfers`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -78,7 +78,7 @@ describe("Transactions", () => { //@id1459 it("Verify the ETH withdrawal via /transactions/{transactionHash}/transfers", async () => { await helper.runRetriableTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txEthWithdraw); + txHash = await helper.readFile(bufferFile + Buffer.txEthWithdraw); apiRoute = `/transactions/${txHash}/transfers`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -128,7 +128,7 @@ describe("Transactions", () => { //@id1461 it("Verify the ETH withdrawal to the other address via /transactions/{transactionHash}/transfers", async () => { await helper.runRetriableTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txEthWithdrawOtherAddress); + txHash = await helper.readFile(bufferFile + Buffer.txEthWithdrawOtherAddress); apiRoute = `/transactions/${txHash}/transfers`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -179,10 +179,10 @@ describe("Transactions", () => { it("Verify the custom token withdrawal via /transactions/{transactionHash}/transfers", async () => { await helper.runRetriableTestAction(async () => { const l1Token = bufferFile + "/" + Buffer.L1; - const customTokenL1 = await helper.getStringFromFile(l1Token); + const customTokenL1 = await helper.readFile(l1Token); const l2Token = bufferFile + "/" + Buffer.L2deposited; - const customTokenL2 = await helper.getStringFromFile(l2Token); - txHash = await helper.getStringFromFile(bufferFile + Buffer.txERC20WithdrawOtherAddress); + const customTokenL2 = await helper.readFile(l2Token); + txHash = await helper.readFile(bufferFile + Buffer.txERC20WithdrawOtherAddress); apiRoute = `/transactions/${txHash}/transfers`; const decapitalizedAddress = apiRoute.slice(1).toLowerCase(); response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -310,14 +310,14 @@ describe("Transactions", () => { describe("/transactions/{transactionHash}", () => { beforeAll(async () => { - const customToken = await helper.getStringFromFile(bufferFile + Buffer.L2deposited); + const customToken = await helper.readFile(bufferFile + Buffer.L2deposited); await playbook.transferFailedState(customToken); }); //@id1460 it("Verify the ETH withdrawal to the other address via /transactions/{transactionHash}", async () => { await helper.runRetriableTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txEthWithdrawOtherAddress); + txHash = await helper.readFile(bufferFile + Buffer.txEthWithdrawOtherAddress); apiRoute = `/transactions/${txHash}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -363,7 +363,7 @@ describe("Transactions", () => { //@id1462 it("Verify the custom token withdrawal via /transactions/{transactionHash}", async () => { await helper.runRetriableTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txERC20Withdraw); + txHash = await helper.readFile(bufferFile + Buffer.txERC20Withdraw); apiRoute = `/transactions/${txHash}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -409,7 +409,7 @@ describe("Transactions", () => { //@id1458 it("Verify the ETH withdrawal via /transactions/{transactionHash}", async () => { await helper.runRetriableTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txEthWithdraw); + txHash = await helper.readFile(bufferFile + Buffer.txEthWithdraw); apiRoute = `/transactions/${txHash}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -455,8 +455,8 @@ describe("Transactions", () => { //@id1478 it("Verify transaction for the ETH via /transactions/{transactionHash}", async () => { await helper.runRetriableTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiTransferETH); - contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiTransferETH); + txHash = await helper.readFile(bufferFile + Buffer.txMultiTransferETH); + contract = await helper.readFile(bufferFile + Buffer.addressMultiTransferETH); apiRoute = `/transactions/${txHash}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -502,8 +502,8 @@ describe("Transactions", () => { //@id1479 it("Verify transaction for the Custom Token I via /transactions/{transactionHash}", async () => { await helper.runRetriableTestAction(async () => { - contract = await helper.getStringFromFile(bufferFile + Buffer.L2); - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiTransferCustomTokenI); + contract = await helper.readFile(bufferFile + Buffer.L2); + txHash = await helper.readFile(bufferFile + Buffer.txMultiTransferCustomTokenI); apiRoute = `/transactions/${txHash}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -549,8 +549,8 @@ describe("Transactions", () => { //@id1480 it("Verify transaction for the Custom Token II via /transactions/{transactionHash}", async () => { await helper.runRetriableTestAction(async () => { - contract = await helper.getStringFromFile(bufferFile + Buffer.L2deposited); - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiTransferCustomTokenII); + contract = await helper.readFile(bufferFile + Buffer.L2deposited); + txHash = await helper.readFile(bufferFile + Buffer.txMultiTransferCustomTokenII); apiRoute = `/transactions/${txHash}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -596,8 +596,8 @@ describe("Transactions", () => { //@id1454 it("Verify the transaction after SetGreeting execution via transactions/{transactionHash}", async () => { await helper.runRetriableTestAction(async () => { - contract = await helper.getStringFromFile(bufferFile + Buffer.greeterL2); - txHash = await helper.getStringFromFile(bufferFile + Buffer.executeGreeterTx); + contract = await helper.readFile(bufferFile + Buffer.greeterL2); + txHash = await helper.readFile(bufferFile + Buffer.executeGreeterTx); apiRoute = `/transactions/${txHash}?page=1&limit=10`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -644,7 +644,7 @@ describe("Transactions", () => { //@id1464:I --> @id1468 it("Verify transaction for the Root contract via /transactions/{transactionHash}", async () => { await helper.runRetriableTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallRoot); + txHash = await helper.readFile(bufferFile + Buffer.txMultiCallRoot); apiRoute = `/transactions/${txHash}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -692,7 +692,7 @@ describe("Transactions", () => { //@id1465:I --> @id1469 it("Verify transaction for the Middle contract via /transactions/{transactionHash}", async () => { await helper.runRetriableTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallMiddle); + txHash = await helper.readFile(bufferFile + Buffer.txMultiCallMiddle); apiRoute = `/transactions/${txHash}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -740,7 +740,7 @@ describe("Transactions", () => { //@id1466:I --> @id1470 it("Verify transaction for the Caller contract via /transactions/{transactionHash}", async () => { await helper.runRetriableTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallCaller); + txHash = await helper.readFile(bufferFile + Buffer.txMultiCallCaller); apiRoute = `/transactions/${txHash}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -788,7 +788,7 @@ describe("Transactions", () => { //@id1471 it("Verify transaction for the use multicall contract via /transactions/{transactionHash}", async () => { await helper.runRetriableTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txUseMultiCallContracts); + txHash = await helper.readFile(bufferFile + Buffer.txUseMultiCallContracts); apiRoute = `/transactions/${txHash}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -834,8 +834,8 @@ describe("Transactions", () => { //@id645 it("Verify the transactions with failed state via /transactions/{transactionHash}", async () => { await helper.runRetriableTestAction(async () => { - token = await helper.getStringFromFile(bufferFile + Buffer.L2deposited); - txHash = await helper.getStringFromFile(bufferFile + Buffer.failedState); + token = await helper.readFile(bufferFile + Buffer.L2deposited); + txHash = await helper.readFile(bufferFile + Buffer.failedState); apiRoute = `/transactions/${txHash}?page=1&limit=10`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -890,8 +890,8 @@ describe("Transactions", () => { //@id1481 it("Verify transaction for the ETH via /transactions/{transactionHash}/transfers", async () => { await helper.runRetriableTestAction(async () => { - contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiTransferETH); - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiTransferETH); + contract = await helper.readFile(bufferFile + Buffer.addressMultiTransferETH); + txHash = await helper.readFile(bufferFile + Buffer.txMultiTransferETH); apiRoute = `/transactions/${txHash}/transfers?page=1&limit=10`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -967,9 +967,9 @@ describe("Transactions", () => { //@id1482 it("Verify transaction for the Custom tokenI via /transactions/{transactionHash}/transfers", async () => { await helper.runRetriableTestAction(async () => { - token = await helper.getStringFromFile(bufferFile + Buffer.L2); - contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiTransferETH); - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiTransferCustomTokenI); + token = await helper.readFile(bufferFile + Buffer.L2); + contract = await helper.readFile(bufferFile + Buffer.addressMultiTransferETH); + txHash = await helper.readFile(bufferFile + Buffer.txMultiTransferCustomTokenI); apiRoute = `/transactions/${txHash}/transfers?page=1&limit=10`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -1045,10 +1045,10 @@ describe("Transactions", () => { //@id1483 it("Verify transaction for the Custom tokenII via /transactions/{transactionHash}/transfers", async () => { await helper.runRetriableTestAction(async () => { - const tokenL1 = await helper.getStringFromFile(bufferFile + Buffer.L1); - token = await helper.getStringFromFile(bufferFile + Buffer.L2deposited); - contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiTransferETH); - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiTransferCustomTokenII); + const tokenL1 = await helper.readFile(bufferFile + Buffer.L1); + token = await helper.readFile(bufferFile + Buffer.L2deposited); + contract = await helper.readFile(bufferFile + Buffer.addressMultiTransferETH); + txHash = await helper.readFile(bufferFile + Buffer.txMultiTransferCustomTokenII); apiRoute = `/transactions/${txHash}/transfers?page=1&limit=10`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -1124,10 +1124,10 @@ describe("Transactions", () => { //@id1452 it("Verify transaction through Paymaster via /transactions/{transactionHash}/transfers", async () => { await helper.runRetriableTestAction(async () => { - const paymasterAddress = await helper.getStringFromFile(bufferFile + Buffer.paymaster); - const emptyWallet = await helper.getStringFromFile(bufferFile + Buffer.emptyWalletAddress); - token = await helper.getStringFromFile(bufferFile + Buffer.customToken); - txHash = await helper.getStringFromFile(bufferFile + Buffer.paymasterTx); + const paymasterAddress = await helper.readFile(bufferFile + Buffer.paymaster); + const emptyWallet = await helper.readFile(bufferFile + Buffer.emptyWalletAddress); + token = await helper.readFile(bufferFile + Buffer.customToken); + txHash = await helper.readFile(bufferFile + Buffer.paymasterTx); apiRoute = `/transactions/${txHash}/transfers?page=1&limit=10`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -1204,7 +1204,7 @@ describe("Transactions", () => { //@id1455 it("Verify the transaction after SetGreeting execution via transactions/{transactionHash}/transfers", async () => { await helper.runRetriableTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.executeGreeterTx); + txHash = await helper.readFile(bufferFile + Buffer.executeGreeterTx); apiRoute = `/transactions/${txHash}/transfers`; const decapitalizedAddress = apiRoute.slice(1).toLowerCase(); response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -1280,8 +1280,8 @@ describe("Transactions", () => { //@id1472 it("Verify transaction for the Root contract via /transactions/{transactionHash}/transfers", async () => { await helper.runRetriableTestAction(async () => { - contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiCallRoot); - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallRoot); + contract = await helper.readFile(bufferFile + Buffer.addressMultiCallRoot); + txHash = await helper.readFile(bufferFile + Buffer.txMultiCallRoot); apiRoute = `/transactions/${txHash}/transfers?page=1&limit=10`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -1337,8 +1337,8 @@ describe("Transactions", () => { //@id1473 it("Verify transaction for the Middle contract via /transactions/{transactionHash}/transfers", async () => { await helper.runRetriableTestAction(async () => { - contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiCallRoot); - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallMiddle); + contract = await helper.readFile(bufferFile + Buffer.addressMultiCallRoot); + txHash = await helper.readFile(bufferFile + Buffer.txMultiCallMiddle); apiRoute = `/transactions/${txHash}/transfers?page=1&limit=10`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -1394,8 +1394,8 @@ describe("Transactions", () => { //@id1474 it("Verify transaction for the Caller contract via /transactions/{transactionHash}/transfers", async () => { await helper.runRetriableTestAction(async () => { - contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiCallRoot); - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallCaller); + contract = await helper.readFile(bufferFile + Buffer.addressMultiCallRoot); + txHash = await helper.readFile(bufferFile + Buffer.txMultiCallCaller); apiRoute = `/transactions/${txHash}/transfers?page=1&limit=10`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -1451,7 +1451,7 @@ describe("Transactions", () => { //@id1475 it("Verify transaction for the use multicall contract via /transactions/{transactionHash}/transfers", async () => { await helper.runRetriableTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txUseMultiCallContracts); + txHash = await helper.readFile(bufferFile + Buffer.txUseMultiCallContracts); apiRoute = `/transactions/${txHash}/transfers?page=1&limit=10`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -1509,8 +1509,8 @@ describe("Transactions", () => { //@id1507 it("Verify the transaction via /transactions/{transactionHash}/logs", async () => { await helper.runRetriableTestAction(async () => { - contract = await helper.getStringFromFile(bufferFile + Buffer.greeterL2); - txHash = await helper.getStringFromFile(bufferFile + Buffer.executeGreeterTx); + contract = await helper.readFile(bufferFile + Buffer.greeterL2); + txHash = await helper.readFile(bufferFile + Buffer.executeGreeterTx); apiRoute = `/transactions/${txHash}/logs`; const decapitalizedAddress = apiRoute.slice(1).toLowerCase(); response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -1625,7 +1625,7 @@ describe("Transactions", () => { //@id1697 it("Verify /api?module=transaction&action=getstatus response", async () => { await helper.runRetriableTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txEthTransfer); + txHash = await helper.readFile(bufferFile + Buffer.txEthTransfer); apiRoute = `/api?module=transaction&action=getstatus&txhash=${txHash}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -1639,7 +1639,7 @@ describe("Transactions", () => { //@id1698 it("Verify /api?module=transaction&action=gettxreceiptstatus response", async () => { await helper.runRetriableTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txEthTransfer); + txHash = await helper.readFile(bufferFile + Buffer.txEthTransfer); apiRoute = `/api?module=transaction&action=gettxreceiptstatus&txhash=${txHash}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); diff --git a/packages/integration-tests/tests/hooks/global.ts b/packages/integration-tests/tests/hooks/global.ts index 0ec0903f5c..5eaaf5e9c6 100644 --- a/packages/integration-tests/tests/hooks/global.ts +++ b/packages/integration-tests/tests/hooks/global.ts @@ -11,6 +11,6 @@ export default async () => { await playbook.deployERC20toL1(); await playbook.depositETH("0.0000001"); const bufferFile = bufferRoute + Buffer.L1; - const token = await helper.getStringFromFile(bufferFile); + const token = await helper.readFile(bufferFile); await playbook.depositERC20("100", token, 18); }; diff --git a/packages/integration-tests/tests/ui/deposit.spec.ts b/packages/integration-tests/tests/ui/deposit.spec.ts index 57aac180cf..1caa6bd4e6 100644 --- a/packages/integration-tests/tests/ui/deposit.spec.ts +++ b/packages/integration-tests/tests/ui/deposit.spec.ts @@ -17,7 +17,7 @@ let hash, initiatorAddressElement, ethValue, erc20Value: Locator; //@id1660 test("Check Deposit ETH transaction on BE", async ({ page }) => { bufferFile = bufferRoute + Buffer.txEthDeposit; - depositTxHash = await helper.getStringFromFile(bufferFile); + depositTxHash = await helper.readFile(bufferFile); url = BlockExplorer.baseUrl + `/tx/${depositTxHash}` + BlockExplorer.localNetwork; initiatorAddress = Wallets.richWalletAddress; @@ -35,7 +35,7 @@ test("Check Deposit ETH transaction on BE", async ({ page }) => { //@id1681 test("Check on BE Deposit the custom ERC-20 token", async ({ page }) => { bufferFile = bufferRoute + Buffer.txERC20Deposit; - depositTxHash = await helper.getStringFromFile(bufferFile); + depositTxHash = await helper.readFile(bufferFile); url = BlockExplorer.baseUrl + `/tx/${depositTxHash}` + BlockExplorer.localNetwork; initiatorAddress = Wallets.richWalletAddress; diff --git a/packages/integration-tests/tests/ui/multiCall.spec.ts b/packages/integration-tests/tests/ui/multiCall.spec.ts index bd7607943f..b72bc8e09d 100644 --- a/packages/integration-tests/tests/ui/multiCall.spec.ts +++ b/packages/integration-tests/tests/ui/multiCall.spec.ts @@ -17,7 +17,7 @@ let selector: string; //@id1684 test("Check Multicall - Caller contract address", async ({ page }) => { bufferFile = bufferRoute + Buffer.addressMultiCallCaller; - contract = await helper.getStringFromFile(bufferFile); + contract = await helper.readFile(bufferFile); url = BlockExplorer.baseUrl + BlockExplorer.localNetwork; const targetUrl = BlockExplorer.baseUrl + `/address/${contract}`; @@ -33,7 +33,7 @@ test("Check Multicall - Caller contract address", async ({ page }) => { //@id1690 test("Check Multicall - Middle contract address", async ({ page }) => { bufferFile = bufferRoute + Buffer.addressMultiCallMiddle; - contract = await helper.getStringFromFile(bufferFile); + contract = await helper.readFile(bufferFile); url = BlockExplorer.baseUrl + BlockExplorer.localNetwork; const targetUrl = BlockExplorer.baseUrl + `/address/${contract}`; @@ -49,7 +49,7 @@ test("Check Multicall - Middle contract address", async ({ page }) => { //@id1691 test("Check Multicall - Root contract address", async ({ page }) => { bufferFile = bufferRoute + Buffer.addressMultiCallRoot; - contract = await helper.getStringFromFile(bufferFile); + contract = await helper.readFile(bufferFile); url = BlockExplorer.baseUrl + BlockExplorer.localNetwork; const targetUrl = BlockExplorer.baseUrl + `/address/${contract}`; diff --git a/packages/integration-tests/tests/ui/nft.spec.ts b/packages/integration-tests/tests/ui/nft.spec.ts index ea24620a62..2fc6a2a365 100644 --- a/packages/integration-tests/tests/ui/nft.spec.ts +++ b/packages/integration-tests/tests/ui/nft.spec.ts @@ -16,7 +16,7 @@ let element: Locator; //@id1658 test("Check the L2 NFT contract address", async ({ page }) => { bufferFile = bufferRoute + Buffer.NFTtoL2; - contract = await helper.getStringFromFile(bufferFile); + contract = await helper.readFile(bufferFile); url = BlockExplorer.baseUrl + BlockExplorer.localNetwork; const targetUrl = BlockExplorer.baseUrl + `/address/${contract}`; @@ -31,7 +31,7 @@ test("Check the L2 NFT contract address", async ({ page }) => { //@id1657 test("Check the L1 NFT contract address", async ({ page }) => { bufferFile = bufferRoute + Buffer.NFTtoL1; - contract = await helper.getStringFromFile(bufferFile); + contract = await helper.readFile(bufferFile); url = BlockExplorer.baseUrl + BlockExplorer.localNetwork; const targetUrl = BlockExplorer.baseUrl + `/address/${contract}`; diff --git a/packages/integration-tests/tests/ui/transactions.spec.ts b/packages/integration-tests/tests/ui/transactions.spec.ts index 8ac394b2ff..8da7301f97 100644 --- a/packages/integration-tests/tests/ui/transactions.spec.ts +++ b/packages/integration-tests/tests/ui/transactions.spec.ts @@ -18,7 +18,7 @@ let selector: string; //@id1656 test("Verify failed tx", async ({ page }) => { bufferFile = bufferRoute + Buffer.failedState; - failedTxHash = await helper.getStringFromFile(bufferFile); + failedTxHash = await helper.readFile(bufferFile); url = BlockExplorer.baseUrl + `/tx/${failedTxHash}` + BlockExplorer.localNetwork; await page.goto(url); @@ -32,7 +32,7 @@ test("Verify failed tx", async ({ page }) => { //@id1655 test("Verify deployed the own ERC20 token contract", async ({ page }) => { bufferFile = bufferRoute + Buffer.L2; - contract = await helper.getStringFromFile(bufferFile); + contract = await helper.readFile(bufferFile); url = BlockExplorer.baseUrl + `/address/${contract}` + BlockExplorer.localNetwork; await page.goto(url); From b0a38a050000fc7cd6fc514bb0d90e3c96a24570 Mon Sep 17 00:00:00 2001 From: pcheremu Date: Thu, 7 Mar 2024 16:34:57 +0100 Subject: [PATCH 20/28] test: refactoring path and variables --- .../src/playbook/deploy/use-greeter.ts | 5 +- .../src/playbook/deploy/use-paymaster.ts | 10 +- .../tests/api/accounts.test.ts | 3 +- .../tests/api/addresses.test.ts | 33 +++--- .../tests/api/contracts.test.ts | 11 +- .../integration-tests/tests/api/logs.test.ts | 7 +- .../tests/api/transactions.test.ts | 105 +++++++++--------- .../integration-tests/tests/hooks/global.ts | 6 +- .../tests/ui/deposit.spec.ts | 10 +- .../tests/ui/multiCall.spec.ts | 13 +-- .../integration-tests/tests/ui/nft.spec.ts | 10 +- .../tests/ui/transactions.spec.ts | 10 +- 12 files changed, 97 insertions(+), 126 deletions(-) diff --git a/packages/integration-tests/src/playbook/deploy/use-greeter.ts b/packages/integration-tests/src/playbook/deploy/use-greeter.ts index 38a91fb9f7..a1e232b7b1 100644 --- a/packages/integration-tests/src/playbook/deploy/use-greeter.ts +++ b/packages/integration-tests/src/playbook/deploy/use-greeter.ts @@ -3,18 +3,17 @@ import { promises as fs } from "fs"; import { Provider, Wallet } from "zksync-web3"; import { localConfig } from "../../config"; -import { Wallets } from "../../constants"; +import { Path, Wallets } from "../../constants"; import { Buffer } from "../../constants"; import { Helper } from "../../helper"; import type { HardhatRuntimeEnvironment } from "hardhat/types"; export default async function (hre: HardhatRuntimeEnvironment) { - const bufferRoute = "src/playbook/"; const helper = new Helper(); let contract: any; // eslint-disable-line - const greeterContractAddress = await helper.readFile(bufferRoute + Buffer.greeterL2); + const greeterContractAddress = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.greeterL2); const provider = new Provider(localConfig.L2Network); const wallet = new Wallet(Wallets.richWalletPrivateKey, provider); diff --git a/packages/integration-tests/src/playbook/deploy/use-paymaster.ts b/packages/integration-tests/src/playbook/deploy/use-paymaster.ts index 0315bcb78b..807af7172c 100644 --- a/packages/integration-tests/src/playbook/deploy/use-paymaster.ts +++ b/packages/integration-tests/src/playbook/deploy/use-paymaster.ts @@ -3,18 +3,16 @@ import { promises as fs } from "fs"; import { Provider, utils, Wallet } from "zksync-web3"; import { localConfig } from "../../config"; -import { Buffer } from "../../constants"; +import { Buffer, Path } from "../../constants"; import { Helper } from "../../helper"; import type { HardhatRuntimeEnvironment } from "hardhat/types"; const helper = new Helper(); export default async function (hre: HardhatRuntimeEnvironment) { - const bufferRoute = "src/playbook/"; - - const PAYMASTER_ADDRESS = await helper.readFile(bufferRoute + Buffer.paymaster); - const TOKEN_ADDRESS = await helper.readFile(bufferRoute + Buffer.customToken); - const EMPTY_WALLET_PRIVATE_KEY = await helper.readFile(bufferRoute + Buffer.emptyWalletPrivateKey); + const PAYMASTER_ADDRESS = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.paymaster); + const TOKEN_ADDRESS = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.customToken); + const EMPTY_WALLET_PRIVATE_KEY = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.emptyWalletPrivateKey); const provider = new Provider(localConfig.L2Network); const emptyWallet = new Wallet(EMPTY_WALLET_PRIVATE_KEY, provider); diff --git a/packages/integration-tests/tests/api/accounts.test.ts b/packages/integration-tests/tests/api/accounts.test.ts index e75aab0ae8..ff34dc2a93 100644 --- a/packages/integration-tests/tests/api/accounts.test.ts +++ b/packages/integration-tests/tests/api/accounts.test.ts @@ -10,7 +10,6 @@ describe("API module: Account", () => { jest.setTimeout(localConfig.standardTimeout); const helper = new Helper(); - const bufferFile = "src/playbook/"; let apiRoute: string; let response; const playbook = new Playbook(); @@ -215,7 +214,7 @@ describe("API module: Account", () => { await helper.runRetriableTestAction(async () => { const blocks = await request(environment.blockExplorerAPI).get("/blocks"); const blockNumber = blocks.body.items[0].number; - const nftAddress = await helper.readFile(bufferFile + Buffer.NFTtoL2); + const nftAddress = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.NFTtoL2); apiRoute = `/api?module=account&action=tokennfttx&page=1&offset=10&sort=desc&endblock=${blockNumber}&startblock=0&contractaddress=${nftAddress}&address=${nftAddress}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); diff --git a/packages/integration-tests/tests/api/addresses.test.ts b/packages/integration-tests/tests/api/addresses.test.ts index 4fb9a73a94..237f05be27 100644 --- a/packages/integration-tests/tests/api/addresses.test.ts +++ b/packages/integration-tests/tests/api/addresses.test.ts @@ -1,5 +1,5 @@ import { localConfig } from "../../src/config"; -import { Buffer, Token, Wallets } from "../../src/constants"; +import { Buffer, Path, Token, Wallets } from "../../src/constants"; import { Helper } from "../../src/helper"; import { Playbook } from "../../src/playbook/playbook"; @@ -8,7 +8,6 @@ describe("Address", () => { const helper = new Helper(); const playbook = new Playbook(); - const bufferFile = "src/playbook/"; let apiRoute: string; let contract: string; let token: string; @@ -29,7 +28,7 @@ describe("Address", () => { //@id1457 it("Verify deployed to L2 NFT via /address/{address}", async () => { await helper.runRetriableTestAction(async () => { - token = await helper.readFile(bufferFile + Buffer.NFTtoL2); + token = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.NFTtoL2); apiRoute = `/address/${token}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -52,8 +51,8 @@ describe("Address", () => { //@id1464 it("Verify the deployed Root contract via /address/{address}", async () => { await helper.runRetriableTestAction(async () => { - contract = await helper.readFile(bufferFile + Buffer.addressMultiCallRoot); - txHash = await helper.readFile(bufferFile + Buffer.txMultiCallRoot); + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiCallRoot); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txMultiCallRoot); apiRoute = `/address/${contract}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -69,8 +68,8 @@ describe("Address", () => { //@id1465 it("Verify the deployed Middle contract via /address/{address}", async () => { await helper.runRetriableTestAction(async () => { - contract = await helper.readFile(bufferFile + Buffer.addressMultiCallMiddle); - txHash = await helper.readFile(bufferFile + Buffer.txMultiCallMiddle); + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiCallMiddle); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txMultiCallMiddle); apiRoute = `/address/${contract}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -86,8 +85,8 @@ describe("Address", () => { //@id1466 it("Verify the deployed Caller contract via /address/{address}", async () => { await helper.runRetriableTestAction(async () => { - contract = await helper.readFile(bufferFile + Buffer.addressMultiCallCaller); - txHash = await helper.readFile(bufferFile + Buffer.txMultiCallCaller); + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiCallCaller); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txMultiCallCaller); apiRoute = `/address/${contract}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -103,7 +102,7 @@ describe("Address", () => { //@id1476 it("Verify the deployed multitransfer contract via /address/{address}", async () => { await helper.runRetriableTestAction(async () => { - contract = await helper.readFile(bufferFile + Buffer.addressMultiTransferETH); + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiTransferETH); apiRoute = `/address/${contract}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -116,7 +115,7 @@ describe("Address", () => { //@id1449 it("Verify the deployed Greeter contract via /address/{address}", async () => { await helper.runRetriableTestAction(async () => { - contract = await helper.readFile(bufferFile + Buffer.greeterL2); + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.greeterL2); apiRoute = `/address/${contract}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -135,8 +134,8 @@ describe("Address", () => { //@id1510 it("Verify the transaction via /address/{address}/logs", async () => { await helper.runRetriableTestAction(async () => { - contract = await helper.readFile(bufferFile + Buffer.greeterL2); - txHash = await helper.readFile(bufferFile + Buffer.executeGreeterTx); + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.greeterL2); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.executeGreeterTx); apiRoute = `/address/${contract}/logs`; const decapitalizedAddress = apiRoute.slice(1).toLowerCase(); response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -176,10 +175,10 @@ describe("Address", () => { //@id1509 it("Verify the transaction via /address/{address}/transfers", async () => { await helper.runRetriableTestAction(async () => { - contract = await helper.readFile(bufferFile + Buffer.paymaster); - const emptyWallet = await helper.readFile(bufferFile + Buffer.emptyWalletAddress); - txHash = await helper.readFile(bufferFile + Buffer.paymasterTx); - const customTokenAddress = await helper.readFile(bufferFile + Buffer.customToken); + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.paymaster); + const emptyWallet = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.emptyWalletAddress); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.paymasterTx); + const customTokenAddress = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.customToken); apiRoute = `/address/${contract}/transfers`; const decapitalizedAddress = apiRoute.slice(1).toLowerCase(); response = await helper.performBlockExplorerApiGetRequest(apiRoute); diff --git a/packages/integration-tests/tests/api/contracts.test.ts b/packages/integration-tests/tests/api/contracts.test.ts index 9c17f8c0ac..4bfc593be2 100644 --- a/packages/integration-tests/tests/api/contracts.test.ts +++ b/packages/integration-tests/tests/api/contracts.test.ts @@ -1,5 +1,5 @@ import { localConfig } from "../../src/config"; -import { Buffer, Wallets } from "../../src/constants"; +import { Buffer, Path, Wallets } from "../../src/constants"; import { Helper } from "../../src/helper"; import { Playbook } from "../../src/playbook/playbook"; @@ -8,7 +8,6 @@ describe("API module: Contract", () => { const helper = new Helper(); const playbook = new Playbook(); - const bufferFile = "src/playbook/"; let apiRoute: string; let paymasterContract: string; let paymasterTx: string; @@ -25,10 +24,10 @@ describe("API module: Contract", () => { //@id1696 it("Verify /api?module=contract&action=getcontractcreation&contractaddresses={address1},{address2} response", async () => { await helper.runRetriableTestAction(async () => { - paymasterContract = await helper.readFile(bufferFile + Buffer.paymaster); - paymasterTx = await helper.readFile(bufferFile + Buffer.paymasterDeployTx); - multicallCallerContract = await helper.readFile(bufferFile + Buffer.addressMultiCallCaller); - multicallCallerTx = await helper.readFile(bufferFile + Buffer.txMultiCallCaller); + paymasterContract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.paymaster); + paymasterTx = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.paymasterDeployTx); + multicallCallerContract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiCallCaller); + multicallCallerTx = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txMultiCallCaller); apiRoute = `/api?module=contract&action=getcontractcreation&contractaddresses=${paymasterContract},${multicallCallerContract}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); diff --git a/packages/integration-tests/tests/api/logs.test.ts b/packages/integration-tests/tests/api/logs.test.ts index e7348f48e2..626e14e1b4 100644 --- a/packages/integration-tests/tests/api/logs.test.ts +++ b/packages/integration-tests/tests/api/logs.test.ts @@ -1,5 +1,5 @@ import { localConfig } from "../../src/config"; -import { Buffer } from "../../src/constants"; +import { Buffer, Path } from "../../src/constants"; import { Helper } from "../../src/helper"; import { Playbook } from "../../src/playbook/playbook"; @@ -7,7 +7,6 @@ describe("API module: Logs", () => { jest.setTimeout(localConfig.standardTimeout); //works unstable without timeout const helper = new Helper(); - const bufferFile = "src/playbook/"; const playbook = new Playbook(); let apiRoute: string; let contractAddress: string; @@ -23,8 +22,8 @@ describe("API module: Logs", () => { //@id1808 it("Verify /api?module=logs&action=getLogs&page={page}&offset={offset}0&toBlock={toBlock}&fromBlock={fromBlock}&address={address} response", async () => { await helper.runRetriableTestAction(async () => { - contractAddress = await helper.readFile(bufferFile + Buffer.greeterL2); - txHash = await helper.readFile(bufferFile + Buffer.executeGreeterTx); + contractAddress = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.greeterL2); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.executeGreeterTx); apiRoute = `/api?module=logs&action=getLogs&page=1&offset=10&toBlock=10000&fromBlock=1&address=${contractAddress}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); diff --git a/packages/integration-tests/tests/api/transactions.test.ts b/packages/integration-tests/tests/api/transactions.test.ts index eb39d4ab4f..fd75925e97 100644 --- a/packages/integration-tests/tests/api/transactions.test.ts +++ b/packages/integration-tests/tests/api/transactions.test.ts @@ -1,5 +1,5 @@ import { localConfig } from "../../src/config"; -import { Buffer, Token, TransactionStatus, TransactionsType, Wallets } from "../../src/constants"; +import { Buffer, Path, Token, TransactionStatus, TransactionsType, Wallets } from "../../src/constants"; import { Helper } from "../../src/helper"; import { Playbook } from "../../src/playbook/playbook"; @@ -7,7 +7,6 @@ describe("Transactions", () => { jest.setTimeout(localConfig.extendedTimeout); const helper = new Helper(); - const bufferFile = "src/playbook/"; const playbook = new Playbook(); let apiRoute: string; let contract: string; @@ -16,7 +15,7 @@ describe("Transactions", () => { let response; beforeAll(async () => { - const customToken = await helper.readFile(bufferFile + Buffer.L2deposited); + const customToken = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.L2deposited); await playbook.withdrawETHtoOtherAddress(); await playbook.withdrawERC20(customToken); await playbook.withdrawERC20toOtherAddress(customToken); @@ -37,7 +36,7 @@ describe("Transactions", () => { //@id1447 it("Verify transfer ETH L2-L2 via /transactions/{transactionHash}/transfers", async () => { await helper.runRetriableTestAction(async () => { - txHash = await helper.readFile(bufferFile + Buffer.txEthTransfer); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txEthTransfer); apiRoute = `/transactions/${txHash}/transfers`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -78,7 +77,7 @@ describe("Transactions", () => { //@id1459 it("Verify the ETH withdrawal via /transactions/{transactionHash}/transfers", async () => { await helper.runRetriableTestAction(async () => { - txHash = await helper.readFile(bufferFile + Buffer.txEthWithdraw); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txEthWithdraw); apiRoute = `/transactions/${txHash}/transfers`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -128,7 +127,7 @@ describe("Transactions", () => { //@id1461 it("Verify the ETH withdrawal to the other address via /transactions/{transactionHash}/transfers", async () => { await helper.runRetriableTestAction(async () => { - txHash = await helper.readFile(bufferFile + Buffer.txEthWithdrawOtherAddress); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txEthWithdrawOtherAddress); apiRoute = `/transactions/${txHash}/transfers`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -178,11 +177,9 @@ describe("Transactions", () => { //@id1463 it("Verify the custom token withdrawal via /transactions/{transactionHash}/transfers", async () => { await helper.runRetriableTestAction(async () => { - const l1Token = bufferFile + "/" + Buffer.L1; - const customTokenL1 = await helper.readFile(l1Token); - const l2Token = bufferFile + "/" + Buffer.L2deposited; - const customTokenL2 = await helper.readFile(l2Token); - txHash = await helper.readFile(bufferFile + Buffer.txERC20WithdrawOtherAddress); + const customTokenL1 = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.L1); + const customTokenL2 = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.L2deposited); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txERC20WithdrawOtherAddress); apiRoute = `/transactions/${txHash}/transfers`; const decapitalizedAddress = apiRoute.slice(1).toLowerCase(); response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -310,14 +307,14 @@ describe("Transactions", () => { describe("/transactions/{transactionHash}", () => { beforeAll(async () => { - const customToken = await helper.readFile(bufferFile + Buffer.L2deposited); + const customToken = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.L2deposited); await playbook.transferFailedState(customToken); }); //@id1460 it("Verify the ETH withdrawal to the other address via /transactions/{transactionHash}", async () => { await helper.runRetriableTestAction(async () => { - txHash = await helper.readFile(bufferFile + Buffer.txEthWithdrawOtherAddress); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txEthWithdrawOtherAddress); apiRoute = `/transactions/${txHash}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -363,7 +360,7 @@ describe("Transactions", () => { //@id1462 it("Verify the custom token withdrawal via /transactions/{transactionHash}", async () => { await helper.runRetriableTestAction(async () => { - txHash = await helper.readFile(bufferFile + Buffer.txERC20Withdraw); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txERC20Withdraw); apiRoute = `/transactions/${txHash}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -409,7 +406,7 @@ describe("Transactions", () => { //@id1458 it("Verify the ETH withdrawal via /transactions/{transactionHash}", async () => { await helper.runRetriableTestAction(async () => { - txHash = await helper.readFile(bufferFile + Buffer.txEthWithdraw); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txEthWithdraw); apiRoute = `/transactions/${txHash}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -455,8 +452,8 @@ describe("Transactions", () => { //@id1478 it("Verify transaction for the ETH via /transactions/{transactionHash}", async () => { await helper.runRetriableTestAction(async () => { - txHash = await helper.readFile(bufferFile + Buffer.txMultiTransferETH); - contract = await helper.readFile(bufferFile + Buffer.addressMultiTransferETH); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txMultiTransferETH); + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiTransferETH); apiRoute = `/transactions/${txHash}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -502,8 +499,8 @@ describe("Transactions", () => { //@id1479 it("Verify transaction for the Custom Token I via /transactions/{transactionHash}", async () => { await helper.runRetriableTestAction(async () => { - contract = await helper.readFile(bufferFile + Buffer.L2); - txHash = await helper.readFile(bufferFile + Buffer.txMultiTransferCustomTokenI); + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.L2); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txMultiTransferCustomTokenI); apiRoute = `/transactions/${txHash}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -549,8 +546,8 @@ describe("Transactions", () => { //@id1480 it("Verify transaction for the Custom Token II via /transactions/{transactionHash}", async () => { await helper.runRetriableTestAction(async () => { - contract = await helper.readFile(bufferFile + Buffer.L2deposited); - txHash = await helper.readFile(bufferFile + Buffer.txMultiTransferCustomTokenII); + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.L2deposited); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txMultiTransferCustomTokenII); apiRoute = `/transactions/${txHash}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -596,8 +593,8 @@ describe("Transactions", () => { //@id1454 it("Verify the transaction after SetGreeting execution via transactions/{transactionHash}", async () => { await helper.runRetriableTestAction(async () => { - contract = await helper.readFile(bufferFile + Buffer.greeterL2); - txHash = await helper.readFile(bufferFile + Buffer.executeGreeterTx); + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.greeterL2); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.executeGreeterTx); apiRoute = `/transactions/${txHash}?page=1&limit=10`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -644,7 +641,7 @@ describe("Transactions", () => { //@id1464:I --> @id1468 it("Verify transaction for the Root contract via /transactions/{transactionHash}", async () => { await helper.runRetriableTestAction(async () => { - txHash = await helper.readFile(bufferFile + Buffer.txMultiCallRoot); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txMultiCallRoot); apiRoute = `/transactions/${txHash}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -692,7 +689,7 @@ describe("Transactions", () => { //@id1465:I --> @id1469 it("Verify transaction for the Middle contract via /transactions/{transactionHash}", async () => { await helper.runRetriableTestAction(async () => { - txHash = await helper.readFile(bufferFile + Buffer.txMultiCallMiddle); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txMultiCallMiddle); apiRoute = `/transactions/${txHash}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -740,7 +737,7 @@ describe("Transactions", () => { //@id1466:I --> @id1470 it("Verify transaction for the Caller contract via /transactions/{transactionHash}", async () => { await helper.runRetriableTestAction(async () => { - txHash = await helper.readFile(bufferFile + Buffer.txMultiCallCaller); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txMultiCallCaller); apiRoute = `/transactions/${txHash}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -788,7 +785,7 @@ describe("Transactions", () => { //@id1471 it("Verify transaction for the use multicall contract via /transactions/{transactionHash}", async () => { await helper.runRetriableTestAction(async () => { - txHash = await helper.readFile(bufferFile + Buffer.txUseMultiCallContracts); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txUseMultiCallContracts); apiRoute = `/transactions/${txHash}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -834,8 +831,8 @@ describe("Transactions", () => { //@id645 it("Verify the transactions with failed state via /transactions/{transactionHash}", async () => { await helper.runRetriableTestAction(async () => { - token = await helper.readFile(bufferFile + Buffer.L2deposited); - txHash = await helper.readFile(bufferFile + Buffer.failedState); + token = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.L2deposited); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.failedState); apiRoute = `/transactions/${txHash}?page=1&limit=10`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -890,8 +887,8 @@ describe("Transactions", () => { //@id1481 it("Verify transaction for the ETH via /transactions/{transactionHash}/transfers", async () => { await helper.runRetriableTestAction(async () => { - contract = await helper.readFile(bufferFile + Buffer.addressMultiTransferETH); - txHash = await helper.readFile(bufferFile + Buffer.txMultiTransferETH); + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiTransferETH); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txMultiTransferETH); apiRoute = `/transactions/${txHash}/transfers?page=1&limit=10`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -967,9 +964,9 @@ describe("Transactions", () => { //@id1482 it("Verify transaction for the Custom tokenI via /transactions/{transactionHash}/transfers", async () => { await helper.runRetriableTestAction(async () => { - token = await helper.readFile(bufferFile + Buffer.L2); - contract = await helper.readFile(bufferFile + Buffer.addressMultiTransferETH); - txHash = await helper.readFile(bufferFile + Buffer.txMultiTransferCustomTokenI); + token = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.L2); + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiTransferETH); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txMultiTransferCustomTokenI); apiRoute = `/transactions/${txHash}/transfers?page=1&limit=10`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -1045,10 +1042,10 @@ describe("Transactions", () => { //@id1483 it("Verify transaction for the Custom tokenII via /transactions/{transactionHash}/transfers", async () => { await helper.runRetriableTestAction(async () => { - const tokenL1 = await helper.readFile(bufferFile + Buffer.L1); - token = await helper.readFile(bufferFile + Buffer.L2deposited); - contract = await helper.readFile(bufferFile + Buffer.addressMultiTransferETH); - txHash = await helper.readFile(bufferFile + Buffer.txMultiTransferCustomTokenII); + const tokenL1 = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.L1); + token = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.L2deposited); + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiTransferETH); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txMultiTransferCustomTokenII); apiRoute = `/transactions/${txHash}/transfers?page=1&limit=10`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -1124,10 +1121,10 @@ describe("Transactions", () => { //@id1452 it("Verify transaction through Paymaster via /transactions/{transactionHash}/transfers", async () => { await helper.runRetriableTestAction(async () => { - const paymasterAddress = await helper.readFile(bufferFile + Buffer.paymaster); - const emptyWallet = await helper.readFile(bufferFile + Buffer.emptyWalletAddress); - token = await helper.readFile(bufferFile + Buffer.customToken); - txHash = await helper.readFile(bufferFile + Buffer.paymasterTx); + const paymasterAddress = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.paymaster); + const emptyWallet = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.emptyWalletAddress); + token = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.customToken); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.paymasterTx); apiRoute = `/transactions/${txHash}/transfers?page=1&limit=10`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -1204,7 +1201,7 @@ describe("Transactions", () => { //@id1455 it("Verify the transaction after SetGreeting execution via transactions/{transactionHash}/transfers", async () => { await helper.runRetriableTestAction(async () => { - txHash = await helper.readFile(bufferFile + Buffer.executeGreeterTx); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.executeGreeterTx); apiRoute = `/transactions/${txHash}/transfers`; const decapitalizedAddress = apiRoute.slice(1).toLowerCase(); response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -1280,8 +1277,8 @@ describe("Transactions", () => { //@id1472 it("Verify transaction for the Root contract via /transactions/{transactionHash}/transfers", async () => { await helper.runRetriableTestAction(async () => { - contract = await helper.readFile(bufferFile + Buffer.addressMultiCallRoot); - txHash = await helper.readFile(bufferFile + Buffer.txMultiCallRoot); + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiCallRoot); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txMultiCallRoot); apiRoute = `/transactions/${txHash}/transfers?page=1&limit=10`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -1337,8 +1334,8 @@ describe("Transactions", () => { //@id1473 it("Verify transaction for the Middle contract via /transactions/{transactionHash}/transfers", async () => { await helper.runRetriableTestAction(async () => { - contract = await helper.readFile(bufferFile + Buffer.addressMultiCallRoot); - txHash = await helper.readFile(bufferFile + Buffer.txMultiCallMiddle); + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiCallRoot); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txMultiCallMiddle); apiRoute = `/transactions/${txHash}/transfers?page=1&limit=10`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -1394,8 +1391,8 @@ describe("Transactions", () => { //@id1474 it("Verify transaction for the Caller contract via /transactions/{transactionHash}/transfers", async () => { await helper.runRetriableTestAction(async () => { - contract = await helper.readFile(bufferFile + Buffer.addressMultiCallRoot); - txHash = await helper.readFile(bufferFile + Buffer.txMultiCallCaller); + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiCallRoot); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txMultiCallCaller); apiRoute = `/transactions/${txHash}/transfers?page=1&limit=10`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -1451,7 +1448,7 @@ describe("Transactions", () => { //@id1475 it("Verify transaction for the use multicall contract via /transactions/{transactionHash}/transfers", async () => { await helper.runRetriableTestAction(async () => { - txHash = await helper.readFile(bufferFile + Buffer.txUseMultiCallContracts); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txUseMultiCallContracts); apiRoute = `/transactions/${txHash}/transfers?page=1&limit=10`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -1509,8 +1506,8 @@ describe("Transactions", () => { //@id1507 it("Verify the transaction via /transactions/{transactionHash}/logs", async () => { await helper.runRetriableTestAction(async () => { - contract = await helper.readFile(bufferFile + Buffer.greeterL2); - txHash = await helper.readFile(bufferFile + Buffer.executeGreeterTx); + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.greeterL2); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.executeGreeterTx); apiRoute = `/transactions/${txHash}/logs`; const decapitalizedAddress = apiRoute.slice(1).toLowerCase(); response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -1625,7 +1622,7 @@ describe("Transactions", () => { //@id1697 it("Verify /api?module=transaction&action=getstatus response", async () => { await helper.runRetriableTestAction(async () => { - txHash = await helper.readFile(bufferFile + Buffer.txEthTransfer); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txEthTransfer); apiRoute = `/api?module=transaction&action=getstatus&txhash=${txHash}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); @@ -1639,7 +1636,7 @@ describe("Transactions", () => { //@id1698 it("Verify /api?module=transaction&action=gettxreceiptstatus response", async () => { await helper.runRetriableTestAction(async () => { - txHash = await helper.readFile(bufferFile + Buffer.txEthTransfer); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txEthTransfer); apiRoute = `/api?module=transaction&action=gettxreceiptstatus&txhash=${txHash}`; response = await helper.performBlockExplorerApiGetRequest(apiRoute); diff --git a/packages/integration-tests/tests/hooks/global.ts b/packages/integration-tests/tests/hooks/global.ts index 5eaaf5e9c6..3c4541d0aa 100644 --- a/packages/integration-tests/tests/hooks/global.ts +++ b/packages/integration-tests/tests/hooks/global.ts @@ -1,16 +1,14 @@ -import { Buffer } from "../../src/constants"; +import { Buffer, Path } from "../../src/constants"; import { Helper } from "../../src/helper"; import { Playbook } from "../../src/playbook/playbook"; export default async () => { const playbook = new Playbook(); const helper = new Helper(); - const bufferRoute = "src/playbook/"; await playbook.deployERC20toL2(); await playbook.deployERC20toL1(); await playbook.depositETH("0.0000001"); - const bufferFile = bufferRoute + Buffer.L1; - const token = await helper.readFile(bufferFile); + const token = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.L1); await playbook.depositERC20("100", token, 18); }; diff --git a/packages/integration-tests/tests/ui/deposit.spec.ts b/packages/integration-tests/tests/ui/deposit.spec.ts index 1caa6bd4e6..c2a3faf847 100644 --- a/packages/integration-tests/tests/ui/deposit.spec.ts +++ b/packages/integration-tests/tests/ui/deposit.spec.ts @@ -1,23 +1,20 @@ import { expect, test } from "@playwright/test"; import { config } from "./config"; -import { BlockExplorer, Buffer, Wallets } from "../../src/constants"; +import { BlockExplorer, Buffer, Path, Wallets } from "../../src/constants"; import { Helper } from "../../src/helper"; import type { Locator } from "@playwright/test"; -const bufferRoute = "src/playbook/"; const helper = new Helper(); let url: string; -let bufferFile; let depositTxHash: string; let initiatorAddress: string; let hash, initiatorAddressElement, ethValue, erc20Value: Locator; //@id1660 test("Check Deposit ETH transaction on BE", async ({ page }) => { - bufferFile = bufferRoute + Buffer.txEthDeposit; - depositTxHash = await helper.readFile(bufferFile); + depositTxHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txEthDeposit); url = BlockExplorer.baseUrl + `/tx/${depositTxHash}` + BlockExplorer.localNetwork; initiatorAddress = Wallets.richWalletAddress; @@ -34,8 +31,7 @@ test("Check Deposit ETH transaction on BE", async ({ page }) => { //@id1681 test("Check on BE Deposit the custom ERC-20 token", async ({ page }) => { - bufferFile = bufferRoute + Buffer.txERC20Deposit; - depositTxHash = await helper.readFile(bufferFile); + depositTxHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txERC20Deposit); url = BlockExplorer.baseUrl + `/tx/${depositTxHash}` + BlockExplorer.localNetwork; initiatorAddress = Wallets.richWalletAddress; diff --git a/packages/integration-tests/tests/ui/multiCall.spec.ts b/packages/integration-tests/tests/ui/multiCall.spec.ts index b72bc8e09d..e97a9c871f 100644 --- a/packages/integration-tests/tests/ui/multiCall.spec.ts +++ b/packages/integration-tests/tests/ui/multiCall.spec.ts @@ -1,23 +1,20 @@ import { expect, test } from "@playwright/test"; import { config } from "./config"; -import { BlockExplorer, Buffer } from "../../src/constants"; +import { BlockExplorer, Buffer, Path } from "../../src/constants"; import { Helper } from "../../src/helper"; import type { Locator } from "@playwright/test"; -const bufferRoute = "src/playbook/"; const helper = new Helper(); let url: string; -let bufferFile; let contract: string; let element: Locator; let selector: string; //@id1684 test("Check Multicall - Caller contract address", async ({ page }) => { - bufferFile = bufferRoute + Buffer.addressMultiCallCaller; - contract = await helper.readFile(bufferFile); + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiCallCaller); url = BlockExplorer.baseUrl + BlockExplorer.localNetwork; const targetUrl = BlockExplorer.baseUrl + `/address/${contract}`; @@ -32,8 +29,7 @@ test("Check Multicall - Caller contract address", async ({ page }) => { //@id1690 test("Check Multicall - Middle contract address", async ({ page }) => { - bufferFile = bufferRoute + Buffer.addressMultiCallMiddle; - contract = await helper.readFile(bufferFile); + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiCallCaller); url = BlockExplorer.baseUrl + BlockExplorer.localNetwork; const targetUrl = BlockExplorer.baseUrl + `/address/${contract}`; @@ -48,8 +44,7 @@ test("Check Multicall - Middle contract address", async ({ page }) => { //@id1691 test("Check Multicall - Root contract address", async ({ page }) => { - bufferFile = bufferRoute + Buffer.addressMultiCallRoot; - contract = await helper.readFile(bufferFile); + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiCallRoot); url = BlockExplorer.baseUrl + BlockExplorer.localNetwork; const targetUrl = BlockExplorer.baseUrl + `/address/${contract}`; diff --git a/packages/integration-tests/tests/ui/nft.spec.ts b/packages/integration-tests/tests/ui/nft.spec.ts index 2fc6a2a365..7ca4ee2763 100644 --- a/packages/integration-tests/tests/ui/nft.spec.ts +++ b/packages/integration-tests/tests/ui/nft.spec.ts @@ -1,22 +1,19 @@ import { expect, test } from "@playwright/test"; import { config } from "./config"; -import { BlockExplorer, Buffer } from "../../src/constants"; +import { BlockExplorer, Buffer, Path } from "../../src/constants"; import { Helper } from "../../src/helper"; import type { Locator } from "@playwright/test"; -const bufferRoute = "src/playbook/"; const helper = new Helper(); let url: string; -let bufferFile; let contract: string; let element: Locator; //@id1658 test("Check the L2 NFT contract address", async ({ page }) => { - bufferFile = bufferRoute + Buffer.NFTtoL2; - contract = await helper.readFile(bufferFile); + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.NFTtoL2); url = BlockExplorer.baseUrl + BlockExplorer.localNetwork; const targetUrl = BlockExplorer.baseUrl + `/address/${contract}`; @@ -30,8 +27,7 @@ test("Check the L2 NFT contract address", async ({ page }) => { //@id1657 test("Check the L1 NFT contract address", async ({ page }) => { - bufferFile = bufferRoute + Buffer.NFTtoL1; - contract = await helper.readFile(bufferFile); + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.NFTtoL1); url = BlockExplorer.baseUrl + BlockExplorer.localNetwork; const targetUrl = BlockExplorer.baseUrl + `/address/${contract}`; diff --git a/packages/integration-tests/tests/ui/transactions.spec.ts b/packages/integration-tests/tests/ui/transactions.spec.ts index 8da7301f97..6369fd3b82 100644 --- a/packages/integration-tests/tests/ui/transactions.spec.ts +++ b/packages/integration-tests/tests/ui/transactions.spec.ts @@ -1,15 +1,13 @@ import { expect, test } from "@playwright/test"; import { config } from "./config"; -import { BlockExplorer, Buffer } from "../../src/constants"; +import { BlockExplorer, Buffer, Path } from "../../src/constants"; import { Helper } from "../../src/helper"; import type { Locator } from "@playwright/test"; -const bufferRoute = "src/playbook/"; const helper = new Helper(); let url: string; -let bufferFile; let failedTxHash: string; let contract: string; let element: Locator; @@ -17,8 +15,7 @@ let selector: string; //@id1656 test("Verify failed tx", async ({ page }) => { - bufferFile = bufferRoute + Buffer.failedState; - failedTxHash = await helper.readFile(bufferFile); + failedTxHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.failedState); url = BlockExplorer.baseUrl + `/tx/${failedTxHash}` + BlockExplorer.localNetwork; await page.goto(url); @@ -31,8 +28,7 @@ test("Verify failed tx", async ({ page }) => { //@id1655 test("Verify deployed the own ERC20 token contract", async ({ page }) => { - bufferFile = bufferRoute + Buffer.L2; - contract = await helper.readFile(bufferFile); + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.L2); url = BlockExplorer.baseUrl + `/address/${contract}` + BlockExplorer.localNetwork; await page.goto(url); From a82496aaba35e7276afdb1c14b3e8431ab163aa8 Mon Sep 17 00:00:00 2001 From: pcheremu Date: Thu, 7 Mar 2024 18:21:44 +0100 Subject: [PATCH 21/28] test: refactoring path and variables --- packages/integration-tests/src/helper.ts | 12 +++++++++++- .../src/playbook/deploy/deploy-greeter.ts | 6 ++++-- .../src/playbook/deploy/deploy-paymaster.ts | 15 ++++++++------- .../src/playbook/deploy/erc20toL1.ts | 7 ++++--- .../src/playbook/deploy/erc20toL2.ts | 7 ++++--- .../src/playbook/deploy/multiTransferETH.ts | 7 ++++--- .../src/playbook/deploy/multicallCaller.ts | 5 ++--- .../src/playbook/deploy/multicallMiddle.ts | 4 ++-- .../src/playbook/deploy/multicallRoot.ts | 9 +++++---- .../src/playbook/deploy/nftToL1.ts | 7 ++++--- .../src/playbook/deploy/nftToL2.ts | 7 ++++--- .../src/playbook/deploy/use-greeter.ts | 2 +- .../src/playbook/deploy/use-multiCall.ts | 2 +- .../src/playbook/deploy/use-multitransferETH.ts | 7 +++---- .../src/playbook/deploy/use-paymaster.ts | 3 +-- .../playbook/scenarios/deposit/depositERC20.ts | 8 ++------ .../src/playbook/scenarios/deposit/depositETH.ts | 5 +---- .../playbook/scenarios/transfers/transferERC20.ts | 5 +---- .../playbook/scenarios/transfers/transferETH.ts | 3 +-- .../scenarios/transfers/transferFailedState.ts | 5 +---- .../scenarios/withdrawal/withdrawERC20.ts | 5 +---- .../withdrawal/withdrawERC20toOtherAddress.ts | 3 +-- .../playbook/scenarios/withdrawal/withdrawETH.ts | 5 +---- .../withdrawal/withdrawETHtoOtherAddress.ts | 5 +---- 24 files changed, 68 insertions(+), 76 deletions(-) diff --git a/packages/integration-tests/src/helper.ts b/packages/integration-tests/src/helper.ts index 8b26397289..9b599171ae 100644 --- a/packages/integration-tests/src/helper.ts +++ b/packages/integration-tests/src/helper.ts @@ -26,6 +26,7 @@ export class Helper { exec(script, { encoding: "utf-8" }, (error, stdout, stderr) => { if (error) { console.error(`Error executing script "${script}":`, error); + console.error(`stderr executing script "${script}":`, stderr); reject(error); } else { console.log(`> Run NPM Script "${script}":\n`, stdout); @@ -35,8 +36,17 @@ export class Helper { }); } + async writeFile(filePath: string, fileName: string, data: string) { + const absoluteRoute = path.join(filePath, fileName); + try { + await fs.writeFile(absoluteRoute, data); + } catch { + console.log(`Cannot write: ${fileName} to ${filePath}`); + } + } + async readFile(filePath: string, fileName: string) { - const absoluteRoute = path.join(filePath + fileName); + const absoluteRoute = path.join(filePath, fileName); try { return await fs.readFile(absoluteRoute, { encoding: "utf-8" }); diff --git a/packages/integration-tests/src/playbook/deploy/deploy-greeter.ts b/packages/integration-tests/src/playbook/deploy/deploy-greeter.ts index c9291e7c6e..a773568e35 100644 --- a/packages/integration-tests/src/playbook/deploy/deploy-greeter.ts +++ b/packages/integration-tests/src/playbook/deploy/deploy-greeter.ts @@ -2,10 +2,12 @@ import { Deployer } from "@matterlabs/hardhat-zksync-deploy"; import { promises as fs } from "fs"; import { localConfig } from "../../config"; -import { Buffer } from "../../constants"; +import { Buffer, Path } from "../../constants"; +import { Helper } from "../../helper"; import getWallet from "../utils/getWallet"; import type { HardhatRuntimeEnvironment } from "hardhat/types"; +const helper = new Helper(); export default async function (hre: HardhatRuntimeEnvironment) { const wallet = await getWallet(hre); @@ -15,5 +17,5 @@ export default async function (hre: HardhatRuntimeEnvironment) { const contract = await deployer.deploy(artifact, [], localConfig.gasLimit); const contractAddress = contract.address; console.log(`${artifact.contractName} was deployed to ${contractAddress}`); - await fs.writeFile(Buffer.greeterL2, contractAddress); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.greeterL2, contractAddress); } diff --git a/packages/integration-tests/src/playbook/deploy/deploy-paymaster.ts b/packages/integration-tests/src/playbook/deploy/deploy-paymaster.ts index 7c82c1f8b3..b68dc35c82 100644 --- a/packages/integration-tests/src/playbook/deploy/deploy-paymaster.ts +++ b/packages/integration-tests/src/playbook/deploy/deploy-paymaster.ts @@ -1,20 +1,21 @@ import { Deployer } from "@matterlabs/hardhat-zksync-deploy"; import * as ethers from "ethers"; -import { promises as fs } from "fs"; import { Wallet } from "zksync-web3"; -import { Buffer, Wallets } from "../../constants"; +import { Buffer, Path, Wallets } from "../../constants"; +import { Helper } from "../../helper"; import type { HardhatRuntimeEnvironment } from "hardhat/types"; +const helper = new Helper(); export default async function (hre: HardhatRuntimeEnvironment) { const wallet = new Wallet(Wallets.richWalletPrivateKey); // The wallet that will receive ERC20 tokens const emptyWallet = Wallet.createRandom(); console.log(`Empty wallet's address: ${emptyWallet.address}`); - await fs.writeFile(Buffer.emptyWalletAddress, emptyWallet.address); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.emptyWalletAddress, emptyWallet.address); console.log(`Empty wallet's private key: ${emptyWallet.privateKey}`); - await fs.writeFile(Buffer.emptyWalletPrivateKey, emptyWallet.privateKey); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.emptyWalletPrivateKey, emptyWallet.privateKey); const deployer = new Deployer(hre, wallet); @@ -22,16 +23,16 @@ export default async function (hre: HardhatRuntimeEnvironment) { const erc20Artifact = await deployer.loadArtifact("MyERC20"); const erc20 = await deployer.deploy(erc20Artifact, ["MyToken", "MyToken", 18]); console.log(`ERC20 address: ${erc20.address}`); - await fs.writeFile(Buffer.customToken, erc20.address); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.customToken, erc20.address); const paymasterArtifact = await deployer.loadArtifact("MyPaymaster"); const paymaster = await deployer.deploy(paymasterArtifact, [erc20.address]); console.log(`Paymaster address: ${paymaster.address}`); - await fs.writeFile(Buffer.paymaster, paymaster.address); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.paymaster, paymaster.address); const deployTransaction = await paymaster.deployTransaction; console.log(`Paymaster deploy transaction: ${deployTransaction.hash}`); - await fs.writeFile(Buffer.paymasterDeployTx, deployTransaction.hash); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.paymasterDeployTx, deployTransaction.hash); await ( await deployer.zkWallet.sendTransaction({ diff --git a/packages/integration-tests/src/playbook/deploy/erc20toL1.ts b/packages/integration-tests/src/playbook/deploy/erc20toL1.ts index b675e55207..49d8bf006c 100644 --- a/packages/integration-tests/src/playbook/deploy/erc20toL1.ts +++ b/packages/integration-tests/src/playbook/deploy/erc20toL1.ts @@ -1,9 +1,10 @@ -import { promises as fs } from "fs"; import { ethers } from "hardhat"; import { localConfig } from "../../config"; -import { Buffer, Wallets } from "../../constants"; +import { Buffer, Path, Wallets } from "../../constants"; +import { Helper } from "../../helper"; +const helper = new Helper(); async function main() { const [deployer] = await ethers.getSigners(); @@ -16,7 +17,7 @@ async function main() { const contract = await ethers.getContractFactory("L1"); const token = await contract.deploy(Wallets.richWalletAddress, localConfig.gasLimit); - await fs.writeFile(Buffer.L1, token.address); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.L1, token.address); } main() diff --git a/packages/integration-tests/src/playbook/deploy/erc20toL2.ts b/packages/integration-tests/src/playbook/deploy/erc20toL2.ts index 13964be03f..51b7d2a86a 100644 --- a/packages/integration-tests/src/playbook/deploy/erc20toL2.ts +++ b/packages/integration-tests/src/playbook/deploy/erc20toL2.ts @@ -1,11 +1,12 @@ import { Deployer } from "@matterlabs/hardhat-zksync-deploy"; -import { promises as fs } from "fs"; import { localConfig } from "../../config"; -import { Buffer } from "../../constants"; +import { Buffer, Path } from "../../constants"; +import { Helper } from "../../helper"; import getWallet from "../utils/getWallet"; import type { HardhatRuntimeEnvironment } from "hardhat/types"; +const helper = new Helper(); export default async function (hre: HardhatRuntimeEnvironment) { const wallet = await getWallet(hre); @@ -15,5 +16,5 @@ export default async function (hre: HardhatRuntimeEnvironment) { const contract = await deployer.deploy(artifact, [], localConfig.gasLimit); const contractAddress = contract.address; console.log(`${artifact.contractName} was deployed to ${contractAddress}`); - await fs.writeFile(Buffer.L2, contractAddress); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.L2, contractAddress); } diff --git a/packages/integration-tests/src/playbook/deploy/multiTransferETH.ts b/packages/integration-tests/src/playbook/deploy/multiTransferETH.ts index 6a8dd60492..e5444f7c04 100644 --- a/packages/integration-tests/src/playbook/deploy/multiTransferETH.ts +++ b/packages/integration-tests/src/playbook/deploy/multiTransferETH.ts @@ -1,11 +1,12 @@ import { Deployer } from "@matterlabs/hardhat-zksync-deploy"; -import { promises as fs } from "fs"; -import { Buffer, Wallets } from "../../constants"; +import { Buffer, Path, Wallets } from "../../constants"; +import { Helper } from "../../helper"; import verify from "../utils/displayVerificationInfo"; import getWallet from "../utils/getWallet"; import type { HardhatRuntimeEnvironment } from "hardhat/types"; +const helper = new Helper(); const contract_name = "TokenF2L2"; // insert the name of the contract you want to deploy const constructor_arguments = [Wallets.richWalletAddress]; // insert the constructor arguments of the contract you want to deploy @@ -27,7 +28,7 @@ export default async function (hre: HardhatRuntimeEnvironment) { // Show the contract info. console.log(`Contract "${artifact.contractName}" was deployed to ${deployedContract.address}`); - await fs.writeFile(Buffer.addressMultiTransferETH, deployedContract.address); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.addressMultiTransferETH, deployedContract.address); await verify({ hre, contract: deployedContract, contractConstructorArguments: constructor_arguments, artifact }); diff --git a/packages/integration-tests/src/playbook/deploy/multicallCaller.ts b/packages/integration-tests/src/playbook/deploy/multicallCaller.ts index 537e7abb37..ed1f3452b5 100644 --- a/packages/integration-tests/src/playbook/deploy/multicallCaller.ts +++ b/packages/integration-tests/src/playbook/deploy/multicallCaller.ts @@ -1,5 +1,4 @@ import { Deployer } from "@matterlabs/hardhat-zksync-deploy"; -import { promises as fs } from "fs"; import { Buffer, Path } from "../../constants"; import { Helper } from "../../helper"; @@ -33,8 +32,8 @@ export default async function (hre: HardhatRuntimeEnvironment) { const address = deployedContract.address; const txHash = deployedContract.deployTransaction.hash; - await fs.writeFile(Buffer.addressMultiCallCaller, address); - await fs.writeFile(Buffer.txMultiCallCaller, txHash); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.addressMultiCallCaller, address); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.txMultiCallCaller, txHash); return [address, txHash]; } diff --git a/packages/integration-tests/src/playbook/deploy/multicallMiddle.ts b/packages/integration-tests/src/playbook/deploy/multicallMiddle.ts index c694f3407a..bbe775b7db 100644 --- a/packages/integration-tests/src/playbook/deploy/multicallMiddle.ts +++ b/packages/integration-tests/src/playbook/deploy/multicallMiddle.ts @@ -34,8 +34,8 @@ export default async function (hre: HardhatRuntimeEnvironment) { const address = deployedContract.address; const txHash = deployedContract.deployTransaction.hash; - await fs.writeFile(Buffer.addressMultiCallMiddle, address); - await fs.writeFile(Buffer.txMultiCallMiddle, txHash); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.addressMultiCallMiddle, address); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.txMultiCallMiddle, txHash); return [address, txHash]; } diff --git a/packages/integration-tests/src/playbook/deploy/multicallRoot.ts b/packages/integration-tests/src/playbook/deploy/multicallRoot.ts index d06b991af9..67efa20891 100644 --- a/packages/integration-tests/src/playbook/deploy/multicallRoot.ts +++ b/packages/integration-tests/src/playbook/deploy/multicallRoot.ts @@ -1,12 +1,13 @@ import { Deployer } from "@matterlabs/hardhat-zksync-deploy"; -import { promises as fs } from "fs"; -import { Buffer } from "../../constants"; +import { Buffer, Path } from "../../constants"; +import { Helper } from "../../helper"; import getWallet from "../utils/getWallet"; import type { HardhatRuntimeEnvironment } from "hardhat/types"; export default async function (hre: HardhatRuntimeEnvironment) { + const helper = new Helper(); console.log(`Running deploy script for the Greeter contract`); const wallet = await getWallet(hre); @@ -48,8 +49,8 @@ export default async function (hre: HardhatRuntimeEnvironment) { const address = deployedContract.address; const txHash = deployedContract.deployTransaction.hash; - await fs.writeFile(Buffer.addressMultiCallRoot, address); - await fs.writeFile(Buffer.txMultiCallRoot, txHash); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.addressMultiCallRoot, address); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.txMultiCallRoot, txHash); return [address, txHash]; } diff --git a/packages/integration-tests/src/playbook/deploy/nftToL1.ts b/packages/integration-tests/src/playbook/deploy/nftToL1.ts index c08f68dfb8..8dfa5242fd 100644 --- a/packages/integration-tests/src/playbook/deploy/nftToL1.ts +++ b/packages/integration-tests/src/playbook/deploy/nftToL1.ts @@ -1,10 +1,11 @@ -import { promises as fs } from "fs"; import { ethers } from "hardhat"; import * as hardhatConfig from "hardhat"; -import { Buffer, Wallets } from "../../constants"; +import { Buffer, Path, Wallets } from "../../constants"; +import { Helper } from "../../helper"; import type { HardhatRuntimeEnvironment } from "hardhat/types"; +const helper = new Helper(); async function main() { const hre: HardhatRuntimeEnvironment = hardhatConfig; @@ -22,7 +23,7 @@ async function main() { console.error(`The NFT minting has been unsuccessful: ${mintNFT}`); } - await fs.writeFile(Buffer.NFTtoL1, myNFT.address); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.NFTtoL1, myNFT.address); } main() diff --git a/packages/integration-tests/src/playbook/deploy/nftToL2.ts b/packages/integration-tests/src/playbook/deploy/nftToL2.ts index 4b90bc5073..bf22be1a42 100644 --- a/packages/integration-tests/src/playbook/deploy/nftToL2.ts +++ b/packages/integration-tests/src/playbook/deploy/nftToL2.ts @@ -1,13 +1,14 @@ import { Deployer } from "@matterlabs/hardhat-zksync-deploy"; -import { promises as fs } from "fs"; -import { Buffer, Wallets } from "../../constants"; +import { Buffer, Path, Wallets } from "../../constants"; +import { Helper } from "../../helper"; import displayVerificationInfo from "../utils/displayVerificationInfo"; import getWallet from "../utils/getWallet"; import type { HardhatRuntimeEnvironment } from "hardhat/types"; export default async function (hre: HardhatRuntimeEnvironment) { + const helper = new Helper(); console.log(`Running deploy script for the Greeter contract`); const wallet = await getWallet(hre); @@ -30,5 +31,5 @@ export default async function (hre: HardhatRuntimeEnvironment) { displayVerificationInfo({ hre, contract: myNFT, contractConstructorArguments, artifact }); - await fs.writeFile(Buffer.NFTtoL2, myNFT.address); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.NFTtoL2, myNFT.address); } diff --git a/packages/integration-tests/src/playbook/deploy/use-greeter.ts b/packages/integration-tests/src/playbook/deploy/use-greeter.ts index a1e232b7b1..c15a7d91dc 100644 --- a/packages/integration-tests/src/playbook/deploy/use-greeter.ts +++ b/packages/integration-tests/src/playbook/deploy/use-greeter.ts @@ -32,7 +32,7 @@ export default async function (hre: HardhatRuntimeEnvironment) { console.log(`Transaction hash: ${transactionReceipt.transactionHash}`); - await fs.writeFile(Buffer.executeGreeterTx, transactionReceipt.transactionHash); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.executeGreeterTx, transactionReceipt.transactionHash); return transactionReceipt.transactionHash; } diff --git a/packages/integration-tests/src/playbook/deploy/use-multiCall.ts b/packages/integration-tests/src/playbook/deploy/use-multiCall.ts index cf72140aae..b420bef4a3 100644 --- a/packages/integration-tests/src/playbook/deploy/use-multiCall.ts +++ b/packages/integration-tests/src/playbook/deploy/use-multiCall.ts @@ -33,7 +33,7 @@ export default async function (hre: HardhatRuntimeEnvironment) { console.log("Multicall contract caller: ", txHash); console.log(`Contract said after new greeting: ${await attachedContract.newCallGreeter()}`); - await fs.writeFile(Buffer.txUseMultiCallContracts, txHash); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.txUseMultiCallContracts, txHash); return txHash; } diff --git a/packages/integration-tests/src/playbook/deploy/use-multitransferETH.ts b/packages/integration-tests/src/playbook/deploy/use-multitransferETH.ts index 0cf2f076fd..9f72911068 100644 --- a/packages/integration-tests/src/playbook/deploy/use-multitransferETH.ts +++ b/packages/integration-tests/src/playbook/deploy/use-multitransferETH.ts @@ -1,5 +1,4 @@ import * as ethers from "ethers"; -import { promises as fs } from "fs"; import { Provider, Wallet } from "zksync-web3"; import { localConfig } from "../../config"; @@ -91,7 +90,7 @@ export default async function callMultiTransferETH(hre: HardhatRuntimeEnvironmen )}" Custom token II` ); - await fs.writeFile(Buffer.txMultiTransferETH, ethTransfer); - await fs.writeFile(Buffer.txMultiTransferCustomTokenI, customToken1Transfer); - await fs.writeFile(Buffer.txMultiTransferCustomTokenII, customToken2Transfer); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.txMultiTransferETH, ethTransfer); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.txMultiTransferCustomTokenI, customToken1Transfer); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.txMultiTransferCustomTokenII, customToken2Transfer); } diff --git a/packages/integration-tests/src/playbook/deploy/use-paymaster.ts b/packages/integration-tests/src/playbook/deploy/use-paymaster.ts index 807af7172c..963d978ef0 100644 --- a/packages/integration-tests/src/playbook/deploy/use-paymaster.ts +++ b/packages/integration-tests/src/playbook/deploy/use-paymaster.ts @@ -1,5 +1,4 @@ import * as ethers from "ethers"; -import { promises as fs } from "fs"; import { Provider, utils, Wallet } from "zksync-web3"; import { localConfig } from "../../config"; @@ -62,7 +61,7 @@ export default async function (hre: HardhatRuntimeEnvironment) { console.log(`Balance of the user after mint: ${await emptyWallet.getBalance(TOKEN_ADDRESS)}`); - await fs.writeFile(Buffer.paymasterTx, receipt.transactionHash); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.paymasterTx, receipt.transactionHash); console.log(`Transaction hash: ${receipt.transactionHash}`); return receipt.transactionHash; diff --git a/packages/integration-tests/src/playbook/scenarios/deposit/depositERC20.ts b/packages/integration-tests/src/playbook/scenarios/deposit/depositERC20.ts index e62a1fe700..ac4154631d 100644 --- a/packages/integration-tests/src/playbook/scenarios/deposit/depositERC20.ts +++ b/packages/integration-tests/src/playbook/scenarios/deposit/depositERC20.ts @@ -1,6 +1,4 @@ import * as ethers from "ethers"; -import { promises as fs } from "fs"; -import * as path from "path"; import * as zksync from "zksync-web3"; import { localConfig } from "../../../config"; @@ -11,8 +9,6 @@ const helper = new Helper(); const syncProvider = new zksync.Provider(localConfig.L2Network); const ethProvider = ethers.getDefaultProvider(localConfig.L1Network); const syncWallet = new zksync.Wallet(localConfig.privateKey, syncProvider, ethProvider); -const bufferAddressL2DepositedFile = path.join(Path.absolutePathToBufferFiles, Buffer.L2deposited); -const bufferTxErc20DepositFile = path.join(Path.absolutePathToBufferFiles, Buffer.txERC20Deposit); export const depositERC20 = async function (sum = "0.5", tokenAddress: string, units = 18) { const deposit = await syncWallet.deposit({ @@ -30,8 +26,8 @@ export const depositERC20 = async function (sum = "0.5", tokenAddress: string, u console.log("L2 token address ", l2TokenAddress); const txHash = await deposit.waitFinalize(); await helper.logTransaction(Logger.deposit, txHash.transactionHash, "ERC20 token"); - await fs.writeFile(bufferAddressL2DepositedFile, l2TokenAddress); - await fs.writeFile(bufferTxErc20DepositFile, txHash.transactionHash); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.L2deposited, l2TokenAddress); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.txERC20Deposit, txHash.transactionHash); return txHash; }; diff --git a/packages/integration-tests/src/playbook/scenarios/deposit/depositETH.ts b/packages/integration-tests/src/playbook/scenarios/deposit/depositETH.ts index 294ec402f8..d19297b314 100644 --- a/packages/integration-tests/src/playbook/scenarios/deposit/depositETH.ts +++ b/packages/integration-tests/src/playbook/scenarios/deposit/depositETH.ts @@ -1,6 +1,4 @@ import * as ethers from "ethers"; -import { promises as fs } from "fs"; -import * as path from "path"; import * as zksync from "zksync-web3"; import { localConfig } from "../../../config"; @@ -12,7 +10,6 @@ export const depositEth = async function (sum = "0.000009") { const syncProvider = new zksync.Provider(localConfig.L2Network); const ethProvider = ethers.getDefaultProvider(localConfig.L1Network); const syncWallet = new zksync.Wallet(localConfig.privateKey, syncProvider, ethProvider); - const bufferFile = path.join(Path.playbookRoot, Buffer.txEthDeposit); const deposit = await syncWallet.deposit({ token: zksync.utils.ETH_ADDRESS, @@ -22,7 +19,7 @@ export const depositEth = async function (sum = "0.000009") { await deposit.wait(1); const txHash = await deposit.waitFinalize(); await helper.logTransaction(Logger.deposit, txHash.transactionHash, "ETH"); - await fs.writeFile(bufferFile, txHash.transactionHash); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.txEthDeposit, txHash.transactionHash); return txHash; }; diff --git a/packages/integration-tests/src/playbook/scenarios/transfers/transferERC20.ts b/packages/integration-tests/src/playbook/scenarios/transfers/transferERC20.ts index 7a6053a5df..3d82d75ead 100644 --- a/packages/integration-tests/src/playbook/scenarios/transfers/transferERC20.ts +++ b/packages/integration-tests/src/playbook/scenarios/transfers/transferERC20.ts @@ -1,6 +1,4 @@ import * as ethers from "ethers"; -import { promises as fs } from "fs"; -import * as path from "path"; import * as zksync from "zksync-web3"; import { localConfig } from "../../../config"; @@ -13,7 +11,6 @@ export const transferERC20 = async function (sum: string, tokenAddress: string, const ethProvider = ethers.getDefaultProvider(localConfig.L1Network); const syncWallet = new zksync.Wallet(localConfig.privateKey, syncProvider, ethProvider); const syncWallet2 = new zksync.Wallet(Wallets.secondaryWalletPrivateKey, syncProvider, ethProvider); - const bufferFile = path.join(Path.playbookRoot, Buffer.txEthTransfer); const transfer = await syncWallet.transfer({ to: syncWallet2.address, @@ -24,7 +21,7 @@ export const transferERC20 = async function (sum: string, tokenAddress: string, const txHash = transfer.hash; await helper.logTransaction(Logger.transfer, txHash, tokenName); - await fs.writeFile(bufferFile, txHash); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.txEthTransfer, txHash); return txHash; }; diff --git a/packages/integration-tests/src/playbook/scenarios/transfers/transferETH.ts b/packages/integration-tests/src/playbook/scenarios/transfers/transferETH.ts index da98e9b0b1..64d5de8e9f 100644 --- a/packages/integration-tests/src/playbook/scenarios/transfers/transferETH.ts +++ b/packages/integration-tests/src/playbook/scenarios/transfers/transferETH.ts @@ -13,7 +13,6 @@ export const transferEth = async function (sum = "0.000009", address: string = W const ethProvider = ethers.getDefaultProvider(localConfig.L1Network); const syncWallet = new zksync.Wallet(localConfig.privateKey, syncProvider, ethProvider); const syncWallet2 = new zksync.Wallet(address, syncProvider, ethProvider); - const bufferFile = path.join(Path.playbookRoot + Buffer.txEthTransfer); const transfer = await syncWallet.transfer({ to: syncWallet2.address, @@ -23,7 +22,7 @@ export const transferEth = async function (sum = "0.000009", address: string = W const txHash = transfer.hash; await helper.logTransaction(Logger.transfer, txHash, "ETH"); - await fs.writeFile(bufferFile, txHash); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.txEthTransfer, txHash); return txHash; }; diff --git a/packages/integration-tests/src/playbook/scenarios/transfers/transferFailedState.ts b/packages/integration-tests/src/playbook/scenarios/transfers/transferFailedState.ts index e085fbe8a6..b618b38626 100644 --- a/packages/integration-tests/src/playbook/scenarios/transfers/transferFailedState.ts +++ b/packages/integration-tests/src/playbook/scenarios/transfers/transferFailedState.ts @@ -1,6 +1,4 @@ import * as ethers from "ethers"; -import { promises as fs } from "fs"; -import * as path from "path"; import * as zksync from "zksync-web3"; import { localConfig } from "../../../config"; @@ -13,7 +11,6 @@ export const transferFailedState = async function (tokenAddress: string, tokenNa const ethProvider = ethers.getDefaultProvider(localConfig.L1Network); const syncWallet = new zksync.Wallet(localConfig.privateKey, syncProvider, ethProvider); const amount = ethers.utils.parseEther("1.0"); - const bufferFile = path.join(Path.playbookRoot + Buffer.failedState); const transfer = await syncWallet.transfer({ to: "0x0000000000000000000000000000000000000000", @@ -24,7 +21,7 @@ export const transferFailedState = async function (tokenAddress: string, tokenNa const txHash = transfer.hash; await helper.logTransaction(Logger.txFailedState, txHash, tokenName); - await fs.writeFile(bufferFile, txHash); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.failedState, txHash); return txHash; }; diff --git a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20.ts b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20.ts index cc7e38795b..39897516f4 100644 --- a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20.ts +++ b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20.ts @@ -1,6 +1,4 @@ import * as ethers from "ethers"; -import { promises as fs } from "fs"; -import * as path from "path"; import * as zksync from "zksync-web3"; import { localConfig } from "../../../config"; @@ -13,7 +11,6 @@ export const withdrawERC20 = async function (tokenAddress: string, sum = "0.2") const ethProvider = ethers.getDefaultProvider(localConfig.L1Network); const syncWallet = new zksync.Wallet(localConfig.privateKey, syncProvider, ethProvider); const bridges = await syncProvider.getDefaultBridgeAddresses(); - const bufferFile = path.join(Path.playbookRoot, Buffer.txERC20Withdraw); const balance = await syncWallet.getBalance(tokenAddress); @@ -37,7 +34,7 @@ export const withdrawERC20 = async function (tokenAddress: string, sum = "0.2") console.log(`Your balance is ${balanceAfter.toString()}`); await helper.logTransaction(Logger.withdraw, txHash, "Custom token"); - await fs.writeFile(bufferFile, txHash); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.txERC20Withdraw, txHash); return txHash; }; diff --git a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20toOtherAddress.ts b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20toOtherAddress.ts index f5bcf605b2..5a86cbb8be 100644 --- a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20toOtherAddress.ts +++ b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20toOtherAddress.ts @@ -13,7 +13,6 @@ export const withdrawERC20toOtherAddress = async function (tokenAddress: string, const ethProvider = ethers.getDefaultProvider(localConfig.L1Network); const syncWallet = new zksync.Wallet(localConfig.privateKey, syncProvider, ethProvider); const bridges = await syncProvider.getDefaultBridgeAddresses(); - const bufferFile = path.join(Path.playbookRoot, Buffer.txERC20WithdrawOtherAddress); const balance = await syncWallet.getBalance(tokenAddress); @@ -37,7 +36,7 @@ export const withdrawERC20toOtherAddress = async function (tokenAddress: string, console.log(`Your balance is ${balanceAfter.toString()}`); await helper.logTransaction(Logger.withdraw, txHash, "Custom token"); - await fs.writeFile(bufferFile, txHash); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.txERC20WithdrawOtherAddress, txHash); return txHash; }; diff --git a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETH.ts b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETH.ts index d57f1806a8..8355f7bc1e 100644 --- a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETH.ts +++ b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETH.ts @@ -1,6 +1,4 @@ import * as ethers from "ethers"; -import { promises as fs } from "fs"; -import * as path from "path"; import * as zksync from "zksync-web3"; import { localConfig } from "../../../config"; @@ -12,7 +10,6 @@ export const withdrawETH = async function (sum = "0.000009") { const syncProvider = new zksync.Provider(localConfig.L2Network); const ethProvider = ethers.getDefaultProvider(localConfig.L1Network); const syncWallet = new zksync.Wallet(localConfig.privateKey, syncProvider, ethProvider); - const bufferFile = path.join(Path.playbookRoot, Buffer.txEthWithdraw); const withdrawL2 = await syncWallet.withdraw({ token: zksync.utils.ETH_ADDRESS, @@ -23,7 +20,7 @@ export const withdrawETH = async function (sum = "0.000009") { await withdrawL2.waitFinalize(); await helper.logTransaction(Logger.withdraw, txHash, "ETH"); - await fs.writeFile(bufferFile, txHash); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.txEthWithdraw, txHash); return txHash; }; diff --git a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETHtoOtherAddress.ts b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETHtoOtherAddress.ts index 7d62429711..e946974c44 100644 --- a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETHtoOtherAddress.ts +++ b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETHtoOtherAddress.ts @@ -1,6 +1,4 @@ import * as ethers from "ethers"; -import { promises as fs } from "fs"; -import * as path from "path"; import * as zksync from "zksync-web3"; import { localConfig } from "../../../config"; @@ -12,7 +10,6 @@ export const withdrawETHtoOtherAddress = async function (sum = "0.000009") { const syncProvider = new zksync.Provider(localConfig.L2Network); const ethProvider = ethers.getDefaultProvider(localConfig.L1Network); const syncWallet = new zksync.Wallet(localConfig.privateKey, syncProvider, ethProvider); - const bufferFile = path.join(Path.playbookRoot + Buffer.txEthWithdrawOtherAddress); const withdrawL2 = await syncWallet.withdraw({ token: zksync.utils.ETH_ADDRESS, @@ -24,7 +21,7 @@ export const withdrawETHtoOtherAddress = async function (sum = "0.000009") { await withdrawL2.waitFinalize(); await helper.logTransaction(Logger.withdraw, txHash, "ETH"); - await fs.writeFile(bufferFile, txHash); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.txEthWithdrawOtherAddress, txHash); return txHash; }; From 3aa7bd8eef380d4402ec3f32003080f08ddc0a0c Mon Sep 17 00:00:00 2001 From: pcheremu Date: Thu, 7 Mar 2024 18:52:07 +0100 Subject: [PATCH 22/28] test: fix issues and refactor --- .../integration-tests/src/playbook/deploy/deploy-greeter.ts | 1 - .../integration-tests/src/playbook/deploy/multicallMiddle.ts | 1 - packages/integration-tests/src/playbook/deploy/use-greeter.ts | 1 - packages/integration-tests/src/playbook/deploy/use-multiCall.ts | 1 - .../src/playbook/scenarios/transfers/transferETH.ts | 2 -- .../scenarios/withdrawal/withdrawERC20toOtherAddress.ts | 2 -- packages/integration-tests/tests/api/accounts.test.ts | 2 +- 7 files changed, 1 insertion(+), 9 deletions(-) diff --git a/packages/integration-tests/src/playbook/deploy/deploy-greeter.ts b/packages/integration-tests/src/playbook/deploy/deploy-greeter.ts index a773568e35..1c331921b3 100644 --- a/packages/integration-tests/src/playbook/deploy/deploy-greeter.ts +++ b/packages/integration-tests/src/playbook/deploy/deploy-greeter.ts @@ -1,5 +1,4 @@ import { Deployer } from "@matterlabs/hardhat-zksync-deploy"; -import { promises as fs } from "fs"; import { localConfig } from "../../config"; import { Buffer, Path } from "../../constants"; diff --git a/packages/integration-tests/src/playbook/deploy/multicallMiddle.ts b/packages/integration-tests/src/playbook/deploy/multicallMiddle.ts index bbe775b7db..ee88d63c11 100644 --- a/packages/integration-tests/src/playbook/deploy/multicallMiddle.ts +++ b/packages/integration-tests/src/playbook/deploy/multicallMiddle.ts @@ -1,5 +1,4 @@ import { Deployer } from "@matterlabs/hardhat-zksync-deploy"; -import { promises as fs } from "fs"; import { Buffer, Path } from "../../constants"; import { Helper } from "../../helper"; diff --git a/packages/integration-tests/src/playbook/deploy/use-greeter.ts b/packages/integration-tests/src/playbook/deploy/use-greeter.ts index c15a7d91dc..0c427a1414 100644 --- a/packages/integration-tests/src/playbook/deploy/use-greeter.ts +++ b/packages/integration-tests/src/playbook/deploy/use-greeter.ts @@ -1,5 +1,4 @@ import * as ethers from "ethers"; -import { promises as fs } from "fs"; import { Provider, Wallet } from "zksync-web3"; import { localConfig } from "../../config"; diff --git a/packages/integration-tests/src/playbook/deploy/use-multiCall.ts b/packages/integration-tests/src/playbook/deploy/use-multiCall.ts index b420bef4a3..cadf86fdf2 100644 --- a/packages/integration-tests/src/playbook/deploy/use-multiCall.ts +++ b/packages/integration-tests/src/playbook/deploy/use-multiCall.ts @@ -1,5 +1,4 @@ import * as ethers from "ethers"; -import { promises as fs } from "fs"; import { Provider } from "zksync-web3"; import { localConfig } from "../../config"; diff --git a/packages/integration-tests/src/playbook/scenarios/transfers/transferETH.ts b/packages/integration-tests/src/playbook/scenarios/transfers/transferETH.ts index 64d5de8e9f..d6c6f1f437 100644 --- a/packages/integration-tests/src/playbook/scenarios/transfers/transferETH.ts +++ b/packages/integration-tests/src/playbook/scenarios/transfers/transferETH.ts @@ -1,6 +1,4 @@ import * as ethers from "ethers"; -import { promises as fs } from "fs"; -import * as path from "path"; import * as zksync from "zksync-web3"; import { localConfig } from "../../../config"; diff --git a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20toOtherAddress.ts b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20toOtherAddress.ts index 5a86cbb8be..ccf4a48857 100644 --- a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20toOtherAddress.ts +++ b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20toOtherAddress.ts @@ -1,6 +1,4 @@ import * as ethers from "ethers"; -import { promises as fs } from "fs"; -import * as path from "path"; import * as zksync from "zksync-web3"; import { localConfig } from "../../../config"; diff --git a/packages/integration-tests/tests/api/accounts.test.ts b/packages/integration-tests/tests/api/accounts.test.ts index ff34dc2a93..819654f7e6 100644 --- a/packages/integration-tests/tests/api/accounts.test.ts +++ b/packages/integration-tests/tests/api/accounts.test.ts @@ -2,7 +2,7 @@ import * as request from "supertest"; import { environment } from "../../src/config"; import { localConfig } from "../../src/config"; -import { Buffer, Token, Wallets } from "../../src/constants"; +import { Buffer, Path, Token, Wallets } from "../../src/constants"; import { Helper } from "../../src/helper"; import { Playbook } from "../../src/playbook/playbook"; From e4fb4624d82abd329895a1cb6e8afc0803397bd3 Mon Sep 17 00:00:00 2001 From: pcheremu Date: Thu, 7 Mar 2024 19:58:00 +0100 Subject: [PATCH 23/28] test: added providerCache for networks --- packages/integration-tests/src/constants.ts | 1 - packages/integration-tests/src/helper.ts | 21 +++++++------------ .../src/playbook/contracts/Caller.sol | 2 +- .../src/playbook/contracts/Middle.sol | 2 +- .../src/playbook/contracts/MyERC20.sol | 2 +- packages/integration-tests/src/provider.ts | 21 +++++++++++++++++++ .../tests/api/accounts.test.ts | 2 +- 7 files changed, 32 insertions(+), 19 deletions(-) create mode 100644 packages/integration-tests/src/provider.ts diff --git a/packages/integration-tests/src/constants.ts b/packages/integration-tests/src/constants.ts index 1ad300052c..e46f4a17c5 100644 --- a/packages/integration-tests/src/constants.ts +++ b/packages/integration-tests/src/constants.ts @@ -51,7 +51,6 @@ export enum Logger { } export enum Token { - // CUST_Address = "0x0928008B245A76E105E02C522b5d309c0887ecA5",// probably unused customL2TokenName = "L2 ERC20 token", customL2TokenSymbol = "L2", customL2TokenDecimals = 18, diff --git a/packages/integration-tests/src/helper.ts b/packages/integration-tests/src/helper.ts index 9b599171ae..4c6cded977 100644 --- a/packages/integration-tests/src/helper.ts +++ b/packages/integration-tests/src/helper.ts @@ -3,10 +3,12 @@ import { ethers } from "ethers"; import { promises as fs } from "fs"; import * as path from "path"; import * as request from "supertest"; +import { setTimeout } from "timers/promises"; import { Provider } from "zksync-web3"; import { environment, localConfig } from "./config"; import { Logger } from "./constants"; +import { getProviderForL1, getProviderForL2 } from "./provider"; import type { BaseProvider } from "@ethersproject/providers/src.ts/base-provider"; @@ -38,21 +40,12 @@ export class Helper { async writeFile(filePath: string, fileName: string, data: string) { const absoluteRoute = path.join(filePath, fileName); - try { - await fs.writeFile(absoluteRoute, data); - } catch { - console.log(`Cannot write: ${fileName} to ${filePath}`); - } + await fs.writeFile(absoluteRoute, data); } async readFile(filePath: string, fileName: string) { const absoluteRoute = path.join(filePath, fileName); - - try { - return await fs.readFile(absoluteRoute, { encoding: "utf-8" }); - } catch { - console.log(`There is no the expected file: ${fileName} in ${filePath}`); - } + return await fs.readFile(absoluteRoute, { encoding: "utf-8" }); } async getBalanceETH(walletAddress: string, layer: string) { @@ -60,10 +53,10 @@ export class Helper { let provider: BaseProvider; if (layer == "L1") { network = localConfig.L1Network; - provider = ethers.getDefaultProvider(network); + provider = getProviderForL1(network); } else if (layer == "L2") { network = localConfig.L2Network; - provider = new Provider(network); + provider = getProviderForL2(network); } else { console.log(`Wrong layer: ${layer}`); } @@ -71,7 +64,7 @@ export class Helper { } async delay(ms: number) { - return new Promise((resolve) => setTimeout(resolve, ms)); + await setTimeout(ms); } async performBlockExplorerApiGetRequest(apiRoute: string) { diff --git a/packages/integration-tests/src/playbook/contracts/Caller.sol b/packages/integration-tests/src/playbook/contracts/Caller.sol index 7028ee5148..d8a7ca96ce 100644 --- a/packages/integration-tests/src/playbook/contracts/Caller.sol +++ b/packages/integration-tests/src/playbook/contracts/Caller.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: Unlicense +// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IGreeter2 { diff --git a/packages/integration-tests/src/playbook/contracts/Middle.sol b/packages/integration-tests/src/playbook/contracts/Middle.sol index 6a45f3e3f0..311d227246 100644 --- a/packages/integration-tests/src/playbook/contracts/Middle.sol +++ b/packages/integration-tests/src/playbook/contracts/Middle.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: Unlicense +// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IGreeter { diff --git a/packages/integration-tests/src/playbook/contracts/MyERC20.sol b/packages/integration-tests/src/playbook/contracts/MyERC20.sol index 5eb5a63d78..5821702080 100644 --- a/packages/integration-tests/src/playbook/contracts/MyERC20.sol +++ b/packages/integration-tests/src/playbook/contracts/MyERC20.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: UNLICENSED +// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; diff --git a/packages/integration-tests/src/provider.ts b/packages/integration-tests/src/provider.ts new file mode 100644 index 0000000000..1a31d6f666 --- /dev/null +++ b/packages/integration-tests/src/provider.ts @@ -0,0 +1,21 @@ +import { ethers } from "ethers"; +import { Provider } from "zksync-web3"; + +import type { BaseProvider } from "@ethersproject/providers/src.ts/base-provider"; + +const providerCacheL1: { [key: string]: BaseProvider } = {}; +const providerCacheL2: { [key: string]: Provider } = {}; + +export function getProviderForL2(network: string): Provider { + if (!providerCacheL2[network]) { + providerCacheL2[network] = new Provider(network); + } + return providerCacheL2[network]; +} + +export function getProviderForL1(network: string): BaseProvider { + if (!providerCacheL1[network]) { + providerCacheL1[network] = ethers.getDefaultProvider(network); + } + return providerCacheL1[network]; +} diff --git a/packages/integration-tests/tests/api/accounts.test.ts b/packages/integration-tests/tests/api/accounts.test.ts index 819654f7e6..4ac7e0c211 100644 --- a/packages/integration-tests/tests/api/accounts.test.ts +++ b/packages/integration-tests/tests/api/accounts.test.ts @@ -98,7 +98,7 @@ describe("API module: Account", () => { expect(typeof response.body.result[0].isError).toStrictEqual("string"); expect(typeof response.body.result[0].txreceipt_status).toStrictEqual("string"); expect(typeof response.body.result[0].input).toStrictEqual("string"); - expect(typeof response.body.result[0].contractAddress).toBeTruthy(); // can be null + expect(typeof response.body.result[0].contractAddress).toBeTruthy(); expect(typeof response.body.result[0].cumulativeGasUsed).toStrictEqual("string"); expect(typeof response.body.result[0].gasUsed).toStrictEqual("string"); expect(typeof response.body.result[0].confirmations).toStrictEqual("string"); From 25109d6fc81209df20220726a8d75cdbe9fe4858 Mon Sep 17 00:00:00 2001 From: pcheremu Date: Thu, 7 Mar 2024 20:11:58 +0100 Subject: [PATCH 24/28] test: fix lint --- packages/integration-tests/src/helper.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/integration-tests/src/helper.ts b/packages/integration-tests/src/helper.ts index 4c6cded977..2482ba4809 100644 --- a/packages/integration-tests/src/helper.ts +++ b/packages/integration-tests/src/helper.ts @@ -4,7 +4,6 @@ import { promises as fs } from "fs"; import * as path from "path"; import * as request from "supertest"; import { setTimeout } from "timers/promises"; -import { Provider } from "zksync-web3"; import { environment, localConfig } from "./config"; import { Logger } from "./constants"; From 572b272dc28389da594800ffc386293510ed90b0 Mon Sep 17 00:00:00 2001 From: pcheremu Date: Thu, 7 Mar 2024 20:48:46 +0100 Subject: [PATCH 25/28] test: updated names --- packages/integration-tests/package.json | 2 +- packages/integration-tests/src/config.ts | 2 +- .../integration-tests/src/playbook/deploy/deploy-greeter.ts | 2 +- packages/integration-tests/src/playbook/deploy/erc20toL1.ts | 2 +- packages/integration-tests/src/playbook/deploy/erc20toL2.ts | 2 +- packages/integration-tests/src/playbook/deploy/use-multiCall.ts | 2 +- .../src/playbook/deploy/use-multitransferETH.ts | 2 +- .../src/playbook/scenarios/deposit/depositERC20.ts | 2 +- .../src/playbook/scenarios/transfers/transferERC20.ts | 2 +- .../src/playbook/scenarios/transfers/transferFailedState.ts | 2 +- .../src/playbook/scenarios/withdrawal/withdrawERC20.ts | 2 +- .../scenarios/withdrawal/withdrawERC20toOtherAddress.ts | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/integration-tests/package.json b/packages/integration-tests/package.json index 24ee6ad63a..19faa6ed50 100644 --- a/packages/integration-tests/package.json +++ b/packages/integration-tests/package.json @@ -2,7 +2,7 @@ "name": "integration-tests", "version": "0.0.0", "title": "Integration tests", - "description": "The test solution for transaction processing`", + "description": "The test solution for Block Explorer API and UI", "repository": "https://github.com/matter-labs/block-explorer", "private": true, "author": "Matter Labs", diff --git a/packages/integration-tests/src/config.ts b/packages/integration-tests/src/config.ts index 561f6b9694..cac998fd3e 100644 --- a/packages/integration-tests/src/config.ts +++ b/packages/integration-tests/src/config.ts @@ -1,7 +1,7 @@ import { Wallets } from "./constants"; export const localConfig = { - gasLimit: { gasLimit: 10000000 }, + l1GasLimit: { gasLimit: 10000000 }, l2GasLimit: 10000000, L1Network: "http://localhost:8545", L2Network: "http://localhost:3050", diff --git a/packages/integration-tests/src/playbook/deploy/deploy-greeter.ts b/packages/integration-tests/src/playbook/deploy/deploy-greeter.ts index 1c331921b3..b6f4c1b6eb 100644 --- a/packages/integration-tests/src/playbook/deploy/deploy-greeter.ts +++ b/packages/integration-tests/src/playbook/deploy/deploy-greeter.ts @@ -13,7 +13,7 @@ export default async function (hre: HardhatRuntimeEnvironment) { const deployer = new Deployer(hre, wallet); const artifact = await deployer.loadArtifact("Greeter"); - const contract = await deployer.deploy(artifact, [], localConfig.gasLimit); + const contract = await deployer.deploy(artifact, [], localConfig.l1GasLimit); const contractAddress = contract.address; console.log(`${artifact.contractName} was deployed to ${contractAddress}`); await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.greeterL2, contractAddress); diff --git a/packages/integration-tests/src/playbook/deploy/erc20toL1.ts b/packages/integration-tests/src/playbook/deploy/erc20toL1.ts index 49d8bf006c..a8ef78e7f2 100644 --- a/packages/integration-tests/src/playbook/deploy/erc20toL1.ts +++ b/packages/integration-tests/src/playbook/deploy/erc20toL1.ts @@ -15,7 +15,7 @@ async function main() { console.log("Account balance:", await ethers.utils.formatEther(weiAmount)); const contract = await ethers.getContractFactory("L1"); - const token = await contract.deploy(Wallets.richWalletAddress, localConfig.gasLimit); + const token = await contract.deploy(Wallets.richWalletAddress, localConfig.l1GasLimit); await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.L1, token.address); } diff --git a/packages/integration-tests/src/playbook/deploy/erc20toL2.ts b/packages/integration-tests/src/playbook/deploy/erc20toL2.ts index 51b7d2a86a..0213227cb2 100644 --- a/packages/integration-tests/src/playbook/deploy/erc20toL2.ts +++ b/packages/integration-tests/src/playbook/deploy/erc20toL2.ts @@ -13,7 +13,7 @@ export default async function (hre: HardhatRuntimeEnvironment) { const deployer = new Deployer(hre, wallet); const artifact = await deployer.loadArtifact("L2"); - const contract = await deployer.deploy(artifact, [], localConfig.gasLimit); + const contract = await deployer.deploy(artifact, [], localConfig.l1GasLimit); const contractAddress = contract.address; console.log(`${artifact.contractName} was deployed to ${contractAddress}`); await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.L2, contractAddress); diff --git a/packages/integration-tests/src/playbook/deploy/use-multiCall.ts b/packages/integration-tests/src/playbook/deploy/use-multiCall.ts index cadf86fdf2..21f440d144 100644 --- a/packages/integration-tests/src/playbook/deploy/use-multiCall.ts +++ b/packages/integration-tests/src/playbook/deploy/use-multiCall.ts @@ -24,7 +24,7 @@ export default async function (hre: HardhatRuntimeEnvironment) { const attachedContract = new ethers.Contract(TRANSFER_CONTRACT_ADDRESS, factoryArtifact.abi, wallet); console.log(`Contract said something like this by default: ${await attachedContract.newCallGreeter()}`); const newGreet = "New Greet!"; - const setNewGreetingHandle = await attachedContract.newSetGreet(newGreet, localConfig.gasLimit); + const setNewGreetingHandle = await attachedContract.newSetGreet(newGreet, localConfig.l1GasLimit); await setNewGreetingHandle.wait(1); const txHash = setNewGreetingHandle.hash; diff --git a/packages/integration-tests/src/playbook/deploy/use-multitransferETH.ts b/packages/integration-tests/src/playbook/deploy/use-multitransferETH.ts index 9f72911068..5447e7d380 100644 --- a/packages/integration-tests/src/playbook/deploy/use-multitransferETH.ts +++ b/packages/integration-tests/src/playbook/deploy/use-multitransferETH.ts @@ -43,7 +43,7 @@ export default async function callMultiTransferETH(hre: HardhatRuntimeEnvironmen to: contractAddress, token: token, amount, - overrides: localConfig.gasLimit, + overrides: localConfig.l1GasLimit, }); // await commitment diff --git a/packages/integration-tests/src/playbook/scenarios/deposit/depositERC20.ts b/packages/integration-tests/src/playbook/scenarios/deposit/depositERC20.ts index ac4154631d..01a043ad9c 100644 --- a/packages/integration-tests/src/playbook/scenarios/deposit/depositERC20.ts +++ b/packages/integration-tests/src/playbook/scenarios/deposit/depositERC20.ts @@ -17,7 +17,7 @@ export const depositERC20 = async function (sum = "0.5", tokenAddress: string, u amount: ethers.utils.parseUnits(sum, units), approveERC20: true, l2GasLimit: localConfig.l2GasLimit, - overrides: localConfig.gasLimit, + overrides: localConfig.l1GasLimit, }); await deposit.wait(1); diff --git a/packages/integration-tests/src/playbook/scenarios/transfers/transferERC20.ts b/packages/integration-tests/src/playbook/scenarios/transfers/transferERC20.ts index 3d82d75ead..5ca3dc6662 100644 --- a/packages/integration-tests/src/playbook/scenarios/transfers/transferERC20.ts +++ b/packages/integration-tests/src/playbook/scenarios/transfers/transferERC20.ts @@ -16,7 +16,7 @@ export const transferERC20 = async function (sum: string, tokenAddress: string, to: syncWallet2.address, token: tokenAddress, amount: ethers.utils.parseEther(sum), - overrides: localConfig.gasLimit, + overrides: localConfig.l1GasLimit, }); const txHash = transfer.hash; diff --git a/packages/integration-tests/src/playbook/scenarios/transfers/transferFailedState.ts b/packages/integration-tests/src/playbook/scenarios/transfers/transferFailedState.ts index b618b38626..f266a47bbe 100644 --- a/packages/integration-tests/src/playbook/scenarios/transfers/transferFailedState.ts +++ b/packages/integration-tests/src/playbook/scenarios/transfers/transferFailedState.ts @@ -16,7 +16,7 @@ export const transferFailedState = async function (tokenAddress: string, tokenNa to: "0x0000000000000000000000000000000000000000", token: tokenAddress, amount, - overrides: localConfig.gasLimit, + overrides: localConfig.l1GasLimit, }); const txHash = transfer.hash; diff --git a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20.ts b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20.ts index 39897516f4..ff9d874760 100644 --- a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20.ts +++ b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20.ts @@ -21,7 +21,7 @@ export const withdrawERC20 = async function (tokenAddress: string, sum = "0.2") amount: ethers.utils.parseEther(sum), token: tokenAddress, bridgeAddress: bridges.erc20L2, - // overrides: localConfig.gasLimit, + // overrides: localConfig.l1GasLimit, }); const txHash = withdrawL2.hash; diff --git a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20toOtherAddress.ts b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20toOtherAddress.ts index ccf4a48857..68b1fdf6ab 100644 --- a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20toOtherAddress.ts +++ b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20toOtherAddress.ts @@ -21,7 +21,7 @@ export const withdrawERC20toOtherAddress = async function (tokenAddress: string, amount: ethers.utils.parseEther(sum), token: tokenAddress, bridgeAddress: bridges.erc20L2, - overrides: localConfig.gasLimit, + overrides: localConfig.l1GasLimit, }); const txHash = withdrawL2.hash; From 18205f5ab957d348fc7e45d7d71b3e9abf08d59b Mon Sep 17 00:00:00 2001 From: pcheremu Date: Thu, 7 Mar 2024 21:33:14 +0100 Subject: [PATCH 26/28] test: npm ci with audit --- .github/workflows/integration-tests-api.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-tests-api.yml b/.github/workflows/integration-tests-api.yml index f191349d4c..d436227849 100644 --- a/.github/workflows/integration-tests-api.yml +++ b/.github/workflows/integration-tests-api.yml @@ -37,7 +37,7 @@ jobs: - name: Install dependencies run: | - npm ci --no-audit + npm ci npx playwright install --with-deps chromium - name: Log in to Docker Hub uses: docker/login-action@v2 From 1688bf6c0e2c1bc311e61fa5a07ccc584f385f1a Mon Sep 17 00:00:00 2001 From: Oleh Bairak <118197764+olehbairak@users.noreply.github.com> Date: Tue, 12 Mar 2024 14:08:53 +0100 Subject: [PATCH 27/28] fix: fix for wrong contract bytecode for UI E2E tests (#205) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # What ❔ Added the correct bytecode for the UI E2E tests. ## Why ❔ To keep them up-to-date and functional. ## Checklist - [x] PR title corresponds to the body of PR (we generate changelog entries from PRs). - [x] Tests for the changes have been added / updated. - [ ] Documentation comments have been added / updated. --- packages/app/tests/e2e/features/copying.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/app/tests/e2e/features/copying.feature b/packages/app/tests/e2e/features/copying.feature index 37e4cab336..d265f41bdf 100644 --- a/packages/app/tests/e2e/features/copying.feature +++ b/packages/app/tests/e2e/features/copying.feature @@ -109,7 +109,7 @@ Feature: Copying Examples: | Text | - | 0x00050000000000020000008003000039000000400030043f00000000030100190000006003300270000000d7033001970000000102200190000000240000c13d000000040230008c0000030a0000413d000000000201043b000000e002200270000000d90420009c0000002c0000a13d000000da0420009c000000380000a13d000000db0420009c000000950000613d000000dc0420009c000001ea0000613d000000dd0220009c0000030a0000c13d0000000002000416000000000202004b0000030a0000c13d000000040230008a000000200220008c0000030a0000413d0000000401100370000000000101043b000000e5011001970000000000100435000000200000043f00000000010000190358033c0000040f000000360000013d0000000001000416000000000101004b0000030a0000c13d000000200100003900000100001004430000012000000443000000d801000041000003590001042e000000e00420009c000000600000213d000000e30120009c000001a60000613d000000e40120009c0000030a0000c13d0000000001000416000000000101004b0000030a0000c13d0000000101000039000000000101041a000001e70000013d000000de0420009c000001af0000613d000000df0220009c0000030a0000c13d0000000002000416000000000202004b0000030a0000c13d000000040230008a000000600220008c0000030a0000413d0000000402100370000000000402043b000000e50240009c0000030a0000213d0000002402100370000000000202043b000000e505200197000000e50220009c0000030a0000213d00000000020004110000004401100370000000000301043b000080060120008c000002090000613d000000090100008a000000000112016f000080010110008c000002090000613d000000f001000041000000800010043f0000002001000039000000840010043f0000003e01000039000000a40010043f000000f101000041000000c40010043f000000f201000041000000e40010043f000000f3010000410000035a00010430000000e10420009c000001e30000613d000000e20220009c0000030a0000c13d0000000002000416000000000202004b0000030a0000c13d000000040230008a000000400220008c0000030a0000413d0000000402100370000000000402043b000000e50240009c0000030a0000213d0000002401100370000000000501043b0000000001000411000080010110008c000001ff0000c13d0000000101000039000000000301041a0000000002530019000000000332004b000000000300001900000001030040390000000103300190000000910000c13d000400000005001d000000000021041b0000000000400435000000200000043f000000d7010000410000000002000414000000d70320009c0000000002018019000000c001200210000000eb011001c70000801002000039000500000004001d035803530000040f000000050500002900000001022001900000030a0000613d000000000101043b000000000201041a0000000403000029000000000232001a000000910000413d000002c20000013d000000fa0100004100000000001004350000001101000039000001e00000013d000000040230008a000000400220008c0000030a0000413d0000000402100370000000000802043b000000e50280009c0000030a0000213d0000002402100370000000000402043b000000e90240009c0000030a0000213d0000002302400039000000ea05000041000000000632004b00000000060000190000000006058019000000ea02200197000000000702004b0000000005008019000000ea0220009c000000000506c019000000000205004b0000030a0000c13d0000000405400039000000000251034f000000000202043b000000e90620009c000001dd0000213d000000bf06200039000000200900008a000000000696016f000000e90760009c000001dd0000213d000000400060043f000000800020043f00000000042400190000002404400039000000000334004b0000030a0000213d0000002003500039000000000131034f0000001f0320018f0000000504200272000000ca0000613d00000000050000190000000506500210000000000761034f000000000707043b000000a00660003900000000007604350000000105500039000000000645004b000000c20000413d000400000009001d000500000008001d000000000503004b000000db0000613d0000000504400210000000000141034f0000000303300210000000a004400039000000000504043300000000053501cf000000000535022f000000000101043b0000010003300089000000000131022f00000000013101cf000000000151019f0000000000140435000000a00120003900000000000104350000000001000416000300000001001d00000000010004100000000000100435000000200000043f000000d7010000410000000002000414000000d70320009c0000000002018019000000c001200210000000eb011001c70000801002000039035803530000040f0000000102200190000000050400002900000004070000290000030a0000613d000000000101043b000000000201041a00000003090000290000000002920049000000000021041b0000000101000039000000000201041a0000000002920049000000000021041b000000ec02000041000000400100043d000000200310003900000000002304350000006002400210000000240310003900000000002304350000000008000411000000600280021000000058031000390000000000230435000000380210003900000000009204350000006c03100039000000800200043d000000000402004b000001100000613d00000000040000190000000005340019000000a006400039000000000606043300000000006504350000002004400039000000000524004b000001090000413d000000000332001900000000000304350000004c0320003900000000003104350000008b02200039000000000272016f000000000a12001900000000022a004b00000000020000190000000102004039000000e903a0009c000001dd0000213d0000000102200190000001dd0000c13d000100000008001d0000004000a0043f000000ed0200004100000000002a04350000000402a000390000002003000039000000000032043500000000020104330000002403a0003900000000002304350000004403a00039000000000402004b000001330000613d000000000400001900000000053400190000002004400039000000000614001900000000060604330000000000650435000000000524004b0000012c0000413d000000000132001900000000000104350000001f01200039000000000171016f000000d702000041000000d703a0009c000000000302001900000000030a401900000040033002100000004401100039000000d70410009c00000000010280190000006001100210000000000131019f0000000003000414000000d70430009c0000000003028019000000c002300210000000000112019f000080080200003900020000000a001d0358034e0000040f000000020a00002900000000030100190000006003300270000000d703300197000000200430008c000000000403001900000020040080390000001f0540018f00000005064002720000015c0000613d0000000007000019000000050870021000000000098a0019000000000881034f000000000808043b00000000008904350000000107700039000000000867004b000001540000413d000000000705004b0000016b0000613d0000000506600210000000000761034f00000000066a00190000000305500210000000000806043300000000085801cf000000000858022f000000000707043b0000010005500089000000000757022f00000000055701cf000000000585019f000000000056043500000001022001900000030c0000613d0000001f01400039000000600210018f0000000001a20019000000000221004b00000000020000190000000102004039000000e90410009c00000005040000290000000305000029000001dd0000213d0000000102200190000001dd0000c13d000000400010043f000000200230008c0000030a0000413d00000020021000390000004003000039000000000032043500000000005104350000004003100039000000800200043d00000000002304350000006003100039000000e506400197000000000402004b0000018f0000613d00000000040000190000000005340019000000a007400039000000000707043300000000007504350000002004400039000000000524004b000001880000413d000000000332001900000000000304350000007f02200039000000040220017f000000d703000041000000d70410009c00000000010380190000004001100210000000d70420009c00000000020380190000006002200210000000000112019f0000000002000414000000d70420009c0000000002038019000000c002200210000000000112019f000000ee011001c70000800d020000390000000303000039000000ef040000410000000105000029000003050000013d0000000001000416000000000101004b0000030a0000c13d000000c001000039000000400010043f0000000501000039000000800010043f000000ff01000041000001f20000013d000000040230008a000000200220008c0000030a0000413d0000000401100370000000000401043b000000e50140009c0000030a0000213d0000000001000416000400000001001d00000000010004100000000000100435000000200000043f000000d7010000410000000002000414000000d70320009c0000000002018019000000c001200210000000eb011001c70000801002000039000500000004001d035803530000040f000000050400002900000001022001900000030a0000613d000000000101043b000000000201041a00000004050000290000000002520049000000000021041b0000000101000039000000000201041a0000000002520049000000000021041b000000ec02000041000000400100043d000000200310003900000000002304350000006002400210000000240310003900000000002304350000003802100039000000000052043500000038020000390000000000210435000000f80210009c0000022f0000413d000000fa0100004100000000001004350000004101000039000000040010043f000000fb010000410000035a000104300000000001000416000000000101004b0000030a0000c13d0000001201000039000000800010043f000000e601000041000003590001042e0000000001000416000000000101004b0000030a0000c13d000000c001000039000000400010043f0000000301000039000000800010043f000000e701000041000000a00010043f0000002001000039000000c00010043f0000008001000039000000e002000039035803290000040f000000c00110008a000000d702000041000000d70310009c00000000010280190000006001100210000000e8011001c7000003590001042e000000f001000041000000800010043f0000002001000039000000840010043f0000001f01000039000000a40010043f000000fc01000041000000c40010043f000000fd010000410000035a00010430000400000003001d0000000000400435000000200000043f000000d7010000410000000002000414000000d70320009c0000000002018019000000c001200210000000eb011001c70000801002000039000500000004001d000300000005001d035803530000040f000000050300002900000001022001900000030a0000613d000000000101043b000000000201041a000000040120006c000002d30000813d000000400100043d0000004402100039000000f603000041000000000032043500000024021000390000001f030000390000000000320435000000f0020000410000000000210435000000040210003900000020030000390000000000320435000000d702000041000000d70310009c00000000010280190000004001100210000000f7011001c70000035a000104300000006007100039000000400070043f000000ed020000410000000000270435000000640210003900000020030000390000000000320435000000840310003900000000020104330000000000230435000000a403100039000000000402004b000002440000613d000000000400001900000000053400190000002004400039000000000614001900000000060604330000000000650435000000000524004b0000023d0000413d000000000132001900000000000104350000001f01200039000000200200008a000000000121016f000000d702000041000000d70370009c0000000003020019000000000307401900000040033002100000004401100039000000d70410009c00000000010280190000006001100210000000000131019f0000000003000414000000d70430009c0000000003028019000000c002300210000000000112019f0000800802000039000300000007001d0358034e0000040f000000030a00002900000000030100190000006003300270000000d703300197000000200430008c000000000403001900000020040080390000001f0540018f00000005064002720000026e0000613d0000000007000019000000050870021000000000098a0019000000000881034f000000000808043b00000000008904350000000107700039000000000867004b000002660000413d000000000705004b0000027d0000613d0000000506600210000000000761034f00000000066a00190000000305500210000000000806043300000000085801cf000000000858022f000000000707043b0000010005500089000000000757022f00000000055701cf000000000585019f000000000056043500000001022001900000029f0000613d0000001f01400039000000600210018f0000000001a20019000000000221004b00000000020000190000000102004039000000e90410009c00000005050000290000000404000029000001dd0000213d0000000102200190000001dd0000c13d000000400010043f000000200230008c0000030a0000413d0000000000410435000000d7020000410000000003000414000000d70430009c0000000003028019000000d70410009c00000000010280190000004001100210000000c002300210000000000112019f000000f4011001c7000000e5065001970000800d0200003900000003030000390000000005000411000000f904000041000003050000013d000000400200043d0000001f0430018f0000000505300272000002ac0000613d000000000600001900000005076002100000000008720019000000000771034f000000000707043b00000000007804350000000106600039000000000756004b000002a40000413d000000000604004b000002bb0000613d0000000505500210000000000151034f00000000055200190000000304400210000000000605043300000000064601cf000000000646022f000000000101043b0000010004400089000000000141022f00000000014101cf000000000161019f0000000000150435000000d701000041000000d70420009c000000000201801900000040012002100000006002300210000000000121019f0000035a00010430000000000021041b000000400100043d0000000000310435000000d7020000410000000003000414000000d70430009c0000000003028019000000d70410009c00000000010280190000004001100210000000c002300210000000000112019f000000f4011001c70000800d020000390000000203000039000000fe04000041000003050000013d000200000002001d0000000000300435000000200000043f000000d7030000410000000001000414000000d70210009c0000000001038019000000c001100210000000eb011001c70000801002000039035803530000040f000000030300002900000001022001900000030a0000613d0000000204000029000000040240006a000000000101043b000000000021041b00000000003004350000000001000414000000d70210009c000000d701008041000000c001100210000000eb011001c70000801002000039035803530000040f0000000306000029000000050500002900000001022001900000030a0000613d000000000101043b000000000201041a00000004030000290000000002320019000000000021041b000000400100043d0000000000310435000000d7020000410000000003000414000000d70430009c0000000003028019000000d70410009c00000000010280190000004001100210000000c002300210000000000112019f000000f4011001c70000800d020000390000000303000039000000f5040000410358034e0000040f00000001012001900000030a0000613d0000000001000019000003590001042e00000000010000190000035a00010430000000400200043d0000001f0430018f0000000505300272000003190000613d000000000600001900000005076002100000000008720019000000000771034f000000000707043b00000000007804350000000106600039000000000756004b000003110000413d000000000604004b000003280000613d0000000505500210000000000151034f00000000055200190000000304400210000000000605043300000000064601cf000000000646022f000000000101043b0000010004400089000000000141022f00000000014101cf000000000161019f0000000000150435000002bb0000013d00000000030104330000000002320436000000000403004b000003350000613d000000000400001900000000052400190000002004400039000000000614001900000000060604330000000000650435000000000534004b0000032e0000413d000000000123001900000000000104350000001f01300039000000200300008a000000000131016f0000000001120019000000000001042d000000d702000041000000d70310009c00000000010280190000000003000414000000d70430009c0000000003028019000000c0023002100000004001100210000000000121019f000000eb011001c70000801002000039035803530000040f00000001022001900000034c0000613d000000000101043b000000000001042d00000000010000190000035a0001043000000351002104210000000102000039000000000001042d0000000002000019000000000001042d00000356002104230000000102000039000000000001042d0000000002000019000000000001042d0000035800000432000003590001042e0000035a00010430000000000000000000000000000000000000000000000000000000000000000000000000ffffffff00000002000000000000000000000000000000400000010000000000000000000000000000000000000000000000000000000000000000000000000051cff8d80000000000000000000000000000000000000000000000000000000084bc3eaf0000000000000000000000000000000000000000000000000000000084bc3eb00000000000000000000000000000000000000000000000000000000095d89b41000000000000000000000000000000000000000000000000000000009cc7f7080000000000000000000000000000000000000000000000000000000051cff8d900000000000000000000000000000000000000000000000000000000579952fc00000000000000000000000000000000000000000000000000000000313ce56600000000000000000000000000000000000000000000000000000000313ce5670000000000000000000000000000000000000000000000000000000040c10f190000000000000000000000000000000000000000000000000000000006fdde030000000000000000000000000000000000000000000000000000000018160ddd000000000000000000000000ffffffffffffffffffffffffffffffffffffffff000000000000000000000000000000000000002000000080000000000000000045544800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000ffffffffffffffff800000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000400000000000000000000000006c0960f90000000000000000000000000000000000000000000000000000000062f84b24000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000c405fe8958410bbaf0c73b7a0c3e20859e86ca168a4c9b0def9c54d2555a306b08c379a0000000000000000000000000000000000000000000000000000000004f6e6c792073797374656d20636f6e7472616374732077697468207370656369616c206163636573732063616e2063616c6c2074686973206d6574686f64000000000000000000000000000000000000000000840000008000000000000000000200000000000000000000000000000000000020000000000000000000000000ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef5472616e7366657220616d6f756e7420657863656564732062616c616e6365000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffa02717ead6b9200dd235aad468c9809ea400fe33ac69b5bfaa6d3e90fc922b63984e487b7100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002400000000000000000000000043616c6c61626c65206f6e6c792062792074686520626f6f746c6f616465720000000000000000000000000000000000000000640000008000000000000000000f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688545746865720000000000000000000000000000000000000000000000000000007b182cdf1aa84e348ae5644feda1c98a5a163d38bb021538445530813acd46bb | + | 0x00050000000000020000008003000039000000400030043f00000000030100190000006003300270000000d7033001970000000102200190000000240000c13d000000040230008c0000030a0000413d000000000201043b000000e002200270000000d90420009c0000002c0000a13d000000da0420009c000000380000a13d000000db0420009c000000950000613d000000dc0420009c000001ea0000613d000000dd0220009c0000030a0000c13d0000000002000416000000000202004b0000030a0000c13d000000040230008a000000200220008c0000030a0000413d0000000401100370000000000101043b000000e5011001970000000000100435000000200000043f00000000010000190358033c0000040f000000360000013d0000000001000416000000000101004b0000030a0000c13d000000200100003900000100001004430000012000000443000000d801000041000003590001042e000000e00420009c000000600000213d000000e30120009c000001a60000613d000000e40120009c0000030a0000c13d0000000001000416000000000101004b0000030a0000c13d0000000101000039000000000101041a000001e70000013d000000de0420009c000001af0000613d000000df0220009c0000030a0000c13d0000000002000416000000000202004b0000030a0000c13d000000040230008a000000600220008c0000030a0000413d0000000402100370000000000402043b000000e50240009c0000030a0000213d0000002402100370000000000202043b000000e505200197000000e50220009c0000030a0000213d00000000020004110000004401100370000000000301043b000080060120008c000002090000613d000000090100008a000000000112016f000080010110008c000002090000613d000000f001000041000000800010043f0000002001000039000000840010043f0000003e01000039000000a40010043f000000f101000041000000c40010043f000000f201000041000000e40010043f000000f3010000410000035a00010430000000e10420009c000001e30000613d000000e20220009c0000030a0000c13d0000000002000416000000000202004b0000030a0000c13d000000040230008a000000400220008c0000030a0000413d0000000402100370000000000402043b000000e50240009c0000030a0000213d0000002401100370000000000501043b0000000001000411000080010110008c000001ff0000c13d0000000101000039000000000301041a0000000002530019000000000332004b000000000300001900000001030040390000000103300190000000910000c13d000400000005001d000000000021041b0000000000400435000000200000043f000000d7010000410000000002000414000000d70320009c0000000002018019000000c001200210000000eb011001c70000801002000039000500000004001d035803530000040f000000050500002900000001022001900000030a0000613d000000000101043b000000000201041a0000000403000029000000000232001a000000910000413d000002c20000013d000000fa0100004100000000001004350000001101000039000001e00000013d000000040230008a000000400220008c0000030a0000413d0000000402100370000000000802043b000000e50280009c0000030a0000213d0000002402100370000000000402043b000000e90240009c0000030a0000213d0000002302400039000000ea05000041000000000632004b00000000060000190000000006058019000000ea02200197000000000702004b0000000005008019000000ea0220009c000000000506c019000000000205004b0000030a0000c13d0000000405400039000000000251034f000000000202043b000000e90620009c000001dd0000213d000000bf06200039000000200900008a000000000696016f000000e90760009c000001dd0000213d000000400060043f000000800020043f00000000042400190000002404400039000000000334004b0000030a0000213d0000002003500039000000000131034f0000001f0320018f0000000504200272000000ca0000613d00000000050000190000000506500210000000000761034f000000000707043b000000a00660003900000000007604350000000105500039000000000645004b000000c20000413d000400000009001d000500000008001d000000000503004b000000db0000613d0000000504400210000000000141034f0000000303300210000000a004400039000000000504043300000000053501cf000000000535022f000000000101043b0000010003300089000000000131022f00000000013101cf000000000151019f0000000000140435000000a00120003900000000000104350000000001000416000300000001001d00000000010004100000000000100435000000200000043f000000d7010000410000000002000414000000d70320009c0000000002018019000000c001200210000000eb011001c70000801002000039035803530000040f0000000102200190000000050400002900000004070000290000030a0000613d000000000101043b000000000201041a00000003090000290000000002920049000000000021041b0000000101000039000000000201041a0000000002920049000000000021041b000000ec02000041000000400100043d000000200310003900000000002304350000006002400210000000240310003900000000002304350000000008000411000000600280021000000058031000390000000000230435000000380210003900000000009204350000006c03100039000000800200043d000000000402004b000001100000613d00000000040000190000000005340019000000a006400039000000000606043300000000006504350000002004400039000000000524004b000001090000413d000000000332001900000000000304350000004c0320003900000000003104350000008b02200039000000000272016f000000000a12001900000000022a004b00000000020000190000000102004039000000e903a0009c000001dd0000213d0000000102200190000001dd0000c13d000100000008001d0000004000a0043f000000ed0200004100000000002a04350000000402a000390000002003000039000000000032043500000000020104330000002403a0003900000000002304350000004403a00039000000000402004b000001330000613d000000000400001900000000053400190000002004400039000000000614001900000000060604330000000000650435000000000524004b0000012c0000413d000000000132001900000000000104350000001f01200039000000000171016f000000d702000041000000d703a0009c000000000302001900000000030a401900000040033002100000004401100039000000d70410009c00000000010280190000006001100210000000000131019f0000000003000414000000d70430009c0000000003028019000000c002300210000000000112019f000080080200003900020000000a001d0358034e0000040f000000020a00002900000000030100190000006003300270000000d703300197000000200430008c000000000403001900000020040080390000001f0540018f00000005064002720000015c0000613d0000000007000019000000050870021000000000098a0019000000000881034f000000000808043b00000000008904350000000107700039000000000867004b000001540000413d000000000705004b0000016b0000613d0000000506600210000000000761034f00000000066a00190000000305500210000000000806043300000000085801cf000000000858022f000000000707043b0000010005500089000000000757022f00000000055701cf000000000585019f000000000056043500000001022001900000030c0000613d0000001f01400039000000600210018f0000000001a20019000000000221004b00000000020000190000000102004039000000e90410009c00000005040000290000000305000029000001dd0000213d0000000102200190000001dd0000c13d000000400010043f000000200230008c0000030a0000413d00000020021000390000004003000039000000000032043500000000005104350000004003100039000000800200043d00000000002304350000006003100039000000e506400197000000000402004b0000018f0000613d00000000040000190000000005340019000000a007400039000000000707043300000000007504350000002004400039000000000524004b000001880000413d000000000332001900000000000304350000007f02200039000000040220017f000000d703000041000000d70410009c00000000010380190000004001100210000000d70420009c00000000020380190000006002200210000000000112019f0000000002000414000000d70420009c0000000002038019000000c002200210000000000112019f000000ee011001c70000800d020000390000000303000039000000ef040000410000000105000029000003050000013d0000000001000416000000000101004b0000030a0000c13d000000c001000039000000400010043f0000000501000039000000800010043f000000ff01000041000001f20000013d000000040230008a000000200220008c0000030a0000413d0000000401100370000000000401043b000000e50140009c0000030a0000213d0000000001000416000400000001001d00000000010004100000000000100435000000200000043f000000d7010000410000000002000414000000d70320009c0000000002018019000000c001200210000000eb011001c70000801002000039000500000004001d035803530000040f000000050400002900000001022001900000030a0000613d000000000101043b000000000201041a00000004050000290000000002520049000000000021041b0000000101000039000000000201041a0000000002520049000000000021041b000000ec02000041000000400100043d000000200310003900000000002304350000006002400210000000240310003900000000002304350000003802100039000000000052043500000038020000390000000000210435000000f80210009c0000022f0000413d000000fa0100004100000000001004350000004101000039000000040010043f000000fb010000410000035a000104300000000001000416000000000101004b0000030a0000c13d0000001201000039000000800010043f000000e601000041000003590001042e0000000001000416000000000101004b0000030a0000c13d000000c001000039000000400010043f0000000301000039000000800010043f000000e701000041000000a00010043f0000002001000039000000c00010043f0000008001000039000000e002000039035803290000040f000000c00110008a000000d702000041000000d70310009c00000000010280190000006001100210000000e8011001c7000003590001042e000000f001000041000000800010043f0000002001000039000000840010043f0000001f01000039000000a40010043f000000fc01000041000000c40010043f000000fd010000410000035a00010430000400000003001d0000000000400435000000200000043f000000d7010000410000000002000414000000d70320009c0000000002018019000000c001200210000000eb011001c70000801002000039000500000004001d000300000005001d035803530000040f000000050300002900000001022001900000030a0000613d000000000101043b000000000201041a000000040120006c000002d30000813d000000400100043d0000004402100039000000f603000041000000000032043500000024021000390000001f030000390000000000320435000000f0020000410000000000210435000000040210003900000020030000390000000000320435000000d702000041000000d70310009c00000000010280190000004001100210000000f7011001c70000035a000104300000006007100039000000400070043f000000ed020000410000000000270435000000640210003900000020030000390000000000320435000000840310003900000000020104330000000000230435000000a403100039000000000402004b000002440000613d000000000400001900000000053400190000002004400039000000000614001900000000060604330000000000650435000000000524004b0000023d0000413d000000000132001900000000000104350000001f01200039000000200200008a000000000121016f000000d702000041000000d70370009c0000000003020019000000000307401900000040033002100000004401100039000000d70410009c00000000010280190000006001100210000000000131019f0000000003000414000000d70430009c0000000003028019000000c002300210000000000112019f0000800802000039000300000007001d0358034e0000040f000000030a00002900000000030100190000006003300270000000d703300197000000200430008c000000000403001900000020040080390000001f0540018f00000005064002720000026e0000613d0000000007000019000000050870021000000000098a0019000000000881034f000000000808043b00000000008904350000000107700039000000000867004b000002660000413d000000000705004b0000027d0000613d0000000506600210000000000761034f00000000066a00190000000305500210000000000806043300000000085801cf000000000858022f000000000707043b0000010005500089000000000757022f00000000055701cf000000000585019f000000000056043500000001022001900000029f0000613d0000001f01400039000000600210018f0000000001a20019000000000221004b00000000020000190000000102004039000000e90410009c00000005050000290000000404000029000001dd0000213d0000000102200190000001dd0000c13d000000400010043f000000200230008c0000030a0000413d0000000000410435000000d7020000410000000003000414000000d70430009c0000000003028019000000d70410009c00000000010280190000004001100210000000c002300210000000000112019f000000f4011001c7000000e5065001970000800d0200003900000003030000390000000005000411000000f904000041000003050000013d000000400200043d0000001f0430018f0000000505300272000002ac0000613d000000000600001900000005076002100000000008720019000000000771034f000000000707043b00000000007804350000000106600039000000000756004b000002a40000413d000000000604004b000002bb0000613d0000000505500210000000000151034f00000000055200190000000304400210000000000605043300000000064601cf000000000646022f000000000101043b0000010004400089000000000141022f00000000014101cf000000000161019f0000000000150435000000d701000041000000d70420009c000000000201801900000040012002100000006002300210000000000121019f0000035a00010430000000000021041b000000400100043d0000000000310435000000d7020000410000000003000414000000d70430009c0000000003028019000000d70410009c00000000010280190000004001100210000000c002300210000000000112019f000000f4011001c70000800d020000390000000203000039000000fe04000041000003050000013d000200000002001d0000000000300435000000200000043f000000d7030000410000000001000414000000d70210009c0000000001038019000000c001100210000000eb011001c70000801002000039035803530000040f000000030300002900000001022001900000030a0000613d0000000204000029000000040240006a000000000101043b000000000021041b00000000003004350000000001000414000000d70210009c000000d701008041000000c001100210000000eb011001c70000801002000039035803530000040f0000000306000029000000050500002900000001022001900000030a0000613d000000000101043b000000000201041a00000004030000290000000002320019000000000021041b000000400100043d0000000000310435000000d7020000410000000003000414000000d70430009c0000000003028019000000d70410009c00000000010280190000004001100210000000c002300210000000000112019f000000f4011001c70000800d020000390000000303000039000000f5040000410358034e0000040f00000001012001900000030a0000613d0000000001000019000003590001042e00000000010000190000035a00010430000000400200043d0000001f0430018f0000000505300272000003190000613d000000000600001900000005076002100000000008720019000000000771034f000000000707043b00000000007804350000000106600039000000000756004b000003110000413d000000000604004b000003280000613d0000000505500210000000000151034f00000000055200190000000304400210000000000605043300000000064601cf000000000646022f000000000101043b0000010004400089000000000141022f00000000014101cf000000000161019f0000000000150435000002bb0000013d00000000030104330000000002320436000000000403004b000003350000613d000000000400001900000000052400190000002004400039000000000614001900000000060604330000000000650435000000000534004b0000032e0000413d000000000123001900000000000104350000001f01300039000000200300008a000000000131016f0000000001120019000000000001042d000000d702000041000000d70310009c00000000010280190000000003000414000000d70430009c0000000003028019000000c0023002100000004001100210000000000121019f000000eb011001c70000801002000039035803530000040f00000001022001900000034c0000613d000000000101043b000000000001042d00000000010000190000035a0001043000000351002104210000000102000039000000000001042d0000000002000019000000000001042d00000356002104230000000102000039000000000001042d0000000002000019000000000001042d0000035800000432000003590001042e0000035a00010430000000000000000000000000000000000000000000000000000000000000000000000000ffffffff00000002000000000000000000000000000000400000010000000000000000000000000000000000000000000000000000000000000000000000000051cff8d80000000000000000000000000000000000000000000000000000000084bc3eaf0000000000000000000000000000000000000000000000000000000084bc3eb00000000000000000000000000000000000000000000000000000000095d89b41000000000000000000000000000000000000000000000000000000009cc7f7080000000000000000000000000000000000000000000000000000000051cff8d900000000000000000000000000000000000000000000000000000000579952fc00000000000000000000000000000000000000000000000000000000313ce56600000000000000000000000000000000000000000000000000000000313ce5670000000000000000000000000000000000000000000000000000000040c10f190000000000000000000000000000000000000000000000000000000006fdde030000000000000000000000000000000000000000000000000000000018160ddd000000000000000000000000ffffffffffffffffffffffffffffffffffffffff000000000000000000000000000000000000002000000080000000000000000045544800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000ffffffffffffffff800000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000400000000000000000000000006c0960f90000000000000000000000000000000000000000000000000000000062f84b24000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000c405fe8958410bbaf0c73b7a0c3e20859e86ca168a4c9b0def9c54d2555a306b08c379a0000000000000000000000000000000000000000000000000000000004f6e6c792073797374656d20636f6e7472616374732077697468207370656369616c206163636573732063616e2063616c6c2074686973206d6574686f64000000000000000000000000000000000000000000840000008000000000000000000200000000000000000000000000000000000020000000000000000000000000ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef5472616e7366657220616d6f756e7420657863656564732062616c616e6365000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffa02717ead6b9200dd235aad468c9809ea400fe33ac69b5bfaa6d3e90fc922b63984e487b7100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002400000000000000000000000043616c6c61626c65206f6e6c792062792074686520626f6f746c6f616465720000000000000000000000000000000000000000640000008000000000000000000f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968854574686572000000000000000000000000000000000000000000000000000000bd8ebb5079d10eb803fe9159063ab90d29b28436f931348d5c6d97af2da4751d | @id266:I @testnet Scenario Outline: Check "" hashes copying on Block page From 5467a5e75e67d3c8c5bfaa1319be0818b1135703 Mon Sep 17 00:00:00 2001 From: Oleh Bairak <118197764+olehbairak@users.noreply.github.com> Date: Tue, 12 Mar 2024 16:42:14 +0100 Subject: [PATCH 28/28] fix: new contract for @id272 for contract bytecode check (#206) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # What ❔ New contract for test to improve stability. ## Why ❔ previous contract can changes its data during the time ## Checklist - [x] PR title corresponds to the body of PR (we generate changelog entries from PRs). - [x] Tests for the changes have been added / updated. - [ ] Documentation comments have been added / updated. --- packages/app/tests/e2e/features/copying.feature | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/app/tests/e2e/features/copying.feature b/packages/app/tests/e2e/features/copying.feature index d265f41bdf..e1f73def6f 100644 --- a/packages/app/tests/e2e/features/copying.feature +++ b/packages/app/tests/e2e/features/copying.feature @@ -102,14 +102,14 @@ Feature: Copying @id272 Scenario Outline: Check hashes copying for Contracts tab on Contracts page - Given I go to page "/address/0x000000000000000000000000000000000000800A" + Given I go to page "/address/0x815858d880932A578b5153680e2786735dD923Eb" When I select "Contract" tab on "Contract" page And I click on the copy button for deployed bytecode Then Clipboard contains "" value Examples: | Text | - | 0x00050000000000020000008003000039000000400030043f00000000030100190000006003300270000000d7033001970000000102200190000000240000c13d000000040230008c0000030a0000413d000000000201043b000000e002200270000000d90420009c0000002c0000a13d000000da0420009c000000380000a13d000000db0420009c000000950000613d000000dc0420009c000001ea0000613d000000dd0220009c0000030a0000c13d0000000002000416000000000202004b0000030a0000c13d000000040230008a000000200220008c0000030a0000413d0000000401100370000000000101043b000000e5011001970000000000100435000000200000043f00000000010000190358033c0000040f000000360000013d0000000001000416000000000101004b0000030a0000c13d000000200100003900000100001004430000012000000443000000d801000041000003590001042e000000e00420009c000000600000213d000000e30120009c000001a60000613d000000e40120009c0000030a0000c13d0000000001000416000000000101004b0000030a0000c13d0000000101000039000000000101041a000001e70000013d000000de0420009c000001af0000613d000000df0220009c0000030a0000c13d0000000002000416000000000202004b0000030a0000c13d000000040230008a000000600220008c0000030a0000413d0000000402100370000000000402043b000000e50240009c0000030a0000213d0000002402100370000000000202043b000000e505200197000000e50220009c0000030a0000213d00000000020004110000004401100370000000000301043b000080060120008c000002090000613d000000090100008a000000000112016f000080010110008c000002090000613d000000f001000041000000800010043f0000002001000039000000840010043f0000003e01000039000000a40010043f000000f101000041000000c40010043f000000f201000041000000e40010043f000000f3010000410000035a00010430000000e10420009c000001e30000613d000000e20220009c0000030a0000c13d0000000002000416000000000202004b0000030a0000c13d000000040230008a000000400220008c0000030a0000413d0000000402100370000000000402043b000000e50240009c0000030a0000213d0000002401100370000000000501043b0000000001000411000080010110008c000001ff0000c13d0000000101000039000000000301041a0000000002530019000000000332004b000000000300001900000001030040390000000103300190000000910000c13d000400000005001d000000000021041b0000000000400435000000200000043f000000d7010000410000000002000414000000d70320009c0000000002018019000000c001200210000000eb011001c70000801002000039000500000004001d035803530000040f000000050500002900000001022001900000030a0000613d000000000101043b000000000201041a0000000403000029000000000232001a000000910000413d000002c20000013d000000fa0100004100000000001004350000001101000039000001e00000013d000000040230008a000000400220008c0000030a0000413d0000000402100370000000000802043b000000e50280009c0000030a0000213d0000002402100370000000000402043b000000e90240009c0000030a0000213d0000002302400039000000ea05000041000000000632004b00000000060000190000000006058019000000ea02200197000000000702004b0000000005008019000000ea0220009c000000000506c019000000000205004b0000030a0000c13d0000000405400039000000000251034f000000000202043b000000e90620009c000001dd0000213d000000bf06200039000000200900008a000000000696016f000000e90760009c000001dd0000213d000000400060043f000000800020043f00000000042400190000002404400039000000000334004b0000030a0000213d0000002003500039000000000131034f0000001f0320018f0000000504200272000000ca0000613d00000000050000190000000506500210000000000761034f000000000707043b000000a00660003900000000007604350000000105500039000000000645004b000000c20000413d000400000009001d000500000008001d000000000503004b000000db0000613d0000000504400210000000000141034f0000000303300210000000a004400039000000000504043300000000053501cf000000000535022f000000000101043b0000010003300089000000000131022f00000000013101cf000000000151019f0000000000140435000000a00120003900000000000104350000000001000416000300000001001d00000000010004100000000000100435000000200000043f000000d7010000410000000002000414000000d70320009c0000000002018019000000c001200210000000eb011001c70000801002000039035803530000040f0000000102200190000000050400002900000004070000290000030a0000613d000000000101043b000000000201041a00000003090000290000000002920049000000000021041b0000000101000039000000000201041a0000000002920049000000000021041b000000ec02000041000000400100043d000000200310003900000000002304350000006002400210000000240310003900000000002304350000000008000411000000600280021000000058031000390000000000230435000000380210003900000000009204350000006c03100039000000800200043d000000000402004b000001100000613d00000000040000190000000005340019000000a006400039000000000606043300000000006504350000002004400039000000000524004b000001090000413d000000000332001900000000000304350000004c0320003900000000003104350000008b02200039000000000272016f000000000a12001900000000022a004b00000000020000190000000102004039000000e903a0009c000001dd0000213d0000000102200190000001dd0000c13d000100000008001d0000004000a0043f000000ed0200004100000000002a04350000000402a000390000002003000039000000000032043500000000020104330000002403a0003900000000002304350000004403a00039000000000402004b000001330000613d000000000400001900000000053400190000002004400039000000000614001900000000060604330000000000650435000000000524004b0000012c0000413d000000000132001900000000000104350000001f01200039000000000171016f000000d702000041000000d703a0009c000000000302001900000000030a401900000040033002100000004401100039000000d70410009c00000000010280190000006001100210000000000131019f0000000003000414000000d70430009c0000000003028019000000c002300210000000000112019f000080080200003900020000000a001d0358034e0000040f000000020a00002900000000030100190000006003300270000000d703300197000000200430008c000000000403001900000020040080390000001f0540018f00000005064002720000015c0000613d0000000007000019000000050870021000000000098a0019000000000881034f000000000808043b00000000008904350000000107700039000000000867004b000001540000413d000000000705004b0000016b0000613d0000000506600210000000000761034f00000000066a00190000000305500210000000000806043300000000085801cf000000000858022f000000000707043b0000010005500089000000000757022f00000000055701cf000000000585019f000000000056043500000001022001900000030c0000613d0000001f01400039000000600210018f0000000001a20019000000000221004b00000000020000190000000102004039000000e90410009c00000005040000290000000305000029000001dd0000213d0000000102200190000001dd0000c13d000000400010043f000000200230008c0000030a0000413d00000020021000390000004003000039000000000032043500000000005104350000004003100039000000800200043d00000000002304350000006003100039000000e506400197000000000402004b0000018f0000613d00000000040000190000000005340019000000a007400039000000000707043300000000007504350000002004400039000000000524004b000001880000413d000000000332001900000000000304350000007f02200039000000040220017f000000d703000041000000d70410009c00000000010380190000004001100210000000d70420009c00000000020380190000006002200210000000000112019f0000000002000414000000d70420009c0000000002038019000000c002200210000000000112019f000000ee011001c70000800d020000390000000303000039000000ef040000410000000105000029000003050000013d0000000001000416000000000101004b0000030a0000c13d000000c001000039000000400010043f0000000501000039000000800010043f000000ff01000041000001f20000013d000000040230008a000000200220008c0000030a0000413d0000000401100370000000000401043b000000e50140009c0000030a0000213d0000000001000416000400000001001d00000000010004100000000000100435000000200000043f000000d7010000410000000002000414000000d70320009c0000000002018019000000c001200210000000eb011001c70000801002000039000500000004001d035803530000040f000000050400002900000001022001900000030a0000613d000000000101043b000000000201041a00000004050000290000000002520049000000000021041b0000000101000039000000000201041a0000000002520049000000000021041b000000ec02000041000000400100043d000000200310003900000000002304350000006002400210000000240310003900000000002304350000003802100039000000000052043500000038020000390000000000210435000000f80210009c0000022f0000413d000000fa0100004100000000001004350000004101000039000000040010043f000000fb010000410000035a000104300000000001000416000000000101004b0000030a0000c13d0000001201000039000000800010043f000000e601000041000003590001042e0000000001000416000000000101004b0000030a0000c13d000000c001000039000000400010043f0000000301000039000000800010043f000000e701000041000000a00010043f0000002001000039000000c00010043f0000008001000039000000e002000039035803290000040f000000c00110008a000000d702000041000000d70310009c00000000010280190000006001100210000000e8011001c7000003590001042e000000f001000041000000800010043f0000002001000039000000840010043f0000001f01000039000000a40010043f000000fc01000041000000c40010043f000000fd010000410000035a00010430000400000003001d0000000000400435000000200000043f000000d7010000410000000002000414000000d70320009c0000000002018019000000c001200210000000eb011001c70000801002000039000500000004001d000300000005001d035803530000040f000000050300002900000001022001900000030a0000613d000000000101043b000000000201041a000000040120006c000002d30000813d000000400100043d0000004402100039000000f603000041000000000032043500000024021000390000001f030000390000000000320435000000f0020000410000000000210435000000040210003900000020030000390000000000320435000000d702000041000000d70310009c00000000010280190000004001100210000000f7011001c70000035a000104300000006007100039000000400070043f000000ed020000410000000000270435000000640210003900000020030000390000000000320435000000840310003900000000020104330000000000230435000000a403100039000000000402004b000002440000613d000000000400001900000000053400190000002004400039000000000614001900000000060604330000000000650435000000000524004b0000023d0000413d000000000132001900000000000104350000001f01200039000000200200008a000000000121016f000000d702000041000000d70370009c0000000003020019000000000307401900000040033002100000004401100039000000d70410009c00000000010280190000006001100210000000000131019f0000000003000414000000d70430009c0000000003028019000000c002300210000000000112019f0000800802000039000300000007001d0358034e0000040f000000030a00002900000000030100190000006003300270000000d703300197000000200430008c000000000403001900000020040080390000001f0540018f00000005064002720000026e0000613d0000000007000019000000050870021000000000098a0019000000000881034f000000000808043b00000000008904350000000107700039000000000867004b000002660000413d000000000705004b0000027d0000613d0000000506600210000000000761034f00000000066a00190000000305500210000000000806043300000000085801cf000000000858022f000000000707043b0000010005500089000000000757022f00000000055701cf000000000585019f000000000056043500000001022001900000029f0000613d0000001f01400039000000600210018f0000000001a20019000000000221004b00000000020000190000000102004039000000e90410009c00000005050000290000000404000029000001dd0000213d0000000102200190000001dd0000c13d000000400010043f000000200230008c0000030a0000413d0000000000410435000000d7020000410000000003000414000000d70430009c0000000003028019000000d70410009c00000000010280190000004001100210000000c002300210000000000112019f000000f4011001c7000000e5065001970000800d0200003900000003030000390000000005000411000000f904000041000003050000013d000000400200043d0000001f0430018f0000000505300272000002ac0000613d000000000600001900000005076002100000000008720019000000000771034f000000000707043b00000000007804350000000106600039000000000756004b000002a40000413d000000000604004b000002bb0000613d0000000505500210000000000151034f00000000055200190000000304400210000000000605043300000000064601cf000000000646022f000000000101043b0000010004400089000000000141022f00000000014101cf000000000161019f0000000000150435000000d701000041000000d70420009c000000000201801900000040012002100000006002300210000000000121019f0000035a00010430000000000021041b000000400100043d0000000000310435000000d7020000410000000003000414000000d70430009c0000000003028019000000d70410009c00000000010280190000004001100210000000c002300210000000000112019f000000f4011001c70000800d020000390000000203000039000000fe04000041000003050000013d000200000002001d0000000000300435000000200000043f000000d7030000410000000001000414000000d70210009c0000000001038019000000c001100210000000eb011001c70000801002000039035803530000040f000000030300002900000001022001900000030a0000613d0000000204000029000000040240006a000000000101043b000000000021041b00000000003004350000000001000414000000d70210009c000000d701008041000000c001100210000000eb011001c70000801002000039035803530000040f0000000306000029000000050500002900000001022001900000030a0000613d000000000101043b000000000201041a00000004030000290000000002320019000000000021041b000000400100043d0000000000310435000000d7020000410000000003000414000000d70430009c0000000003028019000000d70410009c00000000010280190000004001100210000000c002300210000000000112019f000000f4011001c70000800d020000390000000303000039000000f5040000410358034e0000040f00000001012001900000030a0000613d0000000001000019000003590001042e00000000010000190000035a00010430000000400200043d0000001f0430018f0000000505300272000003190000613d000000000600001900000005076002100000000008720019000000000771034f000000000707043b00000000007804350000000106600039000000000756004b000003110000413d000000000604004b000003280000613d0000000505500210000000000151034f00000000055200190000000304400210000000000605043300000000064601cf000000000646022f000000000101043b0000010004400089000000000141022f00000000014101cf000000000161019f0000000000150435000002bb0000013d00000000030104330000000002320436000000000403004b000003350000613d000000000400001900000000052400190000002004400039000000000614001900000000060604330000000000650435000000000534004b0000032e0000413d000000000123001900000000000104350000001f01300039000000200300008a000000000131016f0000000001120019000000000001042d000000d702000041000000d70310009c00000000010280190000000003000414000000d70430009c0000000003028019000000c0023002100000004001100210000000000121019f000000eb011001c70000801002000039035803530000040f00000001022001900000034c0000613d000000000101043b000000000001042d00000000010000190000035a0001043000000351002104210000000102000039000000000001042d0000000002000019000000000001042d00000356002104230000000102000039000000000001042d0000000002000019000000000001042d0000035800000432000003590001042e0000035a00010430000000000000000000000000000000000000000000000000000000000000000000000000ffffffff00000002000000000000000000000000000000400000010000000000000000000000000000000000000000000000000000000000000000000000000051cff8d80000000000000000000000000000000000000000000000000000000084bc3eaf0000000000000000000000000000000000000000000000000000000084bc3eb00000000000000000000000000000000000000000000000000000000095d89b41000000000000000000000000000000000000000000000000000000009cc7f7080000000000000000000000000000000000000000000000000000000051cff8d900000000000000000000000000000000000000000000000000000000579952fc00000000000000000000000000000000000000000000000000000000313ce56600000000000000000000000000000000000000000000000000000000313ce5670000000000000000000000000000000000000000000000000000000040c10f190000000000000000000000000000000000000000000000000000000006fdde030000000000000000000000000000000000000000000000000000000018160ddd000000000000000000000000ffffffffffffffffffffffffffffffffffffffff000000000000000000000000000000000000002000000080000000000000000045544800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000ffffffffffffffff800000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000400000000000000000000000006c0960f90000000000000000000000000000000000000000000000000000000062f84b24000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000c405fe8958410bbaf0c73b7a0c3e20859e86ca168a4c9b0def9c54d2555a306b08c379a0000000000000000000000000000000000000000000000000000000004f6e6c792073797374656d20636f6e7472616374732077697468207370656369616c206163636573732063616e2063616c6c2074686973206d6574686f64000000000000000000000000000000000000000000840000008000000000000000000200000000000000000000000000000000000020000000000000000000000000ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef5472616e7366657220616d6f756e7420657863656564732062616c616e6365000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffa02717ead6b9200dd235aad468c9809ea400fe33ac69b5bfaa6d3e90fc922b63984e487b7100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002400000000000000000000000043616c6c61626c65206f6e6c792062792074686520626f6f746c6f616465720000000000000000000000000000000000000000640000008000000000000000000f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968854574686572000000000000000000000000000000000000000000000000000000bd8ebb5079d10eb803fe9159063ab90d29b28436f931348d5c6d97af2da4751d | + | 0x00050000000000020000008003000039000000400030043f0000000003010019000000600330027000000072033001970000000102200190000000960000c13d000000040230008c000001600000413d000000000201043b000000e002200270000000790420009c0000014e0000613d0000007a0220009c000001600000c13d0000000002000416000000000202004b000001600000c13d000000040230008a000000200220008c000001600000413d0000000402100370000000000502043b000000760250009c000001600000213d00000023025000390000007e04000041000000000632004b000000000600001900000000060480190000007e02200197000000000702004b00000000040080190000007e0220009c000000000406c019000000000204004b000001600000c13d0000000406500039000000000261034f000000000402043b000000760240009c0000009c0000213d000000bf07400039000000200200008a000000000727016f000000760870009c0000009c0000213d000000400070043f000000800040043f00000000054500190000002405500039000000000335004b000001600000213d0000002003600039000000000131034f0000001f0340018f0000000505400272000000440000613d00000000060000190000000507600210000000000871034f000000000808043b000000a00770003900000000008704350000000106600039000000000756004b0000003c0000413d000000000603004b000000530000613d0000000505500210000000000151034f0000000303300210000000a005500039000000000605043300000000063601cf000000000636022f000000000101043b0000010003300089000000000131022f00000000013101cf000000000161019f0000000000150435000000a0014000390000000000010435000000800100043d000000760310009c0000009c0000213d000000000400041a000000010340019000000001054002700000007f0350018f000000000305c0190000001f0530008c00000000050000190000000105002039000000000454013f00000001044001900000015c0000c13d000000200430008c000000750000413d0000001f0410003900000005044002700000007b054000410000007b04000041000000200610008c000000000405801900000000000004350000001f0330003900000005033002700000007b03300041000000000534004b000000750000813d000000000004041b0000000104400039000000000534004b000000710000413d0000001f0310008c0000019f0000a13d0000000003210170000000a0040000390000007b020000410000000000000435000000890000613d0000007b0200004100000020060000390000000004000019000000000506001900000080065000390000000006060433000000000062041b000000200650003900000001022000390000002004400039000000000734004b0000007f0000413d000000a004500039000000000313004b000000930000813d0000000303100210000000f80330018f000000010500008a000000000335022f000000000353013f0000000004040433000000000334016f000000000032041b00000001020000390000000103100210000001a90000013d0000000002000416000000000202004b000001600000c13d0000007302300041000000740220009c000000a20000213d0000007f0100004100000000001004350000004101000039000000040010043f0000008001000041000001c5000104300000009f023000390000007502200197000000400020043f0000001f0230018f0000000504300272000000b10000613d00000000050000190000000506500210000000000761034f000000000707043b000000800660003900000000007604350000000105500039000000000645004b000000a90000413d000000000502004b000000c00000613d0000000504400210000000000141034f00000003022002100000008004400039000000000504043300000000052501cf000000000525022f000000000101043b0000010002200089000000000121022f00000000012101cf000000000151019f0000000000140435000000200130008c000001600000413d000000800400043d000000760140009c000001600000213d00000080033000390000009f01400039000000000131004b000001600000813d00000080024000390000000001020433000000760510009c0000009c0000213d0000003f05100039000000200900008a000000000595016f000000400800043d0000000005580019000000000685004b00000000060000190000000106004039000000760750009c0000009c0000213d00000001066001900000009c0000c13d000000400050043f00000000061804360000000004140019000000a004400039000000000334004b000001600000213d000000000301004b000000e90000613d000000000300001900000000046300190000002003300039000000000523001900000000050504330000000000540435000000000413004b000000e20000413d000000000116001900000000000104350000000004080433000000760140009c0000009c0000213d000000000100041a000000010210019000000001011002700000007f0310018f000000000301c0190000001f0130008c00000000010000190000000101002039000000010110018f000000000112004b0000015c0000c13d000000200130008c0000011f0000413d000100000003001d000300000004001d000000000000043500000072010000410000000002000414000000720320009c0000000002018019000000c00120021000000077011001c70000801002000039000500000008001d000400000009001d000200000006001d01c301be0000040f0000000206000029000000040900002900000005080000290000000102200190000001600000613d00000003040000290000001f024000390000000502200270000000200340008c0000000002004019000000000301043b00000001010000290000001f01100039000000050110027000000000011300190000000002230019000000000312004b0000011f0000813d000000000002041b0000000102200039000000000312004b0000011b0000413d0000001f0140008c000001ad0000a13d000300000004001d000000000000043500000072010000410000000002000414000000720320009c0000000002018019000000c00120021000000077011001c70000801002000039000500000008001d000400000009001d01c301be0000040f000000040300002900000005060000290000000102200190000001600000613d000000030700002900000000033701700000002002000039000000000101043b000001400000613d0000002002000039000000000400001900000000056200190000000005050433000000000051041b000000200220003900000001011000390000002004400039000000000534004b000001380000413d000000000373004b0000014b0000813d0000000303700210000000f80330018f000000010400008a000000000334022f000000000343013f00000000026200190000000002020433000000000232016f000000000021041b00000001010000390000000102700210000001b70000013d0000000001000416000000000101004b000001600000c13d000000000100041a000000010310019000000001041002700000007f0240018f000000000204c0190000001f0420008c00000000040000190000000104002039000000000441013f0000000104400190000001620000613d0000007f01000041000000000010043500000022010000390000009f0000013d0000000001000019000001c500010430000000800020043f000000000303004b000001750000613d000000a0010000390000000000000435000000000302004b000001810000613d0000007b0100004100000000040000190000000003040019000000000401041a000000a005300039000000000045043500000001011000390000002004300039000000000524004b0000016b0000413d000000c0013000390000017b0000013d000001000300008a000000000131016f000000a00010043f000000000102004b000000c001000039000000a0010060390000001f01100039000000200200008a000000000121016f0000007c021000410000007d0220009c0000009c0000413d000000400010043f00000020020000390000000003210436000000800200043d00000000002304350000004003100039000000000402004b000001910000613d00000000040000190000000005340019000000a006400039000000000606043300000000006504350000002004400039000000000524004b0000018a0000413d000000000332001900000000000304350000005f02200039000000200300008a000000000232016f0000007203000041000000720420009c0000000002038019000000720410009c000000000103801900000040011002100000006002200210000000000112019f000001c40001042e000000000201004b0000000002000019000001a30000613d000000a00200043d0000000303100210000000010400008a000000000334022f000000000343013f000000000332016f0000000102100210000000000123019f000000000010041b0000000001000019000001c40001042e000000000104004b0000000001000019000001b10000613d00000000010604330000000302400210000000010300008a000000000223022f000000000232013f000000000221016f0000000101400210000000000112019f000000000010041b0000002001000039000001000010044300000120000004430000007801000041000001c40001042e000001c1002104230000000102000039000000000001042d0000000002000019000000000001042d000001c300000432000001c40001042e000001c5000104300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000009fffffffffffffffffffffffffffffffffffffffffffffffff000000000000007f00000000000000000000000000000000000000000000000000000001ffffffe0000000000000000000000000000000000000000000000000ffffffffffffffff0200000000000000000000000000000000000020000000000000000000000000000000020000000000000000000000000000004000000100000000000000000000000000000000000000000000000000000000000000000000000000cfae321700000000000000000000000000000000000000000000000000000000a4136862290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563ffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffff000000000000008080000000000000000000000000000000000000000000000000000000000000004e487b710000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000240000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d2b6fe8cd9af668ef698f6e0992d0e9aacae5e06943b1402d755814260f9fdac | @id266:I @testnet Scenario Outline: Check "" hashes copying on Block page