@@ -7,6 +7,8 @@ import {
77 Flex,
88 LinkButton,
99 H5,
10+ Text,
11+ HelpText,
1012} from 'indigo-react';
1113import { GenerateButton, ForwardButton, RestartButton } from './Buttons';
1214import { useCheckboxInput } from 'lib/useInputs';
@@ -25,20 +27,30 @@ export default function InlineEthereumTransaction({
2527 confirmed,
2628 reset,
2729 error,
30+ gasPrice,
2831 setGasPrice,
2932 txHash,
33+ nonce,
34+ chainId,
3035 signedTransaction,
3136
3237 // additional from parent
3338 className,
3439 onReturn,
3540}) {
41+ // show receipt after successful broadcast
42+ const showReceipt = broadcasted || confirmed;
43+ // show configure controls pre-broadcast
44+ const showConfigureInput = !(signed || broadcasted || confirmed);
45+ // show signed tx after signing
46+ const showSignedTx = signed;
47+
3648 const exploreHashUrl = useExploreTxUrl(txHash);
37− const [configureInput, { data: configurationOpen }] = useCheckboxInput({
38− name: 'configure',
39− label: 'Configure Transaction',
40− inverseLabel: 'Cancel Configure Transaction',
41− disabled: signed || broadcasted || confirmed,
49+ const [advancedInput, { data: advancedOpen }] = useCheckboxInput({
50+ name: 'advanced',
51+ label: 'Advanced Configuration',
52+ inverseLabel: 'Hide Advanced Configuration',
53+ disabled: !showConfigureInput,
4254 });
4355
4456 const [
@@ -48,16 +60,9 @@ export default function InlineEthereumTransaction({
4860 name: 'viewsigned',
4961 label: 'View Signed Transaction',
5062 inverseLabel: 'Hide Signed Transaction',
51− disabled: !signed,
63+ disabled: !showSignedTx,
5264 });
5365
54− // show receipt after successful broadcast
55− const showReceipt = broadcasted || confirmed;
56− // show configure controls pre-broadcast
57− const showConfigureInput = !(broadcasted || confirmed);
58− // show signed tx after signing
59− const showSignedTx = signed;
60−
6166 const renderButton = () => {
6267 if (error) {
6368 return (
@@ -122,7 +127,42 @@ export default function InlineEthereumTransaction({
122127 )}
123128
124129 {showConfigureInput && (
125− <Grid.Item full as={ToggleInput} {...configureInput} />
130+ <>
131+ {!advancedOpen ? (
132+ <Grid.Item full as={ToggleInput} {...advancedInput} />
133+ ) : (
134+ <>
135+ <Grid.Item full as={Flex} row justify="between" className="mt2">
136+ <Flex.Item as={H5}>Gas Price</Flex.Item>
137+ <Flex.Item as={H5}>{gasPrice} Gwei</Flex.Item>
138+ </Grid.Item>
139+ <Grid.Item
140+ full
141+ as="input"
142+ type="range"
143+ min="1"
144+ max="100"
145+ value={gasPrice}
146+ onChange={e => setGasPrice(parseInt(e.target.value, 10))}
147+ />
148+ <Grid.Item
149+ full
150+ as={Flex}
151+ row
152+ justify="between"
153+ className="f6 mt1">
154+ <Flex.Item as={Text}>Cheap</Flex.Item>
155+ <Flex.Item as={Text}>Fast</Flex.Item>
156+ </Grid.Item>
157+ <Grid.Item full as={HelpText} className="mt3">
158+ Nonce: {nonce}
159+ </Grid.Item>
160+ <Grid.Item full as={HelpText} className="mt1">
161+ Chain ID: {chainId}
162+ </Grid.Item>
163+ </>
164+ )}
165+ </>
126166 )}
127167
128168 {showSignedTx && (