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:
- 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 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 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
sourcefn status(
&mut self,
) -> Pin<Box<dyn Future<Output = Result<StatusResponse>> + Send + 'static>>
fn status( &mut self, ) -> Pin<Box<dyn Future<Output = Result<StatusResponse>> + Send + 'static>>
Get the current status of chain sync.
sourcefn status_stream(
&mut self,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<StatusStreamResponse>> + Send + 'static>>>> + Send + 'static>>
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.
sourcefn app_params(
&mut self,
) -> Pin<Box<dyn Future<Output = Result<AppParameters>> + Send + 'static>>
fn app_params( &mut self, ) -> Pin<Box<dyn Future<Output = Result<AppParameters>> + Send + 'static>>
Get a copy of the app parameters.
sourcefn gas_prices(
&mut self,
) -> Pin<Box<dyn Future<Output = Result<GasPrices>> + Send + 'static>>
fn gas_prices( &mut self, ) -> Pin<Box<dyn Future<Output = Result<GasPrices>> + Send + 'static>>
Get a copy of the gas prices.
sourcefn fmd_parameters(
&mut self,
) -> Pin<Box<dyn Future<Output = Result<Parameters>> + Send + 'static>>
fn fmd_parameters( &mut self, ) -> Pin<Box<dyn Future<Output = Result<Parameters>> + 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,
note_commitment: StateCommitment,
) -> Pin<Box<dyn Future<Output = Result<SpendableNoteRecord>> + Send + 'static>>
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.
sourcefn swap_by_commitment(
&mut self,
swap_commitment: StateCommitment,
) -> Pin<Box<dyn Future<Output = Result<SwapRecord>> + Send + 'static>>
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.
sourcefn nullifier_status(
&mut self,
nullifier: Nullifier,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'static>>
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.
sourcefn await_nullifier(
&mut self,
nullifier: Nullifier,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'static>>
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.
sourcefn await_note_by_commitment(
&mut self,
note_commitment: StateCommitment,
) -> Pin<Box<dyn Future<Output = Result<SpendableNoteRecord>> + Send + 'static>>
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.
sourcefn witness(
&mut self,
plan: &TransactionPlan,
) -> Pin<Box<dyn Future<Output = Result<WitnessData>> + Send + 'static>>
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).
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: TransactionId,
) -> Pin<Box<dyn Future<Output = Result<TransactionInfo>> + Send + 'static>>
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
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<Streaming<BroadcastTransactionResponse>, Error>> + Send>>
fn address_by_index( &mut self, address_index: AddressIndex, ) -> Pin<Box<dyn Future<Output = Result<Address>> + Send + 'static>>
sourcefn index_by_address(
&mut self,
address: Address,
) -> Pin<Box<dyn Future<Output = Result<Option<AddressIndex>>> + Send + 'static>>
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.
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,
) -> Pin<Box<dyn Future<Output = Result<BTreeMap<AddressIndex, BTreeMap<Id, Vec<SpendableNoteRecord>>>>> + Send + 'static>>
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.
sourcefn 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_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.
sourcefn unspent_notes_by_asset_and_address(
&mut self,
) -> Pin<Box<dyn Future<Output = Result<BTreeMap<Id, BTreeMap<AddressIndex, 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>>
Return unspent notes, grouped by denom and then by address index.
Implementations on Foreign Types§
source§impl<T> ViewClient for ViewServiceClient<T>
impl<T> ViewClient for ViewServiceClient<T>
source§fn await_note_by_commitment(
&mut self,
note_commitment: StateCommitment,
) -> Pin<Box<dyn Future<Output = Result<SpendableNoteRecord>> + Send + 'static>>
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>>
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>>
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.