From 2669471e13ca52b4eb8d25b5c034de2faab20bd5 Mon Sep 17 00:00:00 2001 From: Mikhail Mikheev Date: Wed, 31 Mar 2021 17:36:18 +0300 Subject: [PATCH 1/3] Bug: Safe apps passed value converted to ether to createTransaction action instead of wei (#2115) * dont convert transaction value to ether for createTransaction Co-authored-by: Daniel Sanchez --- .../components/ConfirmTxModal/ReviewConfirm.tsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/routes/safe/components/Apps/components/ConfirmTxModal/ReviewConfirm.tsx b/src/routes/safe/components/Apps/components/ConfirmTxModal/ReviewConfirm.tsx index 0a775471..3a56ebcb 100644 --- a/src/routes/safe/components/Apps/components/ConfirmTxModal/ReviewConfirm.tsx +++ b/src/routes/safe/components/Apps/components/ConfirmTxModal/ReviewConfirm.tsx @@ -13,6 +13,7 @@ import { MULTI_SEND_ADDRESS } from 'src/logic/contracts/safeContracts' import { DELEGATE_CALL, TX_NOTIFICATION_TYPES, CALL } from 'src/logic/safe/transactions' import { encodeMultiSendCall } from 'src/logic/safe/transactions/multisend' import { getNetworkInfo } from 'src/config' +import { web3ReadOnly } from 'src/logic/wallets/getWeb3' import { EstimationStatus, useEstimateTransactionGas } from 'src/logic/hooks/useEstimateTransactionGas' import { TransactionFees } from 'src/components/TransactionsFees' import { EditableTxParameters } from 'src/routes/safe/components/Transactions/helpers/EditableTxParameters' @@ -58,6 +59,10 @@ type Props = ConfirmTxModalProps & { hidden: boolean // used to prevent re-rendering the modal each time a tx is inspected } +const parseTxValue = (value: string | number): string => { + return web3ReadOnly.utils.toBN(value).toString() +} + export const ReviewConfirm = ({ app, txs, @@ -86,10 +91,9 @@ export const ReviewConfirm = ({ isMultiSend, ]) const txValue: string | undefined = useMemo( - () => (isMultiSend ? '0' : txs[0]?.value && fromTokenUnit(txs[0]?.value, nativeCoin.decimals)), + () => (isMultiSend ? '0' : txs[0]?.value && parseTxValue(txs[0]?.value)), [txs, isMultiSend], ) - const operation = useMemo(() => (isMultiSend ? DELEGATE_CALL : CALL), [isMultiSend]) const [manualSafeTxGas, setManualSafeTxGas] = useState(0) const [manualGasPrice, setManualGasPrice] = useState() @@ -199,7 +203,11 @@ export const ReviewConfirm = ({ {/* Txs decoded */} - + From 6bcd4815c78fb63fde0985ac5d1ebf85897b0535 Mon Sep 17 00:00:00 2001 From: Mikhail Mikheev Date: Wed, 31 Mar 2021 17:36:18 +0300 Subject: [PATCH 2/3] Bug: Safe apps passed value converted to ether to createTransaction action instead of wei (#2115) * dont convert transaction value to ether for createTransaction Co-authored-by: Daniel Sanchez --- .../components/ConfirmTxModal/ReviewConfirm.tsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/routes/safe/components/Apps/components/ConfirmTxModal/ReviewConfirm.tsx b/src/routes/safe/components/Apps/components/ConfirmTxModal/ReviewConfirm.tsx index 0a775471..3a56ebcb 100644 --- a/src/routes/safe/components/Apps/components/ConfirmTxModal/ReviewConfirm.tsx +++ b/src/routes/safe/components/Apps/components/ConfirmTxModal/ReviewConfirm.tsx @@ -13,6 +13,7 @@ import { MULTI_SEND_ADDRESS } from 'src/logic/contracts/safeContracts' import { DELEGATE_CALL, TX_NOTIFICATION_TYPES, CALL } from 'src/logic/safe/transactions' import { encodeMultiSendCall } from 'src/logic/safe/transactions/multisend' import { getNetworkInfo } from 'src/config' +import { web3ReadOnly } from 'src/logic/wallets/getWeb3' import { EstimationStatus, useEstimateTransactionGas } from 'src/logic/hooks/useEstimateTransactionGas' import { TransactionFees } from 'src/components/TransactionsFees' import { EditableTxParameters } from 'src/routes/safe/components/Transactions/helpers/EditableTxParameters' @@ -58,6 +59,10 @@ type Props = ConfirmTxModalProps & { hidden: boolean // used to prevent re-rendering the modal each time a tx is inspected } +const parseTxValue = (value: string | number): string => { + return web3ReadOnly.utils.toBN(value).toString() +} + export const ReviewConfirm = ({ app, txs, @@ -86,10 +91,9 @@ export const ReviewConfirm = ({ isMultiSend, ]) const txValue: string | undefined = useMemo( - () => (isMultiSend ? '0' : txs[0]?.value && fromTokenUnit(txs[0]?.value, nativeCoin.decimals)), + () => (isMultiSend ? '0' : txs[0]?.value && parseTxValue(txs[0]?.value)), [txs, isMultiSend], ) - const operation = useMemo(() => (isMultiSend ? DELEGATE_CALL : CALL), [isMultiSend]) const [manualSafeTxGas, setManualSafeTxGas] = useState(0) const [manualGasPrice, setManualGasPrice] = useState() @@ -199,7 +203,11 @@ export const ReviewConfirm = ({ {/* Txs decoded */} - + From 87ca43464eaa8ee526a3a382bbb2df466f176697 Mon Sep 17 00:00:00 2001 From: Daniel Sanchez Date: Wed, 31 Mar 2021 16:37:49 +0200 Subject: [PATCH 3/3] Set v3.3.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index dd954f4a..47dae984 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "safe-react", - "version": "3.3.0", + "version": "3.3.1", "description": "Allowing crypto users manage funds in a safer way", "website": "https://github.com/gnosis/safe-react#readme", "bugs": {