1#![forbid(unsafe_code)]
2#![allow(non_camel_case_types, non_snake_case, unused_imports, clippy::all)]
3pub mod splice_api_token_allocation_v2 {
21 pub mod Splice_Api_Token_AllocationV2 {
22 use canton_daml as rt;
23 #[derive(Clone, Debug, PartialEq, Eq, rt::serde::Serialize, rt::serde::Deserialize)]
24 #[serde(crate = "rt::serde")]
25 pub struct SettlementFactory_SettleBatchResult {
26 #[serde(rename = "allocationSettleResults")]
28 pub allocation_settle_results: ::std::vec::Vec<
29 crate::splice_api_token_allocation_v2::Splice_Api_Token_AllocationV2::AllocationResult,
30 >,
31 #[serde(rename = "meta")]
32 pub meta: ::canton_splice_api_token_metadata_v1::splice_api_token_metadata_v1::Splice_Api_Token_MetadataV1::Metadata,
33 }
34 impl rt::ToValue for SettlementFactory_SettleBatchResult {
35 fn to_value(&self) -> rt::Value {
36 rt::record(::std::vec![
37 (
38 "allocationSettleResults",
39 rt::ToValue::to_value(&self.allocation_settle_results)
40 ),
41 ("meta", rt::ToValue::to_value(&self.meta)),
42 ])
43 }
44 }
45 impl rt::FromValue for SettlementFactory_SettleBatchResult {
46 fn from_value(value: &rt::Value) -> ::core::result::Result<Self, rt::ValueError> {
47 ::core::result::Result::Ok(Self {
48 allocation_settle_results: rt::FromValue::from_value(rt::required_field(
49 value,
50 0usize,
51 "allocationSettleResults",
52 )?)
53 .map_err(|e| e.at("allocationSettleResults"))?,
54 meta: rt::FromValue::from_value(rt::required_field(value, 1usize, "meta")?)
55 .map_err(|e| e.at("meta"))?,
56 })
57 }
58 }
59 #[derive(Clone, Debug, PartialEq, Eq, rt::serde::Serialize, rt::serde::Deserialize)]
60 #[serde(crate = "rt::serde")]
61 pub struct SettlementFactory_PublicFetch {
62 #[serde(rename = "actors")]
63 pub actors: ::std::vec::Vec<rt::Party>,
64 }
65 impl rt::ToValue for SettlementFactory_PublicFetch {
66 fn to_value(&self) -> rt::Value {
67 rt::record(::std::vec![("actors", rt::ToValue::to_value(&self.actors)),])
68 }
69 }
70 impl rt::FromValue for SettlementFactory_PublicFetch {
71 fn from_value(value: &rt::Value) -> ::core::result::Result<Self, rt::ValueError> {
72 ::core::result::Result::Ok(Self {
73 actors: rt::FromValue::from_value(rt::required_field(value, 0usize, "actors")?)
74 .map_err(|e| e.at("actors"))?,
75 })
76 }
77 }
78 #[derive(Clone, Debug, PartialEq, Eq, rt::serde::Serialize, rt::serde::Deserialize)]
79 #[serde(crate = "rt::serde")]
80 pub struct SettlementFactory_SettleBatch {
81 #[serde(rename = "settlement")]
82 pub settlement: crate::splice_api_token_allocation_v2::Splice_Api_Token_AllocationV2::SettlementInfo,
83 #[serde(rename = "transferLegs")]
85 pub transfer_legs: ::std::vec::Vec<
86 crate::splice_api_token_allocation_v2::Splice_Api_Token_AllocationV2::TransferLeg,
87 >,
88 #[serde(rename = "allocations")]
89 pub allocations: ::std::vec::Vec<
90 crate::splice_api_token_allocation_v2::Splice_Api_Token_AllocationV2::FinalizedAllocation,
91 >,
92 #[serde(rename = "actors")]
93 pub actors: ::std::vec::Vec<rt::Party>,
94 #[serde(rename = "extraArgs")]
96 pub extra_args: ::canton_splice_api_token_metadata_v1::splice_api_token_metadata_v1::Splice_Api_Token_MetadataV1::ExtraArgs,
97 }
98 impl rt::ToValue for SettlementFactory_SettleBatch {
99 fn to_value(&self) -> rt::Value {
100 rt::record(::std::vec![
101 ("settlement", rt::ToValue::to_value(&self.settlement)),
102 ("transferLegs", rt::ToValue::to_value(&self.transfer_legs)),
103 ("allocations", rt::ToValue::to_value(&self.allocations)),
104 ("actors", rt::ToValue::to_value(&self.actors)),
105 ("extraArgs", rt::ToValue::to_value(&self.extra_args)),
106 ])
107 }
108 }
109 impl rt::FromValue for SettlementFactory_SettleBatch {
110 fn from_value(value: &rt::Value) -> ::core::result::Result<Self, rt::ValueError> {
111 ::core::result::Result::Ok(Self {
112 settlement: rt::FromValue::from_value(rt::required_field(
113 value,
114 0usize,
115 "settlement",
116 )?)
117 .map_err(|e| e.at("settlement"))?,
118 transfer_legs: rt::FromValue::from_value(rt::required_field(
119 value,
120 1usize,
121 "transferLegs",
122 )?)
123 .map_err(|e| e.at("transferLegs"))?,
124 allocations: rt::FromValue::from_value(rt::required_field(
125 value,
126 2usize,
127 "allocations",
128 )?)
129 .map_err(|e| e.at("allocations"))?,
130 actors: rt::FromValue::from_value(rt::required_field(value, 3usize, "actors")?)
131 .map_err(|e| e.at("actors"))?,
132 extra_args: rt::FromValue::from_value(rt::required_field(
133 value,
134 4usize,
135 "extraArgs",
136 )?)
137 .map_err(|e| e.at("extraArgs"))?,
138 })
139 }
140 }
141 #[derive(Clone, Debug, PartialEq, Eq, rt::serde::Serialize, rt::serde::Deserialize)]
142 #[serde(crate = "rt::serde")]
143 pub struct SettlementFactoryView {
144 #[serde(rename = "admin")]
145 pub admin: rt::Party,
146 #[serde(rename = "meta")]
147 pub meta: ::canton_splice_api_token_metadata_v1::splice_api_token_metadata_v1::Splice_Api_Token_MetadataV1::Metadata,
148 }
149 impl rt::ToValue for SettlementFactoryView {
150 fn to_value(&self) -> rt::Value {
151 rt::record(::std::vec![
152 ("admin", rt::ToValue::to_value(&self.admin)),
153 ("meta", rt::ToValue::to_value(&self.meta)),
154 ])
155 }
156 }
157 impl rt::FromValue for SettlementFactoryView {
158 fn from_value(value: &rt::Value) -> ::core::result::Result<Self, rt::ValueError> {
159 ::core::result::Result::Ok(Self {
160 admin: rt::FromValue::from_value(rt::required_field(value, 0usize, "admin")?)
161 .map_err(|e| e.at("admin"))?,
162 meta: rt::FromValue::from_value(rt::required_field(value, 1usize, "meta")?)
163 .map_err(|e| e.at("meta"))?,
164 })
165 }
166 }
167 #[derive(Clone, Debug, PartialEq, Eq, rt::serde::Serialize, rt::serde::Deserialize)]
168 #[serde(crate = "rt::serde", tag = "tag", content = "value")]
169 pub enum AllocationResult_Output {
170 #[serde(rename = "AllocationResult_Pending")]
171 AllocationResult_Pending(
172 crate::splice_api_token_allocation_v2::Splice_Api_Token_AllocationV2::AllocationResult_Output_AllocationResult_Pending,
173 ),
174 #[serde(rename = "AllocationResult_Settled")]
175 AllocationResult_Settled(
176 crate::splice_api_token_allocation_v2::Splice_Api_Token_AllocationV2::AllocationResult_Output_AllocationResult_Settled,
177 ),
178 #[serde(rename = "AllocationResult_Cancelled")]
179 AllocationResult_Cancelled(rt::Unit),
180 #[serde(rename = "AllocationResult_Withdrawn")]
181 AllocationResult_Withdrawn(rt::Unit),
182 }
183 impl rt::ToValue for AllocationResult_Output {
184 fn to_value(&self) -> rt::Value {
185 match self {
186 AllocationResult_Output::AllocationResult_Pending(inner) => {
187 rt::variant_value("AllocationResult_Pending", rt::ToValue::to_value(inner))
188 }
189 AllocationResult_Output::AllocationResult_Settled(inner) => {
190 rt::variant_value("AllocationResult_Settled", rt::ToValue::to_value(inner))
191 }
192 AllocationResult_Output::AllocationResult_Cancelled(inner) => {
193 rt::variant_value(
194 "AllocationResult_Cancelled",
195 rt::ToValue::to_value(inner),
196 )
197 }
198 AllocationResult_Output::AllocationResult_Withdrawn(inner) => {
199 rt::variant_value(
200 "AllocationResult_Withdrawn",
201 rt::ToValue::to_value(inner),
202 )
203 }
204 }
205 }
206 }
207 impl rt::FromValue for AllocationResult_Output {
208 fn from_value(value: &rt::Value) -> ::core::result::Result<Self, rt::ValueError> {
209 let (constructor, payload) = rt::variant_parts(value)?;
210 match constructor {
211 "AllocationResult_Pending" => ::core::result::Result::Ok(
212 AllocationResult_Output::AllocationResult_Pending(
213 rt::FromValue::from_value(payload)
214 .map_err(|e| e.at("AllocationResult_Pending"))?,
215 ),
216 ),
217 "AllocationResult_Settled" => ::core::result::Result::Ok(
218 AllocationResult_Output::AllocationResult_Settled(
219 rt::FromValue::from_value(payload)
220 .map_err(|e| e.at("AllocationResult_Settled"))?,
221 ),
222 ),
223 "AllocationResult_Cancelled" => ::core::result::Result::Ok(
224 AllocationResult_Output::AllocationResult_Cancelled(
225 rt::FromValue::from_value(payload)
226 .map_err(|e| e.at("AllocationResult_Cancelled"))?,
227 ),
228 ),
229 "AllocationResult_Withdrawn" => ::core::result::Result::Ok(
230 AllocationResult_Output::AllocationResult_Withdrawn(
231 rt::FromValue::from_value(payload)
232 .map_err(|e| e.at("AllocationResult_Withdrawn"))?,
233 ),
234 ),
235 other => ::core::result::Result::Err(rt::unexpected_constructor(
236 "AllocationResult_Output",
237 other,
238 )),
239 }
240 }
241 }
242 #[derive(Clone, Debug, PartialEq, Eq, rt::serde::Serialize, rt::serde::Deserialize)]
243 #[serde(crate = "rt::serde")]
244 pub struct AllocationResult_Output_AllocationResult_Pending {
245 #[serde(rename = "allocationCid")]
247 pub allocation_cid: rt::ContractId<
248 crate::splice_api_token_allocation_v2::Splice_Api_Token_AllocationV2::Allocation,
249 >,
250 }
251 impl rt::ToValue for AllocationResult_Output_AllocationResult_Pending {
252 fn to_value(&self) -> rt::Value {
253 rt::record(::std::vec![(
254 "allocationCid",
255 rt::ToValue::to_value(&self.allocation_cid)
256 ),])
257 }
258 }
259 impl rt::FromValue for AllocationResult_Output_AllocationResult_Pending {
260 fn from_value(value: &rt::Value) -> ::core::result::Result<Self, rt::ValueError> {
261 ::core::result::Result::Ok(Self {
262 allocation_cid: rt::FromValue::from_value(rt::required_field(
263 value,
264 0usize,
265 "allocationCid",
266 )?)
267 .map_err(|e| e.at("allocationCid"))?,
268 })
269 }
270 }
271 #[derive(Clone, Debug, PartialEq, Eq, rt::serde::Serialize, rt::serde::Deserialize)]
272 #[serde(crate = "rt::serde")]
273 pub struct AllocationResult_Output_AllocationResult_Settled {
274 #[serde(rename = "nextIterationAllocationCid")]
276 pub next_iteration_allocation_cid: ::core::option::Option<
277 rt::ContractId<
278 crate::splice_api_token_allocation_v2::Splice_Api_Token_AllocationV2::Allocation,
279 >,
280 >,
281 }
282 impl rt::ToValue for AllocationResult_Output_AllocationResult_Settled {
283 fn to_value(&self) -> rt::Value {
284 rt::record(::std::vec![(
285 "nextIterationAllocationCid",
286 rt::ToValue::to_value(&self.next_iteration_allocation_cid)
287 ),])
288 }
289 }
290 impl rt::FromValue for AllocationResult_Output_AllocationResult_Settled {
291 fn from_value(value: &rt::Value) -> ::core::result::Result<Self, rt::ValueError> {
292 ::core::result::Result::Ok(Self {
293 next_iteration_allocation_cid: rt::optional_field(
294 value,
295 0usize,
296 "nextIterationAllocationCid",
297 )
298 .map_err(|e| e.at("nextIterationAllocationCid"))?,
299 })
300 }
301 }
302 #[derive(Clone, Debug, PartialEq, Eq, rt::serde::Serialize, rt::serde::Deserialize)]
303 #[serde(crate = "rt::serde")]
304 pub struct AllocationResult {
305 #[serde(rename = "output")]
306 pub output: crate::splice_api_token_allocation_v2::Splice_Api_Token_AllocationV2::AllocationResult_Output,
307 #[serde(rename = "authorizerHoldingCids")]
309 pub authorizer_holding_cids: rt::TextMap<
310 ::std::vec::Vec<
311 rt::ContractId<
312 ::canton_splice_api_token_holding_v2::splice_api_token_holding_v2::Splice_Api_Token_HoldingV2::Holding,
313 >,
314 >,
315 >,
316 #[serde(rename = "meta")]
317 pub meta: ::canton_splice_api_token_metadata_v1::splice_api_token_metadata_v1::Splice_Api_Token_MetadataV1::Metadata,
318 }
319 impl rt::ToValue for AllocationResult {
320 fn to_value(&self) -> rt::Value {
321 rt::record(::std::vec![
322 ("output", rt::ToValue::to_value(&self.output)),
323 (
324 "authorizerHoldingCids",
325 rt::ToValue::to_value(&self.authorizer_holding_cids)
326 ),
327 ("meta", rt::ToValue::to_value(&self.meta)),
328 ])
329 }
330 }
331 impl rt::FromValue for AllocationResult {
332 fn from_value(value: &rt::Value) -> ::core::result::Result<Self, rt::ValueError> {
333 ::core::result::Result::Ok(Self {
334 output: rt::FromValue::from_value(rt::required_field(value, 0usize, "output")?)
335 .map_err(|e| e.at("output"))?,
336 authorizer_holding_cids: rt::FromValue::from_value(rt::required_field(
337 value,
338 1usize,
339 "authorizerHoldingCids",
340 )?)
341 .map_err(|e| e.at("authorizerHoldingCids"))?,
342 meta: rt::FromValue::from_value(rt::required_field(value, 2usize, "meta")?)
343 .map_err(|e| e.at("meta"))?,
344 })
345 }
346 }
347 #[derive(Clone, Debug, PartialEq, Eq, rt::serde::Serialize, rt::serde::Deserialize)]
348 #[serde(crate = "rt::serde")]
349 pub struct Allocation_Withdraw {
350 #[serde(rename = "actors")]
351 pub actors: ::std::vec::Vec<rt::Party>,
352 #[serde(rename = "extraArgs")]
354 pub extra_args: ::canton_splice_api_token_metadata_v1::splice_api_token_metadata_v1::Splice_Api_Token_MetadataV1::ExtraArgs,
355 }
356 impl rt::ToValue for Allocation_Withdraw {
357 fn to_value(&self) -> rt::Value {
358 rt::record(::std::vec![
359 ("actors", rt::ToValue::to_value(&self.actors)),
360 ("extraArgs", rt::ToValue::to_value(&self.extra_args)),
361 ])
362 }
363 }
364 impl rt::FromValue for Allocation_Withdraw {
365 fn from_value(value: &rt::Value) -> ::core::result::Result<Self, rt::ValueError> {
366 ::core::result::Result::Ok(Self {
367 actors: rt::FromValue::from_value(rt::required_field(value, 0usize, "actors")?)
368 .map_err(|e| e.at("actors"))?,
369 extra_args: rt::FromValue::from_value(rt::required_field(
370 value,
371 1usize,
372 "extraArgs",
373 )?)
374 .map_err(|e| e.at("extraArgs"))?,
375 })
376 }
377 }
378 #[derive(Clone, Debug, PartialEq, Eq, rt::serde::Serialize, rt::serde::Deserialize)]
379 #[serde(crate = "rt::serde")]
380 pub struct Allocation_Cancel {
381 #[serde(rename = "actors")]
382 pub actors: ::std::vec::Vec<rt::Party>,
383 #[serde(rename = "extraArgs")]
385 pub extra_args: ::canton_splice_api_token_metadata_v1::splice_api_token_metadata_v1::Splice_Api_Token_MetadataV1::ExtraArgs,
386 }
387 impl rt::ToValue for Allocation_Cancel {
388 fn to_value(&self) -> rt::Value {
389 rt::record(::std::vec![
390 ("actors", rt::ToValue::to_value(&self.actors)),
391 ("extraArgs", rt::ToValue::to_value(&self.extra_args)),
392 ])
393 }
394 }
395 impl rt::FromValue for Allocation_Cancel {
396 fn from_value(value: &rt::Value) -> ::core::result::Result<Self, rt::ValueError> {
397 ::core::result::Result::Ok(Self {
398 actors: rt::FromValue::from_value(rt::required_field(value, 0usize, "actors")?)
399 .map_err(|e| e.at("actors"))?,
400 extra_args: rt::FromValue::from_value(rt::required_field(
401 value,
402 1usize,
403 "extraArgs",
404 )?)
405 .map_err(|e| e.at("extraArgs"))?,
406 })
407 }
408 }
409 #[derive(Clone, Debug, PartialEq, Eq, rt::serde::Serialize, rt::serde::Deserialize)]
410 #[serde(crate = "rt::serde")]
411 pub struct Allocation_Settle {
412 #[serde(rename = "actors")]
413 pub actors: ::std::vec::Vec<rt::Party>,
414 #[serde(rename = "extraTransferLegSides")]
416 pub extra_transfer_leg_sides: ::std::vec::Vec<
417 crate::splice_api_token_allocation_v2::Splice_Api_Token_AllocationV2::TransferLegSide,
418 >,
419 #[serde(rename = "nextIterationFunding")]
421 pub next_iteration_funding: ::core::option::Option<rt::TextMap<rt::Numeric>>,
422 #[serde(rename = "extraArgs")]
424 pub extra_args: ::canton_splice_api_token_metadata_v1::splice_api_token_metadata_v1::Splice_Api_Token_MetadataV1::ExtraArgs,
425 }
426 impl rt::ToValue for Allocation_Settle {
427 fn to_value(&self) -> rt::Value {
428 rt::record(::std::vec![
429 ("actors", rt::ToValue::to_value(&self.actors)),
430 (
431 "extraTransferLegSides",
432 rt::ToValue::to_value(&self.extra_transfer_leg_sides)
433 ),
434 (
435 "nextIterationFunding",
436 rt::ToValue::to_value(&self.next_iteration_funding)
437 ),
438 ("extraArgs", rt::ToValue::to_value(&self.extra_args)),
439 ])
440 }
441 }
442 impl rt::FromValue for Allocation_Settle {
443 fn from_value(value: &rt::Value) -> ::core::result::Result<Self, rt::ValueError> {
444 ::core::result::Result::Ok(Self {
445 actors: rt::FromValue::from_value(rt::required_field(value, 0usize, "actors")?)
446 .map_err(|e| e.at("actors"))?,
447 extra_transfer_leg_sides: rt::FromValue::from_value(rt::required_field(
448 value,
449 1usize,
450 "extraTransferLegSides",
451 )?)
452 .map_err(|e| e.at("extraTransferLegSides"))?,
453 next_iteration_funding: rt::optional_field(
454 value,
455 2usize,
456 "nextIterationFunding",
457 )
458 .map_err(|e| e.at("nextIterationFunding"))?,
459 extra_args: rt::FromValue::from_value(rt::required_field(
460 value,
461 3usize,
462 "extraArgs",
463 )?)
464 .map_err(|e| e.at("extraArgs"))?,
465 })
466 }
467 }
468 #[derive(Clone, Debug, PartialEq, Eq, rt::serde::Serialize, rt::serde::Deserialize)]
469 #[serde(crate = "rt::serde")]
470 pub struct FinalizedAllocation {
471 #[serde(rename = "allocationCid")]
473 pub allocation_cid: rt::ContractId<
474 crate::splice_api_token_allocation_v2::Splice_Api_Token_AllocationV2::Allocation,
475 >,
476 #[serde(rename = "extraTransferLegSides")]
478 pub extra_transfer_leg_sides: ::std::vec::Vec<
479 crate::splice_api_token_allocation_v2::Splice_Api_Token_AllocationV2::TransferLegSide,
480 >,
481 #[serde(rename = "nextIterationFunding")]
483 pub next_iteration_funding: ::core::option::Option<rt::TextMap<rt::Numeric>>,
484 }
485 impl rt::ToValue for FinalizedAllocation {
486 fn to_value(&self) -> rt::Value {
487 rt::record(::std::vec![
488 ("allocationCid", rt::ToValue::to_value(&self.allocation_cid)),
489 (
490 "extraTransferLegSides",
491 rt::ToValue::to_value(&self.extra_transfer_leg_sides)
492 ),
493 (
494 "nextIterationFunding",
495 rt::ToValue::to_value(&self.next_iteration_funding)
496 ),
497 ])
498 }
499 }
500 impl rt::FromValue for FinalizedAllocation {
501 fn from_value(value: &rt::Value) -> ::core::result::Result<Self, rt::ValueError> {
502 ::core::result::Result::Ok(Self {
503 allocation_cid: rt::FromValue::from_value(rt::required_field(
504 value,
505 0usize,
506 "allocationCid",
507 )?)
508 .map_err(|e| e.at("allocationCid"))?,
509 extra_transfer_leg_sides: rt::FromValue::from_value(rt::required_field(
510 value,
511 1usize,
512 "extraTransferLegSides",
513 )?)
514 .map_err(|e| e.at("extraTransferLegSides"))?,
515 next_iteration_funding: rt::optional_field(
516 value,
517 2usize,
518 "nextIterationFunding",
519 )
520 .map_err(|e| e.at("nextIterationFunding"))?,
521 })
522 }
523 }
524 #[derive(Clone, Debug, PartialEq, Eq, rt::serde::Serialize, rt::serde::Deserialize)]
525 #[serde(crate = "rt::serde")]
526 pub struct AllocationView {
527 #[serde(rename = "originalAllocationCid")]
529 pub original_allocation_cid: ::core::option::Option<
530 rt::ContractId<
531 crate::splice_api_token_allocation_v2::Splice_Api_Token_AllocationV2::Allocation,
532 >,
533 >,
534 #[serde(rename = "settlement")]
535 pub settlement: crate::splice_api_token_allocation_v2::Splice_Api_Token_AllocationV2::SettlementInfo,
536 #[serde(rename = "allocation")]
537 pub allocation: crate::splice_api_token_allocation_v2::Splice_Api_Token_AllocationV2::AllocationSpecification,
538 #[serde(rename = "holdingCids")]
540 pub holding_cids: ::std::vec::Vec<
541 rt::ContractId<
542 ::canton_splice_api_token_holding_v2::splice_api_token_holding_v2::Splice_Api_Token_HoldingV2::Holding,
543 >,
544 >,
545 #[serde(rename = "createdAt")]
547 pub created_at: rt::Timestamp,
548 #[serde(rename = "numIterations")]
550 pub num_iterations: rt::Int64,
551 #[serde(rename = "expiresAt")]
553 pub expires_at: ::core::option::Option<rt::Timestamp>,
554 #[serde(rename = "availableActions")]
556 pub available_actions: rt::GenMap<
557 crate::splice_api_token_allocation_v2::Splice_Api_Token_AllocationV2::AllocationAction,
558 ::std::vec::Vec<::std::vec::Vec<rt::Party>>,
559 >,
560 #[serde(rename = "meta")]
561 pub meta: ::canton_splice_api_token_metadata_v1::splice_api_token_metadata_v1::Splice_Api_Token_MetadataV1::Metadata,
562 }
563 impl rt::ToValue for AllocationView {
564 fn to_value(&self) -> rt::Value {
565 rt::record(::std::vec![
566 (
567 "originalAllocationCid",
568 rt::ToValue::to_value(&self.original_allocation_cid)
569 ),
570 ("settlement", rt::ToValue::to_value(&self.settlement)),
571 ("allocation", rt::ToValue::to_value(&self.allocation)),
572 ("holdingCids", rt::ToValue::to_value(&self.holding_cids)),
573 ("createdAt", rt::ToValue::to_value(&self.created_at)),
574 ("numIterations", rt::ToValue::to_value(&self.num_iterations)),
575 ("expiresAt", rt::ToValue::to_value(&self.expires_at)),
576 (
577 "availableActions",
578 rt::ToValue::to_value(&self.available_actions)
579 ),
580 ("meta", rt::ToValue::to_value(&self.meta)),
581 ])
582 }
583 }
584 impl rt::FromValue for AllocationView {
585 fn from_value(value: &rt::Value) -> ::core::result::Result<Self, rt::ValueError> {
586 ::core::result::Result::Ok(Self {
587 original_allocation_cid: rt::optional_field(
588 value,
589 0usize,
590 "originalAllocationCid",
591 )
592 .map_err(|e| e.at("originalAllocationCid"))?,
593 settlement: rt::FromValue::from_value(rt::required_field(
594 value,
595 1usize,
596 "settlement",
597 )?)
598 .map_err(|e| e.at("settlement"))?,
599 allocation: rt::FromValue::from_value(rt::required_field(
600 value,
601 2usize,
602 "allocation",
603 )?)
604 .map_err(|e| e.at("allocation"))?,
605 holding_cids: rt::FromValue::from_value(rt::required_field(
606 value,
607 3usize,
608 "holdingCids",
609 )?)
610 .map_err(|e| e.at("holdingCids"))?,
611 created_at: rt::FromValue::from_value(rt::required_field(
612 value,
613 4usize,
614 "createdAt",
615 )?)
616 .map_err(|e| e.at("createdAt"))?,
617 num_iterations: rt::FromValue::from_value(rt::required_field(
618 value,
619 5usize,
620 "numIterations",
621 )?)
622 .map_err(|e| e.at("numIterations"))?,
623 expires_at: rt::optional_field(value, 6usize, "expiresAt")
624 .map_err(|e| e.at("expiresAt"))?,
625 available_actions: rt::FromValue::from_value(rt::required_field(
626 value,
627 7usize,
628 "availableActions",
629 )?)
630 .map_err(|e| e.at("availableActions"))?,
631 meta: rt::FromValue::from_value(rt::required_field(value, 8usize, "meta")?)
632 .map_err(|e| e.at("meta"))?,
633 })
634 }
635 }
636 #[derive(Clone, Debug, PartialEq, Eq, rt::serde::Serialize, rt::serde::Deserialize)]
637 #[serde(crate = "rt::serde", tag = "tag", content = "value")]
638 pub enum AllocationAction {
639 #[serde(rename = "AA_Settle")]
640 AA_Settle(rt::Unit),
641 #[serde(rename = "AA_Cancel")]
642 AA_Cancel(rt::Unit),
643 #[serde(rename = "AA_Withdraw")]
644 AA_Withdraw(rt::Unit),
645 #[serde(rename = "AA_Custom")]
646 AA_Custom(
647 crate::splice_api_token_allocation_v2::Splice_Api_Token_AllocationV2::AllocationAction_AA_Custom,
648 ),
649 }
650 impl rt::ToValue for AllocationAction {
651 fn to_value(&self) -> rt::Value {
652 match self {
653 AllocationAction::AA_Settle(inner) => {
654 rt::variant_value("AA_Settle", rt::ToValue::to_value(inner))
655 }
656 AllocationAction::AA_Cancel(inner) => {
657 rt::variant_value("AA_Cancel", rt::ToValue::to_value(inner))
658 }
659 AllocationAction::AA_Withdraw(inner) => {
660 rt::variant_value("AA_Withdraw", rt::ToValue::to_value(inner))
661 }
662 AllocationAction::AA_Custom(inner) => {
663 rt::variant_value("AA_Custom", rt::ToValue::to_value(inner))
664 }
665 }
666 }
667 }
668 impl rt::FromValue for AllocationAction {
669 fn from_value(value: &rt::Value) -> ::core::result::Result<Self, rt::ValueError> {
670 let (constructor, payload) = rt::variant_parts(value)?;
671 match constructor {
672 "AA_Settle" => ::core::result::Result::Ok(AllocationAction::AA_Settle(
673 rt::FromValue::from_value(payload).map_err(|e| e.at("AA_Settle"))?,
674 )),
675 "AA_Cancel" => ::core::result::Result::Ok(AllocationAction::AA_Cancel(
676 rt::FromValue::from_value(payload).map_err(|e| e.at("AA_Cancel"))?,
677 )),
678 "AA_Withdraw" => ::core::result::Result::Ok(AllocationAction::AA_Withdraw(
679 rt::FromValue::from_value(payload).map_err(|e| e.at("AA_Withdraw"))?,
680 )),
681 "AA_Custom" => ::core::result::Result::Ok(AllocationAction::AA_Custom(
682 rt::FromValue::from_value(payload).map_err(|e| e.at("AA_Custom"))?,
683 )),
684 other => ::core::result::Result::Err(rt::unexpected_constructor(
685 "AllocationAction",
686 other,
687 )),
688 }
689 }
690 }
691 #[derive(Clone, Debug, PartialEq, Eq, rt::serde::Serialize, rt::serde::Deserialize)]
692 #[serde(crate = "rt::serde")]
693 pub struct AllocationAction_AA_Custom {
694 #[serde(rename = "id")]
695 pub id: ::std::string::String,
696 }
697 impl rt::ToValue for AllocationAction_AA_Custom {
698 fn to_value(&self) -> rt::Value {
699 rt::record(::std::vec![("id", rt::ToValue::to_value(&self.id)),])
700 }
701 }
702 impl rt::FromValue for AllocationAction_AA_Custom {
703 fn from_value(value: &rt::Value) -> ::core::result::Result<Self, rt::ValueError> {
704 ::core::result::Result::Ok(Self {
705 id: rt::FromValue::from_value(rt::required_field(value, 0usize, "id")?)
706 .map_err(|e| e.at("id"))?,
707 })
708 }
709 }
710 #[derive(Clone, Debug, PartialEq, Eq, rt::serde::Serialize, rt::serde::Deserialize)]
711 #[serde(crate = "rt::serde")]
712 pub struct AllocationSpecification {
713 #[serde(rename = "admin")]
714 pub admin: rt::Party,
715 #[serde(rename = "authorizer")]
716 pub authorizer: ::canton_splice_api_token_holding_v2::splice_api_token_holding_v2::Splice_Api_Token_HoldingV2::Account,
717 #[serde(rename = "transferLegSides")]
719 pub transfer_leg_sides: ::std::vec::Vec<
720 crate::splice_api_token_allocation_v2::Splice_Api_Token_AllocationV2::TransferLegSide,
721 >,
722 #[serde(rename = "settlementDeadline")]
724 pub settlement_deadline: ::core::option::Option<rt::Timestamp>,
725 #[serde(rename = "nextIterationFunding")]
727 pub next_iteration_funding: ::core::option::Option<rt::TextMap<rt::Numeric>>,
728 #[serde(rename = "committed")]
729 pub committed: bool,
730 #[serde(rename = "meta")]
731 pub meta: ::canton_splice_api_token_metadata_v1::splice_api_token_metadata_v1::Splice_Api_Token_MetadataV1::Metadata,
732 }
733 impl rt::ToValue for AllocationSpecification {
734 fn to_value(&self) -> rt::Value {
735 rt::record(::std::vec![
736 ("admin", rt::ToValue::to_value(&self.admin)),
737 ("authorizer", rt::ToValue::to_value(&self.authorizer)),
738 (
739 "transferLegSides",
740 rt::ToValue::to_value(&self.transfer_leg_sides)
741 ),
742 (
743 "settlementDeadline",
744 rt::ToValue::to_value(&self.settlement_deadline)
745 ),
746 (
747 "nextIterationFunding",
748 rt::ToValue::to_value(&self.next_iteration_funding)
749 ),
750 ("committed", rt::ToValue::to_value(&self.committed)),
751 ("meta", rt::ToValue::to_value(&self.meta)),
752 ])
753 }
754 }
755 impl rt::FromValue for AllocationSpecification {
756 fn from_value(value: &rt::Value) -> ::core::result::Result<Self, rt::ValueError> {
757 ::core::result::Result::Ok(Self {
758 admin: rt::FromValue::from_value(rt::required_field(value, 0usize, "admin")?)
759 .map_err(|e| e.at("admin"))?,
760 authorizer: rt::FromValue::from_value(rt::required_field(
761 value,
762 1usize,
763 "authorizer",
764 )?)
765 .map_err(|e| e.at("authorizer"))?,
766 transfer_leg_sides: rt::FromValue::from_value(rt::required_field(
767 value,
768 2usize,
769 "transferLegSides",
770 )?)
771 .map_err(|e| e.at("transferLegSides"))?,
772 settlement_deadline: rt::optional_field(value, 3usize, "settlementDeadline")
773 .map_err(|e| e.at("settlementDeadline"))?,
774 next_iteration_funding: rt::optional_field(
775 value,
776 4usize,
777 "nextIterationFunding",
778 )
779 .map_err(|e| e.at("nextIterationFunding"))?,
780 committed: rt::FromValue::from_value(rt::required_field(
781 value,
782 5usize,
783 "committed",
784 )?)
785 .map_err(|e| e.at("committed"))?,
786 meta: rt::FromValue::from_value(rt::required_field(value, 6usize, "meta")?)
787 .map_err(|e| e.at("meta"))?,
788 })
789 }
790 }
791 #[derive(Clone, Debug, PartialEq, Eq, rt::serde::Serialize, rt::serde::Deserialize)]
792 #[serde(crate = "rt::serde")]
793 pub struct TransferLegSide {
794 #[serde(rename = "transferLegId")]
796 pub transfer_leg_id: ::std::string::String,
797 #[serde(rename = "side")]
798 pub side: crate::splice_api_token_allocation_v2::Splice_Api_Token_AllocationV2::TransferSide,
799 #[serde(rename = "otherside")]
800 pub otherside: ::canton_splice_api_token_holding_v2::splice_api_token_holding_v2::Splice_Api_Token_HoldingV2::Account,
801 #[serde(rename = "amount")]
802 pub amount: rt::Numeric,
803 #[serde(rename = "instrumentId")]
805 pub instrument_id: ::std::string::String,
806 #[serde(rename = "meta")]
807 pub meta: ::canton_splice_api_token_metadata_v1::splice_api_token_metadata_v1::Splice_Api_Token_MetadataV1::Metadata,
808 }
809 impl rt::ToValue for TransferLegSide {
810 fn to_value(&self) -> rt::Value {
811 rt::record(::std::vec![
812 (
813 "transferLegId",
814 rt::ToValue::to_value(&self.transfer_leg_id)
815 ),
816 ("side", rt::ToValue::to_value(&self.side)),
817 ("otherside", rt::ToValue::to_value(&self.otherside)),
818 ("amount", rt::ToValue::to_value(&self.amount)),
819 ("instrumentId", rt::ToValue::to_value(&self.instrument_id)),
820 ("meta", rt::ToValue::to_value(&self.meta)),
821 ])
822 }
823 }
824 impl rt::FromValue for TransferLegSide {
825 fn from_value(value: &rt::Value) -> ::core::result::Result<Self, rt::ValueError> {
826 ::core::result::Result::Ok(Self {
827 transfer_leg_id: rt::FromValue::from_value(rt::required_field(
828 value,
829 0usize,
830 "transferLegId",
831 )?)
832 .map_err(|e| e.at("transferLegId"))?,
833 side: rt::FromValue::from_value(rt::required_field(value, 1usize, "side")?)
834 .map_err(|e| e.at("side"))?,
835 otherside: rt::FromValue::from_value(rt::required_field(
836 value,
837 2usize,
838 "otherside",
839 )?)
840 .map_err(|e| e.at("otherside"))?,
841 amount: rt::FromValue::from_value(rt::required_field(value, 3usize, "amount")?)
842 .map_err(|e| e.at("amount"))?,
843 instrument_id: rt::FromValue::from_value(rt::required_field(
844 value,
845 4usize,
846 "instrumentId",
847 )?)
848 .map_err(|e| e.at("instrumentId"))?,
849 meta: rt::FromValue::from_value(rt::required_field(value, 5usize, "meta")?)
850 .map_err(|e| e.at("meta"))?,
851 })
852 }
853 }
854 #[derive(
855 Clone, Copy, Debug, PartialEq, Eq, rt::serde::Serialize, rt::serde::Deserialize,
856 )]
857 #[serde(crate = "rt::serde")]
858 pub enum TransferSide {
859 #[serde(rename = "SenderSide")]
860 SenderSide,
861 #[serde(rename = "ReceiverSide")]
862 ReceiverSide,
863 }
864 impl rt::ToValue for TransferSide {
865 fn to_value(&self) -> rt::Value {
866 rt::enum_value(match self {
867 TransferSide::SenderSide => "SenderSide",
868 TransferSide::ReceiverSide => "ReceiverSide",
869 })
870 }
871 }
872 impl rt::FromValue for TransferSide {
873 fn from_value(value: &rt::Value) -> ::core::result::Result<Self, rt::ValueError> {
874 match rt::enum_constructor(value)? {
875 "SenderSide" => ::core::result::Result::Ok(TransferSide::SenderSide),
876 "ReceiverSide" => ::core::result::Result::Ok(TransferSide::ReceiverSide),
877 other => ::core::result::Result::Err(rt::unexpected_constructor(
878 "TransferSide",
879 other,
880 )),
881 }
882 }
883 }
884 #[derive(Clone, Debug, PartialEq, Eq, rt::serde::Serialize, rt::serde::Deserialize)]
885 #[serde(crate = "rt::serde")]
886 pub struct TransferLeg {
887 #[serde(rename = "transferLegId")]
889 pub transfer_leg_id: ::std::string::String,
890 #[serde(rename = "sender")]
891 pub sender: ::canton_splice_api_token_holding_v2::splice_api_token_holding_v2::Splice_Api_Token_HoldingV2::Account,
892 #[serde(rename = "receiver")]
893 pub receiver: ::canton_splice_api_token_holding_v2::splice_api_token_holding_v2::Splice_Api_Token_HoldingV2::Account,
894 #[serde(rename = "amount")]
895 pub amount: rt::Numeric,
896 #[serde(rename = "instrumentId")]
898 pub instrument_id: ::std::string::String,
899 #[serde(rename = "meta")]
900 pub meta: ::canton_splice_api_token_metadata_v1::splice_api_token_metadata_v1::Splice_Api_Token_MetadataV1::Metadata,
901 }
902 impl rt::ToValue for TransferLeg {
903 fn to_value(&self) -> rt::Value {
904 rt::record(::std::vec![
905 (
906 "transferLegId",
907 rt::ToValue::to_value(&self.transfer_leg_id)
908 ),
909 ("sender", rt::ToValue::to_value(&self.sender)),
910 ("receiver", rt::ToValue::to_value(&self.receiver)),
911 ("amount", rt::ToValue::to_value(&self.amount)),
912 ("instrumentId", rt::ToValue::to_value(&self.instrument_id)),
913 ("meta", rt::ToValue::to_value(&self.meta)),
914 ])
915 }
916 }
917 impl rt::FromValue for TransferLeg {
918 fn from_value(value: &rt::Value) -> ::core::result::Result<Self, rt::ValueError> {
919 ::core::result::Result::Ok(Self {
920 transfer_leg_id: rt::FromValue::from_value(rt::required_field(
921 value,
922 0usize,
923 "transferLegId",
924 )?)
925 .map_err(|e| e.at("transferLegId"))?,
926 sender: rt::FromValue::from_value(rt::required_field(value, 1usize, "sender")?)
927 .map_err(|e| e.at("sender"))?,
928 receiver: rt::FromValue::from_value(rt::required_field(
929 value, 2usize, "receiver",
930 )?)
931 .map_err(|e| e.at("receiver"))?,
932 amount: rt::FromValue::from_value(rt::required_field(value, 3usize, "amount")?)
933 .map_err(|e| e.at("amount"))?,
934 instrument_id: rt::FromValue::from_value(rt::required_field(
935 value,
936 4usize,
937 "instrumentId",
938 )?)
939 .map_err(|e| e.at("instrumentId"))?,
940 meta: rt::FromValue::from_value(rt::required_field(value, 5usize, "meta")?)
941 .map_err(|e| e.at("meta"))?,
942 })
943 }
944 }
945 #[derive(Clone, Debug, PartialEq, Eq, rt::serde::Serialize, rt::serde::Deserialize)]
946 #[serde(crate = "rt::serde")]
947 pub struct SettlementInfo {
948 #[serde(rename = "executors")]
949 pub executors: ::std::vec::Vec<rt::Party>,
950 #[serde(rename = "id")]
951 pub id: ::std::string::String,
952 #[serde(rename = "cid")]
953 pub cid: ::core::option::Option<
954 rt::ContractId<
955 ::canton_splice_api_token_metadata_v1::splice_api_token_metadata_v1::Splice_Api_Token_MetadataV1::AnyContract,
956 >,
957 >,
958 #[serde(rename = "meta")]
959 pub meta: ::canton_splice_api_token_metadata_v1::splice_api_token_metadata_v1::Splice_Api_Token_MetadataV1::Metadata,
960 }
961 impl rt::ToValue for SettlementInfo {
962 fn to_value(&self) -> rt::Value {
963 rt::record(::std::vec![
964 ("executors", rt::ToValue::to_value(&self.executors)),
965 ("id", rt::ToValue::to_value(&self.id)),
966 ("cid", rt::ToValue::to_value(&self.cid)),
967 ("meta", rt::ToValue::to_value(&self.meta)),
968 ])
969 }
970 }
971 impl rt::FromValue for SettlementInfo {
972 fn from_value(value: &rt::Value) -> ::core::result::Result<Self, rt::ValueError> {
973 ::core::result::Result::Ok(Self {
974 executors: rt::FromValue::from_value(rt::required_field(
975 value,
976 0usize,
977 "executors",
978 )?)
979 .map_err(|e| e.at("executors"))?,
980 id: rt::FromValue::from_value(rt::required_field(value, 1usize, "id")?)
981 .map_err(|e| e.at("id"))?,
982 cid: rt::optional_field(value, 2usize, "cid").map_err(|e| e.at("cid"))?,
983 meta: rt::FromValue::from_value(rt::required_field(value, 3usize, "meta")?)
984 .map_err(|e| e.at("meta"))?,
985 })
986 }
987 }
988 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
990 pub struct Allocation;
991 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
993 pub struct SettlementFactory;
994 impl rt::Contract for Allocation {
995 const PACKAGE_ID: &'static str =
996 "051a3b0563a6fa4df4cb34448081e48b061e555aa1a265abf6ae8f3f4cafe439";
997 const PACKAGE_NAME: &'static str = "splice-api-token-allocation-v2";
998 const MODULE_NAME: &'static str = "Splice.Api.Token.AllocationV2";
999 const ENTITY_NAME: &'static str = "Allocation";
1000 }
1001 impl rt::Interface for Allocation {
1002 type View = crate::splice_api_token_allocation_v2::Splice_Api_Token_AllocationV2::AllocationView;
1003 }
1004 impl rt::Choice<Allocation>
1006 for ::canton_daml_stdlib::ghc_stdlib_DA_Internal_Template::DA_Internal_Template::Archive
1007 {
1008 type Return = rt::Unit;
1009 const NAME: &'static str = "Archive";
1010 const CONSUMING: bool = true;
1011 }
1012 impl rt::Choice<Allocation>
1014 for crate::splice_api_token_allocation_v2::Splice_Api_Token_AllocationV2::Allocation_Settle {
1015 type Return = crate::splice_api_token_allocation_v2::Splice_Api_Token_AllocationV2::AllocationResult;
1016 const NAME: &'static str = "Allocation_Settle";
1017 const CONSUMING: bool = false;
1018 }
1019 impl rt::Choice<Allocation>
1021 for crate::splice_api_token_allocation_v2::Splice_Api_Token_AllocationV2::Allocation_Cancel {
1022 type Return = crate::splice_api_token_allocation_v2::Splice_Api_Token_AllocationV2::AllocationResult;
1023 const NAME: &'static str = "Allocation_Cancel";
1024 const CONSUMING: bool = false;
1025 }
1026 impl rt::Choice<Allocation>
1028 for crate::splice_api_token_allocation_v2::Splice_Api_Token_AllocationV2::Allocation_Withdraw {
1029 type Return = crate::splice_api_token_allocation_v2::Splice_Api_Token_AllocationV2::AllocationResult;
1030 const NAME: &'static str = "Allocation_Withdraw";
1031 const CONSUMING: bool = false;
1032 }
1033 impl rt::Contract for SettlementFactory {
1034 const PACKAGE_ID: &'static str =
1035 "051a3b0563a6fa4df4cb34448081e48b061e555aa1a265abf6ae8f3f4cafe439";
1036 const PACKAGE_NAME: &'static str = "splice-api-token-allocation-v2";
1037 const MODULE_NAME: &'static str = "Splice.Api.Token.AllocationV2";
1038 const ENTITY_NAME: &'static str = "SettlementFactory";
1039 }
1040 impl rt::Interface for SettlementFactory {
1041 type View = crate::splice_api_token_allocation_v2::Splice_Api_Token_AllocationV2::SettlementFactoryView;
1042 }
1043 impl rt::Choice<SettlementFactory>
1045 for ::canton_daml_stdlib::ghc_stdlib_DA_Internal_Template::DA_Internal_Template::Archive
1046 {
1047 type Return = rt::Unit;
1048 const NAME: &'static str = "Archive";
1049 const CONSUMING: bool = true;
1050 }
1051 impl rt::Choice<SettlementFactory>
1053 for crate::splice_api_token_allocation_v2::Splice_Api_Token_AllocationV2::SettlementFactory_PublicFetch {
1054 type Return = crate::splice_api_token_allocation_v2::Splice_Api_Token_AllocationV2::SettlementFactoryView;
1055 const NAME: &'static str = "SettlementFactory_PublicFetch";
1056 const CONSUMING: bool = false;
1057 }
1058 impl rt::Choice<SettlementFactory>
1060 for crate::splice_api_token_allocation_v2::Splice_Api_Token_AllocationV2::SettlementFactory_SettleBatch {
1061 type Return = crate::splice_api_token_allocation_v2::Splice_Api_Token_AllocationV2::SettlementFactory_SettleBatchResult;
1062 const NAME: &'static str = "SettlementFactory_SettleBatch";
1063 const CONSUMING: bool = false;
1064 }
1065 }
1066}