diff options
author | Alexander Tseung <alextsg@gmail.com> | 2018-09-18 01:34:29 +0800 |
---|---|---|
committer | Alexander Tseung <alextsg@gmail.com> | 2018-09-20 05:31:10 +0800 |
commit | 5a6c333506e4000602c1a1106cee6d06fe83afa8 (patch) | |
tree | 2aed850f17114372eaca16ed7e77f42f87907713 /ui/app/helpers | |
parent | 3e470fee8a5560b605f7ad1060fb1eebafefd21e (diff) | |
download | tangerine-wallet-browser-5a6c333506e4000602c1a1106cee6d06fe83afa8.tar tangerine-wallet-browser-5a6c333506e4000602c1a1106cee6d06fe83afa8.tar.gz tangerine-wallet-browser-5a6c333506e4000602c1a1106cee6d06fe83afa8.tar.bz2 tangerine-wallet-browser-5a6c333506e4000602c1a1106cee6d06fe83afa8.tar.lz tangerine-wallet-browser-5a6c333506e4000602c1a1106cee6d06fe83afa8.tar.xz tangerine-wallet-browser-5a6c333506e4000602c1a1106cee6d06fe83afa8.tar.zst tangerine-wallet-browser-5a6c333506e4000602c1a1106cee6d06fe83afa8.zip |
Switch existing modals from using Notification to Modal. Remove Notification component. Add CancelTransaction modal
Diffstat (limited to 'ui/app/helpers')
-rw-r--r-- | ui/app/helpers/conversions.util.js | 12 | ||||
-rw-r--r-- | ui/app/helpers/transactions.util.js | 7 |
2 files changed, 18 insertions, 1 deletions
diff --git a/ui/app/helpers/conversions.util.js b/ui/app/helpers/conversions.util.js index 5204faa1f..20ef9e35b 100644 --- a/ui/app/helpers/conversions.util.js +++ b/ui/app/helpers/conversions.util.js @@ -1,6 +1,11 @@ +import ethUtil from 'ethereumjs-util' import { conversionUtil } from '../conversion-util' import { ETH, GWEI, WEI } from '../constants/common' +export function bnToHex (inputBn) { + return ethUtil.addHexPrefix(inputBn.toString(16)) +} + export function hexToDecimal (hexValue) { return conversionUtil(hexValue, { fromNumericBase: 'hex', @@ -8,6 +13,13 @@ export function hexToDecimal (hexValue) { }) } +export function decimalToHex (decimal) { + return conversionUtil(decimal, { + fromNumericBase: 'dec', + toNumericBase: 'hex', + }) +} + export function getEthConversionFromWeiHex ({ value, conversionRate, numberOfDecimals = 6 }) { const denominations = [ETH, GWEI, WEI] diff --git a/ui/app/helpers/transactions.util.js b/ui/app/helpers/transactions.util.js index 54bb3bcb9..8b87bb538 100644 --- a/ui/app/helpers/transactions.util.js +++ b/ui/app/helpers/transactions.util.js @@ -14,6 +14,7 @@ import { TRANSFER_FROM_ACTION_KEY, SIGNATURE_REQUEST_KEY, UNKNOWN_FUNCTION_KEY, + CANCEL_ATTEMPT_ACTION_KEY, } from '../constants/transactions' import { addCurrencies } from '../conversion-util' @@ -44,7 +45,11 @@ export function isConfirmDeployContract (txData = {}) { } export async function getTransactionActionKey (transaction, methodData) { - const { txParams: { data, to } = {}, msgParams } = transaction + const { txParams: { data, to } = {}, msgParams, type } = transaction + + if (type === 'cancel') { + return CANCEL_ATTEMPT_ACTION_KEY + } if (msgParams) { return SIGNATURE_REQUEST_KEY |