WA-232 Only fetching balance of active tokens

This commit is contained in:
apanizo 2018-07-12 09:48:58 +02:00
parent a5b03007a9
commit 7de871ba81
2 changed files with 2 additions and 7 deletions

View File

@ -41,8 +41,9 @@ export const fetchTokens = (safeAddress: string) =>
try { try {
const balancesRecords = await Promise.all(json.map(async (item: TokenProps) => { const balancesRecords = await Promise.all(json.map(async (item: TokenProps) => {
const funds = await calculateBalanceOf(item.address, safeAddress, item.decimals)
const status = tokens.includes(item.address) const status = tokens.includes(item.address)
const funds = status ? await calculateBalanceOf(item.address, safeAddress, item.decimals) : '0'
return makeToken({ ...item, status, funds }) return makeToken({ ...item, status, funds })
})) }))

View File

@ -5,7 +5,6 @@ import { safeParamAddressSelector, type RouterProps } from '~/routes/safe/store/
import { type GlobalState } from '~/store' import { type GlobalState } from '~/store'
import { TOKEN_REDUCER_ID } from '~/routes/tokens/store/reducer/tokens' import { TOKEN_REDUCER_ID } from '~/routes/tokens/store/reducer/tokens'
import { type Token } from '~/routes/tokens/store/model/token' import { type Token } from '~/routes/tokens/store/model/token'
import { calculateActiveErc20TokensFrom } from '~/utils/tokens'
const balancesSelector = (state: GlobalState) => state[TOKEN_REDUCER_ID] const balancesSelector = (state: GlobalState) => state[TOKEN_REDUCER_ID]
@ -40,8 +39,3 @@ export const tokenAddressesSelector = createSelector(
return addresses return addresses
}, },
) )
export const activeTokenAddressesSelector = createSelector(
tokenListSelector,
(balances: List<Token>) => calculateActiveErc20TokensFrom(balances),
)