@ -9,7 +9,6 @@ import { ethers } from 'ethers'
import NonceTracker from 'nonce-tracker'
import NonceTracker from 'nonce-tracker'
import log from 'loglevel'
import log from 'loglevel'
import BigNumber from 'bignumber.js'
import BigNumber from 'bignumber.js'
import { cloneDeep } from 'lodash'
import {
import {
TOKEN _METHOD _APPROVE ,
TOKEN _METHOD _APPROVE ,
TOKEN _METHOD _TRANSFER ,
TOKEN _METHOD _TRANSFER ,
@ -558,9 +557,9 @@ export default class TransactionController extends EventEmitter {
async confirmTransaction ( txId , txReceipt ) {
async confirmTransaction ( txId , txReceipt ) {
// get the txReceipt before marking the transaction confirmed
// get the txReceipt before marking the transaction confirmed
// to ensure the receipt is gotten before the ui revives the tx
// to ensure the receipt is gotten before the ui revives the tx
const ini tialT xMeta = this . txStateManager . getTx ( txId )
const txMeta = this . txStateManager . getTx ( txId )
if ( ! ini tialT xMeta) {
if ( ! txMeta ) {
return
return
}
}
@ -571,20 +570,24 @@ export default class TransactionController extends EventEmitter {
? txReceipt . gasUsed
? txReceipt . gasUsed
: txReceipt . gasUsed . toString ( 16 )
: txReceipt . gasUsed . toString ( 16 )
ini tialT xMeta. txReceipt = {
txMeta . txReceipt = {
... txReceipt ,
... txReceipt ,
gasUsed ,
gasUsed ,
}
}
this . txStateManager . setTxStatusConfirmed ( txId )
this . txStateManager . setTxStatusConfirmed ( txId )
this . _markNonceDuplicatesDropped ( txId )
this . _markNonceDuplicatesDropped ( txId )
this . txStateManager . updateTx ( ini tialT xMeta, 'transactions#confirmTransaction - add txReceipt' )
this . txStateManager . updateTx ( txMeta , 'transactions#confirmTransaction - add txReceipt' )
if ( initialTxMeta . transactionCategory === SWAP ) {
if ( txMeta . transactionCategory === SWAP ) {
const txMeta = cloneDeep ( initialTxMeta )
const postTxBalance = await this . query . getBalance ( txMeta . txParams . from )
const postTxBalance = await this . query . getBalance ( txMeta . txParams . from )
txMeta . postTxBalance = postTxBalance . toString ( 16 )
const latestTxMeta = this . txStateManager . getTx ( txId )
this . _trackSwapsMetrics ( txMeta )
latestTxMeta . postTxBalance = postTxBalance . toString ( 16 )
this . txStateManager . updateTx ( latestTxMeta , 'transactions#confirmTransaction - add postTxBalance' )
this . _trackSwapsMetrics ( latestTxMeta )
}
}
} catch ( err ) {
} catch ( err ) {