mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-05-01 01:50:00 -07:00
global: snapshot
This commit is contained in:
@@ -789,6 +789,13 @@
|
||||
* @property {number} blockCount - Total blocks in the time period
|
||||
* @property {number} lastEstimatedHashrate - Estimated network hashrate (hashes per second)
|
||||
*/
|
||||
/**
|
||||
* Current price response matching mempool.space /api/v1/prices format
|
||||
*
|
||||
* @typedef {Object} Prices
|
||||
* @property {Timestamp} time
|
||||
* @property {Dollars} uSD
|
||||
*/
|
||||
/**
|
||||
* A range boundary: integer index, date, or timestamp.
|
||||
*
|
||||
@@ -1063,10 +1070,6 @@
|
||||
* @property {Txid} txid - Transaction ID
|
||||
* @property {Vout} vout - Output index
|
||||
*/
|
||||
/**
|
||||
* @typedef {Object} TxidsParam
|
||||
* @property {Txid[]} txId[]
|
||||
*/
|
||||
/**
|
||||
* Index within its type (e.g., 0 for first P2WPKH address)
|
||||
*
|
||||
@@ -10098,6 +10101,22 @@ class BrkClient extends BrkClientBase {
|
||||
return this.getJson(`/api/tx/${txid}/merkle-proof`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Transaction merkleblock proof
|
||||
*
|
||||
* Get the merkleblock proof for a transaction (BIP37 format, hex encoded).
|
||||
*
|
||||
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-transaction-merkleblock-proof)*
|
||||
*
|
||||
* Endpoint: `GET /api/tx/{txid}/merkleblock-proof`
|
||||
*
|
||||
* @param {Txid} txid
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
async getTxMerkleblockProof(txid) {
|
||||
return this.getJson(`/api/tx/${txid}/merkleblock-proof`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Output spend status
|
||||
*
|
||||
@@ -10582,6 +10601,20 @@ class BrkClient extends BrkClientBase {
|
||||
return this.getJson(`/api/v1/mining/reward-stats/${block_count}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Current BTC price
|
||||
*
|
||||
* Returns bitcoin latest price (on-chain derived, USD only).
|
||||
*
|
||||
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-price)*
|
||||
*
|
||||
* Endpoint: `GET /api/v1/prices`
|
||||
* @returns {Promise<Prices>}
|
||||
*/
|
||||
async getPrices() {
|
||||
return this.getJson(`/api/v1/prices`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Transaction first-seen times
|
||||
*
|
||||
@@ -10590,16 +10623,10 @@ class BrkClient extends BrkClientBase {
|
||||
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-transaction-times)*
|
||||
*
|
||||
* Endpoint: `GET /api/v1/transaction-times`
|
||||
*
|
||||
* @param {Txid[]} [txId[]]
|
||||
* @returns {Promise<number[]>}
|
||||
*/
|
||||
async getTransactionTimes(txId) {
|
||||
const params = new URLSearchParams();
|
||||
params.set('txId[]', String(txId));
|
||||
const query = params.toString();
|
||||
const path = `/api/v1/transaction-times${query ? '?' + query : ''}`;
|
||||
return this.getJson(path);
|
||||
async getTransactionTimes() {
|
||||
return this.getJson(`/api/v1/transaction-times`);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user