Skip to main content

binance/wallet/
url.rs

1//! Binance Wallet endpoints.
2//!
3//! Wallet shares the spot REST host (`api.binance.com`). All wallet routes
4//! live under `/sapi/v1/{capital,account,asset}/...` and require an API key
5//! plus signature. For market data and connectivity probes, use
6//! [`crate::spot::http::PublicClient`].
7
8// Mainnet
9pub const BASE_URL_API: &str = "https://api.binance.com";
10
11// Testnet — note that the spot testnet does NOT expose the wallet `/sapi/v1`
12// endpoints. Live wallet calls only work against mainnet.
13pub const BASE_URL_TESTNET_API: &str = "https://testnet.binance.vision";
14
15pub enum Path {
16    // Capital — deposits / withdrawals
17    CapitalConfigGetAll,
18    CapitalDepositAddress,
19    CapitalDepositHistory,
20    CapitalWithdrawHistory,
21
22    // Account
23    AccountStatus,
24    AccountApiTradingStatus,
25
26    // Asset
27    AssetTradeFee,
28    AssetTransfer,
29    AssetUserAsset,
30}
31
32impl std::fmt::Display for Path {
33    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
34        let s = match self {
35            Self::CapitalConfigGetAll => "/sapi/v1/capital/config/getall",
36            Self::CapitalDepositAddress => "/sapi/v1/capital/deposit/address",
37            Self::CapitalDepositHistory => "/sapi/v1/capital/deposit/hisrec",
38            Self::CapitalWithdrawHistory => "/sapi/v1/capital/withdraw/history",
39            Self::AccountStatus => "/sapi/v1/account/status",
40            Self::AccountApiTradingStatus => "/sapi/v1/account/apiTradingStatus",
41            Self::AssetTradeFee => "/sapi/v1/asset/tradeFee",
42            Self::AssetTransfer => "/sapi/v1/asset/transfer",
43            Self::AssetUserAsset => "/sapi/v3/asset/getUserAsset",
44        };
45        write!(f, "{s}")
46    }
47}
48
49pub const HEADER_RETRY_AFTER: &str = "Retry-After";
50pub const HEADER_X_MBX_APIKEY: &str = "X-MBX-APIKEY";