Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
414fb28a5e | ||
|
|
780df01b43 | ||
|
|
c5e4d76dc5 |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "tx-manager",
|
||||
"version": "0.2.6",
|
||||
"version": "0.2.9",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -4,21 +4,23 @@ const BigNumber = ethers.BigNumber
|
||||
const PromiEvent = require('web3-core-promievent')
|
||||
const { sleep, min, max } = require('./utils')
|
||||
|
||||
// prettier-ignore
|
||||
const nonceErrors = [
|
||||
'Transaction nonce is too low. Try incrementing the nonce.',
|
||||
'nonce too low'
|
||||
'nonce too low',
|
||||
'nonce has already been used',
|
||||
]
|
||||
|
||||
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',
|
||||
'transaction underpriced',
|
||||
/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./,
|
||||
]
|
||||
|
||||
// prettier-ignore
|
||||
const sameTxErrors = [
|
||||
'Transaction with the same hash was already imported.',
|
||||
'already known',
|
||||
]
|
||||
|
||||
class Transaction {
|
||||
@@ -268,11 +270,13 @@ class Transaction {
|
||||
}
|
||||
|
||||
_handleSendError(e) {
|
||||
console.log('Got error', e)
|
||||
if (e.error.error) {
|
||||
// Sometimes ethers wraps known errors, unwrap it in this case
|
||||
e = e.error
|
||||
}
|
||||
|
||||
if (e.code === 'SERVER_ERROR' && e.error) {
|
||||
if (e.error && e.code === 'SERVER_ERROR') {
|
||||
const message = e.error.message
|
||||
console.log('Error', e.error.code, e.error.message)
|
||||
|
||||
// nonce is too low, trying to increase and resubmit
|
||||
if (this._hasError(message, nonceErrors)) {
|
||||
|
||||
Reference in New Issue
Block a user