diff --git a/packages/integration-tests/src/config.ts b/packages/integration-tests/src/config.ts index fd139570c2..381b7c3314 100644 --- a/packages/integration-tests/src/config.ts +++ b/packages/integration-tests/src/config.ts @@ -17,4 +17,5 @@ export const localConfig = { export const environment = { blockExplorerAPI: "http://localhost:3020", + blockExplorerSepoliaAPI: "https://block-explorer-api.sepolia.zksync.dev", }; diff --git a/packages/integration-tests/src/entities.ts b/packages/integration-tests/src/entities.ts index 5c1879e5b1..952d90b841 100644 --- a/packages/integration-tests/src/entities.ts +++ b/packages/integration-tests/src/entities.ts @@ -1,5 +1,6 @@ export enum Buffer { greeterL2 = "./buffer/greeterL2.txt", + greeterL2VerifiedSepolia = "./buffer/sepoliaGreeterVerified.txt", executeGreeterTx = "./buffer/executeGreeterTx.txt", NFTtoL1 = "./buffer/NFTtoL1.txt", NFTtoL2 = "./buffer/NFTtoL2.txt", diff --git a/packages/integration-tests/src/helper.ts b/packages/integration-tests/src/helper.ts index 71dc978a5a..c7df6c0011 100644 --- a/packages/integration-tests/src/helper.ts +++ b/packages/integration-tests/src/helper.ts @@ -61,8 +61,12 @@ export class Helper { return new Promise((resolve) => setTimeout(resolve, ms)); } - async performGETrequest(apiRoute: string) { - return request(environment.blockExplorerAPI).get(apiRoute); + async performGETrequest(apiRoute: string, network = "local") { + if (network === `local`) { + return request(environment.blockExplorerAPI).get(apiRoute); + } else if (network === `sepolia`) { + return request(environment.blockExplorerSepoliaAPI).get(apiRoute); + } } /** diff --git a/packages/integration-tests/tests/api/contracts.test.ts b/packages/integration-tests/tests/api/contracts.test.ts index dbff398343..61966c6202 100644 --- a/packages/integration-tests/tests/api/contracts.test.ts +++ b/packages/integration-tests/tests/api/contracts.test.ts @@ -20,6 +20,62 @@ describe("API module: Contract", () => { beforeAll(async () => { await playbook.deployViaPaymaster(); await playbook.deployMultiCallContracts(); + await playbook.deployGreeterToL2(); + }); + + //id1851 + it("Verify /api?module=contract&action=checkverifystatus response", async () => { + await helper.retryTestAction(async () => { + apiRoute = `/api?module=contract&action=checkverifystatus&guid=3177`; + response = await helper.performGETrequest(apiRoute, "sepolia"); + console.log(response.body); + + expect(response.status).toBe(200); + expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" })); + expect(response.body).toStrictEqual(expect.objectContaining({ message: "OK" })); + expect(response.body).toStrictEqual(expect.objectContaining({ result: "Pass - Verified" })); + }); + }); + + //id1695 + it("Verify /api?module=contract&action=getabi response", async () => { + await helper.retryTestAction(async () => { + const greeterContract = await helper.getStringFromFile(bufferFile + Buffer.greeterL2VerifiedSepolia); + apiRoute = `/api?module=contract&action=getabi&address=${greeterContract}`; + response = await helper.performGETrequest(apiRoute, "sepolia"); + + 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).toStrictEqual("string"); + }); + }); + + //id1802 + it("Verify /api?module=contract&action=getsourcecode response", async () => { + await helper.retryTestAction(async () => { + const greeterContract = await helper.getStringFromFile(bufferFile + Buffer.greeterL2VerifiedSepolia); + apiRoute = `/api?module=contract&action=getsourcecode&address=${greeterContract}`; + response = await helper.performGETrequest(apiRoute, "sepolia"); + + 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[0].ABI).toStrictEqual("string"); + expect(typeof response.body.result[0].SourceCode).toStrictEqual("string"); + expect(typeof response.body.result[0].ConstructorArguments).toStrictEqual("string"); + expect(typeof response.body.result[0].ContractName).toStrictEqual("string"); + expect(typeof response.body.result[0].EVMVersion).toStrictEqual("string"); + expect(typeof response.body.result[0].OptimizationUsed).toStrictEqual("string"); + expect(typeof response.body.result[0].Library).toStrictEqual("string"); + expect(typeof response.body.result[0].LicenseType).toStrictEqual("string"); + expect(typeof response.body.result[0].CompilerVersion).toStrictEqual("string"); + expect(typeof response.body.result[0].Runs).toStrictEqual("string"); + expect(typeof response.body.result[0].SwarmSource).toStrictEqual("string"); + expect(typeof response.body.result[0].Proxy).toStrictEqual("string"); + expect(typeof response.body.result[0].Implementation).toStrictEqual("string"); + expect(typeof response.body.result[0].ZkCompilerVersion).toStrictEqual("string"); + }); }); //@id1696 diff --git a/packages/integration-tests/tests/api/tokens.test.ts b/packages/integration-tests/tests/api/tokens.test.ts index b708f03f21..415d82a1e4 100644 --- a/packages/integration-tests/tests/api/tokens.test.ts +++ b/packages/integration-tests/tests/api/tokens.test.ts @@ -113,6 +113,26 @@ describe("Tokens", () => { }); }); + //id1907 + it("Verify /api?module=token&action=tokeninfo response", async () => { + await helper.retryTestAction(async () => { + apiRoute = `/api?module=token&action=tokeninfo&contractaddress=${Token.ETHER_ERC20_Address}`; + 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[0].contractAddress).toStrictEqual("string"); + expect(typeof response.body.result[0].tokenName).toStrictEqual("string"); + expect(typeof response.body.result[0].symbol).toStrictEqual("string"); + expect(typeof response.body.result[0].tokenDecimal).toStrictEqual("string"); + expect(typeof response.body.result[0].tokenPriceUSD).toStrictEqual("string"); + expect(typeof response.body.result[0].liquidity).toStrictEqual("string"); + expect(typeof response.body.result[0].l1Address).toStrictEqual("string"); + expect(typeof response.body.result[0].iconURL).toStrictEqual("string"); + }); + }); + //id1803 it("Verify the response via /tokens/{address}/transfers", async () => { await helper.retryTestAction(async () => {