NAC_Blockchain/nac_wallet_service/src/models/transaction.rs

54 lines
1.4 KiB
Rust
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

use serde::{Deserialize, Serialize};
use chrono::{DateTime, Utc};
/// 交易签名请求
#[derive(Debug, Deserialize)]
pub struct SignTransactionRequest {
pub user_id: i64,
/// 链标识: nac | ethereum | bsc | tron
pub chain: String,
/// 待签名的交易数据Base64编码
pub unsigned_tx: String,
/// 用于解密助记词的密码
pub decryption_password: String,
/// 内部API密钥
pub internal_api_key: String,
}
/// 交易签名响应
#[derive(Debug, Serialize)]
pub struct SignTransactionResponse {
/// 已签名的交易数据Base64编码
pub signed_tx: String,
/// 交易哈希NAC链: 48字节SHA3-384, 其他链: 32字节
pub tx_hash: String,
}
/// 转账请求
#[derive(Debug, Deserialize)]
pub struct TransferRequest {
pub user_id: i64,
pub chain: String,
pub to_address: String,
pub amount: f64,
pub asset_symbol: String,
pub decryption_password: String,
pub internal_api_key: String,
}
/// 交易历史记录
#[derive(Debug, Serialize)]
pub struct TransactionRecord {
pub id: i64,
pub tx_hash: Option<String>,
pub tx_type: String,
pub from_address: String,
pub to_address: String,
pub amount: String,
pub asset_symbol: String,
pub fee_amount: String,
pub fee_currency: String,
pub status: String,
pub created_at: DateTime<Utc>,
}