Skip to main content

Rpc

Trait Rpc 

Source
pub trait Rpc:
    Send
    + Sync
    + 'static {
Show 13 methods // Required methods fn status<'life0, 'async_trait>( &'life0 self, request: Request<()>, ) -> Pin<Box<dyn Future<Output = Result<Response<StoreStatus>, Status>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn check_nullifiers<'life0, 'async_trait>( &'life0 self, request: Request<NullifierList>, ) -> Pin<Box<dyn Future<Output = Result<Response<CheckNullifiersResponse>, Status>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_account<'life0, 'async_trait>( &'life0 self, request: Request<AccountRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<AccountResponse>, Status>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_block_by_number<'life0, 'async_trait>( &'life0 self, request: Request<BlockNumber>, ) -> Pin<Box<dyn Future<Output = Result<Response<MaybeBlock>, Status>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_block_header_by_number<'life0, 'async_trait>( &'life0 self, request: Request<BlockHeaderByNumberRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<BlockHeaderByNumberResponse>, Status>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_notes_by_id<'life0, 'async_trait>( &'life0 self, request: Request<NoteIdList>, ) -> Pin<Box<dyn Future<Output = Result<Response<CommittedNoteList>, Status>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_note_script_by_root<'life0, 'async_trait>( &'life0 self, request: Request<NoteRoot>, ) -> Pin<Box<dyn Future<Output = Result<Response<MaybeNoteScript>, Status>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn sync_nullifiers<'life0, 'async_trait>( &'life0 self, request: Request<SyncNullifiersRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<SyncNullifiersResponse>, Status>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn sync_notes<'life0, 'async_trait>( &'life0 self, request: Request<SyncNotesRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<SyncNotesResponse>, Status>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn sync_state<'life0, 'async_trait>( &'life0 self, request: Request<SyncStateRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<SyncStateResponse>, Status>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn sync_account_vault<'life0, 'async_trait>( &'life0 self, request: Request<SyncAccountVaultRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<SyncAccountVaultResponse>, Status>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn sync_account_storage_maps<'life0, 'async_trait>( &'life0 self, request: Request<SyncAccountStorageMapsRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<SyncAccountStorageMapsResponse>, Status>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn sync_transactions<'life0, 'async_trait>( &'life0 self, request: Request<SyncTransactionsRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<SyncTransactionsResponse>, Status>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait;
}
Expand description

Generated trait containing gRPC methods that should be implemented for use with RpcServer.

Required Methods§

Source

fn status<'life0, 'async_trait>( &'life0 self, request: Request<()>, ) -> Pin<Box<dyn Future<Output = Result<Response<StoreStatus>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the status info.

Source

fn check_nullifiers<'life0, 'async_trait>( &'life0 self, request: Request<NullifierList>, ) -> Pin<Box<dyn Future<Output = Result<Response<CheckNullifiersResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns a Sparse Merkle Tree opening proof for each requested nullifier

Each proof demonstrates either:

  • Inclusion: Nullifier exists in the tree (note was consumed)
  • Non-inclusion: Nullifier does not exist (note was not consumed)

The leaf field indicates the status:

  • empty_leaf_index: Non-inclusion proof
  • single or multiple: Inclusion proof if the nullifier key is present

Verify proofs against the nullifier tree root in the latest block header.

Source

fn get_account<'life0, 'async_trait>( &'life0 self, request: Request<AccountRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<AccountResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the latest details the specified account.

Source

fn get_block_by_number<'life0, 'async_trait>( &'life0 self, request: Request<BlockNumber>, ) -> Pin<Box<dyn Future<Output = Result<Response<MaybeBlock>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns raw block data for the specified block number.

Source

fn get_block_header_by_number<'life0, 'async_trait>( &'life0 self, request: Request<BlockHeaderByNumberRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<BlockHeaderByNumberResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Retrieves block header by given block number. Optionally, it also returns the MMR path and current chain length to authenticate the block’s inclusion.

Source

fn get_notes_by_id<'life0, 'async_trait>( &'life0 self, request: Request<NoteIdList>, ) -> Pin<Box<dyn Future<Output = Result<Response<CommittedNoteList>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns a list of committed notes matching the provided note IDs.

Source

fn get_note_script_by_root<'life0, 'async_trait>( &'life0 self, request: Request<NoteRoot>, ) -> Pin<Box<dyn Future<Output = Result<Response<MaybeNoteScript>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the script for a note by its root.

Source

fn sync_nullifiers<'life0, 'async_trait>( &'life0 self, request: Request<SyncNullifiersRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<SyncNullifiersResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns a list of nullifiers that match the specified prefixes and are recorded in the node.

Note that only 16-bit prefixes are supported at this time.

Source

fn sync_notes<'life0, 'async_trait>( &'life0 self, request: Request<SyncNotesRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<SyncNotesResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns info which can be used by the requester to sync up to the tip of chain for the notes they are interested in.

requester specifies the note_tags they are interested in, and the block height from which to search for new for matching notes for. The request will then return the next block containing any note matching the provided tags.

The response includes each note’s metadata and inclusion proof.

A basic note sync can be implemented by repeatedly requesting the previous response’s block until reaching the tip of the chain.

Source

fn sync_state<'life0, 'async_trait>( &'life0 self, request: Request<SyncStateRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<SyncStateResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns info which can be used by the requester to sync up to the latest state of the chain for the objects (accounts, notes, nullifiers) the requester is interested in.

This request returns the next block containing requested data. It also returns chain_tip which is the latest block number in the chain. requester is expected to repeat these requests in a loop until response.block_header.block_num == response.chain_tip, at which point the requester is fully synchronized with the chain.

Each request also returns info about new notes, nullifiers etc. created. It also returns Chain MMR delta that can be used to update the state of Chain MMR. This includes both chain MMR peaks and chain MMR nodes.

For preserving some degree of privacy, note tags and nullifiers filters contain only high part of hashes. Thus, returned data contains excessive notes and nullifiers, requester can make additional filtering of that data on its side.

Source

fn sync_account_vault<'life0, 'async_trait>( &'life0 self, request: Request<SyncAccountVaultRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<SyncAccountVaultResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns account vault updates for specified account within a block range.

Source

fn sync_account_storage_maps<'life0, 'async_trait>( &'life0 self, request: Request<SyncAccountStorageMapsRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<SyncAccountStorageMapsResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns storage map updates for specified account and storage slots within a block range.

Source

fn sync_transactions<'life0, 'async_trait>( &'life0 self, request: Request<SyncTransactionsRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<SyncTransactionsResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns transactions records for specific accounts within a block range.

Implementors§