From 810a07b9be2350ee484449e2f7976e5ac60c6665 Mon Sep 17 00:00:00 2001 From: ajp8164 Date: Wed, 27 Feb 2019 13:26:28 -0500 Subject: [PATCH] Inject self into own network obj, bump version 0.3.17 --- index.js | 6 ++++++ lib/networks.js | 5 +++++ package.json | 7 ++++--- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 6501769..1ff4f72 100644 --- a/index.js +++ b/index.js @@ -21,4 +21,10 @@ bchLib.URI = require('./lib/uri'); // Internal usage, exposed for testing/advanced tweaking bchLib.Transaction.sighash = require('./lib/transaction/sighash'); +// Inject this library into each of its networks as network.lib. +var bchNetworks = require('@owstack/network-lib').getFiltered({currency: bchLib.Networks.currency}); +for (var i = 0; i < bchNetworks.length; i++) { + bchNetworks[i].lib = bchLib; +} + module.exports = bchLib; diff --git a/lib/networks.js b/lib/networks.js index e7a1089..8c793f3 100644 --- a/lib/networks.js +++ b/lib/networks.js @@ -1,5 +1,6 @@ 'use strict'; +var bchLib = require('../'); var Networks = require('@owstack/network-lib'); var Bip44 = Networks.Bip44; @@ -11,6 +12,7 @@ var regtestEnabled = false; */ var networks = [{ + lib: bchLib, currency: currency, description: 'Bitcoin Cash', name: 'bch', @@ -42,6 +44,7 @@ var networks = [{ 'seed.deadalnix.me' ] }, { + lib: bchLib, currency: currency, description: 'BCH Testnet', name: 'bchtest', @@ -72,6 +75,7 @@ var networks = [{ 'testnet-seed.bitcoin.schildbach.de' ] }, { + lib: bchLib, currency: currency, description: 'BCH Regtest', name: 'bchreg', @@ -203,6 +207,7 @@ module.exports = { get: BchNetworks.get, getProtocols: BchNetworks.getProtocols, getProtocol: BchNetworks.getLivenetProtocol, + currency: currency, enableRegtest: BchNetworks.enableRegtest, disableRegtest: BchNetworks.disableRegtest, defaultNetwork: BchNetworks.get('bch'), diff --git a/package.json b/package.json index 27dcef1..5006fdf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@owstack/bch-lib", - "version": "0.3.16", + "version": "0.3.17", "description": "A Javascript library to build bitcoin cash and blockchain-based applications.", "main": "index.js", "scripts": { @@ -33,9 +33,10 @@ "request": "browser-request" }, "dependencies": { + "@owstack/key-lib": "^0.0.37", + "@owstack/network-lib": "^0.0.26", "@owstack/ows-common": "^0.0.16", - "@owstack/key-lib": "^0.0.36", - "@owstack/network-lib": "^0.0.25", + "acorn": "^6.1.1", "buffer-compare": "=1.0.0", "inherits": "=2.0.1" },