pub struct ApiClient<T> { /* private fields */ }Expand description
RPC API for the RPC component
Implementations§
Source§impl<T> ApiClient<T>where
T: GrpcService<Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
impl<T> ApiClient<T>where
T: GrpcService<Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
pub fn new(inner: T) -> Self
pub fn with_origin(inner: T, origin: Uri) -> Self
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> ApiClient<InterceptedService<T, F>>where
F: Interceptor,
T::ResponseBody: Default,
T: Service<Request<Body>, Response = Response<<T as GrpcService<Body>>::ResponseBody>>,
<T as Service<Request<Body>>>::Error: Into<StdError> + Send + Sync,
Sourcepub fn send_compressed(self, encoding: CompressionEncoding) -> Self
pub fn send_compressed(self, encoding: CompressionEncoding) -> Self
Compress requests with the given encoding.
This requires the server to support it otherwise it might respond with an error.
Sourcepub fn accept_compressed(self, encoding: CompressionEncoding) -> Self
pub fn accept_compressed(self, encoding: CompressionEncoding) -> Self
Enable decompressing responses.
Sourcepub fn max_decoding_message_size(self, limit: usize) -> Self
pub fn max_decoding_message_size(self, limit: usize) -> Self
Limits the maximum size of a decoded message.
Default: 4MB
Sourcepub fn max_encoding_message_size(self, limit: usize) -> Self
pub fn max_encoding_message_size(self, limit: usize) -> Self
Limits the maximum size of an encoded message.
Default: usize::MAX
Sourcepub async fn status(
&mut self,
request: impl IntoRequest<()>,
) -> Result<Response<RpcStatus>, Status>
pub async fn status( &mut self, request: impl IntoRequest<()>, ) -> Result<Response<RpcStatus>, Status>
Returns the status info of the node.
Sourcepub async fn get_limits(
&mut self,
request: impl IntoRequest<()>,
) -> Result<Response<RpcLimits>, Status>
pub async fn get_limits( &mut self, request: impl IntoRequest<()>, ) -> Result<Response<RpcLimits>, Status>
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.
Sourcepub async fn check_nullifiers(
&mut self,
request: impl IntoRequest<NullifierList>,
) -> Result<Response<CheckNullifiersResponse>, Status>
pub async fn check_nullifiers( &mut self, request: impl IntoRequest<NullifierList>, ) -> Result<Response<CheckNullifiersResponse>, Status>
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)singleormultiple: Inclusion proof only if the requested nullifier appears as a key.
Verify proofs against the nullifier tree root in the latest block header.
Sourcepub async fn get_account(
&mut self,
request: impl IntoRequest<AccountRequest>,
) -> Result<Response<AccountResponse>, Status>
pub async fn get_account( &mut self, request: impl IntoRequest<AccountRequest>, ) -> Result<Response<AccountResponse>, Status>
Returns the latest details of the specified account.
Sourcepub async fn get_block_by_number(
&mut self,
request: impl IntoRequest<BlockNumber>,
) -> Result<Response<MaybeBlock>, Status>
pub async fn get_block_by_number( &mut self, request: impl IntoRequest<BlockNumber>, ) -> Result<Response<MaybeBlock>, Status>
Returns raw block data for the specified block number.
Sourcepub async fn get_block_header_by_number(
&mut self,
request: impl IntoRequest<BlockHeaderByNumberRequest>,
) -> Result<Response<BlockHeaderByNumberResponse>, Status>
pub async fn get_block_header_by_number( &mut self, request: impl IntoRequest<BlockHeaderByNumberRequest>, ) -> Result<Response<BlockHeaderByNumberResponse>, Status>
Retrieves block header by given block number. Optionally, it also returns the MMR path and current chain length to authenticate the block’s inclusion.
Sourcepub async fn get_notes_by_id(
&mut self,
request: impl IntoRequest<NoteIdList>,
) -> Result<Response<CommittedNoteList>, Status>
pub async fn get_notes_by_id( &mut self, request: impl IntoRequest<NoteIdList>, ) -> Result<Response<CommittedNoteList>, Status>
Returns a list of notes matching the provided note IDs.
Sourcepub async fn get_note_script_by_root(
&mut self,
request: impl IntoRequest<NoteScriptRoot>,
) -> Result<Response<MaybeNoteScript>, Status>
pub async fn get_note_script_by_root( &mut self, request: impl IntoRequest<NoteScriptRoot>, ) -> Result<Response<MaybeNoteScript>, Status>
Returns the script for a note by its root.
Sourcepub async fn submit_proven_transaction(
&mut self,
request: impl IntoRequest<ProvenTransaction>,
) -> Result<Response<BlockNumber>, Status>
pub async fn submit_proven_transaction( &mut self, request: impl IntoRequest<ProvenTransaction>, ) -> Result<Response<BlockNumber>, Status>
Submits proven transaction to the Miden network. Returns the node’s current block height.
Sourcepub async fn submit_proven_batch(
&mut self,
request: impl IntoRequest<ProvenTransactionBatch>,
) -> Result<Response<BlockNumber>, Status>
pub async fn submit_proven_batch( &mut self, request: impl IntoRequest<ProvenTransactionBatch>, ) -> Result<Response<BlockNumber>, Status>
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.
Sourcepub async fn sync_transactions(
&mut self,
request: impl IntoRequest<SyncTransactionsRequest>,
) -> Result<Response<SyncTransactionsResponse>, Status>
pub async fn sync_transactions( &mut self, request: impl IntoRequest<SyncTransactionsRequest>, ) -> Result<Response<SyncTransactionsResponse>, Status>
Returns transactions records for specific accounts within a block range.
Sourcepub async fn sync_notes(
&mut self,
request: impl IntoRequest<SyncNotesRequest>,
) -> Result<Response<SyncNotesResponse>, Status>
pub async fn sync_notes( &mut self, request: impl IntoRequest<SyncNotesRequest>, ) -> Result<Response<SyncNotesResponse>, Status>
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.
Sourcepub async fn sync_nullifiers(
&mut self,
request: impl IntoRequest<SyncNullifiersRequest>,
) -> Result<Response<SyncNullifiersResponse>, Status>
pub async fn sync_nullifiers( &mut self, request: impl IntoRequest<SyncNullifiersRequest>, ) -> Result<Response<SyncNullifiersResponse>, Status>
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.
Sourcepub async fn sync_account_vault(
&mut self,
request: impl IntoRequest<SyncAccountVaultRequest>,
) -> Result<Response<SyncAccountVaultResponse>, Status>
pub async fn sync_account_vault( &mut self, request: impl IntoRequest<SyncAccountVaultRequest>, ) -> Result<Response<SyncAccountVaultResponse>, Status>
Returns account vault updates for specified account within a block range.
Sourcepub async fn sync_account_storage_maps(
&mut self,
request: impl IntoRequest<SyncAccountStorageMapsRequest>,
) -> Result<Response<SyncAccountStorageMapsResponse>, Status>
pub async fn sync_account_storage_maps( &mut self, request: impl IntoRequest<SyncAccountStorageMapsRequest>, ) -> Result<Response<SyncAccountStorageMapsResponse>, Status>
Returns storage map updates for specified account and storage slots within a block range.
Sourcepub async fn sync_chain_mmr(
&mut self,
request: impl IntoRequest<SyncChainMmrRequest>,
) -> Result<Response<SyncChainMmrResponse>, Status>
pub async fn sync_chain_mmr( &mut self, request: impl IntoRequest<SyncChainMmrRequest>, ) -> Result<Response<SyncChainMmrResponse>, Status>
Returns MMR delta needed to synchronize the chain MMR within the requested block range.
Trait Implementations§
Auto Trait Implementations§
impl<T> !Freeze for ApiClient<T>
impl<T> RefUnwindSafe for ApiClient<T>where
T: RefUnwindSafe,
impl<T> Send for ApiClient<T>where
T: Send,
impl<T> Sync for ApiClient<T>where
T: Sync,
impl<T> Unpin for ApiClient<T>where
T: Unpin,
impl<T> UnsafeUnpin for ApiClient<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for ApiClient<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more