AssetInfoProvider

Trait AssetInfoProvider 

Source
pub trait AssetInfoProvider: Send + Sync {
    type Error: Display;

    // Required method
    fn get_asset_info<'life0, 'life1, 'async_trait>(
        &'life0 self,
        ids: &'life1 [String],
    ) -> Pin<Box<dyn Future<Output = Result<Vec<AssetInfo>, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Trait for providers that can fetch asset information from REST APIs.

This trait defines the interface that REST-based asset information providers must implement. Providers are responsible for making HTTP requests to fetch asset data and converting the responses into AssetInfo structures.

Required Associated Types§

Source

type Error: Display

The type returned in the event of an operation failure.

This should be a custom error type that implements the Display trait and captures all possible error conditions specific to the API.

Required Methods§

Source

fn get_asset_info<'life0, 'life1, 'async_trait>( &'life0 self, ids: &'life1 [String], ) -> Pin<Box<dyn Future<Output = Result<Vec<AssetInfo>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetches asset information for the specified asset IDs.

This method should make HTTP requests to the appropriate endpoints, parse the responses, and convert the data into a vector of AssetInfo structures.

§Errors

Returns a provider-specific error if the operation fails, such as when the API is unavailable, returns an error response, or the response cannot be parsed correctly.

Implementors§