-
Notifications
You must be signed in to change notification settings - Fork 16
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
Get final converted amount via abi interface #38
Conversation
lib/web3-contracts.js
Outdated
try { | ||
const transactionReceipt = await ethersProvider.getTransactionReceipt( | ||
hash | ||
) | ||
|
||
return transactionReceipt | ||
transactionReceipt.logs.forEach(log => { | ||
const parsedLog = abiInterface.parseLog(log) |
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.
Just wanted to make sure:
- What happens if that specific log can't be parsed? Is an error thrown or is
parsedLog
just null? - Here, since we control the previous transaction, we can just assume that the first log is going to be the
Transfer
event (I believe it is, anyway—there should only be two logs in these claim transactions).
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.
To answer the first question I look into Ethers code and the library return null
if the log can't be parsed: https://github.com/ethers-io/ethers.js/blob/master/utils/interface.js#L388
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.
Cool—can we double check what happens with the v5 ABI encoder?
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.
Thanks for looking @0xGabi , I'll log the encoder as an item to check.
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.
Some small comments, but LGTM!
Also asked @0xGabi to take a quick look, since he's had the most experience with ethers.Interface
:).
62bb274
to
a4780c4
Compare
Address #37 (comment)