diff --git a/lib/index.js b/lib/index.js index fa3852a..fa93386 100644 --- a/lib/index.js +++ b/lib/index.js @@ -10,6 +10,7 @@ var MessagesController = require('./messages'); var UtilsController = require('./utils'); var CurrencyController = require('./currency'); var bitcore = require('bitcore'); +var _ = bitcore.deps._; var $ = bitcore.util.preconditions; var Transaction = bitcore.Transaction; var EventEmitter = require('events').EventEmitter; @@ -24,6 +25,12 @@ var InsightAPI = function(options) { inv: [] }; + if (!_.isUndefined(options.routePrefix)) { + this.routePrefix = options.routePrefix; + } else { + this.routePrefix = this.name; + } + this.txController = new TxController(this.node); }; @@ -31,6 +38,10 @@ InsightAPI.dependencies = ['address', 'web']; inherits(InsightAPI, BaseService); +InsightAPI.prototype.getRoutePrefix = function() { + return this.routePrefix; +}; + InsightAPI.prototype.start = function(callback) { this.node.services.bitcoind.on('tx', this.transactionHandler.bind(this));