bitbadges_cosmwasm/
msg.rs

1use schemars::JsonSchema;
2use serde::{Deserialize, Serialize};
3
4use cosmwasm_std::CosmosMsg;
5use cosmwasm_std::CustomMsg;
6
7// implement custom msg
8impl CustomMsg for BitBadgesMsg {}
9
10// this is a helper to be able to return these as CosmosMsg easier
11impl From<BitBadgesMsg> for CosmosMsg<BitBadgesMsg> {
12  fn from(original: BitBadgesMsg) -> Self {
13      CosmosMsg::Custom(original)
14  }
15}
16
17
18#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
19#[serde(rename_all = "camelCase")]
20pub enum BitBadgesMsg {
21  // #[serde(rename_all = "camelCase")]
22  // SetCollectionForProtocolMsg {
23  //   creator: String,
24  //   name: String,
25  //   collection_id: String,
26  // },
27
28  // #[serde(rename_all = "camelCase")]
29  // UnsetCollectionForProtocolMsg {
30  //   creator: String,
31  //   name: String,
32  // },
33
34  // #[serde(rename_all = "camelCase")]
35  // CreateProtocolMsg {
36  //   creator: String,
37  //   name: String,
38  //   uri: String,
39  //   custom_data: String,
40  //   is_frozen: bool,
41  // },
42
43  // #[serde(rename_all = "camelCase")]
44  // UpdateProtocolMsg {
45  //   creator: String,
46  //   name: String,
47  //   uri: String,
48  //   custom_data: String,
49  //   is_frozen: bool,
50  // },
51
52  // #[serde(rename_all = "camelCase")]
53  // DeleteProtocolMsg {
54  //   creator: String,
55  //   name: String,
56  // },
57
58  #[serde(rename_all = "camelCase")]
59  AddCustomData {
60    data: String,
61  },
62
63  #[serde(rename_all = "camelCase")]
64  DeleteCollectionMsg {
65      //As a string
66      collection_id: String, 
67  },
68
69  #[serde(rename_all = "camelCase")]
70  CreateAddressListsMsg {
71    address_lists: Vec<AddressList>,
72  },
73
74  #[serde(rename_all = "camelCase")]
75  TransferBadgesMsg {
76    collection_id: String,
77    transfers: Vec<Transfer>,
78  },
79
80  #[serde(rename_all = "camelCase")]
81  CreateCollectionMsg {
82    balances_type: String,
83    default_balances: UserBalanceStore,
84    badge_ids_to_add: Vec<UintRange>,
85    collection_permissions: CollectionPermissions,
86    manager_timeline: Vec<ManagerTimeline>,
87    collection_metadata_timeline: Vec<CollectionMetadataTimeline>,
88    badge_metadata_timeline: Vec<BadgeMetadataTimeline>,
89    off_chain_balances_metadata_timeline: Vec<OffChainBalancesMetadataTimeline>,
90    custom_data_timeline: Vec<CustomDataTimeline>,
91    collection_approvals: Vec<CollectionApproval>,
92    standards_timeline: Vec<StandardsTimeline>,
93    is_archived_timeline: Vec<IsArchivedTimeline>
94  },
95
96
97  #[serde(rename_all = "camelCase")]
98  UpdateCollectionMsg {
99    collection_id: String,
100    badge_ids_to_add: Vec<UintRange>,
101    update_collection_permissions: bool,
102    collection_permissions: CollectionPermissions,
103    update_manager_timeline: bool,
104    manager_timeline: Vec<ManagerTimeline>,
105    update_collection_metadata_timeline: bool,
106    collection_metadata_timeline: Vec<CollectionMetadataTimeline>,
107    update_badge_metadata_timeline: bool,
108    badge_metadata_timeline: Vec<BadgeMetadataTimeline>,
109    update_off_chain_balances_metadata_timeline: bool,
110    off_chain_balances_metadata_timeline: Vec<OffChainBalancesMetadataTimeline>,
111    update_custom_data_timeline: bool,
112    custom_data_timeline: Vec<CustomDataTimeline>,
113    update_collection_approvals: bool,
114    collection_approvals: Vec<CollectionApproval>,
115    update_standards_timeline: bool,
116    standards_timeline: Vec<StandardsTimeline>,
117    update_is_archived_timeline: bool,
118    is_archived_timeline: Vec<IsArchivedTimeline>,
119  },
120
121  #[serde(rename_all = "camelCase")]
122  UniversalUpdateCollectionMsg {
123    collection_id: String,
124    balances_type: String,
125    default_balances: UserBalanceStore,
126    badge_ids_to_add: Vec<UintRange>,
127    update_collection_permissions: bool,
128    collection_permissions: CollectionPermissions,
129    update_manager_timeline: bool,
130    manager_timeline: Vec<ManagerTimeline>,
131    update_collection_metadata_timeline: bool,
132    collection_metadata_timeline: Vec<CollectionMetadataTimeline>,
133    update_badge_metadata_timeline: bool,
134    badge_metadata_timeline: Vec<BadgeMetadataTimeline>,
135    update_off_chain_balances_metadata_timeline: bool,
136    off_chain_balances_metadata_timeline: Vec<OffChainBalancesMetadataTimeline>,
137    update_custom_data_timeline: bool,
138    custom_data_timeline: Vec<CustomDataTimeline>,
139    update_collection_approvals: bool,
140    collection_approvals: Vec<CollectionApproval>,
141    update_standards_timeline: bool,
142    standards_timeline: Vec<StandardsTimeline>,
143    update_is_archived_timeline: bool,
144    is_archived_timeline: Vec<IsArchivedTimeline>
145  },
146}
147
148// pub fn set_collection_for_protocol_msg(
149//   creator: String,
150//   name: String,
151//   collection_id: String,
152// ) -> CosmosMsg<BitBadgesMsg> {
153//   BitBadgesMsg::SetCollectionForProtocolMsg {
154//     creator,
155//     name,
156//     collection_id,
157//   }.into()
158// }
159
160// pub fn unset_collection_for_protocol_msg(
161//   creator: String,
162//   name: String,
163// ) -> CosmosMsg<BitBadgesMsg> {
164//   BitBadgesMsg::UnsetCollectionForProtocolMsg {
165//     creator,
166//     name,
167//   }.into()
168// }
169
170// pub fn create_protocol_msg(
171//   creator: String,
172//   name: String,
173//   uri: String,
174//   custom_data: String,
175//   is_frozen: bool,
176// ) -> CosmosMsg<BitBadgesMsg> {
177//   BitBadgesMsg::CreateProtocolMsg {
178//     creator,
179//     name,
180//     uri,
181//     custom_data,
182//     is_frozen,
183//   }.into()
184// }
185
186// pub fn update_protocol_msg(
187//   creator: String,
188//   name: String,
189//   uri: String,
190//   custom_data: String,
191//   is_frozen: bool,
192// ) -> CosmosMsg<BitBadgesMsg> {
193//   BitBadgesMsg::UpdateProtocolMsg {
194//     creator,
195//     name,
196//     uri,
197//     custom_data,
198//     is_frozen,
199//   }.into()
200// }
201
202// pub fn delete_protocol_msg(
203//   creator: String,
204//   name: String,
205// ) -> CosmosMsg<BitBadgesMsg> {
206//   BitBadgesMsg::DeleteProtocolMsg {
207//     creator,
208//     name,
209//   }.into()
210// }
211
212pub fn add_custom_data_msg(
213  data: String,
214) -> CosmosMsg<BitBadgesMsg> {
215  BitBadgesMsg::AddCustomData {
216    data,
217  }.into()
218}
219
220pub fn delete_collection_msg(
221    collection_id: String,
222) -> CosmosMsg<BitBadgesMsg> {
223    BitBadgesMsg::DeleteCollectionMsg {
224        collection_id,
225    }.into()
226}
227
228pub fn address_lists_msg(
229  address_lists: Vec<AddressList>,
230) -> CosmosMsg<BitBadgesMsg> {
231  BitBadgesMsg::CreateAddressListsMsg {
232    address_lists,
233  }.into()
234}
235
236pub fn transfer_badges_msg(
237  collection_id: String,
238  transfers: Vec<Transfer>,
239) -> CosmosMsg<BitBadgesMsg> {
240  BitBadgesMsg::TransferBadgesMsg {
241    collection_id,
242    transfers,
243  }.into()
244}
245
246pub fn create_collection_msg(
247  balances_type: String,
248  default_balances: UserBalanceStore,
249  badge_ids_to_add: Vec<UintRange>,
250  collection_permissions: CollectionPermissions,
251  manager_timeline: Vec<ManagerTimeline>,
252  collection_metadata_timeline: Vec<CollectionMetadataTimeline>,
253  badge_metadata_timeline: Vec<BadgeMetadataTimeline>,
254  off_chain_balances_metadata_timeline: Vec<OffChainBalancesMetadataTimeline>,
255  custom_data_timeline: Vec<CustomDataTimeline>,
256  collection_approvals: Vec<CollectionApproval>,
257  standards_timeline: Vec<StandardsTimeline>,
258  is_archived_timeline: Vec<IsArchivedTimeline>
259) -> CosmosMsg<BitBadgesMsg> {
260  BitBadgesMsg::CreateCollectionMsg { 
261    balances_type,
262    default_balances: default_balances,
263    badge_ids_to_add,
264    collection_permissions,
265    manager_timeline,
266    collection_metadata_timeline,
267    badge_metadata_timeline,
268    off_chain_balances_metadata_timeline,
269    custom_data_timeline,
270    collection_approvals,
271    standards_timeline,
272    is_archived_timeline,
273  }.into()
274}
275  
276pub fn update_collection_msg(
277  collection_id: String,
278  badge_ids_to_add: Vec<UintRange>,
279  update_collection_permissions: bool,
280  collection_permissions: CollectionPermissions,
281  update_manager_timeline: bool,
282  manager_timeline: Vec<ManagerTimeline>,
283  update_collection_metadata_timeline: bool,
284  collection_metadata_timeline: Vec<CollectionMetadataTimeline>,
285  update_badge_metadata_timeline: bool,
286  badge_metadata_timeline: Vec<BadgeMetadataTimeline>,
287  update_off_chain_balances_metadata_timeline: bool,
288  off_chain_balances_metadata_timeline: Vec<OffChainBalancesMetadataTimeline>,
289  update_custom_data_timeline: bool,
290  custom_data_timeline: Vec<CustomDataTimeline>,
291  update_collection_approvals: bool,
292  collection_approvals: Vec<CollectionApproval>,
293  update_standards_timeline: bool,
294  standards_timeline: Vec<StandardsTimeline>,
295  update_is_archived_timeline: bool,
296  is_archived_timeline: Vec<IsArchivedTimeline>,
297) -> CosmosMsg<BitBadgesMsg> {
298  BitBadgesMsg::UpdateCollectionMsg {
299      collection_id,
300      badge_ids_to_add,
301      update_collection_permissions,
302      collection_permissions,
303      update_manager_timeline,
304      manager_timeline,
305      update_collection_metadata_timeline,
306      collection_metadata_timeline,
307      update_badge_metadata_timeline,
308      badge_metadata_timeline,
309      update_off_chain_balances_metadata_timeline,
310      off_chain_balances_metadata_timeline,
311      update_custom_data_timeline,
312      custom_data_timeline,
313      update_collection_approvals,
314      collection_approvals,
315      update_standards_timeline,
316      standards_timeline,
317      update_is_archived_timeline,
318      is_archived_timeline,
319  }
320  .into()
321}
322
323pub fn universal_update_collection_msg(
324  collection_id: String,
325  balances_type: String,
326  default_balances: UserBalanceStore,
327  badge_ids_to_add: Vec<UintRange>,
328  update_collection_permissions: bool,
329  collection_permissions: CollectionPermissions,
330  update_manager_timeline: bool,
331  manager_timeline: Vec<ManagerTimeline>,
332  update_collection_metadata_timeline: bool,
333  collection_metadata_timeline: Vec<CollectionMetadataTimeline>,
334  update_badge_metadata_timeline: bool,
335  badge_metadata_timeline: Vec<BadgeMetadataTimeline>,
336  update_off_chain_balances_metadata_timeline: bool,
337  off_chain_balances_metadata_timeline: Vec<OffChainBalancesMetadataTimeline>,
338  update_custom_data_timeline: bool,
339  custom_data_timeline: Vec<CustomDataTimeline>,
340  update_collection_approvals: bool,
341  collection_approvals: Vec<CollectionApproval>,
342  update_standards_timeline: bool,
343  standards_timeline: Vec<StandardsTimeline>,
344  update_is_archived_timeline: bool,
345  is_archived_timeline: Vec<IsArchivedTimeline>
346) -> CosmosMsg<BitBadgesMsg> {
347  BitBadgesMsg::UniversalUpdateCollectionMsg {
348      collection_id,
349      balances_type,
350      default_balances: default_balances,
351      badge_ids_to_add,
352      update_collection_permissions,
353      collection_permissions,
354      update_manager_timeline,
355      manager_timeline,
356      update_collection_metadata_timeline,
357      collection_metadata_timeline,
358      update_badge_metadata_timeline,
359      badge_metadata_timeline,
360      update_off_chain_balances_metadata_timeline,
361      off_chain_balances_metadata_timeline,
362      update_custom_data_timeline,
363      custom_data_timeline,
364      update_collection_approvals,
365      collection_approvals,
366      update_standards_timeline,
367      standards_timeline,
368      update_is_archived_timeline,
369      is_archived_timeline
370  }
371  .into()
372}
373
374
375#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
376#[serde(rename_all = "camelCase")]
377pub struct Protocol {
378  pub name: String,
379  pub uri: String,
380  pub custom_data: String,
381  pub created_by: String,
382  pub is_frozen: bool,
383}
384
385#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
386#[serde(rename_all = "camelCase")]
387pub struct AddressList {
388    pub list_id: String,
389    pub addresses: Vec<String>,
390    pub whitelist: bool,
391    pub uri: String,
392    pub custom_data: String,
393    pub created_by: Option<String>,
394    pub alias_address: Option<String>,
395}
396
397
398#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
399#[serde(rename_all = "camelCase")]
400pub struct Transfer {
401    pub from: String,
402    pub to_addresses: Vec<String>,
403    pub balances: Vec<Balance>,
404    pub precalculate_balances_from_approval: Option<ApprovalIdentifierDetails>,
405    pub merkle_proofs: Vec<MerkleProof>,
406    pub memo: String,
407    pub prioritized_approvals: Vec<ApprovalIdentifierDetails>,
408    pub only_check_prioritized_approvals: bool,
409    pub zk_proof_solutions: Vec<ZkProofSolution>,
410}
411
412#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
413#[serde(rename_all = "camelCase")]
414pub struct ZkProofSolution {
415  pub public_inputs: String,
416  pub proof: String,
417}
418#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
419#[serde(rename_all = "camelCase")]
420pub struct ZkProof {
421  // The verification key for the proof.
422  pub verification_key: String,
423  // The URI associated with this proof, optionally providing metadata about the proof.
424  pub uri: String,
425  // Arbitrary custom data associated with this proof.
426  pub custom_data: String,
427  // The ID of this proof
428  pub zkp_tracker_id: String,
429}
430
431#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
432#[serde(rename_all = "camelCase")]
433pub struct Balance {
434    pub amount: String,
435    pub ownership_times: Vec<UintRange>,
436    pub badge_ids: Vec<UintRange>,
437}
438
439
440#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
441#[serde(rename_all = "camelCase")]
442pub struct UintRange {
443    pub start: String,
444    pub end: String,
445}
446
447
448#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
449#[serde(rename_all = "camelCase")]
450pub struct ApprovalIdentifierDetails {
451    pub approval_id: String,
452    pub approval_level: String,
453    pub approver_address: String,
454}
455
456
457#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
458#[serde(rename_all = "camelCase")]
459pub struct MerkleProof {
460    pub leaf: String,
461    pub aunts: Vec<MerklePathItem>,
462}
463
464
465#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
466#[serde(rename_all = "camelCase")]
467pub struct MerklePathItem {
468    pub aunt: String,
469    pub on_right: bool,
470}
471
472
473#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
474#[serde(rename_all = "camelCase")]
475pub struct MustOwnBadges {
476    pub collection_id: String,
477    pub amount_range: UintRange,
478    pub ownership_times: Vec<UintRange>,
479    pub badge_ids: Vec<UintRange>,
480    pub override_with_current_time: bool,
481    pub must_satify_for_all_assets: bool,
482}
483
484
485#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
486#[serde(rename_all = "camelCase")]
487pub struct BadgeMetadata {
488    pub uri: String,
489    pub custom_data: String,
490    pub badge_ids: Vec<UintRange>,
491}
492
493
494#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
495#[serde(rename_all = "camelCase")]
496pub struct CollectionMetadata {
497    pub uri: String,
498    pub custom_data: String,
499}
500
501
502#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
503#[serde(rename_all = "camelCase")]
504pub struct OffChainBalancesMetadata {
505    pub uri: String,
506    pub custom_data: String,
507}
508
509
510#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
511#[serde(rename_all = "camelCase")]
512pub struct CollectionMetadataTimeline {
513    pub collection_metadata: CollectionMetadata,
514    pub timeline_times: Vec<UintRange>,
515}
516
517
518#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
519#[serde(rename_all = "camelCase")]
520pub struct BadgeMetadataTimeline {
521    pub badge_metadata: Vec<BadgeMetadata>,
522    pub timeline_times: Vec<UintRange>,
523}
524
525
526#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
527#[serde(rename_all = "camelCase")]
528pub struct OffChainBalancesMetadataTimeline {
529    pub off_chain_balances_metadata: OffChainBalancesMetadata,
530    pub timeline_times: Vec<UintRange>,
531}
532
533
534#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
535#[serde(rename_all = "camelCase")]
536pub struct CustomDataTimeline {
537    pub custom_data: String,
538    pub timeline_times: Vec<UintRange>,
539}
540
541
542#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
543#[serde(rename_all = "camelCase")]
544pub struct ManagerTimeline {
545    pub manager: String,
546    pub timeline_times: Vec<UintRange>,
547}
548
549
550#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
551#[serde(rename_all = "camelCase")]
552pub struct IsArchivedTimeline {
553    pub is_archived: bool,
554    pub timeline_times: Vec<UintRange>,
555}
556
557
558#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
559#[serde(rename_all = "camelCase")]
560pub struct ContractAddressTimeline {
561    pub contract_address: String,
562    pub timeline_times: Vec<UintRange>,
563}
564
565
566#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
567#[serde(rename_all = "camelCase")]
568pub struct StandardsTimeline {
569    pub standards: Vec<String>,
570    pub timeline_times: Vec<UintRange>,
571}
572
573
574#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
575#[serde(rename_all = "camelCase")]
576pub struct ManualBalances {
577    pub balances: Vec<Balance>,
578}
579
580
581#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
582#[serde(rename_all = "camelCase")]
583pub struct IncrementedBalances {
584    pub start_balances: Vec<Balance>,
585    pub increment_badge_ids_by: String,
586    pub increment_ownership_times_by: String,
587}
588
589
590#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
591#[serde(rename_all = "camelCase")]
592pub struct PredeterminedOrderCalculationMethod {
593    pub use_overall_num_transfers: bool,
594    pub use_per_to_address_num_transfers: bool,
595    pub use_per_from_address_num_transfers: bool,
596    pub use_per_initiated_by_address_num_transfers: bool,
597    pub use_merkle_challenge_leaf_index: bool,
598    pub challenge_tracker_id: String,
599}
600
601
602#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
603#[serde(rename_all = "camelCase")]
604pub struct PredeterminedBalances {
605    pub manual_balances: Vec<ManualBalances>,
606    pub incremented_balances: IncrementedBalances,
607    pub order_calculation_method: PredeterminedOrderCalculationMethod,
608}
609
610
611#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
612#[serde(rename_all = "camelCase")]
613pub struct ApprovalAmounts {
614    pub overall_approval_amount: String,
615    pub per_to_address_approval_amount: String,
616    pub per_from_address_approval_amount: String,
617    pub per_initiated_by_address_approval_amount: String,
618    pub amount_tracker_id: String,
619}
620
621
622#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
623#[serde(rename_all = "camelCase")]
624pub struct MaxNumTransfers {
625  pub overall_max_num_transfers: String,
626  pub per_to_address_max_num_transfers: String,
627  pub per_from_address_max_num_transfers: String,
628  pub per_initiated_by_address_max_num_transfers: String,
629  pub amount_tracker_id: String,
630}
631
632
633#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
634#[serde(rename_all = "camelCase")]
635pub struct ApprovalTracker {
636    pub num_transfers: String,
637    pub amounts: Vec<Balance>,
638}
639
640#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
641#[serde(rename_all = "camelCase")]
642pub struct CosmosCoin {
643    pub amount: String,
644    pub denom: String,
645}
646
647#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
648#[serde(rename_all = "camelCase")]
649pub struct CoinTransfer {
650  pub to: String,
651  pub coins: Vec<CosmosCoin>,
652}
653
654#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
655#[serde(rename_all = "camelCase")]
656pub struct ApprovalCriteria {
657  must_own_badges: Vec<MustOwnBadges>,
658  merkle_challenges: Vec<MerkleChallenge>,
659  zk_proofs: Vec<ZkProof>,
660  coin_transfers: Vec<CoinTransfer>,
661  predetermined_balances: PredeterminedBalances,
662  approval_amounts: ApprovalAmounts,
663  max_num_transfers: MaxNumTransfers,
664  require_to_equals_initiated_by: bool,
665  require_from_equals_initiated_by: bool,
666  require_to_does_not_equal_initiated_by: bool,
667  require_from_does_not_equal_initiated_by: bool,
668  overrides_from_outgoing_approvals: bool,
669  overrides_to_incoming_approvals: bool,
670}
671
672
673#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
674#[serde(rename_all = "camelCase")]
675pub struct OutgoingApprovalCriteria {
676  must_own_badges: Vec<MustOwnBadges>,
677  merkle_challenges: Vec<MerkleChallenge>,
678  zk_proofs: Vec<ZkProof>,
679  coin_transfers: Vec<CoinTransfer>,
680  predetermined_balances: PredeterminedBalances,
681  approval_amounts: ApprovalAmounts,
682  max_num_transfers: MaxNumTransfers,
683  require_to_equals_initiated_by: bool,
684  require_to_does_not_equal_initiated_by: bool,
685}
686
687
688#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
689#[serde(rename_all = "camelCase")]
690pub struct IncomingApprovalCriteria {
691  must_own_badges: Vec<MustOwnBadges>,
692  merkle_challenges: Vec<MerkleChallenge>,
693  zk_proofs: Vec<ZkProof>,
694  coin_transfers: Vec<CoinTransfer>,
695  predetermined_balances: PredeterminedBalances,
696  approval_amounts: ApprovalAmounts,
697  max_num_transfers: MaxNumTransfers,
698  require_from_equals_initiated_by: bool,
699  require_from_does_not_equal_initiated_by: bool,
700}
701
702
703#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
704#[serde(rename_all = "camelCase")]
705pub struct MerkleChallenge {
706    pub root: String,
707    pub expected_proof_length: String,
708    pub use_creator_address_as_leaf: bool,
709    pub max_uses_per_leaf: String,
710    pub uri: String,
711    pub custom_data: String,
712    pub challenge_tracker_id: String,
713}
714
715
716#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
717#[serde(rename_all = "camelCase")]
718pub struct UserOutgoingApproval {
719    pub to_list_id: String,
720    pub initiated_by_list_id: String,
721    pub transfer_times: Vec<UintRange>,
722    pub badge_ids: Vec<UintRange>,
723    pub ownership_times: Vec<UintRange>,
724    pub uri: String,
725    pub custom_data: String,
726    pub approval_id: String,
727    pub approval_criteria: OutgoingApprovalCriteria,
728}
729
730
731#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
732#[serde(rename_all = "camelCase")]
733pub struct UserIncomingApproval {
734    pub from_list_id: String,
735    pub initiated_by_list_id: String,
736    pub transfer_times: Vec<UintRange>,
737    pub badge_ids: Vec<UintRange>,
738    pub ownership_times: Vec<UintRange>,
739    pub uri: String,
740    pub custom_data: String,
741    pub approval_id: String,
742    pub approval_criteria: IncomingApprovalCriteria,
743}
744
745
746#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
747#[serde(rename_all = "camelCase")]
748pub struct CollectionApproval {
749    pub from_list_id: String,
750    pub to_list_id: String,
751    pub initiated_by_list_id: String,
752    pub transfer_times: Vec<UintRange>,
753    pub badge_ids: Vec<UintRange>,
754    pub ownership_times: Vec<UintRange>,
755    pub uri: String,
756    pub custom_data: String,
757    pub approval_id: String,
758    pub approval_criteria: ApprovalCriteria,
759}
760
761
762#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
763#[serde(rename_all = "camelCase")]
764pub struct CollectionPermissions {
765    pub can_delete_collection: Vec<ActionPermission>,
766    pub can_archive_collection: Vec<TimedUpdatePermission>,
767    pub can_update_off_chain_balances_metadata: Vec<TimedUpdatePermission>,
768    pub can_update_standards: Vec<TimedUpdatePermission>,
769    pub can_update_custom_data: Vec<TimedUpdatePermission>,
770    pub can_update_manager: Vec<TimedUpdatePermission>,
771    pub can_update_collection_metadata: Vec<TimedUpdatePermission>,
772    pub can_update_valid_badge_ids: Vec<BadgeIdsActionPermission>,
773    pub can_update_badge_metadata: Vec<TimedUpdateWithBadgeIdsPermission>,
774    pub can_update_collection_approvals: Vec<CollectionApprovalPermission>,
775}
776
777
778#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
779#[serde(rename_all = "camelCase")]
780pub struct UserPermissions {
781    pub can_update_outgoing_approvals: Vec<UserOutgoingApprovalPermission>,
782    pub can_update_incoming_approvals: Vec<UserIncomingApprovalPermission>,
783    pub can_update_auto_approve_self_initiated_outgoing_transfers: Vec<ActionPermission>,
784    pub can_update_auto_approve_self_initiated_incoming_transfers: Vec<ActionPermission>,
785}
786
787
788#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
789#[serde(rename_all = "camelCase")]
790pub struct CollectionApprovalPermission {
791    pub from_list_id: String,
792    pub to_list_id: String,
793    pub initiated_by_list_id: String,
794    pub transfer_times: Vec<UintRange>,
795    pub badge_ids: Vec<UintRange>,
796    pub ownership_times: Vec<UintRange>,
797    pub permanently_permitted_times: Vec<UintRange>,
798    pub permanenty_forbidden_times: Vec<UintRange>,
799}
800
801
802#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
803#[serde(rename_all = "camelCase")]
804pub struct UserOutgoingApprovalPermission {
805    pub to_list_id: String,
806    pub initiated_by_list_id: String,
807    pub transfer_times: Vec<UintRange>,
808    pub badge_ids: Vec<UintRange>,
809    pub ownership_times: Vec<UintRange>,
810    pub permanently_permitted_times: Vec<UintRange>,
811    pub permanenty_forbidden_times: Vec<UintRange>,
812}
813
814
815#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
816#[serde(rename_all = "camelCase")]
817pub struct UserIncomingApprovalPermission {
818    pub from_list_id: String,
819    pub initiated_by_list_id: String,
820    pub transfer_times: Vec<UintRange>,
821    pub badge_ids: Vec<UintRange>,
822    pub ownership_times: Vec<UintRange>,
823    pub permanently_permitted_times: Vec<UintRange>,
824    pub permanenty_forbidden_times: Vec<UintRange>,
825}
826
827
828#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
829#[serde(rename_all = "camelCase")]
830pub struct BadgeIdsActionPermission {
831    pub badge_ids: Vec<UintRange>,
832    pub permanently_permitted_times: Vec<UintRange>,
833    pub permanenty_forbidden_times: Vec<UintRange>,
834}
835
836
837#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
838#[serde(rename_all = "camelCase")]
839pub struct ActionPermission {
840    pub permanently_permitted_times: Vec<UintRange>,
841    pub permanenty_forbidden_times: Vec<UintRange>,
842}
843
844
845#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
846#[serde(rename_all = "camelCase")]
847pub struct TimedUpdatePermission {
848    pub permanently_permitted_times: Vec<UintRange>,
849    pub permanenty_forbidden_times: Vec<UintRange>,
850    pub timeline_times: Vec<UintRange>,
851}
852
853
854#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
855#[serde(rename_all = "camelCase")]
856pub struct TimedUpdateWithBadgeIdsPermission {
857    pub badge_ids: Vec<UintRange>,
858    pub permanently_permitted_times: Vec<UintRange>,
859    pub permanenty_forbidden_times: Vec<UintRange>,
860    pub timeline_times: Vec<UintRange>,
861}
862
863
864#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
865#[serde(rename_all = "camelCase")]
866pub struct UserBalanceStore {
867    pub balances: Vec<Balance>,
868    pub outgoing_approvals: Vec<UserOutgoingApproval>,
869    pub incoming_approvals: Vec<UserIncomingApproval>,
870    pub auto_approve_self_initiated_outgoing_transfers: bool,
871    pub auto_approve_self_initiated_incoming_transfers: bool,
872    pub user_permissions: UserPermissions,
873}
874
875
876#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
877#[serde(rename_all = "camelCase")]
878pub struct BadgeCollection {
879  collection_id: String,
880  collection_metadata_timeline: Vec<CollectionMetadataTimeline>,
881  badge_metadata_timeline: Vec<BadgeMetadataTimeline>,
882  balances_type: String,
883  off_chain_balances_metadata_timeline: Vec<OffChainBalancesMetadataTimeline>,
884  custom_data_timeline: Vec<CustomDataTimeline>,
885  manager_timeline: Vec<ManagerTimeline>,
886  collection_permissions: CollectionPermissions,
887  collection_approvals: Vec<CollectionApproval>,
888  standards_timeline: Vec<StandardsTimeline>,
889  is_archived_timeline: Vec<IsArchivedTimeline>,
890  default_balances: UserBalanceStore,
891  created_by: String,
892  alias_address: String,
893  valid_badge_ids: Vec<UintRange>,
894}
895
896
897#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
898#[serde(rename_all = "camelCase")]
899pub struct AnchorData {
900  creator: String,
901  data: String,
902  timestamp: String,
903}