1use std::borrow::Cow;
2
3use serde::Serialize;
4
5#[derive(Debug, Clone, Default, Serialize)]
10pub struct CurrencyRequest<'a> {
11 #[serde(skip_serializing_if = "Option::is_none")]
12 ccy: Option<Cow<'a, str>>,
13}
14
15impl<'a> CurrencyRequest<'a> {
16 pub fn new() -> Self {
18 Self::default()
19 }
20
21 pub fn currency(mut self, ccy: impl Into<Cow<'a, str>>) -> Self {
23 self.ccy = Some(ccy.into());
24 self
25 }
26}
27
28#[derive(Debug, Clone, Serialize)]
30pub struct DepositAddressRequest<'a> {
31 ccy: Cow<'a, str>,
32}
33
34impl<'a> DepositAddressRequest<'a> {
35 pub fn new(ccy: impl Into<Cow<'a, str>>) -> Self {
37 Self { ccy: ccy.into() }
38 }
39}
40
41#[derive(Debug, Clone, Serialize)]
43pub struct TransferStateRequest<'a> {
44 #[serde(rename = "transId", skip_serializing_if = "Option::is_none")]
45 trans_id: Option<Cow<'a, str>>,
46 #[serde(rename = "clientId", skip_serializing_if = "Option::is_none")]
47 client_id: Option<Cow<'a, str>>,
48 #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
49 transfer_type: Option<Cow<'a, str>>,
50}
51
52impl<'a> TransferStateRequest<'a> {
53 pub fn new(trans_id: impl Into<Cow<'a, str>>) -> Self {
55 Self {
56 trans_id: Some(trans_id.into()),
57 client_id: None,
58 transfer_type: None,
59 }
60 }
61
62 pub fn with_client_id(client_id: impl Into<Cow<'a, str>>) -> Self {
64 Self {
65 trans_id: None,
66 client_id: Some(client_id.into()),
67 transfer_type: None,
68 }
69 }
70
71 pub fn client_id(mut self, client_id: impl Into<Cow<'a, str>>) -> Self {
73 self.client_id = Some(client_id.into());
74 self
75 }
76
77 pub fn transfer_type(mut self, transfer_type: impl Into<Cow<'a, str>>) -> Self {
79 self.transfer_type = Some(transfer_type.into());
80 self
81 }
82}
83
84#[derive(Debug, Clone, Serialize)]
86pub struct CancelWithdrawalRequest<'a> {
87 #[serde(rename = "wdId")]
88 wd_id: Cow<'a, str>,
89}
90
91impl<'a> CancelWithdrawalRequest<'a> {
92 pub fn new(wd_id: impl Into<Cow<'a, str>>) -> Self {
94 Self {
95 wd_id: wd_id.into(),
96 }
97 }
98}
99
100#[derive(Debug, Clone, Serialize)]
102#[serde(rename_all = "camelCase")]
103pub struct FundsTransferRequest<'a> {
104 ccy: Cow<'a, str>,
105 amt: Cow<'a, str>,
106 #[serde(rename = "from")]
107 from_account: Cow<'a, str>,
108 to: Cow<'a, str>,
109 #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
110 transfer_type: Option<Cow<'a, str>>,
111 #[serde(rename = "subAcct", skip_serializing_if = "Option::is_none")]
112 sub_account: Option<Cow<'a, str>>,
113 #[serde(rename = "loanTrans", skip_serializing_if = "Option::is_none")]
114 loan_transfer: Option<Cow<'a, str>>,
115 #[serde(rename = "omitPosRisk", skip_serializing_if = "Option::is_none")]
116 omit_pos_risk: Option<Cow<'a, str>>,
117 #[serde(rename = "clientId", skip_serializing_if = "Option::is_none")]
118 client_id: Option<Cow<'a, str>>,
119}
120
121impl<'a> FundsTransferRequest<'a> {
122 pub fn new(
124 ccy: impl Into<Cow<'a, str>>,
125 amt: impl Into<Cow<'a, str>>,
126 from_account: impl Into<Cow<'a, str>>,
127 to: impl Into<Cow<'a, str>>,
128 ) -> Self {
129 Self {
130 ccy: ccy.into(),
131 amt: amt.into(),
132 from_account: from_account.into(),
133 to: to.into(),
134 transfer_type: None,
135 sub_account: None,
136 loan_transfer: None,
137 omit_pos_risk: None,
138 client_id: None,
139 }
140 }
141
142 pub fn transfer_type(mut self, transfer_type: impl Into<Cow<'a, str>>) -> Self {
144 self.transfer_type = Some(transfer_type.into());
145 self
146 }
147
148 pub fn sub_account(mut self, sub_account: impl Into<Cow<'a, str>>) -> Self {
150 self.sub_account = Some(sub_account.into());
151 self
152 }
153
154 pub fn loan_transfer(mut self, loan_transfer: impl Into<Cow<'a, str>>) -> Self {
156 self.loan_transfer = Some(loan_transfer.into());
157 self
158 }
159
160 pub fn omit_pos_risk(mut self, omit_pos_risk: impl Into<Cow<'a, str>>) -> Self {
162 self.omit_pos_risk = Some(omit_pos_risk.into());
163 self
164 }
165
166 pub fn client_id(mut self, client_id: impl Into<Cow<'a, str>>) -> Self {
168 self.client_id = Some(client_id.into());
169 self
170 }
171}
172
173#[derive(Debug, Clone, Serialize)]
175#[serde(rename_all = "camelCase")]
176pub struct WithdrawalRequest<'a> {
177 ccy: Cow<'a, str>,
178 amt: Cow<'a, str>,
179 dest: Cow<'a, str>,
180 #[serde(rename = "toAddr")]
181 to_addr: Cow<'a, str>,
182 #[serde(skip_serializing_if = "Option::is_none")]
183 chain: Option<Cow<'a, str>>,
184 #[serde(rename = "areaCode", skip_serializing_if = "Option::is_none")]
185 area_code: Option<Cow<'a, str>>,
186 #[serde(rename = "clientId", skip_serializing_if = "Option::is_none")]
187 client_id: Option<Cow<'a, str>>,
188 #[serde(rename = "toAddrType", skip_serializing_if = "Option::is_none")]
189 to_addr_type: Option<Cow<'a, str>>,
190}
191
192impl<'a> WithdrawalRequest<'a> {
193 pub fn new(
195 ccy: impl Into<Cow<'a, str>>,
196 amt: impl Into<Cow<'a, str>>,
197 dest: impl Into<Cow<'a, str>>,
198 to_addr: impl Into<Cow<'a, str>>,
199 ) -> Self {
200 Self {
201 ccy: ccy.into(),
202 amt: amt.into(),
203 dest: dest.into(),
204 to_addr: to_addr.into(),
205 chain: None,
206 area_code: None,
207 client_id: None,
208 to_addr_type: None,
209 }
210 }
211
212 pub fn chain(mut self, chain: impl Into<Cow<'a, str>>) -> Self {
214 self.chain = Some(chain.into());
215 self
216 }
217
218 pub fn area_code(mut self, area_code: impl Into<Cow<'a, str>>) -> Self {
220 self.area_code = Some(area_code.into());
221 self
222 }
223
224 pub fn client_id(mut self, client_id: impl Into<Cow<'a, str>>) -> Self {
226 self.client_id = Some(client_id.into());
227 self
228 }
229
230 pub fn to_addr_type(mut self, to_addr_type: impl Into<Cow<'a, str>>) -> Self {
232 self.to_addr_type = Some(to_addr_type.into());
233 self
234 }
235}
236
237#[derive(Debug, Clone, Default, Serialize)]
239#[serde(rename_all = "camelCase")]
240pub struct DepositHistoryRequest<'a> {
241 #[serde(skip_serializing_if = "Option::is_none")]
242 ccy: Option<Cow<'a, str>>,
243 #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
244 deposit_type: Option<Cow<'a, str>>,
245 #[serde(skip_serializing_if = "Option::is_none")]
246 state: Option<Cow<'a, str>>,
247 #[serde(skip_serializing_if = "Option::is_none")]
248 after: Option<Cow<'a, str>>,
249 #[serde(skip_serializing_if = "Option::is_none")]
250 before: Option<Cow<'a, str>>,
251 #[serde(skip_serializing_if = "Option::is_none")]
252 limit: Option<u32>,
253 #[serde(rename = "txId", skip_serializing_if = "Option::is_none")]
254 tx_id: Option<Cow<'a, str>>,
255 #[serde(rename = "depId", skip_serializing_if = "Option::is_none")]
256 dep_id: Option<Cow<'a, str>>,
257 #[serde(rename = "fromWdId", skip_serializing_if = "Option::is_none")]
258 from_wd_id: Option<Cow<'a, str>>,
259}
260
261impl<'a> DepositHistoryRequest<'a> {
262 pub fn new() -> Self {
264 Self::default()
265 }
266
267 pub fn currency(mut self, ccy: impl Into<Cow<'a, str>>) -> Self {
269 self.ccy = Some(ccy.into());
270 self
271 }
272
273 pub fn deposit_type(mut self, deposit_type: impl Into<Cow<'a, str>>) -> Self {
275 self.deposit_type = Some(deposit_type.into());
276 self
277 }
278
279 pub fn state(mut self, state: impl Into<Cow<'a, str>>) -> Self {
281 self.state = Some(state.into());
282 self
283 }
284
285 pub fn after(mut self, after: impl Into<Cow<'a, str>>) -> Self {
287 self.after = Some(after.into());
288 self
289 }
290
291 pub fn before(mut self, before: impl Into<Cow<'a, str>>) -> Self {
293 self.before = Some(before.into());
294 self
295 }
296
297 pub fn limit(mut self, limit: u32) -> Self {
299 self.limit = Some(limit);
300 self
301 }
302
303 pub fn tx_id(mut self, tx_id: impl Into<Cow<'a, str>>) -> Self {
305 self.tx_id = Some(tx_id.into());
306 self
307 }
308
309 pub fn dep_id(mut self, dep_id: impl Into<Cow<'a, str>>) -> Self {
311 self.dep_id = Some(dep_id.into());
312 self
313 }
314
315 pub fn from_wd_id(mut self, from_wd_id: impl Into<Cow<'a, str>>) -> Self {
317 self.from_wd_id = Some(from_wd_id.into());
318 self
319 }
320}
321
322#[derive(Debug, Clone, Default, Serialize)]
324#[serde(rename_all = "camelCase")]
325pub struct WithdrawalHistoryRequest<'a> {
326 #[serde(skip_serializing_if = "Option::is_none")]
327 ccy: Option<Cow<'a, str>>,
328 #[serde(rename = "wdId", skip_serializing_if = "Option::is_none")]
329 wd_id: Option<Cow<'a, str>>,
330 #[serde(rename = "clientId", skip_serializing_if = "Option::is_none")]
331 client_id: Option<Cow<'a, str>>,
332 #[serde(rename = "txId", skip_serializing_if = "Option::is_none")]
333 tx_id: Option<Cow<'a, str>>,
334 #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
335 withdrawal_type: Option<Cow<'a, str>>,
336 #[serde(skip_serializing_if = "Option::is_none")]
337 state: Option<Cow<'a, str>>,
338 #[serde(skip_serializing_if = "Option::is_none")]
339 after: Option<Cow<'a, str>>,
340 #[serde(skip_serializing_if = "Option::is_none")]
341 before: Option<Cow<'a, str>>,
342 #[serde(skip_serializing_if = "Option::is_none")]
343 limit: Option<u32>,
344 #[serde(rename = "toAddrType", skip_serializing_if = "Option::is_none")]
345 to_addr_type: Option<Cow<'a, str>>,
346}
347
348impl<'a> WithdrawalHistoryRequest<'a> {
349 pub fn new() -> Self {
351 Self::default()
352 }
353
354 pub fn currency(mut self, ccy: impl Into<Cow<'a, str>>) -> Self {
356 self.ccy = Some(ccy.into());
357 self
358 }
359
360 pub fn withdrawal_id(mut self, wd_id: impl Into<Cow<'a, str>>) -> Self {
362 self.wd_id = Some(wd_id.into());
363 self
364 }
365
366 pub fn client_id(mut self, client_id: impl Into<Cow<'a, str>>) -> Self {
368 self.client_id = Some(client_id.into());
369 self
370 }
371
372 pub fn tx_id(mut self, tx_id: impl Into<Cow<'a, str>>) -> Self {
374 self.tx_id = Some(tx_id.into());
375 self
376 }
377
378 pub fn withdrawal_type(mut self, withdrawal_type: impl Into<Cow<'a, str>>) -> Self {
380 self.withdrawal_type = Some(withdrawal_type.into());
381 self
382 }
383
384 pub fn state(mut self, state: impl Into<Cow<'a, str>>) -> Self {
386 self.state = Some(state.into());
387 self
388 }
389
390 pub fn after(mut self, after: impl Into<Cow<'a, str>>) -> Self {
392 self.after = Some(after.into());
393 self
394 }
395
396 pub fn before(mut self, before: impl Into<Cow<'a, str>>) -> Self {
398 self.before = Some(before.into());
399 self
400 }
401
402 pub fn limit(mut self, limit: u32) -> Self {
404 self.limit = Some(limit);
405 self
406 }
407
408 pub fn to_addr_type(mut self, to_addr_type: impl Into<Cow<'a, str>>) -> Self {
410 self.to_addr_type = Some(to_addr_type.into());
411 self
412 }
413}
414
415#[derive(Debug, Clone, Default, Serialize)]
417pub struct FundingBillsRequest<'a> {
418 #[serde(skip_serializing_if = "Option::is_none")]
419 ccy: Option<Cow<'a, str>>,
420 #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
421 bill_type: Option<Cow<'a, str>>,
422 #[serde(skip_serializing_if = "Option::is_none")]
423 after: Option<Cow<'a, str>>,
424 #[serde(skip_serializing_if = "Option::is_none")]
425 before: Option<Cow<'a, str>>,
426 #[serde(skip_serializing_if = "Option::is_none")]
427 limit: Option<u32>,
428}
429
430impl<'a> FundingBillsRequest<'a> {
431 pub fn new() -> Self {
433 Self::default()
434 }
435
436 pub fn currency(mut self, ccy: impl Into<Cow<'a, str>>) -> Self {
438 self.ccy = Some(ccy.into());
439 self
440 }
441
442 pub fn bill_type(mut self, bill_type: impl Into<Cow<'a, str>>) -> Self {
444 self.bill_type = Some(bill_type.into());
445 self
446 }
447
448 pub fn after(mut self, after: impl Into<Cow<'a, str>>) -> Self {
450 self.after = Some(after.into());
451 self
452 }
453
454 pub fn before(mut self, before: impl Into<Cow<'a, str>>) -> Self {
456 self.before = Some(before.into());
457 self
458 }
459
460 pub fn limit(mut self, limit: u32) -> Self {
462 self.limit = Some(limit);
463 self
464 }
465}
466
467#[derive(Debug, Clone, Serialize)]
469pub struct DepositLightningRequest<'a> {
470 ccy: Cow<'a, str>,
471 amt: Cow<'a, str>,
472 #[serde(skip_serializing_if = "Option::is_none")]
473 to: Option<Cow<'a, str>>,
474}
475
476impl<'a> DepositLightningRequest<'a> {
477 pub fn new(ccy: impl Into<Cow<'a, str>>, amt: impl Into<Cow<'a, str>>) -> Self {
479 Self {
480 ccy: ccy.into(),
481 amt: amt.into(),
482 to: None,
483 }
484 }
485
486 pub fn to(mut self, to: impl Into<Cow<'a, str>>) -> Self {
488 self.to = Some(to.into());
489 self
490 }
491}
492
493#[derive(Debug, Clone, Serialize)]
495pub struct WithdrawalLightningRequest<'a> {
496 ccy: Cow<'a, str>,
497 invoice: Cow<'a, str>,
498 #[serde(skip_serializing_if = "Option::is_none")]
499 memo: Option<Cow<'a, str>>,
500}
501
502impl<'a> WithdrawalLightningRequest<'a> {
503 pub fn new(ccy: impl Into<Cow<'a, str>>, invoice: impl Into<Cow<'a, str>>) -> Self {
505 Self {
506 ccy: ccy.into(),
507 invoice: invoice.into(),
508 memo: None,
509 }
510 }
511
512 pub fn memo(mut self, memo: impl Into<Cow<'a, str>>) -> Self {
514 self.memo = Some(memo.into());
515 self
516 }
517}
518
519#[derive(Debug, Clone, Default, Serialize)]
521#[serde(rename_all = "camelCase")]
522pub struct DepositWithdrawStatusRequest<'a> {
523 #[serde(rename = "wdId", skip_serializing_if = "Option::is_none")]
524 wd_id: Option<Cow<'a, str>>,
525 #[serde(rename = "txId", skip_serializing_if = "Option::is_none")]
526 tx_id: Option<Cow<'a, str>>,
527 #[serde(skip_serializing_if = "Option::is_none")]
528 ccy: Option<Cow<'a, str>>,
529 #[serde(skip_serializing_if = "Option::is_none")]
530 to: Option<Cow<'a, str>>,
531 #[serde(skip_serializing_if = "Option::is_none")]
532 chain: Option<Cow<'a, str>>,
533}
534
535impl<'a> DepositWithdrawStatusRequest<'a> {
536 pub fn new() -> Self {
538 Self::default()
539 }
540
541 pub fn withdrawal_id(mut self, wd_id: impl Into<Cow<'a, str>>) -> Self {
543 self.wd_id = Some(wd_id.into());
544 self
545 }
546
547 pub fn tx_id(mut self, tx_id: impl Into<Cow<'a, str>>) -> Self {
549 self.tx_id = Some(tx_id.into());
550 self
551 }
552
553 pub fn currency(mut self, ccy: impl Into<Cow<'a, str>>) -> Self {
555 self.ccy = Some(ccy.into());
556 self
557 }
558
559 pub fn to(mut self, to: impl Into<Cow<'a, str>>) -> Self {
561 self.to = Some(to.into());
562 self
563 }
564
565 pub fn chain(mut self, chain: impl Into<Cow<'a, str>>) -> Self {
567 self.chain = Some(chain.into());
568 self
569 }
570}