From 6224c8845d954272b7e2d0b671329a88dd947257 Mon Sep 17 00:00:00 2001 From: gurjotd23 Date: Thu, 22 Feb 2024 11:25:00 -0700 Subject: [PATCH] updated tests, all pass now --- .env.example | 2 -- .gitignore | 1 + .../protocols/uniswap-v2/uniswap-v2.decoders.ts | 17 +++++++++++++++++ .../protocols/uniswap-v2/uniswap-v2.test.ts | 10 +++++----- 4 files changed, 23 insertions(+), 7 deletions(-) delete mode 100644 .env.example diff --git a/.env.example b/.env.example deleted file mode 100644 index fdc35b7..0000000 --- a/.env.example +++ /dev/null @@ -1,2 +0,0 @@ -TEST_COVALENT_API_KEY -PORT = "8080" diff --git a/.gitignore b/.gitignore index 2928d3f..f4818e4 100644 --- a/.gitignore +++ b/.gitignore @@ -131,3 +131,4 @@ dist # Custom added decoders.dump +.env.example diff --git a/services/decoder/protocols/uniswap-v2/uniswap-v2.decoders.ts b/services/decoder/protocols/uniswap-v2/uniswap-v2.decoders.ts index df178dc..bbe6d23 100644 --- a/services/decoder/protocols/uniswap-v2/uniswap-v2.decoders.ts +++ b/services/decoder/protocols/uniswap-v2/uniswap-v2.decoders.ts @@ -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, @@ -491,6 +503,11 @@ GoldRushDecoder.on( value: data?.items?.[0]?.token_1?.contract_address || "", type: "address", }, + { + heading: "Pair Address", + value: decoded.pair, + type: "address", + }, ], }; } diff --git a/services/decoder/protocols/uniswap-v2/uniswap-v2.test.ts b/services/decoder/protocols/uniswap-v2/uniswap-v2.test.ts index d900d11..b636eaa 100644 --- a/services/decoder/protocols/uniswap-v2/uniswap-v2.test.ts +++ b/services/decoder/protocols/uniswap-v2/uniswap-v2.test.ts @@ -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", }); @@ -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", }); @@ -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); }); });