diff --git a/src/logic/safe/transactions/safeTxSignerEIP712.js b/src/logic/safe/transactions/safeTxSignerEIP712.js index 07d78efc..ac9a79a6 100644 --- a/src/logic/safe/transactions/safeTxSignerEIP712.js +++ b/src/logic/safe/transactions/safeTxSignerEIP712.js @@ -82,7 +82,7 @@ export const generateMetamaskSignature = async ( operation, txGasEstimate, ) - console.log({sender}) + const jsonTypedData = JSON.stringify(typedData) const signedTypedData = { method: 'eth_signTypedData_v3', diff --git a/src/routes/safe/components/Balances/Receive/index.jsx b/src/routes/safe/components/Balances/Receive/index.jsx index f167ef71..841f6f2a 100644 --- a/src/routes/safe/components/Balances/Receive/index.jsx +++ b/src/routes/safe/components/Balances/Receive/index.jsx @@ -94,7 +94,14 @@ const Receive = ({ - {safeAddress} + { + copyToClipboard(safeAddress) + }} + className={classes.address} + > + {safeAddress} + 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 2f5a0449..e3779478 100644 --- a/src/routes/safe/components/Balances/SendModal/screens/ReviewTx/index.jsx +++ b/src/routes/safe/components/Balances/SendModal/screens/ReviewTx/index.jsx @@ -102,7 +102,7 @@ const ReviewTx = ({ {tx.token.name} - + {tx.amount} {' '} {tx.token.symbol} diff --git a/src/routes/safe/components/Balances/SendModal/screens/ReviewTx/style.js b/src/routes/safe/components/Balances/SendModal/screens/ReviewTx/style.js index 343c621c..96e20c6b 100644 --- a/src/routes/safe/components/Balances/SendModal/screens/ReviewTx/style.js +++ b/src/routes/safe/components/Balances/SendModal/screens/ReviewTx/style.js @@ -24,6 +24,9 @@ export const styles = () => ({ container: { padding: `${md} ${lg}`, }, + amount: { + marginLeft: sm, + }, buttonRow: { height: '84px', justifyContent: 'center', diff --git a/src/routes/safe/store/actions/createTransaction.js b/src/routes/safe/store/actions/createTransaction.js index 23176161..0937672a 100644 --- a/src/routes/safe/store/actions/createTransaction.js +++ b/src/routes/safe/store/actions/createTransaction.js @@ -13,28 +13,39 @@ import { getStandardTokenContract } from '~/logic/tokens/store/actions/fetchToke export const ADD_TRANSACTIONS = 'ADD_TRANSACTIONS' export const addTransactions = createAction(ADD_TRANSACTIONS) -const createTransaction = (safeAddress: string, to: string, valueInEth: string, token: Token, openSnackbar: Function) => async ( - dispatch: ReduxDispatch, -) => { +const createTransaction = ( + safeAddress: string, + to: string, + valueInEth: string, + token: Token, + openSnackbar: Function, +) => async (dispatch: ReduxDispatch) => { + const isSendingETH = isEther(token.symbol) + const safeInstance = await getSafeEthereumInstance(safeAddress) const web3 = getWeb3() const from = web3.currentProvider.selectedAddress const threshold = await safeInstance.getThreshold() const nonce = await safeInstance.nonce() - const valueInWei = web3.utils.toWei(valueInEth, 'ether') + const txRecipient = isSendingETH ? to : token.address + let valueInWei = web3.utils.toWei(valueInEth, 'ether') const isExecution = threshold.toNumber() === 1 let txData = EMPTY_DATA - if (!isEther(token.symbol)) { + if (!isSendingETH) { const StandardToken = await getStandardTokenContract() const sendToken = await StandardToken.at(token.address) - txData = sendToken.contract.transfer(to, valueInWei).encodeABI() + txData = sendToken.contract.methods.transfer(to, valueInWei).encodeABI() + // valueInWei should be 0 if we send tokens + // the real value is encoded in txData and will be used by the contract + // if valueInWei > 0 it would send ETH from the safe + valueInWei = 0 } let txHash if (isExecution) { - txHash = await executeTransaction(safeInstance, to, valueInWei, txData, CALL, nonce, from) + txHash = await executeTransaction(safeInstance, txRecipient, valueInWei, txData, CALL, nonce, from) openSnackbar('Transaction has been submitted', 'success') } else { // txHash = await approveTransaction(safeAddress, to, valueInWei, txData, CALL, nonce)