You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
858 B
35 lines
858 B
6 years ago
|
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',
|
||
|
}))
|
||
|
}
|