diff options
author | Dan Finlay <dan@danfinlay.com> | 2016-07-07 08:58:46 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2016-07-07 08:58:46 +0800 |
commit | 7058dc4ee3d00f4d4e407c656cf671b2d4fd62f2 (patch) | |
tree | 5364558379541311895ddd20c2675739541da5e4 /ui/app/util.js | |
parent | 2c89cd722ed66f9f8522913b1a5bbc55ce5a7ca6 (diff) | |
download | tangerine-wallet-browser-7058dc4ee3d00f4d4e407c656cf671b2d4fd62f2.tar tangerine-wallet-browser-7058dc4ee3d00f4d4e407c656cf671b2d4fd62f2.tar.gz tangerine-wallet-browser-7058dc4ee3d00f4d4e407c656cf671b2d4fd62f2.tar.bz2 tangerine-wallet-browser-7058dc4ee3d00f4d4e407c656cf671b2d4fd62f2.tar.lz tangerine-wallet-browser-7058dc4ee3d00f4d4e407c656cf671b2d4fd62f2.tar.xz tangerine-wallet-browser-7058dc4ee3d00f4d4e407c656cf671b2d4fd62f2.tar.zst tangerine-wallet-browser-7058dc4ee3d00f4d4e407c656cf671b2d4fd62f2.zip |
Began reworking tx conf view
Diffstat (limited to 'ui/app/util.js')
-rw-r--r-- | ui/app/util.js | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/ui/app/util.js b/ui/app/util.js index 4181b096f..d0ee57dee 100644 --- a/ui/app/util.js +++ b/ui/app/util.js @@ -21,6 +21,7 @@ for (var currency in valueTable) { module.exports = { valuesFor: valuesFor, addressSummary: addressSummary, + miniAddressSummary: miniAddressSummary, isAllOneCase: isAllOneCase, isValidAddress: isValidAddress, numericBalance: numericBalance, @@ -43,10 +44,19 @@ function valuesFor (obj) { .map(function (key) { return obj[key] }) } -function addressSummary (address) { +function addressSummary (address, firstSegLength = 10, lastSegLength = 4, includeHex = true) { + if (!address) return '' + let checked = ethUtil.toChecksumAddress(address) + if (!includeHex) { + checked = ethUtil.stripHexPrefix(checked) + } + return checked ? checked.slice(0, firstSegLength) + '...' + checked.slice(checked.length - lastSegLength) : '...' +} + +function miniAddressSummary (address) { if (!address) return '' var checked = ethUtil.toChecksumAddress(address) - return checked ? checked.slice(0, 2 + 8) + '...' + checked.slice(-4) : '...' + return checked ? checked.slice(0, 4) + '...' + checked.slice(-4) : '...' } function isValidAddress (address) { |