whisky_common/interfaces/
fetcher.rs

1use std::collections::HashMap;
2
3use crate::*;
4use async_trait::async_trait;
5
6#[async_trait]
7pub trait Fetcher: Send + Sync {
8    async fn fetch_account_info(&self, address: &str) -> Result<AccountInfo, WError>;
9    async fn fetch_address_utxos(
10        &self,
11        address: &str,
12        asset: Option<&str>,
13    ) -> Result<Vec<UTxO>, WError>;
14
15    async fn fetch_asset_addresses(&self, asset: &str) -> Result<Vec<(String, String)>, WError>;
16    async fn fetch_asset_metadata(
17        &self,
18        asset: &str,
19    ) -> Result<Option<HashMap<String, serde_json::Value>>, WError>;
20    async fn fetch_block_info(&self, hash: &str) -> Result<BlockInfo, WError>;
21    async fn fetch_collection_assets(
22        &self,
23        policy_id: &str,
24        cursor: Option<String>,
25    ) -> Result<(Vec<(String, String)>, Option<String>), WError>;
26    async fn fetch_protocol_parameters(&self, epoch: Option<u32>) -> Result<Protocol, WError>;
27    async fn fetch_tx_info(&self, hash: &str) -> Result<TransactionInfo, WError>;
28    async fn fetch_utxos(&self, hash: &str, index: Option<u32>) -> Result<Vec<UTxO>, WError>;
29    async fn get(&self, url: &str) -> Result<serde_json::Value, WError>;
30}