pub trait NodeRpcClient {
Show 13 methods
// Required methods
fn submit_proven_transaction<'life0, 'async_trait>(
&'life0 mut self,
proven_transaction: ProvenTransaction,
) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_block_header_by_number<'life0, 'async_trait>(
&'life0 mut self,
block_num: Option<BlockNumber>,
include_mmr_proof: bool,
) -> Pin<Box<dyn Future<Output = Result<(BlockHeader, Option<MmrProof>), RpcError>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_notes_by_id<'life0, 'life1, 'async_trait>(
&'life0 mut self,
note_ids: &'life1 [NoteId],
) -> Pin<Box<dyn Future<Output = Result<Vec<NetworkNote>, RpcError>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn sync_state<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 mut self,
block_num: BlockNumber,
account_ids: &'life1 [AccountId],
note_tags: &'life2 [NoteTag],
nullifiers_tags: &'life3 [u16],
) -> Pin<Box<dyn Future<Output = Result<StateSyncInfo, RpcError>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn get_account_update<'life0, 'async_trait>(
&'life0 mut self,
account_id: AccountId,
) -> Pin<Box<dyn Future<Output = Result<AccountDetails, RpcError>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn sync_notes<'life0, 'life1, 'async_trait>(
&'life0 mut self,
block_num: BlockNumber,
note_tags: &'life1 [NoteTag],
) -> Pin<Box<dyn Future<Output = Result<NoteSyncInfo, RpcError>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn check_nullifiers_by_prefix<'life0, 'life1, 'async_trait>(
&'life0 mut self,
prefix: &'life1 [u16],
) -> Pin<Box<dyn Future<Output = Result<Vec<(Nullifier, u32)>, RpcError>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_account_proofs<'life0, 'life1, 'async_trait>(
&'life0 mut self,
account_storage_requests: &'life1 BTreeSet<ForeignAccount>,
known_account_codes: Vec<AccountCode>,
) -> Pin<Box<dyn Future<Output = Result<AccountProofs, RpcError>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn get_nullifier_commit_height<'life0, 'life1, 'async_trait>(
&'life0 mut self,
nullifier: &'life1 Nullifier,
) -> Pin<Box<dyn Future<Output = Result<Option<u32>, RpcError>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn get_public_note_records<'life0, 'life1, 'async_trait>(
&'life0 mut self,
note_ids: &'life1 [NoteId],
current_timestamp: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<Vec<InputNoteRecord>, RpcError>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn get_updated_public_accounts<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
local_accounts: &'life1 [&'life2 AccountHeader],
) -> Pin<Box<dyn Future<Output = Result<Vec<Account>, RpcError>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn get_block_header_with_proof<'life0, 'async_trait>(
&'life0 mut self,
block_num: BlockNumber,
) -> Pin<Box<dyn Future<Output = Result<(BlockHeader, MmrProof), RpcError>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn get_note_by_id<'life0, 'async_trait>(
&'life0 mut self,
note_id: NoteId,
) -> Pin<Box<dyn Future<Output = Result<NetworkNote, RpcError>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}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§
Sourcefn submit_proven_transaction<'life0, 'async_trait>(
&'life0 mut self,
proven_transaction: ProvenTransaction,
) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn submit_proven_transaction<'life0, 'async_trait>(
&'life0 mut self,
proven_transaction: ProvenTransaction,
) -> Pin<Box<dyn Future<Output = Result<(), RpcError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Given a Proven Transaction, send it to the node for it to be included in a future block
using the /SubmitProvenTransaction RPC endpoint.
Sourcefn get_block_header_by_number<'life0, 'async_trait>(
&'life0 mut self,
block_num: Option<BlockNumber>,
include_mmr_proof: bool,
) -> Pin<Box<dyn Future<Output = Result<(BlockHeader, Option<MmrProof>), RpcError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_block_header_by_number<'life0, 'async_trait>(
&'life0 mut self,
block_num: Option<BlockNumber>,
include_mmr_proof: bool,
) -> Pin<Box<dyn Future<Output = Result<(BlockHeader, Option<MmrProof>), RpcError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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.
Sourcefn get_notes_by_id<'life0, 'life1, 'async_trait>(
&'life0 mut self,
note_ids: &'life1 [NoteId],
) -> Pin<Box<dyn Future<Output = Result<Vec<NetworkNote>, RpcError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_notes_by_id<'life0, 'life1, 'async_trait>(
&'life0 mut self,
note_ids: &'life1 [NoteId],
) -> Pin<Box<dyn Future<Output = Result<Vec<NetworkNote>, RpcError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Fetches note-related data for a list of NoteId using the /GetNotesById rpc endpoint.
For any NoteType::Private note, the return data is only the miden_objects::note::NoteMetadata, whereas for NoteType::Onchain notes, the return data includes all details.
Sourcefn sync_state<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 mut self,
block_num: BlockNumber,
account_ids: &'life1 [AccountId],
note_tags: &'life2 [NoteTag],
nullifiers_tags: &'life3 [u16],
) -> Pin<Box<dyn Future<Output = Result<StateSyncInfo, RpcError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn sync_state<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 mut self,
block_num: BlockNumber,
account_ids: &'life1 [AccountId],
note_tags: &'life2 [NoteTag],
nullifiers_tags: &'life3 [u16],
) -> Pin<Box<dyn Future<Output = Result<StateSyncInfo, RpcError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
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 ID.nullifiers_tagssimilar tonote_tags, is a list of tags used to filter the nullifiers corresponding to some notes the client is interested in.
Sourcefn get_account_update<'life0, 'async_trait>(
&'life0 mut self,
account_id: AccountId,
) -> Pin<Box<dyn Future<Output = Result<AccountDetails, RpcError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_account_update<'life0, 'async_trait>(
&'life0 mut self,
account_id: AccountId,
) -> Pin<Box<dyn Future<Output = Result<AccountDetails, RpcError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Fetches the current state of an account from the node using the /GetAccountDetails RPC
endpoint.
account_idis the ID of the wanted account.
fn sync_notes<'life0, 'life1, 'async_trait>(
&'life0 mut self,
block_num: BlockNumber,
note_tags: &'life1 [NoteTag],
) -> Pin<Box<dyn Future<Output = Result<NoteSyncInfo, RpcError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn check_nullifiers_by_prefix<'life0, 'life1, 'async_trait>(
&'life0 mut self,
prefix: &'life1 [u16],
) -> Pin<Box<dyn Future<Output = Result<Vec<(Nullifier, u32)>, RpcError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn check_nullifiers_by_prefix<'life0, 'life1, 'async_trait>(
&'life0 mut self,
prefix: &'life1 [u16],
) -> Pin<Box<dyn Future<Output = Result<Vec<(Nullifier, u32)>, RpcError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Fetches the nullifiers corresponding to a list of prefixes using the
/CheckNullifiersByPrefix RPC endpoint.
Sourcefn get_account_proofs<'life0, 'life1, 'async_trait>(
&'life0 mut self,
account_storage_requests: &'life1 BTreeSet<ForeignAccount>,
known_account_codes: Vec<AccountCode>,
) -> Pin<Box<dyn Future<Output = Result<AccountProofs, RpcError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_account_proofs<'life0, 'life1, 'async_trait>(
&'life0 mut self,
account_storage_requests: &'life1 BTreeSet<ForeignAccount>,
known_account_codes: Vec<AccountCode>,
) -> Pin<Box<dyn Future<Output = Result<AccountProofs, RpcError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Fetches the account data needed to perform a Foreign Procedure Invocation (FPI) on the
specified foreign accounts, using the GetAccountProofs endpoint.
The code_commitments parameter is a list of known code hashes
to prevent unnecessary data fetching. Returns the block number and the FPI account data. If
one of the tracked accounts is not found in the node, the method will return an error.
Provided Methods§
Sourcefn get_nullifier_commit_height<'life0, 'life1, 'async_trait>(
&'life0 mut self,
nullifier: &'life1 Nullifier,
) -> Pin<Box<dyn Future<Output = Result<Option<u32>, RpcError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_nullifier_commit_height<'life0, 'life1, 'async_trait>(
&'life0 mut self,
nullifier: &'life1 Nullifier,
) -> Pin<Box<dyn Future<Output = Result<Option<u32>, RpcError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Fetches the commit height where the nullifier was consumed. If the nullifier isn’t found,
then None is returned.
The default implementation of this method uses NodeRpcClient::check_nullifiers_by_prefix.
Sourcefn get_public_note_records<'life0, 'life1, 'async_trait>(
&'life0 mut self,
note_ids: &'life1 [NoteId],
current_timestamp: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<Vec<InputNoteRecord>, RpcError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_public_note_records<'life0, 'life1, 'async_trait>(
&'life0 mut self,
note_ids: &'life1 [NoteId],
current_timestamp: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<Vec<InputNoteRecord>, RpcError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Fetches public note-related data for a list of NoteId and builds InputNoteRecords with it. If a note is not found or it’s private, it is ignored and will not be included in the returned list.
The default implementation of this method uses NodeRpcClient::get_notes_by_id.
Sourcefn get_updated_public_accounts<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
local_accounts: &'life1 [&'life2 AccountHeader],
) -> Pin<Box<dyn Future<Output = Result<Vec<Account>, RpcError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_updated_public_accounts<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
local_accounts: &'life1 [&'life2 AccountHeader],
) -> Pin<Box<dyn Future<Output = Result<Vec<Account>, RpcError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Fetches the public accounts that have been updated since the last known state of the accounts.
The local_accounts parameter is a list of account headers that the client has
stored locally and that it wants to check for updates. If an account is private or didn’t
change, it is ignored and will not be included in the returned list.
The default implementation of this method uses NodeRpcClient::get_account_update.
Sourcefn get_block_header_with_proof<'life0, 'async_trait>(
&'life0 mut self,
block_num: BlockNumber,
) -> Pin<Box<dyn Future<Output = Result<(BlockHeader, MmrProof), RpcError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_block_header_with_proof<'life0, 'async_trait>(
&'life0 mut self,
block_num: BlockNumber,
) -> Pin<Box<dyn Future<Output = Result<(BlockHeader, MmrProof), RpcError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Given a block number, fetches the block header corresponding to that height from the node along with the MMR proof.
The default implementation of this method uses NodeRpcClient::get_block_header_by_number.
Sourcefn get_note_by_id<'life0, 'async_trait>(
&'life0 mut self,
note_id: NoteId,
) -> Pin<Box<dyn Future<Output = Result<NetworkNote, RpcError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_note_by_id<'life0, 'async_trait>(
&'life0 mut self,
note_id: NoteId,
) -> Pin<Box<dyn Future<Output = Result<NetworkNote, RpcError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Fetches the note with the specified ID.
The default implementation of this method uses NodeRpcClient::get_notes_by_id.
Errors:
- RpcError::NoteNotFound if the note with the specified ID is not found.