@dalmore/api-contracts 0.0.0-dev.651765a → 0.0.0-dev.6728794

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,10 +5,6 @@ export declare enum AssetTemplateType {
5
5
  STANDARD = "STANDARD",
6
6
  TIERED = "TIERED"
7
7
  }
8
- export declare enum InterestType {
9
- SIMPLE = "SIMPLE",
10
- COMPOUND = "COMPOUND"
11
- }
12
8
  export declare const IAsset: z.ZodObject<{
13
9
  __entity: z.ZodOptional<z.ZodString>;
14
10
  createdAt: z.ZodUnion<[z.ZodString, z.ZodDate]>;
@@ -71,10 +67,7 @@ export declare const IAsset: z.ZodObject<{
71
67
  template: z.ZodNativeEnum<typeof AssetTemplateType>;
72
68
  tiers: z.ZodNullable<z.ZodArray<z.ZodNumber, "many">>;
73
69
  enableBonus: z.ZodBoolean;
74
- principalAmount: z.ZodNullable<z.ZodNumber>;
75
- maxTotalRaise: z.ZodNullable<z.ZodNumber>;
76
70
  interestRate: z.ZodNullable<z.ZodNumber>;
77
- interestType: z.ZodNullable<z.ZodNativeEnum<typeof InterestType>>;
78
71
  }, "strip", z.ZodTypeAny, {
79
72
  type: AssetType | null;
80
73
  id: string;
@@ -93,10 +86,7 @@ export declare const IAsset: z.ZodObject<{
93
86
  durationType: DurationType | null;
94
87
  tiers: number[] | null;
95
88
  enableBonus: boolean;
96
- principalAmount: number | null;
97
- maxTotalRaise: number | null;
98
89
  interestRate: number | null;
99
- interestType: InterestType | null;
100
90
  __entity?: string | undefined;
101
91
  account?: {
102
92
  status: import("./common.types").AccountStatus;
@@ -131,10 +121,7 @@ export declare const IAsset: z.ZodObject<{
131
121
  durationType: DurationType | null;
132
122
  tiers: number[] | null;
133
123
  enableBonus: boolean;
134
- principalAmount: number | null;
135
- maxTotalRaise: number | null;
136
124
  interestRate: number | null;
137
- interestType: InterestType | null;
138
125
  __entity?: string | undefined;
139
126
  account?: {
140
127
  status: import("./common.types").AccountStatus;
@@ -216,10 +203,7 @@ export declare const IPaginatedAsset: z.ZodObject<{
216
203
  template: z.ZodNativeEnum<typeof AssetTemplateType>;
217
204
  tiers: z.ZodNullable<z.ZodArray<z.ZodNumber, "many">>;
218
205
  enableBonus: z.ZodBoolean;
219
- principalAmount: z.ZodNullable<z.ZodNumber>;
220
- maxTotalRaise: z.ZodNullable<z.ZodNumber>;
221
206
  interestRate: z.ZodNullable<z.ZodNumber>;
222
- interestType: z.ZodNullable<z.ZodNativeEnum<typeof InterestType>>;
223
207
  }, "strip", z.ZodTypeAny, {
224
208
  type: AssetType | null;
225
209
  id: string;
@@ -238,10 +222,7 @@ export declare const IPaginatedAsset: z.ZodObject<{
238
222
  durationType: DurationType | null;
239
223
  tiers: number[] | null;
240
224
  enableBonus: boolean;
241
- principalAmount: number | null;
242
- maxTotalRaise: number | null;
243
225
  interestRate: number | null;
244
- interestType: InterestType | null;
245
226
  __entity?: string | undefined;
246
227
  account?: {
247
228
  status: import("./common.types").AccountStatus;
@@ -276,10 +257,7 @@ export declare const IPaginatedAsset: z.ZodObject<{
276
257
  durationType: DurationType | null;
277
258
  tiers: number[] | null;
278
259
  enableBonus: boolean;
279
- principalAmount: number | null;
280
- maxTotalRaise: number | null;
281
260
  interestRate: number | null;
282
- interestType: InterestType | null;
283
261
  __entity?: string | undefined;
284
262
  account?: {
285
263
  status: import("./common.types").AccountStatus;
@@ -335,10 +313,7 @@ export declare const IPaginatedAsset: z.ZodObject<{
335
313
  durationType: DurationType | null;
336
314
  tiers: number[] | null;
337
315
  enableBonus: boolean;
338
- principalAmount: number | null;
339
- maxTotalRaise: number | null;
340
316
  interestRate: number | null;
341
- interestType: InterestType | null;
342
317
  __entity?: string | undefined;
343
318
  account?: {
344
319
  status: import("./common.types").AccountStatus;
@@ -382,10 +357,7 @@ export declare const IPaginatedAsset: z.ZodObject<{
382
357
  durationType: DurationType | null;
383
358
  tiers: number[] | null;
384
359
  enableBonus: boolean;
385
- principalAmount: number | null;
386
- maxTotalRaise: number | null;
387
360
  interestRate: number | null;
388
- interestType: InterestType | null;
389
361
  __entity?: string | undefined;
390
362
  account?: {
391
363
  status: import("./common.types").AccountStatus;
@@ -425,10 +397,7 @@ export declare const PostAsset: z.ZodEffects<z.ZodObject<{
425
397
  template: z.ZodDefault<z.ZodNativeEnum<typeof AssetTemplateType>>;
426
398
  tiers: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber, "many">>>;
427
399
  enableBonus: z.ZodDefault<z.ZodBoolean>;
428
- principalAmount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
429
- maxTotalRaise: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
430
400
  interestRate: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
431
- interestType: z.ZodOptional<z.ZodNullable<z.ZodNativeEnum<typeof InterestType>>>;
432
401
  }, "strip", z.ZodTypeAny, {
433
402
  type: AssetType;
434
403
  name: string;
@@ -441,10 +410,7 @@ export declare const PostAsset: z.ZodEffects<z.ZodObject<{
441
410
  duration?: number | null | undefined;
442
411
  durationType?: DurationType | null | undefined;
443
412
  tiers?: number[] | null | undefined;
444
- principalAmount?: number | null | undefined;
445
- maxTotalRaise?: number | null | undefined;
446
413
  interestRate?: number | null | undefined;
447
- interestType?: InterestType | null | undefined;
448
414
  }, {
449
415
  type: AssetType;
450
416
  name: string;
@@ -457,10 +423,7 @@ export declare const PostAsset: z.ZodEffects<z.ZodObject<{
457
423
  durationType?: DurationType | null | undefined;
458
424
  tiers?: number[] | null | undefined;
459
425
  enableBonus?: boolean | undefined;
460
- principalAmount?: number | null | undefined;
461
- maxTotalRaise?: number | null | undefined;
462
426
  interestRate?: number | null | undefined;
463
- interestType?: InterestType | null | undefined;
464
427
  }>, {
465
428
  type: AssetType;
466
429
  name: string;
@@ -473,10 +436,7 @@ export declare const PostAsset: z.ZodEffects<z.ZodObject<{
473
436
  duration?: number | null | undefined;
474
437
  durationType?: DurationType | null | undefined;
475
438
  tiers?: number[] | null | undefined;
476
- principalAmount?: number | null | undefined;
477
- maxTotalRaise?: number | null | undefined;
478
439
  interestRate?: number | null | undefined;
479
- interestType?: InterestType | null | undefined;
480
440
  }, {
481
441
  type: AssetType;
482
442
  name: string;
@@ -489,10 +449,7 @@ export declare const PostAsset: z.ZodEffects<z.ZodObject<{
489
449
  durationType?: DurationType | null | undefined;
490
450
  tiers?: number[] | null | undefined;
491
451
  enableBonus?: boolean | undefined;
492
- principalAmount?: number | null | undefined;
493
- maxTotalRaise?: number | null | undefined;
494
452
  interestRate?: number | null | undefined;
495
- interestType?: InterestType | null | undefined;
496
453
  }>;
497
454
  export type PostAsset = z.infer<typeof PostAsset>;
498
455
  export declare const CompliancePostAsset: z.ZodEffects<z.ZodObject<{
@@ -507,10 +464,7 @@ export declare const CompliancePostAsset: z.ZodEffects<z.ZodObject<{
507
464
  template: z.ZodDefault<z.ZodNativeEnum<typeof AssetTemplateType>>;
508
465
  tiers: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber, "many">>>;
509
466
  enableBonus: z.ZodDefault<z.ZodBoolean>;
510
- principalAmount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
511
- maxTotalRaise: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
512
467
  interestRate: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
513
- interestType: z.ZodOptional<z.ZodNullable<z.ZodNativeEnum<typeof InterestType>>>;
514
468
  } & {
515
469
  accountId: z.ZodLazy<z.ZodEffects<z.ZodString, string, string>>;
516
470
  }, "strip", z.ZodTypeAny, {
@@ -526,10 +480,7 @@ export declare const CompliancePostAsset: z.ZodEffects<z.ZodObject<{
526
480
  duration?: number | null | undefined;
527
481
  durationType?: DurationType | null | undefined;
528
482
  tiers?: number[] | null | undefined;
529
- principalAmount?: number | null | undefined;
530
- maxTotalRaise?: number | null | undefined;
531
483
  interestRate?: number | null | undefined;
532
- interestType?: InterestType | null | undefined;
533
484
  }, {
534
485
  type: AssetType;
535
486
  accountId: string;
@@ -543,10 +494,7 @@ export declare const CompliancePostAsset: z.ZodEffects<z.ZodObject<{
543
494
  durationType?: DurationType | null | undefined;
544
495
  tiers?: number[] | null | undefined;
545
496
  enableBonus?: boolean | undefined;
546
- principalAmount?: number | null | undefined;
547
- maxTotalRaise?: number | null | undefined;
548
497
  interestRate?: number | null | undefined;
549
- interestType?: InterestType | null | undefined;
550
498
  }>, {
551
499
  type: AssetType;
552
500
  accountId: string;
@@ -560,10 +508,7 @@ export declare const CompliancePostAsset: z.ZodEffects<z.ZodObject<{
560
508
  duration?: number | null | undefined;
561
509
  durationType?: DurationType | null | undefined;
562
510
  tiers?: number[] | null | undefined;
563
- principalAmount?: number | null | undefined;
564
- maxTotalRaise?: number | null | undefined;
565
511
  interestRate?: number | null | undefined;
566
- interestType?: InterestType | null | undefined;
567
512
  }, {
568
513
  type: AssetType;
569
514
  accountId: string;
@@ -577,10 +522,7 @@ export declare const CompliancePostAsset: z.ZodEffects<z.ZodObject<{
577
522
  durationType?: DurationType | null | undefined;
578
523
  tiers?: number[] | null | undefined;
579
524
  enableBonus?: boolean | undefined;
580
- principalAmount?: number | null | undefined;
581
- maxTotalRaise?: number | null | undefined;
582
525
  interestRate?: number | null | undefined;
583
- interestType?: InterestType | null | undefined;
584
526
  }>;
585
527
  export type CompliancePostAsset = z.infer<typeof CompliancePostAsset>;
586
528
  export declare const PutAsset: z.ZodObject<{
@@ -594,10 +536,7 @@ export declare const PutAsset: z.ZodObject<{
594
536
  template: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodNativeEnum<typeof AssetTemplateType>>>>;
595
537
  tiers: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber, "many">>>;
596
538
  enableBonus: z.ZodOptional<z.ZodBoolean>;
597
- principalAmount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
598
- maxTotalRaise: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
599
539
  interestRate: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
600
- interestType: z.ZodOptional<z.ZodNullable<z.ZodNativeEnum<typeof InterestType>>>;
601
540
  }, "strip", z.ZodTypeAny, {
602
541
  type?: AssetType | undefined;
603
542
  name?: string | undefined;
@@ -609,10 +548,7 @@ export declare const PutAsset: z.ZodObject<{
609
548
  durationType?: DurationType | null | undefined;
610
549
  tiers?: number[] | null | undefined;
611
550
  enableBonus?: boolean | undefined;
612
- principalAmount?: number | null | undefined;
613
- maxTotalRaise?: number | null | undefined;
614
551
  interestRate?: number | null | undefined;
615
- interestType?: InterestType | null | undefined;
616
552
  }, {
617
553
  type?: AssetType | undefined;
618
554
  name?: string | undefined;
@@ -624,10 +560,7 @@ export declare const PutAsset: z.ZodObject<{
624
560
  durationType?: DurationType | null | undefined;
625
561
  tiers?: number[] | null | undefined;
626
562
  enableBonus?: boolean | undefined;
627
- principalAmount?: number | null | undefined;
628
- maxTotalRaise?: number | null | undefined;
629
563
  interestRate?: number | null | undefined;
630
- interestType?: InterestType | null | undefined;
631
564
  }>;
632
565
  export type PutAsset = z.infer<typeof PutAsset>;
633
566
  export declare const CompliancePutAsset: z.ZodObject<{
@@ -641,10 +574,7 @@ export declare const CompliancePutAsset: z.ZodObject<{
641
574
  template: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodNativeEnum<typeof AssetTemplateType>>>>;
642
575
  tiers: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber, "many">>>;
643
576
  enableBonus: z.ZodOptional<z.ZodBoolean>;
644
- principalAmount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
645
- maxTotalRaise: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
646
577
  interestRate: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
647
- interestType: z.ZodOptional<z.ZodNullable<z.ZodNativeEnum<typeof InterestType>>>;
648
578
  } & {
649
579
  accountId: z.ZodEffects<z.ZodString, string, string>;
650
580
  }, "strip", z.ZodTypeAny, {
@@ -659,10 +589,7 @@ export declare const CompliancePutAsset: z.ZodObject<{
659
589
  durationType?: DurationType | null | undefined;
660
590
  tiers?: number[] | null | undefined;
661
591
  enableBonus?: boolean | undefined;
662
- principalAmount?: number | null | undefined;
663
- maxTotalRaise?: number | null | undefined;
664
592
  interestRate?: number | null | undefined;
665
- interestType?: InterestType | null | undefined;
666
593
  }, {
667
594
  accountId: string;
668
595
  type?: AssetType | undefined;
@@ -675,10 +602,7 @@ export declare const CompliancePutAsset: z.ZodObject<{
675
602
  durationType?: DurationType | null | undefined;
676
603
  tiers?: number[] | null | undefined;
677
604
  enableBonus?: boolean | undefined;
678
- principalAmount?: number | null | undefined;
679
- maxTotalRaise?: number | null | undefined;
680
605
  interestRate?: number | null | undefined;
681
- interestType?: InterestType | null | undefined;
682
606
  }>;
683
607
  export type CompliancePutAsset = z.infer<typeof CompliancePutAsset>;
684
608
  export declare const AssetsIncludeQuery: z.ZodObject<{
@@ -761,10 +685,9 @@ export declare const PromissoryNoteAssetSchema: z.ZodObject<{
761
685
  totalUnits: z.ZodNullable<z.ZodNumber>;
762
686
  } & {
763
687
  type: z.ZodLiteral<AssetType.PROMISSORY_NOTE>;
764
- principalAmount: z.ZodNullable<z.ZodNumber>;
765
- maxTotalRaise: z.ZodNullable<z.ZodNumber>;
766
688
  interestRate: z.ZodNullable<z.ZodNumber>;
767
- interestType: z.ZodNullable<z.ZodNativeEnum<typeof InterestType>>;
689
+ duration: z.ZodNullable<z.ZodNumber>;
690
+ durationType: z.ZodNullable<z.ZodNativeEnum<typeof DurationType>>;
768
691
  }, "strip", z.ZodTypeAny, {
769
692
  type: AssetType.PROMISSORY_NOTE;
770
693
  id: string;
@@ -774,10 +697,9 @@ export declare const PromissoryNoteAssetSchema: z.ZodObject<{
774
697
  issuerId: string | null;
775
698
  pricePerUnit: number | null;
776
699
  totalUnits: number | null;
777
- principalAmount: number | null;
778
- maxTotalRaise: number | null;
700
+ duration: number | null;
701
+ durationType: DurationType | null;
779
702
  interestRate: number | null;
780
- interestType: InterestType | null;
781
703
  }, {
782
704
  type: AssetType.PROMISSORY_NOTE;
783
705
  id: string;
@@ -787,10 +709,9 @@ export declare const PromissoryNoteAssetSchema: z.ZodObject<{
787
709
  issuerId: string | null;
788
710
  pricePerUnit: number | null;
789
711
  totalUnits: number | null;
790
- principalAmount: number | null;
791
- maxTotalRaise: number | null;
712
+ duration: number | null;
713
+ durationType: DurationType | null;
792
714
  interestRate: number | null;
793
- interestType: InterestType | null;
794
715
  }>;
795
716
  export type PromissoryNoteAssetSchema = z.infer<typeof PromissoryNoteAssetSchema>;
796
717
  declare const BondAssetSchema: z.ZodObject<{
@@ -907,10 +828,9 @@ export declare const AssetSummarySchema: z.ZodDiscriminatedUnion<"type", [z.ZodO
907
828
  totalUnits: z.ZodNullable<z.ZodNumber>;
908
829
  } & {
909
830
  type: z.ZodLiteral<AssetType.PROMISSORY_NOTE>;
910
- principalAmount: z.ZodNullable<z.ZodNumber>;
911
- maxTotalRaise: z.ZodNullable<z.ZodNumber>;
912
831
  interestRate: z.ZodNullable<z.ZodNumber>;
913
- interestType: z.ZodNullable<z.ZodNativeEnum<typeof InterestType>>;
832
+ duration: z.ZodNullable<z.ZodNumber>;
833
+ durationType: z.ZodNullable<z.ZodNativeEnum<typeof DurationType>>;
914
834
  }, "strip", z.ZodTypeAny, {
915
835
  type: AssetType.PROMISSORY_NOTE;
916
836
  id: string;
@@ -920,10 +840,9 @@ export declare const AssetSummarySchema: z.ZodDiscriminatedUnion<"type", [z.ZodO
920
840
  issuerId: string | null;
921
841
  pricePerUnit: number | null;
922
842
  totalUnits: number | null;
923
- principalAmount: number | null;
924
- maxTotalRaise: number | null;
843
+ duration: number | null;
844
+ durationType: DurationType | null;
925
845
  interestRate: number | null;
926
- interestType: InterestType | null;
927
846
  }, {
928
847
  type: AssetType.PROMISSORY_NOTE;
929
848
  id: string;
@@ -933,10 +852,9 @@ export declare const AssetSummarySchema: z.ZodDiscriminatedUnion<"type", [z.ZodO
933
852
  issuerId: string | null;
934
853
  pricePerUnit: number | null;
935
854
  totalUnits: number | null;
936
- principalAmount: number | null;
937
- maxTotalRaise: number | null;
855
+ duration: number | null;
856
+ durationType: DurationType | null;
938
857
  interestRate: number | null;
939
- interestType: InterestType | null;
940
858
  }>]>;
941
859
  export type AssetSummarySchema = z.infer<typeof AssetSummarySchema>;
942
860
  export declare const IPaginatedAssetSummary: z.ZodObject<{
@@ -1015,10 +933,9 @@ export declare const IPaginatedAssetSummary: z.ZodObject<{
1015
933
  totalUnits: z.ZodNullable<z.ZodNumber>;
1016
934
  } & {
1017
935
  type: z.ZodLiteral<AssetType.PROMISSORY_NOTE>;
1018
- principalAmount: z.ZodNullable<z.ZodNumber>;
1019
- maxTotalRaise: z.ZodNullable<z.ZodNumber>;
1020
936
  interestRate: z.ZodNullable<z.ZodNumber>;
1021
- interestType: z.ZodNullable<z.ZodNativeEnum<typeof InterestType>>;
937
+ duration: z.ZodNullable<z.ZodNumber>;
938
+ durationType: z.ZodNullable<z.ZodNativeEnum<typeof DurationType>>;
1022
939
  }, "strip", z.ZodTypeAny, {
1023
940
  type: AssetType.PROMISSORY_NOTE;
1024
941
  id: string;
@@ -1028,10 +945,9 @@ export declare const IPaginatedAssetSummary: z.ZodObject<{
1028
945
  issuerId: string | null;
1029
946
  pricePerUnit: number | null;
1030
947
  totalUnits: number | null;
1031
- principalAmount: number | null;
1032
- maxTotalRaise: number | null;
948
+ duration: number | null;
949
+ durationType: DurationType | null;
1033
950
  interestRate: number | null;
1034
- interestType: InterestType | null;
1035
951
  }, {
1036
952
  type: AssetType.PROMISSORY_NOTE;
1037
953
  id: string;
@@ -1041,10 +957,9 @@ export declare const IPaginatedAssetSummary: z.ZodObject<{
1041
957
  issuerId: string | null;
1042
958
  pricePerUnit: number | null;
1043
959
  totalUnits: number | null;
1044
- principalAmount: number | null;
1045
- maxTotalRaise: number | null;
960
+ duration: number | null;
961
+ durationType: DurationType | null;
1046
962
  interestRate: number | null;
1047
- interestType: InterestType | null;
1048
963
  }>]>, "many">;
1049
964
  meta: z.ZodObject<{
1050
965
  itemCount: z.ZodNumber;
@@ -1084,10 +999,9 @@ export declare const IPaginatedAssetSummary: z.ZodObject<{
1084
999
  issuerId: string | null;
1085
1000
  pricePerUnit: number | null;
1086
1001
  totalUnits: number | null;
1087
- principalAmount: number | null;
1088
- maxTotalRaise: number | null;
1002
+ duration: number | null;
1003
+ durationType: DurationType | null;
1089
1004
  interestRate: number | null;
1090
- interestType: InterestType | null;
1091
1005
  } | {
1092
1006
  type: AssetType.BOND | null;
1093
1007
  id: string;
@@ -1127,10 +1041,9 @@ export declare const IPaginatedAssetSummary: z.ZodObject<{
1127
1041
  issuerId: string | null;
1128
1042
  pricePerUnit: number | null;
1129
1043
  totalUnits: number | null;
1130
- principalAmount: number | null;
1131
- maxTotalRaise: number | null;
1044
+ duration: number | null;
1045
+ durationType: DurationType | null;
1132
1046
  interestRate: number | null;
1133
- interestType: InterestType | null;
1134
1047
  } | {
1135
1048
  type: AssetType.BOND | null;
1136
1049
  id: string;
@@ -1175,12 +1088,13 @@ export declare const AssetSummaryFiltersZod: z.ZodObject<{
1175
1088
  export type AssetSummaryFiltersZod = z.infer<typeof AssetSummaryFiltersZod>;
1176
1089
  /**
1177
1090
  * Maps asset types to fields that should be reset (nullified) when converting
1178
- * from one asset type to another. This ensures incompatible fields from the
1179
- * previous type are cleared when the asset type changes.
1091
+ * from one asset type to another. Derived from disjoint sets so required
1092
+ * fields for a type are never reset when converting to that type.
1180
1093
  */
1181
1094
  export declare const ASSET_TYPE_FIELD_RESETS: Record<AssetType, Partial<IAsset>>;
1182
1095
  /**
1183
1096
  * Maps asset types to their required fields when converting TO that asset type.
1097
+ * Derived from disjoint field sets for single source of truth.
1184
1098
  */
1185
1099
  export declare const ASSET_TYPE_REQUIRED_FIELDS: Record<AssetType, Array<keyof IAsset>>;
1186
1100
  export {};
@@ -23,11 +23,6 @@ export var AssetTemplateType;
23
23
  AssetTemplateType["STANDARD"] = "STANDARD";
24
24
  AssetTemplateType["TIERED"] = "TIERED";
25
25
  })(AssetTemplateType || (AssetTemplateType = {}));
26
- export var InterestType;
27
- (function (InterestType) {
28
- InterestType["SIMPLE"] = "SIMPLE";
29
- InterestType["COMPOUND"] = "COMPOUND";
30
- })(InterestType || (InterestType = {}));
31
26
  export const IAsset = IBaseEntity.extend({
32
27
  id: z.lazy(() => assetIdSchema),
33
28
  name: z.string(),
@@ -48,10 +43,7 @@ export const IAsset = IBaseEntity.extend({
48
43
  template: z.nativeEnum(AssetTemplateType),
49
44
  tiers: z.array(z.number().positive()).nullable(),
50
45
  enableBonus: z.boolean(),
51
- principalAmount: z.number().nullable(),
52
- maxTotalRaise: z.number().nullable(),
53
46
  interestRate: z.number().nullable(),
54
- interestType: z.nativeEnum(InterestType).nullable(),
55
47
  });
56
48
  export const IPaginatedAsset = z.object({
57
49
  items: z.array(IAsset),
@@ -100,22 +92,6 @@ const PostAssetBase = z.object({
100
92
  .openapi({ example: AssetTemplateType.STANDARD }),
101
93
  tiers: z.array(z.number().positive()).nullable().optional(),
102
94
  enableBonus: z.boolean().default(false).openapi({ example: false }),
103
- principalAmount: z
104
- .number()
105
- .int()
106
- .positive()
107
- .max(10000000000)
108
- .nullable()
109
- .optional()
110
- .openapi({ example: 1000 }),
111
- maxTotalRaise: z
112
- .number()
113
- .int()
114
- .positive()
115
- .max(10000000000)
116
- .nullable()
117
- .optional()
118
- .openapi({ example: 100 }),
119
95
  interestRate: z
120
96
  .number()
121
97
  .min(0.01)
@@ -123,22 +99,19 @@ const PostAssetBase = z.object({
123
99
  .nullable()
124
100
  .optional()
125
101
  .openapi({ example: 10 }),
126
- interestType: z
127
- .nativeEnum(InterestType)
128
- .nullable()
129
- .optional()
130
- .openapi({ example: InterestType.SIMPLE }),
131
102
  });
132
- const BOND_FIELDS = [
133
- 'yield',
103
+ const DEBT_COMMON_FIELDS = [
134
104
  'duration',
135
105
  'durationType',
136
106
  ];
137
- const PROMISSORY_NOTE_FIELDS = [
138
- 'principalAmount',
139
- 'maxTotalRaise',
107
+ const BOND_ONLY_FIELDS = ['yield'];
108
+ const PROMISSORY_NOTE_ONLY_FIELDS = [
140
109
  'interestRate',
141
- 'interestType',
110
+ ];
111
+ const ALL_DEBT_FIELDS = [
112
+ ...DEBT_COMMON_FIELDS,
113
+ ...BOND_ONLY_FIELDS,
114
+ ...PROMISSORY_NOTE_ONLY_FIELDS,
142
115
  ];
143
116
  // Field labels for better error messages
144
117
  const FIELD_LABELS = {
@@ -158,10 +131,7 @@ const FIELD_LABELS = {
158
131
  template: 'Template',
159
132
  tiers: 'Tiers',
160
133
  enableBonus: 'Enable bonus',
161
- principalAmount: 'Principal amount',
162
- maxTotalRaise: 'Max total raise',
163
134
  interestRate: 'Interest rate',
164
- interestType: 'Interest type',
165
135
  createdAt: 'Created at',
166
136
  updatedAt: 'Updated at',
167
137
  deletedAt: 'Deleted at',
@@ -198,23 +168,17 @@ export const postAssetRefinement = (data, ctx) => {
198
168
  const assetType = data.assetType || data.type;
199
169
  // BOND validation
200
170
  if (assetType === AssetType.BOND) {
201
- // Require bond-specific fields
202
- requireFields(BOND_FIELDS, data, ctx, AssetType.BOND);
203
- // Prohibit promissory note fields
204
- prohibitFields(PROMISSORY_NOTE_FIELDS, data, ctx, AssetType.BOND);
171
+ requireFields([...DEBT_COMMON_FIELDS, ...BOND_ONLY_FIELDS], data, ctx, AssetType.BOND);
172
+ prohibitFields(PROMISSORY_NOTE_ONLY_FIELDS, data, ctx, AssetType.BOND);
205
173
  }
206
174
  // PROMISSORY_NOTE validation
207
175
  if (assetType === AssetType.PROMISSORY_NOTE) {
208
- // Require promissory note-specific fields
209
- requireFields(PROMISSORY_NOTE_FIELDS, data, ctx, AssetType.PROMISSORY_NOTE);
210
- // Prohibit bond fields
211
- prohibitFields(BOND_FIELDS, data, ctx, AssetType.PROMISSORY_NOTE);
176
+ requireFields([...DEBT_COMMON_FIELDS, ...PROMISSORY_NOTE_ONLY_FIELDS], data, ctx, AssetType.PROMISSORY_NOTE);
177
+ prohibitFields(BOND_ONLY_FIELDS, data, ctx, AssetType.PROMISSORY_NOTE);
212
178
  }
213
179
  // STOCK validation
214
180
  if (assetType === AssetType.STOCK) {
215
- // Prohibit both bond and promissory note fields
216
- prohibitFields(BOND_FIELDS, data, ctx, AssetType.STOCK);
217
- prohibitFields(PROMISSORY_NOTE_FIELDS, data, ctx, AssetType.STOCK);
181
+ prohibitFields(ALL_DEBT_FIELDS, data, ctx, AssetType.STOCK);
218
182
  }
219
183
  // Template validation (applies to all asset types)
220
184
  if (data.template === AssetTemplateType.TIERED) {
@@ -285,22 +249,6 @@ export const PutAsset = z.object({
285
249
  .optional(),
286
250
  tiers: z.array(z.number().positive()).nullable().optional(),
287
251
  enableBonus: z.boolean().optional().openapi({ example: false }),
288
- principalAmount: z
289
- .number()
290
- .int()
291
- .positive()
292
- .max(10000000000)
293
- .nullable()
294
- .optional()
295
- .openapi({ example: 1000 }),
296
- maxTotalRaise: z
297
- .number()
298
- .int()
299
- .positive()
300
- .max(10000000000)
301
- .nullable()
302
- .optional()
303
- .openapi({ example: 100 }),
304
252
  interestRate: z
305
253
  .number()
306
254
  .min(0.01)
@@ -308,11 +256,6 @@ export const PutAsset = z.object({
308
256
  .nullable()
309
257
  .optional()
310
258
  .openapi({ example: 10 }),
311
- interestType: z
312
- .nativeEnum(InterestType)
313
- .nullable()
314
- .optional()
315
- .openapi({ example: InterestType.SIMPLE }),
316
259
  });
317
260
  export const CompliancePutAsset = PutAsset.merge(z.object({ accountId: accountIdSchema }));
318
261
  const assetsInclude = z.enum(['account', 'offering', 'bonusTiers']);
@@ -356,10 +299,9 @@ export const StockAssetSchema = BaseAssetSummarySchema.extend({
356
299
  });
357
300
  export const PromissoryNoteAssetSchema = BaseAssetSummarySchema.extend({
358
301
  type: z.literal(AssetType.PROMISSORY_NOTE),
359
- principalAmount: z.number().nullable(),
360
- maxTotalRaise: z.number().nullable(),
361
302
  interestRate: z.number().nullable(),
362
- interestType: z.nativeEnum(InterestType).nullable(),
303
+ duration: z.number().nullable(),
304
+ durationType: z.nativeEnum(DurationType).nullable(),
363
305
  });
364
306
  const BondAssetSchema = BaseAssetSummarySchema.extend({
365
307
  type: z.literal(AssetType.BOND).nullable(),
@@ -388,41 +330,23 @@ export const AssetSummaryFiltersZod = z.object({
388
330
  });
389
331
  /**
390
332
  * Maps asset types to fields that should be reset (nullified) when converting
391
- * from one asset type to another. This ensures incompatible fields from the
392
- * previous type are cleared when the asset type changes.
333
+ * from one asset type to another. Derived from disjoint sets so required
334
+ * fields for a type are never reset when converting to that type.
393
335
  */
394
336
  export const ASSET_TYPE_FIELD_RESETS = {
395
- [AssetType.STOCK]: {
396
- yield: null,
397
- durationType: null,
398
- duration: null,
399
- principalAmount: null,
400
- maxTotalRaise: null,
401
- interestRate: null,
402
- interestType: null,
403
- },
404
- [AssetType.PROMISSORY_NOTE]: {
405
- yield: null,
406
- durationType: null,
407
- duration: null,
408
- },
409
- [AssetType.BOND]: {
410
- principalAmount: null,
411
- maxTotalRaise: null,
412
- interestRate: null,
413
- interestType: null,
414
- },
337
+ [AssetType.STOCK]: Object.fromEntries(ALL_DEBT_FIELDS.map((f) => [f, null])),
338
+ [AssetType.PROMISSORY_NOTE]: Object.fromEntries(BOND_ONLY_FIELDS.map((f) => [f, null])),
339
+ [AssetType.BOND]: Object.fromEntries(PROMISSORY_NOTE_ONLY_FIELDS.map((f) => [f, null])),
415
340
  };
416
341
  /**
417
342
  * Maps asset types to their required fields when converting TO that asset type.
343
+ * Derived from disjoint field sets for single source of truth.
418
344
  */
419
345
  export const ASSET_TYPE_REQUIRED_FIELDS = {
420
- [AssetType.BOND]: ['yield', 'duration', 'durationType'],
346
+ [AssetType.BOND]: [...DEBT_COMMON_FIELDS, ...BOND_ONLY_FIELDS],
421
347
  [AssetType.PROMISSORY_NOTE]: [
422
- 'principalAmount',
423
- 'maxTotalRaise',
424
- 'interestRate',
425
- 'interestType',
348
+ ...DEBT_COMMON_FIELDS,
349
+ ...PROMISSORY_NOTE_ONLY_FIELDS,
426
350
  ],
427
351
  [AssetType.STOCK]: [],
428
352
  };