@xunwukong-tools/withdraw
Version:
Binance withdraw tool
108 lines (105 loc) • 2.56 kB
TypeScript
/**
* Withdraw request parameters
*/
interface WithdrawParams {
coin: string;
address: string;
amount: string | number;
withdrawOrderId?: string;
network?: string;
addressTag?: string;
transactionFeeFlag?: boolean;
name?: string;
walletType?: 0 | 1;
recvWindow?: number;
}
/**
* Withdraw response
*/
interface WithdrawResponse {
id: string;
}
/**
* Binance API configuration
*/
interface BinanceConfig {
apiKey: string;
secretKey: string;
baseURL?: string;
recvWindow?: number;
}
/**
* Coin configuration from getAllCoins API
*/
interface CoinConfig {
coin: string;
depositAllEnable: boolean;
withdrawAllEnable: boolean;
name: string;
free: string;
locked: string;
freeze: string;
withdrawing: string;
ipoing: string;
ipoable: string;
storage: string;
isLegalMoney: boolean;
trading: boolean;
networkList: NetworkConfig[];
}
/**
* Network configuration for a coin
*/
interface NetworkConfig {
network: string;
coin: string;
withdrawIntegerMultiple: string;
isDefault: boolean;
depositEnable: boolean;
withdrawEnable: boolean;
depositDesc: string;
withdrawDesc: string;
specialTips: string;
specialWithdrawTips?: string;
name: string;
resetAddressStatus: boolean;
addressRegex: string;
addressRule: string;
memoRegex?: string;
withdrawFee: string;
withdrawMin: string;
withdrawMax: string;
minConfirm: number;
unLockConfirm: number;
sameAddress: boolean;
estimatedArrivalTime: number;
busy: boolean;
depositDeduct: boolean;
needTag: boolean;
tagName?: string;
tagRegex?: string;
}
/**
* Parameters for getAllCoins API
*/
interface GetAllCoinsParams {
recvWindow?: number;
}
declare class BinanceClient {
private apiKey;
private secretKey;
private baseURL;
private recvWindow;
constructor(config: BinanceConfig);
/**
* Submit a withdraw request
* @see https://developers.binance.com/docs/wallet/capital/withdraw
*/
withdraw(params: WithdrawParams): Promise<WithdrawResponse>;
/**
* Get information of coins (available for deposit and withdraw) for user
* @see https://developers.binance.com/docs/wallet/capital/all-coins-information-user
*/
getAllCoins(params?: GetAllCoinsParams): Promise<CoinConfig[]>;
}
export { BinanceClient, type BinanceConfig, type CoinConfig, type GetAllCoinsParams, type NetworkConfig, type WithdrawParams, type WithdrawResponse };