diff --git a/src/routes/safe/component/Balances/dataFetcher.js b/src/routes/safe/component/Balances/dataFetcher.js index 0ad3f4057f..940982256b 100644 --- a/src/routes/safe/component/Balances/dataFetcher.js +++ b/src/routes/safe/component/Balances/dataFetcher.js @@ -1,5 +1,6 @@ // @flow import { List } from 'immutable' +import { type Token } from '~/routes/tokens/store/model/token' import { buildOrderFieldFrom, FIXED, type SortRow } from '~/components/Table/sorting' import { type Column } from '~/components/Table/TableHead' @@ -14,39 +15,17 @@ type BalanceData = { export type BalanceRow = SortRow -export const getBalanceData = (): Array => [ - { - [BALANCE_TABLE_ASSET_ID]: 'CVL Journalism', - [BALANCE_TABLE_BALANCE_ID]: '234 CVL', - [buildOrderFieldFrom(BALANCE_TABLE_BALANCE_ID)]: 234, - }, - { - [BALANCE_TABLE_ASSET_ID]: 'ABC Periodico', - [BALANCE_TABLE_BALANCE_ID]: '1.394 ABC', - [buildOrderFieldFrom(BALANCE_TABLE_BALANCE_ID)]: 1.394, - }, - { - [BALANCE_TABLE_ASSET_ID]: 'Ethereum', - [BALANCE_TABLE_BALANCE_ID]: '9.394 ETH', - [buildOrderFieldFrom(BALANCE_TABLE_BALANCE_ID)]: 9.394, - [FIXED]: true, - }, - { - [BALANCE_TABLE_ASSET_ID]: 'Gnosis', - [BALANCE_TABLE_BALANCE_ID]: '0.599 GNO', - [buildOrderFieldFrom(BALANCE_TABLE_BALANCE_ID)]: 0.559, - }, - { - [BALANCE_TABLE_ASSET_ID]: 'OmiseGO', - [BALANCE_TABLE_BALANCE_ID]: '39.922 OMG', - [buildOrderFieldFrom(BALANCE_TABLE_BALANCE_ID)]: 39.922, - }, - { - [BALANCE_TABLE_ASSET_ID]: 'Moe Feo', - [BALANCE_TABLE_BALANCE_ID]: '0 MOE', - [buildOrderFieldFrom(BALANCE_TABLE_BALANCE_ID)]: 0, - }, -] +export const getBalanceData = (activeTokens: List): Array => { + const rows = activeTokens.map((token: Token) => ({ + [BALANCE_TABLE_ASSET_ID]: token.get('name'), + [BALANCE_TABLE_BALANCE_ID]: `${token.get('funds')} ${token.get('symbol')}`, + [buildOrderFieldFrom(BALANCE_TABLE_BALANCE_ID)]: Number(token.get('funds')), + [FIXED]: token.get('symbol') === 'ETH', + })) + + return Array.from(rows) +} + export const generateColumns = () => { const assetRow: Column = { diff --git a/src/routes/safe/component/Balances/index.jsx b/src/routes/safe/component/Balances/index.jsx index df15dfd66f..c63312f4a0 100644 --- a/src/routes/safe/component/Balances/index.jsx +++ b/src/routes/safe/component/Balances/index.jsx @@ -33,6 +33,7 @@ type Props = { classes: Object, granted: boolean, tokens: List, + activeTokens: List, safeAddress: string, } @@ -65,7 +66,7 @@ class Balances extends React.Component { hideZero, showToken, showReceive, showSend, } = this.state const { - classes, granted, tokens, safeAddress, + classes, granted, tokens, safeAddress, activeTokens, } = this.props const columns = generateColumns() @@ -74,7 +75,7 @@ class Balances extends React.Component { root: classes.root, } - const filteredData = filterByZero(getBalanceData(), hideZero) + const filteredData = filterByZero(getBalanceData(activeTokens), hideZero) return (