aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/modals/customize-gas/customize-gas.util.js
diff options
context:
space:
mode:
authorAlexander Tseung <alextsg@users.noreply.github.com>2018-07-12 09:31:50 +0800
committerGitHub <noreply@github.com>2018-07-12 09:31:50 +0800
commit0d4dbbec2abfa8c8015063d6e4a5ff0d34abe7b9 (patch)
tree10251992448d308123c16a6a01e02d7b422ddad2 /ui/app/components/modals/customize-gas/customize-gas.util.js
parent4521de19e641e4cda27b906c47b46929ddb831ec (diff)
parent67017711df521e4d9f92cfc756b5468f7704a79c (diff)
downloadtangerine-wallet-browser-0d4dbbec2abfa8c8015063d6e4a5ff0d34abe7b9.tar.gz
tangerine-wallet-browser-0d4dbbec2abfa8c8015063d6e4a5ff0d34abe7b9.tar.zst
tangerine-wallet-browser-0d4dbbec2abfa8c8015063d6e4a5ff0d34abe7b9.zip
Merge pull request #4691 from MetaMask/i4404-confirm-refactor
Refactor and redesign confirm transaction views
Diffstat (limited to 'ui/app/components/modals/customize-gas/customize-gas.util.js')
-rw-r--r--ui/app/components/modals/customize-gas/customize-gas.util.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/ui/app/components/modals/customize-gas/customize-gas.util.js b/ui/app/components/modals/customize-gas/customize-gas.util.js
new file mode 100644
index 000000000..6ba4a7705
--- /dev/null
+++ b/ui/app/components/modals/customize-gas/customize-gas.util.js
@@ -0,0 +1,34 @@
+import ethUtil from 'ethereumjs-util'
+import { conversionUtil } from '../../../conversion-util'
+
+export function getDecimalGasLimit (hexGasLimit) {
+ return conversionUtil(hexGasLimit, {
+ fromNumericBase: 'hex',
+ toNumericBase: 'dec',
+ })
+}
+
+export function getDecimalGasPrice (hexGasPrice) {
+ return conversionUtil(hexGasPrice, {
+ fromNumericBase: 'hex',
+ toNumericBase: 'dec',
+ fromDenomination: 'WEI',
+ toDenomination: 'GWEI',
+ })
+}
+
+export function getPrefixedHexGasLimit (gasLimit) {
+ return ethUtil.addHexPrefix(conversionUtil(gasLimit, {
+ fromNumericBase: 'dec',
+ toNumericBase: 'hex',
+ }))
+}
+
+export function getPrefixedHexGasPrice (gasPrice) {
+ return ethUtil.addHexPrefix(conversionUtil(gasPrice, {
+ fromNumericBase: 'dec',
+ toNumericBase: 'hex',
+ fromDenomination: 'GWEI',
+ toDenomination: 'WEI',
+ }))
+}