Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
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
30 changes: 15 additions & 15 deletions Cargo.lock

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

26 changes: 13 additions & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ resolver = "2"

[workspace.dependencies]
bothan-api = { path = "bothan-api/server" }
bothan-core = { path = "bothan-core", version = "0.0.1" }
bothan-client = { path = "bothan-api/client/rust-client", version = "0.0.1" }
bothan-lib = { path = "bothan-lib", version = "0.0.1" }
bothan-core = { path = "bothan-core", version = "0.1.0" }
bothan-client = { path = "bothan-api/client/rust-client", version = "0.1.0" }
bothan-lib = { path = "bothan-lib", version = "0.1.0" }

bothan-binance = { path = "bothan-binance", version = "0.0.1" }
bothan-bitfinex = { path = "bothan-bitfinex", version = "0.0.1" }
bothan-bybit = { path = "bothan-bybit", version = "0.0.1" }
bothan-coinbase = { path = "bothan-coinbase", version = "0.0.1" }
bothan-coingecko = { path = "bothan-coingecko", version = "0.0.1" }
bothan-coinmarketcap = { path = "bothan-coinmarketcap", version = "0.0.1" }
bothan-htx = { path = "bothan-htx", version = "0.0.1" }
bothan-kraken = { path = "bothan-kraken", version = "0.0.1" }
bothan-okx = { path = "bothan-okx", version = "0.0.1" }
bothan-band = { path = "bothan-band", version = "0.0.1" }
bothan-binance = { path = "bothan-binance", version = "0.1.0" }
bothan-bitfinex = { path = "bothan-bitfinex", version = "0.1.0" }
bothan-bybit = { path = "bothan-bybit", version = "0.1.0" }
bothan-coinbase = { path = "bothan-coinbase", version = "0.1.0" }
bothan-coingecko = { path = "bothan-coingecko", version = "0.1.0" }
bothan-coinmarketcap = { path = "bothan-coinmarketcap", version = "0.1.0" }
bothan-htx = { path = "bothan-htx", version = "0.1.0" }
bothan-kraken = { path = "bothan-kraken", version = "0.1.0" }
bothan-okx = { path = "bothan-okx", version = "0.1.0" }
bothan-band = { path = "bothan-band", version = "0.1.0" }

anyhow = "1.0.86"
async-trait = "0.1.77"
Expand Down
2 changes: 1 addition & 1 deletion bothan-api-proxy/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module go-proxy
go 1.24.2

require (
github.com/bandprotocol/bothan/bothan-api/client/go-client v0.0.1
github.com/bandprotocol/bothan/bothan-api/client/go-client v0.1.0
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0
google.golang.org/grpc v1.67.1
)
Expand Down
2 changes: 1 addition & 1 deletion bothan-api/client/rust-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bothan-client"
version = "0.0.1"
version = "0.1.0"
description = "Rust client for the Bothan API"
authors.workspace = true
edition.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion bothan-api/server-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bothan-api-cli"
version = "0.0.1"
version = "0.1.0"
edition.workspace = true
license.workspace = true
repository.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion bothan-api/server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bothan-api"
version = "0.0.1"
version = "0.1.0"
edition.workspace = true
license.workspace = true
repository.workspace = true
Expand Down
4 changes: 2 additions & 2 deletions bothan-api/server/src/api/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

use bothan_core::manager::crypto_asset_info::types::PriceState;
use rust_decimal::prelude::Zero;
use tracing::warn;
use tracing::error;

use crate::api::server::PRECISION;
use crate::proto::bothan::v1::{Price, Status};
Expand All @@ -32,7 +32,7 @@ pub fn parse_price_state(id: String, price_state: PriceState) -> Price {
match u64::try_from(mantissa) {
Ok(p) => Price::new(id, p, Status::Available),
Err(_) => {
warn!("failed to convert {mantissa} to u64 for id {id}");
error!("failed to convert {mantissa} to u64 for id {id}");
Price::new(id, 0u64, Status::Unavailable)
}
}
Expand Down
2 changes: 1 addition & 1 deletion bothan-band/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bothan-band"
version = "0.0.1"
version = "0.1.0"
description = "Rust client for the Band source with Bothan integration"
edition.workspace = true
license.workspace = true
Expand Down
44 changes: 32 additions & 12 deletions bothan-band/src/api/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//! This module provides custom error types used throughout the Band REST API integration,
//! particularly for REST API client configuration and concurrent background data fetching.

use reqwest::StatusCode;
use thiserror::Error;

/// Errors from initializing the Band REST API builder.
Expand All @@ -16,7 +17,7 @@ pub enum BuildError {
InvalidURL(#[from] url::ParseError),

/// Represents general failures during HTTP client construction (e.g., TLS configuration issues).
#[error("reqwest error: {0}")]
#[error("failed to build with error: {0}")]
FailedToBuild(#[from] reqwest::Error),
}

Expand All @@ -26,21 +27,40 @@ pub enum BuildError {
#[derive(Debug, Error)]
pub enum ProviderError {
/// Indicates HTTP request failure due to network issues or HTTP errors.
#[error("failed to fetch prices: {0}")]
RequestError(#[from] reqwest::Error),
#[error("failed to fetch prices (signals={signals}): {error}")]
SendingRequestError {
#[source]
error: reqwest::Error,
signals: String,
},

/// Indicates a failure to parse the API response.
#[error("parse error: {0}")]
ParseError(#[from] ParseError),
/// Indicates the API returned a non-success HTTP status code.
#[error("returned HTTP {status} for signals={signals}: {body}")]
HttpStatusError {
status: StatusCode,
body: String,
signals: String,
},

/// Indicates the response body could not be deserialized.
#[error("failed to parse response for signals={signals}: {source}")]
ParseResponseError {
#[source]
source: reqwest::Error,
signals: String,
},
}

/// Errors that can occur while parsing Band API responses.
#[derive(Debug, Error)]
pub enum ParseError {
/// Indicates that the price value is not a valid number (NaN).
#[error("price is NaN")]
InvalidPrice,
/// Indicates that the timestamp value is missing or invalid.
#[error("invalid timestamp")]
InvalidTimestamp,
/// Indicates that the price field was missing.
#[error("missing price from signal {0}")]
MissingPrice(String),
/// Indicates that the price value is present but not a valid number (NaN/inf).
#[error("invalid price value {price} from signal {signal}")]
InvalidPrice { price: f64, signal: String },
/// Indicates that the timestamp field was missing.
#[error("missing timestamp from signal {0}")]
MissingTimestamp(String),
}
Loading