Adds TransactionFees modal to confirm safe app tx modal (#1789)

This commit is contained in:
Agustin Pane 2021-01-18 15:25:28 -03:00 committed by GitHub
parent ce43a97bee
commit 0d0acacd04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 3 deletions

View File

@ -25,6 +25,8 @@ import GasEstimationInfo from './GasEstimationInfo'
import { getNetworkInfo } from 'src/config' import { getNetworkInfo } from 'src/config'
import { TransactionParams } from './AppFrame' import { TransactionParams } from './AppFrame'
import { EstimationStatus, useEstimateTransactionGas } from 'src/logic/hooks/useEstimateTransactionGas' import { EstimationStatus, useEstimateTransactionGas } from 'src/logic/hooks/useEstimateTransactionGas'
import Row from 'src/components/layout/Row'
import { TransactionFees } from 'src/components/TransactionsFees'
const isTxValid = (t: Transaction): boolean => { const isTxValid = (t: Transaction): boolean => {
if (!['string', 'number'].includes(typeof t.value)) { if (!['string', 'number'].includes(typeof t.value)) {
@ -67,6 +69,10 @@ const StyledTextBox = styled(TextBox)`
max-width: 444px; max-width: 444px;
` `
const Container = styled.div`
max-width: 480px;
`
type OwnProps = { type OwnProps = {
isOpen: boolean isOpen: boolean
app: SafeApp app: SafeApp
@ -96,7 +102,14 @@ export const ConfirmTransactionModal = ({
}: OwnProps): React.ReactElement | null => { }: OwnProps): React.ReactElement | null => {
const [estimatedSafeTxGas, setEstimatedSafeTxGas] = useState(0) const [estimatedSafeTxGas, setEstimatedSafeTxGas] = useState(0)
const { gasEstimation, txEstimationExecutionStatus } = useEstimateTransactionGas({ const {
gasEstimation,
isOffChainSignature,
isCreation,
isExecution,
gasCostFormatted,
txEstimationExecutionStatus,
} = useEstimateTransactionGas({
txData: encodeMultiSendCall(txs), txData: encodeMultiSendCall(txs),
txRecipient: MULTI_SEND_ADDRESS, txRecipient: MULTI_SEND_ADDRESS,
operation: DELEGATE_CALL, operation: DELEGATE_CALL,
@ -159,7 +172,7 @@ export const ConfirmTransactionModal = ({
</Text> </Text>
</> </>
) : ( ) : (
<> <Container>
<AddressInfo ethBalance={ethBalance} safeAddress={safeAddress} safeName={safeName} /> <AddressInfo ethBalance={ethBalance} safeAddress={safeAddress} safeName={safeName} />
<DividerLine withArrow /> <DividerLine withArrow />
{txs.map((tx, index) => ( {txs.map((tx, index) => (
@ -195,7 +208,16 @@ export const ConfirmTransactionModal = ({
/> />
</div> </div>
)} )}
</> <Row>
<TransactionFees
gasCostFormatted={gasCostFormatted}
isExecution={isExecution}
isCreation={isCreation}
isOffChainSignature={isOffChainSignature}
txEstimationExecutionStatus={txEstimationExecutionStatus}
/>
</Row>
</Container>
) )
return ( return (