skar_net_types_fuel/
lib.rs

1use std::collections::BTreeSet;
2
3use serde::{Deserialize, Serialize};
4use skar_format::{FixedSizeData, Hash};
5
6pub type Sighash = FixedSizeData<4>;
7
8pub mod skar_net_types_capnp {
9    include!(concat!(env!("OUT_DIR"), "/skar_net_types_capnp.rs"));
10}
11
12#[derive(Default, Serialize, Deserialize, Clone, Debug)]
13pub struct ReceiptSelection {
14    #[serde(default)]
15    pub root_contract_id: Vec<Hash>,
16    #[serde(default)]
17    pub to_address: Vec<Hash>,
18    #[serde(default)]
19    pub asset_id: Vec<Hash>,
20    #[serde(default)]
21    pub receipt_type: Vec<u8>,
22    #[serde(default)]
23    pub sender: Vec<Hash>,
24    #[serde(default)]
25    pub recipient: Vec<Hash>,
26    #[serde(default)]
27    pub contract_id: Vec<Hash>,
28    #[serde(default)]
29    pub ra: Vec<u64>,
30    #[serde(default)]
31    pub rb: Vec<u64>,
32    #[serde(default)]
33    pub rc: Vec<u64>,
34    #[serde(default)]
35    pub rd: Vec<u64>,
36}
37
38#[derive(Default, Serialize, Deserialize, Clone, Debug)]
39pub struct InputSelection {
40    #[serde(default)]
41    pub owner: Vec<Hash>,
42    #[serde(default)]
43    pub asset_id: Vec<Hash>,
44    #[serde(default)]
45    pub contract: Vec<Hash>,
46    #[serde(default)]
47    pub sender: Vec<Hash>,
48    #[serde(default)]
49    pub recipient: Vec<Hash>,
50    #[serde(default)]
51    pub input_type: Vec<u8>,
52}
53
54#[derive(Default, Serialize, Deserialize, Clone, Debug)]
55pub struct OutputSelection {
56    #[serde(default)]
57    pub to: Vec<Hash>,
58    #[serde(default)]
59    pub asset_id: Vec<Hash>,
60    #[serde(default)]
61    pub contract: Vec<Hash>,
62    #[serde(default)]
63    pub output_type: Vec<u8>,
64}
65
66#[derive(Default, Serialize, Deserialize, Clone, Debug)]
67pub struct Query {
68    /// The block to start the query from
69    pub from_block: u64,
70    /// The block to end the query at. If not specified, the query will go until the
71    ///  end of data. Exclusive, the returned range will be [from_block..to_block).
72    ///
73    /// The query will return before it reaches this target block if it hits the time limit
74    ///  configured on the server. The user should continue their query by putting the
75    ///  next_block field in the response into from_block field of their next query. This implements
76    ///  pagination.
77    pub to_block: Option<u64>,
78    /// List of receipt selections, the query will return receipts that match any of these selections and
79    ///  it will return receipts that are related to the returned objects.
80    #[serde(default)]
81    pub receipts: Vec<ReceiptSelection>,
82    /// List of input selections, the query will return inputs that match any of these selections and
83    ///  it will return inputs that are related to the returned objects.
84    #[serde(default)]
85    pub inputs: Vec<InputSelection>,
86    /// List of output selections, the query will return outputs that match any of these selections and
87    ///  it will return outputs that are related to the returned objects.
88    #[serde(default)]
89    pub outputs: Vec<OutputSelection>,
90    /// Weather to include all blocks regardless of if they are related to a returned transaction or log. Normally
91    ///  the server will return only the blocks that are related to the transaction or logs in the response. But if this
92    ///  is set to true, the server will return data for all blocks in the requested range [from_block, to_block).
93    #[serde(default)]
94    pub include_all_blocks: bool,
95    /// Field selection. The user can select which fields they are interested in, requesting less fields will improve
96    ///  query execution time and reduce the payload size so the user should always use a minimal number of fields.
97    #[serde(default)]
98    pub field_selection: FieldSelection,
99    /// Maximum number of blocks that should be returned, the server might return more blocks than this number but
100    ///  it won't overshoot by too much.
101    #[serde(default)]
102    pub max_num_blocks: Option<usize>,
103    /// Maximum number of transactions that should be returned, the server might return more transactions than this number but
104    ///  it won't overshoot by too much.
105    #[serde(default)]
106    pub max_num_transactions: Option<usize>,
107}
108
109#[derive(Default, Serialize, Deserialize, Clone, Debug)]
110pub struct FieldSelection {
111    #[serde(default)]
112    pub block: BTreeSet<String>,
113    #[serde(default)]
114    pub transaction: BTreeSet<String>,
115    #[serde(default)]
116    pub receipt: BTreeSet<String>,
117    #[serde(default)]
118    pub input: BTreeSet<String>,
119    #[serde(default)]
120    pub output: BTreeSet<String>,
121}
122
123#[derive(Clone, Copy, Deserialize, Serialize, Debug)]
124pub struct ArchiveHeight {
125    pub height: Option<u64>,
126}