WA-232 Only fetching balance of active tokens
This commit is contained in:
parent
a5b03007a9
commit
7de871ba81
|
@ -41,8 +41,9 @@ export const fetchTokens = (safeAddress: string) =>
|
|||
|
||||
try {
|
||||
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 funds = status ? await calculateBalanceOf(item.address, safeAddress, item.decimals) : '0'
|
||||
|
||||
return makeToken({ ...item, status, funds })
|
||||
}))
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ import { safeParamAddressSelector, type RouterProps } from '~/routes/safe/store/
|
|||
import { type GlobalState } from '~/store'
|
||||
import { TOKEN_REDUCER_ID } from '~/routes/tokens/store/reducer/tokens'
|
||||
import { type Token } from '~/routes/tokens/store/model/token'
|
||||
import { calculateActiveErc20TokensFrom } from '~/utils/tokens'
|
||||
|
||||
const balancesSelector = (state: GlobalState) => state[TOKEN_REDUCER_ID]
|
||||
|
||||
|
@ -40,8 +39,3 @@ export const tokenAddressesSelector = createSelector(
|
|||
return addresses
|
||||
},
|
||||
)
|
||||
|
||||
export const activeTokenAddressesSelector = createSelector(
|
||||
tokenListSelector,
|
||||
(balances: List<Token>) => calculateActiveErc20TokensFrom(balances),
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue