diff --git a/src/routes/safe/container/selector.js b/src/routes/safe/container/selector.js index 9ddf24b0..54aa8b1a 100644 --- a/src/routes/safe/container/selector.js +++ b/src/routes/safe/container/selector.js @@ -74,7 +74,7 @@ const extendedSafeTokensSelector: Selector const baseToken = tokensList.get(token.address) if (baseToken) { - map.set(token.address, baseToken.set(token.balance)) + map.set(token.address, baseToken.set('balance', token.balance)) } }) diff --git a/src/routes/safe/store/actions/fetchSafe.js b/src/routes/safe/store/actions/fetchSafe.js index 3fbfe6eb..17ef2f3a 100644 --- a/src/routes/safe/store/actions/fetchSafe.js +++ b/src/routes/safe/store/actions/fetchSafe.js @@ -3,7 +3,7 @@ import type { Dispatch as ReduxDispatch } from 'redux' import { List, Map } from 'immutable' import { type GlobalState } from '~/store/index' import { makeOwner } from '~/routes/safe/store/models/owner' -import { type SafeProps } from '~/routes/safe/store/models/safe' +import type { SafeProps } from '~/routes/safe/store/models/safe' import { addSafe } from '~/routes/safe/store/actions/addSafe' import { getOwners, getSafeName } from '~/logic/safe/utils' import { getGnosisSafeContract } from '~/logic/contracts/safeContracts' diff --git a/src/routes/safe/store/actions/fetchTokenBalances.js b/src/routes/safe/store/actions/fetchTokenBalances.js index 5c56f643..efb304ba 100644 --- a/src/routes/safe/store/actions/fetchTokenBalances.js +++ b/src/routes/safe/store/actions/fetchTokenBalances.js @@ -8,8 +8,13 @@ import SafeTokenRecord from '~/routes/safe/store/models/safeToken' import { getStandardTokenContract } from '~/logic/tokens/store/actions/fetchTokens' import type { Safe } from '~/routes/safe/store/models/safe' import updateSafe from './updateSafe' +import { ETH_ADDRESS } from '~/logic/tokens/utils/tokenHelpers'; export const calculateBalanceOf = async (tokenAddress: string, safeAddress: string, decimals: number = 18) => { + if (tokenAddress === ETH_ADDRESS) { + return '0' + } + const erc20Token = await getStandardTokenContract() let balance = 0 diff --git a/src/routes/safe/store/reducer/safe.js b/src/routes/safe/store/reducer/safe.js index 125c8d11..df46d174 100644 --- a/src/routes/safe/store/reducer/safe.js +++ b/src/routes/safe/store/reducer/safe.js @@ -76,16 +76,14 @@ export default handleActions( const { safeAddress, token: updatedToken } = action.payload const tokens: List = state.getIn([safeAddress, 'tokens']) - console.log(tokens) const index = tokens.findIndex(token => token.address === updatedToken.address) - console.log('called') + let newState if (index !== -1) { newState = state.setIn([safeAddress, 'tokens'], tokens.delete(index)) } else { newState = state.setIn([safeAddress, 'tokens'], tokens.push(updatedToken)) } - console.log(newState.toJS()) return newState },