fuels_accounts

Trait ViewOnlyAccount

Source
pub trait ViewOnlyAccount:
    Debug
    + Send
    + Sync
    + Clone {
    // Required methods
    fn address(&self) -> &Bech32Address;
    fn try_provider(&self) -> Result<&Provider>;

    // 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, u64>>> + 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 { ... }
}

Required Methods§

Provided Methods§

Source

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,

Source

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.

Source

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.

Source

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.

Source

fn get_balances<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<HashMap<String, u64>>> + 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.

Source

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.

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.

Implementors§