Fetcher

fetcher implements the following interface:

#[async_trait]
pub trait Fetcher: Send + Sync {
    async fn fetch_account_info(&self, address: &str) -> Result<AccountInfo, WError>;
    async fn fetch_address_utxos(
        &self,
        address: &str,
        asset: Option<&str>,
    ) -> Result<Vec<UTxO>, WError>;

    async fn fetch_asset_addresses(&self, asset: &str) -> Result<Vec<(String, String)>, WError>;
    async fn fetch_asset_metadata(
        &self,
        asset: &str,
    ) -> Result<Option<HashMap<String, serde_json::Value>>, WError>;
    async fn fetch_block_info(&self, hash: &str) -> Result<BlockInfo, WError>;
    async fn fetch_collection_assets(
        &self,
        policy_id: &str,
        cursor: Option<String>,
    ) -> Result<(Vec<(String, String)>, Option<String>), WError>;
    async fn fetch_protocol_parameters(&self, epoch: Option<u32>) -> Result<Protocol, WError>;
    async fn fetch_tx_info(&self, hash: &str) -> Result<TransactionInfo, WError>;
    async fn fetch_utxos(&self, hash: &str, index: Option<u32>) -> Result<Vec<UTxO>, WError>;
    async fn get(&self, url: &str) -> Result<serde_json::Value, WError>;
}

Endpoints

fetch_account_info

Fetch the account information of a given address

  • address - The address to fetch the information

fetch_address_utxos

Fetch the utxos at an address

  • address - The targeted address to search utxos for

  • asset - The optional asset to filter the utxos value at the address

fetch_asset_addresses

Fetch the asset addresses for a given asset

  • asset - The policy ID + the asset name in hex

fetch_asset_metadata

Fetch the metadata of a given asset

  • asset - The policy ID + the asset name in hex

fetch_block_info

Fetch the block information

  • hash - The block hash to search for

fetch_collection_assets

Fetch a collection's existing assets on-chain

  • policy_id - The policy ID of the collection to search for

  • cursor - The optional cursor to search for the next page of an assets list

fetch_protocol_parameters

Fetch the current protocol parameters

  • epoch - Optional, to search for a particular epoch's protocol parameters

fetch_tx_info

Fetch transaction information by transaction hash

  • hash - The transaction hash to search for

fetch_utxos

Fetch output utxos Information by transaction hash

  • hash - The transaction hash to search for

  • index - The optional output index to filter

get

The generic get endpoint to help calling other un-unified get requests on the provider service.

Last updated