fix(bch-message-lib): Removed dependence on this library

This commit is contained in:
Chris Troutner
2022-02-19 06:19:59 -08:00
parent 0478776a68
commit 352cbc3bf0
2 changed files with 51 additions and 50 deletions
+38 -38
View File
@@ -6,7 +6,7 @@ import { faGithub } from '@fortawesome/free-brands-svg-icons'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
// Get the IPFS hash from the BCH Blockchain. // Get the IPFS hash from the BCH Blockchain.
import Memo from '../../services/memo-hash' // import Memo from '../../services/memo-hash'
const siteConfig = require('../site-config') const siteConfig = require('../site-config')
let _this let _this
@@ -21,10 +21,10 @@ class Footer extends React.Component {
ipfsHashLink: '' ipfsHashLink: ''
} }
this.memo = new Memo({ // this.memo = new Memo({
bchWallet: props.bchWallet, // bchWallet: props.bchWallet,
bchAddr: siteConfig.memoAddr // bchAddr: siteConfig.memoAddr
}) // })
} }
async componentDidMount () { async componentDidMount () {
@@ -34,53 +34,53 @@ class Footer extends React.Component {
// This function retrieves the IPFS CID for the latest copy of this app. That // This function retrieves the IPFS CID for the latest copy of this app. That
// CID is written to the BCH blockchain. // CID is written to the BCH blockchain.
async handleMemoService () { // async handleMemoService () {
// This is a hard-coded hash or 'checkpoint' to use in times when the // // This is a hard-coded hash or 'checkpoint' to use in times when the
// connection fails. // // connection fails.
let hash = 'QmXT85Xoi7xMRD9m7Ta4Cx8Yrsd2WSzLrq2VRo26KW4xLu' // let hash = 'QmXT85Xoi7xMRD9m7Ta4Cx8Yrsd2WSzLrq2VRo26KW4xLu'
//
// Try to retrieve the hash from the BCH blockchain. // // Try to retrieve the hash from the BCH blockchain.
try { // try {
hash = await this.memo.findHash() // hash = await this.memo.findHash()
console.log(`IPFS hash found: ${hash}`) // console.log(`IPFS hash found: ${hash}`)
//
if (!hash) { // if (!hash) {
throw new Error('Hash not found! Falling back to hard coded IPFS hash.') // throw new Error('Hash not found! Falling back to hard coded IPFS hash.')
} // }
} catch (err) { // } catch (err) {
console.error('Error trying to retrieve IPFS hash for the site: ', err) // console.error('Error trying to retrieve IPFS hash for the site: ', err)
} // }
//
this.setState({ // this.setState({
ipfsHash: hash, // ipfsHash: hash,
ipfsHashLink: `https://ipfs.io/ipfs/${hash}` // ipfsHashLink: `https://ipfs.io/ipfs/${hash}`
}) // })
} // }
render () { render () {
return ( return (
<section id='footer'> <section id="footer">
<Row className='footer-container'> <Row className="footer-container">
<Col md={12} className='footer-section'> <Col md={12} className="footer-section">
<Row> <Row>
<Col md={12} className='mb-1'> <Col md={12} className="mb-1">
<p className='section-tittle'>Produced By</p> <p className="section-tittle">Produced By</p>
<a <a
href={siteConfig.hostUrl} href={siteConfig.hostUrl}
target='_blank' target="_blank"
rel='noopener noreferrer' rel="noopener noreferrer"
> >
{siteConfig.hostText} {siteConfig.hostText}
</a> </a>
</Col> </Col>
<Col md={12}> <Col md={12}>
<p className='section-tittle'>Source Code</p> <p className="section-tittle">Source Code</p>
<FontAwesomeIcon className='' size='lg' icon={faGithub} /> <FontAwesomeIcon className="" size="lg" icon={faGithub} />
<a <a
href={siteConfig.sourceCode} href={siteConfig.sourceCode}
target='_blank' target="_blank"
rel='noopener noreferrer' rel="noopener noreferrer"
> >
Github Github
</a> </a>
+13 -12
View File
@@ -9,18 +9,18 @@ export default function HTML (props) {
return ( return (
<html {...props.htmlAttributes}> <html {...props.htmlAttributes}>
<head> <head>
<meta charSet='utf-8' /> <meta charSet="utf-8" />
<meta httpEquiv='x-ua-compatible' content='ie=edge' /> <meta httpEquiv="x-ua-compatible" content="ie=edge" />
<meta <meta
name='viewport' name="viewport"
content='width=device-width, initial-scale=1, shrink-to-fit=no' content="width=device-width, initial-scale=1, shrink-to-fit=no"
/> />
{/* Loading animation should be loaded very first thing. */} {/* Loading animation should be loaded very first thing. */}
<div <div
className='test' className="test"
key='loader' key="loader"
id='___loader' id="___loader"
style={{ style={{
alignItems: 'center', alignItems: 'center',
backgroundColor: '#F2F2F2', backgroundColor: '#F2F2F2',
@@ -34,15 +34,16 @@ export default function HTML (props) {
zIndex: 9000, zIndex: 9000,
flexDirection: 'column' flexDirection: 'column'
}} }}
><img src='https://i.imgur.com/8n8PYAi.gif' alt='' width='250' /> >
<img src="https://i.imgur.com/8n8PYAi.gif" alt="" width="250" />
Loading... Loading...
</div> </div>
{/* minimal-slp-wallet */} {/* minimal-slp-wallet */}
<script src='https://unpkg.com/minimal-slp-wallet' /> <script src="https://unpkg.com/minimal-slp-wallet" />
{/* bch-message-lib */} {/* bch-message-lib */}
<script src='https://unpkg.com/bch-message-lib' /> {/* <script src='https://unpkg.com/bch-message-lib' /> */}
{props.headComponents} {props.headComponents}
</head> </head>
@@ -50,8 +51,8 @@ export default function HTML (props) {
{props.preBodyComponents} {props.preBodyComponents}
<div> <div>
<div <div
key='body' key="body"
id='___gatsby' id="___gatsby"
dangerouslySetInnerHTML={{ __html: props.body }} dangerouslySetInnerHTML={{ __html: props.body }}
/> />
</div> </div>