Add BCH to bitpay.js
This commit is contained in:
parent
d20104249f
commit
e232a7713e
1 changed files with 2 additions and 2 deletions
|
|
@ -2,11 +2,11 @@ const axios = require('axios')
|
||||||
const BN = require('../../../bn')
|
const BN = require('../../../bn')
|
||||||
|
|
||||||
function ticker (account, fiatCode, cryptoCode) {
|
function ticker (account, fiatCode, cryptoCode) {
|
||||||
if (cryptoCode !== 'BTC') {
|
if (!_.includes(cryptoCode, ['BTC', 'BCH'])) {
|
||||||
return Promise.reject('Unsupported crypto: ' + cryptoCode)
|
return Promise.reject('Unsupported crypto: ' + cryptoCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
return axios.get('https://bitpay.com/api/rates/' + fiatCode)
|
return axios.get('https://bitpay.com/api/rates/' + cryptoCode '/' + fiatCode)
|
||||||
.then(r => {
|
.then(r => {
|
||||||
const data = r.data
|
const data = r.data
|
||||||
const price = BN(data.rate)
|
const price = BN(data.rate)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue