diff --git a/packages/integration-tests/src/constants.ts b/packages/integration-tests/src/constants.ts index d2bc2dce6f..bbe04f5e68 100644 --- a/packages/integration-tests/src/constants.ts +++ b/packages/integration-tests/src/constants.ts @@ -13,6 +13,7 @@ export enum Buffer { paymasterTx = "paymasterTx.txt", addressMultiTransferETH = "multiTransferETH.txt", txMultiTransferETH = "txMultiTransferETH.txt", + txMultiTransferCall = "txMultiTransferCall.txt", txMultiTransferCustomTokenI = "txMultiTransferCustomTokenI.txt", txMultiTransferCustomTokenII = "txMultiTransferCustomTokenII.txt", addressMultiCallMiddle = "multiCallMiddle.txt", diff --git a/packages/integration-tests/src/playbook/deploy/use-multitransferETH.ts b/packages/integration-tests/src/playbook/deploy/use-multitransferETH.ts index 5447e7d380..596085f505 100644 --- a/packages/integration-tests/src/playbook/deploy/use-multitransferETH.ts +++ b/packages/integration-tests/src/playbook/deploy/use-multitransferETH.ts @@ -37,6 +37,7 @@ export default async function callMultiTransferETH(hre: HardhatRuntimeEnvironmen const ethTransfer = await makeTransfer(etherAddress, ethers.utils.parseEther("0.101")); const customToken1Transfer = await makeTransfer(customTokenI, ethers.utils.parseUnits("1", 18)); const customToken2Transfer = await makeTransfer(customTokenII, ethers.utils.parseUnits("1", 18)); + const multiTransferResult = await makeMultiTransfer(); async function makeTransfer(token: string, amount: ethers.BigNumber) { const transfer = await wallet.transfer({ @@ -47,22 +48,27 @@ export default async function callMultiTransferETH(hre: HardhatRuntimeEnvironmen }); // await commitment - const transferReceipt = await transfer.wait(1); + const transferReceipt = await transfer.waitFinalize(); console.log(`Tx transfer hash for ${token}: ${transferReceipt.transactionHash}`); return transferReceipt.transactionHash; } //call the deployed contract. - const transferFromContract = await attachedContract.multiTransfer( - [richWalletAddress, mainWalletAddress, secondaryWalletAddress], - [etherAddress, customTokenI, customTokenII], - [ethAmount, customTokenIAmount, customTokenIIAmount] - ); - if (transferFromContract) { - console.log(`Contract transfer to us!`); - } else { - console.error(`Contract said something unexpected: ${transferFromContract}`); + async function makeMultiTransfer() { + const transferFromContract = await attachedContract.multiTransfer( + [richWalletAddress, mainWalletAddress, secondaryWalletAddress], + [etherAddress, customTokenI, customTokenII], + [ethAmount, customTokenIAmount, customTokenIIAmount] + ); + if (transferFromContract) { + console.log(`Contract transfer to us!`); + const transferReceipt = await transferFromContract.waitFinalize(); + console.log(`Contract transfer transaction hash: ${transferReceipt.transactionHash}`); + return transferReceipt.transactionHash; + } else { + console.error(`Contract said something unexpected: ${transferFromContract}`); + } } // Show the contract balance @@ -90,6 +96,7 @@ export default async function callMultiTransferETH(hre: HardhatRuntimeEnvironmen )}" Custom token II` ); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.txMultiTransferCall, multiTransferResult); await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.txMultiTransferETH, ethTransfer); await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.txMultiTransferCustomTokenI, customToken1Transfer); await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.txMultiTransferCustomTokenII, customToken2Transfer); diff --git a/packages/integration-tests/tests/api/accounts.test.ts b/packages/integration-tests/tests/api/accounts.test.ts index 4ac7e0c211..880565547e 100644 --- a/packages/integration-tests/tests/api/accounts.test.ts +++ b/packages/integration-tests/tests/api/accounts.test.ts @@ -7,7 +7,7 @@ import { Helper } from "../../src/helper"; import { Playbook } from "../../src/playbook/playbook"; describe("API module: Account", () => { - jest.setTimeout(localConfig.standardTimeout); + jest.setTimeout(localConfig.extendedTimeout); const helper = new Helper(); let apiRoute: string; @@ -258,5 +258,37 @@ describe("API module: Account", () => { expect(typeof response.body.result[0].blockReward).toStrictEqual("string"); }); }); + + //id1854 + it("Verify /api?module=account&action=txlistinternal&txhash=", async () => { + await helper.runRetriableTestAction(async () => { + const blocks = await request(environment.blockExplorerAPI).get("/blocks"); + const blockNumber = blocks.body.items[0].number; + const txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txMultiTransferCall); + apiRoute = `/api?module=account&action=txlistinternal&page=1&offset=10&sort=desc&endblock=${blockNumber}&startblock=0&txhash=${txHash}`; + response = await helper.performBlockExplorerApiGetRequest(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[0]).toStrictEqual(expect.objectContaining({ hash: txHash })); + expect(response.body.result[0]).toStrictEqual(expect.objectContaining({ to: Wallets.richWalletAddress })); + expect(response.body.result[0]).toStrictEqual(expect.objectContaining({ type: "call" })); + expect(typeof response.body.result[0].blockNumber).toStrictEqual("string"); + expect(typeof response.body.result[0].timeStamp).toStrictEqual("string"); + expect(typeof response.body.result[0].from).toStrictEqual("string"); + expect(typeof response.body.result[0].value).toStrictEqual("string"); + expect(typeof response.body.result[0].gas).toStrictEqual("string"); + expect(typeof response.body.result[0].input).toStrictEqual("string"); + expect(typeof response.body.result[0].contractAddress).toBeTruthy(); + expect(typeof response.body.result[0].gasUsed).toStrictEqual("string"); + expect(typeof response.body.result[0].fee).toStrictEqual("string"); + expect(typeof response.body.result[0].l1BatchNumber).toStrictEqual("string"); + expect(typeof response.body.result[0].traceId).toBeTruthy(); + expect(typeof response.body.result[0].transactionType).toStrictEqual("string"); + expect(typeof response.body.result[0].isError).toStrictEqual("string"); + expect(typeof response.body.result[0].errCode).toStrictEqual("string"); + }); + }); }); });