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 generateButtonColor =
Nothing.hasInstance(props.txn)
? 'blue'
: 'green'
const signerButtonColor =
Nothing.hasInstance(props.stx)
? 'blue'
: 'green'
const generateTxnButton =
const unsignedTxnDisplay = props.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 = props.web3.matchWith({
Just: _ =>
,
Nothing: _ =>
{ nonceDialogue }
{ chainDialogue }
})
const signTxnButton =
const signedTxnDisplay = props.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 = props.web3.matchWith({
Nothing: _ => '',
Just: _ =>
{ confirmButton }
{ sendTxnButton }
})
return (
{ generateTxnButton }
{ unsignedTxnDisplay }
{ gasPriceDialogue }
{ gasLimitDialogue }
{ onlineParamsDialogue }
{ signTxnButton }
{ signedTxnDisplay }
{ sendDialogue }
)
}
export default StatelessTransaction