|
|
@ -64,7 +64,7 @@ class LocalIndexerWrapper extends Wrapper { |
|
|
|
scriptHash |
|
|
|
) |
|
|
|
|
|
|
|
for (let r of results.txs) { |
|
|
|
for (let r of results.response) { |
|
|
|
ret.txids.push(r.tx_hash) |
|
|
|
ret.ntx++ |
|
|
|
} |
|
|
@ -109,8 +109,8 @@ class LocalIndexerWrapper extends Wrapper { |
|
|
|
: await this.client.sendRequests(commands) |
|
|
|
|
|
|
|
for (let r of results) { |
|
|
|
const addr = addresses[r.idxAddr] |
|
|
|
const txids = r.txs.map(t => t.tx_hash) |
|
|
|
const addr = addresses[r.id] |
|
|
|
const txids = r.response.map(t => t.tx_hash) |
|
|
|
|
|
|
|
ret[addr] = { |
|
|
|
address: addr, |
|
|
@ -131,12 +131,31 @@ class LocalIndexerWrapper extends Wrapper { |
|
|
|
return aRet |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Retrieve the height of the chaintip for the remote source |
|
|
|
* @returns {Promise} returns an object |
|
|
|
* {chainTipHeight: <chaintip_height>} |
|
|
|
*/ |
|
|
|
async getChainTipHeight() { |
|
|
|
let chainTipHeight = null |
|
|
|
const result = await this.client.sendRequest( |
|
|
|
LocalIndexerWrapper.HEADERS_SUBSCRIBE_RPC_CMD, |
|
|
|
null |
|
|
|
) |
|
|
|
if (result != null && result['response'] != null && result['response']['height'] != null) |
|
|
|
chainTipHeight = parseInt(result['response']['height']) |
|
|
|
return {'chainTipHeight': chainTipHeight} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Get history RPC command (Electrum protocol) |
|
|
|
*/ |
|
|
|
LocalIndexerWrapper.GET_HISTORY_RPC_CMD = 'blockchain.scripthash.get_history' |
|
|
|
/** |
|
|
|
* Get history RPC command (Electrum protocol) |
|
|
|
*/ |
|
|
|
LocalIndexerWrapper.HEADERS_SUBSCRIBE_RPC_CMD = 'blockchain.headers.subscribe' |
|
|
|
|
|
|
|
|
|
|
|
module.exports = LocalIndexerWrapper |
|
|
|