fix(error): Updated memo-get-gatsby

This commit is contained in:
Daniel Gonzalez
2020-09-24 20:34:50 -04:00
parent 97652daf51
commit 83b2e28a16
+24 -2
View File
@@ -3,10 +3,10 @@ import './footer.css'
import { Row, Col } from 'adminlte-2-react'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faGithub } from '@fortawesome/free-brands-svg-icons'
import { getWalletInfo } from '../localWallet'
// Get the IPFS hash from the BCH Blockchain.
import MemoGet from 'memo-get-gatsby'
const memoGet = new MemoGet()
let _this
@@ -19,12 +19,14 @@ class Footer extends React.Component {
ipfsHash: 'No Result',
ipfsHashLink: ''
}
// memo-get-gatsby Instance
this.memoGet = _this.instantiateMemoLib()
}
async componentDidMount () {
try {
const addr = 'bitcoincash:qq8mk8etntclfdkny2aknh4ylc0uaewalszh5eytnr'
const hash = await memoGet.read(addr)
const hash = await _this.memoGet.read(addr)
console.log(`hash: ${hash}`)
this.setState({
ipfsHash: hash,
@@ -46,6 +48,26 @@ class Footer extends React.Component {
// console.log(`balance: ${JSON.stringify(balance, null, 2)}`)
}
// Instantiate the library with the
// bchjs options established in the configuration section
instantiateMemoLib () {
// Get wallet info
const localStorageInfo = getWalletInfo()
// Get bchjs options
const jwtToken = localStorageInfo.JWT
const restURL = localStorageInfo.selectedServer
const bchjsOptions = {}
if (jwtToken) {
bchjsOptions.apiToken = jwtToken
}
if (restURL) {
bchjsOptions.restURL = restURL
}
return new MemoGet(bchjsOptions)
}
render () {
return (
<section id='footer'>