From 20d1cfaa236ea29eb03610f91a0cdf2999027a51 Mon Sep 17 00:00:00 2001 From: amelnytskyi Date: Thu, 1 Feb 2024 16:10:14 +0200 Subject: [PATCH 1/4] test: fixing gating transactions tests Fixed disabled /transactions/{transactionHash}/transfers tests and turned them on back --- packages/integration-tests/src/entities.ts | 1 + .../tests/api/transactions.test.ts | 1521 ++++++++++------- 2 files changed, 929 insertions(+), 593 deletions(-) diff --git a/packages/integration-tests/src/entities.ts b/packages/integration-tests/src/entities.ts index 83b391a60f..5c1879e5b1 100644 --- a/packages/integration-tests/src/entities.ts +++ b/packages/integration-tests/src/entities.ts @@ -55,6 +55,7 @@ export enum TransactionsType { fee = "fee", transfer = "transfer", refund = "refund", + withdrawal = "withdrawal", } export enum TransactionsStatus { diff --git a/packages/integration-tests/tests/api/transactions.test.ts b/packages/integration-tests/tests/api/transactions.test.ts index 56e5fa9df7..f48e5d2a73 100644 --- a/packages/integration-tests/tests/api/transactions.test.ts +++ b/packages/integration-tests/tests/api/transactions.test.ts @@ -109,7 +109,7 @@ describe("Transactions", () => { }); //@id1463 - xit("Verify the custom token withdrawal via /transactions/{transactionHash}/transfers", async () => { + it("Verify the custom token withdrawal via /transactions/{transactionHash}/transfers", async () => { await helper.retryTestAction(async () => { const l1Token = bufferFile + "/" + Buffer.L1; const customTokenL1 = await helper.getStringFromFile(l1Token); @@ -117,687 +117,1022 @@ describe("Transactions", () => { const customTokenL2 = await helper.getStringFromFile(l2Token); txHash = await helper.getStringFromFile(bufferFile + Buffer.txERC20WithdrawOtherAddress); apiRoute = `/transactions/${txHash}/transfers`; + const decapitalizedAddress = apiRoute.slice(1).toLowerCase(); response = await helper.performGETrequest(apiRoute); expect(response.status).toBe(200); + expect(typeof response.body.items[0].amount).toStrictEqual("string"); + expect(typeof response.body.items[0].blockNumber).toStrictEqual("number"); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); 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({ transactionHash: txHash })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: "fee" })); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) + ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ + token: { + decimals: 18, + iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", + l1Address: Token.ETHER_Address, + l2Address: Token.ETHER_ERC20_Address, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenType: "ETH" })); + + 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: 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({ transactionHash: txHash })); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ amount: "200000000000000000" })); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ type: "transfer" })); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ tokenAddress: customTokenL2 })); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ type: TransactionsType.transfer })); expect(response.body.items[1]).toStrictEqual( expect.objectContaining({ token: { - l2Address: customTokenL2, + decimals: 18, + usdPrice: null, + iconURL: null, l1Address: customTokenL1, + l2Address: customTokenL2, + liquidity: null, symbol: "L1", name: "L1 ERC20 token", - decimals: 18, }, }) ); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ tokenType: "ERC20" })); + + expect(typeof response.body.items[2].amount).toStrictEqual("string"); + expect(typeof response.body.items[2].blockNumber).toStrictEqual("number"); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ fields: null })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ isInternal: false })); + expect(typeof response.body.items[2].timestamp).toStrictEqual("string"); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ to: Wallets.mainWalletAddress })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ amount: "200000000000000000" })); - expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ type: "withdrawal" })); - expect(response.body.items[1]).toStrictEqual( + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ tokenAddress: customTokenL2 })); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ type: TransactionsType.withdrawal })); + expect(response.body.items[2]).toStrictEqual( expect.objectContaining({ token: { - l2Address: customTokenL2, + decimals: 18, + usdPrice: null, + iconURL: null, l1Address: customTokenL1, + l2Address: customTokenL2, + liquidity: null, symbol: "L1", name: "L1 ERC20 token", - decimals: 18, }, }) ); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ tokenType: "ERC20" })); + + 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({ 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({ type: "refund" })); + expect(response.body.items[3]).toStrictEqual( + expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) + ); + 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, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); + expect(response.body.items[3]).toStrictEqual(expect.objectContaining({ tokenType: "ETH" })); + expect(response.body.meta).toStrictEqual(expect.objectContaining({ totalItems: 4 })); + expect(response.body.meta).toStrictEqual(expect.objectContaining({ itemCount: 4 })); + expect(response.body.meta).toStrictEqual(expect.objectContaining({ itemsPerPage: 10 })); + expect(response.body.meta).toStrictEqual(expect.objectContaining({ totalPages: 1 })); + expect(response.body.meta).toStrictEqual(expect.objectContaining({ currentPage: 1 })); + expect(response.body.links).toStrictEqual( + expect.objectContaining({ first: `${decapitalizedAddress}?limit=10` }) + ); + expect(response.body.links).toStrictEqual(expect.objectContaining({ previous: "" })); + expect(response.body.links).toStrictEqual(expect.objectContaining({ next: "" })); + expect(response.body.links).toStrictEqual( + expect.objectContaining({ last: `${decapitalizedAddress}?page=1&limit=10` }) + ); }); }); - }); - describe("/transactions/{transactionHash}", () => { - beforeAll(async () => { - const customToken = await helper.getStringFromFile(bufferFile + Buffer.L2deposited); - await playbook.transferFailedState(customToken); - }); - - //@id1460 - it("Verify the ETH withdrawal to the other address via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txEthWithdrawOtherAddress); - apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); - - expect(response.status).toBe(200); - expect(response.body.hash).toBe(txHash); - expect(response.body.to).toBe("0x000000000000000000000000000000000000800A"); - expect(response.body.from).toBe(Wallets.richWalletAddress); - expect(response.body.value).toBe("9000000000000"); + describe("/transactions/{transactionHash}", () => { + beforeAll(async () => { + const customToken = await helper.getStringFromFile(bufferFile + Buffer.L2deposited); + await playbook.transferFailedState(customToken); }); - }); - - //@id1462 - it("Verify the custom token withdrawal via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txERC20Withdraw); - apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); - expect(response.status).toBe(200); - expect(response.body.hash).toBe(txHash); - expect(response.body.from).toBe(Wallets.richWalletAddress); + //@id1460 + it("Verify the ETH withdrawal to the other address via /transactions/{transactionHash}", async () => { + await helper.retryTestAction(async () => { + txHash = await helper.getStringFromFile(bufferFile + Buffer.txEthWithdrawOtherAddress); + apiRoute = `/transactions/${txHash}`; + response = await helper.performGETrequest(apiRoute); + + expect(response.status).toBe(200); + expect(response.body.hash).toBe(txHash); + expect(response.body.to).toBe("0x000000000000000000000000000000000000800A"); + expect(response.body.from).toBe(Wallets.richWalletAddress); + expect(response.body.value).toBe("9000000000000"); + }); }); - }); - - //@id1458 - it("Verify the ETH withdrawal via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txEthWithdraw); - apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); - expect(response.status).toBe(200); - expect(response.body.hash).toBe(txHash); - expect(response.body.to).toBe("0x000000000000000000000000000000000000800A"); - expect(response.body.from).toBe(Wallets.richWalletAddress); - expect(response.body.value).toBe("9000000000000"); + //@id1462 + it("Verify the custom token withdrawal via /transactions/{transactionHash}", async () => { + await helper.retryTestAction(async () => { + txHash = await helper.getStringFromFile(bufferFile + Buffer.txERC20Withdraw); + apiRoute = `/transactions/${txHash}`; + response = await helper.performGETrequest(apiRoute); + + expect(response.status).toBe(200); + expect(response.body.hash).toBe(txHash); + expect(response.body.from).toBe(Wallets.richWalletAddress); + }); }); - }); - - //@id1478 - it("Verify transaction for the ETH via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiTransferETH); - contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiTransferETH); - apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); - expect(response.status).toBe(200); - expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); - expect(response.body).toStrictEqual(expect.objectContaining({ to: contract })); - expect(response.body).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); + //@id1458 + it("Verify the ETH withdrawal via /transactions/{transactionHash}", async () => { + await helper.retryTestAction(async () => { + txHash = await helper.getStringFromFile(bufferFile + Buffer.txEthWithdraw); + apiRoute = `/transactions/${txHash}`; + response = await helper.performGETrequest(apiRoute); + + expect(response.status).toBe(200); + expect(response.body.hash).toBe(txHash); + expect(response.body.to).toBe("0x000000000000000000000000000000000000800A"); + expect(response.body.from).toBe(Wallets.richWalletAddress); + expect(response.body.value).toBe("9000000000000"); + }); }); - }); - - //@id1479 - it("Verify transaction for the Custom Token I via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { - contract = await helper.getStringFromFile(bufferFile + Buffer.L2); - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiTransferCustomTokenI); - apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); - expect(response.status).toBe(200); - expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); - // expect(response.body).toStrictEqual(expect.objectContaining({ to: contract })) //unstable on CI - expect(response.body).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); + //@id1478 + it("Verify transaction for the ETH via /transactions/{transactionHash}", async () => { + await helper.retryTestAction(async () => { + txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiTransferETH); + contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiTransferETH); + apiRoute = `/transactions/${txHash}`; + response = await helper.performGETrequest(apiRoute); + + expect(response.status).toBe(200); + expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); + expect(response.body).toStrictEqual(expect.objectContaining({ to: contract })); + expect(response.body).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); + expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); + }); }); - }); - //@id1480 - it("Verify transaction for the Custom Token II via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { - contract = await helper.getStringFromFile(bufferFile + Buffer.L2deposited); - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiTransferCustomTokenII); - apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); - - expect(response.status).toBe(200); - expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); - expect(response.body).toStrictEqual(expect.objectContaining({ to: contract })); - expect(response.body).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); + //@id1479 + it("Verify transaction for the Custom Token I via /transactions/{transactionHash}", async () => { + await helper.retryTestAction(async () => { + contract = await helper.getStringFromFile(bufferFile + Buffer.L2); + txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiTransferCustomTokenI); + apiRoute = `/transactions/${txHash}`; + response = await helper.performGETrequest(apiRoute); + + expect(response.status).toBe(200); + expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); + // expect(response.body).toStrictEqual(expect.objectContaining({ to: contract })) //unstable on CI + expect(response.body).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); + expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); + }); }); - }); - - //@id1454 - it("Verify the transaction after SetGreeting execution via transactions/{transactionHash}", async () => { - await helper.retryTestAction(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); - expect(response.status).toBe(200); - expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); - expect(response.body).toStrictEqual(expect.objectContaining({ to: contract })); - expect(response.body).toStrictEqual(expect.objectContaining({ value: "0" })); - expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); + //@id1480 + it("Verify transaction for the Custom Token II via /transactions/{transactionHash}", async () => { + await helper.retryTestAction(async () => { + contract = await helper.getStringFromFile(bufferFile + Buffer.L2deposited); + txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiTransferCustomTokenII); + apiRoute = `/transactions/${txHash}`; + response = await helper.performGETrequest(apiRoute); + + expect(response.status).toBe(200); + expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); + expect(response.body).toStrictEqual(expect.objectContaining({ to: contract })); + expect(response.body).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); + expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); + }); }); - }); - //@id1464:I --> @id1468 - it("Verify transaction for the Root contract via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallRoot); - apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); - - expect(response.status).toBe(200); - expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); - expect(response.body).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body).toStrictEqual(expect.objectContaining({ value: "0" })); - expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); - expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); + //@id1454 + it("Verify the transaction after SetGreeting execution via transactions/{transactionHash}", async () => { + await helper.retryTestAction(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); + + expect(response.status).toBe(200); + expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); + expect(response.body).toStrictEqual(expect.objectContaining({ to: contract })); + expect(response.body).toStrictEqual(expect.objectContaining({ value: "0" })); + expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); + }); }); - }); - - //@id1465:I --> @id1469 - it("Verify transaction for the Middle contract via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallMiddle); - apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); - expect(response.status).toBe(200); - expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); - expect(response.body).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body).toStrictEqual(expect.objectContaining({ value: "0" })); - expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); - expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); + //@id1464:I --> @id1468 + it("Verify transaction for the Root contract via /transactions/{transactionHash}", async () => { + await helper.retryTestAction(async () => { + txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallRoot); + apiRoute = `/transactions/${txHash}`; + response = await helper.performGETrequest(apiRoute); + + expect(response.status).toBe(200); + expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); + expect(response.body).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); + expect(response.body).toStrictEqual(expect.objectContaining({ value: "0" })); + expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); + expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); + }); }); - }); - - //@id1466:I --> @id1470 - it("Verify transaction for the Caller contract via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallCaller); - apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); - expect(response.status).toBe(200); - expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); - expect(response.body).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body).toStrictEqual(expect.objectContaining({ value: "0" })); - expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); - expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); + //@id1465:I --> @id1469 + it("Verify transaction for the Middle contract via /transactions/{transactionHash}", async () => { + await helper.retryTestAction(async () => { + txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallMiddle); + apiRoute = `/transactions/${txHash}`; + response = await helper.performGETrequest(apiRoute); + + expect(response.status).toBe(200); + expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); + expect(response.body).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); + expect(response.body).toStrictEqual(expect.objectContaining({ value: "0" })); + expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); + expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); + }); }); - }); - - //@id1471 - it("Verify transaction for the use multicall contract via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txUseMultiCallContracts); - apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); - expect(response.status).toBe(200); - expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); - expect(response.body).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body).toStrictEqual(expect.objectContaining({ value: "0" })); - expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); - expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); + //@id1466:I --> @id1470 + it("Verify transaction for the Caller contract via /transactions/{transactionHash}", async () => { + await helper.retryTestAction(async () => { + txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallCaller); + apiRoute = `/transactions/${txHash}`; + response = await helper.performGETrequest(apiRoute); + + expect(response.status).toBe(200); + expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); + expect(response.body).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); + expect(response.body).toStrictEqual(expect.objectContaining({ value: "0" })); + expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); + expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); + }); }); - }); - - //@id645 - it("Verify the transactions with failed state via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(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); - expect(response.status).toBe(200); - 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); + //@id1471 + it("Verify transaction for the use multicall contract via /transactions/{transactionHash}", async () => { + await helper.retryTestAction(async () => { + txHash = await helper.getStringFromFile(bufferFile + Buffer.txUseMultiCallContracts); + apiRoute = `/transactions/${txHash}`; + response = await helper.performGETrequest(apiRoute); + + expect(response.status).toBe(200); + expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); + expect(response.body).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); + expect(response.body).toStrictEqual(expect.objectContaining({ value: "0" })); + expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); + expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); + }); }); - }); - }); - - xdescribe("/transactions/{transactionHash}/transfers", () => { - beforeAll(async () => { - await playbook.deployViaPaymaster(); - await playbook.usePaymaster(); - }); - //@id1481 - it("Verify transaction for the ETH via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(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); - - 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({ transactionHash: txHash })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ token: null })); - 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({ type: TransactionsType.transfer })); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ fields: null })); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ token: null })); - expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); - 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({ type: TransactionsType.refund })); - expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ fields: null })); - expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ token: null })); + //@id645 + it("Verify the transactions with failed state via /transactions/{transactionHash}", async () => { + await helper.retryTestAction(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); + + expect(response.status).toBe(200); + 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); + }); }); }); - //@id1482 - it("Verify transaction for the Custom tokenI via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(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); - - 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({ transactionHash: txHash })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); - 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 })); - 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( - expect.objectContaining({ - token: { - l2Address: token, - l1Address: null, - symbol: "L2", - name: "L2 ERC20 token", - decimals: 18, - }, - }) - ); - expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); - 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({ type: TransactionsType.refund })); - expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ fields: null })); - expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ token: null })); + describe("/transactions/{transactionHash}/transfers", () => { + beforeAll(async () => { + await playbook.deployViaPaymaster(); + await playbook.usePaymaster(); }); - }); - - //@id1483 - it("Verify transaction for the Custom tokenII via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(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); - 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({ transactionHash: txHash })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); - 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 })); - 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( - expect.objectContaining({ - token: { - l2Address: token, - l1Address: tokenL1, - symbol: "L1", - name: "L1 ERC20 token", - decimals: 18, - }, - }) - ); - expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); - 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({ type: TransactionsType.refund })); - expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ fields: null })); - expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ token: null })); + //@id1481 + it("Verify transaction for the ETH via /transactions/{transactionHash}/transfers", async () => { + await helper.retryTestAction(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); + + 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({ transactionHash: txHash })); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) + ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ + token: { + decimals: 18, + iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", + l1Address: Token.ETHER_Address, + l2Address: Token.ETHER_ERC20_Address, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: contract })); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); + expect(response.body.items[1]).toStrictEqual( + expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) + ); + 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( + expect.objectContaining({ + token: { + decimals: 18, + iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", + l1Address: Token.ETHER_Address, + l2Address: Token.ETHER_ERC20_Address, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + 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({ type: TransactionsType.refund })); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[2]).toStrictEqual( + expect.objectContaining({ + token: { + decimals: 18, + iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", + l1Address: Token.ETHER_Address, + l2Address: Token.ETHER_ERC20_Address, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); + }); }); - }); - - //@id1452 - it("Verify transaction through Paymaster via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(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); - expect(response.status).toBe(200); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: emptyWallet })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: paymasterAddress })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ amount: "1" })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenAddress: token })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.transfer })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ - token: { - l2Address: token, - l1Address: null, - symbol: "MyToken", - name: "MyToken", - decimals: 18, - }, - }) - ); - 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({ transactionHash: txHash })); - expect(response.body.items[1]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); - 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(expect.objectContaining({ token: null })); - expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); - 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({ type: TransactionsType.refund })); - expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ fields: null })); - expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ token: null })); + //@id1482 + it("Verify transaction for the Custom tokenI via /transactions/{transactionHash}/transfers", async () => { + await helper.retryTestAction(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); + + 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({ transactionHash: txHash })); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) + ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + 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 })); + 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( + expect.objectContaining({ + token: { + l2Address: token, + l1Address: null, + symbol: "L2", + name: "L2 ERC20 token", + decimals: 18, + iconURL: null, + liquidity: null, + usdPrice: null, + }, + }) + ); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + 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({ type: TransactionsType.refund })); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[2]).toStrictEqual( + expect.objectContaining({ + token: { + decimals: 18, + iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", + l1Address: Token.ETHER_Address, + l2Address: Token.ETHER_ERC20_Address, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); + }); }); - }); - //@id1455 - it("Verify the transaction after SetGreeting execution via transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.executeGreeterTx); - apiRoute = `/transactions/${txHash}/transfers?page=1&limit=10`; - response = await helper.performGETrequest(apiRoute); - - expect(response.status).toBe(200); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_PULL_Address })); - expect(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({ type: TransactionsType.fee })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ token: null })); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); - 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({ type: TransactionsType.refund })); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ fields: null })); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ token: null })); + //@id1483 + it("Verify transaction for the Custom tokenII via /transactions/{transactionHash}/transfers", async () => { + await helper.retryTestAction(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); + + 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({ transactionHash: txHash })); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) + ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + 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 })); + 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( + expect.objectContaining({ + token: { + l2Address: token, + l1Address: tokenL1, + symbol: "L1", + name: "L1 ERC20 token", + decimals: 18, + iconURL: null, + liquidity: null, + usdPrice: null, + }, + }) + ); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + 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({ type: TransactionsType.refund })); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[2]).toStrictEqual( + expect.objectContaining({ + token: { + decimals: 18, + iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", + l1Address: Token.ETHER_Address, + l2Address: Token.ETHER_ERC20_Address, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); + }); }); - }); - - //@id1472 - it("Verify transaction for the Root contract via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(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); - 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({ transactionHash: txHash })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ token: null })); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); - 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({ type: TransactionsType.refund })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ token: null })); + //@id1452 + it("Verify transaction through Paymaster via /transactions/{transactionHash}/transfers", async () => { + await helper.retryTestAction(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); + + expect(response.status).toBe(200); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: emptyWallet })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: paymasterAddress })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ amount: "1" })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenAddress: token })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.transfer })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ + token: { + l2Address: token, + l1Address: null, + symbol: "MyToken", + name: "MyToken", + decimals: 18, + iconURL: null, + liquidity: null, + usdPrice: null, + }, + }) + ); + 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({ transactionHash: txHash })); + expect(response.body.items[1]).toStrictEqual( + expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) + ); + 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( + expect.objectContaining({ + token: { + decimals: 18, + iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", + l1Address: Token.ETHER_Address, + l2Address: Token.ETHER_ERC20_Address, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + 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({ type: TransactionsType.refund })); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[2]).toStrictEqual( + expect.objectContaining({ + token: { + decimals: 18, + iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", + l1Address: Token.ETHER_Address, + l2Address: Token.ETHER_ERC20_Address, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); + }); }); - }); - //@id1473 - it("Verify transaction for the Middle contract via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(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); - - 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({ transactionHash: txHash })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ token: null })); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); - 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({ type: TransactionsType.refund })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ token: null })); + //@id1455 + it("Verify the transaction after SetGreeting execution via transactions/{transactionHash}/transfers", async () => { + await helper.retryTestAction(async () => { + txHash = await helper.getStringFromFile(bufferFile + Buffer.executeGreeterTx); + apiRoute = `/transactions/${txHash}/transfers`; + const decapitalizedAddress = apiRoute.slice(1).toLowerCase(); + response = await helper.performGETrequest(apiRoute); + + expect(response.status).toBe(200); + expect(typeof response.body.items[0].amount).toStrictEqual("string"); + expect(typeof response.body.items[0].blockNumber).toStrictEqual("number"); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + 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({ transactionHash: txHash })); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) + ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ + token: { + decimals: 18, + iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", + l1Address: Token.ETHER_Address, + l2Address: Token.ETHER_ERC20_Address, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenType: "ETH" })); + 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({ 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({ 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, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ tokenType: "ETH" })); + expect(response.body.meta).toStrictEqual(expect.objectContaining({ totalItems: 2 })); + expect(response.body.meta).toStrictEqual(expect.objectContaining({ itemCount: 2 })); + expect(response.body.meta).toStrictEqual(expect.objectContaining({ itemsPerPage: 10 })); + expect(response.body.meta).toStrictEqual(expect.objectContaining({ totalPages: 1 })); + expect(response.body.meta).toStrictEqual(expect.objectContaining({ currentPage: 1 })); + expect(response.body.links).toStrictEqual( + expect.objectContaining({ first: `${decapitalizedAddress}?limit=10` }) + ); + expect(response.body.links).toStrictEqual(expect.objectContaining({ previous: "" })); + expect(response.body.links).toStrictEqual(expect.objectContaining({ next: "" })); + expect(response.body.links).toStrictEqual( + expect.objectContaining({ last: `${decapitalizedAddress}?page=1&limit=10` }) + ); + }); }); - }); - - //@id1474 - it("Verify transaction for the Caller contract via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(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); - 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({ transactionHash: txHash })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ token: null })); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); - 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({ type: TransactionsType.refund })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ token: null })); + //@id1472 + it("Verify transaction for the Root contract via /transactions/{transactionHash}/transfers", async () => { + await helper.retryTestAction(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); + + 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({ transactionHash: txHash })); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) + ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ + token: { + decimals: 18, + iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", + l1Address: Token.ETHER_Address, + l2Address: Token.ETHER_ERC20_Address, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + 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({ type: TransactionsType.refund })); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ fields: null })); + 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, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); + }); }); - }); - - //@id1475 - it("Verify transaction for the use multicall contract via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txUseMultiCallContracts); - apiRoute = `/transactions/${txHash}/transfers?page=1&limit=10`; - response = await helper.performGETrequest(apiRoute); - expect(response.status).toBe(200); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_PULL_Address })); - expect(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({ type: TransactionsType.fee })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ token: null })); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); - 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({ type: TransactionsType.refund })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ token: null })); + //@id1473 + it("Verify transaction for the Middle contract via /transactions/{transactionHash}/transfers", async () => { + await helper.retryTestAction(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); + + 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({ transactionHash: txHash })); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) + ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ + token: { + decimals: 18, + iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", + l1Address: Token.ETHER_Address, + l2Address: Token.ETHER_ERC20_Address, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + 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({ type: TransactionsType.refund })); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ fields: null })); + 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, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); + }); }); - }); - }); - describe("/transactions/${txHash}/logs", () => { - //@id1507 - it("Verify the transaction via /transactions/{transactionHash}/logs", async () => { - await helper.retryTestAction(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); + //@id1474 + it("Verify transaction for the Caller contract via /transactions/{transactionHash}/transfers", async () => { + await helper.retryTestAction(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); + + 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({ transactionHash: txHash })); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) + ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ + token: { + decimals: 18, + iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", + l1Address: Token.ETHER_Address, + l2Address: Token.ETHER_ERC20_Address, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + 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({ type: TransactionsType.refund })); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ fields: null })); + 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, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); + }); + }); - expect(response.status).toBe(200); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ address: Token.ETHER_ERC20_Address })); - 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"); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(typeof response.body.items[0].transactionIndex).toStrictEqual("number"); - expect(typeof response.body.items[0].logIndex).toStrictEqual("number"); - expect(typeof response.body.items[0].timestamp).toStrictEqual("string"); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ address: contract })); - expect(Array.isArray(response.body.items[1].topics)).toStrictEqual(true); - expect(typeof response.body.items[1].data).toStrictEqual("string"); - expect(typeof response.body.items[1].blockNumber).toStrictEqual("number"); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - 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(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"); - expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(typeof response.body.items[2].transactionIndex).toStrictEqual("number"); - expect(typeof response.body.items[2].logIndex).toStrictEqual("number"); - expect(typeof response.body.items[2].timestamp).toStrictEqual("string"); - expect(response.body.meta).toStrictEqual(expect.objectContaining({ totalItems: 3 })); - expect(response.body.meta).toStrictEqual(expect.objectContaining({ itemCount: 3 })); - expect(response.body.meta).toStrictEqual(expect.objectContaining({ itemsPerPage: 10 })); - expect(response.body.meta).toStrictEqual(expect.objectContaining({ totalPages: 1 })); - expect(response.body.meta).toStrictEqual(expect.objectContaining({ currentPage: 1 })); - expect(response.body.links).toStrictEqual( - expect.objectContaining({ first: `${decapitalizedAddress}?limit=10` }) - ); - expect(response.body.links).toStrictEqual(expect.objectContaining({ previous: "" })); - expect(response.body.links).toStrictEqual(expect.objectContaining({ next: "" })); - expect(response.body.links).toStrictEqual( - expect.objectContaining({ last: `${decapitalizedAddress}?page=1&limit=10` }) - ); + //@id1475 + it("Verify transaction for the use multicall contract via /transactions/{transactionHash}/transfers", async () => { + await helper.retryTestAction(async () => { + txHash = await helper.getStringFromFile(bufferFile + Buffer.txUseMultiCallContracts); + apiRoute = `/transactions/${txHash}/transfers?page=1&limit=10`; + response = await helper.performGETrequest(apiRoute); + + expect(response.status).toBe(200); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_PULL_Address })); + expect(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({ type: TransactionsType.fee })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ + token: { + decimals: 18, + iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", + l1Address: Token.ETHER_Address, + l2Address: Token.ETHER_ERC20_Address, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + 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({ type: TransactionsType.refund })); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ fields: null })); + 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, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); + }); }); }); - }); - - describe("/transactions", () => { - //@id1506 - it("Verify the transaction via /transactions", async () => { - await helper.retryTestAction(async () => { - apiRoute = `/transactions`; - response = await helper.performGETrequest(apiRoute); - expect(response.status).toBe(200); - expect(Array.isArray(response.body.items)).toStrictEqual(true); - expect(response.body.items.length).toBe(10); - expect(typeof response.body.meta.totalItems).toStrictEqual("number"); - expect(typeof response.body.meta.itemCount).toStrictEqual("number"); - expect(typeof response.body.meta.itemsPerPage).toStrictEqual("number"); - expect(typeof response.body.meta.totalPages).toStrictEqual("number"); - expect(typeof response.body.meta.currentPage).toStrictEqual("number"); - expect(typeof response.body.links.first).toStrictEqual("string"); - expect(typeof response.body.links.previous).toStrictEqual("string"); - expect(typeof response.body.links.next).toStrictEqual("string"); - expect(typeof response.body.links.last).toStrictEqual("string"); + describe("/transactions/${txHash}/logs", () => { + //@id1507 + it("Verify the transaction via /transactions/{transactionHash}/logs", async () => { + await helper.retryTestAction(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); + + expect(response.status).toBe(200); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ address: Token.ETHER_ERC20_Address })); + 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"); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); + expect(typeof response.body.items[0].transactionIndex).toStrictEqual("number"); + expect(typeof response.body.items[0].logIndex).toStrictEqual("number"); + expect(typeof response.body.items[0].timestamp).toStrictEqual("string"); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ address: contract })); + expect(Array.isArray(response.body.items[1].topics)).toStrictEqual(true); + expect(typeof response.body.items[1].data).toStrictEqual("string"); + expect(typeof response.body.items[1].blockNumber).toStrictEqual("number"); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); + 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(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"); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); + expect(typeof response.body.items[2].transactionIndex).toStrictEqual("number"); + expect(typeof response.body.items[2].logIndex).toStrictEqual("number"); + expect(typeof response.body.items[2].timestamp).toStrictEqual("string"); + expect(response.body.meta).toStrictEqual(expect.objectContaining({ totalItems: 3 })); + expect(response.body.meta).toStrictEqual(expect.objectContaining({ itemCount: 3 })); + expect(response.body.meta).toStrictEqual(expect.objectContaining({ itemsPerPage: 10 })); + expect(response.body.meta).toStrictEqual(expect.objectContaining({ totalPages: 1 })); + expect(response.body.meta).toStrictEqual(expect.objectContaining({ currentPage: 1 })); + expect(response.body.links).toStrictEqual( + expect.objectContaining({ first: `${decapitalizedAddress}?limit=10` }) + ); + expect(response.body.links).toStrictEqual(expect.objectContaining({ previous: "" })); + expect(response.body.links).toStrictEqual(expect.objectContaining({ next: "" })); + expect(response.body.links).toStrictEqual( + expect.objectContaining({ last: `${decapitalizedAddress}?page=1&limit=10` }) + ); + }); }); }); - }); - - describe("/api?module=transaction", () => { - //@id1697 - it("Verify /api?module=transaction&action=getstatus response", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txEthTransfer); - apiRoute = `/api?module=transaction&action=getstatus&txhash=${txHash}`; - response = await helper.performGETrequest(apiRoute); - expect(response.status).toBe(200); - expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" })); - expect(response.body).toStrictEqual(expect.objectContaining({ message: "OK" })); - expect(response.body.result).toStrictEqual(expect.objectContaining({ isError: "0", errDescription: "" })); + describe("/transactions", () => { + //@id1506 + it("Verify the transaction via /transactions", async () => { + await helper.retryTestAction(async () => { + apiRoute = `/transactions`; + response = await helper.performGETrequest(apiRoute); + + expect(response.status).toBe(200); + expect(Array.isArray(response.body.items)).toStrictEqual(true); + expect(response.body.items.length).toBe(10); + expect(typeof response.body.meta.totalItems).toStrictEqual("number"); + expect(typeof response.body.meta.itemCount).toStrictEqual("number"); + expect(typeof response.body.meta.itemsPerPage).toStrictEqual("number"); + expect(typeof response.body.meta.totalPages).toStrictEqual("number"); + expect(typeof response.body.meta.currentPage).toStrictEqual("number"); + expect(typeof response.body.links.first).toStrictEqual("string"); + expect(typeof response.body.links.previous).toStrictEqual("string"); + expect(typeof response.body.links.next).toStrictEqual("string"); + expect(typeof response.body.links.last).toStrictEqual("string"); + }); }); }); - //@id1698 - it("Verify /api?module=transaction&action=gettxreceiptstatus response", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txEthTransfer); - apiRoute = `/api?module=transaction&action=gettxreceiptstatus&txhash=${txHash}`; - response = await helper.performGETrequest(apiRoute); + describe("/api?module=transaction", () => { + //@id1697 + it("Verify /api?module=transaction&action=getstatus response", async () => { + await helper.retryTestAction(async () => { + txHash = await helper.getStringFromFile(bufferFile + Buffer.txEthTransfer); + apiRoute = `/api?module=transaction&action=getstatus&txhash=${txHash}`; + response = await helper.performGETrequest(apiRoute); + + expect(response.status).toBe(200); + expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" })); + expect(response.body).toStrictEqual(expect.objectContaining({ message: "OK" })); + expect(response.body.result).toStrictEqual(expect.objectContaining({ isError: "0", errDescription: "" })); + }); + }); - expect(response.status).toBe(200); - expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" })); - expect(response.body).toStrictEqual(expect.objectContaining({ message: "OK" })); - expect(typeof response.body.result.status).toStrictEqual("string"); + //@id1698 + it("Verify /api?module=transaction&action=gettxreceiptstatus response", async () => { + await helper.retryTestAction(async () => { + txHash = await helper.getStringFromFile(bufferFile + Buffer.txEthTransfer); + apiRoute = `/api?module=transaction&action=gettxreceiptstatus&txhash=${txHash}`; + response = await helper.performGETrequest(apiRoute); + + expect(response.status).toBe(200); + expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" })); + expect(response.body).toStrictEqual(expect.objectContaining({ message: "OK" })); + expect(typeof response.body.result.status).toStrictEqual("string"); + }); }); }); }); From f382dfa106eb8402dc93465579cb21d15a74ab59 Mon Sep 17 00:00:00 2001 From: amelnytskyi Date: Thu, 1 Feb 2024 17:40:37 +0200 Subject: [PATCH 2/4] test: fixing gating transactions tests Fixed failing test id1506 "Verify the transaction via /transactions" --- packages/integration-tests/tests/api/transactions.test.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/integration-tests/tests/api/transactions.test.ts b/packages/integration-tests/tests/api/transactions.test.ts index 8b517bb128..665449bdff 100644 --- a/packages/integration-tests/tests/api/transactions.test.ts +++ b/packages/integration-tests/tests/api/transactions.test.ts @@ -1100,8 +1100,9 @@ describe("Transactions", () => { expect(typeof response.body.items[0].from).toStrictEqual("string"); expect(response.body.items[0].from.length).toBe(42); expect(typeof response.body.items[0].data).toStrictEqual("string"); - expect(response.body.items[0].data.length).toBe(138); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ value: "0" })); + expect(response.body.items[0].data.length).toBeGreaterThan(0); + expect(typeof response.body.items[0].value).toStrictEqual("string"); + expect(response.body.items[0].value.length).toBeGreaterThanOrEqual(1); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ isL1Originated: false })); expect(typeof response.body.items[0].fee).toStrictEqual("string"); expect(response.body.items[0].fee.length).toBe(14); @@ -1124,7 +1125,7 @@ describe("Transactions", () => { expect(typeof response.body.items[0].receivedAt).toStrictEqual("string"); expect(response.body.items[0].receivedAt.length).toBe(24); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ error: null })); - expect(typeof response.body.items[0].revertReason).toBe("string" || null); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ revertReason: null })); expect(typeof response.body.items[0].status).toStrictEqual("string"); expect(typeof response.body.items[0].commitTxHash).toStrictEqual("string"); expect(response.body.items[0].commitTxHash.length).toBe(66); From ea5ea0f13f6f240cde0ae7793e736e5f044c381a Mon Sep 17 00:00:00 2001 From: amelnytskyi Date: Tue, 6 Feb 2024 15:49:09 +0200 Subject: [PATCH 3/4] test: fixing gating transactions tests Fixing spaces --- packages/integration-tests/tests/api/transactions.test.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/integration-tests/tests/api/transactions.test.ts b/packages/integration-tests/tests/api/transactions.test.ts index 665449bdff..b9ee0e141f 100644 --- a/packages/integration-tests/tests/api/transactions.test.ts +++ b/packages/integration-tests/tests/api/transactions.test.ts @@ -1032,6 +1032,8 @@ describe("Transactions", () => { }); describe("/transactions/${txHash}/logs", () => { + //test + //@id1507 it("Verify the transaction via /transactions/{transactionHash}/logs", async () => { await helper.retryTestAction(async () => { From 1a32c11907fa80eb1cc10f953fde58dd567d3b99 Mon Sep 17 00:00:00 2001 From: amelnytskyi Date: Tue, 6 Feb 2024 15:59:45 +0200 Subject: [PATCH 4/4] test: fixing gating transactions tests Fixing spaces --- .../tests/api/transactions.test.ts | 1772 ++++++++--------- 1 file changed, 885 insertions(+), 887 deletions(-) diff --git a/packages/integration-tests/tests/api/transactions.test.ts b/packages/integration-tests/tests/api/transactions.test.ts index b9ee0e141f..cdf0d08f96 100644 --- a/packages/integration-tests/tests/api/transactions.test.ts +++ b/packages/integration-tests/tests/api/transactions.test.ts @@ -243,939 +243,937 @@ describe("Transactions", () => { ); }); }); + }); - describe("/transactions/{transactionHash}", () => { - beforeAll(async () => { - const customToken = await helper.getStringFromFile(bufferFile + Buffer.L2deposited); - await playbook.transferFailedState(customToken); - }); + describe("/transactions/{transactionHash}", () => { + beforeAll(async () => { + const customToken = await helper.getStringFromFile(bufferFile + Buffer.L2deposited); + await playbook.transferFailedState(customToken); + }); - //@id1460 - it("Verify the ETH withdrawal to the other address via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txEthWithdrawOtherAddress); - apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); - - expect(response.status).toBe(200); - expect(response.body.hash).toBe(txHash); - expect(response.body.to).toBe("0x000000000000000000000000000000000000800A"); - expect(response.body.from).toBe(Wallets.richWalletAddress); - expect(response.body.value).toBe("9000000000000"); - }); - }); + //@id1460 + it("Verify the ETH withdrawal to the other address via /transactions/{transactionHash}", async () => { + await helper.retryTestAction(async () => { + txHash = await helper.getStringFromFile(bufferFile + Buffer.txEthWithdrawOtherAddress); + apiRoute = `/transactions/${txHash}`; + response = await helper.performGETrequest(apiRoute); - //@id1462 - it("Verify the custom token withdrawal via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txERC20Withdraw); - apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); - - expect(response.status).toBe(200); - expect(response.body.hash).toBe(txHash); - expect(response.body.from).toBe(Wallets.richWalletAddress); - }); + expect(response.status).toBe(200); + expect(response.body.hash).toBe(txHash); + expect(response.body.to).toBe("0x000000000000000000000000000000000000800A"); + expect(response.body.from).toBe(Wallets.richWalletAddress); + expect(response.body.value).toBe("9000000000000"); }); + }); - //@id1458 - it("Verify the ETH withdrawal via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txEthWithdraw); - apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); - - expect(response.status).toBe(200); - expect(response.body.hash).toBe(txHash); - expect(response.body.to).toBe("0x000000000000000000000000000000000000800A"); - expect(response.body.from).toBe(Wallets.richWalletAddress); - expect(response.body.value).toBe("9000000000000"); - }); - }); + //@id1462 + it("Verify the custom token withdrawal via /transactions/{transactionHash}", async () => { + await helper.retryTestAction(async () => { + txHash = await helper.getStringFromFile(bufferFile + Buffer.txERC20Withdraw); + apiRoute = `/transactions/${txHash}`; + response = await helper.performGETrequest(apiRoute); - //@id1478 - it("Verify transaction for the ETH via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiTransferETH); - contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiTransferETH); - apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); - - expect(response.status).toBe(200); - expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); - expect(response.body).toStrictEqual(expect.objectContaining({ to: contract })); - expect(response.body).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); - }); + expect(response.status).toBe(200); + expect(response.body.hash).toBe(txHash); + expect(response.body.from).toBe(Wallets.richWalletAddress); }); + }); - //@id1479 - it("Verify transaction for the Custom Token I via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { - contract = await helper.getStringFromFile(bufferFile + Buffer.L2); - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiTransferCustomTokenI); - apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); - - expect(response.status).toBe(200); - expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); - // expect(response.body).toStrictEqual(expect.objectContaining({ to: contract })) //unstable on CI - expect(response.body).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); - }); - }); + //@id1458 + it("Verify the ETH withdrawal via /transactions/{transactionHash}", async () => { + await helper.retryTestAction(async () => { + txHash = await helper.getStringFromFile(bufferFile + Buffer.txEthWithdraw); + apiRoute = `/transactions/${txHash}`; + response = await helper.performGETrequest(apiRoute); - //@id1480 - it("Verify transaction for the Custom Token II via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { - contract = await helper.getStringFromFile(bufferFile + Buffer.L2deposited); - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiTransferCustomTokenII); - apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); - - expect(response.status).toBe(200); - expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); - expect(response.body).toStrictEqual(expect.objectContaining({ to: contract })); - expect(response.body).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); - }); + expect(response.status).toBe(200); + expect(response.body.hash).toBe(txHash); + expect(response.body.to).toBe("0x000000000000000000000000000000000000800A"); + expect(response.body.from).toBe(Wallets.richWalletAddress); + expect(response.body.value).toBe("9000000000000"); }); + }); - //@id1454 - it("Verify the transaction after SetGreeting execution via transactions/{transactionHash}", async () => { - await helper.retryTestAction(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); - - expect(response.status).toBe(200); - expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); - expect(response.body).toStrictEqual(expect.objectContaining({ to: contract })); - expect(response.body).toStrictEqual(expect.objectContaining({ value: "0" })); - expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); - }); - }); + //@id1478 + it("Verify transaction for the ETH via /transactions/{transactionHash}", async () => { + await helper.retryTestAction(async () => { + txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiTransferETH); + contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiTransferETH); + apiRoute = `/transactions/${txHash}`; + response = await helper.performGETrequest(apiRoute); - //@id1464:I --> @id1468 - it("Verify transaction for the Root contract via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallRoot); - apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); - - expect(response.status).toBe(200); - expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); - expect(response.body).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body).toStrictEqual(expect.objectContaining({ value: "0" })); - expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); - expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); - }); + expect(response.status).toBe(200); + expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); + expect(response.body).toStrictEqual(expect.objectContaining({ to: contract })); + expect(response.body).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); + expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); }); + }); - //@id1465:I --> @id1469 - it("Verify transaction for the Middle contract via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallMiddle); - apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); - - expect(response.status).toBe(200); - expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); - expect(response.body).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body).toStrictEqual(expect.objectContaining({ value: "0" })); - expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); - expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); - }); - }); + //@id1479 + it("Verify transaction for the Custom Token I via /transactions/{transactionHash}", async () => { + await helper.retryTestAction(async () => { + contract = await helper.getStringFromFile(bufferFile + Buffer.L2); + txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiTransferCustomTokenI); + apiRoute = `/transactions/${txHash}`; + response = await helper.performGETrequest(apiRoute); - //@id1466:I --> @id1470 - it("Verify transaction for the Caller contract via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallCaller); - apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); - - expect(response.status).toBe(200); - expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); - expect(response.body).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body).toStrictEqual(expect.objectContaining({ value: "0" })); - expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); - expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); - }); + expect(response.status).toBe(200); + expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); + // expect(response.body).toStrictEqual(expect.objectContaining({ to: contract })) //unstable on CI + expect(response.body).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); + expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); }); + }); - //@id1471 - it("Verify transaction for the use multicall contract via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txUseMultiCallContracts); - apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); - - expect(response.status).toBe(200); - expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); - expect(response.body).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body).toStrictEqual(expect.objectContaining({ value: "0" })); - expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); - expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); - }); - }); + //@id1480 + it("Verify transaction for the Custom Token II via /transactions/{transactionHash}", async () => { + await helper.retryTestAction(async () => { + contract = await helper.getStringFromFile(bufferFile + Buffer.L2deposited); + txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiTransferCustomTokenII); + apiRoute = `/transactions/${txHash}`; + response = await helper.performGETrequest(apiRoute); - //@id645 - it("Verify the transactions with failed state via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(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); - - expect(response.status).toBe(200); - 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.status).toBe(200); + expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); + expect(response.body).toStrictEqual(expect.objectContaining({ to: contract })); + expect(response.body).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); + expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); }); }); - describe("/transactions/{transactionHash}/transfers", () => { - beforeAll(async () => { - await playbook.deployViaPaymaster(); - await playbook.usePaymaster(); - }); + //@id1454 + it("Verify the transaction after SetGreeting execution via transactions/{transactionHash}", async () => { + await helper.retryTestAction(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); - //@id1481 - it("Verify transaction for the ETH via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(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); - - 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({ transactionHash: txHash })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ - token: { - decimals: 18, - iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, - liquidity: 220000000000, - symbol: "ETH", - name: "Ether", - usdPrice: 1800, - }, - }) - ); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: contract })); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[1]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); - 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( - expect.objectContaining({ - token: { - decimals: 18, - iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, - liquidity: 220000000000, - symbol: "ETH", - name: "Ether", - usdPrice: 1800, - }, - }) - ); - expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); - 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({ type: TransactionsType.refund })); - expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ fields: null })); - expect(response.body.items[2]).toStrictEqual( - expect.objectContaining({ - token: { - decimals: 18, - iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, - liquidity: 220000000000, - symbol: "ETH", - name: "Ether", - usdPrice: 1800, - }, - }) - ); - }); + expect(response.status).toBe(200); + expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); + expect(response.body).toStrictEqual(expect.objectContaining({ to: contract })); + expect(response.body).toStrictEqual(expect.objectContaining({ value: "0" })); + expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); }); + }); - //@id1482 - it("Verify transaction for the Custom tokenI via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(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); - - 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({ transactionHash: txHash })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); - 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 })); - 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( - expect.objectContaining({ - token: { - l2Address: token, - l1Address: null, - symbol: "L2", - name: "L2 ERC20 token", - decimals: 18, - iconURL: null, - liquidity: null, - usdPrice: null, - }, - }) - ); - expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); - 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({ type: TransactionsType.refund })); - expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ fields: null })); - expect(response.body.items[2]).toStrictEqual( - expect.objectContaining({ - token: { - decimals: 18, - iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, - liquidity: 220000000000, - symbol: "ETH", - name: "Ether", - usdPrice: 1800, - }, - }) - ); - }); - }); + //@id1464:I --> @id1468 + it("Verify transaction for the Root contract via /transactions/{transactionHash}", async () => { + await helper.retryTestAction(async () => { + txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallRoot); + apiRoute = `/transactions/${txHash}`; + response = await helper.performGETrequest(apiRoute); - //@id1483 - it("Verify transaction for the Custom tokenII via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(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); - - 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({ transactionHash: txHash })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); - 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 })); - 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( - expect.objectContaining({ - token: { - l2Address: token, - l1Address: tokenL1, - symbol: "L1", - name: "L1 ERC20 token", - decimals: 18, - iconURL: null, - liquidity: null, - usdPrice: null, - }, - }) - ); - expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); - 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({ type: TransactionsType.refund })); - expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ fields: null })); - expect(response.body.items[2]).toStrictEqual( - expect.objectContaining({ - token: { - decimals: 18, - iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, - liquidity: 220000000000, - symbol: "ETH", - name: "Ether", - usdPrice: 1800, - }, - }) - ); - }); + expect(response.status).toBe(200); + expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); + expect(response.body).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); + expect(response.body).toStrictEqual(expect.objectContaining({ value: "0" })); + expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); + expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); }); + }); - //@id1452 - it("Verify transaction through Paymaster via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(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); - - expect(response.status).toBe(200); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: emptyWallet })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: paymasterAddress })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ amount: "1" })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenAddress: token })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.transfer })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ - token: { - l2Address: token, - l1Address: null, - symbol: "MyToken", - name: "MyToken", - decimals: 18, - iconURL: null, - liquidity: null, - usdPrice: null, - }, - }) - ); - 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({ transactionHash: txHash })); - expect(response.body.items[1]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); - 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( - expect.objectContaining({ - token: { - decimals: 18, - iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, - liquidity: 220000000000, - symbol: "ETH", - name: "Ether", - usdPrice: 1800, - }, - }) - ); - expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); - 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({ type: TransactionsType.refund })); - expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ fields: null })); - expect(response.body.items[2]).toStrictEqual( - expect.objectContaining({ - token: { - decimals: 18, - iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, - liquidity: 220000000000, - symbol: "ETH", - name: "Ether", - usdPrice: 1800, - }, - }) - ); - }); - }); + //@id1465:I --> @id1469 + it("Verify transaction for the Middle contract via /transactions/{transactionHash}", async () => { + await helper.retryTestAction(async () => { + txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallMiddle); + apiRoute = `/transactions/${txHash}`; + response = await helper.performGETrequest(apiRoute); - //@id1455 - it("Verify the transaction after SetGreeting execution via transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.executeGreeterTx); - apiRoute = `/transactions/${txHash}/transfers`; - const decapitalizedAddress = apiRoute.slice(1).toLowerCase(); - response = await helper.performGETrequest(apiRoute); - - expect(response.status).toBe(200); - expect(typeof response.body.items[0].amount).toStrictEqual("string"); - expect(typeof response.body.items[0].blockNumber).toStrictEqual("number"); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); - 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({ transactionHash: txHash })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ - token: { - decimals: 18, - iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, - liquidity: 220000000000, - symbol: "ETH", - name: "Ether", - usdPrice: 1800, - }, - }) - ); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenType: "ETH" })); - 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({ 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({ 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, - liquidity: 220000000000, - symbol: "ETH", - name: "Ether", - usdPrice: 1800, - }, - }) - ); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ tokenType: "ETH" })); - expect(response.body.meta).toStrictEqual(expect.objectContaining({ totalItems: 2 })); - expect(response.body.meta).toStrictEqual(expect.objectContaining({ itemCount: 2 })); - expect(response.body.meta).toStrictEqual(expect.objectContaining({ itemsPerPage: 10 })); - expect(response.body.meta).toStrictEqual(expect.objectContaining({ totalPages: 1 })); - expect(response.body.meta).toStrictEqual(expect.objectContaining({ currentPage: 1 })); - expect(response.body.links).toStrictEqual( - expect.objectContaining({ first: `${decapitalizedAddress}?limit=10` }) - ); - expect(response.body.links).toStrictEqual(expect.objectContaining({ previous: "" })); - expect(response.body.links).toStrictEqual(expect.objectContaining({ next: "" })); - expect(response.body.links).toStrictEqual( - expect.objectContaining({ last: `${decapitalizedAddress}?page=1&limit=10` }) - ); - }); + expect(response.status).toBe(200); + expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); + expect(response.body).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); + expect(response.body).toStrictEqual(expect.objectContaining({ value: "0" })); + expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); + expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); }); + }); - //@id1472 - it("Verify transaction for the Root contract via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(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); - - 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({ transactionHash: txHash })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ - token: { - decimals: 18, - iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, - liquidity: 220000000000, - symbol: "ETH", - name: "Ether", - usdPrice: 1800, - }, - }) - ); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); - 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({ type: TransactionsType.refund })); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ fields: null })); - 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, - liquidity: 220000000000, - symbol: "ETH", - name: "Ether", - usdPrice: 1800, - }, - }) - ); - }); - }); + //@id1466:I --> @id1470 + it("Verify transaction for the Caller contract via /transactions/{transactionHash}", async () => { + await helper.retryTestAction(async () => { + txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallCaller); + apiRoute = `/transactions/${txHash}`; + response = await helper.performGETrequest(apiRoute); - //@id1473 - it("Verify transaction for the Middle contract via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(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); - - 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({ transactionHash: txHash })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ - token: { - decimals: 18, - iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, - liquidity: 220000000000, - symbol: "ETH", - name: "Ether", - usdPrice: 1800, - }, - }) - ); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); - 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({ type: TransactionsType.refund })); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ fields: null })); - 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, - liquidity: 220000000000, - symbol: "ETH", - name: "Ether", - usdPrice: 1800, - }, - }) - ); - }); + expect(response.status).toBe(200); + expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); + expect(response.body).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); + expect(response.body).toStrictEqual(expect.objectContaining({ value: "0" })); + expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); + expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); }); + }); + + //@id1471 + it("Verify transaction for the use multicall contract via /transactions/{transactionHash}", async () => { + await helper.retryTestAction(async () => { + txHash = await helper.getStringFromFile(bufferFile + Buffer.txUseMultiCallContracts); + apiRoute = `/transactions/${txHash}`; + response = await helper.performGETrequest(apiRoute); - //@id1474 - it("Verify transaction for the Caller contract via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(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); - - 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({ transactionHash: txHash })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ - token: { - decimals: 18, - iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, - liquidity: 220000000000, - symbol: "ETH", - name: "Ether", - usdPrice: 1800, - }, - }) - ); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); - 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({ type: TransactionsType.refund })); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ fields: null })); - 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, - liquidity: 220000000000, - symbol: "ETH", - name: "Ether", - usdPrice: 1800, - }, - }) - ); - }); + expect(response.status).toBe(200); + expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); + expect(response.body).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); + expect(response.body).toStrictEqual(expect.objectContaining({ value: "0" })); + expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); + expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); }); + }); - //@id1475 - it("Verify transaction for the use multicall contract via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txUseMultiCallContracts); - apiRoute = `/transactions/${txHash}/transfers?page=1&limit=10`; - response = await helper.performGETrequest(apiRoute); - - expect(response.status).toBe(200); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_PULL_Address })); - expect(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({ type: TransactionsType.fee })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ - token: { - decimals: 18, - iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, - liquidity: 220000000000, - symbol: "ETH", - name: "Ether", - usdPrice: 1800, - }, - }) - ); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); - 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({ type: TransactionsType.refund })); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ fields: null })); - 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, - liquidity: 220000000000, - symbol: "ETH", - name: "Ether", - usdPrice: 1800, - }, - }) - ); - }); + //@id645 + it("Verify the transactions with failed state via /transactions/{transactionHash}", async () => { + await helper.retryTestAction(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); + + expect(response.status).toBe(200); + 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); }); }); + }); + + describe("/transactions/{transactionHash}/transfers", () => { + beforeAll(async () => { + await playbook.deployViaPaymaster(); + await playbook.usePaymaster(); + }); + + //@id1481 + it("Verify transaction for the ETH via /transactions/{transactionHash}/transfers", async () => { + await helper.retryTestAction(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); - describe("/transactions/${txHash}/logs", () => { - //test - - //@id1507 - it("Verify the transaction via /transactions/{transactionHash}/logs", async () => { - await helper.retryTestAction(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); - - expect(response.status).toBe(200); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ address: Token.ETHER_ERC20_Address })); - 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"); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(typeof response.body.items[0].transactionIndex).toStrictEqual("number"); - expect(typeof response.body.items[0].logIndex).toStrictEqual("number"); - expect(typeof response.body.items[0].timestamp).toStrictEqual("string"); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ address: contract })); - expect(Array.isArray(response.body.items[1].topics)).toStrictEqual(true); - expect(typeof response.body.items[1].data).toStrictEqual("string"); - expect(typeof response.body.items[1].blockNumber).toStrictEqual("number"); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - 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(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"); - expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(typeof response.body.items[2].transactionIndex).toStrictEqual("number"); - expect(typeof response.body.items[2].logIndex).toStrictEqual("number"); - expect(typeof response.body.items[2].timestamp).toStrictEqual("string"); - expect(response.body.meta).toStrictEqual(expect.objectContaining({ totalItems: 3 })); - expect(response.body.meta).toStrictEqual(expect.objectContaining({ itemCount: 3 })); - expect(response.body.meta).toStrictEqual(expect.objectContaining({ itemsPerPage: 10 })); - expect(response.body.meta).toStrictEqual(expect.objectContaining({ totalPages: 1 })); - expect(response.body.meta).toStrictEqual(expect.objectContaining({ currentPage: 1 })); - expect(response.body.links).toStrictEqual( - expect.objectContaining({ first: `${decapitalizedAddress}?limit=10` }) - ); - expect(response.body.links).toStrictEqual(expect.objectContaining({ previous: "" })); - expect(response.body.links).toStrictEqual(expect.objectContaining({ next: "" })); - expect(response.body.links).toStrictEqual( - expect.objectContaining({ last: `${decapitalizedAddress}?page=1&limit=10` }) - ); - }); + 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({ transactionHash: txHash })); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) + ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ + token: { + decimals: 18, + iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", + l1Address: Token.ETHER_Address, + l2Address: Token.ETHER_ERC20_Address, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: contract })); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); + expect(response.body.items[1]).toStrictEqual( + expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) + ); + 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( + expect.objectContaining({ + token: { + decimals: 18, + iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", + l1Address: Token.ETHER_Address, + l2Address: Token.ETHER_ERC20_Address, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + 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({ type: TransactionsType.refund })); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[2]).toStrictEqual( + expect.objectContaining({ + token: { + decimals: 18, + iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", + l1Address: Token.ETHER_Address, + l2Address: Token.ETHER_ERC20_Address, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); }); }); - describe("/transactions", () => { - //@id1506 - it("Verify the transaction via /transactions", async () => { - await helper.retryTestAction(async () => { - apiRoute = `/transactions`; - response = await helper.performGETrequest(apiRoute); - - expect(response.status).toBe(200); - expect(Array.isArray(response.body.items)).toStrictEqual(true); - expect(response.body.items.length).toBe(10); - expect(typeof response.body.items[0].hash).toStrictEqual("string"); - expect(response.body.items[0].hash.length).toBe(66); - expect(typeof response.body.items[0].to).toStrictEqual("string"); - expect(response.body.items[0].to.length).toBe(42); - expect(typeof response.body.items[0].from).toStrictEqual("string"); - expect(response.body.items[0].from.length).toBe(42); - expect(typeof response.body.items[0].data).toStrictEqual("string"); - expect(response.body.items[0].data.length).toBeGreaterThan(0); - expect(typeof response.body.items[0].value).toStrictEqual("string"); - expect(response.body.items[0].value.length).toBeGreaterThanOrEqual(1); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ isL1Originated: false })); - expect(typeof response.body.items[0].fee).toStrictEqual("string"); - expect(response.body.items[0].fee.length).toBe(14); - expect(typeof response.body.items[0].nonce).toStrictEqual("number"); - expect(response.body.items[0].nonce).toBeGreaterThanOrEqual(0); - expect(typeof response.body.items[0].gasLimit).toStrictEqual("string"); - expect(typeof response.body.items[0].gasPrice).toStrictEqual("string"); - expect(typeof response.body.items[0].gasPerPubdata).toStrictEqual("string"); - expect(typeof response.body.items[0].maxFeePerGas).toStrictEqual("string"); - expect(typeof response.body.items[0].maxPriorityFeePerGas).toStrictEqual("string"); - expect(typeof response.body.items[0].blockNumber).toStrictEqual("number"); - expect(response.body.items[0].blockNumber).toBeGreaterThanOrEqual(0); - expect(typeof response.body.items[0].l1BatchNumber).toStrictEqual("number"); - expect(response.body.items[0].l1BatchNumber).toBeGreaterThanOrEqual(0); - expect(typeof response.body.items[0].blockHash).toStrictEqual("string"); - expect(response.body.items[0].blockHash.length).toBe(66); - expect(typeof response.body.items[0].type).toStrictEqual("number"); - expect(response.body.items[0].type).toBeGreaterThanOrEqual(0); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); - expect(typeof response.body.items[0].receivedAt).toStrictEqual("string"); - expect(response.body.items[0].receivedAt.length).toBe(24); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ error: null })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ revertReason: null })); - expect(typeof response.body.items[0].status).toStrictEqual("string"); - expect(typeof response.body.items[0].commitTxHash).toStrictEqual("string"); - expect(response.body.items[0].commitTxHash.length).toBe(66); - expect(typeof response.body.items[0].executeTxHash).toStrictEqual("string"); - expect(response.body.items[0].executeTxHash.length).toBe(66); - expect(typeof response.body.items[0].proveTxHash).toStrictEqual("string"); - expect(response.body.items[0].proveTxHash.length).toBe(66); - expect(typeof response.body.items[0].isL1BatchSealed).toStrictEqual("boolean"); - expect(typeof response.body.meta.totalItems).toStrictEqual("number"); - expect(typeof response.body.meta.itemCount).toStrictEqual("number"); - expect(typeof response.body.meta.itemsPerPage).toStrictEqual("number"); - expect(typeof response.body.meta.totalPages).toStrictEqual("number"); - expect(typeof response.body.meta.currentPage).toStrictEqual("number"); - expect(typeof response.body.links.first).toStrictEqual("string"); - expect(typeof response.body.links.previous).toStrictEqual("string"); - expect(typeof response.body.links.next).toStrictEqual("string"); - expect(typeof response.body.links.last).toStrictEqual("string"); - }); + //@id1482 + it("Verify transaction for the Custom tokenI via /transactions/{transactionHash}/transfers", async () => { + await helper.retryTestAction(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); + + 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({ transactionHash: txHash })); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) + ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + 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 })); + 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( + expect.objectContaining({ + token: { + l2Address: token, + l1Address: null, + symbol: "L2", + name: "L2 ERC20 token", + decimals: 18, + iconURL: null, + liquidity: null, + usdPrice: null, + }, + }) + ); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + 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({ type: TransactionsType.refund })); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[2]).toStrictEqual( + expect.objectContaining({ + token: { + decimals: 18, + iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", + l1Address: Token.ETHER_Address, + l2Address: Token.ETHER_ERC20_Address, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); }); }); - describe("/api?module=transaction", () => { - //@id1697 - it("Verify /api?module=transaction&action=getstatus response", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txEthTransfer); - apiRoute = `/api?module=transaction&action=getstatus&txhash=${txHash}`; - response = await helper.performGETrequest(apiRoute); - - expect(response.status).toBe(200); - expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" })); - expect(response.body).toStrictEqual(expect.objectContaining({ message: "OK" })); - expect(response.body.result).toStrictEqual(expect.objectContaining({ isError: "0", errDescription: "" })); - }); + //@id1483 + it("Verify transaction for the Custom tokenII via /transactions/{transactionHash}/transfers", async () => { + await helper.retryTestAction(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); + + 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({ transactionHash: txHash })); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) + ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + 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 })); + 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( + expect.objectContaining({ + token: { + l2Address: token, + l1Address: tokenL1, + symbol: "L1", + name: "L1 ERC20 token", + decimals: 18, + iconURL: null, + liquidity: null, + usdPrice: null, + }, + }) + ); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + 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({ type: TransactionsType.refund })); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[2]).toStrictEqual( + expect.objectContaining({ + token: { + decimals: 18, + iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", + l1Address: Token.ETHER_Address, + l2Address: Token.ETHER_ERC20_Address, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); }); + }); + + //@id1452 + it("Verify transaction through Paymaster via /transactions/{transactionHash}/transfers", async () => { + await helper.retryTestAction(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); - //@id1698 - it("Verify /api?module=transaction&action=gettxreceiptstatus response", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txEthTransfer); - apiRoute = `/api?module=transaction&action=gettxreceiptstatus&txhash=${txHash}`; - response = await helper.performGETrequest(apiRoute); - - expect(response.status).toBe(200); - expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" })); - expect(response.body).toStrictEqual(expect.objectContaining({ message: "OK" })); - expect(typeof response.body.result.status).toStrictEqual("string"); - }); + expect(response.status).toBe(200); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: emptyWallet })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: paymasterAddress })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ amount: "1" })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenAddress: token })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.transfer })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ + token: { + l2Address: token, + l1Address: null, + symbol: "MyToken", + name: "MyToken", + decimals: 18, + iconURL: null, + liquidity: null, + usdPrice: null, + }, + }) + ); + 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({ transactionHash: txHash })); + expect(response.body.items[1]).toStrictEqual( + expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) + ); + 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( + expect.objectContaining({ + token: { + decimals: 18, + iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", + l1Address: Token.ETHER_Address, + l2Address: Token.ETHER_ERC20_Address, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + 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({ type: TransactionsType.refund })); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[2]).toStrictEqual( + expect.objectContaining({ + token: { + decimals: 18, + iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", + l1Address: Token.ETHER_Address, + l2Address: Token.ETHER_ERC20_Address, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); + }); + }); + + //@id1455 + it("Verify the transaction after SetGreeting execution via transactions/{transactionHash}/transfers", async () => { + await helper.retryTestAction(async () => { + txHash = await helper.getStringFromFile(bufferFile + Buffer.executeGreeterTx); + apiRoute = `/transactions/${txHash}/transfers`; + const decapitalizedAddress = apiRoute.slice(1).toLowerCase(); + response = await helper.performGETrequest(apiRoute); + + expect(response.status).toBe(200); + expect(typeof response.body.items[0].amount).toStrictEqual("string"); + expect(typeof response.body.items[0].blockNumber).toStrictEqual("number"); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + 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({ transactionHash: txHash })); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) + ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ + token: { + decimals: 18, + iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", + l1Address: Token.ETHER_Address, + l2Address: Token.ETHER_ERC20_Address, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenType: "ETH" })); + 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({ 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({ 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, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ tokenType: "ETH" })); + expect(response.body.meta).toStrictEqual(expect.objectContaining({ totalItems: 2 })); + expect(response.body.meta).toStrictEqual(expect.objectContaining({ itemCount: 2 })); + expect(response.body.meta).toStrictEqual(expect.objectContaining({ itemsPerPage: 10 })); + expect(response.body.meta).toStrictEqual(expect.objectContaining({ totalPages: 1 })); + expect(response.body.meta).toStrictEqual(expect.objectContaining({ currentPage: 1 })); + expect(response.body.links).toStrictEqual( + expect.objectContaining({ first: `${decapitalizedAddress}?limit=10` }) + ); + expect(response.body.links).toStrictEqual(expect.objectContaining({ previous: "" })); + expect(response.body.links).toStrictEqual(expect.objectContaining({ next: "" })); + expect(response.body.links).toStrictEqual( + expect.objectContaining({ last: `${decapitalizedAddress}?page=1&limit=10` }) + ); + }); + }); + + //@id1472 + it("Verify transaction for the Root contract via /transactions/{transactionHash}/transfers", async () => { + await helper.retryTestAction(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); + + 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({ transactionHash: txHash })); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) + ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ + token: { + decimals: 18, + iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", + l1Address: Token.ETHER_Address, + l2Address: Token.ETHER_ERC20_Address, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + 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({ type: TransactionsType.refund })); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ fields: null })); + 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, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); + }); + }); + + //@id1473 + it("Verify transaction for the Middle contract via /transactions/{transactionHash}/transfers", async () => { + await helper.retryTestAction(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); + + 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({ transactionHash: txHash })); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) + ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ + token: { + decimals: 18, + iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", + l1Address: Token.ETHER_Address, + l2Address: Token.ETHER_ERC20_Address, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + 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({ type: TransactionsType.refund })); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ fields: null })); + 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, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); + }); + }); + + //@id1474 + it("Verify transaction for the Caller contract via /transactions/{transactionHash}/transfers", async () => { + await helper.retryTestAction(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); + + 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({ transactionHash: txHash })); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) + ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ + token: { + decimals: 18, + iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", + l1Address: Token.ETHER_Address, + l2Address: Token.ETHER_ERC20_Address, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + 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({ type: TransactionsType.refund })); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ fields: null })); + 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, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); + }); + }); + + //@id1475 + it("Verify transaction for the use multicall contract via /transactions/{transactionHash}/transfers", async () => { + await helper.retryTestAction(async () => { + txHash = await helper.getStringFromFile(bufferFile + Buffer.txUseMultiCallContracts); + apiRoute = `/transactions/${txHash}/transfers?page=1&limit=10`; + response = await helper.performGETrequest(apiRoute); + + expect(response.status).toBe(200); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_PULL_Address })); + expect(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({ type: TransactionsType.fee })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ + token: { + decimals: 18, + iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", + l1Address: Token.ETHER_Address, + l2Address: Token.ETHER_ERC20_Address, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + 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({ type: TransactionsType.refund })); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ fields: null })); + 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, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); + }); + }); + }); + + describe("/transactions/${txHash}/logs", () => { + //@id1507 + it("Verify the transaction via /transactions/{transactionHash}/logs", async () => { + await helper.retryTestAction(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); + + expect(response.status).toBe(200); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ address: Token.ETHER_ERC20_Address })); + 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"); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); + expect(typeof response.body.items[0].transactionIndex).toStrictEqual("number"); + expect(typeof response.body.items[0].logIndex).toStrictEqual("number"); + expect(typeof response.body.items[0].timestamp).toStrictEqual("string"); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ address: contract })); + expect(Array.isArray(response.body.items[1].topics)).toStrictEqual(true); + expect(typeof response.body.items[1].data).toStrictEqual("string"); + expect(typeof response.body.items[1].blockNumber).toStrictEqual("number"); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); + 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(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"); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); + expect(typeof response.body.items[2].transactionIndex).toStrictEqual("number"); + expect(typeof response.body.items[2].logIndex).toStrictEqual("number"); + expect(typeof response.body.items[2].timestamp).toStrictEqual("string"); + expect(response.body.meta).toStrictEqual(expect.objectContaining({ totalItems: 3 })); + expect(response.body.meta).toStrictEqual(expect.objectContaining({ itemCount: 3 })); + expect(response.body.meta).toStrictEqual(expect.objectContaining({ itemsPerPage: 10 })); + expect(response.body.meta).toStrictEqual(expect.objectContaining({ totalPages: 1 })); + expect(response.body.meta).toStrictEqual(expect.objectContaining({ currentPage: 1 })); + expect(response.body.links).toStrictEqual( + expect.objectContaining({ first: `${decapitalizedAddress}?limit=10` }) + ); + expect(response.body.links).toStrictEqual(expect.objectContaining({ previous: "" })); + expect(response.body.links).toStrictEqual(expect.objectContaining({ next: "" })); + expect(response.body.links).toStrictEqual( + expect.objectContaining({ last: `${decapitalizedAddress}?page=1&limit=10` }) + ); + }); + }); + }); + + describe("/transactions", () => { + //@id1506 + it("Verify the transaction via /transactions", async () => { + await helper.retryTestAction(async () => { + apiRoute = `/transactions`; + response = await helper.performGETrequest(apiRoute); + + expect(response.status).toBe(200); + expect(Array.isArray(response.body.items)).toStrictEqual(true); + expect(response.body.items.length).toBe(10); + expect(typeof response.body.items[0].hash).toStrictEqual("string"); + expect(response.body.items[0].hash.length).toBe(66); + expect(typeof response.body.items[0].to).toStrictEqual("string"); + expect(response.body.items[0].to.length).toBe(42); + expect(typeof response.body.items[0].from).toStrictEqual("string"); + expect(response.body.items[0].from.length).toBe(42); + expect(typeof response.body.items[0].data).toStrictEqual("string"); + expect(response.body.items[0].data.length).toBeGreaterThan(0); + expect(typeof response.body.items[0].value).toStrictEqual("string"); + expect(response.body.items[0].value.length).toBeGreaterThanOrEqual(1); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ isL1Originated: false })); + expect(typeof response.body.items[0].fee).toStrictEqual("string"); + expect(response.body.items[0].fee.length).toBe(14); + expect(typeof response.body.items[0].nonce).toStrictEqual("number"); + expect(response.body.items[0].nonce).toBeGreaterThanOrEqual(0); + expect(typeof response.body.items[0].gasLimit).toStrictEqual("string"); + expect(typeof response.body.items[0].gasPrice).toStrictEqual("string"); + expect(typeof response.body.items[0].gasPerPubdata).toStrictEqual("string"); + expect(typeof response.body.items[0].maxFeePerGas).toStrictEqual("string"); + expect(typeof response.body.items[0].maxPriorityFeePerGas).toStrictEqual("string"); + expect(typeof response.body.items[0].blockNumber).toStrictEqual("number"); + expect(response.body.items[0].blockNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.items[0].l1BatchNumber).toStrictEqual("number"); + expect(response.body.items[0].l1BatchNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.items[0].blockHash).toStrictEqual("string"); + expect(response.body.items[0].blockHash.length).toBe(66); + expect(typeof response.body.items[0].type).toStrictEqual("number"); + expect(response.body.items[0].type).toBeGreaterThanOrEqual(0); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); + expect(typeof response.body.items[0].receivedAt).toStrictEqual("string"); + expect(response.body.items[0].receivedAt.length).toBe(24); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ error: null })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ revertReason: null })); + expect(typeof response.body.items[0].status).toStrictEqual("string"); + expect(typeof response.body.items[0].commitTxHash).toStrictEqual("string"); + expect(response.body.items[0].commitTxHash.length).toBe(66); + expect(typeof response.body.items[0].executeTxHash).toStrictEqual("string"); + expect(response.body.items[0].executeTxHash.length).toBe(66); + expect(typeof response.body.items[0].proveTxHash).toStrictEqual("string"); + expect(response.body.items[0].proveTxHash.length).toBe(66); + expect(typeof response.body.items[0].isL1BatchSealed).toStrictEqual("boolean"); + expect(typeof response.body.meta.totalItems).toStrictEqual("number"); + expect(typeof response.body.meta.itemCount).toStrictEqual("number"); + expect(typeof response.body.meta.itemsPerPage).toStrictEqual("number"); + expect(typeof response.body.meta.totalPages).toStrictEqual("number"); + expect(typeof response.body.meta.currentPage).toStrictEqual("number"); + expect(typeof response.body.links.first).toStrictEqual("string"); + expect(typeof response.body.links.previous).toStrictEqual("string"); + expect(typeof response.body.links.next).toStrictEqual("string"); + expect(typeof response.body.links.last).toStrictEqual("string"); + }); + }); + }); + + describe("/api?module=transaction", () => { + //@id1697 + it("Verify /api?module=transaction&action=getstatus response", async () => { + await helper.retryTestAction(async () => { + txHash = await helper.getStringFromFile(bufferFile + Buffer.txEthTransfer); + apiRoute = `/api?module=transaction&action=getstatus&txhash=${txHash}`; + response = await helper.performGETrequest(apiRoute); + + expect(response.status).toBe(200); + expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" })); + expect(response.body).toStrictEqual(expect.objectContaining({ message: "OK" })); + expect(response.body.result).toStrictEqual(expect.objectContaining({ isError: "0", errDescription: "" })); + }); + }); + + //@id1698 + it("Verify /api?module=transaction&action=gettxreceiptstatus response", async () => { + await helper.retryTestAction(async () => { + txHash = await helper.getStringFromFile(bufferFile + Buffer.txEthTransfer); + apiRoute = `/api?module=transaction&action=gettxreceiptstatus&txhash=${txHash}`; + response = await helper.performGETrequest(apiRoute); + + expect(response.status).toBe(200); + expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" })); + expect(response.body).toStrictEqual(expect.objectContaining({ message: "OK" })); + expect(typeof response.body.result.status).toStrictEqual("string"); }); }); });