Added mutable data back in

This commit is contained in:
Chris Troutner
2022-02-02 11:11:29 -08:00
parent 82d529642f
commit 2786cf4075
5 changed files with 4772 additions and 335 deletions
+4672 -236
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -58,6 +58,7 @@
"react-redux": "7.2.4",
"semver": "7.3.5",
"sharp": "0.29.3",
"slp-mutable-data": "^1.4.1",
"stream-browserify": "3.0.0",
"stream-http": "3.2.0"
},
+62 -62
View File
@@ -6,7 +6,7 @@ import TokenModal from './token-modal'
import Spinner from '../../../images/loader.gif'
// import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import SendTokens from './send-tokens'
// import { SlpMutableData } from 'slp-mutable-data'
import { SlpMutableData } from 'slp-mutable-data'
let _this
class Tokens extends React.Component {
constructor (props) {
@@ -31,22 +31,22 @@ class Tokens extends React.Component {
return (
<>
<Button
text='Refresh'
icon='fa-redo'
type='primary'
className='btn-md ml-1 mt-1 mb-1'
text="Refresh"
icon="fa-redo"
type="primary"
className="btn-md ml-1 mt-1 mb-1"
onClick={() => _this.handleGetTokens(true)}
/>
{_this.state.txId && (
<div className='txIdContainer'>
<div className="txIdContainer">
<button onClick={() => _this.setState({ txId: null })}>
&times;
</button>
<Col xs={12} className='text-center mt-1'>
<Box title='Transaction ID' type='primary' className='p-0'>
<Col xs={12} className="text-center mt-1">
<Box title="Transaction ID" type="primary" className="p-0">
<a
target='_blank'
rel='noopener noreferrer'
target="_blank"
rel="noopener noreferrer"
href={`${_this.state.explorerURL}/${_this.state.txId}`}
>
{_this.state.txId}
@@ -71,46 +71,46 @@ class Tokens extends React.Component {
)}
{_this.state.inFetch
? (
<div className='spinner'>
<img alt='Loading...' src={Spinner} width={100} />
</div>
<div className="spinner">
<img alt="Loading..." src={Spinner} width={100} />
</div>
)
: (
<Content>
{_this.state.errMsg && (
<Box padding='true' className='container-nofound'>
<Row>
<Col xs={12}>
<em>{_this.state.errMsg}</em>
</Col>
</Row>
</Box>
)}
<Content>
{_this.state.errMsg && (
<Box padding="true" className="container-nofound">
<Row>
<Col xs={12}>
<em>{_this.state.errMsg}</em>
</Col>
</Row>
</Box>
)}
{_this.state.tokens.length > 0 && (
<>
<Row>
{_this.state.tokens.map((val, i) => {
if (val.qty > 0) {
return (
<Col sm={4} key={`token-${i}`}>
<TokenCard
key={`token-${i}`}
id={`token-${i}`}
token={val}
showToken={_this.showToken}
selectToken={_this.selectToken}
/>
</Col>
)
} else {
return <span key={`token-${i}`} />
}
})}
</Row>
</>
)}
</Content>
{_this.state.tokens.length > 0 && (
<>
<Row>
{_this.state.tokens.map((val, i) => {
if (val.qty > 0) {
return (
<Col sm={4} key={`token-${i}`}>
<TokenCard
key={`token-${i}`}
id={`token-${i}`}
token={val}
showToken={_this.showToken}
selectToken={_this.selectToken}
/>
</Col>
)
} else {
return <span key={`token-${i}`} />
}
})}
</Row>
</>
)}
</Content>
)}
<TokenModal
bchWallet={_this.props.bchWallet}
@@ -227,9 +227,9 @@ class Tokens extends React.Component {
Rate limits exceeded, increase rate limits with a JWT token from
<a
style={{ marginLeft: '5px' }}
target='_blank'
href='https://fullstack.cash'
rel='noopener noreferrer'
target="_blank"
href="https://fullstack.cash"
rel="noopener noreferrer"
>
FullStack.cash
</a>
@@ -271,21 +271,21 @@ class Tokens extends React.Component {
async handleMutableData (tokensArr) {
try {
const tokens = []
// const slpMutableLib = new SlpMutableData()
const slpMutableLib = new SlpMutableData()
for (let i = 0; i < tokensArr.length; i++) {
const token = tokensArr[i]
// try {
// const data = await slpMutableLib.get.mutableData(token.tokenId)
// token.mutableData = data
// // console.log(`data: ${JSON.stringify(data, null, 2)}`)
// } catch (error) {
// // console.warn(error)
// // Skip error
// console.log(
// `Could not access mutable data for ${token.ticker} (${token.tokenId})`
// )
// }
try {
const data = await slpMutableLib.get.mutableData(token.tokenId)
token.mutableData = data
// console.log(`data: ${JSON.stringify(data, null, 2)}`)
} catch (error) {
// console.warn(error)
// Skip error
console.log(
`Could not access mutable data for ${token.ticker} (${token.tokenId})`
)
}
tokens.push(token)
}
+14 -14
View File
@@ -26,31 +26,31 @@ class NewWallet extends React.Component {
<Col sm={2} />
<Col sm={8}>
<Box
className="hover-shadow border-none mt-2"
className='hover-shadow border-none mt-2'
loaded={!_this.state.inFetch}
>
<Row>
<Col sm={12} className="text-center">
<Col sm={12} className='text-center'>
<h1>
<FontAwesomeIcon
className="title-icon"
size="xs"
icon="plus"
className='title-icon'
size='xs'
icon='plus'
/>
<span>New Wallet</span>
</h1>
</Col>
<Col sm={12} className="text-center mt-2 mb-2">
<Col sm={12} className='text-center mt-2 mb-2'>
<Button
text="Create Wallet"
type="primary"
className="btn-lg"
text='Create Wallet'
type='primary'
className='btn-lg'
onClick={_this.handleCreateWallet}
/>
</Col>
<Col sm={12} className="text-center ">
<Col sm={12} className='text-center '>
{_this.state.errMsg && (
<p className="error-color mt-2">{_this.state.errMsg}</p>
<p className='error-color mt-2'>{_this.state.errMsg}</p>
)}
</Col>
</Row>
@@ -171,9 +171,9 @@ class NewWallet extends React.Component {
Rate limits exceeded, increase rate limits with a JWT token from
<a
style={{ marginLeft: '5px' }}
target="_blank"
href="https://fullstack.cash"
rel="noopener noreferrer"
target='_blank'
href='https://fullstack.cash'
rel='noopener noreferrer'
>
FullStack.cash
</a>
+23 -23
View File
@@ -26,51 +26,51 @@ class ImportWallet extends React.Component {
render () {
return (
<Row className="">
<Row className=''>
<Col sm={2} />
<Col sm={8}>
<Box
className="hover-shadow border-none mt-2"
className='hover-shadow border-none mt-2'
loaded={!_this.state.inFetch}
>
<Row>
<Col sm={12} className="text-center">
<Col sm={12} className='text-center'>
<h1>
<FontAwesomeIcon
className="title-icon"
size="xs"
icon="file-import"
className='title-icon'
size='xs'
icon='file-import'
/>
<span>Import Wallet</span>
</h1>
</Col>
<Col sm={12} className="text-center mt-2 mb-2">
<Row className="flex justify-content-center">
<Col sm={12} className='text-center mt-2 mb-2'>
<Row className='flex justify-content-center'>
<Col sm={8}>
<form autoComplete="off">
<form autoComplete='off'>
<Text
id="import-mnemonic"
name="mnemonic"
placeholder="12 word mnemonic"
label="12 word mnemonic"
labelPosition="above"
id='import-mnemonic'
name='mnemonic'
placeholder='12 word mnemonic'
label='12 word mnemonic'
labelPosition='above'
onChange={_this.handleUpdate}
/>
</form>
</Col>
</Row>
</Col>
<Col sm={12} className="text-center mb-2">
<Col sm={12} className='text-center mb-2'>
<Button
text="Import"
type="primary"
className="btn-lg"
text='Import'
type='primary'
className='btn-lg'
onClick={_this.handleImportWallet}
/>
</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>
)}
</Col>
</Row>
@@ -237,9 +237,9 @@ class ImportWallet extends React.Component {
Rate limits exceeded, increase rate limits with a JWT token from
<a
style={{ marginLeft: '5px' }}
target="_blank"
href="https://fullstack.cash"
rel="noopener noreferrer"
target='_blank'
href='https://fullstack.cash'
rel='noopener noreferrer'
>
FullStack.cash
</a>