diff --git a/package.json b/package.json index 986e388..901597d 100644 --- a/package.json +++ b/package.json @@ -11,14 +11,14 @@ "test": "nyc mocha --timeout 30000 test/unit/", "test:integration": "bash test/integration/test-bchn-integration.sh", "test:integration:bchn": "bash test/integration/test-bchn-integration.sh", - "test:integration:abc": "RESTURL=https://abc.fullstack.cash/v3/ IS_USING_FREE_TIER=true mocha --timeout 30000 test/integration/", + "test:integration:abc": "RESTURL=https://abc.fullstack.cash/v4/ IS_USING_FREE_TIER=true mocha --timeout 30000 test/integration/", "test:integration:testnet": "IS_USING_FREE_TIER=true mocha --timeout 30000 test/integration/testnet/", - "test:integration:local": "RESTURL=http://localhost:3000/v3/ mocha --timeout 30000 test/integration", - "test:integration:local:bchn": "RESTURL=http://localhost:3000/v3/ bash test/integration/test-bchn-integration.sh", - "test:integration:local:testnet": "RESTURL=http://localhost:4000/v3/ mocha --timeout 30000 test/integration/testnet", - "test:temp": "RESTURL=http://bchn.fullstack.cash/v3/ mocha --timeout 30000 -g '#validateTxid' test/integration/bchn/", - "test:temp2": "RESTURL=http://abc.fullstack.cash/v3/ mocha --timeout 30000 -g '#validateTxid' test/integration/", - "test:integration:api": "RESTURL=https://api.fullstack.cash/v3/ mocha --timeout 30000 test/integration", + "test:integration:local": "RESTURL=http://localhost:3000/v4/ mocha --timeout 30000 test/integration", + "test:integration:local:bchn": "RESTURL=http://localhost:3000/v4/ bash test/integration/test-bchn-integration.sh", + "test:integration:local:testnet": "RESTURL=http://localhost:4000/v4/ mocha --timeout 30000 test/integration/testnet", + "test:temp": "RESTURL=http://bchn.fullstack.cash/v4/ mocha --timeout 30000 -g '#validateTxid' test/integration/bchn/", + "test:temp2": "RESTURL=http://abc.fullstack.cash/v4/ mocha --timeout 30000 -g '#validateTxid' test/integration/", + "test:integration:api": "RESTURL=https://api.fullstack.cash/v4/ mocha --timeout 30000 test/integration", "coverage": "nyc report --reporter=text-lcov | coveralls", "coverage:report": "nyc --reporter=html mocha --timeout 25000 test/unit/", "docs": "./node_modules/.bin/apidoc -i src/ -o docs" diff --git a/src/address.js b/src/address.js index 841a9ee..7b52ed8 100644 --- a/src/address.js +++ b/src/address.js @@ -6,7 +6,7 @@ const coininfo = require("coininfo") class Address { constructor(config) { const tmp = {} - if (!config || !config.restURL) tmp.restURL = `https://api.bchjs.cash/v3/` + if (!config || !config.restURL) tmp.restURL = `https://api.bchjs.cash/v4/` else tmp.restURL = config.restURL this.restURL = tmp.restURL diff --git a/src/bch-js.js b/src/bch-js.js index 8777ba5..175fd66 100644 --- a/src/bch-js.js +++ b/src/bch-js.js @@ -7,8 +7,7 @@ */ // bch-api mainnet. -// const DEFAULT_REST_API = "https://api.bchjs.cash/v3/" -const DEFAULT_REST_API = "https://api.fullstack.cash/v3/" +const DEFAULT_REST_API = "https://api.fullstack.cash/v4/" // local deps const BitcoinCash = require("./bitcoincash") diff --git a/test/e2e/rate-limits/anonymous-rate-limits.js b/test/e2e/rate-limits/anonymous-rate-limits.js index 462dd98..4c2585c 100644 --- a/test/e2e/rate-limits/anonymous-rate-limits.js +++ b/test/e2e/rate-limits/anonymous-rate-limits.js @@ -14,9 +14,9 @@ const assert = require("chai").assert -// const RESTURL = `https://abc.fullstack.cash/v3/` -const RESTURL = `https://bchn.fullstack.cash/v3/` -// const RESTURL = `http://localhost:3000/v3/` +// const RESTURL = `https://abc.fullstack.cash/v4/` +const RESTURL = `https://bchn.fullstack.cash/v4/` +// const RESTURL = `http://localhost:3000/v4/` const BCHJS = require("../../../src/bch-js") const bchjs = new BCHJS({ restURL: RESTURL }) diff --git a/test/e2e/rate-limits/basic-auth-rate-limits.js b/test/e2e/rate-limits/basic-auth-rate-limits.js index c311e11..958d1a8 100644 --- a/test/e2e/rate-limits/basic-auth-rate-limits.js +++ b/test/e2e/rate-limits/basic-auth-rate-limits.js @@ -13,9 +13,9 @@ const PRO_PASS = "testpassword" const BCHJS = require("../../../src/bch-js") const bchjs = new BCHJS({ - // restURL: `https://bchn.fullstack.cash/v3/`, - restURL: `https://abc.fullstack.cash/v3/`, - // restURL: `http://localhost:3000/v3/`, + // restURL: `https://bchn.fullstack.cash/v4/`, + restURL: `https://abc.fullstack.cash/v4/`, + // restURL: `http://localhost:3000/v4/`, authPass: PRO_PASS }) diff --git a/test/e2e/rate-limits/free-rate-limits.js b/test/e2e/rate-limits/free-rate-limits.js index 736b9a8..e540be5 100644 --- a/test/e2e/rate-limits/free-rate-limits.js +++ b/test/e2e/rate-limits/free-rate-limits.js @@ -18,8 +18,8 @@ const JWT_TOKEN = const BCHJS = require("../../../src/bch-js") const bchjs = new BCHJS({ - restURL: `https://api.fullstack.cash/v3/`, - // restURL: `http://localhost:3000/v3/`, + restURL: `https://api.fullstack.cash/v4/`, + // restURL: `http://localhost:3000/v4/`, apiToken: JWT_TOKEN }) diff --git a/test/e2e/rate-limits/full-node-rate-limits.js b/test/e2e/rate-limits/full-node-rate-limits.js index 98b69fa..51d142a 100644 --- a/test/e2e/rate-limits/full-node-rate-limits.js +++ b/test/e2e/rate-limits/full-node-rate-limits.js @@ -18,9 +18,9 @@ const JWT_TOKEN = const BCHJS = require("../../../src/bch-js") const bchjs = new BCHJS({ - // restURL: `https://bchn.fullstack.cash/v3/`, - restURL: `https:/abc.fullstack.cash/v3/`, - // restURL: `http://localhost:3000/v3/`, + // restURL: `https://bchn.fullstack.cash/v4/`, + restURL: `https:/abc.fullstack.cash/v4/`, + // restURL: `http://localhost:3000/v4/`, apiToken: JWT_TOKEN }) diff --git a/test/e2e/rate-limits/indexer-rate-limits.js b/test/e2e/rate-limits/indexer-rate-limits.js index 7bee43e..a17ee9e 100644 --- a/test/e2e/rate-limits/indexer-rate-limits.js +++ b/test/e2e/rate-limits/indexer-rate-limits.js @@ -14,9 +14,9 @@ const JWT_TOKEN = const BCHJS = require("../../../src/bch-js") const bchjs = new BCHJS({ - // restURL: `https://bchn.fullstack.cash/v3/`, - restURL: `https://abc.fullstack.cash/v3/`, - // restURL: `http://localhost:3000/v3/`, + // restURL: `https://bchn.fullstack.cash/v4/`, + restURL: `https://abc.fullstack.cash/v4/`, + // restURL: `http://localhost:3000/v4/`, apiToken: JWT_TOKEN }) diff --git a/test/integration/test-bchn-integration.sh b/test/integration/test-bchn-integration.sh index edff741..fcc7811 100755 --- a/test/integration/test-bchn-integration.sh +++ b/test/integration/test-bchn-integration.sh @@ -1,7 +1,7 @@ #!/bin/bash -# export RESTURL=https://bchn.fullstack.cash/v3/ -#export RESTURL=http://localhost:3000/v3/ +# export RESTURL=https://bchn.fullstack.cash/v4/ +#export RESTURL=http://localhost:3000/v4/ #export IS_USING_FREE_TIER=true cd test/integration/bchn/ diff --git a/test/integration/testnet/blockbook.js b/test/integration/testnet/blockbook.js index d278d5d..5f653c9 100644 --- a/test/integration/testnet/blockbook.js +++ b/test/integration/testnet/blockbook.js @@ -8,11 +8,11 @@ const assert = chai.assert const RESTURL = process.env.RESTURL ? process.env.RESTURL - : `https://testnet3.fullstack.cash/v3/` + : `https://testnet3.fullstack.cash/v4/` // if (process.env.RESTURL) RESTURL = process.env.RESTURL const BCHJS = require("../../../src/bch-js") -// const bchjs = new BCHJS({ restURL: `https://testnet.bchjs.cash/v3/` }) +// const bchjs = new BCHJS({ restURL: `https://testnet.bchjs.cash/v4/` }) const bchjs = new BCHJS({ restURL: RESTURL, apiToken: process.env.BCHJSTOKEN }) // const bchjs = new BCHJS({ restURL: RESTURL }) //const axios = require("axios") diff --git a/test/integration/testnet/blockchain.js b/test/integration/testnet/blockchain.js index 859c3ac..41b2d46 100644 --- a/test/integration/testnet/blockchain.js +++ b/test/integration/testnet/blockchain.js @@ -12,11 +12,11 @@ const assert = chai.assert const RESTURL = process.env.RESTURL ? process.env.RESTURL - : "https://testnet3.fullstack.cash/v3/" + : "https://testnet3.fullstack.cash/v4/" // if (process.env.RESTURL) RESTURL = process.env.RESTURL const BCHJS = require("../../../src/bch-js") -// const bchjs = new BCHJS({ restURL: `https://testnet.bchjs.cash/v3/` }) +// const bchjs = new BCHJS({ restURL: `https://testnet.bchjs.cash/v4/` }) const bchjs = new BCHJS({ restURL: RESTURL, apiToken: process.env.BCHJSTOKEN }) // Inspect utility used for debugging. diff --git a/test/integration/testnet/control.js b/test/integration/testnet/control.js index 102e0b0..028fb68 100644 --- a/test/integration/testnet/control.js +++ b/test/integration/testnet/control.js @@ -7,7 +7,7 @@ const assert = chai.assert const RESTURL = process.env.RESTURL ? process.env.RESTURL - : `https://testnet3.fullstack.cash/v3/` + : `https://testnet3.fullstack.cash/v4/` const BCHJS = require("../../../src/bch-js") const bchjs = new BCHJS({ restURL: RESTURL, apiToken: process.env.BCHJSTOKEN }) diff --git a/test/integration/testnet/electrumx.js b/test/integration/testnet/electrumx.js index f4898c0..3e914ff 100644 --- a/test/integration/testnet/electrumx.js +++ b/test/integration/testnet/electrumx.js @@ -4,7 +4,7 @@ const sinon = require("sinon") const RESTURL = process.env.RESTURL ? process.env.RESTURL - : `https://testnet3.fullstack.cash/v3/` + : `https://testnet3.fullstack.cash/v4/` const BCHJS = require("../../../src/bch-js") const bchjs = new BCHJS({ restURL: RESTURL, apiToken: process.env.BCHJSTOKEN }) diff --git a/test/integration/testnet/rawtransaction.js b/test/integration/testnet/rawtransaction.js index a79d009..4da6767 100644 --- a/test/integration/testnet/rawtransaction.js +++ b/test/integration/testnet/rawtransaction.js @@ -10,11 +10,11 @@ const assert = chai.assert const RESTURL = process.env.RESTURL ? process.env.RESTURL - : `https://testnet3.fullstack.cash/v3/` + : `https://testnet3.fullstack.cash/v4/` // if (process.env.RESTURL) RESTURL = process.env.RESTURL const BCHJS = require("../../../src/bch-js") -// const bchjs = new BCHJS({ restURL: `https://testnet.bchjs.cash/v3/` }) +// const bchjs = new BCHJS({ restURL: `https://testnet.bchjs.cash/v4/` }) const bchjs = new BCHJS({ restURL: RESTURL, apiToken: process.env.BCHJSTOKEN }) // Inspect utility used for debugging. diff --git a/test/integration/testnet/slp.js b/test/integration/testnet/slp.js index d3d6c57..41c4b7f 100644 --- a/test/integration/testnet/slp.js +++ b/test/integration/testnet/slp.js @@ -7,11 +7,11 @@ const assert = chai.assert const RESTURL = process.env.RESTURL ? process.env.RESTURL - : `https://testnet3.fullstack.cash/v3/` + : `https://testnet3.fullstack.cash/v4/` // if (process.env.RESTURL) RESTURL = process.env.RESTURL const BCHJS = require("../../../src/bch-js") -// const bchjs = new BCHJS({ restURL: `https://testnet.bchjs.cash/v3/` }) +// const bchjs = new BCHJS({ restURL: `https://testnet.bchjs.cash/v4/` }) const bchjs = new BCHJS({ restURL: RESTURL, apiToken: process.env.BCHJSTOKEN }) // Inspect utility used for debugging. diff --git a/test/integration/testnet/test-free-tier.sh b/test/integration/testnet/test-free-tier.sh index dd12f28..1558ce2 100755 --- a/test/integration/testnet/test-free-tier.sh +++ b/test/integration/testnet/test-free-tier.sh @@ -1,6 +1,6 @@ #!/bin/bash -export RESTURL=https://free-test.fullstack.cash/v3/ +export RESTURL=https://free-test.fullstack.cash/v4/ export NETWORK=testnet export IS_USING_FREE_TIER=true diff --git a/test/integration/testnet/util.js b/test/integration/testnet/util.js index 0a5c2e7..7a77d37 100644 --- a/test/integration/testnet/util.js +++ b/test/integration/testnet/util.js @@ -8,11 +8,11 @@ const assert = chai.assert const RESTURL = process.env.RESTURL ? process.env.RESTURL - : `https://testnet3.fullstack.cash/v3/` + : `https://testnet3.fullstack.cash/v4/` // if (process.env.RESTURL) RESTURL = process.env.RESTURL const BCHJS = require("../../../src/bch-js") -// const bchjs = new BCHJS({ restURL: `https://testnet.bchjs.cash/v3/` }) +// const bchjs = new BCHJS({ restURL: `https://testnet.bchjs.cash/v4/` }) const bchjs = new BCHJS({ restURL: RESTURL, apiToken: process.env.BCHJSTOKEN }) // Inspect utility used for debugging. diff --git a/test/unit/slp-utils.js b/test/unit/slp-utils.js index 47b88cc..70223ca 100644 --- a/test/unit/slp-utils.js +++ b/test/unit/slp-utils.js @@ -2,10 +2,10 @@ const assert = require("assert") const assert2 = require("chai").assert const SLP = require("../../src/slp/slp") -//const slp = new SLP("http://decatur.hopto.org:12400/v3/") +//const slp = new SLP("http://decatur.hopto.org:12400/v4/") //const slp = new SLP("https://rest.bitcoin.com/v2/") const slp = new SLP({ - restURL: "https://api.fullstack.cash/v3/", + restURL: "https://api.fullstack.cash/v4/", apiToken: process.env.BCHJSTOKEN }) @@ -1979,7 +1979,7 @@ describe("#SLP Utils", () => { "3a4b628cbcc183ab376d44ce5252325f042268307ffa4a53443e92b6d24fb488" ] - const result = await bchjs.SLP.Utils.validateTxid(txids) + const result = await slp.Utils.validateTxid(txids) console.log(`result: ${JSON.stringify(result, null, 2)}`) }) })