Skip to content

Commit

Permalink
fix: resolves #2810
Browse files Browse the repository at this point in the history
  • Loading branch information
jxom committed Oct 3, 2024
1 parent 034eeed commit 2bf96a2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/brown-lobsters-lick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"viem": patch
---

Accounted for undefined indexed arguments in `parseEventLogs`.
2 changes: 2 additions & 0 deletions src/utils/abi/parseEventLogs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,9 @@ describe('args: args', () => {
abi,
logs,
args: {
owner: null,
spender: '0x40aA958dd87FC8305b97f2BA922CDdCa374bcD7f',
value: undefined,
},
})
expect(parsedLogs).toMatchInlineSnapshot(`
Expand Down
4 changes: 2 additions & 2 deletions src/utils/abi/parseEventLogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ function includesArgs(parameters: {

if (Array.isArray(args) && Array.isArray(matchArgs)) {
return matchArgs.every((value, index) => {
if (value === null) return true
if (value === null || value === undefined) return true
const input = inputs[index]
if (!input) return false
const value_ = Array.isArray(value) ? value : [value]
Expand All @@ -208,7 +208,7 @@ function includesArgs(parameters: {
!Array.isArray(matchArgs)
)
return Object.entries(matchArgs).every(([key, value]) => {
if (value === null) return true
if (value === null || value === undefined) return true
const input = inputs.find((input) => input.name === key)
if (!input) return false
const value_ = Array.isArray(value) ? value : [value]
Expand Down

0 comments on commit 2bf96a2

Please sign in to comment.