pub struct BrkClient { /* private fields */ }Expand description
Main BRK client with series tree and API methods.
Implementations§
Source§impl BrkClient
impl BrkClient
Sourcepub fn with_options(options: BrkClientOptions) -> Self
pub fn with_options(options: BrkClientOptions) -> Self
Create a new client with options.
Sourcepub fn series(&self) -> &SeriesTree
pub fn series(&self) -> &SeriesTree
Get the series tree for navigating series.
Sourcepub fn series_endpoint(
&self,
series: impl Into<SeriesName>,
index: Index,
) -> SeriesEndpoint<Value>
pub fn series_endpoint( &self, series: impl Into<SeriesName>, index: Index, ) -> SeriesEndpoint<Value>
Create a dynamic series endpoint builder for any series/index combination.
Use this for programmatic access when the series name is determined at runtime.
For type-safe access, use the series() tree instead.
§Example
let data = client.series("realized_price", Index::Height)
.last(10)
.json::<f64>()?;Sourcepub fn date_series_endpoint(
&self,
series: impl Into<SeriesName>,
index: Index,
) -> Result<DateSeriesEndpoint<Value>>
pub fn date_series_endpoint( &self, series: impl Into<SeriesName>, index: Index, ) -> Result<DateSeriesEndpoint<Value>>
Create a dynamic date-based series endpoint builder.
Returns Err if the index is not date-based.
Sourcepub fn get_api(&self) -> Result<String>
pub fn get_api(&self) -> Result<String>
Compact OpenAPI specification
Compact OpenAPI specification optimized for LLM consumption. Removes redundant fields while preserving essential API information. Full spec available at /openapi.json.
Endpoint: GET /api.json
Sourcepub fn get_address(&self, address: Addr) -> Result<AddrStats>
pub fn get_address(&self, address: Addr) -> Result<AddrStats>
Address information
Retrieve address information including balance and transaction counts. Supports all standard Bitcoin address types (P2PKH, P2SH, P2WPKH, P2WSH, P2TR).
Endpoint: GET /api/address/{address}
Sourcepub fn get_address_txs(
&self,
address: Addr,
after_txid: Option<Txid>,
) -> Result<Vec<Transaction>>
pub fn get_address_txs( &self, address: Addr, after_txid: Option<Txid>, ) -> Result<Vec<Transaction>>
Address transactions
Get transaction history for an address, sorted with newest first. Returns up to 50 mempool transactions plus the first 25 confirmed transactions. Use ?after_txid=
Endpoint: GET /api/address/{address}/txs
Sourcepub fn get_address_confirmed_txs(
&self,
address: Addr,
after_txid: Option<Txid>,
) -> Result<Vec<Transaction>>
pub fn get_address_confirmed_txs( &self, address: Addr, after_txid: Option<Txid>, ) -> Result<Vec<Transaction>>
Address confirmed transactions
Get confirmed transactions for an address, 25 per page. Use ?after_txid=
Endpoint: GET /api/address/{address}/txs/chain
Sourcepub fn get_address_mempool_txs(&self, address: Addr) -> Result<Vec<Txid>>
pub fn get_address_mempool_txs(&self, address: Addr) -> Result<Vec<Txid>>
Address mempool transactions
Get unconfirmed transaction IDs for an address from the mempool (up to 50).
Endpoint: GET /api/address/{address}/txs/mempool
Sourcepub fn get_address_utxos(&self, address: Addr) -> Result<Vec<Utxo>>
pub fn get_address_utxos(&self, address: Addr) -> Result<Vec<Utxo>>
Address UTXOs
Get unspent transaction outputs (UTXOs) for an address. Returns txid, vout, value, and confirmation status for each UTXO.
Endpoint: GET /api/address/{address}/utxo
Sourcepub fn get_block_by_height(&self, height: Height) -> Result<String>
pub fn get_block_by_height(&self, height: Height) -> Result<String>
Block hash by height
Retrieve the block hash at a given height. Returns the hash as plain text.
Endpoint: GET /api/block-height/{height}
Sourcepub fn get_block(&self, hash: BlockHash) -> Result<BlockInfo>
pub fn get_block(&self, hash: BlockHash) -> Result<BlockInfo>
Block information
Retrieve block information by block hash. Returns block metadata including height, timestamp, difficulty, size, weight, and transaction count.
Endpoint: GET /api/block/{hash}
Sourcepub fn get_block_header(&self, hash: BlockHash) -> Result<String>
pub fn get_block_header(&self, hash: BlockHash) -> Result<String>
Block header
Returns the hex-encoded 80-byte block header.
Endpoint: GET /api/block/{hash}/header
Sourcepub fn get_block_raw(&self, hash: BlockHash) -> Result<String>
pub fn get_block_raw(&self, hash: BlockHash) -> Result<String>
Raw block
Returns the raw block data in binary format.
Endpoint: GET /api/block/{hash}/raw
Sourcepub fn get_block_status(&self, hash: BlockHash) -> Result<BlockStatus>
pub fn get_block_status(&self, hash: BlockHash) -> Result<BlockStatus>
Block status
Retrieve the status of a block. Returns whether the block is in the best chain and, if so, its height and the hash of the next block.
Endpoint: GET /api/block/{hash}/status
Sourcepub fn get_block_txid(&self, hash: BlockHash, index: TxIndex) -> Result<String>
pub fn get_block_txid(&self, hash: BlockHash, index: TxIndex) -> Result<String>
Transaction ID at index
Retrieve a single transaction ID at a specific index within a block. Returns plain text txid.
Endpoint: GET /api/block/{hash}/txid/{index}
Sourcepub fn get_block_txids(&self, hash: BlockHash) -> Result<Vec<Txid>>
pub fn get_block_txids(&self, hash: BlockHash) -> Result<Vec<Txid>>
Block transaction IDs
Retrieve all transaction IDs in a block. Returns an array of txids in block order.
Endpoint: GET /api/block/{hash}/txids
Sourcepub fn get_block_txs(&self, hash: BlockHash) -> Result<Vec<Transaction>>
pub fn get_block_txs(&self, hash: BlockHash) -> Result<Vec<Transaction>>
Block transactions
Retrieve transactions in a block by block hash. Returns up to 25 transactions starting from index 0.
Endpoint: GET /api/block/{hash}/txs
Sourcepub fn get_block_txs_from_index(
&self,
hash: BlockHash,
start_index: TxIndex,
) -> Result<Vec<Transaction>>
pub fn get_block_txs_from_index( &self, hash: BlockHash, start_index: TxIndex, ) -> Result<Vec<Transaction>>
Block transactions (paginated)
Retrieve transactions in a block by block hash, starting from the specified index. Returns up to 25 transactions at a time.
Endpoint: GET /api/block/{hash}/txs/{start_index}
Sourcepub fn get_blocks(&self) -> Result<Vec<BlockInfo>>
pub fn get_blocks(&self) -> Result<Vec<BlockInfo>>
Recent blocks
Retrieve the last 10 blocks. Returns block metadata for each block.
Endpoint: GET /api/blocks
Sourcepub fn get_block_tip_hash(&self) -> Result<String>
pub fn get_block_tip_hash(&self) -> Result<String>
Block tip hash
Returns the hash of the last block.
Endpoint: GET /api/blocks/tip/hash
Sourcepub fn get_block_tip_height(&self) -> Result<String>
pub fn get_block_tip_height(&self) -> Result<String>
Block tip height
Returns the height of the last block.
Endpoint: GET /api/blocks/tip/height
Sourcepub fn get_blocks_from_height(&self, height: Height) -> Result<Vec<BlockInfo>>
pub fn get_blocks_from_height(&self, height: Height) -> Result<Vec<BlockInfo>>
Blocks from height
Retrieve up to 10 blocks going backwards from the given height. For example, height=100 returns blocks 100, 99, 98, …, 91. Height=0 returns only block 0.
Endpoint: GET /api/blocks/{height}
Sourcepub fn get_mempool(&self) -> Result<MempoolInfo>
pub fn get_mempool(&self) -> Result<MempoolInfo>
Mempool statistics
Get current mempool statistics including transaction count, total vsize, total fees, and fee histogram.
Endpoint: GET /api/mempool
Sourcepub fn get_live_price(&self) -> Result<Dollars>
pub fn get_live_price(&self) -> Result<Dollars>
Live BTC/USD price
Returns the current BTC/USD price in dollars, derived from on-chain round-dollar output patterns in the last 12 blocks plus mempool.
Endpoint: GET /api/mempool/price
Sourcepub fn get_mempool_recent(&self) -> Result<Vec<MempoolRecentTx>>
pub fn get_mempool_recent(&self) -> Result<Vec<MempoolRecentTx>>
Recent mempool transactions
Get the last 10 transactions to enter the mempool.
Endpoint: GET /api/mempool/recent
Sourcepub fn get_mempool_txids(&self) -> Result<Vec<Txid>>
pub fn get_mempool_txids(&self) -> Result<Vec<Txid>>
Mempool transaction IDs
Get all transaction IDs currently in the mempool.
Endpoint: GET /api/mempool/txids
Sourcepub fn get_series_tree(&self) -> Result<TreeNode>
pub fn get_series_tree(&self) -> Result<TreeNode>
Series catalog
Returns the complete hierarchical catalog of available series organized as a tree structure. Series are grouped by categories and subcategories.
Endpoint: GET /api/series
Sourcepub fn get_series_bulk(
&self,
series: SeriesList,
index: Index,
start: Option<RangeIndex>,
end: Option<RangeIndex>,
limit: Option<Limit>,
format: Option<Format>,
) -> Result<FormatResponse<Vec<SeriesData>>>
pub fn get_series_bulk( &self, series: SeriesList, index: Index, start: Option<RangeIndex>, end: Option<RangeIndex>, limit: Option<Limit>, format: Option<Format>, ) -> Result<FormatResponse<Vec<SeriesData>>>
Bulk series data
Fetch multiple series in a single request. Supports filtering by index and date range. Returns an array of SeriesData objects. For a single series, use get_series instead.
Endpoint: GET /api/series/bulk
Sourcepub fn get_cost_basis_cohorts(&self) -> Result<Vec<String>>
pub fn get_cost_basis_cohorts(&self) -> Result<Vec<String>>
Available cost basis cohorts
List available cohorts for cost basis distribution.
Endpoint: GET /api/series/cost-basis
Sourcepub fn get_cost_basis_dates(&self, cohort: Cohort) -> Result<Vec<Date>>
pub fn get_cost_basis_dates(&self, cohort: Cohort) -> Result<Vec<Date>>
Available cost basis dates
List available dates for a cohort’s cost basis distribution.
Endpoint: GET /api/series/cost-basis/{cohort}/dates
Sourcepub fn get_cost_basis(
&self,
cohort: Cohort,
date: &str,
bucket: Option<CostBasisBucket>,
value: Option<CostBasisValue>,
) -> Result<Value>
pub fn get_cost_basis( &self, cohort: Cohort, date: &str, bucket: Option<CostBasisBucket>, value: Option<CostBasisValue>, ) -> Result<Value>
Cost basis distribution
Get the cost basis distribution for a cohort on a specific date.
Query params:
bucket: raw (default), lin200, lin500, lin1000, log10, log50, log100value: supply (default, in BTC), realized (USD), unrealized (USD)
Endpoint: GET /api/series/cost-basis/{cohort}/{date}
Sourcepub fn get_series_count(&self) -> Result<Vec<SeriesCount>>
pub fn get_series_count(&self) -> Result<Vec<SeriesCount>>
Series count
Returns the number of series available per index type.
Endpoint: GET /api/series/count
Sourcepub fn get_indexes(&self) -> Result<Vec<IndexInfo>>
pub fn get_indexes(&self) -> Result<Vec<IndexInfo>>
List available indexes
Returns all available indexes with their accepted query aliases. Use any alias when querying series.
Endpoint: GET /api/series/indexes
Sourcepub fn list_series(
&self,
page: Option<i64>,
per_page: Option<i64>,
) -> Result<PaginatedSeries>
pub fn list_series( &self, page: Option<i64>, per_page: Option<i64>, ) -> Result<PaginatedSeries>
Series list
Paginated flat list of all available series names. Use page query param for pagination.
Endpoint: GET /api/series/list
Sourcepub fn search_series(
&self,
q: SeriesName,
limit: Option<Limit>,
) -> Result<Vec<String>>
pub fn search_series( &self, q: SeriesName, limit: Option<Limit>, ) -> Result<Vec<String>>
Search series
Fuzzy search for series by name. Supports partial matches and typos.
Endpoint: GET /api/series/search
Sourcepub fn get_series_info(&self, series: SeriesName) -> Result<SeriesInfo>
pub fn get_series_info(&self, series: SeriesName) -> Result<SeriesInfo>
Get series info
Returns the supported indexes and value type for the specified series.
Endpoint: GET /api/series/{series}
Sourcepub fn get_series(
&self,
series: SeriesName,
index: Index,
start: Option<RangeIndex>,
end: Option<RangeIndex>,
limit: Option<Limit>,
format: Option<Format>,
) -> Result<FormatResponse<SeriesData>>
pub fn get_series( &self, series: SeriesName, index: Index, start: Option<RangeIndex>, end: Option<RangeIndex>, limit: Option<Limit>, format: Option<Format>, ) -> Result<FormatResponse<SeriesData>>
Get series data
Fetch data for a specific series at the given index. Use query parameters to filter by date range and format (json/csv).
Endpoint: GET /api/series/{series}/{index}
Sourcepub fn get_series_data(
&self,
series: SeriesName,
index: Index,
start: Option<RangeIndex>,
end: Option<RangeIndex>,
limit: Option<Limit>,
format: Option<Format>,
) -> Result<FormatResponse<Vec<bool>>>
pub fn get_series_data( &self, series: SeriesName, index: Index, start: Option<RangeIndex>, end: Option<RangeIndex>, limit: Option<Limit>, format: Option<Format>, ) -> Result<FormatResponse<Vec<bool>>>
Get raw series data
Returns just the data array without the SeriesData wrapper. Supports the same range and format parameters as the standard endpoint.
Endpoint: GET /api/series/{series}/{index}/data
Sourcepub fn get_series_latest(
&self,
series: SeriesName,
index: Index,
) -> Result<String>
pub fn get_series_latest( &self, series: SeriesName, index: Index, ) -> Result<String>
Get latest series value
Returns the single most recent value for a series, unwrapped (not inside a SeriesData object).
Endpoint: GET /api/series/{series}/{index}/latest
Sourcepub fn get_series_len(&self, series: SeriesName, index: Index) -> Result<f64>
pub fn get_series_len(&self, series: SeriesName, index: Index) -> Result<f64>
Get series data length
Returns the total number of data points for a series at the given index.
Endpoint: GET /api/series/{series}/{index}/len
Sourcepub fn get_series_version(
&self,
series: SeriesName,
index: Index,
) -> Result<Version>
pub fn get_series_version( &self, series: SeriesName, index: Index, ) -> Result<Version>
Get series version
Returns the current version of a series. Changes when the series data is updated.
Endpoint: GET /api/series/{series}/{index}/version
Sourcepub fn get_disk_usage(&self) -> Result<DiskUsage>
pub fn get_disk_usage(&self) -> Result<DiskUsage>
Disk usage
Returns the disk space used by BRK and Bitcoin data.
Endpoint: GET /api/server/disk
Sourcepub fn get_sync_status(&self) -> Result<SyncStatus>
pub fn get_sync_status(&self) -> Result<SyncStatus>
Sync status
Returns the sync status of the indexer, including indexed height, tip height, blocks behind, and last indexed timestamp.
Endpoint: GET /api/server/sync
Sourcepub fn get_tx(&self, txid: Txid) -> Result<Transaction>
pub fn get_tx(&self, txid: Txid) -> Result<Transaction>
Transaction information
Retrieve complete transaction data by transaction ID (txid). Returns inputs, outputs, fee, size, and confirmation status.
Endpoint: GET /api/tx/{txid}
Sourcepub fn get_tx_hex(&self, txid: Txid) -> Result<String>
pub fn get_tx_hex(&self, txid: Txid) -> Result<String>
Transaction hex
Retrieve the raw transaction as a hex-encoded string. Returns the serialized transaction in hexadecimal format.
Endpoint: GET /api/tx/{txid}/hex
Sourcepub fn get_tx_merkle_proof(&self, txid: Txid) -> Result<MerkleProof>
pub fn get_tx_merkle_proof(&self, txid: Txid) -> Result<MerkleProof>
Transaction merkle proof
Get the merkle inclusion proof for a transaction.
Endpoint: GET /api/tx/{txid}/merkle-proof
Sourcepub fn get_tx_merkleblock_proof(&self, txid: Txid) -> Result<String>
pub fn get_tx_merkleblock_proof(&self, txid: Txid) -> Result<String>
Transaction merkleblock proof
Get the merkleblock proof for a transaction (BIP37 format, hex encoded).
Endpoint: GET /api/tx/{txid}/merkleblock-proof
Sourcepub fn get_tx_outspend(&self, txid: Txid, vout: Vout) -> Result<TxOutspend>
pub fn get_tx_outspend(&self, txid: Txid, vout: Vout) -> Result<TxOutspend>
Output spend status
Get the spending status of a transaction output. Returns whether the output has been spent and, if so, the spending transaction details.
Endpoint: GET /api/tx/{txid}/outspend/{vout}
Sourcepub fn get_tx_outspends(&self, txid: Txid) -> Result<Vec<TxOutspend>>
pub fn get_tx_outspends(&self, txid: Txid) -> Result<Vec<TxOutspend>>
All output spend statuses
Get the spending status of all outputs in a transaction. Returns an array with the spend status for each output.
Endpoint: GET /api/tx/{txid}/outspends
Sourcepub fn get_tx_raw(&self, txid: Txid) -> Result<String>
pub fn get_tx_raw(&self, txid: Txid) -> Result<String>
Transaction raw
Returns a transaction as binary data.
Endpoint: GET /api/tx/{txid}/raw
Sourcepub fn get_tx_status(&self, txid: Txid) -> Result<TxStatus>
pub fn get_tx_status(&self, txid: Txid) -> Result<TxStatus>
Transaction status
Retrieve the confirmation status of a transaction. Returns whether the transaction is confirmed and, if so, the block height, hash, and timestamp.
Endpoint: GET /api/tx/{txid}/status
Sourcepub fn get_block_v1(&self, hash: BlockHash) -> Result<BlockInfoV1>
pub fn get_block_v1(&self, hash: BlockHash) -> Result<BlockInfoV1>
Block (v1)
Returns block details with extras by hash.
Endpoint: GET /api/v1/block/{hash}
Sourcepub fn get_blocks_v1(&self) -> Result<Vec<BlockInfoV1>>
pub fn get_blocks_v1(&self) -> Result<Vec<BlockInfoV1>>
Recent blocks with extras
Retrieve the last 10 blocks with extended data including pool identification and fee statistics.
Endpoint: GET /api/v1/blocks
Sourcepub fn get_blocks_v1_from_height(
&self,
height: Height,
) -> Result<Vec<BlockInfoV1>>
pub fn get_blocks_v1_from_height( &self, height: Height, ) -> Result<Vec<BlockInfoV1>>
Blocks from height with extras
Retrieve up to 10 blocks with extended data going backwards from the given height.
Endpoint: GET /api/v1/blocks/{height}
Sourcepub fn get_cpfp(&self, txid: Txid) -> Result<CpfpInfo>
pub fn get_cpfp(&self, txid: Txid) -> Result<CpfpInfo>
CPFP info
Returns ancestors and descendants for a CPFP (Child Pays For Parent) transaction, including the effective fee rate of the package.
Endpoint: GET /api/v1/cpfp/{txid}
Sourcepub fn get_difficulty_adjustment(&self) -> Result<DifficultyAdjustment>
pub fn get_difficulty_adjustment(&self) -> Result<DifficultyAdjustment>
Difficulty adjustment
Get current difficulty adjustment progress and estimates.
Endpoint: GET /api/v1/difficulty-adjustment
Sourcepub fn get_mempool_blocks(&self) -> Result<Vec<MempoolBlock>>
pub fn get_mempool_blocks(&self) -> Result<Vec<MempoolBlock>>
Projected mempool blocks
Get projected blocks from the mempool for fee estimation.
Endpoint: GET /api/v1/fees/mempool-blocks
Sourcepub fn get_precise_fees(&self) -> Result<RecommendedFees>
pub fn get_precise_fees(&self) -> Result<RecommendedFees>
Precise recommended fees
Get recommended fee rates with up to 3 decimal places.
Endpoint: GET /api/v1/fees/precise
Sourcepub fn get_recommended_fees(&self) -> Result<RecommendedFees>
pub fn get_recommended_fees(&self) -> Result<RecommendedFees>
Recommended fees
Get recommended fee rates for different confirmation targets.
Endpoint: GET /api/v1/fees/recommended
Sourcepub fn get_historical_price(
&self,
timestamp: Option<Timestamp>,
) -> Result<HistoricalPrice>
pub fn get_historical_price( &self, timestamp: Option<Timestamp>, ) -> Result<HistoricalPrice>
Historical price
Get historical BTC/USD price. Optionally specify a UNIX timestamp to get the price at that time.
Endpoint: GET /api/v1/historical-price
Sourcepub fn get_block_fee_rates(
&self,
time_period: TimePeriod,
) -> Result<Vec<BlockFeeRatesEntry>>
pub fn get_block_fee_rates( &self, time_period: TimePeriod, ) -> Result<Vec<BlockFeeRatesEntry>>
Block fee rates
Get block fee rate percentiles (min, 10th, 25th, median, 75th, 90th, max) for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y.
Endpoint: GET /api/v1/mining/blocks/fee-rates/{time_period}
Sourcepub fn get_block_fees(
&self,
time_period: TimePeriod,
) -> Result<Vec<BlockFeesEntry>>
pub fn get_block_fees( &self, time_period: TimePeriod, ) -> Result<Vec<BlockFeesEntry>>
Block fees
Get average total fees per block for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y.
Endpoint: GET /api/v1/mining/blocks/fees/{time_period}
Sourcepub fn get_block_rewards(
&self,
time_period: TimePeriod,
) -> Result<Vec<BlockRewardsEntry>>
pub fn get_block_rewards( &self, time_period: TimePeriod, ) -> Result<Vec<BlockRewardsEntry>>
Block rewards
Get average coinbase reward (subsidy + fees) per block for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y.
Endpoint: GET /api/v1/mining/blocks/rewards/{time_period}
Sourcepub fn get_block_sizes_weights(
&self,
time_period: TimePeriod,
) -> Result<BlockSizesWeights>
pub fn get_block_sizes_weights( &self, time_period: TimePeriod, ) -> Result<BlockSizesWeights>
Block sizes and weights
Get average block sizes and weights for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y.
Endpoint: GET /api/v1/mining/blocks/sizes-weights/{time_period}
Sourcepub fn get_block_by_timestamp(
&self,
timestamp: Timestamp,
) -> Result<BlockTimestamp>
pub fn get_block_by_timestamp( &self, timestamp: Timestamp, ) -> Result<BlockTimestamp>
Block by timestamp
Find the block closest to a given UNIX timestamp.
Endpoint: GET /api/v1/mining/blocks/timestamp/{timestamp}
Sourcepub fn get_difficulty_adjustments(
&self,
) -> Result<Vec<DifficultyAdjustmentEntry>>
pub fn get_difficulty_adjustments( &self, ) -> Result<Vec<DifficultyAdjustmentEntry>>
Difficulty adjustments (all time)
Get historical difficulty adjustments including timestamp, block height, difficulty value, and percentage change.
Endpoint: GET /api/v1/mining/difficulty-adjustments
Sourcepub fn get_difficulty_adjustments_by_period(
&self,
time_period: TimePeriod,
) -> Result<Vec<DifficultyAdjustmentEntry>>
pub fn get_difficulty_adjustments_by_period( &self, time_period: TimePeriod, ) -> Result<Vec<DifficultyAdjustmentEntry>>
Difficulty adjustments
Get historical difficulty adjustments for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y.
Endpoint: GET /api/v1/mining/difficulty-adjustments/{time_period}
Sourcepub fn get_hashrate(&self) -> Result<HashrateSummary>
pub fn get_hashrate(&self) -> Result<HashrateSummary>
Network hashrate (all time)
Get network hashrate and difficulty data for all time.
Endpoint: GET /api/v1/mining/hashrate
Sourcepub fn get_pools_hashrate(&self) -> Result<Vec<PoolHashrateEntry>>
pub fn get_pools_hashrate(&self) -> Result<Vec<PoolHashrateEntry>>
All pools hashrate (all time)
Get hashrate data for all mining pools.
Endpoint: GET /api/v1/mining/hashrate/pools
Sourcepub fn get_pools_hashrate_by_period(
&self,
time_period: TimePeriod,
) -> Result<Vec<PoolHashrateEntry>>
pub fn get_pools_hashrate_by_period( &self, time_period: TimePeriod, ) -> Result<Vec<PoolHashrateEntry>>
All pools hashrate
Get hashrate data for all mining pools for a time period. Valid periods: 1m, 3m, 6m, 1y, 2y, 3y.
Endpoint: GET /api/v1/mining/hashrate/pools/{time_period}
Sourcepub fn get_hashrate_by_period(
&self,
time_period: TimePeriod,
) -> Result<HashrateSummary>
pub fn get_hashrate_by_period( &self, time_period: TimePeriod, ) -> Result<HashrateSummary>
Network hashrate
Get network hashrate and difficulty data for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y.
Endpoint: GET /api/v1/mining/hashrate/{time_period}
Sourcepub fn get_pool(&self, slug: PoolSlug) -> Result<PoolDetail>
pub fn get_pool(&self, slug: PoolSlug) -> Result<PoolDetail>
Mining pool details
Get detailed information about a specific mining pool including block counts and shares for different time periods.
Endpoint: GET /api/v1/mining/pool/{slug}
Sourcepub fn get_pool_blocks(&self, slug: PoolSlug) -> Result<Vec<BlockInfoV1>>
pub fn get_pool_blocks(&self, slug: PoolSlug) -> Result<Vec<BlockInfoV1>>
Mining pool blocks
Get the 10 most recent blocks mined by a specific pool.
Endpoint: GET /api/v1/mining/pool/{slug}/blocks
Sourcepub fn get_pool_blocks_from(
&self,
slug: PoolSlug,
height: Height,
) -> Result<Vec<BlockInfoV1>>
pub fn get_pool_blocks_from( &self, slug: PoolSlug, height: Height, ) -> Result<Vec<BlockInfoV1>>
Mining pool blocks from height
Get 10 blocks mined by a specific pool before (and including) the given height.
Endpoint: GET /api/v1/mining/pool/{slug}/blocks/{height}
Sourcepub fn get_pool_hashrate(
&self,
slug: PoolSlug,
) -> Result<Vec<PoolHashrateEntry>>
pub fn get_pool_hashrate( &self, slug: PoolSlug, ) -> Result<Vec<PoolHashrateEntry>>
Mining pool hashrate
Get hashrate history for a specific mining pool.
Endpoint: GET /api/v1/mining/pool/{slug}/hashrate
Sourcepub fn get_pools(&self) -> Result<Vec<PoolInfo>>
pub fn get_pools(&self) -> Result<Vec<PoolInfo>>
List all mining pools
Get list of all known mining pools with their identifiers.
Endpoint: GET /api/v1/mining/pools
Sourcepub fn get_pool_stats(&self, time_period: TimePeriod) -> Result<PoolsSummary>
pub fn get_pool_stats(&self, time_period: TimePeriod) -> Result<PoolsSummary>
Mining pool statistics
Get mining pool statistics for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y.
Endpoint: GET /api/v1/mining/pools/{time_period}
Sourcepub fn get_reward_stats(&self, block_count: i64) -> Result<RewardStats>
pub fn get_reward_stats(&self, block_count: i64) -> Result<RewardStats>
Mining reward statistics
Get mining reward statistics for the last N blocks including total rewards, fees, and transaction count.
Endpoint: GET /api/v1/mining/reward-stats/{block_count}
Sourcepub fn get_prices(&self) -> Result<Prices>
pub fn get_prices(&self) -> Result<Prices>
Current BTC price
Returns bitcoin latest price (on-chain derived, USD only).
Endpoint: GET /api/v1/prices
Sourcepub fn get_transaction_times(&self) -> Result<Vec<f64>>
pub fn get_transaction_times(&self) -> Result<Vec<f64>>
Transaction first-seen times
Returns timestamps when transactions were first seen in the mempool. Returns 0 for mined or unknown transactions.
Endpoint: GET /api/v1/transaction-times
Sourcepub fn validate_address(&self, address: &str) -> Result<AddrValidation>
pub fn validate_address(&self, address: &str) -> Result<AddrValidation>
Validate address
Validate a Bitcoin address and get information about its type and scriptPubKey. Returns isvalid: false with an error message for invalid addresses.
Endpoint: GET /api/v1/validate-address/{address}
Sourcepub fn get_health(&self) -> Result<Health>
pub fn get_health(&self) -> Result<Health>
Health check
Returns the health status of the API server, including uptime information.
Endpoint: GET /health
Sourcepub fn get_openapi(&self) -> Result<String>
pub fn get_openapi(&self) -> Result<String>
OpenAPI specification
Full OpenAPI 3.1 specification for this API.
Endpoint: GET /openapi.json
Sourcepub fn get_version(&self) -> Result<String>
pub fn get_version(&self) -> Result<String>
API version
Returns the current version of the API server
Endpoint: GET /version
Auto Trait Implementations§
impl Freeze for BrkClient
impl !RefUnwindSafe for BrkClient
impl Send for BrkClient
impl Sync for BrkClient
impl Unpin for BrkClient
impl UnsafeUnpin for BrkClient
impl !UnwindSafe for BrkClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more