wait for sign before showing tx confirmation screen

This commit is contained in:
Barry Gitarts 2018-10-19 12:30:36 -04:00 committed by Barry G
parent 96502db101
commit c234a24ee2
1 changed files with 33 additions and 31 deletions

View File

@ -193,8 +193,9 @@ const RegisterSubDomain = withFormik({
const gas = editAccount ? gasEstimated + 1000 : gasEstimated * 2;
console.log("Register would work. :D Gas estimated: " + gasEstimated, { gas }, gasEstimated + 1000);
console.log("Trying: register(\"" + subdomainHash + "\",\"" + domainNameHash + "\",\"" + resolveToAddr + "\",\"" + zeroBytes32 + "\",\"" + zeroBytes32 + "\")");
if (preRegisteredCallback) preRegisteredCallback();
toSend.send({ gas }).then((txId) => {
toSend.send({ gas })
.on('transactionHash', (txHash) => { if (preRegisteredCallback) preRegisteredCallback(txHash); })
.then((txId) => {
if (txId.status == "0x1" || txId.status == "0x01"){
console.log("Register send success. :)");
} else {
@ -204,13 +205,14 @@ const RegisterSubDomain = withFormik({
}).catch(err => {
console.log("Register send errored. :( Out of gas?");
console.dir(err)
}).finally(() => {
})
.on('confirmation', (confirmationNumber, receipt) => {
// REQUIRED UNTIL THIS ISSUES IS RESOLVED: https://github.com/jaredpalmer/formik/issues/597
setTimeout(() => {
registeredCallbackFn(resolveToAddr, statusAddress || zeroBytes32);
}, 200);
setSubmitting(false);
});
})
}).catch(err => {
console.log("Register would error. :/ Already Registered? Have Token Balance? Is Allowance set?")
console.dir(err)