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
|
||||
|
||||
`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)
|
||||
|
||||
|
|
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.preconditions = require('./lib/util/preconditions');
|
||||
|
||||
// transport
|
||||
bitcore.transport = require('./lib/transport');
|
||||
|
||||
// errors thrown by the library
|
||||
bitcore.errors = require('./lib/errors');
|
||||
|
||||
|
@ -53,9 +50,8 @@ bitcore.deps.bs58 = require('bs58');
|
|||
bitcore.deps.Buffer = Buffer;
|
||||
bitcore.deps.elliptic = require('elliptic');
|
||||
|
||||
// blockchain explorers
|
||||
bitcore.explorers = {};
|
||||
bitcore.explorers.Insight = require('./lib/explorers/insight');
|
||||
// transport
|
||||
bitcore.transport = require('./lib/transport');
|
||||
|
||||
// Internal usage, exposed for testing/advanced tweaking
|
||||
bitcore._HDKeyCache = require('./lib/hdkeycache');
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
Insight: require('./insight')
|
||||
};
|
|
@ -1,11 +1,12 @@
|
|||
'use strict';
|
||||
|
||||
var Networks = require('../networks');
|
||||
var JSUtil = require('../util/js');
|
||||
var $ = require('../util/preconditions');
|
||||
var $ = require('../../util/preconditions');
|
||||
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 request = require('request');
|
|
@ -2,6 +2,7 @@
|
|||
* @namespace Transport
|
||||
*/
|
||||
module.exports = {
|
||||
explorers: require('./explorers'),
|
||||
Messages: require('./messages'),
|
||||
Peer: require('./peer'),
|
||||
Pool: require('./pool'),
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
var sinon = require('sinon');
|
||||
var should = require('chai').should();
|
||||
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 Transaction = bitcore.Transaction;
|
||||
var Networks = bitcore.Networks;
|
||||
|
@ -74,7 +74,7 @@ describe('Insight', function() {
|
|||
|
||||
describe('broadcasting a transaction', function() {
|
||||
var insight = new Insight();
|
||||
var tx = require('../data/tx_creation.json')[0][7];
|
||||
var tx = require('../../data/tx_creation.json')[0][7];
|
||||
beforeEach(function() {
|
||||
insight.requestPost = sinon.stub();
|
||||
insight.requestPost.onFirstCall().callsArgWith(2, null, {statusCode: 200});
|
Loading…
Reference in New Issue