import React from 'react';
import { Grid, ToggleInput, ErrorText } from 'indigo-react';
import { GenerateButton, ForwardButton } from './Buttons';
import { useCheckboxInput } from 'lib/useInputs';
import Blinky from './Blinky';
export default function InlineEthereumTransaction({
initializing,
construct,
constructed,
canSign,
generateAndSign,
signed,
broadcast,
broadcasted,
confirmed,
reset,
error,
setGasPrice,
className,
}) {
const [configureInput, { data: configurationOpen }] = useCheckboxInput({
name: 'configure',
label: 'Configure Transaction',
disabled: signed || broadcasted || confirmed,
});
const [
viewSignedTransaction,
{ data: signedTransactionOpen },
] = useCheckboxInput({
name: 'viewsigned',
label: 'View Signed Transaction',
disabled: !signed,
});
const renderButton = () => {
if (confirmed) {
// some sort of next button or nothing at all
return null;
} else if (broadcasted) {
return (
}>
Sending Transaction...
);
} else if (signed) {
return (
broadcast()}>
Send Transaction
);
} else {
return (
: undefined}>
Generate & Sign Transaction
);
}
};
return (
{renderButton()}
{error && (
{error.message}
)}
{!broadcasted && !confirmed && (
)}
);
}