claimFinished(`Your transaction was not mined in ${maxWaitBlocks} blocks. Please, try again with the increased gas price or fixed nonce (use Reset Account feature of MetaMask).`)
openErrorModal('Error','Your transaction cannot be mined at the moment. Please, try again in a few blocks.')
return
if(!callbackFunc){
callbackFunc=function(errorMessage){
if(!errorMessage){
state.refreshPageFunc(store)
openSuccessModal('Success','Transaction is confirmed.')
}else{
openErrorModal('Error',errorMessage)
}
}
}
try{
awaitcall.send({
from:account,
gas:Math.ceil(gas*1.2),
gasPrice:1000000000
}).once('transactionHash',(hash)=>{
timeout=setTimeout(()=>{
if(!resultShown){
openErrorModal('Error','Your transaction cannot be mined at the moment. Please, try again with the increased gas price or fixed nonce (use Reset Account feature of MetaMask).')
resultShown=true
}
},30000)
})
if(!from){
returncallbackFunc('Your MetaMask account is undefined. Please, contact support.')
}elseif(!web3){
returncallbackFunc('Web3 is undefined. Please, contact support.')
}
clearTimeout(timeout)
refreshPage(store)
constgasPrice=web3.utils.toWei('1','gwei')
if(!resultShown){
openSuccessModal('Success','Transaction is confirmed.')
resultShown=true
if(!gasLimit){
try{
gasLimit=awaitcall.estimateGas({from,gasPrice})
}catch(e){
returncallbackFunc('Your transaction cannot be mined at the moment. Please, try again in a few blocks.')
}
}
}catch(err){
clearTimeout(timeout)
leterrorMessage='Your MetaMask transaction was not processed, please try again in a few minutes.'
callbackFunc(`Your transaction wasn't processed in ${maxWaitBlocks} blocks. Please, try again with the increased gas price or fixed nonce (use Reset Account feature of MetaMask).`)
}
}catch(e){
callbackFunc(e.message)
}
}
})
}
exportfunctionsetupChart($canvas,self,total){
@ -107,3 +131,7 @@ export function isSupportedNetwork (store) {
openWarningModal('Unauthorized','Please, connect to the xDai Chain.<br /><a href="https://xdaichain.com" target="_blank">Instructions</a>')