Trait miden_client::rpc::NodeRpcClient
source · pub trait NodeRpcClient {
// Required methods
async fn submit_proven_transaction(
&mut self,
proven_transaction: ProvenTransaction,
) -> Result<(), RpcError>;
async fn get_block_header_by_number(
&mut self,
block_num: Option<u32>,
include_mmr_proof: bool,
) -> Result<(BlockHeader, Option<MmrProof>), RpcError>;
async fn get_notes_by_id(
&mut self,
note_ids: &[NoteId],
) -> Result<Vec<NoteDetails>, RpcError>;
async fn sync_state(
&mut self,
block_num: u32,
account_ids: &[AccountId],
note_tags: &[NoteTag],
nullifiers_tags: &[u16],
) -> Result<StateSyncInfo, RpcError>;
async fn get_account_update(
&mut self,
account_id: AccountId,
) -> Result<AccountDetails, RpcError>;
}Expand description
Defines the interface for communicating with the Miden node.
The implementers are responsible for connecting to the Miden node, handling endpoint requests/responses, and translating responses into domain objects relevant for each of the endpoints.
Required Methods§
sourceasync fn submit_proven_transaction(
&mut self,
proven_transaction: ProvenTransaction,
) -> Result<(), RpcError>
async fn submit_proven_transaction( &mut self, proven_transaction: ProvenTransaction, ) -> Result<(), RpcError>
Given a Proven Transaction, send it to the node for it to be included in a future block
using the /SubmitProvenTransaction rpc endpoint
sourceasync fn get_block_header_by_number(
&mut self,
block_num: Option<u32>,
include_mmr_proof: bool,
) -> Result<(BlockHeader, Option<MmrProof>), RpcError>
async fn get_block_header_by_number( &mut self, block_num: Option<u32>, include_mmr_proof: bool, ) -> Result<(BlockHeader, Option<MmrProof>), RpcError>
Given a block number, fetches the block header corresponding to that height from the node
using the /GetBlockHeaderByNumber endpoint.
If include_mmr_proof is set to true and the function returns an Ok, the second value
of the return tuple should always be Some(MmrProof)
When None is provided, returns info regarding the latest block
sourceasync fn get_notes_by_id(
&mut self,
note_ids: &[NoteId],
) -> Result<Vec<NoteDetails>, RpcError>
async fn get_notes_by_id( &mut self, note_ids: &[NoteId], ) -> Result<Vec<NoteDetails>, RpcError>
Fetches note-related data for a list of NoteId using the /GetNotesById rpc endpoint
For any NoteType::Offchain note, the return data is only the NoteMetadata, whereas for NoteType::Onchain notes, the return data includes all details.
sourceasync fn sync_state(
&mut self,
block_num: u32,
account_ids: &[AccountId],
note_tags: &[NoteTag],
nullifiers_tags: &[u16],
) -> Result<StateSyncInfo, RpcError>
async fn sync_state( &mut self, block_num: u32, account_ids: &[AccountId], note_tags: &[NoteTag], nullifiers_tags: &[u16], ) -> Result<StateSyncInfo, RpcError>
Fetches info from the node necessary to perform a state sync using the
/SyncState rpc endpoint
block_numis the last block number known by the client. The returned StateSyncInfo should contain data starting from the next block, until the first block which contains a note of matching the requested tag, or the chain tip if there are no notes.account_idsis a list of account ids and determines the accounts the client is interested in and should receive account updates of.note_tagsis a list of tags used to filter the notes the client is interested in, which serves as a “note group” filter. Notice that you can’t filter by a specific note idnullifiers_tagssimilar tonote_tags, is a list of tags used to filter the nullifiers corresponding to some notes the client is interested in
sourceasync fn get_account_update(
&mut self,
account_id: AccountId,
) -> Result<AccountDetails, RpcError>
async fn get_account_update( &mut self, account_id: AccountId, ) -> Result<AccountDetails, RpcError>
Fetches the current state of an account from the node using the /GetAccountDetails rpc endpoint
account_idis the id of the wanted account.