Skip to main content

Api

Trait Api 

Source
pub trait Api:
    Send
    + Sync
    + 'static {
Show 16 methods // Required methods fn status<'life0, 'async_trait>( &'life0 self, request: Request<()>, ) -> Pin<Box<dyn Future<Output = Result<Response<RpcStatus>, 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 submit_proven_transaction<'life0, 'async_trait>( &'life0 self, request: Request<ProvenTransaction>, ) -> Pin<Box<dyn Future<Output = Result<Response<BlockNumber>, Status>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn submit_proven_batch<'life0, 'async_trait>( &'life0 self, request: Request<ProvenTransactionBatch>, ) -> Pin<Box<dyn Future<Output = Result<Response<BlockNumber>, 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_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_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_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; fn get_limits<'life0, 'async_trait>( &'life0 self, request: Request<()>, ) -> Pin<Box<dyn Future<Output = Result<Response<RpcLimits>, 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 ApiServer.

Required Methods§

Source

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

Returns the status info of the node.

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 (nullifier not in tree)
  • single or multiple: Inclusion proof only if the requested nullifier appears as a key.

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 of 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 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 submit_proven_transaction<'life0, 'async_trait>( &'life0 self, request: Request<ProvenTransaction>, ) -> Pin<Box<dyn Future<Output = Result<Response<BlockNumber>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Submits proven transaction to the Miden network. Returns the node’s current block height.

Source

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

Submits a proven batch of transactions to the Miden network.

The batch may include transactions which were are:

  • already in the mempool i.e. previously successfully submitted
  • will be submitted to the mempool in the future
  • won’t be submitted to the mempool at all

All transactions in the batch but not in the mempool must build on the current mempool state following normal transaction submission rules.

Returns the node’s current block height.

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_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_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 client to sync up to the tip of chain for the notes they are interested in.

Client 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 client to sync up to the latest state of the chain for the objects (accounts and notes) the client 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. Client is expected to repeat these requests in a loop until response.block_header.block_num == response.chain_tip, at which point the client is fully synchronized with the chain.

Each update response also contains info about new notes, accounts 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 contain only high part of hashes. Thus, returned data contains excessive notes, client can make additional filtering of that data on its side.

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.

Source

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

Returns the query parameter limits configured for RPC methods.

These define the maximum number of each parameter a method will accept. Exceeding the limit will result in the request being rejected and you should instead send multiple smaller requests.

Implementors§