nautilus_common/messages/defi/
subscribe.rs1use alloy_primitives::Address;
17use indexmap::IndexMap;
18use nautilus_core::{UUID4, UnixNanos};
19use nautilus_model::{defi::chain::Blockchain, identifiers::ClientId};
20
21#[derive(Debug, Clone)]
22pub struct SubscribeBlocks {
23 pub chain: Blockchain,
24 pub client_id: Option<ClientId>,
25 pub command_id: UUID4,
26 pub ts_init: UnixNanos,
27 pub params: Option<IndexMap<String, String>>,
28}
29
30impl SubscribeBlocks {
31 #[must_use]
33 pub const fn new(
34 chain: Blockchain,
35 client_id: Option<ClientId>,
36 command_id: UUID4,
37 ts_init: UnixNanos,
38 params: Option<IndexMap<String, String>>,
39 ) -> Self {
40 Self {
41 chain,
42 client_id,
43 command_id,
44 ts_init,
45 params,
46 }
47 }
48}
49
50#[derive(Debug, Clone)]
52pub struct SubscribePool {
53 pub address: Address,
54 pub client_id: Option<ClientId>,
55 pub command_id: UUID4,
56 pub ts_init: UnixNanos,
57 pub params: Option<IndexMap<String, String>>,
58}
59
60impl SubscribePool {
61 #[must_use]
63 pub const fn new(
64 address: Address,
65 client_id: Option<ClientId>,
66 command_id: UUID4,
67 ts_init: UnixNanos,
68 params: Option<IndexMap<String, String>>,
69 ) -> Self {
70 Self {
71 address,
72 client_id,
73 command_id,
74 ts_init,
75 params,
76 }
77 }
78}
79
80#[derive(Debug, Clone)]
81pub struct SubscribePoolSwaps {
82 pub address: Address,
83 pub client_id: Option<ClientId>,
84 pub command_id: UUID4,
85 pub ts_init: UnixNanos,
86 pub params: Option<IndexMap<String, String>>,
87}
88
89impl SubscribePoolSwaps {
90 #[must_use]
92 pub const fn new(
93 address: Address,
94 client_id: Option<ClientId>,
95 command_id: UUID4,
96 ts_init: UnixNanos,
97
98 params: Option<IndexMap<String, String>>,
99 ) -> Self {
100 Self {
101 address,
102 client_id,
103 command_id,
104 ts_init,
105 params,
106 }
107 }
108}
109
110#[derive(Debug, Clone)]
112pub struct SubscribePoolLiquidityUpdates {
113 pub address: Address,
114 pub client_id: Option<ClientId>,
115 pub command_id: UUID4,
116 pub ts_init: UnixNanos,
117 pub params: Option<IndexMap<String, String>>,
118}
119
120impl SubscribePoolLiquidityUpdates {
121 #[must_use]
123 pub const fn new(
124 address: Address,
125 client_id: Option<ClientId>,
126 command_id: UUID4,
127 ts_init: UnixNanos,
128 params: Option<IndexMap<String, String>>,
129 ) -> Self {
130 Self {
131 address,
132 client_id,
133 command_id,
134 ts_init,
135 params,
136 }
137 }
138}