diff --git a/lib/HistoricSync.js b/lib/HistoricSync.js index 1229305c..07196566 100644 --- a/lib/HistoricSync.js +++ b/lib/HistoricSync.js @@ -14,6 +14,7 @@ var Sync = require('./Sync'); var sockets = require('../app/controllers/socket.js'); var BlockExtractor = require('./BlockExtractor.js'); var buffertools = require('buffertools'); +var Address = bitcore.Address; // var bitcoreUtil = require('bitcore/util/util'); // var Deserialize = require('bitcore/Deserialize'); @@ -158,8 +159,8 @@ HistoricSync.prototype.getBlockFromFile = function(cb) { try { var s = new Script(o.s); - var addrs = self.sync.txDb.getAddrStr(s); - + var addrs = new Address.fromScriptPubKey(s, config.network); + // support only for p2pubkey p2pubkeyhash and p2sh if (addrs.length === 1) { objTx.out[to].addrStr = addrs[0]; diff --git a/lib/Rpc.js b/lib/Rpc.js index 47ce37a6..9f78c8d3 100644 --- a/lib/Rpc.js +++ b/lib/Rpc.js @@ -30,6 +30,7 @@ Rpc._parseTxResult = function(info) { // Outputs => add total var valueOutSat = 0; info.vout.forEach( function(o) { + o.value = o.value.toFixed(8); valueOutSat += o.value * bitcore.util.COIN; delete o.scriptPubKey.hex; }); diff --git a/package.json b/package.json index 906b2815..7b56ceb0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "insight-bitcore-api", "description": "An open-source bitcoin blockchain API. The Insight API provides you with a convenient, powerful and simple way to query and broadcast data on the bitcoin network and build your own services with it.", - "version": "0.1.10", + "version": "0.1.11", "author": { "name": "Ryan X Charles", "email": "ryan@bitpay.com" @@ -46,6 +46,7 @@ "engines": { "node": "*" }, + "bin": "insight.js", "scripts": { "start": "node node_modules/grunt-cli/bin/grunt" },