@@ -1,4 +1,4 @@
1−import { Maybe, Nothing } from 'folktale/maybe'
1+import { Maybe, Nothing, Just } from 'folktale/maybe'
2import React from 'react'
2import React from 'react'
4import { Code, H3 } from './Base'
4import { Code, H3 } from './Base'
@@ -38,7 +38,8 @@ class StatelessTransaction extends React.Component {
38 this.handleSubmit = this.handleSubmit.bind(this)
38 this.handleSubmit = this.handleSubmit.bind(this)
39 this.handleSetUserApproval = this.handleSetUserApproval.bind(this)
39 this.handleSetUserApproval = this.handleSetUserApproval.bind(this)
40 this.handleSetTxn = this.handleSetTxn.bind(this)
40 this.handleSetTxn = this.handleSetTxn.bind(this)
41− this.handleSetStx = this.handleSetStx.bind(this)
41+ this.setStx = this.setStx.bind(this)
42+ this.sendTxn = this.sendTxn.bind(this)
42 this.handleSetNonce = this.handleSetNonce.bind(this)
43 this.handleSetNonce = this.handleSetNonce.bind(this)
43 this.handleSetChainId = this.handleSetChainId.bind(this)
44 this.handleSetChainId = this.handleSetChainId.bind(this)
44 this.handleSetGasPrice = this.handleSetGasPrice.bind(this)
45 this.handleSetGasPrice = this.handleSetGasPrice.bind(this)
@@ -90,7 +91,8 @@ class StatelessTransaction extends React.Component {
90 props.pushRoute(ROUTE_NAMES.SENT_TRANSACTION)
91 props.pushRoute(ROUTE_NAMES.SENT_TRANSACTION)
92 .catch(err => {
93 .catch(err => {
94+ console.log('err = ', err)
93− this.setState({ txError: err.map(val => val.merge()) })
95+ // this.setState({ txError: err.map(val => val.merge()) })
@@ -105,7 +107,7 @@ class StatelessTransaction extends React.Component {
108− handleSetStx(stx){
110+ setStx(stx){
109 this.setState({
111 this.setState({
111 userApproval: false,
113 userApproval: false,
@@ -124,8 +126,8 @@ class StatelessTransaction extends React.Component {
124 handleClearTxn() {
126 handleClearTxn() {
125 this.setState({
127 this.setState({
126 userApproval: false,
128 userApproval: false,
127− txn: Maybe.Nothing(),
129+ txn: Nothing(),
128− stx: Maybe.Nothing(),
130+ stx: Nothing(),
@@ -156,7 +158,7 @@ class StatelessTransaction extends React.Component {
156 handleClearStx() {
158 handleClearStx() {
157 this.setState({
159 this.setState({
158 userApproval: false,
160 userApproval: false,
159− stx: Maybe.Nothing(),
161+ stx: Nothing(),
@@ -173,17 +175,19 @@ class StatelessTransaction extends React.Component {
175 render() {
177 render() {
176− const { web3, createUnsignedTxn, canGenerate } = this.props
178+ const { web3, canGenerate } = this.props
177− const { gasPrice, gasLimit, nonce, chainId, txn, stx, userApproval } = this.state
179+ const { gasPrice, gasLimit, nonce, chainId,
180+ txn, stx, userApproval } = this.state
179− const { setNonce, setChainId, setGasLimit, setGasPrice, handleSubmit } = this
182+ const { setNonce, setChainId, setGasLimit, setGasPrice,
180− const { showGasDetails, toggleGasDetails, setUserApproval, sendTxn } = this
183+ handleSubmit, showGasDetails, toggleGasDetails, handleSetUserApproval,
184+ sendTxn, handleCreateUnsignedTxn } = this
182 const { state } = this
186 const { state } = this
184− const canSign = Maybe.Just.hasInstance(state.txn)
188+ const canSign = Just.hasInstance(state.txn)
185− const canApprove = Maybe.Just.hasInstance(state.stx)
189+ const canApprove = Just.hasInstance(state.stx)
186− const canSend = Maybe.Just.hasInstance(state.stx) && state.userApproval === true
190+ const canSend = Just.hasInstance(state.stx) && state.userApproval === true
188 const generateButtonColor =
192 const generateButtonColor =
189 Nothing.hasInstance(txn)
193 Nothing.hasInstance(txn)
@@ -201,7 +205,7 @@ class StatelessTransaction extends React.Component {
201 disabled={ !canGenerate }
205 disabled={ !canGenerate }
202 prop-color={ generateButtonColor }
206 prop-color={ generateButtonColor }
203 prop-size={ 'lg wide' }
207 prop-size={ 'lg wide' }
204− onClick={ createUnsignedTxn }
208+ onClick={ handleCreateUnsignedTxn }
206 { 'Generate Transaction' }
210 { 'Generate Transaction' }
207 </Button>
211 </Button>
@@ -319,7 +323,7 @@ class StatelessTransaction extends React.Component {
319 className={ 'mt-8' }
323 className={ 'mt-8' }
320 prop-size={ 'lg wide' }
324 prop-size={ 'lg wide' }
321 prop-color={ signerButtonColor }
325 prop-color={ signerButtonColor }
322− onClick={ () => signTransaction(this.props) }
326+ onClick={ () => signTransaction({...this.props, ...this.state, setStx: this.setStx}) }
324 { 'Sign Transaction' }
328 { 'Sign Transaction' }
325 </Button>
329 </Button>
@@ -341,7 +345,7 @@ class StatelessTransaction extends React.Component {
341 <CheckboxButton
345 <CheckboxButton
342 className={ 'mt-8' }
346 className={ 'mt-8' }
343 disabled={ !canApprove }
347 disabled={ !canApprove }
344− onClick={ setUserApproval }
348+ onClick={ handleSetUserApproval }
345 state={ userApproval }
349 state={ userApproval }
@@ -371,7 +375,7 @@ class StatelessTransaction extends React.Component {
371 </React.Fragment>
375 </React.Fragment>
374− const txnErrorDialogue = Maybe.Nothing.hasInstance(state.txError)
378+ const txnErrorDialogue = Nothing.hasInstance(state.txError)
376 : <Warning className={'mt-8'}>
380 : <Warning className={'mt-8'}>
377 <H3 style={{marginTop: 0, paddingTop: 0}}>
381 <H3 style={{marginTop: 0, paddingTop: 0}}>