Skip to content

Commit

Permalink
Merge pull request #16 from Permissionless-Software-Foundation/dh-pri…
Browse files Browse the repository at this point in the history
…ce-calls

feat(price): Get price from minimal-slp-wallet and not bch-js
  • Loading branch information
christroutner committed Mar 16, 2022
2 parents aa33b04 + 44cd8a4 commit dacfa24
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 49 deletions.
15 changes: 3 additions & 12 deletions src/components/admin-lte/configure/servers.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class Servers extends React.Component {
type='primary'
onClick={_this.handleNewServerUrl}
/>
}
}
/>
)
: (
Expand All @@ -80,7 +80,7 @@ class Servers extends React.Component {
icon='fa-plus'
onClick={_this.handleTextField}
/>
}
}
/>
)}
</Col>
Expand Down Expand Up @@ -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
Expand Down
20 changes: 2 additions & 18 deletions src/components/admin-lte/send-receive/send.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
11 changes: 1 addition & 10 deletions src/components/admin-lte/wallet/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 1 addition & 9 deletions src/components/admin-lte/wallet/import.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dacfa24

Please sign in to comment.