/* @flow */ import React from 'react'; import Tooltip from 'rc-tooltip'; import type { Props as BaseProps } from './index'; type Props = { selectedAccount: $ElementType, sendForm: $ElementType, sendFormActions: $ElementType, children?: $ElementType, }; const AdvancedForm = (props: Props) => { const { account, network, } = props.selectedAccount; const { networkSymbol, currency, gasPrice, gasLimit, recommendedGasPrice, calculatingGasLimit, nonce, data, errors, warnings, infos, advanced, } = props.sendForm; const { toggleAdvanced, onGasPriceChange, onGasLimitChange, onNonceChange, onDataChange, } = props.sendFormActions; if (!advanced) { return (
Advanced settings { props.children }
); } const nonceTooltip = (
TODO
); let gasLimitTooltipCurrency: string; let gasLimitTooltipValue: string; if (networkSymbol !== currency) { gasLimitTooltipCurrency = 'tokens'; gasLimitTooltipValue = network.defaultGasLimitTokens; } else { gasLimitTooltipCurrency = networkSymbol; gasLimitTooltipValue = network.defaultGasLimit; } const gasLimitTooltip = (
Gas limit is the amount of gas to send with your transaction.
TX fee = gas price * gas limit & is paid to miners for including your TX in a block.
Increasing this number will not get your TX mined faster.
Default value for sending { gasLimitTooltipCurrency } is { gasLimitTooltipValue }
); const gasPriceTooltip = (
Gas Price is the amount you pay per unit of gas.
TX fee = gas price * gas limit & is paid to miners for including your TX in a block.
Higher the gas price = faster transaction, but more expensive. Recommended is { recommendedGasPrice } GWEI.
Read more
); const dataTooltip = (
Data is usually used when you send transactions to contracts.
); return (
Advanced settings
{/*
} overlay={ nonceTooltip } placement="top"> onNonceChange(event.target.value) } /> { errors.nonce ? ({ errors.nonce }) : null } { warnings.nonce ? ({ warnings.nonce }) : null }
*/}
0} onChange={event => onGasLimitChange(event.target.value)} /> { errors.gasLimit ? ({ errors.gasLimit }) : null } { warnings.gasLimit ? ({ warnings.gasLimit }) : null } { calculatingGasLimit ? (Calculating...) : null }
onGasPriceChange(event.target.value)} /> { errors.gasPrice ? ({ errors.gasPrice }) : null }