penumbra_view

Trait ViewClient

Source
pub trait ViewClient {
Show 27 methods // Required methods fn auctions( &mut self, account_filter: Option<AddressIndex>, include_inactive: bool, query_latest_state: bool, ) -> Pin<Box<dyn Future<Output = Result<Vec<(AuctionId, SpendableNoteRecord, u64, Option<Any>, Vec<Position>)>>> + Send + 'static>>; fn status( &mut self, ) -> Pin<Box<dyn Future<Output = Result<StatusResponse>> + Send + 'static>>; fn status_stream( &mut self, ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<StatusStreamResponse>> + Send + 'static>>>> + Send + 'static>>; fn app_params( &mut self, ) -> Pin<Box<dyn Future<Output = Result<AppParameters>> + Send + 'static>>; fn gas_prices( &mut self, ) -> Pin<Box<dyn Future<Output = Result<GasPrices>> + Send + 'static>>; fn fmd_parameters( &mut self, ) -> Pin<Box<dyn Future<Output = Result<Parameters>> + Send + 'static>>; fn notes( &mut self, request: NotesRequest, ) -> Pin<Box<dyn Future<Output = Result<Vec<SpendableNoteRecord>>> + Send + 'static>>; fn notes_for_voting( &mut self, request: NotesForVotingRequest, ) -> Pin<Box<dyn Future<Output = Result<Vec<(SpendableNoteRecord, IdentityKey)>>> + Send + 'static>>; fn balances( &mut self, address_index: AddressIndex, asset_id: Option<Id>, ) -> Pin<Box<dyn Future<Output = Result<Vec<(Id, Amount)>>> + Send + 'static>>; fn note_by_commitment( &mut self, note_commitment: StateCommitment, ) -> Pin<Box<dyn Future<Output = Result<SpendableNoteRecord>> + Send + 'static>>; fn swap_by_commitment( &mut self, swap_commitment: StateCommitment, ) -> Pin<Box<dyn Future<Output = Result<SwapRecord>> + Send + 'static>>; fn nullifier_status( &mut self, nullifier: Nullifier, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'static>>; fn await_nullifier( &mut self, nullifier: Nullifier, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'static>>; fn await_note_by_commitment( &mut self, note_commitment: StateCommitment, ) -> Pin<Box<dyn Future<Output = Result<SpendableNoteRecord>> + Send + 'static>>; fn witness( &mut self, plan: &TransactionPlan, ) -> Pin<Box<dyn Future<Output = Result<WitnessData>> + Send + 'static>>; fn witness_and_build( &mut self, plan: TransactionPlan, auth_data: AuthorizationData, ) -> Pin<Box<dyn Future<Output = Result<Transaction>> + Send + 'static>>; fn assets( &mut self, ) -> Pin<Box<dyn Future<Output = Result<Cache>> + Send + 'static>>; fn owned_position_ids( &mut self, position_state: Option<State>, trading_pair: Option<TradingPair>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Id>>> + Send + 'static>>; fn transaction_info_by_hash( &mut self, id: TransactionId, ) -> Pin<Box<dyn Future<Output = Result<TransactionInfo>> + Send + 'static>>; fn transaction_info( &mut self, start_height: Option<u64>, end_height: Option<u64>, ) -> Pin<Box<dyn Future<Output = Result<Vec<TransactionInfo>>> + Send + 'static>>; fn broadcast_transaction( &mut self, transaction: Transaction, await_detection: bool, ) -> Pin<Box<dyn Future<Output = Result<Streaming<BroadcastTransactionResponse>, Error>> + Send>>; fn address_by_index( &mut self, address_index: AddressIndex, ) -> Pin<Box<dyn Future<Output = Result<Address>> + Send + 'static>>; fn index_by_address( &mut self, address: Address, ) -> Pin<Box<dyn Future<Output = Result<Option<AddressIndex>>> + Send + 'static>>; fn unclaimed_swaps( &mut self, ) -> Pin<Box<dyn Future<Output = Result<Vec<SwapRecord>>> + Send + 'static>>; // Provided methods fn unspent_notes_by_address_and_asset( &mut self, ) -> Pin<Box<dyn Future<Output = Result<BTreeMap<AddressIndex, BTreeMap<Id, Vec<SpendableNoteRecord>>>>> + Send + 'static>> { ... } fn unspent_notes_by_account_and_asset( &mut self, ) -> Pin<Box<dyn Future<Output = Result<BTreeMap<u32, BTreeMap<Id, Vec<SpendableNoteRecord>>>>> + Send + 'static>> { ... } fn unspent_notes_by_asset_and_address( &mut self, ) -> Pin<Box<dyn Future<Output = Result<BTreeMap<Id, BTreeMap<AddressIndex, Vec<SpendableNoteRecord>>>>> + Send + 'static>> { ... }
}
Expand description

The view protocol is used by a view client, who wants to do some transaction-related actions, to request data from a view service, which is responsible for synchronizing and scanning the public chain state with one or more full viewing keys.

This trait is a wrapper around the proto-generated ViewServiceClient that serves two goals:

  1. It can use domain types rather than proto-generated types, avoiding conversions;
  2. It’s easier to write as a trait bound than the CustodyProtocolClient, which requires complex bounds on its inner type to enforce that it is a tower Service.

Required Methods§

Source

fn auctions( &mut self, account_filter: Option<AddressIndex>, include_inactive: bool, query_latest_state: bool, ) -> Pin<Box<dyn Future<Output = Result<Vec<(AuctionId, SpendableNoteRecord, u64, Option<Any>, Vec<Position>)>>> + Send + 'static>>

Query the auction state

Source

fn status( &mut self, ) -> Pin<Box<dyn Future<Output = Result<StatusResponse>> + Send + 'static>>

Get the current status of chain sync.

Source

fn status_stream( &mut self, ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<StatusStreamResponse>> + Send + 'static>>>> + Send + 'static>>

Stream status updates on chain sync until it completes.

Source

fn app_params( &mut self, ) -> Pin<Box<dyn Future<Output = Result<AppParameters>> + Send + 'static>>

Get a copy of the app parameters.

Source

fn gas_prices( &mut self, ) -> Pin<Box<dyn Future<Output = Result<GasPrices>> + Send + 'static>>

Get a copy of the gas prices.

Source

fn fmd_parameters( &mut self, ) -> Pin<Box<dyn Future<Output = Result<Parameters>> + Send + 'static>>

Get a copy of the FMD parameters.

Source

fn notes( &mut self, request: NotesRequest, ) -> Pin<Box<dyn Future<Output = Result<Vec<SpendableNoteRecord>>> + Send + 'static>>

Queries for notes.

Source

fn notes_for_voting( &mut self, request: NotesForVotingRequest, ) -> Pin<Box<dyn Future<Output = Result<Vec<(SpendableNoteRecord, IdentityKey)>>> + Send + 'static>>

Queries for notes for voting.

Source

fn balances( &mut self, address_index: AddressIndex, asset_id: Option<Id>, ) -> Pin<Box<dyn Future<Output = Result<Vec<(Id, Amount)>>> + Send + 'static>>

Queries for account balance by address

Source

fn note_by_commitment( &mut self, note_commitment: StateCommitment, ) -> Pin<Box<dyn Future<Output = Result<SpendableNoteRecord>> + Send + 'static>>

Queries for a specific note by commitment, returning immediately if it is not found.

Source

fn swap_by_commitment( &mut self, swap_commitment: StateCommitment, ) -> Pin<Box<dyn Future<Output = Result<SwapRecord>> + Send + 'static>>

Queries for a specific swap by commitment, returning immediately if it is not found.

Source

fn nullifier_status( &mut self, nullifier: Nullifier, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'static>>

Queries for a specific nullifier’s status, returning immediately if it is not found.

Source

fn await_nullifier( &mut self, nullifier: Nullifier, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'static>>

Waits for a specific nullifier to be detected, returning immediately if it is already present, but waiting otherwise.

Source

fn await_note_by_commitment( &mut self, note_commitment: StateCommitment, ) -> Pin<Box<dyn Future<Output = Result<SpendableNoteRecord>> + Send + 'static>>

Queries for a specific note by commitment, waiting until the note is detected if it is not found.

This is useful for waiting for a note to be detected by the view service.

Source

fn witness( &mut self, plan: &TransactionPlan, ) -> Pin<Box<dyn Future<Output = Result<WitnessData>> + Send + 'static>>

Returns authentication paths for the given note commitments.

This method takes a batch of input commitments, rather than just one, so that the client can get a consistent set of authentication paths to a common root. (Otherwise, if a client made multiple requests, the wallet service could have advanced the state commitment tree state between queries).

Source

fn witness_and_build( &mut self, plan: TransactionPlan, auth_data: AuthorizationData, ) -> Pin<Box<dyn Future<Output = Result<Transaction>> + Send + 'static>>

Returns a transaction built from the provided TransactionPlan and AuthorizationData

Source

fn assets( &mut self, ) -> Pin<Box<dyn Future<Output = Result<Cache>> + Send + 'static>>

Queries for all known assets.

Source

fn owned_position_ids( &mut self, position_state: Option<State>, trading_pair: Option<TradingPair>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Id>>> + Send + 'static>>

Queries for liquidity positions owned by the full viewing key.

Source

fn transaction_info_by_hash( &mut self, id: TransactionId, ) -> Pin<Box<dyn Future<Output = Result<TransactionInfo>> + Send + 'static>>

Generates a full perspective for a selected transaction using a full viewing key

Source

fn transaction_info( &mut self, start_height: Option<u64>, end_height: Option<u64>, ) -> Pin<Box<dyn Future<Output = Result<Vec<TransactionInfo>>> + Send + 'static>>

Queries for transactions in a range of block heights

Source

fn broadcast_transaction( &mut self, transaction: Transaction, await_detection: bool, ) -> Pin<Box<dyn Future<Output = Result<Streaming<BroadcastTransactionResponse>, Error>> + Send>>

Source

fn address_by_index( &mut self, address_index: AddressIndex, ) -> Pin<Box<dyn Future<Output = Result<Address>> + Send + 'static>>

Source

fn index_by_address( &mut self, address: Address, ) -> Pin<Box<dyn Future<Output = Result<Option<AddressIndex>>> + Send + 'static>>

Queries for the index of a provided address, returning None if not controlled by the view service’s FVK.

Source

fn unclaimed_swaps( &mut self, ) -> Pin<Box<dyn Future<Output = Result<Vec<SwapRecord>>> + Send + 'static>>

Queries for unclaimed Swaps.

Provided Methods§

Source

fn unspent_notes_by_address_and_asset( &mut self, ) -> Pin<Box<dyn Future<Output = Result<BTreeMap<AddressIndex, BTreeMap<Id, Vec<SpendableNoteRecord>>>>> + Send + 'static>>

Return unspent notes, grouped by address index and then by asset id.

Source

fn unspent_notes_by_account_and_asset( &mut self, ) -> Pin<Box<dyn Future<Output = Result<BTreeMap<u32, BTreeMap<Id, Vec<SpendableNoteRecord>>>>> + Send + 'static>>

Return unspent notes, grouped by account ID (combining ephemeral addresses for the account) and then by asset id.

Source

fn unspent_notes_by_asset_and_address( &mut self, ) -> Pin<Box<dyn Future<Output = Result<BTreeMap<Id, BTreeMap<AddressIndex, Vec<SpendableNoteRecord>>>>> + Send + 'static>>

Return unspent notes, grouped by denom and then by address index.

Implementations on Foreign Types§

Source§

impl<T> ViewClient for ViewServiceClient<T>
where T: GrpcService<BoxBody> + Clone + Send + 'static, T::ResponseBody: Body<Data = Bytes> + Send + 'static, T::Error: Into<StdError>, T::Future: Send + 'static, <T::ResponseBody as Body>::Error: Into<StdError> + Send,

Source§

fn await_note_by_commitment( &mut self, note_commitment: StateCommitment, ) -> Pin<Box<dyn Future<Output = Result<SpendableNoteRecord>> + Send + 'static>>

Queries for a specific note by commitment, waiting until the note is detected if it is not found.

This is useful for waiting for a note to be detected by the view service.

Source§

fn nullifier_status( &mut self, nullifier: Nullifier, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'static>>

Queries for a specific nullifier’s status, returning immediately if it is not found.

Source§

fn await_nullifier( &mut self, nullifier: Nullifier, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'static>>

Waits for a specific nullifier to be detected, returning immediately if it is already present, but waiting otherwise.

Source§

fn status( &mut self, ) -> Pin<Box<dyn Future<Output = Result<StatusResponse>> + Send + 'static>>

Source§

fn status_stream( &mut self, ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<StatusStreamResponse>> + Send + 'static>>>> + Send + 'static>>

Source§

fn app_params( &mut self, ) -> Pin<Box<dyn Future<Output = Result<AppParameters>> + Send + 'static>>

Source§

fn gas_prices( &mut self, ) -> Pin<Box<dyn Future<Output = Result<GasPrices>> + Send + 'static>>

Source§

fn fmd_parameters( &mut self, ) -> Pin<Box<dyn Future<Output = Result<Parameters>> + Send + 'static>>

Source§

fn notes( &mut self, request: NotesRequest, ) -> Pin<Box<dyn Future<Output = Result<Vec<SpendableNoteRecord>>> + Send + 'static>>

Source§

fn notes_for_voting( &mut self, request: NotesForVotingRequest, ) -> Pin<Box<dyn Future<Output = Result<Vec<(SpendableNoteRecord, IdentityKey)>>> + Send + 'static>>

Source§

fn note_by_commitment( &mut self, note_commitment: StateCommitment, ) -> Pin<Box<dyn Future<Output = Result<SpendableNoteRecord>> + Send + 'static>>

Source§

fn balances( &mut self, address_index: AddressIndex, asset_id: Option<Id>, ) -> Pin<Box<dyn Future<Output = Result<Vec<(Id, Amount)>>> + Send + 'static>>

Source§

fn swap_by_commitment( &mut self, swap_commitment: StateCommitment, ) -> Pin<Box<dyn Future<Output = Result<SwapRecord>> + Send + 'static>>

Source§

fn witness( &mut self, plan: &TransactionPlan, ) -> Pin<Box<dyn Future<Output = Result<WitnessData>> + Send + 'static>>

Source§

fn assets( &mut self, ) -> Pin<Box<dyn Future<Output = Result<Cache>> + Send + 'static>>

Source§

fn owned_position_ids( &mut self, position_state: Option<State>, trading_pair: Option<TradingPair>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Id>>> + Send + 'static>>

Source§

fn transaction_info_by_hash( &mut self, id: TransactionId, ) -> Pin<Box<dyn Future<Output = Result<TransactionInfo>> + Send + 'static>>

Source§

fn transaction_info( &mut self, start_height: Option<u64>, end_height: Option<u64>, ) -> Pin<Box<dyn Future<Output = Result<Vec<TransactionInfo>>> + Send + 'static>>

Source§

fn broadcast_transaction( &mut self, transaction: Transaction, await_detection: bool, ) -> Pin<Box<dyn Future<Output = Result<Streaming<BroadcastTransactionResponse>, Error>> + Send>>

Source§

fn address_by_index( &mut self, address_index: AddressIndex, ) -> Pin<Box<dyn Future<Output = Result<Address>> + Send + 'static>>

Source§

fn index_by_address( &mut self, address: Address, ) -> Pin<Box<dyn Future<Output = Result<Option<AddressIndex>>> + Send + 'static>>

Source§

fn witness_and_build( &mut self, transaction_plan: TransactionPlan, authorization_data: AuthorizationData, ) -> Pin<Box<dyn Future<Output = Result<Transaction>> + Send + 'static>>

Source§

fn unclaimed_swaps( &mut self, ) -> Pin<Box<dyn Future<Output = Result<Vec<SwapRecord>>> + Send + 'static>>

Source§

fn auctions( &mut self, account_filter: Option<AddressIndex>, include_inactive: bool, query_latest_state: bool, ) -> Pin<Box<dyn Future<Output = Result<Vec<(AuctionId, SpendableNoteRecord, u64, Option<Any>, Vec<Position>)>>> + Send + 'static>>

Implementors§