diff --git a/package.json b/package.json index 3a640a3..5acece6 100644 --- a/package.json +++ b/package.json @@ -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 ", "contributors": [ diff --git a/src/components/admin-lte/index.js b/src/components/admin-lte/index.js index 85c5a09..8c4b1a4 100644 --- a/src/components/admin-lte/index.js +++ b/src/components/admin-lte/index.js @@ -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 diff --git a/src/components/admin-lte/tokens/index.js b/src/components/admin-lte/tokens/index.js index 332a1ee..f529ae5 100644 --- a/src/components/admin-lte/tokens/index.js +++ b/src/components/admin-lte/tokens/index.js @@ -31,22 +31,22 @@ class Tokens extends React.Component { return ( <> - - + + {_this.state.txId} @@ -71,46 +71,46 @@ class Tokens extends React.Component { )} {_this.state.inFetch ? ( -
- Loading... -
+
+ Loading... +
) : ( - - {_this.state.errMsg && ( - - - - {_this.state.errMsg} - - - - )} + + {_this.state.errMsg && ( + + + + {_this.state.errMsg} + + + + )} - {_this.state.tokens.length > 0 && ( - <> - - {_this.state.tokens.map((val, i) => { - if (val.qty > 0) { - return ( - - - - ) - } else { - return - } - })} - - - )} - + {_this.state.tokens.length > 0 && ( + <> + + {_this.state.tokens.map((val, i) => { + if (val.qty > 0) { + return ( + + + + ) + } else { + return + } + })} + + + )} + )} FullStack.cash
@@ -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 diff --git a/src/components/admin-lte/tokens/send-tokens.js b/src/components/admin-lte/tokens/send-tokens.js index 5d6b36a..4474ede 100644 --- a/src/components/admin-lte/tokens/send-tokens.js +++ b/src/components/admin-lte/tokens/send-tokens.js @@ -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() diff --git a/src/components/admin-lte/wallet/create.js b/src/components/admin-lte/wallet/create.js index be7a471..6c81939 100644 --- a/src/components/admin-lte/wallet/create.js +++ b/src/components/admin-lte/wallet/create.js @@ -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 { - +

New Wallet

- +