diff --git a/src/routes/v3/bitcore.js b/src/routes/v3/bitcore.js index 1379d90..79475ff 100644 --- a/src/routes/v3/bitcore.js +++ b/src/routes/v3/bitcore.js @@ -48,7 +48,7 @@ async function balanceFromBitcore(thisAddress) { const path = `${process.env.BITCORE_URL}api/BCH/${network}/address/${addr}/balance` - console.log(`path: ${path}`) + //console.log(`path: ${path}`) // Query the Bitcore Node API. const axiosResponse = await axios.get(path) diff --git a/src/routes/v3/insight/address.js b/src/routes/v3/insight/address.js index 1e8d180..f2e1c1a 100644 --- a/src/routes/v3/insight/address.js +++ b/src/routes/v3/insight/address.js @@ -45,16 +45,8 @@ function root(req, res, next) { // Returns a Promise. async function detailsFromInsight(thisAddress, currentPage = 0) { try { - /* - let addr - - if ( - process.env.BITCOINCOM_BASEURL === "https://bch-insight.bitpay.com/api/" - ) - addr = bchjs.Address.toCashAddress(thisAddress) - else addr = bchjs.Address.toLegacyAddress(thisAddress) - */ - const addr = bchjs.Address.toLegacyAddress(thisAddress) + //const addr = bchjs.Address.toLegacyAddress(thisAddress) + const addr = bchjs.Address.toCashAddress(thisAddress) let path = `${process.env.BITCOINCOM_BASEURL}addr/${addr}` @@ -64,7 +56,7 @@ async function detailsFromInsight(thisAddress, currentPage = 0) { const to = from + PAGE_SIZE path = `${path}?from=${from}&to=${to}` - //console.log(`path: ${path}`) + console.log(`insight path: ${path}`) // Query the Insight server. const axiosResponse = await axios.get(path) @@ -238,12 +230,7 @@ async function detailsSingle(req, res, next) { // Retrieve UTXO data from the Insight API async function utxoFromInsight(thisAddress) { try { - let addr - if ( - process.env.BITCOINCOM_BASEURL === "https://bch-insight.bitpay.com/api/" - ) - addr = bchjs.Address.toCashAddress(thisAddress) - else addr = bchjs.Address.toLegacyAddress(thisAddress) + const addr = bchjs.Address.toCashAddress(thisAddress) const path = `${process.env.BITCOINCOM_BASEURL}addr/${addr}/utxo` diff --git a/src/routes/v3/insight/index.js b/src/routes/v3/insight/index.js index 52133bc..8f3c11f 100644 --- a/src/routes/v3/insight/index.js +++ b/src/routes/v3/insight/index.js @@ -17,8 +17,8 @@ const router = express.Router() const util = require("util") util.inspect.defaultOptions = { depth: 1 } -const BCHJS = require("@chris.troutner/bch-js") -const bchjs = new BCHJS() +//const BCHJS = require("@chris.troutner/bch-js") +//const bchjs = new BCHJS() //const BITCORE_URL = process.env.BITCORE_URL diff --git a/src/routes/v3/route-utils.js b/src/routes/v3/route-utils.js index ae512b5..be11a4e 100644 --- a/src/routes/v3/route-utils.js +++ b/src/routes/v3/route-utils.js @@ -73,7 +73,7 @@ function validateNetwork(addr) { // Dynamically set these based on env vars. Allows unit testing. function setEnvVars() { - const BITBOXHTTP = axios.create({ + const BitboxHTTP = axios.create({ baseURL: process.env.RPC_BASEURL }) const username = process.env.RPC_USERNAME