diff --git a/src/price.js b/src/price.js index c1703fe..c285170 100644 --- a/src/price.js +++ b/src/price.js @@ -29,21 +29,6 @@ class Price { this.axios = axios } - // This endpoint is deprecated. Documentation removed. - // async current (currency = 'usd') { - // try { - // const response = await this.axios.get( - // `https://index-api.bitcoin.com/api/v0/cash/price/${currency.toLowerCase()}` - // ) - // // console.log(`response.data: ${JSON.stringify(response.data, null, 2)}`) - // - // return response.data.price - // } catch (err) { - // if (err.response && err.response.data) throw err.response.data - // else throw err - // } - // } - /** * @api price.getUsd() getUsd() * @apiName Price getUsd() @@ -122,80 +107,6 @@ class Price { } } - /** - * @api price.getBchaUsd() getBchaUsd() - * @apiName Price getBchaUsd() - * @apiGroup Price - * @apiDescription Return current price of BCHA in USD. - * This endpoint gets the USD price of XEC from the Coinex API. The price - * denominated in BCHA comes from bch-api, so it has a better chance of - * working in Tor. - * - * @apiExample Example usage: - *(async () => { - * try { - * let current = await bchjs.Price.getBchaUsd(); - * console.log(current); - * } catch(err) { - * console.error(err) - * } - *})() - * - * // 212.34 - */ - async getBchaUsd () { - try { - const response = await this.axios.get( - `${this.restURL}price/bchausd`, - this.axiosOptions - ) - // console.log(`response.data: ${JSON.stringify(response.data, null, 2)}`) - - const bchaPrice = response.data.usd * 1000000 - // Convert XEC denomination to BCHA denomination - - return bchaPrice - } catch (err) { - if (err.response && err.response.data) throw err.response.data - else throw err - } - } - - /** - * @api price.getXecUsd() getXecUsd() - * @apiName Price getXecUsd() - * @apiGroup Price - * @apiDescription Return current price of XEC in USD. - * This endpoint gets the USD price of XEC from the Coinex API. The price - * comes from bch-api, so it has a better chance of working in Tor. - * - * @apiExample Example usage: - *(async () => { - * try { - * let current = await bchjs.Price.getXecUsd(); - * console.log(current); - * } catch(err) { - * console.error(err) - * } - *})() - * - * // 0.00021234 - */ - async getXecUsd () { - try { - const response = await this.axios.get( - `${this.restURL}price/bchausd`, - this.axiosOptions - ) - // console.log(`response.data: ${JSON.stringify(response.data, null, 2)}`) - - return response.data.usd - } catch (err) { - if (err.response && err.response.data) throw err.response.data - else throw err - } - } - /** * @api price.getBchUsd() getBchUsd() * @apiName Price getBchUsd() diff --git a/test/integration/electrumx.js b/test/integration/electrumx.js index b4b17f7..005f7cf 100644 --- a/test/integration/electrumx.js +++ b/test/integration/electrumx.js @@ -385,7 +385,6 @@ describe('#ElectrumX', () => { assert.isAbove(sortedTransactions[0].height, sortedTransactions[1].height) }) }) - }) function sleep (ms) { diff --git a/test/integration/price.js b/test/integration/price.js index c295067..48e3c44 100644 --- a/test/integration/price.js +++ b/test/integration/price.js @@ -8,33 +8,6 @@ describe('#price', () => { if (process.env.IS_USING_FREE_TIER) await sleep(1500) }) - // describe('#current', () => { - // describe('#single currency', () => { - // it('should get current price for single currency', async () => { - // const result = await bchjs.Price.current('usd') - // assert.notEqual(0, result) - // }) - // }) - // }) - - describe('#getUsd', () => { - it('should get the USD price of BCH', async () => { - const result = await bchjs.Price.getUsd() - // console.log(result) - - assert.isNumber(result) - }) - }) - - describe('#getBchaUsd', () => { - it('should get the USD price of BCHA', async () => { - const result = await bchjs.Price.getBchaUsd() - console.log(result) - - assert.isNumber(result) - }) - }) - describe('#getBchUsd', () => { it('should get the USD price of BCH', async () => { const result = await bchjs.Price.getBchUsd() @@ -44,16 +17,6 @@ describe('#price', () => { }) }) - describe('#rates', () => { - it('should get the price of BCH in several currencies', async () => { - const result = await bchjs.Price.rates() - // console.log(result) - - assert.property(result, 'USD') - assert.property(result, 'CAD') - }) - }) - describe('#getPsffppPrice', () => { it('should get the price of BCH in several currencies', async () => { const result = await bchjs.Price.getPsffppPrice()