Skip to content

Commit

Permalink
updated tests, all pass now
Browse files Browse the repository at this point in the history
  • Loading branch information
gurjotd23 committed Feb 22, 2024
1 parent cbdb51b commit 6224c88
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
2 changes: 0 additions & 2 deletions .env.example

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,4 @@ dist

# Custom added
decoders.dump
.env.example
17 changes: 17 additions & 0 deletions services/decoder/protocols/uniswap-v2/uniswap-v2.decoders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,18 @@ GoldRushDecoder.on(
logo: log_event.sender_logo_url as string,
name: log_event.sender_name as string,
},
details: [
{
heading: "Sender",
type: "address",
value: decoded.sender,
},
{
heading: "To",
type: "address",
value: decoded.to,
},
],
tokens: [
{
ticker_logo: inputToken?.logo_url ?? null,
Expand Down Expand Up @@ -491,6 +503,11 @@ GoldRushDecoder.on(
value: data?.items?.[0]?.token_1?.contract_address || "",
type: "address",
},
{
heading: "Pair Address",
value: decoded.pair,
type: "address",
},
],
};
}
Expand Down
10 changes: 5 additions & 5 deletions services/decoder/protocols/uniswap-v2/uniswap-v2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe("uniswap-v2", () => {
"x-covalent-api-key": process.env.TEST_COVALENT_API_KEY,
})
.send({
network: "eth-mainnet",
chain_name: "eth-mainnet",
tx_hash:
"0xf419cd1a89b928cb93f38237e9b1e6743218fbb87aaac678cb1f950951b7476e",
});
Expand All @@ -69,7 +69,7 @@ describe("uniswap-v2", () => {
"x-covalent-api-key": process.env.TEST_COVALENT_API_KEY,
})
.send({
network: "eth-mainnet",
chain_name: "eth-mainnet",
tx_hash:
"0xf419cd1a89b928cb93f38237e9b1e6743218fbb87aaac678cb1f950951b7476e",
});
Expand All @@ -88,15 +88,15 @@ describe("uniswap-v2", () => {
"x-covalent-api-key": process.env.TEST_COVALENT_API_KEY,
})
.send({
network: "eth-mainnet",
chain_name: "eth-mainnet",
tx_hash:
"0x9584cdf7d99a22e18843cf26c484018bfb11ab4ce4f2d898ec69075ed8e3c8dc",
});
const { events } = res.body as { events: EventType[] };
const event = events.find(({ name }) => name === "PairCreated");
const event = events.find(({ name }) => name === "Pair Created");
if (!event) {
throw Error("Event not found");
}
expect(event.tokens?.length).toEqual(2);
expect(event.details?.length).toEqual(9);
});
});

0 comments on commit 6224c88

Please sign in to comment.