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 <daniel.sanchez@gnosis.pm>
This commit is contained in:
parent
f8ccff0796
commit
2669471e13
|
@ -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 { DELEGATE_CALL, TX_NOTIFICATION_TYPES, CALL } from 'src/logic/safe/transactions'
|
||||||
import { encodeMultiSendCall } from 'src/logic/safe/transactions/multisend'
|
import { encodeMultiSendCall } from 'src/logic/safe/transactions/multisend'
|
||||||
import { getNetworkInfo } from 'src/config'
|
import { getNetworkInfo } from 'src/config'
|
||||||
|
import { web3ReadOnly } from 'src/logic/wallets/getWeb3'
|
||||||
import { EstimationStatus, useEstimateTransactionGas } from 'src/logic/hooks/useEstimateTransactionGas'
|
import { EstimationStatus, useEstimateTransactionGas } from 'src/logic/hooks/useEstimateTransactionGas'
|
||||||
import { TransactionFees } from 'src/components/TransactionsFees'
|
import { TransactionFees } from 'src/components/TransactionsFees'
|
||||||
import { EditableTxParameters } from 'src/routes/safe/components/Transactions/helpers/EditableTxParameters'
|
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
|
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 = ({
|
export const ReviewConfirm = ({
|
||||||
app,
|
app,
|
||||||
txs,
|
txs,
|
||||||
|
@ -86,10 +91,9 @@ export const ReviewConfirm = ({
|
||||||
isMultiSend,
|
isMultiSend,
|
||||||
])
|
])
|
||||||
const txValue: string | undefined = useMemo(
|
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],
|
[txs, isMultiSend],
|
||||||
)
|
)
|
||||||
|
|
||||||
const operation = useMemo(() => (isMultiSend ? DELEGATE_CALL : CALL), [isMultiSend])
|
const operation = useMemo(() => (isMultiSend ? DELEGATE_CALL : CALL), [isMultiSend])
|
||||||
const [manualSafeTxGas, setManualSafeTxGas] = useState(0)
|
const [manualSafeTxGas, setManualSafeTxGas] = useState(0)
|
||||||
const [manualGasPrice, setManualGasPrice] = useState<string | undefined>()
|
const [manualGasPrice, setManualGasPrice] = useState<string | undefined>()
|
||||||
|
@ -199,7 +203,11 @@ export const ReviewConfirm = ({
|
||||||
<DividerLine withArrow />
|
<DividerLine withArrow />
|
||||||
|
|
||||||
{/* Txs decoded */}
|
{/* Txs decoded */}
|
||||||
<BasicTxInfo txRecipient={txRecipient} txData={txData} txValue={txValue} />
|
<BasicTxInfo
|
||||||
|
txRecipient={txRecipient}
|
||||||
|
txData={txData}
|
||||||
|
txValue={fromTokenUnit(txValue, nativeCoin.decimals)}
|
||||||
|
/>
|
||||||
|
|
||||||
<DecodeTxsWrapper>
|
<DecodeTxsWrapper>
|
||||||
<DecodeTxs txs={txs} decodedData={decodedData} onTxItemClick={showDecodedTxData} />
|
<DecodeTxs txs={txs} decodedData={decodedData} onTxItemClick={showDecodedTxData} />
|
||||||
|
|
Loading…
Reference in New Issue