mirror of
https://github.com/Permissionless-Software-Foundation/bch-js.git
synced 2026-09-21 16:51:59 -07:00
Merge pull request #149 from Permissionless-Software-Foundation/ct-unstable
feat(/v5 REST API): Using the new v5 route in bch-api
This commit is contained in:
+1
-1
@@ -6,7 +6,7 @@ const coininfo = require('@psf/coininfo')
|
|||||||
class Address {
|
class Address {
|
||||||
constructor (config) {
|
constructor (config) {
|
||||||
const tmp = {}
|
const tmp = {}
|
||||||
if (!config || !config.restURL) tmp.restURL = 'https://api.bchjs.cash/v4/'
|
if (!config || !config.restURL) tmp.restURL = 'https://api.bchjs.cash/v5/'
|
||||||
else tmp.restURL = config.restURL
|
else tmp.restURL = config.restURL
|
||||||
|
|
||||||
this.restURL = tmp.restURL
|
this.restURL = tmp.restURL
|
||||||
|
|||||||
+2
-2
@@ -7,8 +7,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// bch-api mainnet.
|
// bch-api mainnet.
|
||||||
const DEFAULT_REST_API = 'https://api.fullstack.cash/v4/'
|
const DEFAULT_REST_API = 'https://api.fullstack.cash/v5/'
|
||||||
// const DEFAULT_REST_API = "http://localhost:3000/v4/"
|
// const DEFAULT_REST_API = "http://localhost:3000/v5/"
|
||||||
|
|
||||||
// local deps
|
// local deps
|
||||||
const BitcoinCash = require('./bitcoincash')
|
const BitcoinCash = require('./bitcoincash')
|
||||||
|
|||||||
@@ -14,9 +14,9 @@
|
|||||||
|
|
||||||
const assert = require('chai').assert
|
const assert = require('chai').assert
|
||||||
|
|
||||||
// const RESTURL = `https://abc.fullstack.cash/v4/`
|
// const RESTURL = `https://abc.fullstack.cash/v5/`
|
||||||
const RESTURL = 'https://bchn.fullstack.cash/v4/'
|
const RESTURL = 'https://bchn.fullstack.cash/v5/'
|
||||||
// const RESTURL = `http://localhost:3000/v4/`
|
// const RESTURL = `http://localhost:3000/v5/`
|
||||||
|
|
||||||
const BCHJS = require('../../../src/bch-js')
|
const BCHJS = require('../../../src/bch-js')
|
||||||
const bchjs = new BCHJS({ restURL: RESTURL })
|
const bchjs = new BCHJS({ restURL: RESTURL })
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ const PRO_PASS = 'testpassword'
|
|||||||
|
|
||||||
const BCHJS = require('../../../src/bch-js')
|
const BCHJS = require('../../../src/bch-js')
|
||||||
const bchjs = new BCHJS({
|
const bchjs = new BCHJS({
|
||||||
// restURL: `https://bchn.fullstack.cash/v4/`,
|
// restURL: `https://bchn.fullstack.cash/v5/`,
|
||||||
restURL: 'https://abc.fullstack.cash/v4/',
|
restURL: 'https://abc.fullstack.cash/v5/',
|
||||||
// restURL: `http://localhost:3000/v4/`,
|
// restURL: `http://localhost:3000/v5/`,
|
||||||
authPass: PRO_PASS
|
authPass: PRO_PASS
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ const JWT_TOKEN =
|
|||||||
|
|
||||||
const BCHJS = require('../../../src/bch-js')
|
const BCHJS = require('../../../src/bch-js')
|
||||||
const bchjs = new BCHJS({
|
const bchjs = new BCHJS({
|
||||||
restURL: 'https://api.fullstack.cash/v4/',
|
restURL: 'https://api.fullstack.cash/v5/',
|
||||||
// restURL: `http://localhost:3000/v4/`,
|
// restURL: `http://localhost:3000/v5/`,
|
||||||
apiToken: JWT_TOKEN
|
apiToken: JWT_TOKEN
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ const JWT_TOKEN =
|
|||||||
|
|
||||||
const BCHJS = require('../../../src/bch-js')
|
const BCHJS = require('../../../src/bch-js')
|
||||||
const bchjs = new BCHJS({
|
const bchjs = new BCHJS({
|
||||||
// restURL: `https://bchn.fullstack.cash/v4/`,
|
// restURL: `https://bchn.fullstack.cash/v5/`,
|
||||||
restURL: 'https:/abc.fullstack.cash/v4/',
|
restURL: 'https:/abc.fullstack.cash/v5/',
|
||||||
// restURL: `http://localhost:3000/v4/`,
|
// restURL: `http://localhost:3000/v5/`,
|
||||||
apiToken: JWT_TOKEN
|
apiToken: JWT_TOKEN
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ describe('#full node rate limits', () => {
|
|||||||
|
|
||||||
it('should throw error for more than 100 RPM to fullnode', async () => {
|
it('should throw error for more than 100 RPM to fullnode', async () => {
|
||||||
try {
|
try {
|
||||||
console.log('This test usually doesn\'t pass, because of latency.')
|
console.log("This test usually doesn't pass, because of latency.")
|
||||||
for (let i = 0; i < 100; i++) await bchjs.Control.getNetworkInfo()
|
for (let i = 0; i < 100; i++) await bchjs.Control.getNetworkInfo()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// console.log(`validating after 10th call`)
|
// console.log(`validating after 10th call`)
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ const JWT_TOKEN =
|
|||||||
|
|
||||||
const BCHJS = require('../../../src/bch-js')
|
const BCHJS = require('../../../src/bch-js')
|
||||||
const bchjs = new BCHJS({
|
const bchjs = new BCHJS({
|
||||||
// restURL: `https://bchn.fullstack.cash/v4/`,
|
// restURL: `https://bchn.fullstack.cash/v5/`,
|
||||||
restURL: 'https://abc.fullstack.cash/v4/',
|
restURL: 'https://abc.fullstack.cash/v5/',
|
||||||
// restURL: `http://localhost:3000/v4/`,
|
// restURL: `http://localhost:3000/v5/`,
|
||||||
apiToken: JWT_TOKEN
|
apiToken: JWT_TOKEN
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -12,11 +12,11 @@ const assert = chai.assert
|
|||||||
|
|
||||||
const RESTURL = process.env.RESTURL
|
const RESTURL = process.env.RESTURL
|
||||||
? process.env.RESTURL
|
? process.env.RESTURL
|
||||||
: 'https://testnet3.fullstack.cash/v4/'
|
: 'https://testnet3.fullstack.cash/v5/'
|
||||||
// if (process.env.RESTURL) RESTURL = process.env.RESTURL
|
// if (process.env.RESTURL) RESTURL = process.env.RESTURL
|
||||||
|
|
||||||
const BCHJS = require('../../../../src/bch-js')
|
const BCHJS = require('../../../../src/bch-js')
|
||||||
// const bchjs = new BCHJS({ restURL: `https://testnet.bchjs.cash/v4/` })
|
// const bchjs = new BCHJS({ restURL: `https://testnet.bchjs.cash/v5/` })
|
||||||
const bchjs = new BCHJS({ restURL: RESTURL, apiToken: process.env.BCHJSTOKEN })
|
const bchjs = new BCHJS({ restURL: RESTURL, apiToken: process.env.BCHJSTOKEN })
|
||||||
|
|
||||||
// Inspect utility used for debugging.
|
// Inspect utility used for debugging.
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ const assert = chai.assert
|
|||||||
|
|
||||||
const RESTURL = process.env.RESTURL
|
const RESTURL = process.env.RESTURL
|
||||||
? process.env.RESTURL
|
? process.env.RESTURL
|
||||||
: 'https://testnet3.fullstack.cash/v4/'
|
: 'https://testnet3.fullstack.cash/v5/'
|
||||||
|
|
||||||
const BCHJS = require('../../../../src/bch-js')
|
const BCHJS = require('../../../../src/bch-js')
|
||||||
const bchjs = new BCHJS({ restURL: RESTURL, apiToken: process.env.BCHJSTOKEN })
|
const bchjs = new BCHJS({ restURL: RESTURL, apiToken: process.env.BCHJSTOKEN })
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ const util = require('util')
|
|||||||
|
|
||||||
const RESTURL = process.env.RESTURL
|
const RESTURL = process.env.RESTURL
|
||||||
? process.env.RESTURL
|
? process.env.RESTURL
|
||||||
: 'https://testnet3.fullstack.cash/v4/'
|
: 'https://testnet3.fullstack.cash/v5/'
|
||||||
|
|
||||||
const BCHJS = require('../../../../src/bch-js')
|
const BCHJS = require('../../../../src/bch-js')
|
||||||
const bchjs = new BCHJS({ restURL: RESTURL, apiToken: process.env.BCHJSTOKEN })
|
const bchjs = new BCHJS({ restURL: RESTURL, apiToken: process.env.BCHJSTOKEN })
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ const assert = chai.assert
|
|||||||
|
|
||||||
const RESTURL = process.env.RESTURL
|
const RESTURL = process.env.RESTURL
|
||||||
? process.env.RESTURL
|
? process.env.RESTURL
|
||||||
: 'https://testnet3.fullstack.cash/v4/'
|
: 'https://testnet3.fullstack.cash/v5/'
|
||||||
// if (process.env.RESTURL) RESTURL = process.env.RESTURL
|
// if (process.env.RESTURL) RESTURL = process.env.RESTURL
|
||||||
|
|
||||||
const BCHJS = require('../../../../src/bch-js')
|
const BCHJS = require('../../../../src/bch-js')
|
||||||
// const bchjs = new BCHJS({ restURL: `https://testnet.bchjs.cash/v4/` })
|
// const bchjs = new BCHJS({ restURL: `https://testnet.bchjs.cash/v5/` })
|
||||||
const bchjs = new BCHJS({ restURL: RESTURL, apiToken: process.env.BCHJSTOKEN })
|
const bchjs = new BCHJS({ restURL: RESTURL, apiToken: process.env.BCHJSTOKEN })
|
||||||
|
|
||||||
// Inspect utility used for debugging.
|
// Inspect utility used for debugging.
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ const assert = chai.assert
|
|||||||
|
|
||||||
const RESTURL = process.env.RESTURL
|
const RESTURL = process.env.RESTURL
|
||||||
? process.env.RESTURL
|
? process.env.RESTURL
|
||||||
: 'https://testnet3.fullstack.cash/v4/'
|
: 'https://testnet3.fullstack.cash/v5/'
|
||||||
// if (process.env.RESTURL) RESTURL = process.env.RESTURL
|
// if (process.env.RESTURL) RESTURL = process.env.RESTURL
|
||||||
|
|
||||||
const BCHJS = require('../../../../src/bch-js')
|
const BCHJS = require('../../../../src/bch-js')
|
||||||
// const bchjs = new BCHJS({ restURL: `https://testnet.bchjs.cash/v4/` })
|
// const bchjs = new BCHJS({ restURL: `https://testnet.bchjs.cash/v5/` })
|
||||||
const bchjs = new BCHJS({ restURL: RESTURL, apiToken: process.env.BCHJSTOKEN })
|
const bchjs = new BCHJS({ restURL: RESTURL, apiToken: process.env.BCHJSTOKEN })
|
||||||
|
|
||||||
// Inspect utility used for debugging.
|
// Inspect utility used for debugging.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
export RESTURL=https://free-test.fullstack.cash/v4/
|
export RESTURL=https://free-test.fullstack.cash/v5/
|
||||||
export NETWORK=testnet
|
export NETWORK=testnet
|
||||||
export IS_USING_FREE_TIER=true
|
export IS_USING_FREE_TIER=true
|
||||||
|
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ const assert = chai.assert
|
|||||||
|
|
||||||
const RESTURL = process.env.RESTURL
|
const RESTURL = process.env.RESTURL
|
||||||
? process.env.RESTURL
|
? process.env.RESTURL
|
||||||
: 'https://testnet3.fullstack.cash/v4/'
|
: 'https://testnet3.fullstack.cash/v5/'
|
||||||
// if (process.env.RESTURL) RESTURL = process.env.RESTURL
|
// if (process.env.RESTURL) RESTURL = process.env.RESTURL
|
||||||
|
|
||||||
const BCHJS = require('../../../../src/bch-js')
|
const BCHJS = require('../../../../src/bch-js')
|
||||||
// const bchjs = new BCHJS({ restURL: `https://testnet.bchjs.cash/v4/` })
|
// const bchjs = new BCHJS({ restURL: `https://testnet.bchjs.cash/v5/` })
|
||||||
const bchjs = new BCHJS({ restURL: RESTURL, apiToken: process.env.BCHJSTOKEN })
|
const bchjs = new BCHJS({ restURL: RESTURL, apiToken: process.env.BCHJSTOKEN })
|
||||||
|
|
||||||
// Inspect utility used for debugging.
|
// Inspect utility used for debugging.
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ let uut
|
|||||||
|
|
||||||
const REST_URL = process.env.RESTURL
|
const REST_URL = process.env.RESTURL
|
||||||
? process.env.RESTURL
|
? process.env.RESTURL
|
||||||
: 'https://bchn.fullstack.cash/v4/'
|
: 'https://bchn.fullstack.cash/v5/'
|
||||||
|
|
||||||
// Mock data used for unit tests
|
// Mock data used for unit tests
|
||||||
const mockDataLib = require('./fixtures/slp/mock-utils')
|
const mockDataLib = require('./fixtures/slp/mock-utils')
|
||||||
|
|||||||
Reference in New Issue
Block a user