Skip to content

Commit

Permalink
feat: add deployed contract address in parties
Browse files Browse the repository at this point in the history
  • Loading branch information
ponyjackal committed Apr 29, 2024
1 parent 8288aee commit 57cd56d
Show file tree
Hide file tree
Showing 3 changed files with 1,887 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/transformers/_common/parties.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,21 @@ describe('transactionParties', () => {
const result2 = transform(block2);

expect(result2).toBeDefined();

const block3 = loadBlockFixture('base_sepolia', '9312985_decoded');
const result3 = transform(block3);

const txResult5 = result3.transactions.find(
(tx) =>
tx.hash ===
'0x4eac93e327071ba5313ef7c0d8f243ff0653d63ed3403954db41c2b14c2b50b3',
);
expect(txResult5).toBeDefined();
if (txResult5) {
expect(txResult5.parties).toStrictEqual([
'0x0e204e46a52f1c701e54efd525062a4da96f2b59',
'0xe4347cb90e809a9d8526458eaa6e4a1bfff4cc2f',
]);
}
});
});
3 changes: 3 additions & 0 deletions src/transformers/_common/parties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ export const transform: TxnTransformer = (_block, tx) => {
if (trace.action?.to) {
result = [...result, trace.action.to.toLowerCase()];
}
if (trace.result?.address) {
result = [...result, trace.result.address.toLowerCase()];
}
if (trace.type === 'suicide') {
result = [...result, trace.action.address.toLowerCase()];
if (trace.action.refundAddress) {
Expand Down
Loading

0 comments on commit 57cd56d

Please sign in to comment.