fix: handleRpcError with web3 provider
This commit is contained in:
parent
2c17b8c3a4
commit
7c7446d46b
|
@ -11,12 +11,11 @@ const nonceErrors = [
|
|||
/OldNonce/,
|
||||
'invalid transaction nonce',
|
||||
]
|
||||
const nonceErrorCodes = ['SERVER_ERROR', 'NONCE_EXPIRED']
|
||||
|
||||
const gasPriceErrors = [
|
||||
'Transaction gas price supplied is too low. There is another transaction with same nonce in the queue. Try increasing the gas price or incrementing the nonce.',
|
||||
/replacement transaction underpriced/i,
|
||||
/transaction underpriced/,
|
||||
/fee too low/i,
|
||||
/Transaction gas price \d+wei is too low. There is another transaction with same nonce in the queue with gas price: \d+wei. Try increasing the gas price or incrementing the nonce./,
|
||||
/FeeTooLow/,
|
||||
/max fee per gas less than block base fee/,
|
||||
|
@ -323,8 +322,8 @@ class Transaction {
|
|||
e = e.error
|
||||
}
|
||||
|
||||
if (e.error && nonceErrorCodes.includes(e.code)) {
|
||||
const message = e.error.message
|
||||
// web3 provider not wrapping message
|
||||
const message = e.error?.message || e.message
|
||||
|
||||
// nonce is too low, trying to increase and resubmit
|
||||
if (this._hasError(message, nonceErrors)) {
|
||||
|
@ -359,7 +358,6 @@ class Transaction {
|
|||
console.log('Same transaction is already in mempool, skipping submit')
|
||||
return // do nothing
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error(`Send error: ${e}`)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue