mirror of
https://github.com/fullstack-cash/fullstack-gatsby-theme-bch-wallet.git
synced 2026-09-21 16:52:06 -07:00
Merge pull request #16 from Permissionless-Software-Foundation/dh-price-calls
feat(price): Get price from minimal-slp-wallet and not bch-js
This commit is contained in:
@@ -303,16 +303,7 @@ class Servers extends React.Component {
|
|||||||
await bchWalletLib.walletInfoPromise
|
await bchWalletLib.walletInfoPromise
|
||||||
const myBalance = await bchWalletLib.getBalance()
|
const myBalance = await bchWalletLib.getBalance()
|
||||||
|
|
||||||
const bchjs = bchWalletLib.bchjs
|
const currentRate = (await bchWalletLib.getUsd()) * 100
|
||||||
|
|
||||||
let currentRate
|
|
||||||
|
|
||||||
if (bchjs.restURL.includes('abc.fullstack')) {
|
|
||||||
currentRate = (await bchjs.Price.getBchaUsd()) * 100
|
|
||||||
} else {
|
|
||||||
// BCHN price.
|
|
||||||
currentRate = (await bchjs.Price.getUsd()) * 100
|
|
||||||
}
|
|
||||||
|
|
||||||
_this.setState({
|
_this.setState({
|
||||||
currentRate: currentRate
|
currentRate: currentRate
|
||||||
|
|||||||
@@ -284,16 +284,8 @@ class Send extends React.Component {
|
|||||||
// update balance
|
// update balance
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
const myBalance = await bchWalletLib.getBalance()
|
const myBalance = await bchWalletLib.getBalance()
|
||||||
const bchjs = bchWalletLib.bchjs
|
|
||||||
|
|
||||||
let currentRate
|
const currentRate = (await bchWalletLib.getUsd()) * 100
|
||||||
|
|
||||||
if (bchjs.restURL.includes('abc.fullstack')) {
|
|
||||||
currentRate = (await bchjs.Price.getBchaUsd()) * 100
|
|
||||||
} else {
|
|
||||||
// BCHN price.
|
|
||||||
currentRate = (await bchjs.Price.getUsd()) * 100
|
|
||||||
}
|
|
||||||
|
|
||||||
_this.props.updateBalance({ myBalance, currentRate })
|
_this.props.updateBalance({ myBalance, currentRate })
|
||||||
}, 1000)
|
}, 1000)
|
||||||
@@ -365,16 +357,8 @@ class Send extends React.Component {
|
|||||||
// update balance
|
// update balance
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
const myBalance = await bchWalletLib.getBalance()
|
const myBalance = await bchWalletLib.getBalance()
|
||||||
const bchjs = bchWalletLib.bchjs
|
|
||||||
|
|
||||||
let currentRate
|
const currentRate = (await bchWalletLib.getUsd()) * 100
|
||||||
|
|
||||||
if (bchjs.restURL.includes('abc.fullstack')) {
|
|
||||||
currentRate = (await bchjs.Price.getBchaUsd()) * 100
|
|
||||||
} else {
|
|
||||||
// BCHN price.
|
|
||||||
currentRate = (await bchjs.Price.getUsd()) * 100
|
|
||||||
}
|
|
||||||
|
|
||||||
_this.props.updateBalance({ myBalance, currentRate })
|
_this.props.updateBalance({ myBalance, currentRate })
|
||||||
}, 1000)
|
}, 1000)
|
||||||
|
|||||||
@@ -97,16 +97,7 @@ class NewWallet extends React.Component {
|
|||||||
|
|
||||||
const myBalance = await bchWalletLib.getBalance()
|
const myBalance = await bchWalletLib.getBalance()
|
||||||
|
|
||||||
const bchjs = bchWalletLib.bchjs
|
const currentRate = (await bchWalletLib.getUsd()) * 100
|
||||||
|
|
||||||
let currentRate
|
|
||||||
|
|
||||||
if (bchjs.restURL.includes('abc.fullstack')) {
|
|
||||||
currentRate = (await bchjs.Price.getBchaUsd()) * 100
|
|
||||||
} else {
|
|
||||||
// BCHN price.
|
|
||||||
currentRate = (await bchjs.Price.getUsd()) * 100
|
|
||||||
}
|
|
||||||
|
|
||||||
// console.log("myBalance", myBalance)
|
// console.log("myBalance", myBalance)
|
||||||
// Update redux state
|
// Update redux state
|
||||||
|
|||||||
@@ -135,15 +135,7 @@ class ImportWallet extends React.Component {
|
|||||||
Object.assign(currentWallet, walletInfo)
|
Object.assign(currentWallet, walletInfo)
|
||||||
|
|
||||||
const myBalance = await bchWalletLib.getBalance()
|
const myBalance = await bchWalletLib.getBalance()
|
||||||
const bchjs = bchWalletLib.bchjs
|
const currentRate = (await bchWalletLib.getUsd()) * 100
|
||||||
let currentRate
|
|
||||||
|
|
||||||
if (bchjs.restURL.includes('abc.fullstack')) {
|
|
||||||
currentRate = (await bchjs.Price.getBchaUsd()) * 100
|
|
||||||
} else {
|
|
||||||
// BCHN price.
|
|
||||||
currentRate = (await bchjs.Price.getUsd()) * 100
|
|
||||||
}
|
|
||||||
|
|
||||||
_this.setState({
|
_this.setState({
|
||||||
currentRate: currentRate
|
currentRate: currentRate
|
||||||
|
|||||||
Reference in New Issue
Block a user