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, showGasDetails, toggleGasDetails } = props
const { txn, stx, createUnsignedTxn } = props
const { canSign, canGenerate, canApprove } = props
const { setUserApproval, userApproval } = props
const { canSend, handleSubmit } = props
// TODO: Investigate
// setState doesn't seem to work in SetProxy/handleSubmit;
// - TypeError: Cannot read property 'updater' of undefined
// so just modifying the DOM manually here. (https://imgur.com/a/i0Qsyq1)
const handleRangeChange = (e) => {
setGasPrice(e.target.value);
}
const sendTxn = (e) => {
e.target.setAttribute("disabled", true);
let spinner = e.target.querySelectorAll('.btn-spinner')[0];
spinner.classList.remove('hide');
handleSubmit()
}
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) }
{ JSON.stringify(renderSignedTx(tx.value), null, 2) }