fix: throw error if transaction execution was failed
This commit is contained in:
parent
b940fad5e0
commit
6bb265d3b9
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "tx-manager",
|
||||
"version": "0.2.4",
|
||||
"version": "0.2.5",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
@ -175,6 +175,9 @@ class Transaction {
|
||||
this.currentTxHash = null
|
||||
continue
|
||||
}
|
||||
if (Number(receipt.status) === 0) {
|
||||
throw new Error('Transaction failed')
|
||||
}
|
||||
|
||||
const currentBlock = await this._provider.getBlockNumber()
|
||||
const confirmations = Math.max(0, currentBlock - receipt.blockNumber)
|
||||
@ -234,7 +237,10 @@ class Transaction {
|
||||
}
|
||||
}
|
||||
|
||||
console.log('Mined. Start waiting for confirmations...')
|
||||
if (Number(receipt.status) === 0) {
|
||||
throw new Error('Transaction failed')
|
||||
}
|
||||
|
||||
this._emitter.emit('mined', receipt)
|
||||
this.currentTxHash = receipt.transactionHash
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user