pub trait ViewOnlyAccount:
Debug
+ Send
+ Sync
+ Clone {
// Required methods
fn address(&self) -> &Bech32Address;
fn try_provider(&self) -> Result<&Provider>;
fn get_asset_inputs_for_amount<'life0, 'async_trait>(
&'life0 self,
asset_id: AssetId,
amount: u64,
excluded_coins: Option<Vec<CoinTypeId>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Input>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn get_transactions<'life0, 'async_trait>(
&'life0 self,
request: PaginationRequest<String>,
) -> Pin<Box<dyn Future<Output = Result<PaginatedResult<TransactionResponse, String>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn get_coins<'life0, 'async_trait>(
&'life0 self,
asset_id: AssetId,
) -> Pin<Box<dyn Future<Output = Result<Vec<Coin>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn get_asset_balance<'life0, 'life1, 'async_trait>(
&'life0 self,
asset_id: &'life1 AssetId,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn get_messages<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Message>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn get_balances<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, u128>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn get_spendable_resources<'life0, 'async_trait>(
&'life0 self,
asset_id: AssetId,
amount: u64,
excluded_coins: Option<Vec<CoinTypeId>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<CoinType>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn get_asset_outputs_for_amount(
&self,
to: &Bech32Address,
asset_id: AssetId,
amount: u64,
) -> Vec<Output> { ... }
fn adjust_for_fee<'life0, 'life1, 'async_trait, Tb>(
&'life0 self,
tb: &'life1 mut Tb,
used_base_amount: u64,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Tb: 'async_trait + TransactionBuilder + Sync,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}
Required Methods§
fn address(&self) -> &Bech32Address
fn try_provider(&self) -> Result<&Provider>
Sourcefn get_asset_inputs_for_amount<'life0, 'async_trait>(
&'life0 self,
asset_id: AssetId,
amount: u64,
excluded_coins: Option<Vec<CoinTypeId>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Input>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_asset_inputs_for_amount<'life0, 'async_trait>(
&'life0 self,
asset_id: AssetId,
amount: u64,
excluded_coins: Option<Vec<CoinTypeId>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Input>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns a vector consisting of Input::Coin
s and Input::Message
s for the given
asset ID and amount.
Provided Methods§
fn get_transactions<'life0, 'async_trait>(
&'life0 self,
request: PaginationRequest<String>,
) -> Pin<Box<dyn Future<Output = Result<PaginatedResult<TransactionResponse, String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn get_coins<'life0, 'async_trait>(
&'life0 self,
asset_id: AssetId,
) -> Pin<Box<dyn Future<Output = Result<Vec<Coin>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_coins<'life0, 'async_trait>(
&'life0 self,
asset_id: AssetId,
) -> Pin<Box<dyn Future<Output = Result<Vec<Coin>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Gets all unspent coins of asset asset_id
owned by the account.
Sourcefn get_asset_balance<'life0, 'life1, 'async_trait>(
&'life0 self,
asset_id: &'life1 AssetId,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_asset_balance<'life0, 'life1, 'async_trait>(
&'life0 self,
asset_id: &'life1 AssetId,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get the balance of all spendable coins asset_id
for address address
. This is different
from getting coins because we are just returning a number (the sum of UTXOs amount) instead
of the UTXOs.
Sourcefn get_messages<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Message>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_messages<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Message>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Gets all unspent messages owned by the account.
Sourcefn get_balances<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, u128>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_balances<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, u128>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get all the spendable balances of all assets for the account. This is different from getting the coins because we are only returning the sum of UTXOs coins amount and not the UTXOs coins themselves.
Sourcefn get_spendable_resources<'life0, 'async_trait>(
&'life0 self,
asset_id: AssetId,
amount: u64,
excluded_coins: Option<Vec<CoinTypeId>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<CoinType>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_spendable_resources<'life0, 'async_trait>(
&'life0 self,
asset_id: AssetId,
amount: u64,
excluded_coins: Option<Vec<CoinTypeId>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<CoinType>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get some spendable resources (coins and messages) of asset asset_id
owned by the account
that add up at least to amount amount
. The returned coins (UTXOs) are actual coins that
can be spent. The number of UXTOs is optimized to prevent dust accumulation.
Sourcefn get_asset_outputs_for_amount(
&self,
to: &Bech32Address,
asset_id: AssetId,
amount: u64,
) -> Vec<Output>
fn get_asset_outputs_for_amount( &self, to: &Bech32Address, asset_id: AssetId, amount: u64, ) -> Vec<Output>
Returns a vector containing the output coin and change output given an asset and amount
Sourcefn adjust_for_fee<'life0, 'life1, 'async_trait, Tb>(
&'life0 self,
tb: &'life1 mut Tb,
used_base_amount: u64,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Tb: 'async_trait + TransactionBuilder + Sync,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn adjust_for_fee<'life0, 'life1, 'async_trait, Tb>(
&'life0 self,
tb: &'life1 mut Tb,
used_base_amount: u64,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Tb: 'async_trait + TransactionBuilder + Sync,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Add base asset inputs to the transaction to cover the estimated fee and add a change output for the base asset if needed. Requires contract inputs to be at the start of the transactions inputs vec so that their indexes are retained
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.