Add Owner Flow gas estimations

This commit is contained in:
Mikhail Mikheev 2019-10-16 12:29:35 +04:00
parent c5a1ece144
commit ede3293968
3 changed files with 9 additions and 2 deletions

View File

@ -16,6 +16,7 @@ const styles = () => ({
width: '775px', width: '775px',
minHeight: '500px', minHeight: '500px',
position: 'static', position: 'static',
height: 'auto',
}, },
}) })

View File

@ -44,11 +44,12 @@ const ReviewAddOwner = ({
const web3 = getWeb3() const web3 = getWeb3()
const { fromWei, toBN } = web3.utils const { fromWei, toBN } = web3.utils
const safeInstance = await getGnosisSafeInstanceAt(safeAddress) const safeInstance = await getGnosisSafeInstanceAt(safeAddress)
const txData = safeInstance.contract.methods const txData = safeInstance.contract.methods
.addOwnerWithThreshold(values.ownerAddress, values.threshold) .addOwnerWithThreshold(values.ownerAddress, values.threshold)
.encodeABI() .encodeABI()
const estimatedGasCosts = await estimateTxGasCosts(safeAddress, safeAddress, txData) const estimatedGasCosts = await estimateTxGasCosts(safeAddress, safeAddress, txData)
const gasCostsAsEth = fromWei(toBN(estimatedGasCosts), 'ether') const gasCostsAsEth = fromWei(toBN(estimatedGasCosts), 'ether')
const formattedGasCosts = formatAmount(gasCostsAsEth) const formattedGasCosts = formatAmount(gasCostsAsEth)
if (isCurrent) { if (isCurrent) {
@ -167,7 +168,9 @@ const ReviewAddOwner = ({
</Block> </Block>
<Hairline /> <Hairline />
<Row> <Row>
<Paragraph>{gasCosts}</Paragraph> <Block className={classes.gasCostsContainer}>
<Paragraph>{`You're about to create a transaction and will have to confirm it with your currently connected wallet. Make sure you have ${gasCosts} (fee price) ETH in this wallet to fund this confirmation.`}</Paragraph>
</Block>
</Row> </Row>
<Hairline /> <Hairline />
<Row align="center" className={classes.buttonRow}> <Row align="center" className={classes.buttonRow}>

View File

@ -78,4 +78,7 @@ export const styles = () => ({
cursor: 'pointer', cursor: 'pointer',
}, },
}, },
gasCostsContainer: {
padding: `0 ${lg}`,
},
}) })