From af65d78be9de7643e15b707914ae01f495333e82 Mon Sep 17 00:00:00 2001 From: poma Date: Wed, 17 Feb 2021 08:39:50 +0300 Subject: [PATCH 1/2] fix await --- src/Transaction.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Transaction.js b/src/Transaction.js index 3329c4f..5822108 100644 --- a/src/Transaction.js +++ b/src/Transaction.js @@ -100,7 +100,7 @@ class Transaction { try { await this._prepare() await this._send() - const receipt = this._waitForConfirmations() + const receipt = await this._waitForConfirmations() // we could have bumped nonce during execution, so get the latest one + 1 this.manager._nonce = this.tx.nonce + 1 return receipt From 8d4bab7fc2ef85d7c9604ab753e0a475495d107e Mon Sep 17 00:00:00 2001 From: poma Date: Wed, 17 Feb 2021 08:40:14 +0300 Subject: [PATCH 2/2] handle bump gas price error --- src/Transaction.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Transaction.js b/src/Transaction.js index 5822108..cf2f742 100644 --- a/src/Transaction.js +++ b/src/Transaction.js @@ -300,8 +300,11 @@ class Transaction { console.log( `Gas price ${formatUnits(this.tx.gasPrice, 'gwei')} gwei is too low, increasing and retrying`, ) - this._increaseGasPrice() - return this._send() + if (this._increaseGasPrice()) { + return this._send() + } else { + throw new Error('Already at max gas price, but still not enough to submit the transaction') + } } if (this._hasError(message, sameTxErrors)) {