Trait penumbra_view::ViewClient
source · pub trait ViewClient {
Show 23 methods
// Required methods
fn status(
&mut self,
account_group_id: AccountGroupId
) -> Pin<Box<dyn Future<Output = Result<StatusResponse>> + Send + 'static>>;
fn status_stream(
&mut self,
account_group_id: AccountGroupId
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<StatusStreamResponse>> + Send + 'static>>>> + Send + 'static>>;
fn chain_params(
&mut self
) -> Pin<Box<dyn Future<Output = Result<ChainParameters>> + Send + 'static>>;
fn fmd_parameters(
&mut self
) -> Pin<Box<dyn Future<Output = Result<FmdParameters>> + 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,
account_group_id: AccountGroupId,
note_commitment: StateCommitment
) -> Pin<Box<dyn Future<Output = Result<SpendableNoteRecord>> + Send + 'static>>;
fn swap_by_commitment(
&mut self,
account_group_id: AccountGroupId,
swap_commitment: StateCommitment
) -> Pin<Box<dyn Future<Output = Result<SwapRecord>> + Send + 'static>>;
fn nullifier_status(
&mut self,
account_group_id: AccountGroupId,
nullifier: Nullifier
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'static>>;
fn await_nullifier(
&mut self,
account_group_id: AccountGroupId,
nullifier: Nullifier
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'static>>;
fn await_note_by_commitment(
&mut self,
account_group_id: AccountGroupId,
note_commitment: StateCommitment
) -> Pin<Box<dyn Future<Output = Result<SpendableNoteRecord>> + Send + 'static>>;
fn witness(
&mut self,
account_group_id: AccountGroupId,
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: Id
) -> 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<(Id, u64)>> + Send + 'static>>;
fn address_by_index(
&mut self,
address_index: AddressIndex
) -> Pin<Box<dyn Future<Output = Result<Address>> + 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,
account_group_id: AccountGroupId
) -> Pin<Box<dyn Future<Output = Result<BTreeMap<AddressIndex, BTreeMap<Id, Vec<SpendableNoteRecord>>>>> + Send + 'static>> { ... }
fn unspent_notes_by_asset_and_address(
&mut self,
account_group_id: AccountGroupId
) -> 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 ViewProtocolServiceClient
that serves two goals:
- It can use domain types rather than proto-generated types, avoiding conversions;
- 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 towerService
.
Required Methods§
sourcefn status(
&mut self,
account_group_id: AccountGroupId
) -> Pin<Box<dyn Future<Output = Result<StatusResponse>> + Send + 'static>>
fn status( &mut self, account_group_id: AccountGroupId ) -> Pin<Box<dyn Future<Output = Result<StatusResponse>> + Send + 'static>>
Get the current status of chain sync.
sourcefn status_stream(
&mut self,
account_group_id: AccountGroupId
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<StatusStreamResponse>> + Send + 'static>>>> + Send + 'static>>
fn status_stream( &mut self, account_group_id: AccountGroupId ) -> 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.
sourcefn chain_params(
&mut self
) -> Pin<Box<dyn Future<Output = Result<ChainParameters>> + Send + 'static>>
fn chain_params( &mut self ) -> Pin<Box<dyn Future<Output = Result<ChainParameters>> + Send + 'static>>
Get a copy of the chain parameters.
sourcefn fmd_parameters(
&mut self
) -> Pin<Box<dyn Future<Output = Result<FmdParameters>> + Send + 'static>>
fn fmd_parameters( &mut self ) -> Pin<Box<dyn Future<Output = Result<FmdParameters>> + Send + 'static>>
Get a copy of the FMD parameters.
sourcefn notes(
&mut self,
request: NotesRequest
) -> Pin<Box<dyn Future<Output = Result<Vec<SpendableNoteRecord>>> + Send + 'static>>
fn notes( &mut self, request: NotesRequest ) -> Pin<Box<dyn Future<Output = Result<Vec<SpendableNoteRecord>>> + Send + 'static>>
Queries for notes.
sourcefn notes_for_voting(
&mut self,
request: NotesForVotingRequest
) -> Pin<Box<dyn Future<Output = Result<Vec<(SpendableNoteRecord, IdentityKey)>>> + Send + 'static>>
fn notes_for_voting( &mut self, request: NotesForVotingRequest ) -> Pin<Box<dyn Future<Output = Result<Vec<(SpendableNoteRecord, IdentityKey)>>> + Send + 'static>>
Queries for notes for voting.
sourcefn balances(
&mut self,
address_index: AddressIndex,
asset_id: Option<Id>
) -> Pin<Box<dyn Future<Output = Result<Vec<(Id, Amount)>>> + Send + 'static>>
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
sourcefn note_by_commitment(
&mut self,
account_group_id: AccountGroupId,
note_commitment: StateCommitment
) -> Pin<Box<dyn Future<Output = Result<SpendableNoteRecord>> + Send + 'static>>
fn note_by_commitment( &mut self, account_group_id: AccountGroupId, 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.
sourcefn swap_by_commitment(
&mut self,
account_group_id: AccountGroupId,
swap_commitment: StateCommitment
) -> Pin<Box<dyn Future<Output = Result<SwapRecord>> + Send + 'static>>
fn swap_by_commitment( &mut self, account_group_id: AccountGroupId, 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.
sourcefn nullifier_status(
&mut self,
account_group_id: AccountGroupId,
nullifier: Nullifier
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'static>>
fn nullifier_status( &mut self, account_group_id: AccountGroupId, 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.
sourcefn await_nullifier(
&mut self,
account_group_id: AccountGroupId,
nullifier: Nullifier
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'static>>
fn await_nullifier( &mut self, account_group_id: AccountGroupId, 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.
sourcefn await_note_by_commitment(
&mut self,
account_group_id: AccountGroupId,
note_commitment: StateCommitment
) -> Pin<Box<dyn Future<Output = Result<SpendableNoteRecord>> + Send + 'static>>
fn await_note_by_commitment( &mut self, account_group_id: AccountGroupId, 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.
sourcefn witness(
&mut self,
account_group_id: AccountGroupId,
plan: &TransactionPlan
) -> Pin<Box<dyn Future<Output = Result<WitnessData>> + Send + 'static>>
fn witness( &mut self, account_group_id: AccountGroupId, 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).
sourcefn witness_and_build(
&mut self,
plan: TransactionPlan,
auth_data: AuthorizationData
) -> Pin<Box<dyn Future<Output = Result<Transaction>> + Send + 'static>>
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
sourcefn assets(
&mut self
) -> Pin<Box<dyn Future<Output = Result<Cache>> + Send + 'static>>
fn assets( &mut self ) -> Pin<Box<dyn Future<Output = Result<Cache>> + Send + 'static>>
Queries for all known assets.
sourcefn owned_position_ids(
&mut self,
position_state: Option<State>,
trading_pair: Option<TradingPair>
) -> Pin<Box<dyn Future<Output = Result<Vec<Id>>> + 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>>
Queries for liquidity positions owned by the full viewing key.
sourcefn transaction_info_by_hash(
&mut self,
id: Id
) -> Pin<Box<dyn Future<Output = Result<TransactionInfo>> + Send + 'static>>
fn transaction_info_by_hash( &mut self, id: Id ) -> Pin<Box<dyn Future<Output = Result<TransactionInfo>> + Send + 'static>>
Generates a full perspective for a selected transaction using a full viewing key
sourcefn transaction_info(
&mut self,
start_height: Option<u64>,
end_height: Option<u64>
) -> Pin<Box<dyn Future<Output = Result<Vec<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>>
Queries for transactions in a range of block heights
fn broadcast_transaction( &mut self, transaction: Transaction, await_detection: bool ) -> Pin<Box<dyn Future<Output = Result<(Id, u64)>> + Send + 'static>>
fn address_by_index( &mut self, address_index: AddressIndex ) -> Pin<Box<dyn Future<Output = Result<Address>> + Send + 'static>>
sourcefn unclaimed_swaps(
&mut self
) -> Pin<Box<dyn Future<Output = Result<Vec<SwapRecord>>> + Send + 'static>>
fn unclaimed_swaps( &mut self ) -> Pin<Box<dyn Future<Output = Result<Vec<SwapRecord>>> + Send + 'static>>
Queries for unclaimed Swaps.
Provided Methods§
sourcefn unspent_notes_by_address_and_asset(
&mut self,
account_group_id: AccountGroupId
) -> Pin<Box<dyn Future<Output = Result<BTreeMap<AddressIndex, BTreeMap<Id, Vec<SpendableNoteRecord>>>>> + Send + 'static>>
fn unspent_notes_by_address_and_asset( &mut self, account_group_id: AccountGroupId ) -> 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.
sourcefn unspent_notes_by_asset_and_address(
&mut self,
account_group_id: AccountGroupId
) -> Pin<Box<dyn Future<Output = Result<BTreeMap<Id, BTreeMap<AddressIndex, Vec<SpendableNoteRecord>>>>> + Send + 'static>>
fn unspent_notes_by_asset_and_address( &mut self, account_group_id: AccountGroupId ) -> 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 ViewProtocolServiceClient<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,
impl<T> ViewClient for ViewProtocolServiceClient<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,
account_group_id: AccountGroupId,
note_commitment: StateCommitment
) -> Pin<Box<dyn Future<Output = Result<SpendableNoteRecord>> + Send + 'static>>
fn await_note_by_commitment( &mut self, account_group_id: AccountGroupId, 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,
account_group_id: AccountGroupId,
nullifier: Nullifier
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'static>>
fn nullifier_status( &mut self, account_group_id: AccountGroupId, 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,
account_group_id: AccountGroupId,
nullifier: Nullifier
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'static>>
fn await_nullifier( &mut self, account_group_id: AccountGroupId, 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.