fix options for http.

This commit is contained in:
Christopher Jeffrey 2016-05-19 00:55:00 -07:00
parent 3e2d4aa717
commit 3979e57acc
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
6 changed files with 16 additions and 4 deletions

View File

@ -3,7 +3,7 @@
var argv = parseArg(process.argv);
var bcoin = require('../').set(argv.network);
var network = bcoin.protocol.network;
var network = bcoin.network.get();
var utils = bcoin.utils;
var assert = utils.assert;
var Client = bcoin.http.client;

View File

@ -202,6 +202,9 @@ Environment.prototype.set = function set(options) {
if (typeof options === 'string')
options = { network: options };
if (!options)
options = {};
options = utils.merge({}, options);
options.prefix = options.prefix

View File

@ -26,6 +26,9 @@ function HTTPClient(options) {
if (!options)
options = {};
if (typeof options === 'string')
options = { uri: options };
EventEmitter.call(this);
this.uri = options.uri;

View File

@ -8,8 +8,8 @@
var utils = require('../utils');
exports.request = require('./request');
exports.provider = require('./provider');
exports.client = require('./client');
exports.provider = require('./provider');
if (!utils.isBrowser) {
exports.base = require('./ba' + 'se');

View File

@ -26,9 +26,15 @@ function HTTPProvider(options) {
EventEmitter.call(this);
if (!options)
options = {};
if (typeof options === 'string')
options = { uri: options };
this.client = new HTTPClient(options);
this.network = bcoin.network.get(options.network);
this.uri = uri;
this.uri = options.uri;
this.id = null;
this._init();
}

View File

@ -101,10 +101,10 @@ TX.prototype.clone = function clone() {
copy = {
version: this.version,
flag: this.flag,
inputs: [],
outputs: [],
locktime: this.locktime,
flag: this.flag,
ts: this.ts,
block: this.block,
index: this.index,