From af7daf4a6960515273916740394b6f1118fd86f2 Mon Sep 17 00:00:00 2001 From: ponyjackal Date: Mon, 4 Mar 2024 08:23:06 -0800 Subject: [PATCH] feat: update netAssetTransfersOldNfts order --- src/transformer.spec.ts | 26 ++++++++++++++++++++++++++ src/transformers/index.ts | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/transformer.spec.ts b/src/transformer.spec.ts index 7df49e0..110ba7b 100644 --- a/src/transformer.spec.ts +++ b/src/transformer.spec.ts @@ -57,5 +57,31 @@ describe('transformations', () => { expect(tx.baseFeePerGas).toBe(49897163985); expect(tx.transactionFee).toBe('1103276192872335'); } + + const block1 = loadBlockFixture('ethereum', '19313444_decoded'); + const result1 = transformer.transform(block1); + const cryptoKittiesTx1 = result1.transactions.find( + (tx) => + tx.hash === + '0xf3a7cbc426ad7278fb1c2c52ec0c7c0f41eb91a314b8059cb8cbefe0128f2a2e', + ); + expect(cryptoKittiesTx1).toBeDefined(); + if (cryptoKittiesTx1) { + const ckTransfers = cryptoKittiesTx1.netAssetTransfers; + expect(Object.keys(ckTransfers).length).toBe(2); + expect( + ckTransfers['0x74a61f3efe8d3194d96cc734b3b946933feb6a84'].sent.length, + ).toBe(0); + expect( + ckTransfers['0x74a61f3efe8d3194d96cc734b3b946933feb6a84'].received, + ).toStrictEqual([ + { + asset: '0x06012c8cf97bead5deae237070f9587f8e7a266d', + id: '0x06012c8cf97bead5deae237070f9587f8e7a266d-2023617', + tokenId: '2023617', + type: 'erc721', + }, + ]); + } }); }); diff --git a/src/transformers/index.ts b/src/transformers/index.ts index dea51e8..43e137b 100644 --- a/src/transformers/index.ts +++ b/src/transformers/index.ts @@ -14,6 +14,7 @@ import * as transactionForks from './ethereum/forks'; const children = { transactionAssetTransfers, + transactionAssetTransfersOldNFTs, transactionDelegateCalls, transactionDerivativesNeighbors, transactionErrors, @@ -21,7 +22,6 @@ const children = { transactionParties, transactionSigHash, transactionTimestamp, - transactionAssetTransfersOldNFTs, transactionFees, transactionForks, };