-
Notifications
You must be signed in to change notification settings - Fork 11
feature(component): Show account balance and feedback when wallet balance is too low to create transaction #95
Conversation
…nce and Network Selector
any expctation from this ? 😬 |
This is for issue #58 number 2. |
…dmin-website into feature/show-account-balance * 'fix/up-admin-page-ui' of https://github.com/OpenCerts/admin-website: Fixed changed of name from isValidHash to isValidCertificateHash Changed console.error to use logger error instead Disabled console logging in eslint Removed unused imports Fixed input and button tests Added tests for isValidCertificateHash function Used isEmpty from lodash and show message only when there is message Update logger.js Removed console.log Moved functions to class functions and cleanup code Fixed eslint alert for popup window Updated Store Deploy Block, Store Issue Block and Store Revoke Block to use new utility validation methods Removed unnecessary babel-eslint Removed pageLoaderBase Moved validators to utils.js and added validation to StoreIssue and StoreRevoke Cleanup Added store deploy validation Imported React in AdminContainer Added wallet address not found page # Conflicts: # src/components/AdminContainer.js
…nto feature/show-account-balance * 'master' of https://github.com/OpenCerts/admin-website: Changed error messages
…nto feature/show-account-balance * 'master' of https://github.com/OpenCerts/admin-website: Revert "Added redirect to home screen if no wallet provider selected" Added redirect to home screen if no wallet provider selected Fixed wallet message bug Added module testing and integration testing into travis # Conflicts: # pages/deploy.js # src/components/AdminContainer.js
src/sagas/admin.js
Outdated
) { | ||
toast.error("Transaction was rejected."); | ||
} | ||
} else { |
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.
Problem is this promise will always run resolve...
You can either:
- move the resolve into this else statement so that it's not executed AFTER reject (i dont likt this)
- swap the position of the if statement on top with the reject and
return reject(err)
instead so the rest of the code does not execute.
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.
Updated.
…nto feature/show-account-balance * 'master' of https://github.com/OpenCerts/admin-website: Removed unused favicon.ico Fixed not able to redeploy after rejecting a transaction Added favicon and changed page title Updates to !networkId Fixed linter issues Check if networkID null before running getNetworkId Removed unused network proptype Update network ID when in deploy page
src/sagas/admin.js
Outdated
@@ -53,17 +81,24 @@ function sendTxWrapper({ txObject, gasPrice, gasLimit, fromAddress }) { | |||
(err, res) => { | |||
// callback passed into eth.contract.send() to get the txhash | |||
if (err) { | |||
reject(err); | |||
if ( | |||
err.message === |
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.
Where does this message comes from ? It looks like a weak comparison (i.e may easily break)
Why not always displaying the toaster toast.error("Transaction was rejected.");
?
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.
err is returned message from Web3 and not all error messages are caused by rejected transactions. So it is necessary to only show the message when the transaction has actually been rejected.
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.
does this handle ledger as well ?
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.
as per @rjchow 💡
let's use a different check: err.message.includes('User denied transaction signature.')
Some sources
https://ethereum.stackexchange.com/questions/45836/elegant-way-to-map-web3-js-error-messages#comment54609_45848
https://github.com/blocknative/assist/blob/afbf565dda006158f6f1397d8ea645fa6d307eff/src/js/helpers/utilities.js#L134
What about ledger ?
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.
Updated and works for ledger too in latest commit.
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.
Please add a comment why we are doing this, it's not obvious at all =)
…in front end and directly using the values in redux to check
…ed unneeded messages
Shows notification when: