@carrot-foundation/schemas 0.1.36 → 0.1.37

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.
Files changed (40) hide show
  1. package/dist/index.cjs +1124 -36
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +959 -13
  4. package/dist/index.d.ts +959 -13
  5. package/dist/index.js +1102 -37
  6. package/dist/index.js.map +1 -1
  7. package/package.json +1 -1
  8. package/schemas/ipfs/collection/collection.example.json +1 -0
  9. package/schemas/ipfs/collection/collection.schema.json +305 -32
  10. package/schemas/ipfs/credit/credit.example.json +1 -0
  11. package/schemas/ipfs/credit/credit.schema.json +326 -45
  12. package/schemas/ipfs/credit-purchase-receipt/credit-purchase-receipt.example.json +290 -0
  13. package/schemas/ipfs/credit-purchase-receipt/credit-purchase-receipt.schema.json +1768 -0
  14. package/schemas/ipfs/gas-id/gas-id.schema.json +6 -6
  15. package/schemas/ipfs/mass-id/mass-id.schema.json +6 -6
  16. package/schemas/ipfs/mass-id-audit/mass-id-audit.example.json +30 -29
  17. package/schemas/ipfs/mass-id-audit/mass-id-audit.schema.json +636 -15
  18. package/schemas/ipfs/methodology/methodology.example.json +27 -26
  19. package/schemas/ipfs/methodology/methodology.schema.json +457 -15
  20. package/schemas/ipfs/recycled-id/recycled-id.schema.json +6 -6
  21. package/schemas/ipfs/gas-id/gas-id.attributes.schema.json +0 -219
  22. package/schemas/ipfs/gas-id/gas-id.data.schema.json +0 -120
  23. package/schemas/ipfs/mass-id-audit/mass-id-audit.data.schema.json +0 -130
  24. package/schemas/ipfs/methodology/methodology.data.schema.json +0 -121
  25. package/schemas/ipfs/purchase-id/purchase-id.attributes.schema.json +0 -91
  26. package/schemas/ipfs/purchase-id/purchase-id.data.schema.json +0 -337
  27. package/schemas/ipfs/purchase-id/purchase-id.example.json +0 -224
  28. package/schemas/ipfs/purchase-id/purchase-id.schema.json +0 -29
  29. package/schemas/ipfs/recycled-id/recycled-id.attributes.schema.json +0 -202
  30. package/schemas/ipfs/recycled-id/recycled-id.data.schema.json +0 -63
  31. package/schemas/ipfs/shared/base/base.schema.json +0 -163
  32. package/schemas/ipfs/shared/certificate/certificate.schema.json +0 -145
  33. package/schemas/ipfs/shared/definitions/definitions.schema.json +0 -255
  34. package/schemas/ipfs/shared/entities/location/location.schema.json +0 -90
  35. package/schemas/ipfs/shared/entities/participant/participant.schema.json +0 -28
  36. package/schemas/ipfs/shared/nft/nft.schema.json +0 -182
  37. package/schemas/ipfs/shared/references/audit-reference/audit-reference.schema.json +0 -42
  38. package/schemas/ipfs/shared/references/gas-id-reference/gas-id-reference.schema.json +0 -27
  39. package/schemas/ipfs/shared/references/mass-id-reference/mass-id-reference.schema.json +0 -27
  40. package/schemas/ipfs/shared/references/methodology-reference/methodology-reference.schema.json +0 -34
@@ -1,202 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://raw.githubusercontent.com/carrot-foundation/schemas/refs/heads/main/schemas/ipfs/recycled-id/recycled-id.attributes.schema.json",
4
- "$defs": {
5
- "attribute_methodology": {
6
- "type": "object",
7
- "required": ["trait_type", "value"],
8
- "properties": {
9
- "trait_type": {
10
- "const": "Methodology"
11
- },
12
- "value": {
13
- "$ref": "../shared/definitions/definitions.schema.json#/$defs/non_empty_string",
14
- "maxLength": 100,
15
- "description": "Name of the recycling methodology used for certification",
16
- "example": "BOLD Recycling"
17
- }
18
- },
19
- "additionalProperties": false
20
- },
21
- "attribute_recycled_mass_weight": {
22
- "type": "object",
23
- "required": ["trait_type", "value", "display_type"],
24
- "properties": {
25
- "trait_type": {
26
- "const": "Recycled Mass Weight (kg)"
27
- },
28
- "value": {
29
- "$ref": "../shared/definitions/definitions.schema.json#/$defs/weight_kg",
30
- "description": "Total weight of recycled materials in kilograms"
31
- },
32
- "display_type": {
33
- "const": "number"
34
- }
35
- },
36
- "additionalProperties": false
37
- },
38
- "attribute_credit_amount": {
39
- "type": "object",
40
- "required": ["trait_type", "value", "display_type"],
41
- "properties": {
42
- "trait_type": {
43
- "const": "Credit Amount"
44
- },
45
- "value": {
46
- "$ref": "../shared/definitions/definitions.schema.json#/$defs/non_negative_float",
47
- "description": "Amount of credits issued"
48
- },
49
- "display_type": {
50
- "const": "number"
51
- }
52
- },
53
- "additionalProperties": false
54
- },
55
- "attribute_credit_type": {
56
- "type": "object",
57
- "required": ["trait_type", "value"],
58
- "properties": {
59
- "trait_type": {
60
- "const": "Credit Type"
61
- },
62
- "value": {
63
- "$ref": "../shared/definitions/definitions.schema.json#/$defs/non_empty_string",
64
- "maxLength": 100,
65
- "description": "Type of credit issued",
66
- "example": "Carrot Organic"
67
- }
68
- },
69
- "additionalProperties": false
70
- },
71
- "attribute_source_waste_type": {
72
- "type": "object",
73
- "required": ["trait_type", "value"],
74
- "properties": {
75
- "trait_type": {
76
- "const": "Source Waste Type"
77
- },
78
- "value": {
79
- "$ref": "../shared/definitions/definitions.schema.json#/$defs/waste_type"
80
- }
81
- },
82
- "additionalProperties": false
83
- },
84
- "attribute_source_weight": {
85
- "type": "object",
86
- "required": ["trait_type", "value", "display_type"],
87
- "properties": {
88
- "trait_type": {
89
- "const": "Source Weight (kg)"
90
- },
91
- "value": {
92
- "$ref": "../shared/definitions/definitions.schema.json#/$defs/weight_kg"
93
- },
94
- "display_type": {
95
- "const": "number"
96
- }
97
- },
98
- "additionalProperties": false
99
- },
100
- "attribute_origin_country": {
101
- "type": "object",
102
- "required": ["trait_type", "value"],
103
- "properties": {
104
- "trait_type": {
105
- "const": "Origin Country"
106
- },
107
- "value": {
108
- "$ref": "../shared/definitions/definitions.schema.json#/$defs/non_empty_string",
109
- "maxLength": 100,
110
- "description": "Country where the waste was generated",
111
- "example": "Brazil"
112
- }
113
- },
114
- "additionalProperties": false
115
- },
116
- "attribute_origin_municipality": {
117
- "type": "object",
118
- "required": ["trait_type", "value"],
119
- "properties": {
120
- "trait_type": {
121
- "const": "Origin Municipality"
122
- },
123
- "value": {
124
- "$ref": "../shared/definitions/definitions.schema.json#/$defs/non_empty_string",
125
- "maxLength": 100,
126
- "description": "Municipality where the waste was generated",
127
- "example": "Macapá"
128
- }
129
- },
130
- "additionalProperties": false
131
- },
132
- "attribute_recycler": {
133
- "type": "object",
134
- "required": ["trait_type", "value"],
135
- "properties": {
136
- "trait_type": {
137
- "const": "Recycler"
138
- },
139
- "value": {
140
- "$ref": "../shared/definitions/definitions.schema.json#/$defs/non_empty_string",
141
- "maxLength": 100,
142
- "description": "Organization that processed the waste",
143
- "example": "Eco Reciclagem"
144
- }
145
- },
146
- "additionalProperties": false
147
- },
148
- "attribute_mass_id_token_id": {
149
- "type": "object",
150
- "required": ["trait_type", "value"],
151
- "properties": {
152
- "trait_type": {
153
- "const": "MassID"
154
- },
155
- "value": {
156
- "$ref": "../shared/definitions/definitions.schema.json#/$defs/non_empty_string",
157
- "pattern": "^#[0-9]+$",
158
- "description": "Token ID of the source MassID NFT",
159
- "example": "#123"
160
- }
161
- },
162
- "additionalProperties": false
163
- },
164
- "attribute_mass_id_recycling_date": {
165
- "type": "object",
166
- "required": ["trait_type", "value", "display_type"],
167
- "properties": {
168
- "trait_type": {
169
- "const": "MassID Recycling Date"
170
- },
171
- "value": {
172
- "$ref": "../shared/definitions/definitions.schema.json#/$defs/iso_date",
173
- "description": "Date when the source waste was recycled",
174
- "example": "2025-02-22"
175
- },
176
- "display_type": {
177
- "const": "date"
178
- }
179
- },
180
- "additionalProperties": false
181
- }
182
- },
183
- "title": "RecycledID NFT Attribute Array",
184
- "description": "Schema for the fixed set of RecycledID NFT attributes, enforcing order and type for each trait.",
185
- "type": "array",
186
- "prefixItems": [
187
- { "$ref": "#/$defs/attribute_methodology" },
188
- { "$ref": "#/$defs/attribute_recycled_mass_weight" },
189
- { "$ref": "#/$defs/attribute_credit_amount" },
190
- { "$ref": "#/$defs/attribute_credit_type" },
191
- { "$ref": "#/$defs/attribute_source_waste_type" },
192
- { "$ref": "#/$defs/attribute_source_weight" },
193
- { "$ref": "#/$defs/attribute_origin_country" },
194
- { "$ref": "#/$defs/attribute_origin_municipality" },
195
- { "$ref": "#/$defs/attribute_recycler" },
196
- { "$ref": "#/$defs/attribute_mass_id_token_id" },
197
- { "$ref": "#/$defs/attribute_mass_id_recycling_date" }
198
- ],
199
- "items": false,
200
- "minItems": 11,
201
- "maxItems": 11
202
- }
@@ -1,63 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://raw.githubusercontent.com/carrot-foundation/schemas/refs/heads/main/schemas/ipfs/recycled-id/recycled-id.data.schema.json",
4
- "title": "RecycledID Data",
5
- "type": "object",
6
- "required": [
7
- "summary",
8
- "methodology",
9
- "audit",
10
- "mass_id",
11
- "waste_classification",
12
- "origin_location",
13
- "accredited_participants"
14
- ],
15
- "properties": {
16
- "summary": {
17
- "type": "object",
18
- "required": ["recycled_mass_kg", "credit_type", "credit_amount"],
19
- "properties": {
20
- "recycled_mass_kg": {
21
- "$ref": "../shared/definitions/definitions.schema.json#/$defs/weight_kg",
22
- "title": "Recycled Mass Weight",
23
- "description": "Total weight of materials successfully recycled"
24
- },
25
- "credit_type": {
26
- "$ref": "../shared/definitions/definitions.schema.json#/$defs/non_empty_string",
27
- "title": "Credit Type",
28
- "description": "Type of credit issued"
29
- },
30
- "credit_amount": {
31
- "$ref": "../shared/definitions/definitions.schema.json#/$defs/non_negative_float",
32
- "title": "Credit Amount",
33
- "description": "Amount of credits issued"
34
- }
35
- },
36
- "additionalProperties": false
37
- },
38
- "methodology": {
39
- "$ref": "../shared/references/methodology-reference/methodology-reference.schema.json"
40
- },
41
- "audit": {
42
- "$ref": "../shared/references/audit-reference/audit-reference.schema.json"
43
- },
44
- "mass_id": {
45
- "$ref": "../shared/references/mass-id-reference/mass-id-reference.schema.json"
46
- },
47
- "waste_classification": {
48
- "$ref": "../shared/certificate/certificate.schema.json#/$defs/waste_classification"
49
- },
50
- "origin_location": {
51
- "$ref": "../shared/entities/location/location.schema.json",
52
- "title": "Source Waste Origin Location",
53
- "description": "Location of the waste origin"
54
- },
55
- "accredited_participants": {
56
- "$ref": "../shared/certificate/certificate.schema.json#/$defs/accredited_participants"
57
- },
58
- "participant_rewards": {
59
- "$ref": "../shared/certificate/certificate.schema.json#/$defs/participant_rewards"
60
- }
61
- },
62
- "additionalProperties": false
63
- }
@@ -1,163 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://raw.githubusercontent.com/carrot-foundation/schemas/refs/heads/main/schemas/ipfs/shared/base/base.schema.json",
4
- "title": "Carrot Base IPFS Record",
5
- "description": "Base fields for all Carrot IPFS records, providing common structure for any JSON content stored in IPFS.",
6
- "type": "object",
7
- "required": [
8
- "$schema",
9
- "schema",
10
- "created_at",
11
- "external_id",
12
- "external_url",
13
- "content_hash",
14
- "creator"
15
- ],
16
- "properties": {
17
- "$schema": {
18
- "type": "string",
19
- "format": "uri",
20
- "title": "Schema URI",
21
- "description": "URI of the JSON Schema used to validate this record.",
22
- "example": "https://raw.githubusercontent.com/carrot-foundation/schemas/refs/heads/main/schemas/ipfs/mass-id/mass-id.schema.json"
23
- },
24
- "schema": {
25
- "type": "object",
26
- "description": "Schema information.",
27
- "required": ["hash", "type", "version"],
28
- "properties": {
29
- "hash": {
30
- "$ref": "../definitions/definitions.schema.json#/$defs/keccak256_hash",
31
- "title": "Schema Hash",
32
- "description": "Keccak256 hash of the JSON Schema this record was validated against (32 bytes as hex string)."
33
- },
34
- "type": {
35
- "type": "string",
36
- "enum": [
37
- "MassID",
38
- "MassID Audit",
39
- "RecycledID",
40
- "GasID",
41
- "PurchaseID",
42
- "Methodology",
43
- "Credit",
44
- "Collection"
45
- ],
46
- "title": "Schema Type",
47
- "description": "Type/category of this schema.",
48
- "example": "MassID"
49
- },
50
- "version": {
51
- "$ref": "../definitions/definitions.schema.json#/$defs/semantic_version",
52
- "title": "Schema Version",
53
- "description": "Version of the schema, using semantic versioning (https://semver.org/)."
54
- }
55
- },
56
- "additionalProperties": false
57
- },
58
- "created_at": {
59
- "$ref": "../definitions/definitions.schema.json#/$defs/iso_timestamp",
60
- "title": "Record Creation Timestamp",
61
- "description": "ISO 8601 creation timestamp for this record."
62
- },
63
- "external_id": {
64
- "$ref": "../definitions/definitions.schema.json#/$defs/external_id"
65
- },
66
- "external_url": {
67
- "$ref": "../definitions/definitions.schema.json#/$defs/external_url"
68
- },
69
- "content_hash": {
70
- "type": "string",
71
- "pattern": "^[a-fA-F0-9]{64}$",
72
- "title": "Content Hash",
73
- "description": "SHA-256 hash of RFC 8785 canonicalized JSON after schema validation."
74
- },
75
- "original_content_hash": {
76
- "type": "string",
77
- "pattern": "^[a-fA-F0-9]{64}$",
78
- "title": "Original Content Hash",
79
- "description": "SHA-256 hash of the original JSON content including private data before schema validation."
80
- },
81
- "creator": {
82
- "type": "object",
83
- "description": "Entity that created this record.",
84
- "required": ["name", "id"],
85
- "properties": {
86
- "name": {
87
- "type": "string",
88
- "description": "Company or individual name that created this record."
89
- },
90
- "id": {
91
- "$ref": "../definitions/definitions.schema.json#/$defs/uuid",
92
- "description": "Unique identifier for the creator."
93
- }
94
- },
95
- "additionalProperties": false
96
- },
97
- "relationships": {
98
- "type": "array",
99
- "description": "References to other IPFS records this record relates to.",
100
- "items": {
101
- "type": "object",
102
- "required": ["target_cid", "type"],
103
- "properties": {
104
- "target_cid": {
105
- "type": "string",
106
- "pattern": "^(Qm[1-9A-HJ-NP-Za-km-z]{44}|b[a-z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]+)$",
107
- "description": "IPFS Content Identifier (CID) of the referenced record."
108
- },
109
- "type": {
110
- "type": "string",
111
- "enum": [
112
- "collection",
113
- "credit",
114
- "audit",
115
- "update",
116
- "derivation",
117
- "reference"
118
- ],
119
- "description": "Type of relationship to the referenced record."
120
- },
121
- "description": {
122
- "type": "string",
123
- "description": "Human-readable description of the relationship."
124
- }
125
- },
126
- "additionalProperties": false
127
- }
128
- },
129
- "environment": {
130
- "type": "object",
131
- "description": "Environment information.",
132
- "required": ["blockchain_network", "deployment", "data_set_name"],
133
- "properties": {
134
- "blockchain_network": {
135
- "type": "string",
136
- "enum": ["mainnet", "testnet"],
137
- "title": "Blockchain Network Environment",
138
- "example": "mainnet"
139
- },
140
- "deployment": {
141
- "type": "string",
142
- "enum": ["production", "development", "testing"],
143
- "title": "Deployment Environment",
144
- "description": "System environment where this record was generated.",
145
- "example": "production"
146
- },
147
- "data_set_name": {
148
- "type": "string",
149
- "enum": ["TEST", "PROD"],
150
- "title": "Data Set Name",
151
- "description": "Name of the data set for this record.",
152
- "example": "TEST"
153
- }
154
- },
155
- "additionalProperties": false
156
- },
157
- "data": {
158
- "type": "object",
159
- "description": "Custom data block that includes the record's data.",
160
- "additionalProperties": true
161
- }
162
- }
163
- }
@@ -1,145 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://raw.githubusercontent.com/carrot-foundation/schemas/refs/heads/main/schemas/ipfs/shared/certificate/certificate.schema.json",
4
- "title": "Carrot Certificate Definitions",
5
- "description": "Reusable certificate definitions for Carrot IPFS JSON schemas.",
6
- "type": "object",
7
- "$defs": {
8
- "waste_classification": {
9
- "type": "object",
10
- "required": ["primary_type", "subtype", "net_weight_kg"],
11
- "title": "Waste Classification",
12
- "description": "Classification of the source waste (MassID)",
13
- "properties": {
14
- "primary_type": {
15
- "$ref": "../definitions/definitions.schema.json#/$defs/waste_type",
16
- "title": "Source Waste Primary Type",
17
- "description": "Primary type of the source waste"
18
- },
19
- "subtype": {
20
- "$ref": "../definitions/definitions.schema.json#/$defs/waste_subtype",
21
- "title": "Source Waste Subtype",
22
- "description": "Subtype of the source waste"
23
- },
24
- "net_weight_kg": {
25
- "$ref": "../definitions/definitions.schema.json#/$defs/weight_kg",
26
- "title": "Source Waste Net Weight",
27
- "description": "Net weight of the source waste"
28
- }
29
- },
30
- "additionalProperties": false
31
- },
32
- "accredited_participants": {
33
- "type": "array",
34
- "minItems": 1,
35
- "title": "Accredited Participants",
36
- "items": {
37
- "type": "object",
38
- "required": [
39
- "participant_id",
40
- "name",
41
- "role",
42
- "external_url",
43
- "accreditation_id"
44
- ],
45
- "properties": {
46
- "participant_id": {
47
- "$ref": "../definitions/definitions.schema.json#/$defs/uuid",
48
- "title": "Participant ID"
49
- },
50
- "name": {
51
- "$ref": "../definitions/definitions.schema.json#/$defs/participant_name"
52
- },
53
- "role": {
54
- "$ref": "../definitions/definitions.schema.json#/$defs/participant_role"
55
- },
56
- "accreditation_id": {
57
- "$ref": "../definitions/definitions.schema.json#/$defs/uuid",
58
- "title": "Accreditation ID"
59
- },
60
- "external_url": {
61
- "$ref": "../definitions/definitions.schema.json#/$defs/external_url",
62
- "title": "Participant Accreditation External URL"
63
- }
64
- },
65
- "additionalProperties": false
66
- }
67
- },
68
- "participant_rewards": {
69
- "type": "object",
70
- "required": ["distribution_basis", "reward_allocations"],
71
- "title": "Participant Rewards",
72
- "description": "Rewards distribution to participants",
73
- "properties": {
74
- "distribution_basis": {
75
- "$ref": "../definitions/definitions.schema.json#/$defs/non_empty_string",
76
- "maxLength": 200,
77
- "title": "Distribution Basis",
78
- "description": "Basis for the rewards distribution"
79
- },
80
- "reward_allocations": {
81
- "type": "array",
82
- "minItems": 1,
83
- "title": "Reward Allocations",
84
- "description": "Rewards percentage allocated to each participant",
85
- "items": {
86
- "type": "object",
87
- "required": [
88
- "participant_id",
89
- "participant_name",
90
- "role",
91
- "reward_percentage",
92
- "effective_percentage"
93
- ],
94
- "properties": {
95
- "participant_id": {
96
- "$ref": "../definitions/definitions.schema.json#/$defs/uuid",
97
- "title": "Participant ID"
98
- },
99
- "participant_name": {
100
- "$ref": "../definitions/definitions.schema.json#/$defs/participant_name"
101
- },
102
- "role": {
103
- "$ref": "../definitions/definitions.schema.json#/$defs/participant_role"
104
- },
105
- "reward_percentage": {
106
- "$ref": "../definitions/definitions.schema.json#/$defs/percentage",
107
- "title": "Reward Percentage",
108
- "description": "Reward percentage allocated to the participant"
109
- },
110
- "large_business_discount_applied": {
111
- "type": "boolean",
112
- "title": "Large Business Discount Applied",
113
- "description": "Whether the large business discount was applied"
114
- },
115
- "effective_percentage": {
116
- "$ref": "../definitions/definitions.schema.json#/$defs/percentage",
117
- "title": "Effective Percentage",
118
- "description": "Effective percentage of the reward"
119
- }
120
- },
121
- "additionalProperties": false
122
- }
123
- },
124
- "distribution_notes": {
125
- "type": "object",
126
- "properties": {
127
- "large_business_discount_applied": {
128
- "$ref": "../definitions/definitions.schema.json#/$defs/non_empty_string",
129
- "description": "Description of the large business discount applied",
130
- "example": "50% reduction applied to participants with >$4M annual revenue"
131
- },
132
- "redirected_rewards": {
133
- "$ref": "../definitions/definitions.schema.json#/$defs/non_empty_string",
134
- "description": "Description of the redirected rewards",
135
- "example": "Discounted rewards from large businesses redirected to accredited NGOs"
136
- }
137
- },
138
- "additionalProperties": false
139
- }
140
- },
141
- "additionalProperties": false
142
- }
143
- },
144
- "additionalProperties": false
145
- }