aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/util.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/app/util.js')
-rw-r--r--ui/app/util.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/ui/app/util.js b/ui/app/util.js
index 82a5f9f29..800ccb218 100644
--- a/ui/app/util.js
+++ b/ui/app/util.js
@@ -56,6 +56,7 @@ module.exports = {
exportAsFile: exportAsFile,
isInvalidChecksumAddress,
allNull,
+ getTokenAddressFromTokenObject,
}
function valuesFor (obj) {
@@ -211,6 +212,9 @@ function normalizeEthStringToWei (str) {
while (decimal.length < 18) {
decimal += '0'
}
+ if (decimal.length > 18) {
+ decimal = decimal.slice(0, 18)
+ }
const decimalBN = new ethUtil.BN(decimal, 10)
eth = eth.add(decimalBN)
}
@@ -278,3 +282,7 @@ function exportAsFile (filename, data) {
function allNull (obj) {
return Object.entries(obj).every(([key, value]) => value === null)
}
+
+function getTokenAddressFromTokenObject (token) {
+ return Object.values(token)[0].address.toLowerCase()
+}