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:
Chris Troutner
2022-03-16 11:49:27 -07:00
committed by GitHub
4 changed files with 7 additions and 49 deletions
+1 -10
View File
@@ -303,16 +303,7 @@ class Servers extends React.Component {
await bchWalletLib.walletInfoPromise
const myBalance = await bchWalletLib.getBalance()
const bchjs = bchWalletLib.bchjs
let currentRate
if (bchjs.restURL.includes('abc.fullstack')) {
currentRate = (await bchjs.Price.getBchaUsd()) * 100
} else {
// BCHN price.
currentRate = (await bchjs.Price.getUsd()) * 100
}
const currentRate = (await bchWalletLib.getUsd()) * 100
_this.setState({
currentRate: currentRate
+2 -18
View File
@@ -284,16 +284,8 @@ class Send extends React.Component {
// update balance
setTimeout(async () => {
const myBalance = await bchWalletLib.getBalance()
const bchjs = bchWalletLib.bchjs
let currentRate
if (bchjs.restURL.includes('abc.fullstack')) {
currentRate = (await bchjs.Price.getBchaUsd()) * 100
} else {
// BCHN price.
currentRate = (await bchjs.Price.getUsd()) * 100
}
const currentRate = (await bchWalletLib.getUsd()) * 100
_this.props.updateBalance({ myBalance, currentRate })
}, 1000)
@@ -365,16 +357,8 @@ class Send extends React.Component {
// update balance
setTimeout(async () => {
const myBalance = await bchWalletLib.getBalance()
const bchjs = bchWalletLib.bchjs
let currentRate
if (bchjs.restURL.includes('abc.fullstack')) {
currentRate = (await bchjs.Price.getBchaUsd()) * 100
} else {
// BCHN price.
currentRate = (await bchjs.Price.getUsd()) * 100
}
const currentRate = (await bchWalletLib.getUsd()) * 100
_this.props.updateBalance({ myBalance, currentRate })
}, 1000)
+1 -10
View File
@@ -97,16 +97,7 @@ class NewWallet extends React.Component {
const myBalance = await bchWalletLib.getBalance()
const bchjs = bchWalletLib.bchjs
let currentRate
if (bchjs.restURL.includes('abc.fullstack')) {
currentRate = (await bchjs.Price.getBchaUsd()) * 100
} else {
// BCHN price.
currentRate = (await bchjs.Price.getUsd()) * 100
}
const currentRate = (await bchWalletLib.getUsd()) * 100
// console.log("myBalance", myBalance)
// Update redux state
+1 -9
View File
@@ -135,15 +135,7 @@ class ImportWallet extends React.Component {
Object.assign(currentWallet, walletInfo)
const myBalance = await bchWalletLib.getBalance()
const bchjs = bchWalletLib.bchjs
let currentRate
if (bchjs.restURL.includes('abc.fullstack')) {
currentRate = (await bchjs.Price.getBchaUsd()) * 100
} else {
// BCHN price.
currentRate = (await bchjs.Price.getUsd()) * 100
}
const currentRate = (await bchWalletLib.getUsd()) * 100
_this.setState({
currentRate: currentRate