Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Bitworkr supports #33

Merged
merged 6 commits into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
169 changes: 135 additions & 34 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/electrumx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ pub struct ElectrumXBuilder {
pub base_uri: String,
}
impl ElectrumXBuilder {
#[cfg(test)]
pub fn testnet() -> Self {
Self { network: Network::Testnet, base_uri: "https://eptestnet.atomicals.xyz/proxy".into() }
}

pub fn network(mut self, network: Network) -> Self {
self.network = network;

Expand Down
14 changes: 10 additions & 4 deletions src/electrumx/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,28 @@ use super::*;

#[tokio::test]
async fn get_by_ticker_should_work() {
ElectrumXBuilder::default().build().unwrap().get_by_ticker("quark").await.unwrap();
tracing_subscriber::fmt::init();

ElectrumXBuilder::testnet().build().unwrap().get_by_ticker("quark").await.unwrap();
}

#[tokio::test]
async fn get_ft_info_should_work() {
let e = ElectrumXBuilder::default().build().unwrap();
tracing_subscriber::fmt::init();

let e = ElectrumXBuilder::testnet().build().unwrap();

e.get_ft_info(e.get_by_ticker("quark").await.unwrap().atomical_id).await.unwrap();
}

#[tokio::test]
async fn get_unspent_address_should_work() {
ElectrumXBuilder::default()
tracing_subscriber::fmt::init();

ElectrumXBuilder::testnet()
.build()
.unwrap()
.get_unspent_address("bc1pqkq0rg5yjrx6u08nhmc652s33g96jmdz4gjp9d46ew6ahun7xuvqaerzsp")
.get_unspent_address("tb1pemen3j4wvlryktkqsew8ext7wnsgqhmuzl7267rm3xk0th3gh04qr9wcec")
.await
.unwrap();
}
5 changes: 3 additions & 2 deletions src/electrumx/type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ pub struct Ft {
pub mint_amount: u64,
#[serde(rename = "$mint_bitworkc")]
pub mint_bitworkc: String,
#[serde(rename = "$mint_bitworkr")]
pub mint_bitworkr: Option<String>,
#[serde(rename = "$mint_height")]
pub mint_height: u64,
#[serde(rename = "$request_ticker")]
Expand All @@ -95,8 +97,7 @@ pub struct Ft {
#[derive(Debug, Deserialize)]
pub struct Bitwork {
pub bitworkc: String,
// TODO: Check the real type.
pub bitworkr: Option<()>,
pub bitworkr: Option<String>,
}
#[derive(Debug, Deserialize)]
pub struct TickerStatus {
Expand Down
Loading
Loading