-
Notifications
You must be signed in to change notification settings - Fork 6
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
Convert values coming in from WalletConnect #70
Conversation
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.
LGTM!
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.
LGTM!
to: payload.to, | ||
from: payload.from, | ||
nonce: payload.nonce, | ||
data: payload.data || constants.HashZero, |
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.
We need 0x
here as no data. HashZero
produces 32 bytes
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.
I updated this to be 0x
but I also made the default for gasPrice and gasLimit undefined
. I think this adapter should not set them to zero in case it is reused in a different app. In #72, if the gasLimit/gasPrice are undefined, then it will use the estimates.
@@ -23,6 +23,8 @@ describe('Wallet Connect Adapter', () => { | |||
from, | |||
to, | |||
value: '0x3e8', | |||
gas: '25000', |
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.
Should we add two tests? One for the payload with values and another for the defaults that trigger estimations
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.
I added a new test and refactored the existing test to use spyon to get the parameters being sent to sendTransaction
.
- Spyon the sendTransaction method to get the parameters that are being sent to the provider - Change default values to undefined not zero.
Convert values coming from WalletConnect to integers which is what is expected. Also, delete thegas
property as this was also causing ethers to fail.This uses BigNumber'sfrom
method to handle the conversion to BigNumber then back to number. We could extract out thefrom
portion if it would make it faster.Update:
TransactionRequest
including renaminggas
togasLimit
.notes