import { Nothing } from 'folktale/maybe' import React from 'react' import { Code, H3 } from './Base' import { Button } from './Base' import { CheckboxButton, Input, InnerLabel } from './Base' import { renderSignedTx, signTransaction } from '../lib/txn' const StatelessTransaction = props => { const { web3, gasPrice, gasLimit, nonce, chainId } = props const { setNonce, setChainId, setGasLimit, setGasPrice } = props const { txn, stx, createUnsignedTxn } = props const { canSign, canGenerate, canApprove } = props const { setUserApproval, userApproval } = props const { canSend, handleSubmit } = props const generateButtonColor = Nothing.hasInstance(txn) ? 'blue' : 'green' const signerButtonColor = Nothing.hasInstance(stx) ? 'blue' : 'green' const generateTxnButton = const unsignedTxnDisplay = txn.matchWith({ Nothing: _ => '', Just: tx =>

{ 'Unsigned Transaction' }

{ JSON.stringify(tx.value, null, 2) }
}) const gasPriceDialogue = { 'Gas Price (gwei)' } const gasLimitDialogue = { 'Gas Limit' } const nonceDialogue = { 'Nonce' } const chainDialogue = { 'Chain ID' } const onlineParamsDialogue = web3.matchWith({ Just: _ =>
, Nothing: _ => { nonceDialogue } { chainDialogue } }) const signTxnButton = const signedTxnDisplay = stx.matchWith({ Nothing: _ => '', Just: tx =>

{ 'Signed Transaction' }

{ JSON.stringify(renderSignedTx(tx.value), null, 2) }
}) const confirmButton =
{ `I approve this transaction and wish to send.` }
const sendTxnButton = const sendDialogue = web3.matchWith({ Nothing: _ => '', Just: _ => { confirmButton } { sendTxnButton } }) return ( { generateTxnButton } { unsignedTxnDisplay } { gasPriceDialogue } { gasLimitDialogue } { onlineParamsDialogue } { signTxnButton } { signedTxnDisplay } { sendDialogue } ) } export default StatelessTransaction