1use serde::Serialize;
2
3#[derive(Debug, Clone, Default, Serialize)]
8pub struct CurrencyRequest<'a> {
9 #[serde(skip_serializing_if = "Option::is_none")]
11 pub ccy: Option<&'a str>,
12}
13
14#[derive(Debug, Clone, Serialize)]
16pub struct DepositAddressRequest<'a> {
17 pub ccy: &'a str,
19}
20
21#[derive(Debug, Clone, Serialize)]
23pub struct TransferStateRequest<'a> {
24 #[serde(rename = "transId")]
26 pub trans_id: &'a str,
27 #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
29 pub transfer_type: Option<&'a str>,
30}
31
32#[derive(Debug, Clone, Serialize)]
34pub struct CancelWithdrawalRequest<'a> {
35 #[serde(rename = "wdId")]
37 pub wd_id: &'a str,
38}
39
40#[derive(Debug, Clone, Serialize)]
42#[serde(rename_all = "camelCase")]
43pub struct FundsTransferRequest {
44 ccy: String,
45 amt: String,
46 #[serde(rename = "from")]
47 from_account: String,
48 to: String,
49 #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
50 transfer_type: Option<String>,
51 #[serde(rename = "subAcct", skip_serializing_if = "Option::is_none")]
52 sub_account: Option<String>,
53 #[serde(rename = "instId", skip_serializing_if = "Option::is_none")]
54 inst_id: Option<String>,
55 #[serde(rename = "toInstId", skip_serializing_if = "Option::is_none")]
56 to_inst_id: Option<String>,
57 #[serde(rename = "loanTrans", skip_serializing_if = "Option::is_none")]
58 loan_transfer: Option<String>,
59}
60
61impl FundsTransferRequest {
62 pub fn new(
64 ccy: impl Into<String>,
65 amt: impl Into<String>,
66 from_account: impl Into<String>,
67 to: impl Into<String>,
68 ) -> Self {
69 Self {
70 ccy: ccy.into(),
71 amt: amt.into(),
72 from_account: from_account.into(),
73 to: to.into(),
74 transfer_type: None,
75 sub_account: None,
76 inst_id: None,
77 to_inst_id: None,
78 loan_transfer: None,
79 }
80 }
81
82 pub fn transfer_type(mut self, transfer_type: impl Into<String>) -> Self {
84 self.transfer_type = Some(transfer_type.into());
85 self
86 }
87
88 pub fn sub_account(mut self, sub_account: impl Into<String>) -> Self {
90 self.sub_account = Some(sub_account.into());
91 self
92 }
93
94 pub fn inst_id(mut self, inst_id: impl Into<String>) -> Self {
96 self.inst_id = Some(inst_id.into());
97 self
98 }
99
100 pub fn to_inst_id(mut self, to_inst_id: impl Into<String>) -> Self {
102 self.to_inst_id = Some(to_inst_id.into());
103 self
104 }
105
106 pub fn loan_transfer(mut self, loan_transfer: impl Into<String>) -> Self {
108 self.loan_transfer = Some(loan_transfer.into());
109 self
110 }
111}
112
113#[derive(Debug, Clone, Serialize)]
115#[serde(rename_all = "camelCase")]
116pub struct WithdrawalRequest {
117 ccy: String,
118 amt: String,
119 dest: String,
120 #[serde(rename = "toAddr")]
121 to_addr: String,
122 #[serde(skip_serializing_if = "Option::is_none")]
123 chain: Option<String>,
124 #[serde(rename = "areaCode", skip_serializing_if = "Option::is_none")]
125 area_code: Option<String>,
126 #[serde(rename = "clientId", skip_serializing_if = "Option::is_none")]
127 client_id: Option<String>,
128 #[serde(rename = "toAddrType", skip_serializing_if = "Option::is_none")]
129 to_addr_type: Option<String>,
130}
131
132impl WithdrawalRequest {
133 pub fn new(
135 ccy: impl Into<String>,
136 amt: impl Into<String>,
137 dest: impl Into<String>,
138 to_addr: impl Into<String>,
139 ) -> Self {
140 Self {
141 ccy: ccy.into(),
142 amt: amt.into(),
143 dest: dest.into(),
144 to_addr: to_addr.into(),
145 chain: None,
146 area_code: None,
147 client_id: None,
148 to_addr_type: None,
149 }
150 }
151
152 pub fn chain(mut self, chain: impl Into<String>) -> Self {
154 self.chain = Some(chain.into());
155 self
156 }
157
158 pub fn area_code(mut self, area_code: impl Into<String>) -> Self {
160 self.area_code = Some(area_code.into());
161 self
162 }
163
164 pub fn client_id(mut self, client_id: impl Into<String>) -> Self {
166 self.client_id = Some(client_id.into());
167 self
168 }
169
170 pub fn to_addr_type(mut self, to_addr_type: impl Into<String>) -> Self {
172 self.to_addr_type = Some(to_addr_type.into());
173 self
174 }
175}
176
177#[derive(Debug, Clone, Default, Serialize)]
179#[serde(rename_all = "camelCase")]
180pub struct DepositHistoryRequest {
181 #[serde(skip_serializing_if = "Option::is_none")]
182 ccy: Option<String>,
183 #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
184 deposit_type: Option<String>,
185 #[serde(skip_serializing_if = "Option::is_none")]
186 state: Option<String>,
187 #[serde(skip_serializing_if = "Option::is_none")]
188 after: Option<String>,
189 #[serde(skip_serializing_if = "Option::is_none")]
190 before: Option<String>,
191 #[serde(skip_serializing_if = "Option::is_none")]
192 limit: Option<u32>,
193 #[serde(rename = "txId", skip_serializing_if = "Option::is_none")]
194 tx_id: Option<String>,
195 #[serde(rename = "depId", skip_serializing_if = "Option::is_none")]
196 dep_id: Option<String>,
197 #[serde(rename = "fromWdId", skip_serializing_if = "Option::is_none")]
198 from_wd_id: Option<String>,
199}
200
201impl DepositHistoryRequest {
202 pub fn new() -> Self {
204 Self::default()
205 }
206
207 pub fn currency(mut self, ccy: impl Into<String>) -> Self {
209 self.ccy = Some(ccy.into());
210 self
211 }
212
213 pub fn deposit_type(mut self, deposit_type: impl Into<String>) -> Self {
215 self.deposit_type = Some(deposit_type.into());
216 self
217 }
218
219 pub fn state(mut self, state: impl Into<String>) -> Self {
221 self.state = Some(state.into());
222 self
223 }
224
225 pub fn after(mut self, after: impl Into<String>) -> Self {
227 self.after = Some(after.into());
228 self
229 }
230
231 pub fn before(mut self, before: impl Into<String>) -> Self {
233 self.before = Some(before.into());
234 self
235 }
236
237 pub fn limit(mut self, limit: u32) -> Self {
239 self.limit = Some(limit);
240 self
241 }
242
243 pub fn tx_id(mut self, tx_id: impl Into<String>) -> Self {
245 self.tx_id = Some(tx_id.into());
246 self
247 }
248
249 pub fn dep_id(mut self, dep_id: impl Into<String>) -> Self {
251 self.dep_id = Some(dep_id.into());
252 self
253 }
254
255 pub fn from_wd_id(mut self, from_wd_id: impl Into<String>) -> Self {
257 self.from_wd_id = Some(from_wd_id.into());
258 self
259 }
260}
261
262#[derive(Debug, Clone, Default, Serialize)]
264#[serde(rename_all = "camelCase")]
265pub struct WithdrawalHistoryRequest {
266 #[serde(skip_serializing_if = "Option::is_none")]
267 ccy: Option<String>,
268 #[serde(rename = "wdId", skip_serializing_if = "Option::is_none")]
269 wd_id: Option<String>,
270 #[serde(rename = "clientId", skip_serializing_if = "Option::is_none")]
271 client_id: Option<String>,
272 #[serde(rename = "txId", skip_serializing_if = "Option::is_none")]
273 tx_id: Option<String>,
274 #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
275 withdrawal_type: Option<String>,
276 #[serde(skip_serializing_if = "Option::is_none")]
277 state: Option<String>,
278 #[serde(skip_serializing_if = "Option::is_none")]
279 after: Option<String>,
280 #[serde(skip_serializing_if = "Option::is_none")]
281 before: Option<String>,
282 #[serde(skip_serializing_if = "Option::is_none")]
283 limit: Option<u32>,
284 #[serde(rename = "toAddrType", skip_serializing_if = "Option::is_none")]
285 to_addr_type: Option<String>,
286}
287
288impl WithdrawalHistoryRequest {
289 pub fn new() -> Self {
291 Self::default()
292 }
293
294 pub fn currency(mut self, ccy: impl Into<String>) -> Self {
296 self.ccy = Some(ccy.into());
297 self
298 }
299
300 pub fn withdrawal_id(mut self, wd_id: impl Into<String>) -> Self {
302 self.wd_id = Some(wd_id.into());
303 self
304 }
305
306 pub fn client_id(mut self, client_id: impl Into<String>) -> Self {
308 self.client_id = Some(client_id.into());
309 self
310 }
311
312 pub fn tx_id(mut self, tx_id: impl Into<String>) -> Self {
314 self.tx_id = Some(tx_id.into());
315 self
316 }
317
318 pub fn withdrawal_type(mut self, withdrawal_type: impl Into<String>) -> Self {
320 self.withdrawal_type = Some(withdrawal_type.into());
321 self
322 }
323
324 pub fn state(mut self, state: impl Into<String>) -> Self {
326 self.state = Some(state.into());
327 self
328 }
329
330 pub fn after(mut self, after: impl Into<String>) -> Self {
332 self.after = Some(after.into());
333 self
334 }
335
336 pub fn before(mut self, before: impl Into<String>) -> Self {
338 self.before = Some(before.into());
339 self
340 }
341
342 pub fn limit(mut self, limit: u32) -> Self {
344 self.limit = Some(limit);
345 self
346 }
347
348 pub fn to_addr_type(mut self, to_addr_type: impl Into<String>) -> Self {
350 self.to_addr_type = Some(to_addr_type.into());
351 self
352 }
353}
354
355#[derive(Debug, Clone, Default, Serialize)]
357pub struct FundingBillsRequest {
358 #[serde(skip_serializing_if = "Option::is_none")]
359 ccy: Option<String>,
360 #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
361 bill_type: Option<String>,
362 #[serde(skip_serializing_if = "Option::is_none")]
363 after: Option<String>,
364 #[serde(skip_serializing_if = "Option::is_none")]
365 before: Option<String>,
366 #[serde(skip_serializing_if = "Option::is_none")]
367 limit: Option<u32>,
368}
369
370impl FundingBillsRequest {
371 pub fn new() -> Self {
373 Self::default()
374 }
375
376 pub fn currency(mut self, ccy: impl Into<String>) -> Self {
378 self.ccy = Some(ccy.into());
379 self
380 }
381
382 pub fn bill_type(mut self, bill_type: impl Into<String>) -> Self {
384 self.bill_type = Some(bill_type.into());
385 self
386 }
387
388 pub fn after(mut self, after: impl Into<String>) -> Self {
390 self.after = Some(after.into());
391 self
392 }
393
394 pub fn before(mut self, before: impl Into<String>) -> Self {
396 self.before = Some(before.into());
397 self
398 }
399
400 pub fn limit(mut self, limit: u32) -> Self {
402 self.limit = Some(limit);
403 self
404 }
405}
406
407#[derive(Debug, Clone, Serialize)]
409pub struct DepositLightningRequest {
410 ccy: String,
411 amt: String,
412 #[serde(skip_serializing_if = "Option::is_none")]
413 to: Option<String>,
414}
415
416impl DepositLightningRequest {
417 pub fn new(ccy: impl Into<String>, amt: impl Into<String>) -> Self {
419 Self {
420 ccy: ccy.into(),
421 amt: amt.into(),
422 to: None,
423 }
424 }
425
426 pub fn to(mut self, to: impl Into<String>) -> Self {
428 self.to = Some(to.into());
429 self
430 }
431}
432
433#[derive(Debug, Clone, Serialize)]
435pub struct WithdrawalLightningRequest {
436 ccy: String,
437 invoice: String,
438 #[serde(skip_serializing_if = "Option::is_none")]
439 memo: Option<String>,
440}
441
442impl WithdrawalLightningRequest {
443 pub fn new(ccy: impl Into<String>, invoice: impl Into<String>) -> Self {
445 Self {
446 ccy: ccy.into(),
447 invoice: invoice.into(),
448 memo: None,
449 }
450 }
451
452 pub fn memo(mut self, memo: impl Into<String>) -> Self {
454 self.memo = Some(memo.into());
455 self
456 }
457}
458
459#[derive(Debug, Clone, Default, Serialize)]
461#[serde(rename_all = "camelCase")]
462pub struct DepositWithdrawStatusRequest {
463 #[serde(rename = "wdId", skip_serializing_if = "Option::is_none")]
464 wd_id: Option<String>,
465 #[serde(rename = "txId", skip_serializing_if = "Option::is_none")]
466 tx_id: Option<String>,
467 #[serde(skip_serializing_if = "Option::is_none")]
468 ccy: Option<String>,
469 #[serde(skip_serializing_if = "Option::is_none")]
470 to: Option<String>,
471 #[serde(skip_serializing_if = "Option::is_none")]
472 chain: Option<String>,
473}
474
475impl DepositWithdrawStatusRequest {
476 pub fn new() -> Self {
478 Self::default()
479 }
480
481 pub fn withdrawal_id(mut self, wd_id: impl Into<String>) -> Self {
483 self.wd_id = Some(wd_id.into());
484 self
485 }
486
487 pub fn tx_id(mut self, tx_id: impl Into<String>) -> Self {
489 self.tx_id = Some(tx_id.into());
490 self
491 }
492
493 pub fn currency(mut self, ccy: impl Into<String>) -> Self {
495 self.ccy = Some(ccy.into());
496 self
497 }
498
499 pub fn to(mut self, to: impl Into<String>) -> Self {
501 self.to = Some(to.into());
502 self
503 }
504
505 pub fn chain(mut self, chain: impl Into<String>) -> Self {
507 self.chain = Some(chain.into());
508 self
509 }
510}