From 7e43c4610c48df69b1e3d3a7817e96113913b967 Mon Sep 17 00:00:00 2001 From: pcheremu Date: Thu, 7 Mar 2024 11:22:02 +0100 Subject: [PATCH 1/6] 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 2/6] 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 3/6] 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 4/6] 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 5/6] 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 6/6] 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);