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

Commit

Permalink
Part VI
Browse files Browse the repository at this point in the history
  • Loading branch information
aurexav committed Jan 22, 2024
1 parent 0c9b3bf commit b5b0466
Show file tree
Hide file tree
Showing 7 changed files with 262 additions and 247 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion atomicals-electrumx/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ version = "0.1.9"

[dependencies]
# crates.io
anyhow = { version = "1.0" }
array-bytes = { version = "6.2" }
bitcoin = { version = "0.31", features = ["rand-std"] }
reqwest = { version = "0.11", features = ["json", "rustls-tls"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0" }
sha2 = { version = "0.10" }
thiserror = { version = "1.0" }
tokio = { version = "1.35", features = ["macros", "rt-multi-thread"] }
tracing = { version = "0.1" }

Expand Down
17 changes: 17 additions & 0 deletions atomicals-electrumx/src/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//! atomicals-electrumx error collections.
#![allow(missing_docs)]

// crates.io
use thiserror::Error as ThisError;

#[derive(Debug, ThisError)]
pub enum Error {
#[error("exceeded maximum retries")]
ExceededMaximumRetries,

#[error(transparent)]
Bitcoin(#[from] bitcoin::address::Error),
#[error(transparent)]
Reqwest(#[from] reqwest::Error),
}
19 changes: 14 additions & 5 deletions atomicals-electrumx/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
#![deny(missing_docs, unused_crate_dependencies)]

//! Atomicals electrumx APIs.
#![deny(missing_docs, unused_crate_dependencies)]

#[cfg(test)] mod test;

pub mod error;

pub mod r#type;
use r#type::*;

pub mod util;

mod prelude {
pub use anyhow::Result;
pub mod prelude {
//! atomicals-electrumx prelude.
pub use std::result::Result as StdResult;

pub use super::error::{self, Error};

/// atomicals-electrumx `Result` type.
pub type Result<T> = StdResult<T, Error>;
}
use prelude::*;

Expand Down Expand Up @@ -228,7 +237,7 @@ impl Http for ElectrumX {
time::sleep(self.retry_period).await;
}

Err(anyhow::anyhow!("exceeded maximum retries"))
Err(Error::ExceededMaximumRetries)
}
}

Expand Down
2 changes: 1 addition & 1 deletion atomicals-electrumx/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::future::Future;
// crates.io
use tokio::runtime::Runtime;
// atomicals-electrumx
use super::*;
use crate::*;

fn test<F, Fut>(f: F)
where
Expand Down
Loading

0 comments on commit b5b0466

Please sign in to comment.