pub trait Indexer {
Show 13 methods
// Required methods
fn get_lightd_info(
&mut self,
timeout: Duration,
) -> impl Future<Output = Result<LightdInfo, Status>> + Send;
fn get_latest_block(
&mut self,
timeout: Duration,
) -> impl Future<Output = Result<BlockId, Status>> + Send;
fn send_transaction(
&mut self,
tx: RawTransaction,
timeout: Duration,
) -> impl Future<Output = Result<String, Status>> + Send;
fn get_tree_state(
&mut self,
block_id: BlockId,
timeout: Duration,
) -> impl Future<Output = Result<TreeState, Status>> + Send;
fn get_block(
&mut self,
block_id: BlockId,
timeout: Duration,
) -> impl Future<Output = Result<CompactBlock, Status>> + Send;
fn get_block_nullifiers(
&mut self,
block_id: BlockId,
timeout: Duration,
) -> impl Future<Output = Result<CompactBlock, Status>> + Send;
fn get_block_range(
&mut self,
range: BlockRange,
timeout: Duration,
) -> impl Future<Output = Result<Streaming<CompactBlock>, Status>> + Send;
fn get_block_range_nullifiers(
&mut self,
range: BlockRange,
timeout: Duration,
) -> impl Future<Output = Result<Streaming<CompactBlock>, Status>> + Send;
fn get_transaction(
&mut self,
filter: TxFilter,
timeout: Duration,
) -> impl Future<Output = Result<RawTransaction, Status>> + Send;
fn get_mempool_tx(
&mut self,
request: GetMempoolTxRequest,
timeout: Duration,
) -> impl Future<Output = Result<Streaming<CompactTx>, Status>> + Send;
fn get_mempool_stream(
&mut self,
timeout: Duration,
) -> impl Future<Output = Result<Streaming<RawTransaction>, Status>> + Send;
fn get_latest_tree_state(
&mut self,
timeout: Duration,
) -> impl Future<Output = Result<TreeState, Status>> + Send;
fn get_subtree_roots(
&mut self,
arg: GetSubtreeRootsArg,
timeout: Duration,
) -> impl Future<Output = Result<Streaming<SubtreeRoot>, Status>> + Send;
}Expand description
Trait for communicating with a Zcash chain indexer.
Implementors provide access to a lightwalletd-compatible server. Callers can depend on the following guarantees:
- Each method opens a fresh connection (or reuses a pooled one) — no persistent session state is assumed between calls.
Required Methods§
Sourcefn get_lightd_info(
&mut self,
timeout: Duration,
) -> impl Future<Output = Result<LightdInfo, Status>> + Send
fn get_lightd_info( &mut self, timeout: Duration, ) -> impl Future<Output = Result<LightdInfo, Status>> + Send
Return server metadata (chain name, block height, version, etc.).
The returned LightdInfo includes the chain name, current block height,
server version, and consensus branch ID. Callers should not cache this
value across sync boundaries as the block height is a point-in-time snapshot.
Sourcefn get_latest_block(
&mut self,
timeout: Duration,
) -> impl Future<Output = Result<BlockId, Status>> + Send
fn get_latest_block( &mut self, timeout: Duration, ) -> impl Future<Output = Result<BlockId, Status>> + Send
Return the height and hash of the chain tip.
The returned BlockId identifies the most recent block the server
is aware of. The hash may be omitted by some implementations.
Sourcefn send_transaction(
&mut self,
tx: RawTransaction,
timeout: Duration,
) -> impl Future<Output = Result<String, Status>> + Send
fn send_transaction( &mut self, tx: RawTransaction, timeout: Duration, ) -> impl Future<Output = Result<String, Status>> + Send
Submit a raw transaction to the network.
On success, returns the transaction ID as a hex string.
On rejection by the network, returns a tonic::Status
containing the rejection reason. Callers should be prepared for
transient failures and may retry.
Sourcefn get_tree_state(
&mut self,
block_id: BlockId,
timeout: Duration,
) -> impl Future<Output = Result<TreeState, Status>> + Send
fn get_tree_state( &mut self, block_id: BlockId, timeout: Duration, ) -> impl Future<Output = Result<TreeState, Status>> + Send
Fetch the note commitment tree state for the given block.
Returns Sapling and Orchard commitment tree frontiers as of the
end of the specified block. The block can be identified by height,
hash, or both via BlockId. Requesting an unmined block is an error.
Sourcefn get_block(
&mut self,
block_id: BlockId,
timeout: Duration,
) -> impl Future<Output = Result<CompactBlock, Status>> + Send
fn get_block( &mut self, block_id: BlockId, timeout: Duration, ) -> impl Future<Output = Result<CompactBlock, Status>> + Send
Return the compact block at the given height.
The returned CompactBlock contains compact transaction data
sufficient for trial decryption and nullifier detection.
Sourcefn get_block_nullifiers(
&mut self,
block_id: BlockId,
timeout: Duration,
) -> impl Future<Output = Result<CompactBlock, Status>> + Send
👎Deprecated: use get_block instead
fn get_block_nullifiers( &mut self, block_id: BlockId, timeout: Duration, ) -> impl Future<Output = Result<CompactBlock, Status>> + Send
use get_block instead
Return the compact block at the given height, containing only nullifiers.
The returned CompactBlock omits output data, retaining only
spend nullifiers. Callers should migrate to get_block.
Sourcefn get_block_range(
&mut self,
range: BlockRange,
timeout: Duration,
) -> impl Future<Output = Result<Streaming<CompactBlock>, Status>> + Send
fn get_block_range( &mut self, range: BlockRange, timeout: Duration, ) -> impl Future<Output = Result<Streaming<CompactBlock>, Status>> + Send
Return a stream of consecutive compact blocks for the given range.
Both endpoints of the range are inclusive. If start <= end, blocks
are yielded in ascending height order; if start > end, blocks are
yielded in descending height order. See the test
tests::get_block_range_supports_descending_order for a live
verification of descending order against a public indexer.
Callers must consume or drop the stream before the connection is reused.
Sourcefn get_block_range_nullifiers(
&mut self,
range: BlockRange,
timeout: Duration,
) -> impl Future<Output = Result<Streaming<CompactBlock>, Status>> + Send
👎Deprecated: use get_block_range instead
fn get_block_range_nullifiers( &mut self, range: BlockRange, timeout: Duration, ) -> impl Future<Output = Result<Streaming<CompactBlock>, Status>> + Send
use get_block_range instead
Return a stream of consecutive compact blocks (nullifiers only) for the given range.
Same streaming guarantees as get_block_range
but each block contains only nullifiers.
Callers should migrate to get_block_range.
Sourcefn get_transaction(
&mut self,
filter: TxFilter,
timeout: Duration,
) -> impl Future<Output = Result<RawTransaction, Status>> + Send
fn get_transaction( &mut self, filter: TxFilter, timeout: Duration, ) -> impl Future<Output = Result<RawTransaction, Status>> + Send
Return the full serialized transaction matching the given filter.
The filter identifies a transaction by its txid hash. The returned
RawTransaction contains the complete serialized bytes and the
block height at which it was mined (0 if in the mempool).
Sourcefn get_mempool_tx(
&mut self,
request: GetMempoolTxRequest,
timeout: Duration,
) -> impl Future<Output = Result<Streaming<CompactTx>, Status>> + Send
fn get_mempool_tx( &mut self, request: GetMempoolTxRequest, timeout: Duration, ) -> impl Future<Output = Result<Streaming<CompactTx>, Status>> + Send
Return a stream of compact transactions currently in the mempool.
The request may include txid suffixes to exclude from the results, allowing the caller to avoid re-fetching known transactions. Results may be seconds out of date.
Sourcefn get_mempool_stream(
&mut self,
timeout: Duration,
) -> impl Future<Output = Result<Streaming<RawTransaction>, Status>> + Send
fn get_mempool_stream( &mut self, timeout: Duration, ) -> impl Future<Output = Result<Streaming<RawTransaction>, Status>> + Send
Return a stream of raw mempool transactions.
The stream remains open while there are mempool transactions and closes when a new block is mined.
Sourcefn get_latest_tree_state(
&mut self,
timeout: Duration,
) -> impl Future<Output = Result<TreeState, Status>> + Send
fn get_latest_tree_state( &mut self, timeout: Duration, ) -> impl Future<Output = Result<TreeState, Status>> + Send
Return the note commitment tree state at the chain tip.
Equivalent to calling get_tree_state with
the current tip height, but avoids the need to query the tip first.
Sourcefn get_subtree_roots(
&mut self,
arg: GetSubtreeRootsArg,
timeout: Duration,
) -> impl Future<Output = Result<Streaming<SubtreeRoot>, Status>> + Send
fn get_subtree_roots( &mut self, arg: GetSubtreeRootsArg, timeout: Duration, ) -> impl Future<Output = Result<Streaming<SubtreeRoot>, Status>> + Send
Return a stream of subtree roots for the given shielded protocol.
Yields roots in ascending index order starting from start_index.
Pass max_entries = 0 to request all available roots.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".