You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

121 lines
2.9 KiB
Rust

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct RPCParams {
pub hash: Option<String>,
pub txs_hashes: Option<Vec<String>>,
pub height: Option<String>
}
impl Default for RPCParams {
fn default() -> RPCParams {
RPCParams {
hash: None,
txs_hashes: None,
height: None
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct GetTransactionPool {
pub credits: u32,
pub spent_key_images: Option<Vec<SpentKeyImages>>,
pub status: String,
pub top_hash: String,
pub transactions: Option<Vec<Transaction>>
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct SpentKeyImages {
pub id_hash: String,
pub txs_hashes: Vec<String>
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Transaction {
pub blob_size: u32,
pub do_not_relay: bool,
pub double_spend_seen: bool,
pub fee: u64,
pub id_hash: String,
pub kept_by_block: bool,
pub last_failed_height: u32,
pub last_failed_id_hash: String,
pub last_relayed_time: i64,
pub max_used_block_height: u32,
pub max_used_block_id_hash: String,
pub receive_time: i64,
pub relayed: bool,
pub tx_blob: String,
pub tx_json: String,
pub tx_json_full: Option<TransactionJSON>,
pub weight: u32
}
impl Transaction {
pub fn process(&mut self) {
self.tx_json_full = Some(serde_json::from_str(&self.tx_json).unwrap())
}
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct TransactionJSON {
pub version: u32,
pub unlock_time: u64,
pub vin: Option<Vec<TransactionInputs>>,
pub vout: Vec<TransactionOutputs>,
pub extra: Vec<u32>,
pub rct_signatures: Option<RingSignatures>
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct TransactionInputs {
pub key: Option<PreviousTransactionKey>
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct PreviousTransactionKey {
pub amount: u64,
pub key_offsets: Vec<u32>,
pub k_image: String
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct TransactionOutputs {
pub amount: u64,
pub target: OutputStealthAddress
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct OutputStealthAddress {
pub key: Option<String>
}
#[allow(non_snake_case)]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct RingSignatures {
pub r#type: u32,
pub txnFee: Option<u64>,
pub outPk: Option<Vec<String>>
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct QRData {
pub tx_amount: String,
pub tx_description: String,
pub recipient_name: String,
pub tx_payment_id: String
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct CheckTxKeyResponse {
pub jsonrpc: String,
pub id: u32,
pub result: Option<CheckTxKeyResult>
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct CheckTxKeyResult {
pub confirmations: u32,
pub in_pool: bool,
pub received: u64,
}