diff --git a/app/App/Panel/Main/Account/Requests/TransactionRequest/TxApproval/approvals/TokenSpend/index.js b/app/App/Panel/Main/Account/Requests/TransactionRequest/TxApproval/approvals/TokenSpend/index.js
index a0e3e682a..8a6e1cfbb 100644
--- a/app/App/Panel/Main/Account/Requests/TransactionRequest/TxApproval/approvals/TokenSpend/index.js
+++ b/app/App/Panel/Main/Account/Requests/TransactionRequest/TxApproval/approvals/TokenSpend/index.js
@@ -5,7 +5,7 @@ import BigNumber from 'bignumber.js'
import svg from '../../../../../../../../../../resources/svg'
import link from '../../../../../../../../../../resources/link'
-import { ApprovalType } from '../../../../../../../../../../resources/constants'
+import { ADDRESS_DISPLAY_CHARS, ApprovalType } from '../../../../../../../../../../resources/constants'
const numberRegex = /\.0+$|(\.[0-9]*[1-9])0+$/
const MAX_HEX = '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'
@@ -64,7 +64,7 @@ class TokenSpend extends React.Component {
} else {
amount = '0x' + custom.integerValue().toString(16)
}
-
+
this.setState({ mode: 'custom', amount, customInput: value })
}
}
@@ -139,7 +139,7 @@ class TokenSpend extends React.Component {
} : {}}
onClick={() => {
this.props.onApprove(
- this.props.req,
+ this.props.req,
ApprovalType.TokenSpendApproval,
{ amount: this.state.amount }
)
@@ -174,7 +174,7 @@ class TokenSpend extends React.Component {
{symbol}
{this.state.mode === 'custom' ? (
-
) : (
-
{displayAmount.number}
-
{displayAmount.symbol}
+
{displayAmount.symbol}
)}
@@ -214,7 +214,7 @@ class TokenSpend extends React.Component {
>
Requested
- {
@@ -225,7 +225,7 @@ class TokenSpend extends React.Component {
{'Unlimited'}
{!inputLock ? (
- {
@@ -245,18 +245,21 @@ class TokenSpend extends React.Component {
{data.spender ? (
- {data.spender.substring(0, 6)}
+ {
+ // 0x prefix plus leading characters of address
+ data.spender.substring(0, 2 + ADDRESS_DISPLAY_CHARS)
+ }
{svg.octicon('kebab-horizontal', { height: 15 })}
- {data.spender.substr(data.contract.length - 4)}
+ {data.spender.substr(data.contract.length - ADDRESS_DISPLAY_CHARS)}
-
{
link.send('tray:clipboardData', data.spender)
this.setState({ copyTokenRequester: true })
setTimeout(() => {
this.setState({ copyTokenRequester: false })
- }, 1000)
+ }, 1000)
}}
>
{this.state.copyTokenRequester ? 'ADDRESS COPIED' : data.spender}
@@ -270,14 +273,14 @@ class TokenSpend extends React.Component {
{symbol}
-
{
link.send('tray:clipboardData', data.contract)
this.setState({ copyTokenContract: true })
setTimeout(() => {
this.setState({ copyTokenContract: false })
- }, 1000)
+ }, 1000)
}}
>
{this.state.copyTokenContract ? 'ADDRESS COPIED' : data.contract}
diff --git a/app/App/Panel/Main/Account/Requests/TransactionRequest/TxRecipient/index.js b/app/App/Panel/Main/Account/Requests/TransactionRequest/TxRecipient/index.js
index 2bec6071e..b3d65f763 100644
--- a/app/App/Panel/Main/Account/Requests/TransactionRequest/TxRecipient/index.js
+++ b/app/App/Panel/Main/Account/Requests/TransactionRequest/TxRecipient/index.js
@@ -1,5 +1,6 @@
import React from 'react'
import Restore from 'react-restore'
+import { ADDRESS_DISPLAY_CHARS } from '../../../../../../../../resources/constants'
import link from '../../../../../../../../resources/link'
import svg from '../../../../../../../../resources/svg'
@@ -38,9 +39,9 @@ class TxRecipient extends React.Component {
{ensName
? {ensName}
- : {address.substring(0, 6)}{svg.octicon('kebab-horizontal', { height: 15 })}{address.substring(address.length - 4)}
+ : {address.substring(0, 2 + ADDRESS_DISPLAY_CHARS)}{svg.octicon('kebab-horizontal', { height: 15 })}{address.substring(address.length - ADDRESS_DISPLAY_CHARS)}
}
- {req.decodedData && req.decodedData.contractName ? (
+ {req.decodedData && req.decodedData.contractName ? (
{(() => {
if (req.decodedData.contractName.length > 11) return `${req.decodedData.contractName.substr(0, 9)}..`
return req.decodedData.contractName
diff --git a/resources/constants/index.ts b/resources/constants/index.ts
index 1e5be7ac5..8510d38f8 100644
--- a/resources/constants/index.ts
+++ b/resources/constants/index.ts
@@ -3,3 +3,8 @@ export enum ApprovalType {
GasLimitApproval = 'approveGasLimit',
TokenSpendApproval = 'approveTokenSpend'
}
+
+const ADDRESS_DISPLAY_CHARS = 8
+export {
+ ADDRESS_DISPLAY_CHARS
+}