feat(price): Get price from minimal-slp-wallet and not bch-js

This commit is contained in:
Daniel Gonzalez
2022-03-16 13:12:00 -04:00
parent aa33b04c49
commit 44cd8a4fbe
4 changed files with 7 additions and 49 deletions
+3 -12
View File
@@ -64,7 +64,7 @@ class Servers extends React.Component {
type='primary'
onClick={_this.handleNewServerUrl}
/>
}
}
/>
)
: (
@@ -80,7 +80,7 @@ class Servers extends React.Component {
icon='fa-plus'
onClick={_this.handleTextField}
/>
}
}
/>
)}
</Col>
@@ -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