wait for sign before showing tx confirmation screen
This commit is contained in:
parent
96502db101
commit
c234a24ee2
|
@ -81,13 +81,13 @@ const InnerForm = ({
|
||||||
button={
|
button={
|
||||||
<Button
|
<Button
|
||||||
mode="strong"
|
mode="strong"
|
||||||
style={{marginTop: '5px'}}
|
style={{marginTop: '5px'}}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
UsernameRegistrar.methods.getPrice()
|
UsernameRegistrar.methods.getPrice()
|
||||||
.call()
|
.call()
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
setFieldValue('price', fromWei(res));
|
setFieldValue('price', fromWei(res));
|
||||||
});
|
});
|
||||||
}}>
|
}}>
|
||||||
Get Price
|
Get Price
|
||||||
</Button>
|
</Button>
|
||||||
|
@ -133,13 +133,13 @@ const InnerForm = ({
|
||||||
|
|
||||||
<div style={{ position: 'relative', left: 0, right: 0, bottom: 0, textAlign: 'center' }}>
|
<div style={{ position: 'relative', left: 0, right: 0, bottom: 0, textAlign: 'center' }}>
|
||||||
{!isSubmitting ?
|
{!isSubmitting ?
|
||||||
<Button onClick={() => {setStatus('terms')}} className={classNames(classes.button)}>
|
<Button onClick={() => {setStatus('terms')}} className={classNames(classes.button)}>
|
||||||
<div className={classNames(classes.buttonText)}>
|
<div className={classNames(classes.buttonText)}>
|
||||||
{`${editAccount ? 'Save' : 'Register'} with transaction`}
|
{`${editAccount ? 'Save' : 'Register'} with transaction`}
|
||||||
</div>
|
</div>
|
||||||
</Button>
|
</Button>
|
||||||
:
|
:
|
||||||
<CircularProgress />}
|
<CircularProgress />}
|
||||||
<Terms open={displayTerms(status)} onSubmit={() => { setStatus(null); formRef.current.dispatchEvent(new Event('submit')) }} form={formRef} />
|
<Terms open={displayTerms(status)} onSubmit={() => { setStatus(null); formRef.current.dispatchEvent(new Event('submit')) }} form={formRef} />
|
||||||
</div>
|
</div>
|
||||||
</Hidden>
|
</Hidden>
|
||||||
|
@ -193,24 +193,26 @@ const RegisterSubDomain = withFormik({
|
||||||
const gas = editAccount ? gasEstimated + 1000 : gasEstimated * 2;
|
const gas = editAccount ? gasEstimated + 1000 : gasEstimated * 2;
|
||||||
console.log("Register would work. :D Gas estimated: " + gasEstimated, { gas }, gasEstimated + 1000);
|
console.log("Register would work. :D Gas estimated: " + gasEstimated, { gas }, gasEstimated + 1000);
|
||||||
console.log("Trying: register(\"" + subdomainHash + "\",\"" + domainNameHash + "\",\"" + resolveToAddr + "\",\"" + zeroBytes32 + "\",\"" + zeroBytes32 + "\")");
|
console.log("Trying: register(\"" + subdomainHash + "\",\"" + domainNameHash + "\",\"" + resolveToAddr + "\",\"" + zeroBytes32 + "\",\"" + zeroBytes32 + "\")");
|
||||||
if (preRegisteredCallback) preRegisteredCallback();
|
toSend.send({ gas })
|
||||||
toSend.send({ gas }).then((txId) => {
|
.on('transactionHash', (txHash) => { if (preRegisteredCallback) preRegisteredCallback(txHash); })
|
||||||
if (txId.status == "0x1" || txId.status == "0x01"){
|
.then((txId) => {
|
||||||
console.log("Register send success. :)");
|
if (txId.status == "0x1" || txId.status == "0x01"){
|
||||||
} else {
|
console.log("Register send success. :)");
|
||||||
console.log("Register send errored. :( Out of gas? ");
|
} else {
|
||||||
}
|
console.log("Register send errored. :( Out of gas? ");
|
||||||
console.dir(txId)
|
}
|
||||||
}).catch(err => {
|
console.dir(txId)
|
||||||
console.log("Register send errored. :( Out of gas?");
|
}).catch(err => {
|
||||||
console.dir(err)
|
console.log("Register send errored. :( Out of gas?");
|
||||||
}).finally(() => {
|
console.dir(err)
|
||||||
// REQUIRED UNTIL THIS ISSUES IS RESOLVED: https://github.com/jaredpalmer/formik/issues/597
|
})
|
||||||
setTimeout(() => {
|
.on('confirmation', (confirmationNumber, receipt) => {
|
||||||
registeredCallbackFn(resolveToAddr, statusAddress || zeroBytes32);
|
// REQUIRED UNTIL THIS ISSUES IS RESOLVED: https://github.com/jaredpalmer/formik/issues/597
|
||||||
}, 200);
|
setTimeout(() => {
|
||||||
setSubmitting(false);
|
registeredCallbackFn(resolveToAddr, statusAddress || zeroBytes32);
|
||||||
});
|
}, 200);
|
||||||
|
setSubmitting(false);
|
||||||
|
})
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.log("Register would error. :/ Already Registered? Have Token Balance? Is Allowance set?")
|
console.log("Register would error. :/ Already Registered? Have Token Balance? Is Allowance set?")
|
||||||
console.dir(err)
|
console.dir(err)
|
||||||
|
|
Loading…
Reference in New Issue