-
Notifications
You must be signed in to change notification settings - Fork 5
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
Choose the higher gasLimit and gasPrice in the modal #72
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.
Perfect!! I will open an issue saying we need to decide if we need to notify the user
const gasLimitEstimate = wallet.smartWallet | ||
.estimateDirectExecute(tx.to || '0x', tx.data || '0x') | ||
.then((estimate: BigNumber) => { | ||
if (tx.gasLimit && estimate.toNumber() < tx.gasLimit) { |
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.
if (tx.gasLimit && estimate.toNumber() < tx.gasLimit) { | |
if (tx.gasLimit && estimate.lt(tx.gasLimit)) { |
?.getGasPrice() | ||
.then((gp: BigNumber) => gp.mul('101').div('100')) | ||
.then((estimate: BigNumber) => { | ||
if (tx.gasPrice && estimate.toNumber() < tx.gasPrice) { |
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.
if (tx.gasPrice && estimate.toNumber() < tx.gasPrice) { | |
if (tx.gasPrice && estimate.lt(tx.gasPrice)) { |
This PR does two things:
It accomplishes these things by a custom hook that handles all three promises and the state of the gas. This moves the logic outside of the component so it is easier to read and can be reused in the future if needed.
Tests were updated to fix all issues with
act/await/async/etc...