-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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!: remove offset from decodeLog
and decodeFunctionResult
methods
#2308
Changes from 4 commits
99aa766
e5ccfa4
dbe1564
c71bd01
46cc00b
a6f1494
7799643
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -766,4 +766,42 @@ describe('Abi interface', () => { | |
); | ||
}); | ||
}); | ||
|
||
describe('decodeLog', () => { | ||
it('should return decoded log by id', () => { | ||
const data = exhaustiveExamplesInterface.decodeLog('0x01000000000000000000000000000020', '0'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Also, passing in |
||
expect(data).toEqual({ | ||
a: true, | ||
b: 32, | ||
nedsalk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}); | ||
}); | ||
|
||
it('should throw an error when log does not exist', () => { | ||
expect(() => | ||
exhaustiveExamplesInterface.decodeLog('0x01000000000000000000000000000020', '1') | ||
).toThrowError(`Log type with logId '1' doesn't exist in the ABI.`); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should use the |
||
}); | ||
}); | ||
|
||
describe('decodeFunctionResult', () => { | ||
it('should return decoded function result', () => { | ||
const data = exhaustiveExamplesInterface.decodeFunctionResult( | ||
'struct_simple', | ||
'0x01000000000000000000000000000020' | ||
); | ||
expect(data).toEqual({ | ||
a: true, | ||
b: 32, | ||
}); | ||
}); | ||
|
||
it('should throw an error when function does not exist', () => { | ||
expect(() => { | ||
exhaustiveExamplesInterface.decodeFunctionResult( | ||
'doesnt_exist', | ||
'0x01000000000000000000000000000020' | ||
); | ||
}).toThrowError(/^Function doesnt_exist not found\.$/); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should use the |
||
}); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fn
is undefined here