#![warn(future_incompatible, let_underscore, nonstandard_style)] #![feature(slice_pattern)]
#![feature(default_field_values)]
#![feature(error_generic_member_access)]
#![feature(try_blocks)]
#![feature(duration_constructors)]
#![allow(clippy::result_large_err)]
use std::backtrace::Backtrace;
pub mod http;
pub mod ratelimiter;
pub mod retry;
pub mod ws;
pub use ratelimiter::{RateLimiter, quota::Quota};
pub use retry::{ExponentialBackoff, RetryConfig, RetryManager};
pub extern crate reqwest;
pub extern crate tokio_tungstenite;
#[derive(Debug, miette::Diagnostic, thiserror::Error, derive_new::new)]
#[non_exhaustive]
pub enum ConstructAuthError {
#[error("missing API public key")]
#[diagnostic(code(v_exchanges::auth::missing_pubkey), help("Provide API public key in your credentials"))]
MissingPubkey {
#[new(value = "Backtrace::capture()")]
backtrace: Backtrace,
},
#[error("missing API secret key")]
#[diagnostic(code(v_exchanges::auth::missing_secret), help("Provide API secret key in your credentials"))]
MissingSecret {
#[new(value = "Backtrace::capture()")]
backtrace: Backtrace,
},
#[error("invalid character in API key: {key}")]
#[diagnostic(code(v_exchanges::auth::invalid_api_key))]
InvalidCharacterInApiKey {
key: String,
#[new(value = "Backtrace::capture()")]
backtrace: Backtrace,
},
#[error(transparent)]
Other(eyre::Report),
}
#[derive(Debug, miette::Diagnostic, thiserror::Error)]
pub enum UrlError {
#[error("Failed to parse URL: {0}")]
#[diagnostic(code(v_exchanges::url::parse))]
Parse(#[from] url::ParseError),
#[error("Exchange does not provide testnet for requested endpoint: {0}")]
#[diagnostic(
code(v_exchanges::url::missing_testnet),
help("Not all exchanges provide testnet endpoints. Check if this exchange supports testnet for this specific API.")
)]
MissingTestnet(url::Url),
}