100 lines
4.9 KiB
Rust
100 lines
4.9 KiB
Rust
// file: crates/ksp-app-store-desk/src/dto_transaction.rs
|
|
// version: 1
|
|
|
|
//! Application-owned DTOs for RAW transaction inspection and detail commands.
|
|
|
|
use ts_rs::TS; // rust-rules: trait-import
|
|
|
|
/// Bounded Store-owned query request projected from one DataTables page request.
|
|
#[derive(Debug, serde::Deserialize, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export, export_to = "../frontend/ts/bindings/ksp_app_store_desk/dto_transaction/StoreTransactionQueryRequestDto.ts")]
|
|
pub(crate) struct StoreTransactionQueryRequestDto {
|
|
/// Stable Store sort direction code (`ascending` or `descending`).
|
|
pub(crate) direction: String,
|
|
/// Absolute zero-based inspection offset encoded as exact decimal text.
|
|
pub(crate) offset: String,
|
|
/// Whitelisted page size (`25`, `50`, or `100`).
|
|
pub(crate) limit: u32,
|
|
/// Optional inclusive maximum slot encoded as decimal text.
|
|
pub(crate) slot_max: std::option::Option<String>,
|
|
/// Optional inclusive minimum slot encoded as decimal text.
|
|
pub(crate) slot_min: std::option::Option<String>,
|
|
}
|
|
|
|
/// Payload-free RAW transaction row returned to the server-side DataTables adapter.
|
|
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export, export_to = "../frontend/ts/bindings/ksp_app_store_desk/dto_transaction/StoreTransactionRowDto.ts")]
|
|
pub(crate) struct StoreTransactionRowDto {
|
|
/// Optional canonical block timestamp encoded as exact Unix-millisecond decimal text.
|
|
pub(crate) block_time_unix_millis_decimal: std::option::Option<String>,
|
|
/// Canonical transaction content hash encoded as lower-case hexadecimal text.
|
|
pub(crate) content_hash: String,
|
|
/// KSP-owned RAW format identifier.
|
|
pub(crate) format_id: String,
|
|
/// KSP-owned RAW format version, safely representable in JavaScript.
|
|
pub(crate) format_version: u32,
|
|
/// Logical payload size encoded as exact decimal text while payload remains retained.
|
|
pub(crate) payload_size_decimal: std::option::Option<String>,
|
|
/// Stable logical retention-state code.
|
|
pub(crate) retention_state: String,
|
|
/// Canonical 64-byte transaction signature encoded as lower-case hexadecimal text.
|
|
pub(crate) signature: String,
|
|
/// Solana slot encoded as exact decimal text.
|
|
pub(crate) slot_decimal: String,
|
|
}
|
|
|
|
/// Server-side transaction table result using exact decimal counts.
|
|
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export, export_to = "../frontend/ts/bindings/ksp_app_store_desk/dto_transaction/StoreTransactionQueryResponseDto.ts")]
|
|
pub(crate) struct StoreTransactionQueryResponseDto {
|
|
/// Exact count after optional Store filters.
|
|
pub(crate) records_filtered_decimal: String,
|
|
/// Exact count in the mandatory Store network scope before optional filters.
|
|
pub(crate) records_total_decimal: String,
|
|
/// Payload-free inspection rows for the requested random-access page.
|
|
pub(crate) rows: std::vec::Vec<crate::StoreTransactionRowDto>,
|
|
}
|
|
|
|
/// App-owned identity request for one explicit RAW transaction detail load.
|
|
#[derive(Debug, serde::Deserialize, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export, export_to = "../frontend/ts/bindings/ksp_app_store_desk/dto_transaction/StoreTransactionDetailRequestDto.ts")]
|
|
pub(crate) struct StoreTransactionDetailRequestDto {
|
|
/// Canonical 64-byte transaction signature encoded as lower-case hexadecimal text.
|
|
pub(crate) signature: String,
|
|
}
|
|
|
|
/// Bounded detail projection for one RAW transaction.
|
|
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export, export_to = "../frontend/ts/bindings/ksp_app_store_desk/dto_transaction/StoreTransactionDetailDto.ts")]
|
|
pub(crate) struct StoreTransactionDetailDto {
|
|
/// Optional canonical block timestamp encoded as exact Unix-millisecond decimal text.
|
|
pub(crate) block_time_unix_millis_decimal: std::option::Option<String>,
|
|
/// Canonical content hash encoded as lower-case hexadecimal text.
|
|
pub(crate) content_hash: String,
|
|
/// KSP-owned RAW format identifier.
|
|
pub(crate) format_id: String,
|
|
/// KSP-owned RAW format version.
|
|
pub(crate) format_version: u32,
|
|
/// Bounded lower-case hexadecimal preview of the canonical RAW payload, when retained.
|
|
pub(crate) payload_preview_hex: std::option::Option<String>,
|
|
/// Whether the canonical payload is larger than the returned preview.
|
|
pub(crate) payload_preview_truncated: bool,
|
|
/// Exact canonical payload size while retained.
|
|
pub(crate) payload_size_decimal: std::option::Option<String>,
|
|
/// Stable logical retention-state code.
|
|
pub(crate) retention_state: String,
|
|
/// Canonical transaction signature encoded as lower-case hexadecimal text.
|
|
pub(crate) signature: String,
|
|
/// Solana slot encoded as exact decimal text.
|
|
pub(crate) slot_decimal: String,
|
|
}
|
|
|
|
#[cfg(test)]
|
|
#[path = "../unit_tests/dto_transaction.rs"]
|
|
mod tests;
|