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 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<BlockRequest>,
) -> Result<Response<MaybeBlock>, Status>
pub async fn get_block_by_number( &mut self, request: impl IntoRequest<BlockRequest>, ) -> Result<Response<MaybeBlock>, Status>
Returns raw block data for the specified block number, optionally including the block proof.
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_tx(
&mut self,
request: impl IntoRequest<ProvenTransaction>,
) -> Result<Response<BlockNumber>, Status>
pub async fn submit_proven_tx( &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_tx_batch(
&mut self,
request: impl IntoRequest<TransactionBatch>,
) -> Result<Response<BlockNumber>, Status>
pub async fn submit_proven_tx_batch( &mut self, request: impl IntoRequest<TransactionBatch>, ) -> Result<Response<BlockNumber>, Status>
Submits a batch of transactions to the Miden network.
All transactions in this batch will be considered atomic, and be committed together or not all.
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 range to search.
The response contains all blocks with matching notes that fit within the response payload
limit, along with each note’s metadata and inclusion proof.
If response.pagination_info.block_num is less than the requested range end, make
another request starting from response.pagination_info.block_num + 1 to continue syncing.
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.
Sourcepub async fn block_subscription(
&mut self,
request: impl IntoRequest<BlockSubscriptionRequest>,
) -> Result<Response<Streaming<BlockSubscriptionResponse>>, Status>
pub async fn block_subscription( &mut self, request: impl IntoRequest<BlockSubscriptionRequest>, ) -> Result<Response<Streaming<BlockSubscriptionResponse>>, Status>
Streams committed blocks starting from the given block number (inclusive).
Replays historical blocks first, then streams live blocks as they are committed. On lag (replica falls too far behind), the stream is closed with a DATA_LOSS error and the client should reconnect from its local tip.
Sourcepub async fn proof_subscription(
&mut self,
request: impl IntoRequest<ProofSubscriptionRequest>,
) -> Result<Response<Streaming<ProofSubscriptionResponse>>, Status>
pub async fn proof_subscription( &mut self, request: impl IntoRequest<ProofSubscriptionRequest>, ) -> Result<Response<Streaming<ProofSubscriptionResponse>>, Status>
Streams block proofs starting from the given block number (inclusive).
Replays existing proofs first, then streams new proofs as they are generated. On lag, the stream is closed with a DATA_LOSS error.
Sourcepub async fn get_network_note_status(
&mut self,
request: impl IntoRequest<NoteId>,
) -> Result<Response<GetNetworkNoteStatusResponse>, Status>
pub async fn get_network_note_status( &mut self, request: impl IntoRequest<NoteId>, ) -> Result<Response<GetNetworkNoteStatusResponse>, Status>
Returns the current status of a network note.
The status indicates where the note is in its lifecycle: pending execution, processed (consumed by a transaction in the mempool), or discarded after too many failed attempts.
Returns NOT_FOUND if the note ID is not tracked by the network transaction builder.
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