From abd39ae5d3df7aba3606aedce00ddc62492ecf24 Mon Sep 17 00:00:00 2001 From: ponyjackal Date: Mon, 26 Feb 2024 10:25:50 -0800 Subject: [PATCH] feat: update parties --- src/transformers/_common/parties.spec.ts | 121 ++++++++--------------- src/transformers/_common/parties.ts | 5 +- 2 files changed, 46 insertions(+), 80 deletions(-) diff --git a/src/transformers/_common/parties.spec.ts b/src/transformers/_common/parties.spec.ts index 8834949..cd3b0ee 100644 --- a/src/transformers/_common/parties.spec.ts +++ b/src/transformers/_common/parties.spec.ts @@ -6,14 +6,14 @@ describe('transactionParties', () => { const block = loadBlockFixture('ethereum', '12679108_decoded'); const result = transform(block); - const txResult = result.transactions.find( + const txResult1 = result.transactions.find( (tx) => tx.hash === '0xf677a8d48d456fc124b3097ccb7e35171b5f8c048f4682ae1566da828bca4480', ); - expect(txResult).toBeDefined(); - if (txResult) { - expect(txResult.parties).toStrictEqual([ + expect(txResult1).toBeDefined(); + if (txResult1) { + expect(txResult1.parties).toStrictEqual([ '0xfbb1b73c4f0bda4f67dca266ce6ef42f520fbb98', '0xfc1e1fd1d25d915c7eae1ece7112eb141dca540d', '0xa3c1e324ca1ce40db73ed6026c4a177f099b5770', @@ -23,81 +23,44 @@ describe('transactionParties', () => { ]); } - // //The addresses sending/receiving in the assetTransfers should be in parties as well - // const block1 = loadBlockFixture('ethereum', '6088920_decode'); - // const result1 = transform(block1); - - // const txResult1 = result1.transactions.find( - // (tx) => - // tx.hash === - // '0x3ede752dffb235fe8e45e5c5c3cd2d025acd1a5255b3a8fd63ccf7ed7ed55115', - // ); - // expect(txResult1).toBeDefined(); - // if (txResult1) { - // expect(txResult1.parties.length).toBe(303); - // } - - // //NFT should be in parties - // const block2 = loadBlockFixture('ethereum', '18230275_decode'); - // const result2 = transform(block2); - - // const txResult2 = result2.transactions.find( - // (tx) => - // tx.hash === - // '0xece119678a421a7e4c4af38848ef84634028fce2b17720a565136f13e7881db6', - // ); - // expect(txResult2).toBeDefined(); - // if (txResult2) { - // expect(txResult2.parties).toStrictEqual([ - // '0xd7029bdea1c17493893aafe29aad69ef892b8ff2', - // '0xff9c1b15b16263c61d017ee9f65c50e4ae0113d7', - // '0x0000000000000000000000000000000000000000', - // '0x8fc5d6afe572fefc4ec153587b63ce543f6fa2ea', - // '0xff9c1b15b16263c61d017ee9f65c50e4ae0113d7-6605', - // ]); - // } - - // // Zora Sepolia - // const block3 = loadBlockFixture('zora_sepolia', '479884_decode'); - // const result3 = transform(block3); - // const txResult3 = result3.transactions.find( - // (tx) => - // tx.hash === - // '0xd9deb98a359b71243f74939985be840f54c658e23d4d81bc44003088ec28df29', - // ); - // expect(txResult3).toBeDefined(); - // if (txResult3) { - // expect(txResult3.parties).toStrictEqual([ - // '0xfe44ae787a632c45acea658492ddbebe39f002ac', - // '0xf21d42203af9af1c86e1e8ac501b41f5bc004a0a', - // '0xf0b44c112630b2423c03080740d1a612474fc12a', - // '0x9da2873b5ffe73d3ba353111920534f30076cbb4', - // '0x0000000000000000000000000000000000000001', - // '0x101707a0ba5f2eb87336994c2e8b9eb39b0cf20c', - // '0x6e07bbf7fba8e43988aec5f2df6c40d1afb4400e', - // ]); - // } - - // // Lyra Sepolia - // const block4 = loadBlockFixture('lyra_sepolia', '3967804_decode'); - // const result4 = transform(block4); + const txResult2 = result.transactions.find( + (tx) => + tx.hash === + '0x18bade9bee95a730a697569d366912bb3d5d6444f1504c109459f44d8a3514d2', + ); + expect(txResult2).toBeDefined(); + if (txResult2) { + expect(txResult2.parties).toStrictEqual([ + '0xfbb1b73c4f0bda4f67dca266ce6ef42f520fbb98', + '0x75ffc6a4d776024effbb5421a0abbb8fb2a6e5e7', + '0xa3c1e324ca1ce40db73ed6026c4a177f099b5770', + '0xb2233fcec42c588ee71a594d9a25aa695345426c', + '0xc0f874d652cd46ad233971fc61008309778730dd', + '0x0000000000000000000000000000000000000000', + ]); + } - // const txResult4 = result4.transactions.find( - // (tx) => - // tx.hash === - // '0xfa58c800fbdc2f34312a6bed8fc8e5052ce59f26a2258a0930529efbcda21ceb', - // ); - // expect(txResult4).toBeDefined(); - // if (txResult4) { - // expect(txResult4.parties).toStrictEqual([ - // '0xfe44ae787a632c45acea658492ddbebe39f002ac', - // '0xf21d42203af9af1c86e1e8ac501b41f5bc004a0a', - // '0xf0b44c112630b2423c03080740d1a612474fc12a', - // '0x9da2873b5ffe73d3ba353111920534f30076cbb4', - // '0x0000000000000000000000000000000000000001', - // '0x6bf249f802b9afc6d10af75eb45d4559858c81a1', - // '0x6e07bbf7fba8e43988aec5f2df6c40d1afb4400e', - // ]); - // } + const txResult3 = result.transactions.find( + (tx) => + tx.hash === + '0x4e4959da92eae0e03e835c5c71e77fe58e8d1e0f9795e309d661fcc65abdc021', + ); + expect(txResult3).toBeDefined(); + if (txResult3) { + expect(txResult3.parties).toStrictEqual([ + '0xa6ae57b1da8238cd149bc718c40578e4620b752c', + '0x00000000003b3cc22af3ae1eac0440bcee416b40', + '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', + '0xa9bd7eef0c7affbdbdae92105712e9ff8b06ed49', + '0x725c263e32c72ddc3a19bea12c5a0479a81ee688', + '0x3421b1fb3f9e1bb232386ae055fa788ee0e01463', + '0xb9f77c41becc96bfcf9dd75623a72dd92309e4a6', + '0x7a250d5630b4cf539739df2c5dacb4c659f2488d', + '0xc3d1eb891f24de439937c73748fc455588828489', + '0xc52b39ab373c6c5dceb9b87658808f956dfd25fd', + '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2-150000000000000000', + '0x725c263e32c72ddc3a19bea12c5a0479a81ee688-117616442243753714047423', + ]); + } }); }); diff --git a/src/transformers/_common/parties.ts b/src/transformers/_common/parties.ts index cd239d6..0b9dae9 100644 --- a/src/transformers/_common/parties.ts +++ b/src/transformers/_common/parties.ts @@ -75,7 +75,10 @@ export function transform(block: RawBlock): RawBlock { log.decoded?.name === 'Approval') && log.decoded?.decoded[2]?.type === 'uint256', ) - .map((log) => `${log.address.toLowerCase()}-${log.decoded?.decoded[2]}`); + .map( + (log) => + `${log.address.toLowerCase()}-${log.decoded?.decoded[2].decoded}`, + ); // contracts created const contractsCreated = tx.contracts?.map((contract) => contract.address); parties = [