Move explorers inside transport
This commit is contained in:
parent
7cf826249b
commit
7fe17e1699
|
@ -5,7 +5,7 @@ description: Allows users to fetch information about the state of the blockchain
|
||||||
|
|
||||||
## Description
|
## Description
|
||||||
|
|
||||||
`bitcore.explorers.Insight` is a simple agent to perform queries to the blockchain. There are currently two methods (the API will grow as features are requested): `getUnspentUtxos` and `broadcast`.
|
`bitcore.transport.explorers.Insight` is a simple agent to perform queries to the blockchain. There are currently two methods (the API will grow as features are requested): `getUnspentUtxos` and `broadcast`.
|
||||||
|
|
||||||
### Retrieving Unspent UTXOs for an Address (or set of)
|
### Retrieving Unspent UTXOs for an Address (or set of)
|
||||||
|
|
||||||
|
|
8
index.js
8
index.js
|
@ -24,9 +24,6 @@ bitcore.util.buffer = require('./lib/util/buffer');
|
||||||
bitcore.util.js = require('./lib/util/js');
|
bitcore.util.js = require('./lib/util/js');
|
||||||
bitcore.util.preconditions = require('./lib/util/preconditions');
|
bitcore.util.preconditions = require('./lib/util/preconditions');
|
||||||
|
|
||||||
// transport
|
|
||||||
bitcore.transport = require('./lib/transport');
|
|
||||||
|
|
||||||
// errors thrown by the library
|
// errors thrown by the library
|
||||||
bitcore.errors = require('./lib/errors');
|
bitcore.errors = require('./lib/errors');
|
||||||
|
|
||||||
|
@ -53,9 +50,8 @@ bitcore.deps.bs58 = require('bs58');
|
||||||
bitcore.deps.Buffer = Buffer;
|
bitcore.deps.Buffer = Buffer;
|
||||||
bitcore.deps.elliptic = require('elliptic');
|
bitcore.deps.elliptic = require('elliptic');
|
||||||
|
|
||||||
// blockchain explorers
|
// transport
|
||||||
bitcore.explorers = {};
|
bitcore.transport = require('./lib/transport');
|
||||||
bitcore.explorers.Insight = require('./lib/explorers/insight');
|
|
||||||
|
|
||||||
// Internal usage, exposed for testing/advanced tweaking
|
// Internal usage, exposed for testing/advanced tweaking
|
||||||
bitcore._HDKeyCache = require('./lib/hdkeycache');
|
bitcore._HDKeyCache = require('./lib/hdkeycache');
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
module.exports = {
|
||||||
|
Insight: require('./insight')
|
||||||
|
};
|
|
@ -1,11 +1,12 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var Networks = require('../networks');
|
var $ = require('../../util/preconditions');
|
||||||
var JSUtil = require('../util/js');
|
|
||||||
var $ = require('../util/preconditions');
|
|
||||||
var _ = require('lodash');
|
var _ = require('lodash');
|
||||||
var Address = require('../address');
|
|
||||||
var Transaction = require('../transaction');
|
var Address = require('../../address');
|
||||||
|
var JSUtil = require('../../util/js');
|
||||||
|
var Networks = require('../../networks');
|
||||||
|
var Transaction = require('../../transaction');
|
||||||
var UnspentOutput = Transaction.UnspentOutput;
|
var UnspentOutput = Transaction.UnspentOutput;
|
||||||
|
|
||||||
var request = require('request');
|
var request = require('request');
|
|
@ -2,6 +2,7 @@
|
||||||
* @namespace Transport
|
* @namespace Transport
|
||||||
*/
|
*/
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
explorers: require('./explorers'),
|
||||||
Messages: require('./messages'),
|
Messages: require('./messages'),
|
||||||
Peer: require('./peer'),
|
Peer: require('./peer'),
|
||||||
Pool: require('./pool'),
|
Pool: require('./pool'),
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
var sinon = require('sinon');
|
var sinon = require('sinon');
|
||||||
var should = require('chai').should();
|
var should = require('chai').should();
|
||||||
var expect = require('chai').expect;
|
var expect = require('chai').expect;
|
||||||
var bitcore = require('../..');
|
var bitcore = require('../../..');
|
||||||
|
|
||||||
var Insight = bitcore.explorers.Insight;
|
var Insight = bitcore.transport.explorers.Insight;
|
||||||
var Address = bitcore.Address;
|
var Address = bitcore.Address;
|
||||||
var Transaction = bitcore.Transaction;
|
var Transaction = bitcore.Transaction;
|
||||||
var Networks = bitcore.Networks;
|
var Networks = bitcore.Networks;
|
||||||
|
@ -74,7 +74,7 @@ describe('Insight', function() {
|
||||||
|
|
||||||
describe('broadcasting a transaction', function() {
|
describe('broadcasting a transaction', function() {
|
||||||
var insight = new Insight();
|
var insight = new Insight();
|
||||||
var tx = require('../data/tx_creation.json')[0][7];
|
var tx = require('../../data/tx_creation.json')[0][7];
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
insight.requestPost = sinon.stub();
|
insight.requestPost = sinon.stub();
|
||||||
insight.requestPost.onFirstCall().callsArgWith(2, null, {statusCode: 200});
|
insight.requestPost.onFirstCall().callsArgWith(2, null, {statusCode: 200});
|
Loading…
Reference in New Issue