mirror of
https://github.com/fullstack-cash/fullstack-gatsby-theme-bch-wallet.git
synced 2026-09-21 16:52:06 -07:00
Removing mutable token data again. Too slow
This commit is contained in:
Generated
+111
-4633
File diff suppressed because it is too large
Load Diff
+1
-2
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "fullstack-gatsby-theme-bch-wallet",
|
||||
"description": "A GatsbyJS Theme with AdminLTE integration and basic Bitcoin Cash wallet functionality.",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"main": "index.js",
|
||||
"author": "Chris Troutner <chris.troutner@gmail.com>",
|
||||
"contributors": [
|
||||
@@ -58,7 +58,6 @@
|
||||
"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"
|
||||
},
|
||||
|
||||
@@ -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 })}>
|
||||
×
|
||||
</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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user