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")]
45 trans_id: Cow<'a, str>,
46 #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
47 transfer_type: Option<Cow<'a, str>>,
48}
49
50impl<'a> TransferStateRequest<'a> {
51 pub fn new(trans_id: impl Into<Cow<'a, str>>) -> Self {
53 Self {
54 trans_id: trans_id.into(),
55 transfer_type: None,
56 }
57 }
58
59 pub fn transfer_type(mut self, transfer_type: impl Into<Cow<'a, str>>) -> Self {
61 self.transfer_type = Some(transfer_type.into());
62 self
63 }
64}
65
66#[derive(Debug, Clone, Serialize)]
68pub struct CancelWithdrawalRequest<'a> {
69 #[serde(rename = "wdId")]
70 wd_id: Cow<'a, str>,
71}
72
73impl<'a> CancelWithdrawalRequest<'a> {
74 pub fn new(wd_id: impl Into<Cow<'a, str>>) -> Self {
76 Self {
77 wd_id: wd_id.into(),
78 }
79 }
80}
81
82#[derive(Debug, Clone, Serialize)]
84#[serde(rename_all = "camelCase")]
85pub struct FundsTransferRequest<'a> {
86 ccy: Cow<'a, str>,
87 amt: Cow<'a, str>,
88 #[serde(rename = "from")]
89 from_account: Cow<'a, str>,
90 to: Cow<'a, str>,
91 #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
92 transfer_type: Option<Cow<'a, str>>,
93 #[serde(rename = "subAcct", skip_serializing_if = "Option::is_none")]
94 sub_account: Option<Cow<'a, str>>,
95 #[serde(rename = "instId", skip_serializing_if = "Option::is_none")]
96 inst_id: Option<Cow<'a, str>>,
97 #[serde(rename = "toInstId", skip_serializing_if = "Option::is_none")]
98 to_inst_id: Option<Cow<'a, str>>,
99 #[serde(rename = "loanTrans", skip_serializing_if = "Option::is_none")]
100 loan_transfer: Option<Cow<'a, str>>,
101}
102
103impl<'a> FundsTransferRequest<'a> {
104 pub fn new(
106 ccy: impl Into<Cow<'a, str>>,
107 amt: impl Into<Cow<'a, str>>,
108 from_account: impl Into<Cow<'a, str>>,
109 to: impl Into<Cow<'a, str>>,
110 ) -> Self {
111 Self {
112 ccy: ccy.into(),
113 amt: amt.into(),
114 from_account: from_account.into(),
115 to: to.into(),
116 transfer_type: None,
117 sub_account: None,
118 inst_id: None,
119 to_inst_id: None,
120 loan_transfer: None,
121 }
122 }
123
124 pub fn transfer_type(mut self, transfer_type: impl Into<Cow<'a, str>>) -> Self {
126 self.transfer_type = Some(transfer_type.into());
127 self
128 }
129
130 pub fn sub_account(mut self, sub_account: impl Into<Cow<'a, str>>) -> Self {
132 self.sub_account = Some(sub_account.into());
133 self
134 }
135
136 pub fn inst_id(mut self, inst_id: impl Into<Cow<'a, str>>) -> Self {
138 self.inst_id = Some(inst_id.into());
139 self
140 }
141
142 pub fn to_inst_id(mut self, to_inst_id: impl Into<Cow<'a, str>>) -> Self {
144 self.to_inst_id = Some(to_inst_id.into());
145 self
146 }
147
148 pub fn loan_transfer(mut self, loan_transfer: impl Into<Cow<'a, str>>) -> Self {
150 self.loan_transfer = Some(loan_transfer.into());
151 self
152 }
153}
154
155#[derive(Debug, Clone, Serialize)]
157#[serde(rename_all = "camelCase")]
158pub struct WithdrawalRequest<'a> {
159 ccy: Cow<'a, str>,
160 amt: Cow<'a, str>,
161 dest: Cow<'a, str>,
162 #[serde(rename = "toAddr")]
163 to_addr: Cow<'a, str>,
164 #[serde(skip_serializing_if = "Option::is_none")]
165 chain: Option<Cow<'a, str>>,
166 #[serde(rename = "areaCode", skip_serializing_if = "Option::is_none")]
167 area_code: Option<Cow<'a, str>>,
168 #[serde(rename = "clientId", skip_serializing_if = "Option::is_none")]
169 client_id: Option<Cow<'a, str>>,
170 #[serde(rename = "toAddrType", skip_serializing_if = "Option::is_none")]
171 to_addr_type: Option<Cow<'a, str>>,
172}
173
174impl<'a> WithdrawalRequest<'a> {
175 pub fn new(
177 ccy: impl Into<Cow<'a, str>>,
178 amt: impl Into<Cow<'a, str>>,
179 dest: impl Into<Cow<'a, str>>,
180 to_addr: impl Into<Cow<'a, str>>,
181 ) -> Self {
182 Self {
183 ccy: ccy.into(),
184 amt: amt.into(),
185 dest: dest.into(),
186 to_addr: to_addr.into(),
187 chain: None,
188 area_code: None,
189 client_id: None,
190 to_addr_type: None,
191 }
192 }
193
194 pub fn chain(mut self, chain: impl Into<Cow<'a, str>>) -> Self {
196 self.chain = Some(chain.into());
197 self
198 }
199
200 pub fn area_code(mut self, area_code: impl Into<Cow<'a, str>>) -> Self {
202 self.area_code = Some(area_code.into());
203 self
204 }
205
206 pub fn client_id(mut self, client_id: impl Into<Cow<'a, str>>) -> Self {
208 self.client_id = Some(client_id.into());
209 self
210 }
211
212 pub fn to_addr_type(mut self, to_addr_type: impl Into<Cow<'a, str>>) -> Self {
214 self.to_addr_type = Some(to_addr_type.into());
215 self
216 }
217}
218
219#[derive(Debug, Clone, Default, Serialize)]
221#[serde(rename_all = "camelCase")]
222pub struct DepositHistoryRequest<'a> {
223 #[serde(skip_serializing_if = "Option::is_none")]
224 ccy: Option<Cow<'a, str>>,
225 #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
226 deposit_type: Option<Cow<'a, str>>,
227 #[serde(skip_serializing_if = "Option::is_none")]
228 state: Option<Cow<'a, str>>,
229 #[serde(skip_serializing_if = "Option::is_none")]
230 after: Option<Cow<'a, str>>,
231 #[serde(skip_serializing_if = "Option::is_none")]
232 before: Option<Cow<'a, str>>,
233 #[serde(skip_serializing_if = "Option::is_none")]
234 limit: Option<u32>,
235 #[serde(rename = "txId", skip_serializing_if = "Option::is_none")]
236 tx_id: Option<Cow<'a, str>>,
237 #[serde(rename = "depId", skip_serializing_if = "Option::is_none")]
238 dep_id: Option<Cow<'a, str>>,
239 #[serde(rename = "fromWdId", skip_serializing_if = "Option::is_none")]
240 from_wd_id: Option<Cow<'a, str>>,
241}
242
243impl<'a> DepositHistoryRequest<'a> {
244 pub fn new() -> Self {
246 Self::default()
247 }
248
249 pub fn currency(mut self, ccy: impl Into<Cow<'a, str>>) -> Self {
251 self.ccy = Some(ccy.into());
252 self
253 }
254
255 pub fn deposit_type(mut self, deposit_type: impl Into<Cow<'a, str>>) -> Self {
257 self.deposit_type = Some(deposit_type.into());
258 self
259 }
260
261 pub fn state(mut self, state: impl Into<Cow<'a, str>>) -> Self {
263 self.state = Some(state.into());
264 self
265 }
266
267 pub fn after(mut self, after: impl Into<Cow<'a, str>>) -> Self {
269 self.after = Some(after.into());
270 self
271 }
272
273 pub fn before(mut self, before: impl Into<Cow<'a, str>>) -> Self {
275 self.before = Some(before.into());
276 self
277 }
278
279 pub fn limit(mut self, limit: u32) -> Self {
281 self.limit = Some(limit);
282 self
283 }
284
285 pub fn tx_id(mut self, tx_id: impl Into<Cow<'a, str>>) -> Self {
287 self.tx_id = Some(tx_id.into());
288 self
289 }
290
291 pub fn dep_id(mut self, dep_id: impl Into<Cow<'a, str>>) -> Self {
293 self.dep_id = Some(dep_id.into());
294 self
295 }
296
297 pub fn from_wd_id(mut self, from_wd_id: impl Into<Cow<'a, str>>) -> Self {
299 self.from_wd_id = Some(from_wd_id.into());
300 self
301 }
302}
303
304#[derive(Debug, Clone, Default, Serialize)]
306#[serde(rename_all = "camelCase")]
307pub struct WithdrawalHistoryRequest<'a> {
308 #[serde(skip_serializing_if = "Option::is_none")]
309 ccy: Option<Cow<'a, str>>,
310 #[serde(rename = "wdId", skip_serializing_if = "Option::is_none")]
311 wd_id: Option<Cow<'a, str>>,
312 #[serde(rename = "clientId", skip_serializing_if = "Option::is_none")]
313 client_id: Option<Cow<'a, str>>,
314 #[serde(rename = "txId", skip_serializing_if = "Option::is_none")]
315 tx_id: Option<Cow<'a, str>>,
316 #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
317 withdrawal_type: Option<Cow<'a, str>>,
318 #[serde(skip_serializing_if = "Option::is_none")]
319 state: Option<Cow<'a, str>>,
320 #[serde(skip_serializing_if = "Option::is_none")]
321 after: Option<Cow<'a, str>>,
322 #[serde(skip_serializing_if = "Option::is_none")]
323 before: Option<Cow<'a, str>>,
324 #[serde(skip_serializing_if = "Option::is_none")]
325 limit: Option<u32>,
326 #[serde(rename = "toAddrType", skip_serializing_if = "Option::is_none")]
327 to_addr_type: Option<Cow<'a, str>>,
328}
329
330impl<'a> WithdrawalHistoryRequest<'a> {
331 pub fn new() -> Self {
333 Self::default()
334 }
335
336 pub fn currency(mut self, ccy: impl Into<Cow<'a, str>>) -> Self {
338 self.ccy = Some(ccy.into());
339 self
340 }
341
342 pub fn withdrawal_id(mut self, wd_id: impl Into<Cow<'a, str>>) -> Self {
344 self.wd_id = Some(wd_id.into());
345 self
346 }
347
348 pub fn client_id(mut self, client_id: impl Into<Cow<'a, str>>) -> Self {
350 self.client_id = Some(client_id.into());
351 self
352 }
353
354 pub fn tx_id(mut self, tx_id: impl Into<Cow<'a, str>>) -> Self {
356 self.tx_id = Some(tx_id.into());
357 self
358 }
359
360 pub fn withdrawal_type(mut self, withdrawal_type: impl Into<Cow<'a, str>>) -> Self {
362 self.withdrawal_type = Some(withdrawal_type.into());
363 self
364 }
365
366 pub fn state(mut self, state: impl Into<Cow<'a, str>>) -> Self {
368 self.state = Some(state.into());
369 self
370 }
371
372 pub fn after(mut self, after: impl Into<Cow<'a, str>>) -> Self {
374 self.after = Some(after.into());
375 self
376 }
377
378 pub fn before(mut self, before: impl Into<Cow<'a, str>>) -> Self {
380 self.before = Some(before.into());
381 self
382 }
383
384 pub fn limit(mut self, limit: u32) -> Self {
386 self.limit = Some(limit);
387 self
388 }
389
390 pub fn to_addr_type(mut self, to_addr_type: impl Into<Cow<'a, str>>) -> Self {
392 self.to_addr_type = Some(to_addr_type.into());
393 self
394 }
395}
396
397#[derive(Debug, Clone, Default, Serialize)]
399pub struct FundingBillsRequest<'a> {
400 #[serde(skip_serializing_if = "Option::is_none")]
401 ccy: Option<Cow<'a, str>>,
402 #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
403 bill_type: Option<Cow<'a, str>>,
404 #[serde(skip_serializing_if = "Option::is_none")]
405 after: Option<Cow<'a, str>>,
406 #[serde(skip_serializing_if = "Option::is_none")]
407 before: Option<Cow<'a, str>>,
408 #[serde(skip_serializing_if = "Option::is_none")]
409 limit: Option<u32>,
410}
411
412impl<'a> FundingBillsRequest<'a> {
413 pub fn new() -> Self {
415 Self::default()
416 }
417
418 pub fn currency(mut self, ccy: impl Into<Cow<'a, str>>) -> Self {
420 self.ccy = Some(ccy.into());
421 self
422 }
423
424 pub fn bill_type(mut self, bill_type: impl Into<Cow<'a, str>>) -> Self {
426 self.bill_type = Some(bill_type.into());
427 self
428 }
429
430 pub fn after(mut self, after: impl Into<Cow<'a, str>>) -> Self {
432 self.after = Some(after.into());
433 self
434 }
435
436 pub fn before(mut self, before: impl Into<Cow<'a, str>>) -> Self {
438 self.before = Some(before.into());
439 self
440 }
441
442 pub fn limit(mut self, limit: u32) -> Self {
444 self.limit = Some(limit);
445 self
446 }
447}
448
449#[derive(Debug, Clone, Serialize)]
451pub struct DepositLightningRequest<'a> {
452 ccy: Cow<'a, str>,
453 amt: Cow<'a, str>,
454 #[serde(skip_serializing_if = "Option::is_none")]
455 to: Option<Cow<'a, str>>,
456}
457
458impl<'a> DepositLightningRequest<'a> {
459 pub fn new(ccy: impl Into<Cow<'a, str>>, amt: impl Into<Cow<'a, str>>) -> Self {
461 Self {
462 ccy: ccy.into(),
463 amt: amt.into(),
464 to: None,
465 }
466 }
467
468 pub fn to(mut self, to: impl Into<Cow<'a, str>>) -> Self {
470 self.to = Some(to.into());
471 self
472 }
473}
474
475#[derive(Debug, Clone, Serialize)]
477pub struct WithdrawalLightningRequest<'a> {
478 ccy: Cow<'a, str>,
479 invoice: Cow<'a, str>,
480 #[serde(skip_serializing_if = "Option::is_none")]
481 memo: Option<Cow<'a, str>>,
482}
483
484impl<'a> WithdrawalLightningRequest<'a> {
485 pub fn new(ccy: impl Into<Cow<'a, str>>, invoice: impl Into<Cow<'a, str>>) -> Self {
487 Self {
488 ccy: ccy.into(),
489 invoice: invoice.into(),
490 memo: None,
491 }
492 }
493
494 pub fn memo(mut self, memo: impl Into<Cow<'a, str>>) -> Self {
496 self.memo = Some(memo.into());
497 self
498 }
499}
500
501#[derive(Debug, Clone, Default, Serialize)]
503#[serde(rename_all = "camelCase")]
504pub struct DepositWithdrawStatusRequest<'a> {
505 #[serde(rename = "wdId", skip_serializing_if = "Option::is_none")]
506 wd_id: Option<Cow<'a, str>>,
507 #[serde(rename = "txId", skip_serializing_if = "Option::is_none")]
508 tx_id: Option<Cow<'a, str>>,
509 #[serde(skip_serializing_if = "Option::is_none")]
510 ccy: Option<Cow<'a, str>>,
511 #[serde(skip_serializing_if = "Option::is_none")]
512 to: Option<Cow<'a, str>>,
513 #[serde(skip_serializing_if = "Option::is_none")]
514 chain: Option<Cow<'a, str>>,
515}
516
517impl<'a> DepositWithdrawStatusRequest<'a> {
518 pub fn new() -> Self {
520 Self::default()
521 }
522
523 pub fn withdrawal_id(mut self, wd_id: impl Into<Cow<'a, str>>) -> Self {
525 self.wd_id = Some(wd_id.into());
526 self
527 }
528
529 pub fn tx_id(mut self, tx_id: impl Into<Cow<'a, str>>) -> Self {
531 self.tx_id = Some(tx_id.into());
532 self
533 }
534
535 pub fn currency(mut self, ccy: impl Into<Cow<'a, str>>) -> Self {
537 self.ccy = Some(ccy.into());
538 self
539 }
540
541 pub fn to(mut self, to: impl Into<Cow<'a, str>>) -> Self {
543 self.to = Some(to.into());
544 self
545 }
546
547 pub fn chain(mut self, chain: impl Into<Cow<'a, str>>) -> Self {
549 self.chain = Some(chain.into());
550 self
551 }
552}