mirror of
https://github.com/fullstack-cash/fullstack-gatsby-theme-bch-wallet.git
synced 2026-09-21 16:52:06 -07:00
fix(upstream): Fixing merge conflicts with upstream gatsby-theme-bch-wallet
This commit is contained in:
+1
-1
@@ -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.1",
|
||||
"version": "1.0.2",
|
||||
"main": "index.js",
|
||||
"author": "Chris Troutner <chris.troutner@gmail.com>",
|
||||
"contributors": [
|
||||
|
||||
@@ -132,16 +132,20 @@ class AdminLTEPage extends React.Component {
|
||||
await bchWalletLib.walletInfoPromise
|
||||
const myBalance = await bchWalletLib.getBalance()
|
||||
|
||||
const bchjs = bchWalletLib.bchjs
|
||||
// const bchjs = bchWalletLib.bchjs
|
||||
|
||||
let currentRate
|
||||
const currentRate = (await bchWalletLib.getUsd()) * 100
|
||||
console.log('currentRate: ', currentRate)
|
||||
|
||||
if (bchjs.restURL.includes('abc.fullstack')) {
|
||||
currentRate = (await bchjs.Price.getBchaUsd()) * 100
|
||||
} else {
|
||||
// BCHN price.
|
||||
currentRate = (await bchjs.Price.getUsd()) * 100
|
||||
}
|
||||
// if (bchjs.restURL.includes('abc.fullstack')) {
|
||||
// currentRate = (await bchjs.Price.getBchaUsd()) * 100
|
||||
// } else if (siteConfig.interface === 'consumer-api') {
|
||||
// bchjs.restURL = `${siteConfig.restURL}/`
|
||||
// currentRate = (await bchjs.Price.getUsd()) * 100
|
||||
// } else {
|
||||
// // BCHN price.
|
||||
// currentRate = (await bchjs.Price.getUsd()) * 100
|
||||
// }
|
||||
|
||||
_this.setState({
|
||||
currentRate: currentRate
|
||||
|
||||
@@ -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>
|
||||
@@ -297,10 +297,12 @@ class Tokens extends React.Component {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Tokens.propTypes = {
|
||||
walletInfo: PropTypes.object.isRequired, // wallet info
|
||||
bchWallet: PropTypes.object, // get minimal-slp-wallet instance
|
||||
setTokensInfo: PropTypes.func.isRequired, // set tokens info
|
||||
tokensInfo: PropTypes.array // tokens info
|
||||
}
|
||||
|
||||
export default Tokens
|
||||
|
||||
@@ -6,6 +6,8 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
||||
import ScannerModal from '../../qr-scanner/modal'
|
||||
const { Text } = Inputs
|
||||
|
||||
const siteConfig = require('../../site-config')
|
||||
|
||||
const BchWallet = typeof window !== 'undefined' ? window.SlpWallet : null
|
||||
|
||||
let _this
|
||||
@@ -216,12 +218,23 @@ class SendTokens extends React.Component {
|
||||
const result = await bchWalletLib.sendTokens(receiver, 5.0)
|
||||
// console.log('result: ', result)
|
||||
|
||||
_this.setState({
|
||||
txId: result,
|
||||
inFetch: false
|
||||
})
|
||||
if (siteConfig.interface === 'consumer-api') {
|
||||
_this.setState({
|
||||
txId: result.txid,
|
||||
inFetch: false
|
||||
})
|
||||
|
||||
_this.props.setTxId(result) /* Set the transaction ID in Tokens state */
|
||||
// Set the transaction ID in Tokens state
|
||||
_this.props.setTxId(result.txid)
|
||||
} else {
|
||||
_this.setState({
|
||||
txId: result,
|
||||
inFetch: false
|
||||
})
|
||||
|
||||
// Set the transaction ID in Tokens state
|
||||
_this.props.setTxId(result)
|
||||
}
|
||||
|
||||
_this.resetValues()
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@ import { Row, Col, Box, Button } from 'adminlte-2-react'
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
||||
// import BchWallet from 'minimal-slp-wallet'
|
||||
|
||||
const siteConfig = require('../../site-config')
|
||||
|
||||
const BchWallet = typeof window !== 'undefined' ? window.SlpWallet : null
|
||||
|
||||
let _this
|
||||
@@ -26,31 +28,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>
|
||||
@@ -137,6 +139,7 @@ class NewWallet extends React.Component {
|
||||
|
||||
if (_interface === 'consumer-api') {
|
||||
bchjsOptions.interface = _interface
|
||||
bchjsOptions.restURL = siteConfig.restURL
|
||||
return bchjsOptions
|
||||
}
|
||||
|
||||
@@ -171,9 +174,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>
|
||||
|
||||
@@ -4,6 +4,8 @@ import { Row, Col, Box, Button, Inputs } from 'adminlte-2-react'
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
||||
// import BchWallet from 'minimal-slp-wallet'
|
||||
|
||||
const siteConfig = require('../../site-config')
|
||||
|
||||
const BchWallet = typeof window !== 'undefined' ? window.SlpWallet : null
|
||||
|
||||
const { Text } = Inputs
|
||||
@@ -26,51 +28,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>
|
||||
@@ -178,6 +180,7 @@ class ImportWallet extends React.Component {
|
||||
|
||||
if (_interface === 'consumer-api') {
|
||||
bchjsOptions.interface = _interface
|
||||
bchjsOptions.restURL = siteConfig.restURL
|
||||
return bchjsOptions
|
||||
}
|
||||
|
||||
@@ -237,9 +240,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>
|
||||
|
||||
@@ -29,9 +29,11 @@ class Footer extends React.Component {
|
||||
|
||||
async componentDidMount () {
|
||||
// Get hash using memo service
|
||||
await this.handleMemoService()
|
||||
// await this.handleMemoService()
|
||||
}
|
||||
|
||||
// This function retrieves the IPFS CID for the latest copy of this app. That
|
||||
// CID is written to the BCH blockchain.
|
||||
async handleMemoService () {
|
||||
// This is a hard-coded hash or 'checkpoint' to use in times when the
|
||||
// connection fails.
|
||||
@@ -59,7 +61,7 @@ class Footer extends React.Component {
|
||||
return (
|
||||
<section id='footer'>
|
||||
<Row className='footer-container'>
|
||||
<Col md={5} className='footer-section'>
|
||||
<Col md={12} className='footer-section'>
|
||||
<Row>
|
||||
<Col md={12} className='mb-1'>
|
||||
<p className='section-tittle'>Produced By</p>
|
||||
@@ -85,52 +87,6 @@ class Footer extends React.Component {
|
||||
</Col>
|
||||
</Row>
|
||||
</Col>
|
||||
<Col md={7} className='footer-section'>
|
||||
<div className='pull-right'>
|
||||
<p className='section-tittle'>Ways to access this web-app</p>
|
||||
<ul>
|
||||
<li id='web'>
|
||||
<span>
|
||||
<b>Web</b>
|
||||
</span>
|
||||
<b className='bar-space'>|</b>
|
||||
<a href={siteConfig.clearWebUrl}>{siteConfig.clearWebUrl}</a>
|
||||
</li>
|
||||
|
||||
<li id='tor'>
|
||||
<span>
|
||||
<b>Tor</b>
|
||||
</span>
|
||||
<b className='bar-space'>|</b>
|
||||
<a href={`http://${siteConfig.torUrl}`}>
|
||||
{siteConfig.torUrl}
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li id='ipfs'>
|
||||
<span>
|
||||
<b>IPFS</b>
|
||||
</span>
|
||||
<b className='bar-space'>|</b>
|
||||
<a href={_this.state.ipfsHashLink}>{this.state.ipfsHash}</a>
|
||||
</li>
|
||||
|
||||
<li id='memo'>
|
||||
<span>
|
||||
<b>Memo</b>
|
||||
</span>
|
||||
<b className='bar-space'>|</b>
|
||||
<a
|
||||
href={`https://memo.cash/profile/${siteConfig.memoAddr}`}
|
||||
target='_blank'
|
||||
rel='noopener noreferrer'
|
||||
>
|
||||
{siteConfig.memoAddr}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</Col>
|
||||
</Row>
|
||||
</section>
|
||||
)
|
||||
|
||||
@@ -14,11 +14,19 @@ const config = {
|
||||
memoAddr: 'bitcoincash:qqwdv3hkmvd5vk0uhwqrqnef54542e5ctvy3ppt0nq',
|
||||
|
||||
// Footer Information
|
||||
hostText: 'FullStack.cash',
|
||||
hostUrl: 'https://fullstack.cash/',
|
||||
sourceCode: 'https://github.com/Permissionless-Software-Foundation/gatsby-ipfs-web-wallet',
|
||||
hostText: 'Permissionless Software Foundation',
|
||||
hostUrl: 'https://psfoundation.cash/',
|
||||
sourceCode:
|
||||
'https://github.com/Permissionless-Software-Foundation/gatsby-theme-bch-wallet',
|
||||
torUrl: '2egutot63q765ciwsenlcy5zdyxwxt7olzbldr5dx5i3ixsef2nvrzid.onion',
|
||||
clearWebUrl: 'https://gatsby-ipfs-web-wallet.fullstack.cash'
|
||||
clearWebUrl: 'https://gatsby-ipfs-web-wallet.fullstack.cash',
|
||||
|
||||
// Interface used by minial-slp-wallet
|
||||
interface: 'consumer-api',
|
||||
restURL: 'https://free-bch.fullstack.cash'
|
||||
// restURL: 'http://localhost:5005'
|
||||
// interface: 'rest-api',
|
||||
// restURL: 'https://bchn.fullstack.cash/v5/'
|
||||
}
|
||||
|
||||
module.exports = config
|
||||
|
||||
@@ -4,6 +4,8 @@ import { getWalletInfo, setWalletInfo } from '../components/localWallet'
|
||||
// import BchWallet from 'minimal-slp-wallet'
|
||||
const BchWallet = typeof window !== 'undefined' ? window.SlpWallet : null
|
||||
|
||||
const siteConfig = require('../components/site-config')
|
||||
|
||||
const reducer = (state, action) => {
|
||||
// Update walletInfo state property
|
||||
if (action.type === 'SET_WALLET_INFO') {
|
||||
@@ -100,6 +102,7 @@ const getBchjsOptions = () => {
|
||||
|
||||
if (_interface === 'consumer-api') {
|
||||
bchjsOptions.interface = _interface
|
||||
bchjsOptions.restURL = siteConfig.restURL
|
||||
return bchjsOptions
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user