diff options
author | Alexander Tseung <alextsg@users.noreply.github.com> | 2018-12-10 04:48:06 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-10 04:48:06 +0800 |
commit | d8ab9cc002c10757b7382a174dafff7a0247e307 (patch) | |
tree | d0a46ac3ca2334ddec2ee240214d67a8122e81b7 /ui/app/helpers | |
parent | 575fb607c3b8deea831aa28293303991b3f6be29 (diff) | |
download | tangerine-wallet-browser-d8ab9cc002c10757b7382a174dafff7a0247e307.tar tangerine-wallet-browser-d8ab9cc002c10757b7382a174dafff7a0247e307.tar.gz tangerine-wallet-browser-d8ab9cc002c10757b7382a174dafff7a0247e307.tar.bz2 tangerine-wallet-browser-d8ab9cc002c10757b7382a174dafff7a0247e307.tar.lz tangerine-wallet-browser-d8ab9cc002c10757b7382a174dafff7a0247e307.tar.xz tangerine-wallet-browser-d8ab9cc002c10757b7382a174dafff7a0247e307.tar.zst tangerine-wallet-browser-d8ab9cc002c10757b7382a174dafff7a0247e307.zip |
Group transactions by nonce (#5886)
Diffstat (limited to 'ui/app/helpers')
-rw-r--r-- | ui/app/helpers/transactions.util.js | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/ui/app/helpers/transactions.util.js b/ui/app/helpers/transactions.util.js index 2f4b1d095..0f1ed70a3 100644 --- a/ui/app/helpers/transactions.util.js +++ b/ui/app/helpers/transactions.util.js @@ -2,6 +2,10 @@ import ethUtil from 'ethereumjs-util' import MethodRegistry from 'eth-method-registry' import abi from 'human-standard-token-abi' import abiDecoder from 'abi-decoder' +import { + TRANSACTION_TYPE_CANCEL, + TRANSACTION_STATUS_CONFIRMED, +} from '../../../app/scripts/controllers/transactions/enums' import { TOKEN_METHOD_TRANSFER, @@ -13,7 +17,7 @@ import { SEND_TOKEN_ACTION_KEY, TRANSFER_FROM_ACTION_KEY, SIGNATURE_REQUEST_KEY, - UNKNOWN_FUNCTION_KEY, + CONTRACT_INTERACTION_KEY, CANCEL_ATTEMPT_ACTION_KEY, } from '../constants/transactions' @@ -87,7 +91,7 @@ export async function getTransactionActionKey (transaction, methodData) { const methodName = name && name.toLowerCase() if (!methodName) { - return UNKNOWN_FUNCTION_KEY + return CONTRACT_INTERACTION_KEY } switch (methodName) { @@ -148,12 +152,16 @@ export function sumHexes (...args) { * @returns {string} */ export function getStatusKey (transaction) { - const { txReceipt: { status } = {} } = transaction + const { txReceipt: { status: receiptStatus } = {}, type, status } = transaction // There was an on-chain failure - if (status === '0x0') { + if (receiptStatus === '0x0') { return 'failed' } + if (status === TRANSACTION_STATUS_CONFIRMED && type === TRANSACTION_TYPE_CANCEL) { + return 'cancelled' + } + return transaction.status } |