Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix undefined error #18

Merged
merged 1 commit into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading