1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-26 12:29:06 +01:00

fix token amount

This commit is contained in:
板橋 清信 2018-07-23 16:28:45 +09:00
parent 7cca146058
commit 79976b7026

View File

@ -1,5 +1,6 @@
const log = require('loglevel')
const util = require('./util')
const BigNumber = require('bignumber.js')
function tokenInfoGetter () {
const tokens = {}
@ -43,9 +44,7 @@ async function getSymbolAndDecimals (tokenAddress, existingTokens = []) {
function calcTokenAmount (value, decimals) {
const multiplier = Math.pow(10, Number(decimals || 0))
const amount = Number(value / multiplier)
return amount
return new BigNumber(value).div(multiplier).toString()
}