1import { Nothing } from 'folktale/maybe'
2import React from 'react'
4import { Code, H3 } from './Base'
5import { Button } from './Base'
6import { CheckboxButton, Input, InnerLabel } from './Base'
13const StatelessTransaction = props => {
15 const generateButtonColor =
16 Nothing.hasInstance(props.txn)
20 const signerButtonColor =
21 Nothing.hasInstance(props.stx)
25 const generateTxnButton =
28 disabled={ !props.canGenerate }
29 prop-color={ generateButtonColor }
30 prop-size={ 'lg wide' }
31 onClick={ () => props.createUnsignedTxn() }
33 { 'Generate Transaction' }
36 const unsignedTxnDisplay = props.txn.matchWith({
40 <H3 className={ 'mt-8' }>
41 { 'Unsigned Transaction' }
44 { JSON.stringify(tx.value, null, 2) }
49 const gasPriceDialogue =
51 className={ 'mono mt-4' }
53 prop-format={ 'innerLabel' }
54 value={ props.gasPrice }
55 onChange={ props.setGasPrice }
58 { 'Gas Price (gwei)' }
62 const gasLimitDialogue =
64 className={ 'mono mt-4' }
66 prop-format={ 'innerLabel' }
67 value={ props.gasLimit }
68 onChange={ props.setGasLimit }>
76 className={ 'mono mt-4' }
78 prop-format={ 'innerLabel' }
80 onChange={ props.setNonce }
89 className={ 'mono mt-4 mb-8' }
91 prop-format={ 'innerLabel' }
92 value={ props.chainId }
93 onChange={ props.setChainId }
100 const onlineParamsDialogue = props.web3.matchWith({
109 const signTxnButton =
111 disabled={ !props.canSign }
113 prop-size={ 'lg wide' }
114 prop-color={ signerButtonColor }
115 onClick={ () => signTransaction(props) }
117 { 'Sign Transaction' }
120 const signedTxnDisplay = props.stx.matchWith({
124 <H3 className={ 'mt-8' }>
125 { 'Signed Transaction' }
128 { JSON.stringify(renderSignedTx(tx.value), null, 2) }
133 const confirmButton =
136 disabled={ !props.canApprove }
137 onClick={ props.setUserApproval }
138 state={ props.userApproval }
141 { `I approve this transaction and wish to send.` }
145 const sendTxnButton =
147 prop-size={ 'xl wide' }
149 disabled={ !props.canSend }
150 onClick={ props.handleSubmit }
152 { 'Send Transaction' }
155 const sendDialogue = props.web3.matchWith({
166 { generateTxnButton }
167 { unsignedTxnDisplay }
171 { onlineParamsDialogue }
183export default StatelessTransaction
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