# Fetcher

`fetcher` implements the following interface:

```rust
#[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

* &#x20;`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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://whisky.sidan.io/services/providers/fetcher.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
