1import Maybe from 'folktale/maybe'
2import React from 'react'
4import { Code, H3 } from './Base'
5import { Button } from './Base'
6import { CheckboxButton, Input, InnerLabel } from './Base'
16const StatelessTransaction = props => {
18 const generateButtonColor = Maybe.Nothing.hasInstance(props.txn)
22 const signerButtonColor = Maybe.Nothing.hasInstance(props.stx)
31 prop-color={generateButtonColor}
33 disabled={ !props.canGenerate }
34 onClick={ () => props.createUnsignedTxn()}>
35 { 'Generate Transaction' }
44 const rendered = tx.value
47 <H3 className={'mt-8'}>{'Unsigned Transaction'}</H3>
48 <Code> {JSON.stringify(rendered, null, 2)} </Code>
59 prop-format='innerLabel'
60 value={ props.gasPrice }
61 onChange={ v => props.setGasPrice(v) }>
63 { 'Gas Price (gwei)' }
70 prop-format='innerLabel'
71 value={ props.gasLimit }
72 onChange={ v => props.setGasLimit(v) }>
79 props.web3.matchWith({
86 prop-format='innerLabel'
88 onChange={ v => props.setNonce(v) }>
95 className='mono mt-4 mb-8'
97 prop-format='innerLabel'
98 value={ props.chainId }
99 onChange={ v => props.setChainId(v) }>
109 disabled={ !props.canSign }
111 prop-size={'lg wide'}
112 prop-color={signerButtonColor}
113 onClick={ () => signTransaction({
114 wallet: props.wallet,
115 walletType: props.walletType,
116 walletHdPath: props.walletHdPath,
118 setStx: props.setStx,
120 chainId: props.chainId,
121 gasPrice: props.gasPrice,
122 gasLimit: props.gasLimit,
124 { 'Sign Transaction' }
129 props.stx.matchWith({
132 const rendered = renderSignedTx(tx.value)
135 <H3 className={'mt-8'}>{'Signed Transaction'}</H3>
136 <Code> {JSON.stringify(rendered, null, 2)} </Code>
144 props.web3.matchWith({
151 disabled={ !props.canApprove }
152 onClick={ () => props.setUserApproval() }
153 state={props.userApproval}>
155 { `I approve this transaction and wish to send.` }
159 prop-size={'xl wide'}
161 disabled={ !props.canSend }
162 onClick={ () => props.handleSubmit() }>
163 { 'Send Transaction' }
176export 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