Skip to main content

canton_splice_api_token_allocation_v1/
lib.rs

1#![forbid(unsafe_code)]
2#![allow(non_camel_case_types, non_snake_case, unused_imports, clippy::all)]
3//! Typed Rust bindings generated from a Daml archive (DAR).
4//!
5//! **Generated file — do not edit by hand.** Regenerate with
6//! `dpm-codegen-rust` from the source this crate's `Cargo.toml` records
7//! (a DAR, or a participant's package payloads); edits are lost.
8//!
9//! Each Daml package in the DAR's dependency closure is one top-level
10//! module, and each Daml module a submodule under it, so cross-package
11//! references resolve and names never collide. Templates carry typed
12//! choices; the runtime traits they implement (`Template`, `Choice`,
13//! `Contract`) and the command builders live in `canton-daml`, which the
14//! generated code imports as `rt`.
15//!
16//! # Packages in this crate
17//!
18//! - [`splice_api_token_allocation_v1`] — 1 Daml module
19
20pub mod splice_api_token_allocation_v1 {
21    pub mod Splice_Api_Token_AllocationV1 {
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 Allocation_WithdrawResult {
26            ///Daml field `senderHoldingCids`.
27            #[serde(rename = "senderHoldingCids")]
28            pub sender_holding_cids: ::std::vec::Vec<
29                rt::ContractId<
30                    ::canton_splice_api_token_holding_v1::splice_api_token_holding_v1::Splice_Api_Token_HoldingV1::Holding,
31                >,
32            >,
33            #[serde(rename = "meta")]
34            pub meta: ::canton_splice_api_token_metadata_v1::splice_api_token_metadata_v1::Splice_Api_Token_MetadataV1::Metadata,
35        }
36        impl rt::ToValue for Allocation_WithdrawResult {
37            fn to_value(&self) -> rt::Value {
38                rt::record(::std::vec![
39                    (
40                        "senderHoldingCids",
41                        rt::ToValue::to_value(&self.sender_holding_cids)
42                    ),
43                    ("meta", rt::ToValue::to_value(&self.meta)),
44                ])
45            }
46        }
47        impl rt::FromValue for Allocation_WithdrawResult {
48            fn from_value(value: &rt::Value) -> ::core::result::Result<Self, rt::ValueError> {
49                ::core::result::Result::Ok(Self {
50                    sender_holding_cids: rt::FromValue::from_value(rt::required_field(
51                        value,
52                        0usize,
53                        "senderHoldingCids",
54                    )?)
55                    .map_err(|e| e.at("senderHoldingCids"))?,
56                    meta: rt::FromValue::from_value(rt::required_field(value, 1usize, "meta")?)
57                        .map_err(|e| e.at("meta"))?,
58                })
59            }
60        }
61        #[derive(Clone, Debug, PartialEq, Eq, rt::serde::Serialize, rt::serde::Deserialize)]
62        #[serde(crate = "rt::serde")]
63        pub struct Allocation_CancelResult {
64            ///Daml field `senderHoldingCids`.
65            #[serde(rename = "senderHoldingCids")]
66            pub sender_holding_cids: ::std::vec::Vec<
67                rt::ContractId<
68                    ::canton_splice_api_token_holding_v1::splice_api_token_holding_v1::Splice_Api_Token_HoldingV1::Holding,
69                >,
70            >,
71            #[serde(rename = "meta")]
72            pub meta: ::canton_splice_api_token_metadata_v1::splice_api_token_metadata_v1::Splice_Api_Token_MetadataV1::Metadata,
73        }
74        impl rt::ToValue for Allocation_CancelResult {
75            fn to_value(&self) -> rt::Value {
76                rt::record(::std::vec![
77                    (
78                        "senderHoldingCids",
79                        rt::ToValue::to_value(&self.sender_holding_cids)
80                    ),
81                    ("meta", rt::ToValue::to_value(&self.meta)),
82                ])
83            }
84        }
85        impl rt::FromValue for Allocation_CancelResult {
86            fn from_value(value: &rt::Value) -> ::core::result::Result<Self, rt::ValueError> {
87                ::core::result::Result::Ok(Self {
88                    sender_holding_cids: rt::FromValue::from_value(rt::required_field(
89                        value,
90                        0usize,
91                        "senderHoldingCids",
92                    )?)
93                    .map_err(|e| e.at("senderHoldingCids"))?,
94                    meta: rt::FromValue::from_value(rt::required_field(value, 1usize, "meta")?)
95                        .map_err(|e| e.at("meta"))?,
96                })
97            }
98        }
99        #[derive(Clone, Debug, PartialEq, Eq, rt::serde::Serialize, rt::serde::Deserialize)]
100        #[serde(crate = "rt::serde")]
101        pub struct Allocation_ExecuteTransferResult {
102            ///Daml field `senderHoldingCids`.
103            #[serde(rename = "senderHoldingCids")]
104            pub sender_holding_cids: ::std::vec::Vec<
105                rt::ContractId<
106                    ::canton_splice_api_token_holding_v1::splice_api_token_holding_v1::Splice_Api_Token_HoldingV1::Holding,
107                >,
108            >,
109            ///Daml field `receiverHoldingCids`.
110            #[serde(rename = "receiverHoldingCids")]
111            pub receiver_holding_cids: ::std::vec::Vec<
112                rt::ContractId<
113                    ::canton_splice_api_token_holding_v1::splice_api_token_holding_v1::Splice_Api_Token_HoldingV1::Holding,
114                >,
115            >,
116            #[serde(rename = "meta")]
117            pub meta: ::canton_splice_api_token_metadata_v1::splice_api_token_metadata_v1::Splice_Api_Token_MetadataV1::Metadata,
118        }
119        impl rt::ToValue for Allocation_ExecuteTransferResult {
120            fn to_value(&self) -> rt::Value {
121                rt::record(::std::vec![
122                    (
123                        "senderHoldingCids",
124                        rt::ToValue::to_value(&self.sender_holding_cids)
125                    ),
126                    (
127                        "receiverHoldingCids",
128                        rt::ToValue::to_value(&self.receiver_holding_cids)
129                    ),
130                    ("meta", rt::ToValue::to_value(&self.meta)),
131                ])
132            }
133        }
134        impl rt::FromValue for Allocation_ExecuteTransferResult {
135            fn from_value(value: &rt::Value) -> ::core::result::Result<Self, rt::ValueError> {
136                ::core::result::Result::Ok(Self {
137                    sender_holding_cids: rt::FromValue::from_value(rt::required_field(
138                        value,
139                        0usize,
140                        "senderHoldingCids",
141                    )?)
142                    .map_err(|e| e.at("senderHoldingCids"))?,
143                    receiver_holding_cids: rt::FromValue::from_value(rt::required_field(
144                        value,
145                        1usize,
146                        "receiverHoldingCids",
147                    )?)
148                    .map_err(|e| e.at("receiverHoldingCids"))?,
149                    meta: rt::FromValue::from_value(rt::required_field(value, 2usize, "meta")?)
150                        .map_err(|e| e.at("meta"))?,
151                })
152            }
153        }
154        #[derive(Clone, Debug, PartialEq, Eq, rt::serde::Serialize, rt::serde::Deserialize)]
155        #[serde(crate = "rt::serde")]
156        pub struct Allocation_Withdraw {
157            ///Daml field `extraArgs`.
158            #[serde(rename = "extraArgs")]
159            pub extra_args: ::canton_splice_api_token_metadata_v1::splice_api_token_metadata_v1::Splice_Api_Token_MetadataV1::ExtraArgs,
160        }
161        impl rt::ToValue for Allocation_Withdraw {
162            fn to_value(&self) -> rt::Value {
163                rt::record(::std::vec![(
164                    "extraArgs",
165                    rt::ToValue::to_value(&self.extra_args)
166                ),])
167            }
168        }
169        impl rt::FromValue for Allocation_Withdraw {
170            fn from_value(value: &rt::Value) -> ::core::result::Result<Self, rt::ValueError> {
171                ::core::result::Result::Ok(Self {
172                    extra_args: rt::FromValue::from_value(rt::required_field(
173                        value,
174                        0usize,
175                        "extraArgs",
176                    )?)
177                    .map_err(|e| e.at("extraArgs"))?,
178                })
179            }
180        }
181        #[derive(Clone, Debug, PartialEq, Eq, rt::serde::Serialize, rt::serde::Deserialize)]
182        #[serde(crate = "rt::serde")]
183        pub struct Allocation_Cancel {
184            ///Daml field `extraArgs`.
185            #[serde(rename = "extraArgs")]
186            pub extra_args: ::canton_splice_api_token_metadata_v1::splice_api_token_metadata_v1::Splice_Api_Token_MetadataV1::ExtraArgs,
187        }
188        impl rt::ToValue for Allocation_Cancel {
189            fn to_value(&self) -> rt::Value {
190                rt::record(::std::vec![(
191                    "extraArgs",
192                    rt::ToValue::to_value(&self.extra_args)
193                ),])
194            }
195        }
196        impl rt::FromValue for Allocation_Cancel {
197            fn from_value(value: &rt::Value) -> ::core::result::Result<Self, rt::ValueError> {
198                ::core::result::Result::Ok(Self {
199                    extra_args: rt::FromValue::from_value(rt::required_field(
200                        value,
201                        0usize,
202                        "extraArgs",
203                    )?)
204                    .map_err(|e| e.at("extraArgs"))?,
205                })
206            }
207        }
208        #[derive(Clone, Debug, PartialEq, Eq, rt::serde::Serialize, rt::serde::Deserialize)]
209        #[serde(crate = "rt::serde")]
210        pub struct Allocation_ExecuteTransfer {
211            ///Daml field `extraArgs`.
212            #[serde(rename = "extraArgs")]
213            pub extra_args: ::canton_splice_api_token_metadata_v1::splice_api_token_metadata_v1::Splice_Api_Token_MetadataV1::ExtraArgs,
214        }
215        impl rt::ToValue for Allocation_ExecuteTransfer {
216            fn to_value(&self) -> rt::Value {
217                rt::record(::std::vec![(
218                    "extraArgs",
219                    rt::ToValue::to_value(&self.extra_args)
220                ),])
221            }
222        }
223        impl rt::FromValue for Allocation_ExecuteTransfer {
224            fn from_value(value: &rt::Value) -> ::core::result::Result<Self, rt::ValueError> {
225                ::core::result::Result::Ok(Self {
226                    extra_args: rt::FromValue::from_value(rt::required_field(
227                        value,
228                        0usize,
229                        "extraArgs",
230                    )?)
231                    .map_err(|e| e.at("extraArgs"))?,
232                })
233            }
234        }
235        #[derive(Clone, Debug, PartialEq, Eq, rt::serde::Serialize, rt::serde::Deserialize)]
236        #[serde(crate = "rt::serde")]
237        pub struct AllocationView {
238            #[serde(rename = "allocation")]
239            pub allocation: crate::splice_api_token_allocation_v1::Splice_Api_Token_AllocationV1::AllocationSpecification,
240            ///Daml field `holdingCids`.
241            #[serde(rename = "holdingCids")]
242            pub holding_cids: ::std::vec::Vec<
243                rt::ContractId<
244                    ::canton_splice_api_token_holding_v1::splice_api_token_holding_v1::Splice_Api_Token_HoldingV1::Holding,
245                >,
246            >,
247            #[serde(rename = "meta")]
248            pub meta: ::canton_splice_api_token_metadata_v1::splice_api_token_metadata_v1::Splice_Api_Token_MetadataV1::Metadata,
249        }
250        impl rt::ToValue for AllocationView {
251            fn to_value(&self) -> rt::Value {
252                rt::record(::std::vec![
253                    ("allocation", rt::ToValue::to_value(&self.allocation)),
254                    ("holdingCids", rt::ToValue::to_value(&self.holding_cids)),
255                    ("meta", rt::ToValue::to_value(&self.meta)),
256                ])
257            }
258        }
259        impl rt::FromValue for AllocationView {
260            fn from_value(value: &rt::Value) -> ::core::result::Result<Self, rt::ValueError> {
261                ::core::result::Result::Ok(Self {
262                    allocation: rt::FromValue::from_value(rt::required_field(
263                        value,
264                        0usize,
265                        "allocation",
266                    )?)
267                    .map_err(|e| e.at("allocation"))?,
268                    holding_cids: rt::FromValue::from_value(rt::required_field(
269                        value,
270                        1usize,
271                        "holdingCids",
272                    )?)
273                    .map_err(|e| e.at("holdingCids"))?,
274                    meta: rt::FromValue::from_value(rt::required_field(value, 2usize, "meta")?)
275                        .map_err(|e| e.at("meta"))?,
276                })
277            }
278        }
279        #[derive(Clone, Debug, PartialEq, Eq, rt::serde::Serialize, rt::serde::Deserialize)]
280        #[serde(crate = "rt::serde")]
281        pub struct AllocationSpecification {
282            #[serde(rename = "settlement")]
283            pub settlement: crate::splice_api_token_allocation_v1::Splice_Api_Token_AllocationV1::SettlementInfo,
284            ///Daml field `transferLegId`.
285            #[serde(rename = "transferLegId")]
286            pub transfer_leg_id: ::std::string::String,
287            ///Daml field `transferLeg`.
288            #[serde(rename = "transferLeg")]
289            pub transfer_leg: crate::splice_api_token_allocation_v1::Splice_Api_Token_AllocationV1::TransferLeg,
290        }
291        impl rt::ToValue for AllocationSpecification {
292            fn to_value(&self) -> rt::Value {
293                rt::record(::std::vec![
294                    ("settlement", rt::ToValue::to_value(&self.settlement)),
295                    (
296                        "transferLegId",
297                        rt::ToValue::to_value(&self.transfer_leg_id)
298                    ),
299                    ("transferLeg", rt::ToValue::to_value(&self.transfer_leg)),
300                ])
301            }
302        }
303        impl rt::FromValue for AllocationSpecification {
304            fn from_value(value: &rt::Value) -> ::core::result::Result<Self, rt::ValueError> {
305                ::core::result::Result::Ok(Self {
306                    settlement: rt::FromValue::from_value(rt::required_field(
307                        value,
308                        0usize,
309                        "settlement",
310                    )?)
311                    .map_err(|e| e.at("settlement"))?,
312                    transfer_leg_id: rt::FromValue::from_value(rt::required_field(
313                        value,
314                        1usize,
315                        "transferLegId",
316                    )?)
317                    .map_err(|e| e.at("transferLegId"))?,
318                    transfer_leg: rt::FromValue::from_value(rt::required_field(
319                        value,
320                        2usize,
321                        "transferLeg",
322                    )?)
323                    .map_err(|e| e.at("transferLeg"))?,
324                })
325            }
326        }
327        #[derive(Clone, Debug, PartialEq, Eq, rt::serde::Serialize, rt::serde::Deserialize)]
328        #[serde(crate = "rt::serde")]
329        pub struct TransferLeg {
330            #[serde(rename = "sender")]
331            pub sender: rt::Party,
332            #[serde(rename = "receiver")]
333            pub receiver: rt::Party,
334            #[serde(rename = "amount")]
335            pub amount: rt::Numeric,
336            ///Daml field `instrumentId`.
337            #[serde(rename = "instrumentId")]
338            pub instrument_id: ::canton_splice_api_token_holding_v1::splice_api_token_holding_v1::Splice_Api_Token_HoldingV1::InstrumentId,
339            #[serde(rename = "meta")]
340            pub meta: ::canton_splice_api_token_metadata_v1::splice_api_token_metadata_v1::Splice_Api_Token_MetadataV1::Metadata,
341        }
342        impl rt::ToValue for TransferLeg {
343            fn to_value(&self) -> rt::Value {
344                rt::record(::std::vec![
345                    ("sender", rt::ToValue::to_value(&self.sender)),
346                    ("receiver", rt::ToValue::to_value(&self.receiver)),
347                    ("amount", rt::ToValue::to_value(&self.amount)),
348                    ("instrumentId", rt::ToValue::to_value(&self.instrument_id)),
349                    ("meta", rt::ToValue::to_value(&self.meta)),
350                ])
351            }
352        }
353        impl rt::FromValue for TransferLeg {
354            fn from_value(value: &rt::Value) -> ::core::result::Result<Self, rt::ValueError> {
355                ::core::result::Result::Ok(Self {
356                    sender: rt::FromValue::from_value(rt::required_field(value, 0usize, "sender")?)
357                        .map_err(|e| e.at("sender"))?,
358                    receiver: rt::FromValue::from_value(rt::required_field(
359                        value, 1usize, "receiver",
360                    )?)
361                    .map_err(|e| e.at("receiver"))?,
362                    amount: rt::FromValue::from_value(rt::required_field(value, 2usize, "amount")?)
363                        .map_err(|e| e.at("amount"))?,
364                    instrument_id: rt::FromValue::from_value(rt::required_field(
365                        value,
366                        3usize,
367                        "instrumentId",
368                    )?)
369                    .map_err(|e| e.at("instrumentId"))?,
370                    meta: rt::FromValue::from_value(rt::required_field(value, 4usize, "meta")?)
371                        .map_err(|e| e.at("meta"))?,
372                })
373            }
374        }
375        #[derive(Clone, Debug, PartialEq, Eq, rt::serde::Serialize, rt::serde::Deserialize)]
376        #[serde(crate = "rt::serde")]
377        pub struct SettlementInfo {
378            #[serde(rename = "executor")]
379            pub executor: rt::Party,
380            ///Daml field `settlementRef`.
381            #[serde(rename = "settlementRef")]
382            pub settlement_ref: crate::splice_api_token_allocation_v1::Splice_Api_Token_AllocationV1::Reference,
383            ///Daml field `requestedAt`.
384            #[serde(rename = "requestedAt")]
385            pub requested_at: rt::Timestamp,
386            ///Daml field `allocateBefore`.
387            #[serde(rename = "allocateBefore")]
388            pub allocate_before: rt::Timestamp,
389            ///Daml field `settleBefore`.
390            #[serde(rename = "settleBefore")]
391            pub settle_before: rt::Timestamp,
392            #[serde(rename = "meta")]
393            pub meta: ::canton_splice_api_token_metadata_v1::splice_api_token_metadata_v1::Splice_Api_Token_MetadataV1::Metadata,
394        }
395        impl rt::ToValue for SettlementInfo {
396            fn to_value(&self) -> rt::Value {
397                rt::record(::std::vec![
398                    ("executor", rt::ToValue::to_value(&self.executor)),
399                    ("settlementRef", rt::ToValue::to_value(&self.settlement_ref)),
400                    ("requestedAt", rt::ToValue::to_value(&self.requested_at)),
401                    (
402                        "allocateBefore",
403                        rt::ToValue::to_value(&self.allocate_before)
404                    ),
405                    ("settleBefore", rt::ToValue::to_value(&self.settle_before)),
406                    ("meta", rt::ToValue::to_value(&self.meta)),
407                ])
408            }
409        }
410        impl rt::FromValue for SettlementInfo {
411            fn from_value(value: &rt::Value) -> ::core::result::Result<Self, rt::ValueError> {
412                ::core::result::Result::Ok(Self {
413                    executor: rt::FromValue::from_value(rt::required_field(
414                        value, 0usize, "executor",
415                    )?)
416                    .map_err(|e| e.at("executor"))?,
417                    settlement_ref: rt::FromValue::from_value(rt::required_field(
418                        value,
419                        1usize,
420                        "settlementRef",
421                    )?)
422                    .map_err(|e| e.at("settlementRef"))?,
423                    requested_at: rt::FromValue::from_value(rt::required_field(
424                        value,
425                        2usize,
426                        "requestedAt",
427                    )?)
428                    .map_err(|e| e.at("requestedAt"))?,
429                    allocate_before: rt::FromValue::from_value(rt::required_field(
430                        value,
431                        3usize,
432                        "allocateBefore",
433                    )?)
434                    .map_err(|e| e.at("allocateBefore"))?,
435                    settle_before: rt::FromValue::from_value(rt::required_field(
436                        value,
437                        4usize,
438                        "settleBefore",
439                    )?)
440                    .map_err(|e| e.at("settleBefore"))?,
441                    meta: rt::FromValue::from_value(rt::required_field(value, 5usize, "meta")?)
442                        .map_err(|e| e.at("meta"))?,
443                })
444            }
445        }
446        #[derive(Clone, Debug, PartialEq, Eq, rt::serde::Serialize, rt::serde::Deserialize)]
447        #[serde(crate = "rt::serde")]
448        pub struct Reference {
449            #[serde(rename = "id")]
450            pub id: ::std::string::String,
451            #[serde(rename = "cid")]
452            pub cid: ::core::option::Option<
453                rt::ContractId<
454                    ::canton_splice_api_token_metadata_v1::splice_api_token_metadata_v1::Splice_Api_Token_MetadataV1::AnyContract,
455                >,
456            >,
457        }
458        impl rt::ToValue for Reference {
459            fn to_value(&self) -> rt::Value {
460                rt::record(::std::vec![
461                    ("id", rt::ToValue::to_value(&self.id)),
462                    ("cid", rt::ToValue::to_value(&self.cid)),
463                ])
464            }
465        }
466        impl rt::FromValue for Reference {
467            fn from_value(value: &rt::Value) -> ::core::result::Result<Self, rt::ValueError> {
468                ::core::result::Result::Ok(Self {
469                    id: rt::FromValue::from_value(rt::required_field(value, 0usize, "id")?)
470                        .map_err(|e| e.at("id"))?,
471                    cid: rt::optional_field(value, 1usize, "cid").map_err(|e| e.at("cid"))?,
472                })
473            }
474        }
475        ///Marker for the Daml interface `Allocation` (held via `ContractId`).
476        #[derive(Clone, Copy, Debug, PartialEq, Eq)]
477        pub struct Allocation;
478        impl rt::Contract for Allocation {
479            const PACKAGE_ID: &'static str =
480                "93c942ae2b4c2ba674fb152fe38473c507bda4e82b4e4c5da55a552a9d8cce1d";
481            const PACKAGE_NAME: &'static str = "splice-api-token-allocation-v1";
482            const MODULE_NAME: &'static str = "Splice.Api.Token.AllocationV1";
483            const ENTITY_NAME: &'static str = "Allocation";
484        }
485        impl rt::Interface for Allocation {
486            type View = crate::splice_api_token_allocation_v1::Splice_Api_Token_AllocationV1::AllocationView;
487        }
488        ///The `Archive` choice on [`Allocation`] (consuming).
489        impl rt::Choice<Allocation>
490            for ::canton_daml_stdlib::ghc_stdlib_DA_Internal_Template::DA_Internal_Template::Archive
491        {
492            type Return = rt::Unit;
493            const NAME: &'static str = "Archive";
494            const CONSUMING: bool = true;
495        }
496        ///The `Allocation_Withdraw` choice on [`Allocation`] (consuming).
497        impl rt::Choice<Allocation>
498        for crate::splice_api_token_allocation_v1::Splice_Api_Token_AllocationV1::Allocation_Withdraw {
499            type Return = crate::splice_api_token_allocation_v1::Splice_Api_Token_AllocationV1::Allocation_WithdrawResult;
500            const NAME: &'static str = "Allocation_Withdraw";
501            const CONSUMING: bool = true;
502        }
503        ///The `Allocation_Cancel` choice on [`Allocation`] (consuming).
504        impl rt::Choice<Allocation>
505        for crate::splice_api_token_allocation_v1::Splice_Api_Token_AllocationV1::Allocation_Cancel {
506            type Return = crate::splice_api_token_allocation_v1::Splice_Api_Token_AllocationV1::Allocation_CancelResult;
507            const NAME: &'static str = "Allocation_Cancel";
508            const CONSUMING: bool = true;
509        }
510        ///The `Allocation_ExecuteTransfer` choice on [`Allocation`] (consuming).
511        impl rt::Choice<Allocation>
512        for crate::splice_api_token_allocation_v1::Splice_Api_Token_AllocationV1::Allocation_ExecuteTransfer {
513            type Return = crate::splice_api_token_allocation_v1::Splice_Api_Token_AllocationV1::Allocation_ExecuteTransferResult;
514            const NAME: &'static str = "Allocation_ExecuteTransfer";
515            const CONSUMING: bool = true;
516        }
517    }
518}