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).`)
openSuccessModal('Success','Transaction is confirmed.')
}catch(err){
}else{
openErrorModal('Error','Your transaction cannot be mined at the moment. Please, try again in a few blocks.')
openErrorModal('Error',errorMessage)
return
}
}
}
}
try{
if(!from){
awaitcall.send({
returncallbackFunc('Your MetaMask account is undefined. Please, contact support.')
from:account,
}elseif(!web3){
gas:Math.ceil(gas*1.2),
returncallbackFunc('Web3 is undefined. Please, contact support.')
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)
})
clearTimeout(timeout)
constgasPrice=web3.utils.toWei('1','gwei')
refreshPage(store)
if(!resultShown){
if(!gasLimit){
openSuccessModal('Success','Transaction is confirmed.')
try{
resultShown=true
gasLimit=awaitcall.estimateGas({from,gasPrice})
}
}catch(e){
}catch(err){
returncallbackFunc('Your transaction cannot be mined at the moment. Please, try again in a few blocks.')
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){
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>')
openWarningModal('Unauthorized','Please, connect to the xDai Chain.<br /><a href="https://xdaichain.com" target="_blank">Instructions</a>')