tokens added from search should be visible only for the network where search was made

This commit is contained in:
Victor Baranov 2018-09-17 18:00:22 +03:00
parent c01e907677
commit d50d957fa3
3 changed files with 9 additions and 5 deletions

View File

@ -417,7 +417,7 @@ class AddTokenScreen extends Component {
return
}
const { setPendingTokens/* , history*/ } = this.props
const { setPendingTokens, network/* , history*/ } = this.props
const {
customAddress: address,
customSymbol: symbol,
@ -429,6 +429,7 @@ class AddTokenScreen extends Component {
address,
symbol,
decimals,
network: network,
}
setPendingTokens({ customToken, selectedTokens })

View File

@ -2296,9 +2296,12 @@ function updateNetworkEndpointType (networkEndpointType) {
}
function setPendingTokens (pendingTokens) {
const { customToken = {}, selectedTokens = {} } = pendingTokens
const { address, symbol, decimals } = customToken
const tokens = address && symbol && decimals
const { selectedTokens = {}, customToken = {} } = pendingTokens
const { address, symbol, decimals, network } = customToken
Object.keys(selectedTokens).forEach(address => {
selectedTokens[address].network = parseInt(network)
})
const tokens = address && symbol && decimals && network
? { ...selectedTokens, [address]: { ...customToken, isCustom: true } }
: selectedTokens

View File

@ -59,7 +59,7 @@ export default class ConfirmAddToken extends Component {
</div>
<div className="confirm-add-token__token-list">
{
Object.entries(pendingTokens)
pendingTokens && Object.entries(pendingTokens)
.map(([ address, token ]) => {
const { name, symbol } = token