pub trait NodeRpcClient: Send + Sync {
Show 16 methods
// Required methods
fn submit_proven_transaction<'life0, 'async_trait>(
&'life0 self,
proven_transaction: ProvenTransaction,
) -> Pin<Box<dyn Future<Output = Result<BlockNumber, RpcError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_block_header_by_number<'life0, 'async_trait>(
&'life0 self,
block_num: Option<BlockNumber>,
include_mmr_proof: bool,
) -> Pin<Box<dyn Future<Output = Result<(BlockHeader, Option<MmrProof>), RpcError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_block_by_number<'life0, 'async_trait>(
&'life0 self,
block_num: BlockNumber,
) -> Pin<Box<dyn Future<Output = Result<ProvenBlock, RpcError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_notes_by_id<'life0, 'life1, 'async_trait>(
&'life0 self,
note_ids: &'life1 [NoteId],
) -> Pin<Box<dyn Future<Output = Result<Vec<FetchedNote>, RpcError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn sync_state<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
block_num: BlockNumber,
account_ids: &'life1 [AccountId],
note_tags: &'life2 [NoteTag],
) -> Pin<Box<dyn Future<Output = Result<StateSyncInfo, RpcError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn get_account_details<'life0, 'async_trait>(
&'life0 self,
account_id: AccountId,
) -> Pin<Box<dyn Future<Output = Result<FetchedAccount, RpcError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn sync_notes<'life0, 'life1, 'async_trait>(
&'life0 self,
block_num: BlockNumber,
note_tags: &'life1 [NoteTag],
) -> Pin<Box<dyn Future<Output = Result<NoteSyncInfo, RpcError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn check_nullifiers_by_prefix<'life0, 'life1, 'async_trait>(
&'life0 self,
prefix: &'life1 [u16],
block_num: BlockNumber,
) -> Pin<Box<dyn Future<Output = Result<Vec<NullifierUpdate>, RpcError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn check_nullifiers<'life0, 'life1, 'async_trait>(
&'life0 self,
nullifiers: &'life1 [Nullifier],
) -> Pin<Box<dyn Future<Output = Result<Vec<SmtProof>, RpcError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_account_proofs<'life0, 'life1, 'async_trait>(
&'life0 self,
account_storage_requests: &'life1 BTreeSet<ForeignAccount>,
known_account_codes: Vec<AccountCode>,
) -> Pin<Box<dyn Future<Output = Result<AccountProofs, RpcError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_account_state_delta<'life0, 'async_trait>(
&'life0 self,
account_id: AccountId,
from_block: BlockNumber,
to_block: BlockNumber,
) -> Pin<Box<dyn Future<Output = Result<AccountDelta, RpcError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn get_nullifier_commit_height<'life0, 'life1, 'async_trait>(
&'life0 self,
nullifier: &'life1 Nullifier,
block_num: BlockNumber,
) -> Pin<Box<dyn Future<Output = Result<Option<u32>, RpcError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn get_public_note_records<'life0, 'life1, 'async_trait>(
&'life0 self,
note_ids: &'life1 [NoteId],
current_timestamp: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<Vec<InputNoteRecord>, RpcError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn get_updated_public_accounts<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
local_accounts: &'life1 [&'life2 AccountHeader],
) -> Pin<Box<dyn Future<Output = Result<Vec<Account>, RpcError>> + Send + '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 self,
block_num: BlockNumber,
) -> Pin<Box<dyn Future<Output = Result<(BlockHeader, MmrProof), RpcError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn get_note_by_id<'life0, 'async_trait>(
&'life0 self,
note_id: NoteId,
) -> Pin<Box<dyn Future<Output = Result<FetchedNote, RpcError>> + Send + '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 self,
proven_transaction: ProvenTransaction,
) -> Pin<Box<dyn Future<Output = Result<BlockNumber, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn submit_proven_transaction<'life0, 'async_trait>(
&'life0 self,
proven_transaction: ProvenTransaction,
) -> Pin<Box<dyn Future<Output = Result<BlockNumber, RpcError>> + Send + '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 self,
block_num: Option<BlockNumber>,
include_mmr_proof: bool,
) -> Pin<Box<dyn Future<Output = Result<(BlockHeader, Option<MmrProof>), RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_block_header_by_number<'life0, 'async_trait>(
&'life0 self,
block_num: Option<BlockNumber>,
include_mmr_proof: bool,
) -> Pin<Box<dyn Future<Output = Result<(BlockHeader, Option<MmrProof>), RpcError>> + Send + '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_block_by_number<'life0, 'async_trait>(
&'life0 self,
block_num: BlockNumber,
) -> Pin<Box<dyn Future<Output = Result<ProvenBlock, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_block_by_number<'life0, 'async_trait>(
&'life0 self,
block_num: BlockNumber,
) -> Pin<Box<dyn Future<Output = Result<ProvenBlock, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Given a block number, fetches the block corresponding to that height from the node using
the /GetBlockByNumber RPC endpoint.
Sourcefn get_notes_by_id<'life0, 'life1, 'async_trait>(
&'life0 self,
note_ids: &'life1 [NoteId],
) -> Pin<Box<dyn Future<Output = Result<Vec<FetchedNote>, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_notes_by_id<'life0, 'life1, 'async_trait>(
&'life0 self,
note_ids: &'life1 [NoteId],
) -> Pin<Box<dyn Future<Output = Result<Vec<FetchedNote>, RpcError>> + Send + '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, 'async_trait>(
&'life0 self,
block_num: BlockNumber,
account_ids: &'life1 [AccountId],
note_tags: &'life2 [NoteTag],
) -> Pin<Box<dyn Future<Output = Result<StateSyncInfo, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn sync_state<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
block_num: BlockNumber,
account_ids: &'life1 [AccountId],
note_tags: &'life2 [NoteTag],
) -> Pin<Box<dyn Future<Output = Result<StateSyncInfo, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: '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_details<'life0, 'async_trait>(
&'life0 self,
account_id: AccountId,
) -> Pin<Box<dyn Future<Output = Result<FetchedAccount, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_account_details<'life0, 'async_trait>(
&'life0 self,
account_id: AccountId,
) -> Pin<Box<dyn Future<Output = Result<FetchedAccount, RpcError>> + Send + '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.
Sourcefn sync_notes<'life0, 'life1, 'async_trait>(
&'life0 self,
block_num: BlockNumber,
note_tags: &'life1 [NoteTag],
) -> Pin<Box<dyn Future<Output = Result<NoteSyncInfo, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn sync_notes<'life0, 'life1, 'async_trait>(
&'life0 self,
block_num: BlockNumber,
note_tags: &'life1 [NoteTag],
) -> Pin<Box<dyn Future<Output = Result<NoteSyncInfo, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Fetches the notes related to the specified tags using the /SyncNotes RPC endpoint.
block_numis the last block number known by the client.note_tagsis a list of tags used to filter the notes the client is interested in.
Sourcefn check_nullifiers_by_prefix<'life0, 'life1, 'async_trait>(
&'life0 self,
prefix: &'life1 [u16],
block_num: BlockNumber,
) -> Pin<Box<dyn Future<Output = Result<Vec<NullifierUpdate>, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn check_nullifiers_by_prefix<'life0, 'life1, 'async_trait>(
&'life0 self,
prefix: &'life1 [u16],
block_num: BlockNumber,
) -> Pin<Box<dyn Future<Output = Result<Vec<NullifierUpdate>, RpcError>> + Send + '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.
prefixis a list of nullifiers prefixes to search for.block_numis the block number to start the search from. Nullifiers created in this block or the following blocks will be included.
Sourcefn check_nullifiers<'life0, 'life1, 'async_trait>(
&'life0 self,
nullifiers: &'life1 [Nullifier],
) -> Pin<Box<dyn Future<Output = Result<Vec<SmtProof>, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn check_nullifiers<'life0, 'life1, 'async_trait>(
&'life0 self,
nullifiers: &'life1 [Nullifier],
) -> Pin<Box<dyn Future<Output = Result<Vec<SmtProof>, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Fetches the nullifier proofs corresponding to a list of nullifiers using the
/CheckNullifiers RPC endpoint.
Sourcefn get_account_proofs<'life0, 'life1, 'async_trait>(
&'life0 self,
account_storage_requests: &'life1 BTreeSet<ForeignAccount>,
known_account_codes: Vec<AccountCode>,
) -> Pin<Box<dyn Future<Output = Result<AccountProofs, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_account_proofs<'life0, 'life1, 'async_trait>(
&'life0 self,
account_storage_requests: &'life1 BTreeSet<ForeignAccount>,
known_account_codes: Vec<AccountCode>,
) -> Pin<Box<dyn Future<Output = Result<AccountProofs, RpcError>> + Send + '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 commitments
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.
Sourcefn get_account_state_delta<'life0, 'async_trait>(
&'life0 self,
account_id: AccountId,
from_block: BlockNumber,
to_block: BlockNumber,
) -> Pin<Box<dyn Future<Output = Result<AccountDelta, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_account_state_delta<'life0, 'async_trait>(
&'life0 self,
account_id: AccountId,
from_block: BlockNumber,
to_block: BlockNumber,
) -> Pin<Box<dyn Future<Output = Result<AccountDelta, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Fetches the account state delta for the specified account between the specified blocks
using the /GetAccountStateDelta RPC endpoint.
Provided Methods§
Sourcefn get_nullifier_commit_height<'life0, 'life1, 'async_trait>(
&'life0 self,
nullifier: &'life1 Nullifier,
block_num: BlockNumber,
) -> Pin<Box<dyn Future<Output = Result<Option<u32>, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_nullifier_commit_height<'life0, 'life1, 'async_trait>(
&'life0 self,
nullifier: &'life1 Nullifier,
block_num: BlockNumber,
) -> Pin<Box<dyn Future<Output = Result<Option<u32>, RpcError>> + Send + '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 block_num parameter is the block number to start the search from.
The default implementation of this method uses NodeRpcClient::check_nullifiers_by_prefix.
Sourcefn get_public_note_records<'life0, 'life1, 'async_trait>(
&'life0 self,
note_ids: &'life1 [NoteId],
current_timestamp: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<Vec<InputNoteRecord>, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_public_note_records<'life0, 'life1, 'async_trait>(
&'life0 self,
note_ids: &'life1 [NoteId],
current_timestamp: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<Vec<InputNoteRecord>, RpcError>> + Send + '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 self,
local_accounts: &'life1 [&'life2 AccountHeader],
) -> Pin<Box<dyn Future<Output = Result<Vec<Account>, RpcError>> + Send + '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 self,
local_accounts: &'life1 [&'life2 AccountHeader],
) -> Pin<Box<dyn Future<Output = Result<Vec<Account>, RpcError>> + Send + '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_details.
Sourcefn get_block_header_with_proof<'life0, 'async_trait>(
&'life0 self,
block_num: BlockNumber,
) -> Pin<Box<dyn Future<Output = Result<(BlockHeader, MmrProof), RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_block_header_with_proof<'life0, 'async_trait>(
&'life0 self,
block_num: BlockNumber,
) -> Pin<Box<dyn Future<Output = Result<(BlockHeader, MmrProof), RpcError>> + Send + '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 self,
note_id: NoteId,
) -> Pin<Box<dyn Future<Output = Result<FetchedNote, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_note_by_id<'life0, 'async_trait>(
&'life0 self,
note_id: NoteId,
) -> Pin<Box<dyn Future<Output = Result<FetchedNote, RpcError>> + Send + '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.