@@ -10,12 +10,13 @@ import {
1010 Text,
1111 HelpText,
1212} from 'indigo-react';
13−import { GenerateButton, ForwardButton, RestartButton } from './Buttons';
13+
1414import { useCheckboxInput } from 'lib/useInputs';
15−import Blinky from './Blinky';
1615import { hexify } from 'lib/txn';
1716import { useExploreTxUrl } from 'lib/explorer';
1817
18+import { GenerateButton, ForwardButton, RestartButton } from './Buttons';
19+
1920export default function InlineEthereumTransaction({
2021 // from useEthereumTransaction.bind
2122 initializing,
@@ -42,10 +43,10 @@ export default function InlineEthereumTransaction({
4243 const showReceipt = broadcasted || confirmed;
4344 // show configure controls pre-broadcast
4445 const showConfigureInput = !(signed || broadcasted || confirmed);
45− // show signed tx after signing
46+ // show signed tx only when signing (for offline usage)
4647 const showSignedTx = signed;
4748
48− const exploreHashUrl = useExploreTxUrl(txHash);
49+ const exploreTxUrl = useExploreTxUrl(txHash);
4950 const [advancedInput, { data: advancedOpen }] = useCheckboxInput({
5051 name: 'advanced',
5152 label: 'Advanced Configuration',
@@ -63,7 +64,7 @@ export default function InlineEthereumTransaction({
6364 disabled: !showSignedTx,
6465 });
6566
66− const renderButton = () => {
67+ const renderPrimaryButton = () => {
6768 if (error) {
6869 return (
6970 <Grid.Item full as={RestartButton} solid onClick={() => reset()}>
@@ -79,25 +80,15 @@ export default function InlineEthereumTransaction({
7980 </Grid.Item>
8081 </>
8182 );
82− } else if (broadcasted) {
83− return (
84− <Grid.Item
85− full
86− as={ForwardButton}
87− solid
88− success
89− disabled
90− accessory={<Blinky />}>
91− Sending Transaction...
92− </Grid.Item>
93− );
94− } else if (signed) {
83+ } else if (signed || broadcasted) {
9584 return (
9685 <Grid.Item
9786 full
9887 as={ForwardButton}
9988 solid
10089 success
90+ disable={broadcasted}
91+ loading={broadcasted}
10192 onClick={() => broadcast()}>
10293 Send Transaction
10394 </Grid.Item>
@@ -109,7 +100,7 @@ export default function InlineEthereumTransaction({
109100 as={GenerateButton}
110101 onClick={generateAndSign}
111102 disabled={!canSign}
112− accessory={!canSign && initializing ? <Blinky /> : undefined}>
103+ loading={!canSign && initializing}>
113104 Generate & Sign Transaction
114105 </Grid.Item>
115106 );
@@ -118,7 +109,7 @@ export default function InlineEthereumTransaction({
118109
119110 return (
120111 <Grid className={cn(className, 'mt1')}>
121− {renderButton()}
112+ {renderPrimaryButton()}
122113
123114 {error && (
124115 <Grid.Item full as={ErrorText} className="mt1">
@@ -136,6 +127,7 @@ export default function InlineEthereumTransaction({
136127 <Flex.Item as={H5}>Gas Price</Flex.Item>
137128 <Flex.Item as={H5}>{gasPrice} Gwei</Flex.Item>
138129 </Grid.Item>
130+ {/* TODO(shrugs): move to indigo/RangeInput */}
139131 <Grid.Item
140132 full
141133 as="input"
@@ -182,7 +174,7 @@ export default function InlineEthereumTransaction({
182174 <Grid.Item full as={Flex} col className="pv4">
183175 <Flex.Item as={Flex} row justify="between">
184176 <Flex.Item as={H5}>Transaction Hash</Flex.Item>
185− <Flex.Item as={LinkButton} href={exploreHashUrl}>
177+ <Flex.Item as={LinkButton} href={exploreTxUrl}>
186178 Etherscan↗
187179 </Flex.Item>
188180 </Flex.Item>