mirror of
https://github.com/fullstack-cash/fullstack-gatsby-theme-bch-wallet.git
synced 2026-09-21 16:52:06 -07:00
Fixed UTXO issue in token send. Ran into Andre's issue
This commit is contained in:
@@ -29,67 +29,66 @@ class SendTokens extends React.Component {
|
||||
<>
|
||||
<Row>
|
||||
<Col sm={12}>
|
||||
<Box className=' border-none mt-2'>
|
||||
<Box className=" border-none mt-2">
|
||||
<Row>
|
||||
<Col sm={12} className='text-center'>
|
||||
<h1 id='SendTokens'>
|
||||
<Col sm={12} className="text-center">
|
||||
<h1 id="SendTokens">
|
||||
<FontAwesomeIcon
|
||||
className='title-icon'
|
||||
size='xs'
|
||||
icon='paper-plane'
|
||||
className="title-icon"
|
||||
size="xs"
|
||||
icon="paper-plane"
|
||||
/>
|
||||
<span>Send</span>
|
||||
</h1>
|
||||
|
||||
<Box className='border-none'>
|
||||
<Box className="border-none">
|
||||
<Text
|
||||
id='addressToSend'
|
||||
name='address'
|
||||
placeholder='Enter simpleledger address to send'
|
||||
label='SLP Address'
|
||||
labelPosition='above'
|
||||
id="addressToSend"
|
||||
name="address"
|
||||
placeholder="Enter simpleledger address to send"
|
||||
label="SLP Address"
|
||||
labelPosition="above"
|
||||
onChange={_this.handleUpdate}
|
||||
className='title-icon'
|
||||
className="title-icon"
|
||||
buttonRight={
|
||||
<Button
|
||||
icon='fa-qrcode'
|
||||
onClick={_this.handleModal}
|
||||
/>
|
||||
<Button icon="fa-qrcode" onClick={_this.handleModal} />
|
||||
}
|
||||
/>
|
||||
|
||||
<Text
|
||||
id='amountToSend'
|
||||
name='amountSat'
|
||||
placeholder='Enter amount to send'
|
||||
label='Amount'
|
||||
labelPosition='above'
|
||||
id="amountToSend"
|
||||
name="amountSat"
|
||||
placeholder="Enter amount to send"
|
||||
label="Amount"
|
||||
labelPosition="above"
|
||||
onChange={_this.handleUpdate}
|
||||
/>
|
||||
<Button
|
||||
text='Close'
|
||||
type='primary'
|
||||
className='btn-lg mr-2'
|
||||
text="Close"
|
||||
type="primary"
|
||||
className="btn-lg mr-2"
|
||||
onClick={_this.props.handleBack}
|
||||
/>
|
||||
<Button
|
||||
text='Send'
|
||||
type='primary'
|
||||
className='btn-lg '
|
||||
text="Send"
|
||||
type="primary"
|
||||
className="btn-lg "
|
||||
onClick={_this.handleSend}
|
||||
/>
|
||||
|
||||
</Box>
|
||||
</Col>
|
||||
<Col sm={12} className='text-center'>
|
||||
<Col sm={12} className="text-center">
|
||||
{_this.state.errMsg && (
|
||||
<p className='error-color'>{_this.state.errMsg}</p>
|
||||
<p className="error-color">{_this.state.errMsg}</p>
|
||||
)}
|
||||
{_this.state.txId && (
|
||||
<p className=''>Transaction ID: {_this.state.txId}</p>
|
||||
<p className="">Transaction ID: {_this.state.txId}</p>
|
||||
)}
|
||||
{name && (
|
||||
<span>
|
||||
Selected Token : <b>{name}</b>
|
||||
</span>
|
||||
)}
|
||||
{name && <span>Selected Token : <b>{name}</b></span>}
|
||||
|
||||
</Col>
|
||||
</Row>
|
||||
</Box>
|
||||
@@ -137,16 +136,17 @@ class SendTokens extends React.Component {
|
||||
|
||||
// Ensure the wallet UTXOs are up-to-date.
|
||||
const walletAddr = bchWalletLib.walletInfo.address
|
||||
bchWalletLib.utxos.bchUtxos = await bchWalletLib.utxos.initUtxoStore(
|
||||
walletAddr
|
||||
)
|
||||
bchWalletLib.utxos.tokenUtxos = await bchWalletLib.utxos.initUtxoStore(
|
||||
walletAddr
|
||||
)
|
||||
const utxoStore = await bchWalletLib.utxos.initUtxoStore(walletAddr)
|
||||
console.log(`utxoStore: ${JSON.stringify(utxoStore, null, 2)}`)
|
||||
|
||||
// For some reason, the utxo categories do not get populated, so we have
|
||||
// to do it manually.
|
||||
bchWalletLib.utxos.bchUtxos = await bchWalletLib.utxos.getBchUtxos()
|
||||
bchWalletLib.utxos.tokenUtxos = await bchWalletLib.utxos.getTokenUtxos()
|
||||
|
||||
// Send token.
|
||||
const result = await bchWalletLib.sendTokens(receiver)
|
||||
// console.log('result',result)
|
||||
console.log('result: ', result)
|
||||
|
||||
_this.setState({
|
||||
txId: result
|
||||
|
||||
Reference in New Issue
Block a user