Skip to content
This repository was archived by the owner on Aug 27, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions tests/EvmAcceptanceTests/test/OtterTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,22 @@ describe("Otterscan api tests", function () {
});
});

it("When TX succeeds, we can get 0x", async function () {
const METHOD = "ots_getTransactionError";

// Create a simple contract creation transaction that will succeed and so API request returns "Ox"
const Contract = await ethers.getContractFactory("SimpleContract");
const contract = await Contract.deploy();

await sendJsonRpcRequest(METHOD, 1, [contract.deployTransaction.hash], (result, status) => {
assert.equal(status, 200, "has status code");

let jsonObject = result.result;

assert.equal(jsonObject, "0x");
});
});

it("We can get the otter internal operations", async function () {
const METHOD = "ots_getInternalOperations";

Expand Down Expand Up @@ -72,6 +88,23 @@ describe("Otterscan api tests", function () {
});
});

it("When a contract has no internal operations, we get empty list", async function () {
const METHOD = "ots_getInternalOperations";

// Create a simple contract creation transaction which involves no internal operations
// so API call returns []
const Contract = await ethers.getContractFactory("SimpleContract");
const contract = await Contract.deploy();

await sendJsonRpcRequest(METHOD, 1, [contract.deployTransaction.hash], (result, status) => {
assert.equal(status, 200, "has status code");

let jsonObject = result.result;

assert(Array.isArray(jsonObject) && !jsonObject.length);
});
});

it("We can get the otter trace transaction", async function () {
const METHOD = "ots_traceTransaction";

Expand Down