thru_base/
rpc_types.rs

1use serde::{Deserialize, Serialize};
2
3/// Data slice configuration for account queries
4#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
5pub struct DataSlice {
6    /// Offset from start of account data
7    pub offset: usize,
8    /// Number of bytes to return
9    pub length: usize,
10}
11
12/// Filter types for getProgramAccounts
13#[derive(Debug, Serialize, Eq, Deserialize, Clone, PartialEq)]
14#[serde(untagged)]
15pub enum ProgramAccountFilter {
16    /// Filter by account data size
17    DataSize {
18        #[serde(rename = "dataSize")]
19        /// data size
20        data_size: u64,
21    },
22    /// Filter by memory comparison
23    Memcmp {
24        /// memory comparison filter
25        memcmp: MemcmpFilter,
26    },
27}
28
29/// Memory comparison filter
30#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)]
31pub struct MemcmpFilter {
32    /// Offset in the account data
33    pub offset: usize,
34    /// Base64-encoded bytes to match
35    pub bytes: String,
36}
37
38/// Configuration for getProgramAccounts operations
39#[derive(Debug, Serialize, Deserialize, Clone)]
40pub struct GetProgramAccountsConfig {
41    /// Whether to skip data
42    #[serde(rename = "skipData", skip_serializing_if = "Option::is_none")]
43    pub skip_data: Option<bool>,
44    /// The data slice
45    #[serde(rename = "dataSlice", skip_serializing_if = "Option::is_none")]
46    pub data_slice: Option<DataSlice>,
47    /// Filters to apply
48    #[serde(skip_serializing_if = "Option::is_none")]
49    pub filters: Option<Vec<ProgramAccountFilter>>,
50}
51
52/// Proof type for makeStateProof operations
53#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)]
54#[serde(rename_all = "lowercase")]
55pub enum ProofType {
56    /// Create a state proof for a new account
57    Creating,
58    /// Create a state proof for an account update
59    Updating,
60    /// Create a state proof for account uncompression
61    Existing,
62}
63
64/// Configuration for makeStateProof operations
65#[derive(Debug, Serialize, Deserialize, Clone)]
66pub struct MakeStateProofConfig {
67    /// Type of proof to create
68    pub proof_type: ProofType,
69    /// Optional slot to create the proof for
70    #[serde(skip_serializing_if = "Option::is_none")]
71    pub slot: Option<u64>,
72}