parse_transaction

Function parse_transaction 

Source
pub fn parse_transaction(
    data: &Value,
    transaction_type: TransactionType,
) -> Result<Transaction>
Expand description

解析单个交易记录(充值或提现)

§Arguments

  • data - Binance transaction data JSON
  • transaction_type - Transaction type (deposit or withdrawal)

§Returns

Returns a Transaction.

§Binance API Response Format (Deposit)

{
    "id": "abc123",
    "amount": "0.5",
    "coin": "BTC",
    "network": "BTC",
    "status": 1,
    "address": "1A1zP1...",
    "addressTag": "",
    "txId": "hash123...",
    "insertTime": 1609459200000,
    "transferType": 0,
    "confirmTimes": "2/2",
    "unlockConfirm": 2,
    "walletType": 0
}

§Binance API Response Format (Withdrawal)

{
    "id": "def456",
    "amount": "0.3",
    "transactionFee": "0.0005",
    "coin": "BTC",
    "status": 6,
    "address": "1A1zP1...",
    "txId": "hash456...",
    "applyTime": "2021-01-01 00:00:00",
    "network": "BTC",
    "transferType": 0
}