pub struct TitanClient { /* private fields */ }Expand description
A client for your HTTP server.
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(base_url: &str) -> Self
pub fn new(base_url: &str) -> Self
Create a new client with the given base URL (e.g. “http://localhost:3030”).
Sourcepub async fn get_address(
&self,
address: &str,
) -> Result<AddressData, Box<dyn Error>>
pub async fn get_address( &self, address: &str, ) -> Result<AddressData, Box<dyn Error>>
GET /address/{address}
Sourcepub async fn get_transaction(
&self,
txid: &str,
) -> Result<Transaction, Box<dyn Error>>
pub async fn get_transaction( &self, txid: &str, ) -> Result<Transaction, Box<dyn Error>>
GET /tx/{txid}
Returns a structured bitcoin Transaction (JSON).
Sourcepub async fn get_transaction_with_runes(
&self,
txid: &str,
) -> Result<Transaction, Box<dyn Error>>
pub async fn get_transaction_with_runes( &self, txid: &str, ) -> Result<Transaction, Box<dyn Error>>
Same as get_transaction but always requests runes (with_runes=true).
Sourcepub async fn get_transaction_raw(
&self,
txid: &str,
) -> Result<Vec<u8>, Box<dyn Error>>
pub async fn get_transaction_raw( &self, txid: &str, ) -> Result<Vec<u8>, Box<dyn Error>>
GET /tx/{txid}/raw Returns the raw transaction bytes (content-type: application/octet-stream).
Sourcepub async fn get_transaction_hex(
&self,
txid: &str,
) -> Result<String, Box<dyn Error>>
pub async fn get_transaction_hex( &self, txid: &str, ) -> Result<String, Box<dyn Error>>
GET /tx/{txid}/hex Returns a text/plain body containing hex-encoded raw transaction.
Sourcepub async fn broadcast_transaction(
&self,
tx_hex: String,
) -> Result<Txid, Box<dyn Error>>
pub async fn broadcast_transaction( &self, tx_hex: String, ) -> Result<Txid, Box<dyn Error>>
POST /tx/broadcast Broadcast a raw transaction (in hex form) to the network.
Sourcepub async fn get_output(
&self,
outpoint: &str,
) -> Result<TxOutEntry, Box<dyn Error>>
pub async fn get_output( &self, outpoint: &str, ) -> Result<TxOutEntry, Box<dyn Error>>
GET /output/{outpoint}
Sourcepub async fn get_inscription(
&self,
inscription_id: &str,
) -> Result<(HeaderMap, Vec<u8>), Box<dyn Error>>
pub async fn get_inscription( &self, inscription_id: &str, ) -> Result<(HeaderMap, Vec<u8>), Box<dyn Error>>
GET /inscription/{inscription_id}
Returns (Headers, Bytes). The server sets content-type and possibly compression,
and the body is the raw inscription content.
Sourcepub async fn get_runes(
&self,
pagination: Option<Pagination>,
) -> Result<PaginationResponse<RuneResponse>, Box<dyn Error>>
pub async fn get_runes( &self, pagination: Option<Pagination>, ) -> Result<PaginationResponse<RuneResponse>, Box<dyn Error>>
GET /runes?skip=&limit=
Sourcepub async fn get_rune(&self, rune: &str) -> Result<RuneResponse, Box<dyn Error>>
pub async fn get_rune(&self, rune: &str) -> Result<RuneResponse, Box<dyn Error>>
GET /rune/{rune}
Sourcepub async fn get_rune_transactions(
&self,
rune: &str,
pagination: Option<Pagination>,
) -> Result<PaginationResponse<Txid>, Box<dyn Error>>
pub async fn get_rune_transactions( &self, rune: &str, pagination: Option<Pagination>, ) -> Result<PaginationResponse<Txid>, Box<dyn Error>>
GET /rune/{rune}/transactions?skip=&limit=
Sourcepub async fn get_subscription(
&self,
id: &str,
) -> Result<Subscription, Box<dyn Error>>
pub async fn get_subscription( &self, id: &str, ) -> Result<Subscription, Box<dyn Error>>
GET /subscription/{id}
Sourcepub async fn list_subscriptions(
&self,
) -> Result<Vec<Subscription>, Box<dyn Error>>
pub async fn list_subscriptions( &self, ) -> Result<Vec<Subscription>, Box<dyn Error>>
GET /subscriptions
Sourcepub async fn add_subscription(
&self,
subscription: &Subscription,
) -> Result<Subscription, Box<dyn Error>>
pub async fn add_subscription( &self, subscription: &Subscription, ) -> Result<Subscription, Box<dyn Error>>
POST /subscription