aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/helpers/conversions.util.js
diff options
context:
space:
mode:
authorAlexander Tseung <alextsg@users.noreply.github.com>2018-09-25 02:34:12 +0800
committerGitHub <noreply@github.com>2018-09-25 02:34:12 +0800
commit5d57c7c4fd17f1841e33d31e3b13dcc13aef5b3e (patch)
tree9d310e5a5689dfa27edb508197ef4811e2786f95 /ui/app/helpers/conversions.util.js
parent24d8d4ae0077a3adbcdd6c37e4ddc476228195a6 (diff)
parent431beb943675f2e9b7b5e5ce9c7f55d45f10905f (diff)
downloadtangerine-wallet-browser-5d57c7c4fd17f1841e33d31e3b13dcc13aef5b3e.tar.gz
tangerine-wallet-browser-5d57c7c4fd17f1841e33d31e3b13dcc13aef5b3e.tar.zst
tangerine-wallet-browser-5d57c7c4fd17f1841e33d31e3b13dcc13aef5b3e.zip
Merge pull request #5282 from MetaMask/tx-cancel-ui
Add Cancel Transaction feature. Refactor modals. Add Transaction Details modal.
Diffstat (limited to 'ui/app/helpers/conversions.util.js')
-rw-r--r--ui/app/helpers/conversions.util.js12
1 files changed, 12 insertions, 0 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]