@dashevo/token-history-contract 2.0.0-dev.1 → 2.0.0-rc.2

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/Cargo.toml CHANGED
@@ -1,13 +1,13 @@
1
1
  [package]
2
2
  name = "token-history-contract"
3
3
  description = "Token history data contract schema and tools"
4
- version = "2.0.0-dev.1"
4
+ version = "2.0.0-rc.2"
5
5
  edition = "2021"
6
6
  rust-version.workspace = true
7
7
  license = "MIT"
8
8
 
9
9
  [dependencies]
10
- thiserror = "1.0.64"
10
+ thiserror = "2.0.12"
11
11
  platform-version = { path = "../rs-platform-version" }
12
12
  serde_json = { version = "1.0" }
13
13
  platform-value = { path = "../rs-platform-value" }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dashevo/token-history-contract",
3
- "version": "2.0.0-dev.1",
3
+ "version": "2.0.0-rc.2",
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": "2.0.0-dev.1",
19
+ "@dashevo/wasm-dpp": "2.0.0-rc.2",
20
20
  "chai": "^4.3.10",
21
21
  "dirty-chai": "^2.0.1",
22
22
  "eslint": "^8.53.0",
@@ -539,9 +539,6 @@
539
539
  {
540
540
  "tokenId": "asc"
541
541
  },
542
- {
543
- "recipientType": "asc"
544
- },
545
542
  {
546
543
  "recipientId": "asc"
547
544
  },
@@ -551,16 +548,13 @@
551
548
  ]
552
549
  },
553
550
  {
554
- "name": "byDistributionType",
551
+ "name": "byAmount",
555
552
  "properties": [
556
553
  {
557
554
  "tokenId": "asc"
558
555
  },
559
556
  {
560
- "distributionType": "asc"
561
- },
562
- {
563
- "$createdAt": "asc"
557
+ "amount": "asc"
564
558
  }
565
559
  ]
566
560
  }
@@ -593,7 +587,10 @@
593
587
  },
594
588
  "distributionType": {
595
589
  "type": "integer",
596
- "minimum": 0,
590
+ "enum": [
591
+ 0,
592
+ 1
593
+ ],
597
594
  "description": "The type of distribution (0: PreProgrammed, 1: Perpetual)",
598
595
  "position": 3
599
596
  },
@@ -674,7 +671,7 @@
674
671
  0,
675
672
  1
676
673
  ],
677
- "description": "The action we are performing. 0 - Pause, 1 - Resume",
674
+ "description": "The action we are performing (0: Pause, 1: Resume)",
678
675
  "position": 1
679
676
  }
680
677
  },
@@ -756,5 +753,152 @@
756
753
  "$createdAtBlockHeight"
757
754
  ],
758
755
  "additionalProperties": false
756
+ },
757
+ "directPricing": {
758
+ "type": "object",
759
+ "documentsMutable": false,
760
+ "canBeDeleted": false,
761
+ "creationRestrictionMode": 2,
762
+ "indices": [
763
+ {
764
+ "name": "byDate",
765
+ "properties": [
766
+ {
767
+ "tokenId": "asc"
768
+ },
769
+ {
770
+ "$createdAt": "asc"
771
+ }
772
+ ]
773
+ }
774
+ ],
775
+ "properties": {
776
+ "tokenId": {
777
+ "type": "array",
778
+ "byteArray": true,
779
+ "minItems": 32,
780
+ "maxItems": 32,
781
+ "description": "The token ID",
782
+ "position": 0,
783
+ "contentMediaType": "application/x.dash.dpp.identifier"
784
+ },
785
+ "priceSchedule": {
786
+ "type": "array",
787
+ "byteArray": true,
788
+ "minItems": 1,
789
+ "maxItems": 2048,
790
+ "description": "The serialized price schedule for direct token purchases",
791
+ "position": 1
792
+ },
793
+ "note": {
794
+ "type": "string",
795
+ "maxLength": 2048,
796
+ "description": "An optional note explaining the pricing change",
797
+ "position": 2
798
+ }
799
+ },
800
+ "required": [
801
+ "tokenId",
802
+ "$createdAt",
803
+ "$createdAtBlockHeight"
804
+ ],
805
+ "additionalProperties": false
806
+ },
807
+ "directPurchase": {
808
+ "type": "object",
809
+ "documentsMutable": false,
810
+ "canBeDeleted": false,
811
+ "creationRestrictionMode": 2,
812
+ "indices": [
813
+ {
814
+ "name": "byDate",
815
+ "properties": [
816
+ {
817
+ "tokenId": "asc"
818
+ },
819
+ {
820
+ "$createdAt": "asc"
821
+ }
822
+ ]
823
+ },
824
+ {
825
+ "name": "byOwnerIdForToken",
826
+ "properties": [
827
+ {
828
+ "tokenId": "asc"
829
+ },
830
+ {
831
+ "$ownerId": "asc"
832
+ },
833
+ {
834
+ "$createdAt": "asc"
835
+ }
836
+ ]
837
+ },
838
+ {
839
+ "name": "byOwnerId",
840
+ "properties": [
841
+ {
842
+ "$ownerId": "asc"
843
+ },
844
+ {
845
+ "$createdAt": "asc"
846
+ }
847
+ ]
848
+ },
849
+ {
850
+ "name": "byPurchaseCost",
851
+ "properties": [
852
+ {
853
+ "purchaseCost": "asc"
854
+ }
855
+ ]
856
+ },
857
+ {
858
+ "name": "byTokenAmount",
859
+ "properties": [
860
+ {
861
+ "tokenId": "asc"
862
+ },
863
+ {
864
+ "tokenAmount": "asc"
865
+ },
866
+ {
867
+ "$createdAt": "asc"
868
+ }
869
+ ]
870
+ }
871
+ ],
872
+ "properties": {
873
+ "tokenId": {
874
+ "type": "array",
875
+ "byteArray": true,
876
+ "minItems": 32,
877
+ "maxItems": 32,
878
+ "description": "The token ID",
879
+ "position": 0,
880
+ "contentMediaType": "application/x.dash.dpp.identifier"
881
+ },
882
+ "tokenAmount": {
883
+ "type": "integer",
884
+ "minimum": 1,
885
+ "description": "The number of tokens purchased",
886
+ "position": 1
887
+ },
888
+ "purchaseCost": {
889
+ "type": "integer",
890
+ "minimum": 0,
891
+ "description": "The cost paid for the tokens in credits",
892
+ "position": 2
893
+ }
894
+ },
895
+ "required": [
896
+ "tokenId",
897
+ "tokenAmount",
898
+ "purchaseCost",
899
+ "$createdAt",
900
+ "$createdAtBlockHeight"
901
+ ],
902
+ "additionalProperties": false
759
903
  }
760
- }
904
+ }
package/src/lib.rs CHANGED
@@ -16,20 +16,20 @@ pub const OWNER_ID_BYTES: [u8; 32] = [0; 32];
16
16
  pub const ID: Identifier = Identifier(IdentifierBytes32(ID_BYTES));
17
17
  pub const OWNER_ID: Identifier = Identifier(IdentifierBytes32(OWNER_ID_BYTES));
18
18
  pub fn load_definitions(platform_version: &PlatformVersion) -> Result<Option<Value>, Error> {
19
- match platform_version.system_data_contracts.withdrawals {
19
+ match platform_version.system_data_contracts.token_history {
20
20
  1 => Ok(None),
21
21
  version => Err(Error::UnknownVersionMismatch {
22
- method: "wallet_contract::load_definitions".to_string(),
22
+ method: "token_history_contract::load_definitions".to_string(),
23
23
  known_versions: vec![1],
24
24
  received: version,
25
25
  }),
26
26
  }
27
27
  }
28
28
  pub fn load_documents_schemas(platform_version: &PlatformVersion) -> Result<Value, Error> {
29
- match platform_version.system_data_contracts.withdrawals {
29
+ match platform_version.system_data_contracts.token_history {
30
30
  1 => v1::load_documents_schemas(),
31
31
  version => Err(Error::UnknownVersionMismatch {
32
- method: "wallet_contract::load_documents_schemas".to_string(),
32
+ method: "token_history_contract::load_documents_schemas".to_string(),
33
33
  known_versions: vec![1],
34
34
  received: version,
35
35
  }),