Last active
October 15, 2018 17:28
-
-
Save ylv-io/00aabc7f42f2fe04f22ca76be3428cb9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| try { | |
| const account = getAccount(); | |
| const hash = await yourContractInstance.yourMethod.sendTransaction(arg1, arg2, { | |
| from: account, | |
| // if payable, specify value | |
| // value: web3js.toWei(value, 'ether') | |
| }); | |
| // update progress UI | |
| setSubmitting(false); | |
| // reset transaction related form, if any | |
| resetForm(); | |
| } | |
| catch(e) | |
| { | |
| // if user cancel transaction at Metamask UI we'll get error and handle it here | |
| console.log(e); | |
| // update progress UI anyway | |
| setSubmitting(false); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment