[package]
name = "digdigdig3"
version = "0.1.26"
exclude = ["**/research/**", "contributing/**", "docs/"]
edition = "2021"
description = "Unified async Rust API for 44 exchange connectors — crypto, stocks, forex. REST + WebSocket."
license = "MIT OR Apache-2.0"
repository = "https://github.com/ZENG3LD/digdigdig3"
homepage = "https://github.com/ZENG3LD/digdigdig3"
documentation = "https://docs.rs/digdigdig3"
readme = "README.md"
keywords = ["exchange", "trading", "crypto", "websocket", "connector"]
categories = ["api-bindings", "asynchronous", "web-programming"]

[features]
default = ["onchain-evm"]
websocket = []
# Canonical on-chain feature flags
onchain-evm = ["dep:alloy"]
onchain-cosmos = ["dep:cosmrs"]
onchain-starknet = ["dep:starknet-crypto"]
# Backward-compat alias — onchain-ethereum is now onchain-evm
onchain-ethereum = ["onchain-evm"]
grpc = ["dep:tonic", "dep:prost"]
k256-signing = ["dep:k256"]
# Legacy alias — starknet feature now maps to onchain-starknet
starknet = ["onchain-starknet"]

[dependencies]
# Serialization
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"

# Async
tokio = { version = "1.0", features = ["full"] }
async-trait = "0.1"
futures-util = "0.3"

# HTTP/WebSocket
reqwest = { version = "0.12", features = ["json", "rustls-tls"], default-features = false }
tokio-tungstenite = { version = "0.24", features = ["rustls-tls-webpki-roots"] }
# Explicit rustls dep to pin ring as the process-level CryptoProvider.
# alloy-transport-ws pulls rustls 0.23 with aws_lc_rs; reqwest pulls ring.
# rustls 0.23 panics unless one provider is installed via install_default().
rustls = { version = "0.23", default-features = false, features = ["ring"] }
tokio-stream = { version = "0.1", features = ["sync"] }

# Error handling
thiserror = "1.0"

# Logging
tracing = "0.1"

# Crypto (for HMAC signatures)
hmac = "0.12"
sha2 = "0.10"
hex = "0.4"
base64 = "0.22"

# Time (for OKX ISO timestamps)
chrono = "0.4"

# Binary parsing (for Dhan WebSocket binary format - Little Endian)
byteorder = "1.5"

# UUID generation (for client order IDs)
uuid = { version = "1.0", features = ["v4"] }

# Compression (for BingX and HTX WebSocket, Dukascopy binary files)
flate2 = "1.0"
lzma-rs = "0.3"

# URL encoding (for HTX authentication and Polygon)
url = "2.5"
urlencoding = "2.1"

# JWT (for Coinbase authentication)
jsonwebtoken = "9.3"
# ring: explicit dep for manual JWT signing (Coinbase nonce-in-header);
# already a transitive dep via jsonwebtoken, pinned to the same major version
ring = "0.17"
rand = "0.8"

# Base58 encoding (for Raydium pubkey parsing)
bs58 = "0.5"

# Solana (for Raydium WebSocket via Solana RPC)
# Implemented using raw WebSocket to avoid OpenSSL dependency
# Uses tokio-tungstenite with native-tls (already available via reqwest)
# No additional dependencies needed

# Ethereum (for Uniswap WebSocket) — gated behind onchain-ethereum feature
alloy = { version = "1", features = ["provider-ws", "rpc-types"], optional = true }
tracing-subscriber = "0.3.22"

# TOTP (for Angel One 2FA)
totp-rs = "5.6"

# Concurrent hashmap (for ConnectorPool)
dashmap = "5.5"

# gRPC transport (feature-gated behind `grpc`)
tonic = { version = "0.12", features = ["tls", "tls-native-roots"], optional = true }
prost = { version = "0.13", optional = true }

# Cryptographic signing (feature-gated)
k256 = { version = "0.13", features = ["ecdsa-core", "ecdsa"], optional = true }
starknet-crypto = { version = "0.6", optional = true }

# Cosmos SDK transaction builder + signer (for dYdX, Osmosis, etc.)
cosmrs = { version = "0.22", optional = true, default-features = false, features = ["bip32"] }

# Decimal arithmetic (f64 → Decimal conversion for safe price/qty rounding)
rust_decimal = "1"
