Skip to content

Commit

Permalink
revert(dpp): rs-dpp/schema is needed for js packages tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lklimek committed Jan 22, 2025
1 parent b06ddce commit 514e723
Show file tree
Hide file tree
Showing 21 changed files with 1,039 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"version": {
"type": "integer",
"$comment": "Maximum is the latest protocol version"
},
"type": {
"type": "integer",
"const": 0
},
"dataContract": {
"type": "object"
},
"entropy": {
"type": "array",
"byteArray": true,
"minItems": 32,
"maxItems": 32
},
"signaturePublicKeyId": {
"type": "integer",
"minimum": 0
},
"signature": {
"type": "array",
"byteArray": true,
"minItems": 65,
"maxItems": 96
}
},
"additionalProperties": false,
"required": [
"version",
"type",
"dataContract",
"entropy",
"signaturePublicKeyId",
"signature"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"version": {
"type": "integer",
"$comment": "Maximum is the latest protocol version"
},
"type": {
"type": "integer",
"const": 4
},
"dataContract": {
"type": "object"
},
"signaturePublicKeyId": {
"type": "integer",
"minimum": 0
},
"signature": {
"type": "array",
"byteArray": true,
"minItems": 65,
"maxItems": 96
}
},
"additionalProperties": false,
"required": [
"version",
"type",
"dataContract",
"signaturePublicKeyId",
"signature"
]
}
83 changes: 83 additions & 0 deletions packages/rs-dpp/src/schema/document/v0/documentBase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"$protocolVersion": {
"type": "integer",
"$comment": "Maximum is the latest protocol version"
},
"$id": {
"type": "array",
"byteArray": true,
"minItems": 32,
"maxItems": 32,
"contentMediaType": "application/x.dash.dpp.identifier"
},
"$type": {
"type": "string"
},
"$revision": {
"type": "integer",
"minimum": 1
},
"$dataContractId": {
"type": "array",
"byteArray": true,
"minItems": 32,
"maxItems": 32,
"contentMediaType": "application/x.dash.dpp.identifier"
},
"$ownerId": {
"type": "array",
"byteArray": true,
"minItems": 32,
"maxItems": 32,
"contentMediaType": "application/x.dash.dpp.identifier"
},
"$createdAt": {
"type": "integer",
"minimum": 0
},
"$updatedAt": {
"type": "integer",
"minimum": 0
},
"$transferredAt": {
"type": "integer",
"minimum": 0
},
"$createdAtBlockHeight": {
"type": "integer",
"minimum": 0
},
"$updatedAtBlockHeight": {
"type": "integer",
"minimum": 0
},
"$transferredAtBlockHeight": {
"type": "integer",
"minimum": 0
},
"$createdAtCoreBlockHeight": {
"type": "integer",
"minimum": 0
},
"$updatedAtCoreBlockHeight": {
"type": "integer",
"minimum": 0
},
"$transferredAtCoreBlockHeight": {
"type": "integer",
"minimum": 0
}
},
"required": [
"$protocolVersion",
"$id",
"$type",
"$revision",
"$dataContractId",
"$ownerId"
],
"additionalProperties": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"$id": {
"type": "array",
"byteArray": true,
"minItems": 32,
"maxItems": 32,
"contentMediaType": "application/x.dash.dpp.identifier"
},
"$type": {
"type": "string"
},
"$action": {
"type": "integer",
"enum": [0, 1, 3]
},
"$dataContractId": {
"type": "array",
"byteArray": true,
"minItems": 32,
"maxItems": 32,
"contentMediaType": "application/x.dash.dpp.identifier"
}
},
"required": [
"$id",
"$type",
"$action",
"$dataContractId"
],
"additionalProperties": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"$entropy": {
"type": "array",
"byteArray": true,
"minItems": 32,
"maxItems": 32
},
"$createdAt": {
"type": "integer",
"minimum": 0
},
"$updatedAt": {
"type": "integer",
"minimum": 0
}
},
"required": [
"$entropy"
],
"additionalProperties": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"$revision": {
"type": "integer",
"minimum": 1
},
"$updatedAt": {
"type": "integer",
"minimum": 0
}
},
"required": [
"$revision"
],
"additionalProperties": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"protocolVersion": {
"type": "integer",
"$comment": "Maximum is the latest protocol version"
},
"type": {
"type": "integer",
"const": 1
},
"ownerId": {
"type": "array",
"byteArray": true,
"minItems": 32,
"maxItems": 32,
"contentMediaType": "application/x.dash.dpp.identifier"
},
"transitions": {
"type": "array",
"items": {
"type": "object"
},
"minItems": 1,
"maxItems": 10
},
"signaturePublicKeyId": {
"type": "integer",
"minimum": 0
},
"signature": {
"type": "array",
"byteArray": true,
"minItems": 65,
"maxItems": 96
}
},
"additionalProperties": false,
"required": [
"protocolVersion",
"type",
"ownerId",
"transitions",
"signaturePublicKeyId",
"signature"
]
}
1 change: 1 addition & 0 deletions packages/rs-dpp/src/schema/identity/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod v0;
40 changes: 40 additions & 0 deletions packages/rs-dpp/src/schema/identity/v0/identity.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"protocolVersion": {
"type": "integer",
"minimum": 0,
"$comment": "Maximum is the latest protocol version"
},
"id": {
"type": "array",
"byteArray": true,
"minItems": 32,
"maxItems": 32,
"contentMediaType": "application/x.dash.dpp.identifier"
},
"publicKeys": {
"type": "array",
"minItems": 1,
"maxItems": 32,
"uniqueItems": true
},
"balance": {
"type": "integer",
"minimum": 0
},
"revision": {
"type": "integer",
"minimum": 0,
"description": "Identity update revision"
}
},
"required": [
"protocolVersion",
"id",
"publicKeys",
"balance",
"revision"
]
}
46 changes: 46 additions & 0 deletions packages/rs-dpp/src/schema/identity/v0/identity.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
use serde_json::Value;

pub const IDENTITY_JSON_STRING: &str = r#"{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"protocolVersion": {
"type": "integer",
"minimum": 0,
"$comment": "Maximum is the latest protocol version"
},
"id": {
"type": "array",
"byteArray": true,
"minItems": 32,
"maxItems": 32,
"contentMediaType": "application/x.dash.dpp.identifier"
},
"publicKeys": {
"type": "array",
"minItems": 1,
"maxItems": 32,
"uniqueItems": true
},
"balance": {
"type": "integer",
"minimum": 0
},
"revision": {
"type": "integer",
"minimum": 0,
"description": "Identity update revision"
}
},
"required": [
"protocolVersion",
"id",
"publicKeys",
"balance",
"revision"
]
}"#;

pub fn identity_json() -> Result<Value, serde_json::Error> {
serde_json::from_str(IDENTITY_JSON_STRING)
}
3 changes: 3 additions & 0 deletions packages/rs-dpp/src/schema/identity/v0/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub use identity::identity_json;

mod identity;
Loading

0 comments on commit 514e723

Please sign in to comment.