1import React from 'react';
2import cn from 'classnames';
11import { GenerateButton, ForwardButton, RestartButton } from './Buttons';
12import { useCheckboxInput } from 'lib/useInputs';
13import Blinky from './Blinky';
14import { hexify } from 'lib/txn';
15import { useExploreTxUrl } from 'lib/explorer';
17export default function InlineEthereumTransaction({
18 // from useEthereumTransaction.bind
32 // additional from parent
36 const exploreHashUrl = useExploreTxUrl(txHash);
37 const [configureInput, { data: configurationOpen }] = useCheckboxInput({
39 label: 'Configure Transaction',
40 inverseLabel: 'Cancel Configure Transaction',
41 disabled: signed || broadcasted || confirmed,
45 viewSignedTransaction,
46 { data: signedTransactionOpen },
47 ] = useCheckboxInput({
49 label: 'View Signed Transaction',
50 inverseLabel: 'Hide Signed Transaction',
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;
61 const renderButton = () => {
64 <Grid.Item full as={RestartButton} solid onClick={() => reset()}>
68 } else if (confirmed) {
72 <Grid.Item full as={RestartButton} onClick={onReturn}>
77 } else if (broadcasted) {
85 accessory={<Blinky />}>
86 Sending Transaction...
96 onClick={() => broadcast()}>
105 onClick={generateAndSign}
107 accessory={!canSign && initializing ? <Blinky /> : undefined}>
108 Generate & Sign Transaction
115 <Grid className={cn(className, 'mt1')}>
119 <Grid.Item full as={ErrorText} className="mt1">
124 {showConfigureInput && (
125 <Grid.Item full as={ToggleInput} {...configureInput} />
130 <Grid.Item full as={ToggleInput} {...viewSignedTransaction} />
131 {signedTransactionOpen && (
132 <Grid.Item full as="code" className="f6 mono gray4 wrap">
133 {hexify(signedTransaction.serialize())}
142 <Grid.Item full as={Flex} col className="pv4">
143 <Flex.Item as={Flex} row justify="between">
144 <Flex.Item as={H5}>Transaction Hash</Flex.Item>
145 <Flex.Item as={LinkButton} href={exploreHashUrl}>
149 <Flex.Item as={Flex}>
150 <Flex.Item flex as="code" className="f6 mono gray4 wrap">
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list