Skip to content

Commit

Permalink
Merge pull request #18 from Once-Upon/feature/undefined-var
Browse files Browse the repository at this point in the history
Fix undefined error
  • Loading branch information
pcowgill authored Feb 27, 2024
2 parents 87277f7 + d46bc9f commit 4deeb24
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/blocks/ethereum/18965012_decoded.json

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions src/transformers/_common/parties.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,10 @@ describe('transactionParties', () => {
'0x54b50187becd0bbcfd52ec5d538433dab044d2a8',
]);
}

const block2 = loadBlockFixture('ethereum', '18965012_decoded');
const result2 = transform(block2);

expect(result2).toBeDefined();
});
});
12 changes: 9 additions & 3 deletions src/transformers/_common/parties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ export function transform(block: RawBlock): RawBlock {
const inputAddresses: string[] = tx.decoded
? tx.decoded.decoded
.map((param) =>
param.type === 'address' ? param.decoded.toLowerCase() : '',
param.type === 'address' && param.decoded
? param.decoded.toLowerCase()
: '',
)
.filter((address) => address !== '')
: [];
Expand All @@ -42,7 +44,9 @@ export function transform(block: RawBlock): RawBlock {
// grab event inputs params from decoded trace
const partiesFromTrace = trace.decoded?.decoded
.map((param) =>
param.type === 'address' ? param.decoded.toLowerCase() : '',
param.type === 'address' && param.decoded
? param.decoded.toLowerCase()
: '',
)
.filter((address) => address !== '');

Expand All @@ -57,7 +61,9 @@ export function transform(block: RawBlock): RawBlock {
// grab event inputs params from decoded log
const partiesFromLog = log.decoded?.decoded
.map((param) =>
param.type === 'address' ? param.decoded.toLowerCase() : '',
param.type === 'address' && param.decoded
? param.decoded.toLowerCase()
: '',
)
.filter((address) => address !== '');

Expand Down

0 comments on commit 4deeb24

Please sign in to comment.