@dashevo/token-history-contract 4.2.0-dev.8 → 5.0.0-beta.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dashevo/token-history-contract",
3
- "version": "4.2.0-dev.8",
3
+ "version": "5.0.0-beta.1",
4
4
  "description": "The token history contract",
5
5
  "scripts": {
6
6
  "lint": "eslint .",
@@ -16,7 +16,7 @@
16
16
  ],
17
17
  "license": "MIT",
18
18
  "devDependencies": {
19
- "@dashevo/wasm-dpp": "4.2.0-dev.8",
19
+ "@dashevo/wasm-dpp": "5.0.0-beta.1",
20
20
  "chai": "^4.3.10",
21
21
  "dirty-chai": "^2.0.1",
22
22
  "eslint": "^9.18.0",
@@ -0,0 +1,960 @@
1
+ {
2
+ "burn": {
3
+ "type": "object",
4
+ "documentsMutable": false,
5
+ "canBeDeleted": false,
6
+ "creationRestrictionMode": 2,
7
+ "indices": [
8
+ {
9
+ "name": "byDate",
10
+ "properties": [
11
+ {
12
+ "tokenId": "asc"
13
+ },
14
+ {
15
+ "$createdAt": "asc"
16
+ }
17
+ ]
18
+ },
19
+ {
20
+ "name": "byAmount",
21
+ "properties": [
22
+ {
23
+ "tokenId": "asc"
24
+ },
25
+ {
26
+ "amount": "asc"
27
+ }
28
+ ]
29
+ },
30
+ {
31
+ "name": "byOwnerId",
32
+ "properties": [
33
+ {
34
+ "tokenId": "asc"
35
+ },
36
+ {
37
+ "$ownerId": "asc"
38
+ },
39
+ {
40
+ "$createdAt": "asc"
41
+ }
42
+ ]
43
+ },
44
+ {
45
+ "name": "byBurnFromId",
46
+ "properties": [
47
+ {
48
+ "tokenId": "asc"
49
+ },
50
+ {
51
+ "burnFromId": "asc"
52
+ },
53
+ {
54
+ "$createdAt": "asc"
55
+ }
56
+ ]
57
+ }
58
+ ],
59
+ "properties": {
60
+ "tokenId": {
61
+ "type": "array",
62
+ "byteArray": true,
63
+ "minItems": 32,
64
+ "maxItems": 32,
65
+ "description": "The token ID",
66
+ "position": 0,
67
+ "contentMediaType": "application/x.dash.dpp.identifier"
68
+ },
69
+ "burnFromId": {
70
+ "type": "array",
71
+ "byteArray": true,
72
+ "minItems": 32,
73
+ "maxItems": 32,
74
+ "description": "The identifier of the identity from which tokens will be burned",
75
+ "position": 1,
76
+ "contentMediaType": "application/x.dash.dpp.identifier"
77
+ },
78
+ "amount": {
79
+ "type": "integer",
80
+ "minimum": 0,
81
+ "description": "The amount that was burned",
82
+ "position": 2
83
+ },
84
+ "note": {
85
+ "type": "string",
86
+ "maxLength": 2048,
87
+ "description": "An optional explanation of why this burn took place",
88
+ "position": 3
89
+ }
90
+ },
91
+ "required": [
92
+ "tokenId",
93
+ "burnFromId",
94
+ "amount",
95
+ "$createdAt",
96
+ "$createdAtBlockHeight"
97
+ ],
98
+ "additionalProperties": false
99
+ },
100
+ "mint": {
101
+ "type": "object",
102
+ "documentsMutable": false,
103
+ "canBeDeleted": false,
104
+ "creationRestrictionMode": 2,
105
+ "indices": [
106
+ {
107
+ "name": "byDate",
108
+ "properties": [
109
+ {
110
+ "tokenId": "asc"
111
+ },
112
+ {
113
+ "$createdAt": "asc"
114
+ }
115
+ ]
116
+ },
117
+ {
118
+ "name": "byAmount",
119
+ "properties": [
120
+ {
121
+ "tokenId": "asc"
122
+ },
123
+ {
124
+ "amount": "asc"
125
+ }
126
+ ]
127
+ },
128
+ {
129
+ "name": "byOwnerId",
130
+ "properties": [
131
+ {
132
+ "tokenId": "asc"
133
+ },
134
+ {
135
+ "$ownerId": "asc"
136
+ },
137
+ {
138
+ "$createdAt": "asc"
139
+ }
140
+ ]
141
+ },
142
+ {
143
+ "name": "byRecipientId",
144
+ "properties": [
145
+ {
146
+ "tokenId": "asc"
147
+ },
148
+ {
149
+ "recipientId": "asc"
150
+ },
151
+ {
152
+ "$createdAt": "asc"
153
+ }
154
+ ]
155
+ }
156
+ ],
157
+ "properties": {
158
+ "tokenId": {
159
+ "type": "array",
160
+ "byteArray": true,
161
+ "minItems": 32,
162
+ "maxItems": 32,
163
+ "description": "The token ID",
164
+ "position": 0,
165
+ "contentMediaType": "application/x.dash.dpp.identifier"
166
+ },
167
+ "recipientId": {
168
+ "type": "array",
169
+ "byteArray": true,
170
+ "minItems": 32,
171
+ "maxItems": 32,
172
+ "description": "The recipient ID",
173
+ "position": 1,
174
+ "contentMediaType": "application/x.dash.dpp.identifier"
175
+ },
176
+ "amount": {
177
+ "type": "integer",
178
+ "minimum": 0,
179
+ "description": "The amount that was minted",
180
+ "position": 2
181
+ },
182
+ "note": {
183
+ "type": "string",
184
+ "maxLength": 2048,
185
+ "description": "An optional explanation of why this mint took place",
186
+ "position": 3
187
+ }
188
+ },
189
+ "required": [
190
+ "tokenId",
191
+ "amount",
192
+ "recipientId",
193
+ "$createdAt",
194
+ "$createdAtBlockHeight"
195
+ ],
196
+ "additionalProperties": false
197
+ },
198
+ "transfer": {
199
+ "type": "object",
200
+ "documentsMutable": false,
201
+ "canBeDeleted": false,
202
+ "creationRestrictionMode": 2,
203
+ "indices": [
204
+ {
205
+ "name": "byDate",
206
+ "properties": [
207
+ {
208
+ "tokenId": "asc"
209
+ },
210
+ {
211
+ "$createdAt": "asc"
212
+ }
213
+ ]
214
+ },
215
+ {
216
+ "name": "byAmount",
217
+ "properties": [
218
+ {
219
+ "tokenId": "asc"
220
+ },
221
+ {
222
+ "amount": "asc"
223
+ }
224
+ ]
225
+ },
226
+ {
227
+ "name": "from",
228
+ "properties": [
229
+ {
230
+ "tokenId": "asc"
231
+ },
232
+ {
233
+ "$ownerId": "asc"
234
+ },
235
+ {
236
+ "$createdAt": "asc"
237
+ }
238
+ ]
239
+ },
240
+ {
241
+ "name": "to",
242
+ "properties": [
243
+ {
244
+ "tokenId": "asc"
245
+ },
246
+ {
247
+ "toIdentityId": "asc"
248
+ },
249
+ {
250
+ "$createdAt": "asc"
251
+ }
252
+ ]
253
+ }
254
+ ],
255
+ "properties": {
256
+ "tokenId": {
257
+ "type": "array",
258
+ "byteArray": true,
259
+ "minItems": 32,
260
+ "maxItems": 32,
261
+ "description": "The token ID",
262
+ "position": 0,
263
+ "contentMediaType": "application/x.dash.dpp.identifier"
264
+ },
265
+ "amount": {
266
+ "type": "integer",
267
+ "minimum": 0,
268
+ "description": "The amount that was burned",
269
+ "position": 1
270
+ },
271
+ "toIdentityId": {
272
+ "type": "array",
273
+ "byteArray": true,
274
+ "minItems": 32,
275
+ "maxItems": 32,
276
+ "description": "The identity or the group Id",
277
+ "position": 2,
278
+ "contentMediaType": "application/x.dash.dpp.identifier"
279
+ },
280
+ "encryptedPersonalNote": {
281
+ "type": "array",
282
+ "byteArray": true,
283
+ "minItems": 32,
284
+ "maxItems": 2048,
285
+ "description": "An optional encrypted explanation of why this transfer took place only meant for the sender",
286
+ "position": 3
287
+ },
288
+ "encryptedSharedNote": {
289
+ "type": "array",
290
+ "byteArray": true,
291
+ "minItems": 32,
292
+ "maxItems": 2048,
293
+ "description": "An optional encrypted explanation of why this transfer took place shared between the sender and the receiver",
294
+ "position": 4
295
+ },
296
+ "publicNote": {
297
+ "type": "string",
298
+ "maxLength": 2048,
299
+ "description": "An optional public explanation of why this transfer took place",
300
+ "position": 5
301
+ },
302
+ "senderKeyIndex": {
303
+ "type": "integer",
304
+ "minimum": 0,
305
+ "description": "Used with the encrypted shared note",
306
+ "position": 6
307
+ },
308
+ "recipientKeyIndex": {
309
+ "type": "integer",
310
+ "minimum": 0,
311
+ "description": "Used with the encrypted shared note",
312
+ "position": 7
313
+ },
314
+ "rootEncryptionKeyIndex": {
315
+ "type": "integer",
316
+ "minimum": 0,
317
+ "description": "Used with the encrypted private note",
318
+ "position": 8
319
+ },
320
+ "derivationEncryptionKeyIndex": {
321
+ "type": "integer",
322
+ "minimum": 0,
323
+ "description": "Used with the encrypted private note",
324
+ "position": 9
325
+ }
326
+ },
327
+ "required": [
328
+ "tokenId",
329
+ "amount",
330
+ "toIdentityId",
331
+ "$createdAt",
332
+ "$createdAtBlockHeight"
333
+ ],
334
+ "additionalProperties": false
335
+ },
336
+ "freeze": {
337
+ "type": "object",
338
+ "documentsMutable": false,
339
+ "canBeDeleted": false,
340
+ "creationRestrictionMode": 2,
341
+ "indices": [
342
+ {
343
+ "name": "byOwnerId",
344
+ "properties": [
345
+ {
346
+ "tokenId": "asc"
347
+ },
348
+ {
349
+ "$ownerId": "asc"
350
+ },
351
+ {
352
+ "$createdAt": "asc"
353
+ }
354
+ ]
355
+ },
356
+ {
357
+ "name": "byFrozenIdentityId",
358
+ "properties": [
359
+ {
360
+ "tokenId": "asc"
361
+ },
362
+ {
363
+ "frozenIdentityId": "asc"
364
+ },
365
+ {
366
+ "$createdAt": "asc"
367
+ }
368
+ ]
369
+ }
370
+ ],
371
+ "properties": {
372
+ "tokenId": {
373
+ "type": "array",
374
+ "byteArray": true,
375
+ "minItems": 32,
376
+ "maxItems": 32,
377
+ "description": "The token ID",
378
+ "position": 0,
379
+ "contentMediaType": "application/x.dash.dpp.identifier"
380
+ },
381
+ "frozenIdentityId": {
382
+ "type": "array",
383
+ "byteArray": true,
384
+ "minItems": 32,
385
+ "maxItems": 32,
386
+ "description": "The identity Id of the frozen token account",
387
+ "position": 1,
388
+ "contentMediaType": "application/x.dash.dpp.identifier"
389
+ },
390
+ "note": {
391
+ "type": "string",
392
+ "maxLength": 2048,
393
+ "description": "An optional explanation for this identity freeze",
394
+ "position": 2
395
+ }
396
+ },
397
+ "required": [
398
+ "tokenId",
399
+ "frozenIdentityId",
400
+ "$createdAt",
401
+ "$createdAtBlockHeight"
402
+ ],
403
+ "additionalProperties": false
404
+ },
405
+ "unfreeze": {
406
+ "type": "object",
407
+ "documentsMutable": false,
408
+ "canBeDeleted": false,
409
+ "creationRestrictionMode": 2,
410
+ "indices": [
411
+ {
412
+ "name": "byOwnerId",
413
+ "properties": [
414
+ {
415
+ "tokenId": "asc"
416
+ },
417
+ {
418
+ "$ownerId": "asc"
419
+ },
420
+ {
421
+ "$createdAt": "asc"
422
+ }
423
+ ]
424
+ },
425
+ {
426
+ "name": "byFrozenIdentityId",
427
+ "properties": [
428
+ {
429
+ "tokenId": "asc"
430
+ },
431
+ {
432
+ "frozenIdentityId": "asc"
433
+ },
434
+ {
435
+ "$createdAt": "asc"
436
+ }
437
+ ]
438
+ }
439
+ ],
440
+ "properties": {
441
+ "tokenId": {
442
+ "type": "array",
443
+ "byteArray": true,
444
+ "minItems": 32,
445
+ "maxItems": 32,
446
+ "description": "The token ID",
447
+ "position": 0,
448
+ "contentMediaType": "application/x.dash.dpp.identifier"
449
+ },
450
+ "frozenIdentityId": {
451
+ "type": "array",
452
+ "byteArray": true,
453
+ "minItems": 32,
454
+ "maxItems": 32,
455
+ "description": "The identity Id of the frozen token account",
456
+ "position": 1,
457
+ "contentMediaType": "application/x.dash.dpp.identifier"
458
+ },
459
+ "note": {
460
+ "type": "string",
461
+ "maxLength": 2048,
462
+ "description": "An optional explanation for this identity unfreeze",
463
+ "position": 2
464
+ }
465
+ },
466
+ "required": [
467
+ "tokenId",
468
+ "frozenIdentityId",
469
+ "$createdAt",
470
+ "$createdAtBlockHeight"
471
+ ],
472
+ "additionalProperties": false
473
+ },
474
+ "destroyFrozenFunds": {
475
+ "type": "object",
476
+ "documentsMutable": false,
477
+ "canBeDeleted": false,
478
+ "creationRestrictionMode": 2,
479
+ "indices": [
480
+ {
481
+ "name": "byOwnerId",
482
+ "properties": [
483
+ {
484
+ "tokenId": "asc"
485
+ },
486
+ {
487
+ "$ownerId": "asc"
488
+ },
489
+ {
490
+ "$createdAt": "asc"
491
+ }
492
+ ]
493
+ },
494
+ {
495
+ "name": "byAmount",
496
+ "properties": [
497
+ {
498
+ "tokenId": "asc"
499
+ },
500
+ {
501
+ "destroyedAmount": "asc"
502
+ }
503
+ ]
504
+ },
505
+ {
506
+ "name": "byFrozenIdentityId",
507
+ "properties": [
508
+ {
509
+ "tokenId": "asc"
510
+ },
511
+ {
512
+ "frozenIdentityId": "asc"
513
+ },
514
+ {
515
+ "$createdAt": "asc"
516
+ }
517
+ ]
518
+ }
519
+ ],
520
+ "properties": {
521
+ "tokenId": {
522
+ "type": "array",
523
+ "byteArray": true,
524
+ "minItems": 32,
525
+ "maxItems": 32,
526
+ "description": "The token ID",
527
+ "position": 0,
528
+ "contentMediaType": "application/x.dash.dpp.identifier"
529
+ },
530
+ "frozenIdentityId": {
531
+ "type": "array",
532
+ "byteArray": true,
533
+ "minItems": 32,
534
+ "maxItems": 32,
535
+ "description": "The identity Id of the frozen token account",
536
+ "position": 1,
537
+ "contentMediaType": "application/x.dash.dpp.identifier"
538
+ },
539
+ "destroyedAmount": {
540
+ "type": "integer",
541
+ "minimum": 0,
542
+ "description": "The amount that was frost burned",
543
+ "position": 2
544
+ },
545
+ "note": {
546
+ "type": "string",
547
+ "maxLength": 2048,
548
+ "description": "An optional explanation for destroying these frozen funds",
549
+ "position": 3
550
+ }
551
+ },
552
+ "required": [
553
+ "tokenId",
554
+ "frozenIdentityId",
555
+ "destroyedAmount",
556
+ "$createdAt",
557
+ "$createdAtBlockHeight"
558
+ ],
559
+ "additionalProperties": false
560
+ },
561
+ "claim": {
562
+ "type": "object",
563
+ "documentsMutable": false,
564
+ "canBeDeleted": false,
565
+ "creationRestrictionMode": 2,
566
+ "indices": [
567
+ {
568
+ "name": "byDate",
569
+ "properties": [
570
+ {
571
+ "tokenId": "asc"
572
+ },
573
+ {
574
+ "$createdAt": "asc"
575
+ }
576
+ ]
577
+ },
578
+ {
579
+ "name": "byRecipient",
580
+ "properties": [
581
+ {
582
+ "tokenId": "asc"
583
+ },
584
+ {
585
+ "recipientId": "asc"
586
+ },
587
+ {
588
+ "$createdAt": "asc"
589
+ }
590
+ ]
591
+ },
592
+ {
593
+ "name": "byAmount",
594
+ "properties": [
595
+ {
596
+ "tokenId": "asc"
597
+ },
598
+ {
599
+ "amount": "asc"
600
+ }
601
+ ]
602
+ }
603
+ ],
604
+ "properties": {
605
+ "tokenId": {
606
+ "type": "array",
607
+ "byteArray": true,
608
+ "minItems": 32,
609
+ "maxItems": 32,
610
+ "description": "The token ID",
611
+ "position": 0,
612
+ "contentMediaType": "application/x.dash.dpp.identifier"
613
+ },
614
+ "recipientType": {
615
+ "type": "integer",
616
+ "minimum": 0,
617
+ "maximum": 2,
618
+ "description": "Recipient type: 0 = ContractOwner, 1 = Identity, 2 = EvonodesByParticipation. A once-per-identity claim records 1 = Identity with the claimant as recipientId.",
619
+ "position": 1
620
+ },
621
+ "recipientId": {
622
+ "type": "array",
623
+ "byteArray": true,
624
+ "minItems": 32,
625
+ "maxItems": 32,
626
+ "description": "An identity ID for direct recipient distributions",
627
+ "contentMediaType": "application/x.dash.dpp.identifier",
628
+ "position": 2
629
+ },
630
+ "distributionType": {
631
+ "type": "integer",
632
+ "enum": [
633
+ 0,
634
+ 1,
635
+ 2
636
+ ],
637
+ "description": "The type of distribution (0: PreProgrammed, 1: Perpetual, 2: OncePerIdentity)",
638
+ "position": 3
639
+ },
640
+ "amount": {
641
+ "type": "integer",
642
+ "minimum": 0,
643
+ "description": "The amount of tokens released",
644
+ "position": 4
645
+ },
646
+ "note": {
647
+ "type": "string",
648
+ "maxLength": 2048,
649
+ "description": "An optional explanation for this release",
650
+ "position": 5
651
+ }
652
+ },
653
+ "required": [
654
+ "tokenId",
655
+ "recipientType",
656
+ "recipientId",
657
+ "distributionType",
658
+ "amount",
659
+ "$createdAt",
660
+ "$createdAtBlockHeight"
661
+ ],
662
+ "additionalProperties": false
663
+ },
664
+ "emergencyAction": {
665
+ "type": "object",
666
+ "documentsMutable": false,
667
+ "canBeDeleted": false,
668
+ "creationRestrictionMode": 2,
669
+ "indices": [
670
+ {
671
+ "name": "byOwnerId",
672
+ "properties": [
673
+ {
674
+ "tokenId": "asc"
675
+ },
676
+ {
677
+ "$ownerId": "asc"
678
+ },
679
+ {
680
+ "action": "asc"
681
+ },
682
+ {
683
+ "$createdAt": "asc"
684
+ }
685
+ ]
686
+ },
687
+ {
688
+ "name": "byAction",
689
+ "properties": [
690
+ {
691
+ "tokenId": "asc"
692
+ },
693
+ {
694
+ "action": "asc"
695
+ },
696
+ {
697
+ "$createdAt": "asc"
698
+ }
699
+ ]
700
+ }
701
+ ],
702
+ "properties": {
703
+ "tokenId": {
704
+ "type": "array",
705
+ "byteArray": true,
706
+ "minItems": 32,
707
+ "maxItems": 32,
708
+ "description": "The token ID",
709
+ "position": 0,
710
+ "contentMediaType": "application/x.dash.dpp.identifier"
711
+ },
712
+ "action": {
713
+ "type": "integer",
714
+ "enum": [
715
+ 0,
716
+ 1
717
+ ],
718
+ "description": "The action we are performing (0: Pause, 1: Resume)",
719
+ "position": 1
720
+ },
721
+ "note": {
722
+ "type": "string",
723
+ "maxLength": 2048,
724
+ "description": "An optional explanation for this emergency action",
725
+ "position": 2
726
+ }
727
+ },
728
+ "required": [
729
+ "tokenId",
730
+ "action",
731
+ "$createdAt",
732
+ "$createdAtBlockHeight"
733
+ ],
734
+ "additionalProperties": false
735
+ },
736
+ "configUpdate": {
737
+ "type": "object",
738
+ "documentsMutable": false,
739
+ "canBeDeleted": false,
740
+ "creationRestrictionMode": 2,
741
+ "indices": [
742
+ {
743
+ "name": "byOwnerId",
744
+ "properties": [
745
+ {
746
+ "tokenId": "asc"
747
+ },
748
+ {
749
+ "$ownerId": "asc"
750
+ },
751
+ {
752
+ "changeItemType": "asc"
753
+ },
754
+ {
755
+ "$createdAt": "asc"
756
+ }
757
+ ]
758
+ },
759
+ {
760
+ "name": "byChangeItemType",
761
+ "properties": [
762
+ {
763
+ "tokenId": "asc"
764
+ },
765
+ {
766
+ "changeItemType": "asc"
767
+ },
768
+ {
769
+ "$createdAt": "asc"
770
+ }
771
+ ]
772
+ }
773
+ ],
774
+ "properties": {
775
+ "tokenId": {
776
+ "type": "array",
777
+ "byteArray": true,
778
+ "minItems": 32,
779
+ "maxItems": 32,
780
+ "description": "The token ID",
781
+ "position": 0,
782
+ "contentMediaType": "application/x.dash.dpp.identifier"
783
+ },
784
+ "changeItemType": {
785
+ "type": "integer",
786
+ "minimum": 0,
787
+ "description": "The action we are performing",
788
+ "position": 1
789
+ },
790
+ "changeItem": {
791
+ "type": "array",
792
+ "byteArray": true,
793
+ "minItems": 1,
794
+ "description": "The change item in serialized form",
795
+ "position": 2
796
+ },
797
+ "note": {
798
+ "type": "string",
799
+ "maxLength": 2048,
800
+ "description": "An optional explanation for this config update",
801
+ "position": 3
802
+ }
803
+ },
804
+ "required": [
805
+ "tokenId",
806
+ "changeItemType",
807
+ "changeItem",
808
+ "$createdAt",
809
+ "$createdAtBlockHeight"
810
+ ],
811
+ "additionalProperties": false
812
+ },
813
+ "directPricing": {
814
+ "type": "object",
815
+ "documentsMutable": false,
816
+ "canBeDeleted": false,
817
+ "creationRestrictionMode": 2,
818
+ "indices": [
819
+ {
820
+ "name": "byDate",
821
+ "properties": [
822
+ {
823
+ "tokenId": "asc"
824
+ },
825
+ {
826
+ "$createdAt": "asc"
827
+ }
828
+ ]
829
+ }
830
+ ],
831
+ "properties": {
832
+ "tokenId": {
833
+ "type": "array",
834
+ "byteArray": true,
835
+ "minItems": 32,
836
+ "maxItems": 32,
837
+ "description": "The token ID",
838
+ "position": 0,
839
+ "contentMediaType": "application/x.dash.dpp.identifier"
840
+ },
841
+ "priceSchedule": {
842
+ "type": "array",
843
+ "byteArray": true,
844
+ "minItems": 1,
845
+ "maxItems": 2048,
846
+ "description": "The serialized price schedule for direct token purchases",
847
+ "position": 1
848
+ },
849
+ "note": {
850
+ "type": "string",
851
+ "maxLength": 2048,
852
+ "description": "An optional explanation for the pricing change",
853
+ "position": 2
854
+ }
855
+ },
856
+ "required": [
857
+ "tokenId",
858
+ "$createdAt",
859
+ "$createdAtBlockHeight"
860
+ ],
861
+ "additionalProperties": false
862
+ },
863
+ "directPurchase": {
864
+ "type": "object",
865
+ "documentsMutable": false,
866
+ "canBeDeleted": false,
867
+ "creationRestrictionMode": 2,
868
+ "indices": [
869
+ {
870
+ "name": "byDate",
871
+ "properties": [
872
+ {
873
+ "tokenId": "asc"
874
+ },
875
+ {
876
+ "$createdAt": "asc"
877
+ }
878
+ ]
879
+ },
880
+ {
881
+ "name": "byOwnerIdForToken",
882
+ "properties": [
883
+ {
884
+ "tokenId": "asc"
885
+ },
886
+ {
887
+ "$ownerId": "asc"
888
+ },
889
+ {
890
+ "$createdAt": "asc"
891
+ }
892
+ ]
893
+ },
894
+ {
895
+ "name": "byOwnerId",
896
+ "properties": [
897
+ {
898
+ "$ownerId": "asc"
899
+ },
900
+ {
901
+ "$createdAt": "asc"
902
+ }
903
+ ]
904
+ },
905
+ {
906
+ "name": "byPurchaseCost",
907
+ "properties": [
908
+ {
909
+ "purchaseCost": "asc"
910
+ }
911
+ ]
912
+ },
913
+ {
914
+ "name": "byTokenAmount",
915
+ "properties": [
916
+ {
917
+ "tokenId": "asc"
918
+ },
919
+ {
920
+ "tokenAmount": "asc"
921
+ },
922
+ {
923
+ "$createdAt": "asc"
924
+ }
925
+ ]
926
+ }
927
+ ],
928
+ "properties": {
929
+ "tokenId": {
930
+ "type": "array",
931
+ "byteArray": true,
932
+ "minItems": 32,
933
+ "maxItems": 32,
934
+ "description": "The token ID",
935
+ "position": 0,
936
+ "contentMediaType": "application/x.dash.dpp.identifier"
937
+ },
938
+ "tokenAmount": {
939
+ "type": "integer",
940
+ "minimum": 1,
941
+ "description": "The number of tokens purchased",
942
+ "position": 1
943
+ },
944
+ "purchaseCost": {
945
+ "type": "integer",
946
+ "minimum": 0,
947
+ "description": "The cost paid for the tokens in credits",
948
+ "position": 2
949
+ }
950
+ },
951
+ "required": [
952
+ "tokenId",
953
+ "tokenAmount",
954
+ "purchaseCost",
955
+ "$createdAt",
956
+ "$createdAtBlockHeight"
957
+ ],
958
+ "additionalProperties": false
959
+ }
960
+ }
package/src/lib.rs CHANGED
@@ -1,5 +1,8 @@
1
1
  mod error;
2
2
  pub mod v1;
3
+ /// Version 2 (protocol version 14): the `claim` document's `distributionType` admits the value 2
4
+ /// (OncePerIdentity), written for once-per-identity distribution claims.
5
+ pub mod v2;
3
6
 
4
7
  pub use crate::error::Error;
5
8
  use platform_value::{Identifier, IdentifierBytes32};
@@ -17,10 +20,10 @@ pub const ID: Identifier = Identifier(IdentifierBytes32(ID_BYTES));
17
20
  pub const OWNER_ID: Identifier = Identifier(IdentifierBytes32(OWNER_ID_BYTES));
18
21
  pub fn load_definitions(platform_version: &PlatformVersion) -> Result<Option<Value>, Error> {
19
22
  match platform_version.system_data_contracts.token_history {
20
- 1 => Ok(None),
23
+ 1 | 2 => Ok(None),
21
24
  version => Err(Error::UnknownVersionMismatch {
22
25
  method: "token_history_contract::load_definitions".to_string(),
23
- known_versions: vec![1],
26
+ known_versions: vec![1, 2],
24
27
  received: version,
25
28
  }),
26
29
  }
@@ -28,9 +31,10 @@ pub fn load_definitions(platform_version: &PlatformVersion) -> Result<Option<Val
28
31
  pub fn load_documents_schemas(platform_version: &PlatformVersion) -> Result<Value, Error> {
29
32
  match platform_version.system_data_contracts.token_history {
30
33
  1 => v1::load_documents_schemas(),
34
+ 2 => v2::load_documents_schemas(),
31
35
  version => Err(Error::UnknownVersionMismatch {
32
36
  method: "token_history_contract::load_documents_schemas".to_string(),
33
- known_versions: vec![1],
37
+ known_versions: vec![1, 2],
34
38
  received: version,
35
39
  }),
36
40
  }
package/src/v2/mod.rs ADDED
@@ -0,0 +1,9 @@
1
+ use crate::Error;
2
+ use serde_json::Value;
3
+
4
+ pub fn load_documents_schemas() -> Result<Value, Error> {
5
+ serde_json::from_str(include_str!(
6
+ "../../schema/v2/token-history-contract-documents.json"
7
+ ))
8
+ .map_err(Error::InvalidSchemaJson)
9
+ }