diff --git a/src/routes/safe/components/Balances/SendModal/index.jsx b/src/routes/safe/components/Balances/SendModal/index.jsx index 20b793a8..9526da23 100644 --- a/src/routes/safe/components/Balances/SendModal/index.jsx +++ b/src/routes/safe/components/Balances/SendModal/index.jsx @@ -128,6 +128,7 @@ const Send = ({ safeName={safeName} ethBalance={ethBalance} createTransaction={createTransaction} + tokens={tokens} /> )} {activeScreen === 'sendCustomTx' && ( diff --git a/src/routes/safe/components/Balances/SendModal/screens/ReviewTx/index.jsx b/src/routes/safe/components/Balances/SendModal/screens/ReviewTx/index.jsx index 6328c2cd..d0449fb0 100644 --- a/src/routes/safe/components/Balances/SendModal/screens/ReviewTx/index.jsx +++ b/src/routes/safe/components/Balances/SendModal/screens/ReviewTx/index.jsx @@ -1,5 +1,6 @@ // @flow import React, { useEffect, useState } from 'react' +import { List } from 'immutable' import { BigNumber } from 'bignumber.js' import { withStyles } from '@material-ui/core/styles' import Close from '@material-ui/icons/Close' @@ -20,10 +21,11 @@ import { setImageToPlaceholder } from '~/routes/safe/components/Balances/utils' import { getHumanFriendlyToken } from '~/logic/tokens/store/actions/fetchTokens' import { estimateTxGasCosts } from '~/logic/safe/transactions/gasNew' import { EMPTY_DATA } from '~/logic/wallets/ethTransactions' +import { type Token } from '~/logic/tokens/store/model/token' import { formatAmount } from '~/logic/tokens/utils/formatAmount' import { getWeb3 } from '~/logic/wallets/getWeb3' import { TX_NOTIFICATION_TYPES } from '~/logic/safe/transactions' -import { isEther } from '~/logic/tokens/utils/tokenHelpers' +import { ETH_ADDRESS } from '~/logic/tokens/utils/tokenHelpers' import ArrowDown from '../assets/arrow-down.svg' import { styles } from './style' @@ -35,6 +37,7 @@ type Props = { safeName: string, ethBalance: string, tx: Object, + tokens: List, createTransaction: Function, enqueueSnackbar: Function, closeSnackbar: Function, @@ -48,13 +51,15 @@ const ReviewTx = ({ safeName, ethBalance, tx, + tokens, createTransaction, enqueueSnackbar, closeSnackbar, }: Props) => { const [gasCosts, setGasCosts] = useState('< 0.001') - const isSendingETH = isEther(tx.token.symbol) - const txRecipient = isSendingETH ? tx.recipientAddress : tx.token.address + const txToken = tokens.find((token) => token.address === tx.token) + const isSendingETH = txToken.address === ETH_ADDRESS + const txRecipient = isSendingETH ? tx.recipientAddress : txToken.address useEffect(() => { let isCurrent = true @@ -65,7 +70,7 @@ const ReviewTx = ({ if (!isSendingETH) { const StandardToken = await getHumanFriendlyToken() - const tokenInstance = await StandardToken.at(tx.token.address) + const tokenInstance = await StandardToken.at(txToken.address) txData = tokenInstance.contract.methods.transfer(tx.recipientAddress, 0).encodeABI() } @@ -92,7 +97,7 @@ const ReviewTx = ({ if (!isSendingETH) { const HumanFriendlyToken = await getHumanFriendlyToken() - const tokenInstance = await HumanFriendlyToken.at(tx.token.address) + const tokenInstance = await HumanFriendlyToken.at(txToken.address) const decimals = await tokenInstance.decimals() txAmount = new BigNumber(tx.amount).times(10 ** decimals.toNumber()).toString() @@ -162,11 +167,11 @@ const ReviewTx = ({ - {tx.token.name} + {txToken.name} {tx.amount} {' '} - {tx.token.symbol} + {txToken.symbol} diff --git a/src/routes/safe/components/Balances/SendModal/screens/SendFunds/index.jsx b/src/routes/safe/components/Balances/SendModal/screens/SendFunds/index.jsx index 976908ed..3414ca22 100644 --- a/src/routes/safe/components/Balances/SendModal/screens/SendFunds/index.jsx +++ b/src/routes/safe/components/Balances/SendModal/screens/SendFunds/index.jsx @@ -43,9 +43,7 @@ type Props = { const formMutators = { setMax: (args, state, utils) => { - const { token } = state.formState.values - - utils.changeValue(state, 'amount', () => token && token.balance) + utils.changeValue(state, 'amount', () => args[0]) }, onTokenChange: (args, state, utils) => { utils.changeValue(state, 'amount', () => '') @@ -156,7 +154,7 @@ const SendFunds = ({ Amount - + mutators.setMax(selectedTokenRecord.balance)}> Send max diff --git a/src/routes/safe/components/Settings/ManageOwners/ReplaceOwnerModal/screens/Review/index.jsx b/src/routes/safe/components/Settings/ManageOwners/ReplaceOwnerModal/screens/Review/index.jsx index 0764066a..1d90251f 100644 --- a/src/routes/safe/components/Settings/ManageOwners/ReplaceOwnerModal/screens/Review/index.jsx +++ b/src/routes/safe/components/Settings/ManageOwners/ReplaceOwnerModal/screens/Review/index.jsx @@ -90,31 +90,30 @@ const ReviewRemoveOwner = ({ {owners.map( - (owner) => - owner.address !== ownerAddress && ( - - - - - - - - - {owner.name} + (owner) => owner.address !== ownerAddress && ( + + + + + + + + + {owner.name} + + + + {owner.address} - - - {owner.address} - - - - + + - - - - - ), + + + + + + ), )}