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§