@carrot-foundation/schemas 0.1.34 → 0.1.35
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/dist/index.cjs +1128 -1048
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +737 -81
- package/dist/index.d.ts +737 -81
- package/dist/index.js +1108 -1049
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/schemas/ipfs/gas-id/gas-id.example.json +1 -1
- package/schemas/ipfs/gas-id/gas-id.schema.json +82 -70
- package/schemas/ipfs/mass-id/mass-id.schema.json +56 -45
- package/schemas/ipfs/recycled-id/recycled-id.example.json +9 -8
- package/schemas/ipfs/recycled-id/recycled-id.schema.json +1650 -15
- package/schemas/ipfs/shared/definitions/definitions.schema.json +10 -0
- package/schemas/ipfs/shared/entities/location/location.schema.json +10 -10
package/dist/index.cjs
CHANGED
|
@@ -75,6 +75,34 @@ var NonEmptyStringSchema = zod.z.string().min(1, "Cannot be empty").meta({
|
|
|
75
75
|
description: "A string that contains at least one character",
|
|
76
76
|
examples: ["Example text", "Sample value", "Test string"]
|
|
77
77
|
});
|
|
78
|
+
var MunicipalitySchema = NonEmptyStringSchema.max(50).meta({
|
|
79
|
+
title: "Municipality",
|
|
80
|
+
description: "Municipality or city name",
|
|
81
|
+
examples: ["Macap\xE1", "S\xE3o Paulo", "New York", "Berlin", "Tokyo"]
|
|
82
|
+
});
|
|
83
|
+
var AdministrativeDivisionSchema = NonEmptyStringSchema.max(50).meta({
|
|
84
|
+
title: "Administrative Division",
|
|
85
|
+
description: "State, province, or administrative region name",
|
|
86
|
+
examples: ["Amap\xE1", "California", "Bavaria"]
|
|
87
|
+
});
|
|
88
|
+
var CountryNameSchema = NonEmptyStringSchema.max(50).meta({
|
|
89
|
+
title: "Country",
|
|
90
|
+
description: "Full country name in English",
|
|
91
|
+
examples: ["Brazil", "United States", "Germany", "Japan"]
|
|
92
|
+
});
|
|
93
|
+
var MethodologyNameSchema = NonEmptyStringSchema.max(100).meta({
|
|
94
|
+
title: "Methodology Name",
|
|
95
|
+
description: "Name of the methodology used for certification",
|
|
96
|
+
examples: ["BOLD Recycling", "BOLD Carbon (CH\u2084)"]
|
|
97
|
+
});
|
|
98
|
+
var StringifiedTokenIdSchema = NonEmptyStringSchema.regex(
|
|
99
|
+
/^#\d+$/,
|
|
100
|
+
"Must match pattern #<token_id>"
|
|
101
|
+
).meta({
|
|
102
|
+
title: "Token ID",
|
|
103
|
+
description: "Token ID represented as #<token_id>",
|
|
104
|
+
example: "#123"
|
|
105
|
+
});
|
|
78
106
|
var SlugSchema = NonEmptyStringSchema.regex(
|
|
79
107
|
/^[a-z0-9-]+$/,
|
|
80
108
|
"Must contain only lowercase letters, numbers, and hyphens"
|
|
@@ -142,6 +170,15 @@ var NonNegativeFloatSchema = zod.z.number().min(0).meta({
|
|
|
142
170
|
description: "Floating-point number that is zero or positive",
|
|
143
171
|
examples: [0, 45.2, 72.5]
|
|
144
172
|
});
|
|
173
|
+
var CreditTypeSchema = NonEmptyStringSchema.max(100).meta({
|
|
174
|
+
title: "Credit Type",
|
|
175
|
+
description: "Type of credit issued",
|
|
176
|
+
examples: ["Organic", "Carbon (CH\u2084)"]
|
|
177
|
+
});
|
|
178
|
+
var CreditAmountSchema = NonNegativeFloatSchema.meta({
|
|
179
|
+
title: "Credit Amount",
|
|
180
|
+
description: "Amount of credits issued"
|
|
181
|
+
});
|
|
145
182
|
var HoursSchema = zod.z.number().min(0).multipleOf(0.1).meta({
|
|
146
183
|
title: "Hours",
|
|
147
184
|
description: "Time duration in hours with 0.1 hour precision",
|
|
@@ -258,118 +295,6 @@ var RecordRelationshipTypeSchema = zod.z.enum([
|
|
|
258
295
|
description: "Type of relationship between different entities in the system",
|
|
259
296
|
examples: ["mass-id", "audit", "collection"]
|
|
260
297
|
});
|
|
261
|
-
var SchemaInfoSchema = zod.z.strictObject({
|
|
262
|
-
hash: Keccak256HashSchema.meta({
|
|
263
|
-
title: "Schema Hash",
|
|
264
|
-
description: "Keccak256 hash of the JSON Schema this record was validated against"
|
|
265
|
-
}),
|
|
266
|
-
type: RecordSchemaTypeSchema.meta({
|
|
267
|
-
title: "Schema Type",
|
|
268
|
-
description: "Type/category of this schema"
|
|
269
|
-
}),
|
|
270
|
-
version: SemanticVersionSchema.meta({
|
|
271
|
-
title: "Schema Version",
|
|
272
|
-
description: "Version of the schema, using semantic versioning"
|
|
273
|
-
})
|
|
274
|
-
}).meta({
|
|
275
|
-
title: "Schema Information"
|
|
276
|
-
});
|
|
277
|
-
var RecordCreatorSchema = zod.z.strictObject({
|
|
278
|
-
name: zod.z.string().meta({
|
|
279
|
-
title: "Creator Name",
|
|
280
|
-
description: "Company or individual name that created this record",
|
|
281
|
-
examples: ["Carrot Foundation"]
|
|
282
|
-
}),
|
|
283
|
-
id: UuidSchema.meta({
|
|
284
|
-
title: "Creator ID",
|
|
285
|
-
description: "Unique identifier for the creator"
|
|
286
|
-
})
|
|
287
|
-
}).meta({
|
|
288
|
-
title: "Creator",
|
|
289
|
-
description: "Entity that created this record"
|
|
290
|
-
});
|
|
291
|
-
var RecordRelationshipSchema = zod.z.strictObject({
|
|
292
|
-
target_uri: IpfsUriSchema.meta({
|
|
293
|
-
title: "Target IPFS URI",
|
|
294
|
-
description: "Target IPFS URI of the referenced record"
|
|
295
|
-
}),
|
|
296
|
-
type: RecordRelationshipTypeSchema.meta({
|
|
297
|
-
title: "Relationship Type",
|
|
298
|
-
description: "Type of relationship to the referenced record"
|
|
299
|
-
}),
|
|
300
|
-
description: zod.z.string().optional().meta({
|
|
301
|
-
title: "Relationship Description",
|
|
302
|
-
description: "Human-readable description of the relationship",
|
|
303
|
-
examples: [
|
|
304
|
-
"This record supersedes the previous version",
|
|
305
|
-
"Related carbon credit batch",
|
|
306
|
-
"Source document for this verification",
|
|
307
|
-
"Child record derived from this parent",
|
|
308
|
-
"Updated version of original record"
|
|
309
|
-
]
|
|
310
|
-
})
|
|
311
|
-
}).meta({
|
|
312
|
-
title: "Relationship",
|
|
313
|
-
description: "Relationship to another IPFS record"
|
|
314
|
-
});
|
|
315
|
-
var RecordEnvironmentSchema = zod.z.strictObject({
|
|
316
|
-
blockchain_network: zod.z.enum(["mainnet", "testnet"]).meta({
|
|
317
|
-
title: "Blockchain Network",
|
|
318
|
-
description: "Blockchain Network Environment"
|
|
319
|
-
}),
|
|
320
|
-
deployment: zod.z.enum(["production", "development", "testing"]).meta({
|
|
321
|
-
title: "Deployment Environment",
|
|
322
|
-
description: "System environment where this record was generated"
|
|
323
|
-
}),
|
|
324
|
-
data_set_name: zod.z.enum(["TEST", "PROD"]).meta({
|
|
325
|
-
title: "Data Set Name",
|
|
326
|
-
description: "Name of the data set for this record"
|
|
327
|
-
})
|
|
328
|
-
}).meta({
|
|
329
|
-
title: "Environment",
|
|
330
|
-
description: "Environment information"
|
|
331
|
-
});
|
|
332
|
-
var BaseIpfsSchema = zod.z.strictObject({
|
|
333
|
-
$schema: zod.z.url("Must be a valid URI").meta({
|
|
334
|
-
title: "JSON Schema URI",
|
|
335
|
-
description: "URI of the JSON Schema used to validate this record",
|
|
336
|
-
example: "https://raw.githubusercontent.com/carrot-foundation/schemas/refs/heads/main/schemas/ipfs/shared/base/base.schema.json"
|
|
337
|
-
}),
|
|
338
|
-
schema: SchemaInfoSchema,
|
|
339
|
-
created_at: IsoTimestampSchema.meta({
|
|
340
|
-
title: "Created At",
|
|
341
|
-
description: "ISO 8601 creation timestamp for this record"
|
|
342
|
-
}),
|
|
343
|
-
external_id: ExternalIdSchema.meta({
|
|
344
|
-
title: "External ID",
|
|
345
|
-
description: "Off-chain reference ID (UUID from Carrot backend)"
|
|
346
|
-
}),
|
|
347
|
-
external_url: ExternalUrlSchema.meta({
|
|
348
|
-
title: "External URL",
|
|
349
|
-
description: "External URL of the content"
|
|
350
|
-
}),
|
|
351
|
-
original_content_hash: Sha256HashSchema.meta({
|
|
352
|
-
title: "Original Content Hash",
|
|
353
|
-
description: "SHA-256 hash of the original JSON content including private data before schema validation"
|
|
354
|
-
}),
|
|
355
|
-
content_hash: Sha256HashSchema.meta({
|
|
356
|
-
title: "Content Hash",
|
|
357
|
-
description: "SHA-256 hash of RFC 8785 canonicalized JSON after schema validation"
|
|
358
|
-
}),
|
|
359
|
-
creator: RecordCreatorSchema.optional(),
|
|
360
|
-
relationships: zod.z.array(RecordRelationshipSchema).optional().meta({
|
|
361
|
-
title: "Relationships",
|
|
362
|
-
description: "References to other IPFS records this record relates to"
|
|
363
|
-
}),
|
|
364
|
-
environment: RecordEnvironmentSchema.optional(),
|
|
365
|
-
data: zod.z.record(zod.z.string(), zod.z.unknown()).optional().meta({
|
|
366
|
-
title: "Custom Data",
|
|
367
|
-
description: "Custom data block that includes the record's data"
|
|
368
|
-
})
|
|
369
|
-
}).meta({
|
|
370
|
-
title: "Base IPFS Record",
|
|
371
|
-
description: "Base fields for all Carrot IPFS records, providing common structure for any JSON content stored in IPFS"
|
|
372
|
-
});
|
|
373
298
|
function uniqueArrayItems(schema, errorMessage = "Array items must be unique") {
|
|
374
299
|
return zod.z.array(schema).refine((items) => new Set(items).size === items.length, {
|
|
375
300
|
message: errorMessage
|
|
@@ -387,760 +312,568 @@ function uniqueBy(schema, selector, errorMessage = "Items must be unique") {
|
|
|
387
312
|
);
|
|
388
313
|
}
|
|
389
314
|
|
|
390
|
-
// src/shared/
|
|
391
|
-
var
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
"PurchaseID"
|
|
396
|
-
]).meta({
|
|
397
|
-
title: "NFT Schema Type",
|
|
398
|
-
description: "Type of schema for NFT records"
|
|
399
|
-
});
|
|
400
|
-
var BlockchainReferenceSchema = zod.z.strictObject({
|
|
401
|
-
smart_contract_address: EthereumAddressSchema.meta({
|
|
402
|
-
title: "Smart Contract Address"
|
|
403
|
-
}),
|
|
404
|
-
chain_id: BlockchainChainIdSchema.meta({
|
|
405
|
-
title: "Chain ID",
|
|
406
|
-
description: "Blockchain chain ID"
|
|
315
|
+
// src/shared/entities/participant.schema.ts
|
|
316
|
+
var ParticipantSchema = zod.z.strictObject({
|
|
317
|
+
id_hash: Sha256HashSchema.meta({
|
|
318
|
+
title: "Participant ID Hash",
|
|
319
|
+
description: "Anonymized identifier for the participant"
|
|
407
320
|
}),
|
|
408
|
-
|
|
409
|
-
title: "
|
|
410
|
-
description: "Name of the
|
|
321
|
+
name: ParticipantNameSchema.meta({
|
|
322
|
+
title: "Participant Name",
|
|
323
|
+
description: "Name of the participant"
|
|
411
324
|
}),
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
325
|
+
roles: uniqueArrayItems(
|
|
326
|
+
ParticipantRoleSchema,
|
|
327
|
+
"Participant roles must be unique"
|
|
328
|
+
).min(1).meta({
|
|
329
|
+
title: "Participant Roles",
|
|
330
|
+
description: "Roles of the participant in the waste management supply chain"
|
|
415
331
|
})
|
|
416
332
|
}).meta({
|
|
417
|
-
title: "
|
|
418
|
-
description: "
|
|
333
|
+
title: "Participant",
|
|
334
|
+
description: "A participant in the waste management supply chain"
|
|
419
335
|
});
|
|
420
|
-
var
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
336
|
+
var PrecisionLevelSchema = zod.z.enum(["exact", "neighborhood", "city", "region", "country"]).meta({
|
|
337
|
+
title: "Coordinate Precision Level",
|
|
338
|
+
description: "Level of coordinate precision",
|
|
339
|
+
examples: ["city", "exact", "neighborhood"]
|
|
340
|
+
});
|
|
341
|
+
var CoordinatesSchema = zod.z.strictObject({
|
|
342
|
+
latitude: LatitudeSchema,
|
|
343
|
+
longitude: LongitudeSchema,
|
|
344
|
+
precision_level: PrecisionLevelSchema
|
|
345
|
+
}).meta({
|
|
346
|
+
title: "Coordinates",
|
|
347
|
+
description: "GPS coordinates of the location"
|
|
348
|
+
});
|
|
349
|
+
var LocationSchema = zod.z.strictObject({
|
|
350
|
+
id_hash: Sha256HashSchema.meta({
|
|
351
|
+
title: "Location ID Hash",
|
|
352
|
+
description: "Anonymized identifier for the location"
|
|
424
353
|
}),
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
354
|
+
municipality: MunicipalitySchema,
|
|
355
|
+
administrative_division: AdministrativeDivisionSchema,
|
|
356
|
+
administrative_division_code: IsoAdministrativeDivisionCodeSchema.optional(),
|
|
357
|
+
country: CountryNameSchema,
|
|
358
|
+
country_code: IsoCountryCodeSchema,
|
|
359
|
+
responsible_participant_id_hash: Sha256HashSchema.meta({
|
|
360
|
+
title: "Responsible Participant ID Hash",
|
|
361
|
+
description: "Anonymized ID of the participant responsible for this location"
|
|
428
362
|
}),
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
description: "Optional context about what the link provides"
|
|
432
|
-
})
|
|
363
|
+
coordinates: CoordinatesSchema,
|
|
364
|
+
facility_type: FacilityTypeSchema.optional()
|
|
433
365
|
}).meta({
|
|
434
|
-
title: "
|
|
435
|
-
description: "
|
|
366
|
+
title: "Location",
|
|
367
|
+
description: "Geographic location with address and coordinate information"
|
|
436
368
|
});
|
|
437
|
-
var
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
369
|
+
var MethodologyComplianceSchema = zod.z.enum(["PASSED", "FAILED"]).meta({
|
|
370
|
+
title: "Methodology Compliance",
|
|
371
|
+
description: "Result of methodology compliance check",
|
|
372
|
+
examples: ["PASSED", "FAILED"]
|
|
373
|
+
});
|
|
374
|
+
var AuditReferenceSchema = zod.z.strictObject({
|
|
375
|
+
date: IsoDateSchema.meta({
|
|
376
|
+
title: "Audit Date",
|
|
377
|
+
description: "Date when the audit was completed"
|
|
441
378
|
}),
|
|
442
|
-
|
|
443
|
-
title: "
|
|
444
|
-
description: "
|
|
379
|
+
external_id: ExternalIdSchema.meta({
|
|
380
|
+
title: "Audit External ID",
|
|
381
|
+
description: "Unique identifier for the audit"
|
|
445
382
|
}),
|
|
446
|
-
|
|
447
|
-
title: "
|
|
448
|
-
description: "
|
|
383
|
+
external_url: ExternalUrlSchema.meta({
|
|
384
|
+
title: "Audit External URL",
|
|
385
|
+
description: "URL to view the audit on Carrot Explorer"
|
|
449
386
|
}),
|
|
450
|
-
|
|
451
|
-
title: "
|
|
452
|
-
description: "
|
|
387
|
+
methodology_compliance: MethodologyComplianceSchema.meta({
|
|
388
|
+
title: "Methodology Compliance",
|
|
389
|
+
description: "Result of methodology compliance check"
|
|
390
|
+
}),
|
|
391
|
+
rules_executed: NonNegativeIntegerSchema.meta({
|
|
392
|
+
title: "Rules Executed",
|
|
393
|
+
description: "Number of rules executed during the audit"
|
|
394
|
+
}),
|
|
395
|
+
report: IpfsUriSchema.meta({
|
|
396
|
+
title: "Audit Report",
|
|
397
|
+
description: "IPFS URI of the audit report"
|
|
453
398
|
})
|
|
454
399
|
}).meta({
|
|
455
|
-
title: "
|
|
456
|
-
description: "
|
|
400
|
+
title: "Audit Reference",
|
|
401
|
+
description: "Reference to an audit record"
|
|
457
402
|
});
|
|
458
|
-
var
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
description: "Type/category of this NFT schema"
|
|
463
|
-
})
|
|
464
|
-
}),
|
|
465
|
-
blockchain: BlockchainReferenceSchema,
|
|
466
|
-
name: zod.z.string().min(1).max(100).meta({
|
|
467
|
-
title: "NFT Name",
|
|
468
|
-
description: "Full display name for this NFT, including extra context",
|
|
469
|
-
examples: [
|
|
470
|
-
"MassID #123 \u2022 Organic \u2022 3.0t",
|
|
471
|
-
"RecycledID #456 \u2022 Plastic \u2022 2.5t",
|
|
472
|
-
"GasID #789 \u2022 Methane \u2022 1000 m\xB3"
|
|
473
|
-
]
|
|
403
|
+
var GasIDReferenceSchema = zod.z.strictObject({
|
|
404
|
+
external_id: ExternalIdSchema.meta({
|
|
405
|
+
title: "GasID External ID",
|
|
406
|
+
description: "Unique identifier for the GasID"
|
|
474
407
|
}),
|
|
475
|
-
|
|
476
|
-
title: "
|
|
477
|
-
description: "
|
|
478
|
-
examples: ["MassID #123", "RecycledID #456", "GasID #789"]
|
|
408
|
+
token_id: TokenIdSchema.meta({
|
|
409
|
+
title: "GasID Token ID",
|
|
410
|
+
description: "NFT token ID of the GasID"
|
|
479
411
|
}),
|
|
480
|
-
|
|
481
|
-
title: "
|
|
482
|
-
description: "
|
|
483
|
-
examples: [
|
|
484
|
-
"This MassID represents 3 metric tons of organic food waste from Enlatados Produ\xE7\xE3o, tracked through complete chain of custody from generation to composting.",
|
|
485
|
-
"This RecycledID represents 2.5 metric tons of recycled plastic bottles processed by Green Solutions Ltd."
|
|
486
|
-
]
|
|
487
|
-
}),
|
|
488
|
-
image: IpfsUriSchema.meta({
|
|
489
|
-
title: "Image URI",
|
|
490
|
-
description: "IPFS URI pointing to the preview image"
|
|
412
|
+
external_url: ExternalUrlSchema.meta({
|
|
413
|
+
title: "GasID External URL",
|
|
414
|
+
description: "URL to view the GasID on Carrot Explorer"
|
|
491
415
|
}),
|
|
492
|
-
|
|
493
|
-
title: "
|
|
494
|
-
description: "
|
|
416
|
+
uri: IpfsUriSchema.meta({
|
|
417
|
+
title: "GasID IPFS URI",
|
|
418
|
+
description: "IPFS URI of the GasID record"
|
|
419
|
+
})
|
|
420
|
+
}).meta({
|
|
421
|
+
title: "GasID Reference",
|
|
422
|
+
description: "Reference to a GasID record"
|
|
423
|
+
});
|
|
424
|
+
var MassIDReferenceSchema = zod.z.strictObject({
|
|
425
|
+
external_id: ExternalIdSchema.meta({
|
|
426
|
+
title: "MassID External ID",
|
|
427
|
+
description: "Unique identifier for the MassID"
|
|
495
428
|
}),
|
|
496
|
-
|
|
497
|
-
title: "
|
|
498
|
-
description: "
|
|
499
|
-
examples: [
|
|
500
|
-
"ipfs://QmAnimation123/mass-id-animation.mp4",
|
|
501
|
-
"ipfs://QmInteractive456/recycled-visualization.webm"
|
|
502
|
-
]
|
|
429
|
+
token_id: TokenIdSchema.meta({
|
|
430
|
+
title: "MassID Token ID",
|
|
431
|
+
description: "NFT token ID of the MassID"
|
|
503
432
|
}),
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
"External link URLs must be unique"
|
|
508
|
-
).max(10).optional().meta({
|
|
509
|
-
title: "External Links",
|
|
510
|
-
description: "Optional list of public resource links with labels",
|
|
511
|
-
examples: [
|
|
512
|
-
[
|
|
513
|
-
{
|
|
514
|
-
label: "Carrot Explorer",
|
|
515
|
-
url: "https://explore.carrot.eco/document/ad44dd3f-f176-4b98-bf78-5ee6e77d0530",
|
|
516
|
-
description: "Complete chain of custody and audit trail"
|
|
517
|
-
},
|
|
518
|
-
{
|
|
519
|
-
label: "Carrot White Paper",
|
|
520
|
-
url: "https://carrot.eco/whitepaper.pdf",
|
|
521
|
-
description: "Carrot Foundation technical and impact white paper"
|
|
522
|
-
}
|
|
523
|
-
]
|
|
524
|
-
]
|
|
433
|
+
external_url: ExternalUrlSchema.meta({
|
|
434
|
+
title: "MassID External URL",
|
|
435
|
+
description: "URL to view the MassID on Carrot Explorer"
|
|
525
436
|
}),
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
"Attribute trait_type values must be unique"
|
|
530
|
-
).meta({
|
|
531
|
-
title: "NFT Attributes",
|
|
532
|
-
description: "List of visual traits and filterable attributes compatible with NFT marketplaces",
|
|
533
|
-
examples: [
|
|
534
|
-
[
|
|
535
|
-
{
|
|
536
|
-
trait_type: "Waste Type",
|
|
537
|
-
value: "Organic"
|
|
538
|
-
},
|
|
539
|
-
{
|
|
540
|
-
trait_type: "Waste Subtype",
|
|
541
|
-
value: "Food, Food Waste and Beverages"
|
|
542
|
-
},
|
|
543
|
-
{
|
|
544
|
-
trait_type: "Weight (kg)",
|
|
545
|
-
value: 3e3,
|
|
546
|
-
display_type: "number"
|
|
547
|
-
},
|
|
548
|
-
{
|
|
549
|
-
trait_type: "Origin Country",
|
|
550
|
-
value: "Brazil"
|
|
551
|
-
},
|
|
552
|
-
{
|
|
553
|
-
trait_type: "Pick-up Date",
|
|
554
|
-
value: "2024-12-05",
|
|
555
|
-
display_type: "date"
|
|
556
|
-
}
|
|
557
|
-
]
|
|
558
|
-
]
|
|
437
|
+
uri: IpfsUriSchema.meta({
|
|
438
|
+
title: "MassID IPFS URI",
|
|
439
|
+
description: "IPFS URI of the MassID record"
|
|
559
440
|
})
|
|
560
441
|
}).meta({
|
|
561
|
-
title: "
|
|
562
|
-
description: "
|
|
563
|
-
});
|
|
564
|
-
|
|
565
|
-
// src/mass-id/mass-id.attributes.ts
|
|
566
|
-
var MassIDAttributeWasteTypeSchema = NftAttributeSchema.extend({
|
|
567
|
-
trait_type: zod.z.literal("Waste Type"),
|
|
568
|
-
value: WasteTypeSchema
|
|
569
|
-
}).meta({
|
|
570
|
-
title: "Waste Type Attribute",
|
|
571
|
-
description: "Waste type attribute"
|
|
572
|
-
});
|
|
573
|
-
var MassIDAttributeWasteSubtypeSchema = NftAttributeSchema.extend({
|
|
574
|
-
trait_type: zod.z.literal("Waste Subtype"),
|
|
575
|
-
value: WasteSubtypeSchema
|
|
576
|
-
}).meta({
|
|
577
|
-
title: "Waste Subtype Attribute",
|
|
578
|
-
description: "Waste subtype attribute"
|
|
579
|
-
});
|
|
580
|
-
var MassIDAttributeWeightSchema = NftAttributeSchema.extend({
|
|
581
|
-
trait_type: zod.z.literal("Weight (kg)"),
|
|
582
|
-
value: WeightKgSchema,
|
|
583
|
-
display_type: zod.z.literal("number")
|
|
584
|
-
}).meta({
|
|
585
|
-
title: "Weight Attribute",
|
|
586
|
-
description: "Weight attribute with numeric display"
|
|
442
|
+
title: "MassID Reference",
|
|
443
|
+
description: "Reference to a MassID record"
|
|
587
444
|
});
|
|
588
|
-
var
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
445
|
+
var MethodologyReferenceSchema = zod.z.strictObject({
|
|
446
|
+
external_id: ExternalIdSchema.meta({
|
|
447
|
+
title: "Methodology External ID",
|
|
448
|
+
description: "Unique identifier for the methodology"
|
|
449
|
+
}),
|
|
450
|
+
name: NonEmptyStringSchema.min(5).max(150).meta({
|
|
451
|
+
title: "Methodology Name",
|
|
452
|
+
description: "Human-readable name of the methodology",
|
|
453
|
+
examples: ["BOLD Carbon (CH\u2084)", "BOLD Recycling"]
|
|
454
|
+
}),
|
|
455
|
+
version: SemanticVersionSchema.meta({
|
|
456
|
+
title: "Methodology Version",
|
|
457
|
+
description: "Version of the methodology"
|
|
458
|
+
}),
|
|
459
|
+
external_url: ExternalUrlSchema.meta({
|
|
460
|
+
title: "Methodology External URL",
|
|
461
|
+
description: "URL to view the methodology on Carrot Explorer"
|
|
462
|
+
}),
|
|
463
|
+
uri: IpfsUriSchema.optional().meta({
|
|
464
|
+
title: "Methodology IPFS URI",
|
|
465
|
+
description: "IPFS URI to the methodology record"
|
|
594
466
|
})
|
|
595
467
|
}).meta({
|
|
596
|
-
title: "
|
|
597
|
-
description: "
|
|
468
|
+
title: "Methodology Reference",
|
|
469
|
+
description: "Reference to a methodology record"
|
|
598
470
|
});
|
|
599
|
-
var
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
471
|
+
var WasteClassificationSchema = zod.z.strictObject({
|
|
472
|
+
primary_type: WasteTypeSchema.meta({
|
|
473
|
+
title: "Source Waste Primary Type",
|
|
474
|
+
description: "Primary type of the source waste"
|
|
475
|
+
}),
|
|
476
|
+
subtype: WasteSubtypeSchema.meta({
|
|
477
|
+
title: "Source Waste Subtype",
|
|
478
|
+
description: "Subtype of the source waste"
|
|
479
|
+
}),
|
|
480
|
+
net_weight_kg: WeightKgSchema.meta({
|
|
481
|
+
title: "Source Waste Net Weight",
|
|
482
|
+
description: "Net weight of the source waste"
|
|
605
483
|
})
|
|
606
484
|
}).meta({
|
|
607
|
-
title: "
|
|
608
|
-
description: "
|
|
485
|
+
title: "Waste Classification",
|
|
486
|
+
description: "Classification of the source waste (MassID)"
|
|
609
487
|
});
|
|
610
|
-
var
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
488
|
+
var AccreditedParticipantSchema = zod.z.strictObject({
|
|
489
|
+
participant_id: UuidSchema.meta({
|
|
490
|
+
title: "Participant ID",
|
|
491
|
+
description: "Unique identifier for the participant"
|
|
492
|
+
}),
|
|
493
|
+
name: ParticipantNameSchema.meta({
|
|
494
|
+
title: "Participant Name",
|
|
495
|
+
description: "Name of the participant"
|
|
496
|
+
}),
|
|
497
|
+
role: ParticipantRoleSchema.meta({
|
|
498
|
+
title: "Participant Role",
|
|
499
|
+
description: "Role of the participant in the supply chain"
|
|
500
|
+
}),
|
|
501
|
+
accreditation_id: UuidSchema.meta({
|
|
502
|
+
title: "Accreditation ID",
|
|
503
|
+
description: "Unique identifier for the participant accreditation"
|
|
504
|
+
}),
|
|
505
|
+
external_url: ExternalUrlSchema.meta({
|
|
506
|
+
title: "Participant Accreditation External URL",
|
|
507
|
+
description: "URL to view the participant accreditation on Carrot Explorer"
|
|
616
508
|
})
|
|
617
509
|
}).meta({
|
|
618
|
-
title: "
|
|
619
|
-
description: "
|
|
510
|
+
title: "Accredited Participant",
|
|
511
|
+
description: "Participant with valid accreditation in the supply chain"
|
|
620
512
|
});
|
|
621
|
-
var
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
513
|
+
var AccreditedParticipantsSchema = zod.z.array(AccreditedParticipantSchema).min(1).meta({
|
|
514
|
+
title: "Accredited Participants",
|
|
515
|
+
description: "List of participants with valid accreditations"
|
|
516
|
+
});
|
|
517
|
+
var RewardAllocationSchema = zod.z.strictObject({
|
|
518
|
+
participant_id: UuidSchema.meta({
|
|
519
|
+
title: "Participant ID",
|
|
520
|
+
description: "Unique identifier for the participant receiving the reward"
|
|
521
|
+
}),
|
|
522
|
+
participant_name: ParticipantNameSchema.meta({
|
|
523
|
+
title: "Participant Name",
|
|
524
|
+
description: "Name of the participant receiving the reward"
|
|
525
|
+
}),
|
|
526
|
+
role: ParticipantRoleSchema.meta({
|
|
527
|
+
title: "Participant Role",
|
|
528
|
+
description: "Role of the participant in the supply chain"
|
|
529
|
+
}),
|
|
530
|
+
reward_percentage: PercentageSchema.meta({
|
|
531
|
+
title: "Reward Percentage",
|
|
532
|
+
description: "Reward percentage allocated to the participant"
|
|
533
|
+
}),
|
|
534
|
+
large_business_discount_applied: zod.z.boolean().optional().meta({
|
|
535
|
+
title: "Large Business Discount Applied",
|
|
536
|
+
description: "Whether the large business discount was applied"
|
|
537
|
+
}),
|
|
538
|
+
effective_percentage: PercentageSchema.meta({
|
|
539
|
+
title: "Effective Percentage",
|
|
540
|
+
description: "Effective percentage of the reward after discounts"
|
|
627
541
|
})
|
|
628
542
|
}).meta({
|
|
629
|
-
title: "
|
|
630
|
-
description: "
|
|
543
|
+
title: "Reward Allocation",
|
|
544
|
+
description: "Reward allocation for a specific participant"
|
|
631
545
|
});
|
|
632
|
-
var
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
description: "Method used for recycling or processing the waste",
|
|
546
|
+
var DistributionNotesSchema = zod.z.strictObject({
|
|
547
|
+
large_business_discount_applied: NonEmptyStringSchema.optional().meta({
|
|
548
|
+
title: "Large Business Discount Applied",
|
|
549
|
+
description: "Description of the large business discount applied",
|
|
637
550
|
examples: [
|
|
638
|
-
"
|
|
639
|
-
|
|
640
|
-
|
|
551
|
+
"50% reduction applied to participants with >$4M annual revenue"
|
|
552
|
+
]
|
|
553
|
+
}),
|
|
554
|
+
redirected_rewards: NonEmptyStringSchema.optional().meta({
|
|
555
|
+
title: "Redirected Rewards",
|
|
556
|
+
description: "Description of the redirected rewards",
|
|
557
|
+
examples: [
|
|
558
|
+
"Discounted rewards from large businesses redirected to accredited NGOs"
|
|
641
559
|
]
|
|
642
560
|
})
|
|
643
561
|
}).meta({
|
|
644
|
-
title: "
|
|
645
|
-
description: "
|
|
646
|
-
});
|
|
647
|
-
var MassIDAttributeProcessingTimeSchema = NftAttributeSchema.extend({
|
|
648
|
-
trait_type: zod.z.literal("Processing Time (hours)"),
|
|
649
|
-
value: HoursSchema,
|
|
650
|
-
trait_description: NonEmptyStringSchema.max(200).optional().meta({
|
|
651
|
-
title: "Processing Time Description",
|
|
652
|
-
description: "Custom description for the processing time"
|
|
653
|
-
})
|
|
654
|
-
}).meta({
|
|
655
|
-
title: "Processing Time Attribute",
|
|
656
|
-
description: "Processing time attribute with optional trait description"
|
|
562
|
+
title: "Distribution Notes",
|
|
563
|
+
description: "Additional notes about the reward distribution"
|
|
657
564
|
});
|
|
658
|
-
var
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
565
|
+
var ParticipantRewardsSchema = zod.z.strictObject({
|
|
566
|
+
distribution_basis: NonEmptyStringSchema.max(200).meta({
|
|
567
|
+
title: "Distribution Basis",
|
|
568
|
+
description: "Basis for the rewards distribution"
|
|
569
|
+
}),
|
|
570
|
+
reward_allocations: zod.z.array(RewardAllocationSchema).min(1).meta({
|
|
571
|
+
title: "Reward Allocations",
|
|
572
|
+
description: "Rewards percentage allocated to each participant"
|
|
573
|
+
}),
|
|
574
|
+
distribution_notes: DistributionNotesSchema.optional().meta({
|
|
575
|
+
title: "Distribution Notes",
|
|
576
|
+
description: "Additional notes about the reward distribution"
|
|
664
577
|
})
|
|
665
578
|
}).meta({
|
|
666
|
-
title: "
|
|
667
|
-
description: "
|
|
579
|
+
title: "Participant Rewards",
|
|
580
|
+
description: "Rewards distribution to participants"
|
|
668
581
|
});
|
|
669
|
-
var
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
582
|
+
var SchemaHashSchema = zod.z.union([
|
|
583
|
+
Keccak256HashSchema,
|
|
584
|
+
zod.z.string().regex(
|
|
585
|
+
/^0x[a-fA-F0-9]{64}$/,
|
|
586
|
+
"Must be a Keccak256 hash as 0x-prefixed hex string"
|
|
587
|
+
)
|
|
588
|
+
]).meta({
|
|
589
|
+
title: "Schema Hash",
|
|
590
|
+
description: "Keccak256 hash of the JSON Schema this record was validated against",
|
|
591
|
+
examples: [
|
|
592
|
+
"ac08c3cf2e175e55961d6affdb38bc24591b84ceef7f3707c69ae3d52c148b2f",
|
|
593
|
+
"0xac08c3cf2e175e55961d6affdb38bc24591b84ceef7f3707c69ae3d52c148b2f"
|
|
594
|
+
]
|
|
679
595
|
});
|
|
680
|
-
var
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
title: "
|
|
684
|
-
description: "
|
|
685
|
-
|
|
596
|
+
var SchemaInfoSchema = zod.z.strictObject({
|
|
597
|
+
hash: SchemaHashSchema,
|
|
598
|
+
type: RecordSchemaTypeSchema.meta({
|
|
599
|
+
title: "Schema Type",
|
|
600
|
+
description: "Type/category of this schema"
|
|
601
|
+
}),
|
|
602
|
+
version: SemanticVersionSchema.meta({
|
|
603
|
+
title: "Schema Version",
|
|
604
|
+
description: "Version of the schema, using semantic versioning"
|
|
686
605
|
})
|
|
687
606
|
}).meta({
|
|
688
|
-
title: "
|
|
689
|
-
description: "Transport manifest code attribute (optional)"
|
|
607
|
+
title: "Schema Information"
|
|
690
608
|
});
|
|
691
|
-
var
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
609
|
+
var RecordCreatorSchema = zod.z.strictObject({
|
|
610
|
+
name: zod.z.string().meta({
|
|
611
|
+
title: "Creator Name",
|
|
612
|
+
description: "Company or individual name that created this record",
|
|
613
|
+
examples: ["Carrot Foundation"]
|
|
614
|
+
}),
|
|
615
|
+
id: UuidSchema.meta({
|
|
616
|
+
title: "Creator ID",
|
|
617
|
+
description: "Unique identifier for the creator"
|
|
697
618
|
})
|
|
698
619
|
}).meta({
|
|
699
|
-
title: "
|
|
700
|
-
description: "
|
|
620
|
+
title: "Creator",
|
|
621
|
+
description: "Entity that created this record"
|
|
701
622
|
});
|
|
702
|
-
var
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
623
|
+
var RecordRelationshipSchema = zod.z.strictObject({
|
|
624
|
+
target_uri: IpfsUriSchema.meta({
|
|
625
|
+
title: "Target IPFS URI",
|
|
626
|
+
description: "Target IPFS URI of the referenced record"
|
|
627
|
+
}),
|
|
628
|
+
type: RecordRelationshipTypeSchema.meta({
|
|
629
|
+
title: "Relationship Type",
|
|
630
|
+
description: "Type of relationship to the referenced record"
|
|
631
|
+
}),
|
|
632
|
+
description: zod.z.string().optional().meta({
|
|
633
|
+
title: "Relationship Description",
|
|
634
|
+
description: "Human-readable description of the relationship",
|
|
707
635
|
examples: [
|
|
708
|
-
"
|
|
709
|
-
"
|
|
710
|
-
"
|
|
711
|
-
"
|
|
636
|
+
"This record supersedes the previous version",
|
|
637
|
+
"Related carbon credit batch",
|
|
638
|
+
"Source document for this verification",
|
|
639
|
+
"Child record derived from this parent",
|
|
640
|
+
"Updated version of original record"
|
|
712
641
|
]
|
|
713
642
|
})
|
|
714
643
|
}).meta({
|
|
715
|
-
title: "
|
|
716
|
-
description: "
|
|
717
|
-
});
|
|
718
|
-
var MassIDAttributeContainerTypeSchema = NftAttributeSchema.extend({
|
|
719
|
-
trait_type: zod.z.literal("Container Type"),
|
|
720
|
-
value: NonEmptyStringSchema.max(100).meta({
|
|
721
|
-
title: "Container Type Value",
|
|
722
|
-
description: "Type of container used for waste storage or transport",
|
|
723
|
-
examples: ["Truck", "Dumpster", "Roll-off Container", "Compactor", "Bin"]
|
|
724
|
-
})
|
|
725
|
-
}).meta({
|
|
726
|
-
title: "Container Type Attribute",
|
|
727
|
-
description: "Container type attribute (optional)"
|
|
728
|
-
});
|
|
729
|
-
var MassIDAttributePickUpDateSchema = NftAttributeSchema.extend({
|
|
730
|
-
trait_type: zod.z.literal("Pick-up Date"),
|
|
731
|
-
value: UnixTimestampSchema.meta({
|
|
732
|
-
title: "Pick-up Date Value",
|
|
733
|
-
description: "Unix timestamp in milliseconds when the waste was picked up from the source",
|
|
734
|
-
examples: [17105184e5, 17040672e5, 17152704e5]
|
|
735
|
-
}),
|
|
736
|
-
display_type: zod.z.literal("date")
|
|
737
|
-
}).meta({
|
|
738
|
-
title: "Pick-up Date Attribute",
|
|
739
|
-
description: "Pick-up date attribute with Unix timestamp"
|
|
740
|
-
});
|
|
741
|
-
var MassIDAttributeRecyclingDateSchema = NftAttributeSchema.extend({
|
|
742
|
-
trait_type: zod.z.literal("Recycling Date"),
|
|
743
|
-
value: UnixTimestampSchema.meta({
|
|
744
|
-
title: "Recycling Date Value",
|
|
745
|
-
description: "Unix timestamp in milliseconds when the waste was recycled/processed",
|
|
746
|
-
examples: [17106048e5, 17041536e5, 17153568e5]
|
|
747
|
-
}),
|
|
748
|
-
display_type: zod.z.literal("date")
|
|
749
|
-
}).meta({
|
|
750
|
-
title: "Recycling Date Attribute",
|
|
751
|
-
description: "Recycling date attribute with Unix timestamp"
|
|
752
|
-
});
|
|
753
|
-
var MassIDAttributesSchema = uniqueBy(
|
|
754
|
-
zod.z.union([
|
|
755
|
-
MassIDAttributeWasteTypeSchema,
|
|
756
|
-
MassIDAttributeWasteSubtypeSchema,
|
|
757
|
-
MassIDAttributeWeightSchema,
|
|
758
|
-
MassIDAttributeOriginCountrySchema,
|
|
759
|
-
MassIDAttributeOriginMunicipalitySchema,
|
|
760
|
-
MassIDAttributeOriginDivisionSchema,
|
|
761
|
-
MassIDAttributeVehicleTypeSchema,
|
|
762
|
-
MassIDAttributeRecyclingMethodSchema,
|
|
763
|
-
MassIDAttributeProcessingTimeSchema,
|
|
764
|
-
MassIDAttributeLocalWasteClassificationIdSchema,
|
|
765
|
-
MassIDAttributeRecyclingManifestCodeSchema,
|
|
766
|
-
MassIDAttributeTransportManifestCodeSchema,
|
|
767
|
-
MassIDAttributeWeighingCaptureMethodSchema,
|
|
768
|
-
MassIDAttributeScaleTypeSchema,
|
|
769
|
-
MassIDAttributeContainerTypeSchema,
|
|
770
|
-
MassIDAttributePickUpDateSchema,
|
|
771
|
-
MassIDAttributeRecyclingDateSchema
|
|
772
|
-
]),
|
|
773
|
-
(attr) => attr.trait_type
|
|
774
|
-
).min(12).max(17).meta({
|
|
775
|
-
title: "MassID Attributes",
|
|
776
|
-
description: "MassID NFT attributes array containing attributes selected from the available attribute types. The schema validates array length but does not enforce which specific attributes must be present."
|
|
777
|
-
});
|
|
778
|
-
var PrecisionLevelSchema = zod.z.enum(["exact", "neighborhood", "city", "region", "country"]).meta({
|
|
779
|
-
title: "Precision Level",
|
|
780
|
-
description: "Level of coordinate precision",
|
|
781
|
-
examples: ["city", "exact", "neighborhood"]
|
|
644
|
+
title: "Relationship",
|
|
645
|
+
description: "Relationship to another IPFS record"
|
|
782
646
|
});
|
|
783
|
-
var
|
|
784
|
-
|
|
785
|
-
title: "
|
|
786
|
-
description: "
|
|
647
|
+
var RecordEnvironmentSchema = zod.z.strictObject({
|
|
648
|
+
blockchain_network: zod.z.enum(["mainnet", "testnet"]).meta({
|
|
649
|
+
title: "Blockchain Network",
|
|
650
|
+
description: "Blockchain Network Environment"
|
|
787
651
|
}),
|
|
788
|
-
|
|
789
|
-
title: "
|
|
790
|
-
description: "
|
|
652
|
+
deployment: zod.z.enum(["production", "development", "testing"]).meta({
|
|
653
|
+
title: "Deployment Environment",
|
|
654
|
+
description: "System environment where this record was generated"
|
|
791
655
|
}),
|
|
792
|
-
|
|
656
|
+
data_set_name: zod.z.enum(["TEST", "PROD"]).meta({
|
|
657
|
+
title: "Data Set Name",
|
|
658
|
+
description: "Name of the data set for this record"
|
|
659
|
+
})
|
|
793
660
|
}).meta({
|
|
794
|
-
title: "
|
|
795
|
-
description: "
|
|
661
|
+
title: "Environment",
|
|
662
|
+
description: "Environment information"
|
|
796
663
|
});
|
|
797
|
-
var
|
|
798
|
-
|
|
799
|
-
title: "
|
|
800
|
-
description: "
|
|
664
|
+
var BaseIpfsSchema = zod.z.strictObject({
|
|
665
|
+
$schema: zod.z.url("Must be a valid URI").meta({
|
|
666
|
+
title: "JSON Schema URI",
|
|
667
|
+
description: "URI of the JSON Schema used to validate this record",
|
|
668
|
+
example: "https://raw.githubusercontent.com/carrot-foundation/schemas/refs/heads/main/schemas/ipfs/shared/base/base.schema.json"
|
|
801
669
|
}),
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
670
|
+
schema: SchemaInfoSchema,
|
|
671
|
+
created_at: IsoTimestampSchema.meta({
|
|
672
|
+
title: "Created At",
|
|
673
|
+
description: "ISO 8601 creation timestamp for this record"
|
|
806
674
|
}),
|
|
807
|
-
|
|
808
|
-
title: "
|
|
809
|
-
description: "
|
|
810
|
-
examples: ["California", "Ontario", "Bavaria", "Queensland"]
|
|
675
|
+
external_id: ExternalIdSchema.meta({
|
|
676
|
+
title: "External ID",
|
|
677
|
+
description: "Off-chain reference ID (UUID from Carrot backend)"
|
|
811
678
|
}),
|
|
812
|
-
|
|
813
|
-
title: "
|
|
814
|
-
description: "
|
|
679
|
+
external_url: ExternalUrlSchema.meta({
|
|
680
|
+
title: "External URL",
|
|
681
|
+
description: "External URL of the content"
|
|
815
682
|
}),
|
|
816
|
-
|
|
817
|
-
title: "
|
|
818
|
-
description: "
|
|
819
|
-
examples: ["United States", "Canada", "Germany", "Australia"]
|
|
683
|
+
original_content_hash: Sha256HashSchema.meta({
|
|
684
|
+
title: "Original Content Hash",
|
|
685
|
+
description: "SHA-256 hash of the original JSON content including private data before schema validation"
|
|
820
686
|
}),
|
|
821
|
-
|
|
822
|
-
title: "
|
|
823
|
-
description: "
|
|
687
|
+
content_hash: Sha256HashSchema.meta({
|
|
688
|
+
title: "Content Hash",
|
|
689
|
+
description: "SHA-256 hash of RFC 8785 canonicalized JSON after schema validation"
|
|
824
690
|
}),
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
691
|
+
creator: RecordCreatorSchema.optional(),
|
|
692
|
+
relationships: zod.z.array(RecordRelationshipSchema).optional().meta({
|
|
693
|
+
title: "Relationships",
|
|
694
|
+
description: "References to other IPFS records this record relates to"
|
|
828
695
|
}),
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
title: "
|
|
832
|
-
description: "
|
|
696
|
+
environment: RecordEnvironmentSchema.optional(),
|
|
697
|
+
data: zod.z.record(zod.z.string(), zod.z.unknown()).optional().meta({
|
|
698
|
+
title: "Custom Data",
|
|
699
|
+
description: "Custom data block that includes the record's data"
|
|
833
700
|
})
|
|
834
701
|
}).meta({
|
|
835
|
-
title: "
|
|
836
|
-
description: "
|
|
702
|
+
title: "Base IPFS Record",
|
|
703
|
+
description: "Base fields for all Carrot IPFS records, providing common structure for any JSON content stored in IPFS"
|
|
837
704
|
});
|
|
838
|
-
var
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
705
|
+
var NftSchemaTypeSchema = RecordSchemaTypeSchema.extract([
|
|
706
|
+
"MassID",
|
|
707
|
+
"RecycledID",
|
|
708
|
+
"GasID",
|
|
709
|
+
"PurchaseID"
|
|
710
|
+
]).meta({
|
|
711
|
+
title: "NFT Schema Type",
|
|
712
|
+
description: "Type of schema for NFT records"
|
|
713
|
+
});
|
|
714
|
+
var BlockchainReferenceSchema = zod.z.strictObject({
|
|
715
|
+
smart_contract_address: EthereumAddressSchema.meta({
|
|
716
|
+
title: "Smart Contract Address"
|
|
842
717
|
}),
|
|
843
|
-
|
|
844
|
-
title: "
|
|
845
|
-
description: "
|
|
718
|
+
chain_id: BlockchainChainIdSchema.meta({
|
|
719
|
+
title: "Chain ID",
|
|
720
|
+
description: "Blockchain chain ID"
|
|
846
721
|
}),
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
"
|
|
850
|
-
)
|
|
851
|
-
|
|
852
|
-
|
|
722
|
+
network_name: zod.z.string().min(5).max(100).meta({
|
|
723
|
+
title: "Network Name",
|
|
724
|
+
description: "Name of the blockchain network"
|
|
725
|
+
}),
|
|
726
|
+
token_id: TokenIdSchema.meta({
|
|
727
|
+
title: "Token ID",
|
|
728
|
+
description: "NFT token ID"
|
|
853
729
|
})
|
|
854
730
|
}).meta({
|
|
855
|
-
title: "
|
|
856
|
-
description: "
|
|
731
|
+
title: "Blockchain Information",
|
|
732
|
+
description: "Blockchain-specific information for the NFT"
|
|
857
733
|
});
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
title: "Classification Code",
|
|
863
|
-
description: "Local waste classification code",
|
|
864
|
-
examples: ["20 01 01", "D001", "EWC-150101", "IBAMA-A001"]
|
|
734
|
+
var ExternalLinkSchema = zod.z.strictObject({
|
|
735
|
+
label: zod.z.string().min(1).max(50).meta({
|
|
736
|
+
title: "Link Label",
|
|
737
|
+
description: "Display name for the external link"
|
|
865
738
|
}),
|
|
866
|
-
|
|
867
|
-
title: "
|
|
868
|
-
description: "
|
|
869
|
-
examples: [
|
|
870
|
-
"Paper and cardboard packaging",
|
|
871
|
-
"Ignitable waste",
|
|
872
|
-
"Paper and cardboard packaging waste",
|
|
873
|
-
"Municipal solid waste - organic fraction"
|
|
874
|
-
]
|
|
739
|
+
url: zod.z.url("Must be a valid URI").meta({
|
|
740
|
+
title: "Link URL",
|
|
741
|
+
description: "Direct URI to the linked resource"
|
|
875
742
|
}),
|
|
876
|
-
|
|
877
|
-
title: "
|
|
878
|
-
description: "
|
|
879
|
-
examples: ["IBAMA"]
|
|
743
|
+
description: zod.z.string().min(10).max(100).optional().meta({
|
|
744
|
+
title: "Link Description",
|
|
745
|
+
description: "Optional context about what the link provides"
|
|
880
746
|
})
|
|
881
747
|
}).meta({
|
|
882
|
-
title: "
|
|
883
|
-
description: "
|
|
884
|
-
});
|
|
885
|
-
var MassIDMeasurementUnitSchema = zod.z.enum(["kg", "ton"]).meta({
|
|
886
|
-
title: "Measurement Unit",
|
|
887
|
-
description: "Unit of measurement for the waste quantity",
|
|
888
|
-
examples: ["kg", "ton"]
|
|
748
|
+
title: "External Link",
|
|
749
|
+
description: "External link with label and description"
|
|
889
750
|
});
|
|
890
|
-
var
|
|
891
|
-
|
|
892
|
-
title: "
|
|
893
|
-
description: "
|
|
751
|
+
var NftAttributeSchema = zod.z.strictObject({
|
|
752
|
+
trait_type: zod.z.string().max(50).meta({
|
|
753
|
+
title: "Trait Type",
|
|
754
|
+
description: "Name of the trait or attribute"
|
|
894
755
|
}),
|
|
895
|
-
|
|
896
|
-
title: "
|
|
897
|
-
description: "
|
|
756
|
+
value: zod.z.union([zod.z.string(), zod.z.number(), zod.z.boolean()]).meta({
|
|
757
|
+
title: "Trait Value",
|
|
758
|
+
description: "Value of the trait - can be string, number, or boolean"
|
|
898
759
|
}),
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
760
|
+
display_type: zod.z.enum(["number", "date", "boost_number", "boost_percentage"]).optional().meta({
|
|
761
|
+
title: "Display Type",
|
|
762
|
+
description: "How the trait should be displayed in marketplace UIs"
|
|
763
|
+
}),
|
|
764
|
+
max_value: NonNegativeFloatSchema.optional().meta({
|
|
765
|
+
title: "Max Value",
|
|
766
|
+
description: "Maximum possible value for numeric traits"
|
|
904
767
|
})
|
|
905
768
|
}).meta({
|
|
906
|
-
title: "
|
|
907
|
-
description: "
|
|
908
|
-
});
|
|
909
|
-
var EventAttributeFormatSchema = zod.z.enum(["KILOGRAM", "DATE", "CURRENCY", "PERCENTAGE", "COORDINATE"]).meta({
|
|
910
|
-
title: "Event Attribute Format",
|
|
911
|
-
description: "Data format hint for proper display",
|
|
912
|
-
examples: ["KILOGRAM", "DATE", "PERCENTAGE"]
|
|
769
|
+
title: "NFT Attribute",
|
|
770
|
+
description: "NFT attribute or trait with type and value"
|
|
913
771
|
});
|
|
914
|
-
var
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
"humidity",
|
|
921
|
-
"contamination_percentage",
|
|
922
|
-
"quality_grade",
|
|
923
|
-
"batch_number",
|
|
924
|
-
"operator_id",
|
|
925
|
-
"equipment_used",
|
|
926
|
-
"processing_cost"
|
|
927
|
-
]
|
|
772
|
+
var NftIpfsSchema = BaseIpfsSchema.safeExtend({
|
|
773
|
+
schema: BaseIpfsSchema.shape.schema.safeExtend({
|
|
774
|
+
type: NftSchemaTypeSchema.meta({
|
|
775
|
+
title: "NFT Schema Type",
|
|
776
|
+
description: "Type/category of this NFT schema"
|
|
777
|
+
})
|
|
928
778
|
}),
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
779
|
+
blockchain: BlockchainReferenceSchema,
|
|
780
|
+
name: zod.z.string().min(1).max(100).meta({
|
|
781
|
+
title: "NFT Name",
|
|
782
|
+
description: "Full display name for this NFT, including extra context",
|
|
932
783
|
examples: [
|
|
933
|
-
|
|
934
|
-
"
|
|
935
|
-
|
|
936
|
-
"BATCH-2024-001",
|
|
937
|
-
12.75,
|
|
938
|
-
"Shredder-X200",
|
|
939
|
-
false,
|
|
940
|
-
"OP-456"
|
|
784
|
+
"MassID #123 \u2022 Organic \u2022 3.0t",
|
|
785
|
+
"RecycledID #456 \u2022 Plastic \u2022 2.5t",
|
|
786
|
+
"GasID #789 \u2022 Methane \u2022 1000 m\xB3"
|
|
941
787
|
]
|
|
942
788
|
}),
|
|
943
|
-
|
|
944
|
-
title: "
|
|
945
|
-
description: "
|
|
946
|
-
|
|
947
|
-
format: EventAttributeFormatSchema.optional()
|
|
948
|
-
}).meta({
|
|
949
|
-
title: "Event Attribute",
|
|
950
|
-
description: "Additional attribute specific to an event"
|
|
951
|
-
});
|
|
952
|
-
var EventAttachmentSchema = zod.z.strictObject({
|
|
953
|
-
type: NonEmptyStringSchema.max(50).meta({
|
|
954
|
-
title: "Attachment Type",
|
|
955
|
-
description: "Type of supporting attachment",
|
|
956
|
-
examples: [
|
|
957
|
-
"Waste Transfer Note",
|
|
958
|
-
"Certificate of Disposal",
|
|
959
|
-
"Certificate of Final Destination",
|
|
960
|
-
"Quality Assessment Report",
|
|
961
|
-
"Transport Manifest",
|
|
962
|
-
"Processing Receipt",
|
|
963
|
-
"Environmental Permit",
|
|
964
|
-
"Invoice"
|
|
965
|
-
]
|
|
789
|
+
short_name: zod.z.string().min(1).max(50).meta({
|
|
790
|
+
title: "Short Name",
|
|
791
|
+
description: "Compact name for UI summaries, tables, or tooltips",
|
|
792
|
+
examples: ["MassID #123", "RecycledID #456", "GasID #789"]
|
|
966
793
|
}),
|
|
967
|
-
|
|
968
|
-
title: "
|
|
969
|
-
description: "
|
|
794
|
+
description: zod.z.string().min(10).max(500).meta({
|
|
795
|
+
title: "Description",
|
|
796
|
+
description: "Human-readable summary of the NFT's role and context. Ideally, maximum 300 characters.",
|
|
970
797
|
examples: [
|
|
971
|
-
"
|
|
972
|
-
"
|
|
973
|
-
"INV-2024-QTR1-789",
|
|
974
|
-
"PERMIT-EPA-2024-001",
|
|
975
|
-
"MANIFEST-DOT-567890"
|
|
798
|
+
"This MassID represents 3 metric tons of organic food waste from Enlatados Produ\xE7\xE3o, tracked through complete chain of custody from generation to composting.",
|
|
799
|
+
"This RecycledID represents 2.5 metric tons of recycled plastic bottles processed by Green Solutions Ltd."
|
|
976
800
|
]
|
|
977
801
|
}),
|
|
978
|
-
|
|
979
|
-
title: "
|
|
980
|
-
description: "
|
|
981
|
-
examples: [
|
|
982
|
-
"QmYjtig7VJQ6XsnUjqqJvj7QaMcCAwtrgNdahSiFofrE7o",
|
|
983
|
-
"waste_transfer_note_2024_001.pdf",
|
|
984
|
-
"https://docs.example.com/certificates/disposal_cert_456.pdf",
|
|
985
|
-
"bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi",
|
|
986
|
-
"processing_receipt_20240315.jpg"
|
|
987
|
-
]
|
|
802
|
+
image: IpfsUriSchema.meta({
|
|
803
|
+
title: "Image URI",
|
|
804
|
+
description: "IPFS URI pointing to the preview image"
|
|
988
805
|
}),
|
|
989
|
-
|
|
990
|
-
title: "
|
|
991
|
-
description: "
|
|
992
|
-
examples: [17105184e5, 17040672e5, 17152704e5]
|
|
806
|
+
background_color: HexColorSchema.optional().meta({
|
|
807
|
+
title: "Background Color",
|
|
808
|
+
description: "Hex color code for marketplace background display"
|
|
993
809
|
}),
|
|
994
|
-
|
|
995
|
-
title: "
|
|
996
|
-
description: "
|
|
810
|
+
animation_url: IpfsUriSchema.optional().meta({
|
|
811
|
+
title: "Animation URL",
|
|
812
|
+
description: "IPFS URI pointing to an animated or interactive media file",
|
|
997
813
|
examples: [
|
|
998
|
-
"
|
|
999
|
-
"
|
|
1000
|
-
"Green Recycling Corp",
|
|
1001
|
-
"City Waste Authority",
|
|
1002
|
-
"EcoProcess Industries",
|
|
1003
|
-
"Regional Environmental Office"
|
|
814
|
+
"ipfs://QmAnimation123/mass-id-animation.mp4",
|
|
815
|
+
"ipfs://QmInteractive456/recycled-visualization.webm"
|
|
1004
816
|
]
|
|
1005
|
-
})
|
|
1006
|
-
}).meta({
|
|
1007
|
-
title: "Event Attachment",
|
|
1008
|
-
description: "Supporting event attachment"
|
|
1009
|
-
});
|
|
1010
|
-
var MassIDChainOfCustodyEventSchema = zod.z.strictObject({
|
|
1011
|
-
event_id: UuidSchema.meta({
|
|
1012
|
-
title: "Event ID",
|
|
1013
|
-
description: "Unique event identifier"
|
|
1014
|
-
}),
|
|
1015
|
-
event_name: NonEmptyStringSchema.max(50).meta({
|
|
1016
|
-
title: "Event Name",
|
|
1017
|
-
description: "Name of custody or processing event",
|
|
1018
|
-
examples: ["Sorting", "Processing", "Recycling", "Weighing"]
|
|
1019
817
|
}),
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
818
|
+
external_links: uniqueBy(
|
|
819
|
+
ExternalLinkSchema,
|
|
820
|
+
(link) => link.url,
|
|
821
|
+
"External link URLs must be unique"
|
|
822
|
+
).max(10).optional().meta({
|
|
823
|
+
title: "External Links",
|
|
824
|
+
description: "Optional list of public resource links with labels",
|
|
1023
825
|
examples: [
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
from_location_id_hash: Sha256HashSchema.meta({
|
|
1076
|
-
title: "From Location ID Hash",
|
|
1077
|
-
description: "Reference hash of the location where the waste started movement"
|
|
1078
|
-
}),
|
|
1079
|
-
to_location_id_hash: Sha256HashSchema.meta({
|
|
1080
|
-
title: "To Location ID Hash",
|
|
1081
|
-
description: "Reference hash of the location where the waste ended movement"
|
|
1082
|
-
}),
|
|
1083
|
-
first_reported_timestamp: UnixTimestampSchema.meta({
|
|
1084
|
-
title: "First Reported Timestamp",
|
|
1085
|
-
description: "Unix timestamp in milliseconds when the waste was first reported/collected at the origin location",
|
|
1086
|
-
examples: [17105184e5, 17040672e5, 17152704e5]
|
|
1087
|
-
}),
|
|
1088
|
-
last_reported_timestamp: UnixTimestampSchema.meta({
|
|
1089
|
-
title: "Last Reported Timestamp",
|
|
1090
|
-
description: "Unix timestamp in milliseconds when the waste was last reported/processed at the destination location",
|
|
1091
|
-
examples: [17106048e5, 17041536e5, 17153568e5]
|
|
1092
|
-
})
|
|
1093
|
-
}).refine((data) => {
|
|
1094
|
-
return data.first_reported_timestamp <= data.last_reported_timestamp;
|
|
1095
|
-
}, "first_reported_timestamp must be before or equal to last_reported_timestamp").meta({
|
|
1096
|
-
title: "Geographic Data",
|
|
1097
|
-
description: "Simplified geographic information tracking waste movement from origin to destination with temporal bounds"
|
|
1098
|
-
});
|
|
1099
|
-
var MassIDDataSchema = zod.z.strictObject({
|
|
1100
|
-
waste_properties: MassIDWastePropertiesSchema,
|
|
1101
|
-
locations: uniqueBy(
|
|
1102
|
-
LocationSchema,
|
|
1103
|
-
(loc) => loc.id_hash,
|
|
1104
|
-
"Location ID hashes must be unique"
|
|
1105
|
-
).min(1).meta({
|
|
1106
|
-
title: "Locations",
|
|
1107
|
-
description: "All locations referenced in this MassID, indexed by ID"
|
|
1108
|
-
}),
|
|
1109
|
-
participants: uniqueBy(
|
|
1110
|
-
ParticipantSchema,
|
|
1111
|
-
(p) => p.id_hash,
|
|
1112
|
-
"Participant ID hashes must be unique"
|
|
1113
|
-
).min(1).meta({
|
|
1114
|
-
title: "Participants",
|
|
1115
|
-
description: "All participants referenced in this MassID, indexed by ID"
|
|
1116
|
-
}),
|
|
1117
|
-
chain_of_custody: MassIDChainOfCustodySchema,
|
|
1118
|
-
geographic_data: MassIDGeographicDataSchema
|
|
1119
|
-
}).refine((data) => {
|
|
1120
|
-
const participantIdSet = new Set(
|
|
1121
|
-
data.participants.map((participant) => participant.id_hash)
|
|
1122
|
-
);
|
|
1123
|
-
const eventParticipantIds = data.chain_of_custody.events.map(
|
|
1124
|
-
(event) => event.participant_id_hash
|
|
1125
|
-
);
|
|
1126
|
-
const allEventParticipantsExist = eventParticipantIds.every(
|
|
1127
|
-
(participantId) => participantIdSet.has(participantId)
|
|
1128
|
-
);
|
|
1129
|
-
return allEventParticipantsExist;
|
|
1130
|
-
}, "All participant ID hashes in chain of custody events must exist in participants array").refine((data) => {
|
|
1131
|
-
const locationIdSet = new Set(
|
|
1132
|
-
data.locations.map((location) => location.id_hash)
|
|
1133
|
-
);
|
|
1134
|
-
const eventLocationIds = data.chain_of_custody.events.map(
|
|
1135
|
-
(event) => event.location_id_hash
|
|
1136
|
-
);
|
|
1137
|
-
const allEventLocationsExist = eventLocationIds.every(
|
|
1138
|
-
(locationId) => locationIdSet.has(locationId)
|
|
1139
|
-
);
|
|
1140
|
-
return allEventLocationsExist;
|
|
1141
|
-
}, "All location ID hashes in chain of custody events must exist in locations array").meta({
|
|
1142
|
-
title: "MassID Data",
|
|
1143
|
-
description: "MassID data containing waste tracking and chain of custody information"
|
|
826
|
+
[
|
|
827
|
+
{
|
|
828
|
+
label: "Carrot Explorer",
|
|
829
|
+
url: "https://explore.carrot.eco/document/ad44dd3f-f176-4b98-bf78-5ee6e77d0530",
|
|
830
|
+
description: "Complete chain of custody and audit trail"
|
|
831
|
+
},
|
|
832
|
+
{
|
|
833
|
+
label: "Carrot White Paper",
|
|
834
|
+
url: "https://carrot.eco/whitepaper.pdf",
|
|
835
|
+
description: "Carrot Foundation technical and impact white paper"
|
|
836
|
+
}
|
|
837
|
+
]
|
|
838
|
+
]
|
|
839
|
+
}),
|
|
840
|
+
attributes: uniqueBy(
|
|
841
|
+
NftAttributeSchema,
|
|
842
|
+
(attr) => attr.trait_type,
|
|
843
|
+
"Attribute trait_type values must be unique"
|
|
844
|
+
).meta({
|
|
845
|
+
title: "NFT Attributes",
|
|
846
|
+
description: "List of visual traits and filterable attributes compatible with NFT marketplaces",
|
|
847
|
+
examples: [
|
|
848
|
+
[
|
|
849
|
+
{
|
|
850
|
+
trait_type: "Waste Type",
|
|
851
|
+
value: "Organic"
|
|
852
|
+
},
|
|
853
|
+
{
|
|
854
|
+
trait_type: "Waste Subtype",
|
|
855
|
+
value: "Food, Food Waste and Beverages"
|
|
856
|
+
},
|
|
857
|
+
{
|
|
858
|
+
trait_type: "Weight (kg)",
|
|
859
|
+
value: 3e3,
|
|
860
|
+
display_type: "number"
|
|
861
|
+
},
|
|
862
|
+
{
|
|
863
|
+
trait_type: "Origin Country",
|
|
864
|
+
value: "Brazil"
|
|
865
|
+
},
|
|
866
|
+
{
|
|
867
|
+
trait_type: "Pick-up Date",
|
|
868
|
+
value: "2024-12-05",
|
|
869
|
+
display_type: "date"
|
|
870
|
+
}
|
|
871
|
+
]
|
|
872
|
+
]
|
|
873
|
+
})
|
|
874
|
+
}).meta({
|
|
875
|
+
title: "NFT IPFS Record",
|
|
876
|
+
description: "NFT-specific fields for Carrot IPFS records"
|
|
1144
877
|
});
|
|
1145
878
|
function getSchemaBaseUrl() {
|
|
1146
879
|
return `https://raw.githubusercontent.com/carrot-foundation/schemas/refs/tags/${getSchemaVersionOrDefault()}/schemas/ipfs`;
|
|
@@ -1150,402 +883,648 @@ function buildSchemaUrl(schemaPath) {
|
|
|
1150
883
|
return `${getSchemaBaseUrl()}/${cleanPath}`;
|
|
1151
884
|
}
|
|
1152
885
|
function getSchemaVersionOrDefault() {
|
|
1153
|
-
return "0.1.
|
|
886
|
+
return "0.1.35";
|
|
1154
887
|
}
|
|
1155
|
-
|
|
1156
|
-
// src/mass-id/mass-id.schema.ts
|
|
1157
|
-
var MassIDIpfsSchemaMeta = {
|
|
1158
|
-
title: "MassID NFT IPFS Record",
|
|
1159
|
-
description: "Complete MassID NFT IPFS record including fixed attributes and detailed waste tracking data",
|
|
1160
|
-
$id: buildSchemaUrl("mass-id/mass-id.schema.json"),
|
|
1161
|
-
version: getSchemaVersionOrDefault()
|
|
1162
|
-
};
|
|
1163
|
-
var MassIDIpfsSchema = NftIpfsSchema.safeExtend({
|
|
1164
|
-
schema: NftIpfsSchema.shape.schema.safeExtend({
|
|
1165
|
-
type: zod.z.literal("MassID").meta({
|
|
1166
|
-
title: "MassID Schema Type",
|
|
1167
|
-
description: "MassID NFT schema type"
|
|
1168
|
-
})
|
|
1169
|
-
}),
|
|
1170
|
-
attributes: MassIDAttributesSchema,
|
|
1171
|
-
data: MassIDDataSchema
|
|
1172
|
-
}).meta(MassIDIpfsSchemaMeta);
|
|
1173
|
-
var GasIDAttributeMethodologySchema = NftAttributeSchema.extend({
|
|
888
|
+
var MethodologyAttributeSchema = NftAttributeSchema.extend({
|
|
1174
889
|
trait_type: zod.z.literal("Methodology"),
|
|
1175
|
-
value:
|
|
1176
|
-
title: "Methodology Value",
|
|
1177
|
-
description: "Name of the carbon methodology used for certification",
|
|
1178
|
-
examples: ["BOLD Carbon (CH\u2084)"]
|
|
1179
|
-
})
|
|
890
|
+
value: MethodologyNameSchema
|
|
1180
891
|
}).meta({
|
|
1181
892
|
title: "Methodology Attribute",
|
|
1182
|
-
description: "Methodology
|
|
1183
|
-
});
|
|
1184
|
-
var GasIDAttributeGasTypeSchema = NftAttributeSchema.extend({
|
|
1185
|
-
trait_type: zod.z.literal("Gas Type"),
|
|
1186
|
-
value: NonEmptyStringSchema.max(100).meta({
|
|
1187
|
-
title: "Gas Type Value",
|
|
1188
|
-
description: "Type of gas prevented",
|
|
1189
|
-
examples: ["Methane (CH\u2084)", "Carbon Dioxide (CO\u2082)"]
|
|
1190
|
-
})
|
|
1191
|
-
}).meta({
|
|
1192
|
-
title: "Gas Type Attribute",
|
|
1193
|
-
description: "Gas type attribute"
|
|
1194
|
-
});
|
|
1195
|
-
var GasIDAttributeCo2ePreventedSchema = NftAttributeSchema.extend({
|
|
1196
|
-
trait_type: zod.z.literal("CO\u2082e Prevented (kg)"),
|
|
1197
|
-
value: NonNegativeFloatSchema.meta({
|
|
1198
|
-
title: "CO\u2082e Prevented Value",
|
|
1199
|
-
description: "Total CO\u2082 equivalent emissions prevented in kilograms"
|
|
1200
|
-
}),
|
|
1201
|
-
display_type: zod.z.literal("number")
|
|
1202
|
-
}).meta({
|
|
1203
|
-
title: "CO\u2082e Prevented Attribute",
|
|
1204
|
-
description: "CO\u2082e prevented attribute with numeric display"
|
|
893
|
+
description: "Methodology used for certification"
|
|
1205
894
|
});
|
|
1206
|
-
var
|
|
895
|
+
var CreditAmountAttributeSchema = NftAttributeSchema.extend({
|
|
1207
896
|
trait_type: zod.z.literal("Credit Amount"),
|
|
1208
|
-
value:
|
|
1209
|
-
title: "Credit Amount Value",
|
|
1210
|
-
description: "Amount of credits issued"
|
|
1211
|
-
}),
|
|
897
|
+
value: CreditAmountSchema,
|
|
1212
898
|
display_type: zod.z.literal("number")
|
|
1213
899
|
}).meta({
|
|
1214
900
|
title: "Credit Amount Attribute",
|
|
1215
901
|
description: "Credit amount attribute with numeric display"
|
|
1216
902
|
});
|
|
1217
|
-
var
|
|
903
|
+
var CreditTypeAttributeSchema = NftAttributeSchema.extend({
|
|
1218
904
|
trait_type: zod.z.literal("Credit Type"),
|
|
1219
|
-
value:
|
|
1220
|
-
title: "Credit Type Value",
|
|
1221
|
-
description: "Type of credit issued",
|
|
1222
|
-
examples: ["Carrot Carbon"]
|
|
1223
|
-
})
|
|
905
|
+
value: CreditTypeSchema
|
|
1224
906
|
}).meta({
|
|
1225
907
|
title: "Credit Type Attribute",
|
|
1226
908
|
description: "Credit type attribute"
|
|
1227
909
|
});
|
|
1228
|
-
var
|
|
910
|
+
var SourceWasteTypeAttributeSchema = NftAttributeSchema.extend({
|
|
1229
911
|
trait_type: zod.z.literal("Source Waste Type"),
|
|
1230
912
|
value: WasteTypeSchema
|
|
1231
913
|
}).meta({
|
|
1232
914
|
title: "Source Waste Type Attribute",
|
|
1233
915
|
description: "Source waste type attribute"
|
|
1234
916
|
});
|
|
1235
|
-
var
|
|
917
|
+
var SourceWeightAttributeSchema = NftAttributeSchema.extend({
|
|
1236
918
|
trait_type: zod.z.literal("Source Weight (kg)"),
|
|
1237
|
-
value: WeightKgSchema
|
|
919
|
+
value: WeightKgSchema.meta({
|
|
920
|
+
title: "Source Weight",
|
|
921
|
+
description: "Weight of the source waste in kilograms"
|
|
922
|
+
}),
|
|
1238
923
|
display_type: zod.z.literal("number")
|
|
1239
924
|
}).meta({
|
|
1240
925
|
title: "Source Weight Attribute",
|
|
1241
926
|
description: "Source weight attribute with numeric display"
|
|
1242
927
|
});
|
|
1243
|
-
var
|
|
928
|
+
var OriginCountryAttributeSchema = NftAttributeSchema.extend({
|
|
1244
929
|
trait_type: zod.z.literal("Origin Country"),
|
|
1245
|
-
value:
|
|
1246
|
-
title: "Origin Country Value",
|
|
1247
|
-
description: "Country where the waste was generated",
|
|
1248
|
-
examples: ["Brazil"]
|
|
1249
|
-
})
|
|
930
|
+
value: CountryNameSchema
|
|
1250
931
|
}).meta({
|
|
1251
932
|
title: "Origin Country Attribute",
|
|
1252
933
|
description: "Origin country attribute"
|
|
1253
934
|
});
|
|
1254
|
-
var
|
|
935
|
+
var OriginMunicipalityAttributeSchema = NftAttributeSchema.extend({
|
|
1255
936
|
trait_type: zod.z.literal("Origin Municipality"),
|
|
1256
|
-
value:
|
|
1257
|
-
title: "Origin Municipality Value",
|
|
1258
|
-
description: "Municipality where the waste was generated",
|
|
1259
|
-
examples: ["Macap\xE1"]
|
|
1260
|
-
})
|
|
937
|
+
value: MunicipalitySchema
|
|
1261
938
|
}).meta({
|
|
1262
939
|
title: "Origin Municipality Attribute",
|
|
1263
940
|
description: "Origin municipality attribute"
|
|
1264
941
|
});
|
|
1265
|
-
var
|
|
942
|
+
var RecyclerAttributeSchema = NftAttributeSchema.extend({
|
|
1266
943
|
trait_type: zod.z.literal("Recycler"),
|
|
1267
944
|
value: NonEmptyStringSchema.max(100).meta({
|
|
1268
|
-
title: "Recycler
|
|
945
|
+
title: "Recycler",
|
|
1269
946
|
description: "Organization that processed the waste",
|
|
1270
|
-
|
|
947
|
+
example: "Eco Reciclagem"
|
|
1271
948
|
})
|
|
1272
949
|
}).meta({
|
|
1273
950
|
title: "Recycler Attribute",
|
|
1274
951
|
description: "Recycler attribute"
|
|
1275
952
|
});
|
|
1276
|
-
var
|
|
953
|
+
var MassIdTokenIdAttributeSchema = NftAttributeSchema.extend({
|
|
1277
954
|
trait_type: zod.z.literal("MassID"),
|
|
1278
|
-
value:
|
|
1279
|
-
|
|
1280
|
-
"
|
|
1281
|
-
).meta({
|
|
1282
|
-
title: "MassID Token ID Value",
|
|
1283
|
-
description: "Token ID of the source MassID NFT",
|
|
1284
|
-
examples: ["#123"]
|
|
955
|
+
value: StringifiedTokenIdSchema.meta({
|
|
956
|
+
title: "MassID Token ID",
|
|
957
|
+
description: "Token ID of the source MassID NFT as #<token_id>"
|
|
1285
958
|
})
|
|
1286
959
|
}).meta({
|
|
1287
960
|
title: "MassID Token ID Attribute",
|
|
1288
961
|
description: "MassID token ID attribute"
|
|
1289
962
|
});
|
|
1290
|
-
var
|
|
963
|
+
var MassIdRecyclingDateAttributeSchema = NftAttributeSchema.omit({
|
|
964
|
+
max_value: true
|
|
965
|
+
}).extend({
|
|
1291
966
|
trait_type: zod.z.literal("MassID Recycling Date"),
|
|
1292
|
-
value:
|
|
1293
|
-
title: "MassID Recycling Date
|
|
1294
|
-
description: "
|
|
1295
|
-
examples: ["2025-02-22"]
|
|
967
|
+
value: UnixTimestampSchema.meta({
|
|
968
|
+
title: "MassID Recycling Date",
|
|
969
|
+
description: "Unix timestamp in milliseconds when the source waste was recycled"
|
|
1296
970
|
}),
|
|
1297
971
|
display_type: zod.z.literal("date")
|
|
1298
972
|
}).meta({
|
|
1299
973
|
title: "MassID Recycling Date Attribute",
|
|
1300
|
-
description: "MassID recycling date attribute
|
|
974
|
+
description: "MassID recycling date attribute using Unix timestamp in milliseconds"
|
|
1301
975
|
});
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
GasIDAttributeOriginCountrySchema,
|
|
1311
|
-
GasIDAttributeOriginMunicipalitySchema,
|
|
1312
|
-
GasIDAttributeRecyclerSchema,
|
|
1313
|
-
GasIDAttributeMassIDTokenIdSchema,
|
|
1314
|
-
GasIDAttributeMassIDRecyclingDateSchema
|
|
1315
|
-
]).meta({
|
|
1316
|
-
title: "GasID NFT Attribute Array",
|
|
1317
|
-
description: "Schema for the fixed set of GasID NFT attributes, enforcing order and type for each trait"
|
|
976
|
+
|
|
977
|
+
// src/mass-id/mass-id.attributes.ts
|
|
978
|
+
var MassIDAttributeWasteTypeSchema = NftAttributeSchema.extend({
|
|
979
|
+
trait_type: zod.z.literal("Waste Type"),
|
|
980
|
+
value: WasteTypeSchema
|
|
981
|
+
}).meta({
|
|
982
|
+
title: "Waste Type Attribute",
|
|
983
|
+
description: "Waste type attribute"
|
|
1318
984
|
});
|
|
1319
|
-
var
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
985
|
+
var MassIDAttributeWasteSubtypeSchema = NftAttributeSchema.extend({
|
|
986
|
+
trait_type: zod.z.literal("Waste Subtype"),
|
|
987
|
+
value: WasteSubtypeSchema
|
|
988
|
+
}).meta({
|
|
989
|
+
title: "Waste Subtype Attribute",
|
|
990
|
+
description: "Waste subtype attribute"
|
|
991
|
+
});
|
|
992
|
+
var MassIDAttributeWeightSchema = NftAttributeSchema.extend({
|
|
993
|
+
trait_type: zod.z.literal("Weight (kg)"),
|
|
994
|
+
value: WeightKgSchema,
|
|
995
|
+
display_type: zod.z.literal("number")
|
|
996
|
+
}).meta({
|
|
997
|
+
title: "Weight Attribute",
|
|
998
|
+
description: "Weight attribute with numeric display"
|
|
999
|
+
});
|
|
1000
|
+
var MassIDAttributeOriginCountrySchema = OriginCountryAttributeSchema.extend({
|
|
1001
|
+
value: CountryNameSchema
|
|
1002
|
+
});
|
|
1003
|
+
var MassIDAttributeOriginMunicipalitySchema = OriginMunicipalityAttributeSchema.extend({
|
|
1004
|
+
value: MunicipalitySchema
|
|
1005
|
+
});
|
|
1006
|
+
var MassIDAttributeOriginDivisionSchema = NftAttributeSchema.extend({
|
|
1007
|
+
trait_type: zod.z.literal("Origin Administrative Division"),
|
|
1008
|
+
value: AdministrativeDivisionSchema
|
|
1009
|
+
}).meta({
|
|
1010
|
+
title: "Origin Administrative Division Attribute",
|
|
1011
|
+
description: "Origin administrative division attribute"
|
|
1012
|
+
});
|
|
1013
|
+
var MassIDAttributeVehicleTypeSchema = NftAttributeSchema.extend({
|
|
1014
|
+
trait_type: zod.z.literal("Vehicle Type"),
|
|
1015
|
+
value: NonEmptyStringSchema.max(100).meta({
|
|
1016
|
+
title: "Vehicle Type",
|
|
1017
|
+
description: "Type of vehicle used for waste transportation",
|
|
1018
|
+
examples: ["Garbage Truck", "Box Truck", "Flatbed Truck", "Roll-off Truck"]
|
|
1019
|
+
})
|
|
1020
|
+
}).meta({
|
|
1021
|
+
title: "Vehicle Type Attribute",
|
|
1022
|
+
description: "Vehicle type attribute"
|
|
1023
|
+
});
|
|
1024
|
+
var MassIDAttributeRecyclingMethodSchema = NftAttributeSchema.extend({
|
|
1025
|
+
trait_type: zod.z.literal("Recycling Method"),
|
|
1026
|
+
value: NonEmptyStringSchema.max(100).meta({
|
|
1027
|
+
title: "Recycling Method",
|
|
1028
|
+
description: "Method used for recycling or processing the waste",
|
|
1029
|
+
examples: [
|
|
1030
|
+
"Composting",
|
|
1031
|
+
"Mechanical Recycling",
|
|
1032
|
+
"Incineration with Energy Recovery"
|
|
1033
|
+
]
|
|
1034
|
+
})
|
|
1035
|
+
}).meta({
|
|
1036
|
+
title: "Recycling Method Attribute",
|
|
1037
|
+
description: "Recycling method attribute"
|
|
1038
|
+
});
|
|
1039
|
+
var MassIDAttributeProcessingTimeSchema = NftAttributeSchema.extend({
|
|
1040
|
+
trait_type: zod.z.literal("Processing Time (hours)"),
|
|
1041
|
+
value: HoursSchema,
|
|
1042
|
+
trait_description: NonEmptyStringSchema.max(200).optional().meta({
|
|
1043
|
+
title: "Processing Time Description",
|
|
1044
|
+
description: "Custom description for the processing time"
|
|
1045
|
+
})
|
|
1046
|
+
}).meta({
|
|
1047
|
+
title: "Processing Time Attribute",
|
|
1048
|
+
description: "Processing time attribute with optional trait description"
|
|
1049
|
+
});
|
|
1050
|
+
var MassIDAttributeLocalWasteClassificationIdSchema = NftAttributeSchema.extend({
|
|
1051
|
+
trait_type: zod.z.literal("Local Waste Classification ID"),
|
|
1052
|
+
value: NonEmptyStringSchema.max(100).meta({
|
|
1053
|
+
title: "Local Waste Classification ID",
|
|
1054
|
+
description: "Local or regional waste classification identifier",
|
|
1055
|
+
examples: ["04 02 20", "IBAMA-A001", "EWC-150101"]
|
|
1056
|
+
})
|
|
1057
|
+
}).meta({
|
|
1058
|
+
title: "Local Waste Classification ID Attribute",
|
|
1059
|
+
description: "Local waste classification ID attribute"
|
|
1060
|
+
});
|
|
1061
|
+
var MassIDAttributeRecyclingManifestCodeSchema = NftAttributeSchema.extend({
|
|
1062
|
+
trait_type: zod.z.literal("Recycling Manifest Code"),
|
|
1063
|
+
value: NonEmptyStringSchema.max(100).meta({
|
|
1064
|
+
title: "Recycling Manifest Code",
|
|
1065
|
+
description: "Concatenated recycling manifest code (Document Type + Document Number)",
|
|
1066
|
+
examples: ["CDF-2353", "RC-12345", "REC-MANIFEST-789"]
|
|
1067
|
+
})
|
|
1068
|
+
}).meta({
|
|
1069
|
+
title: "Recycling Manifest Code Attribute",
|
|
1070
|
+
description: "Recycling manifest code attribute (optional)"
|
|
1071
|
+
});
|
|
1072
|
+
var MassIDAttributeTransportManifestCodeSchema = NftAttributeSchema.extend({
|
|
1073
|
+
trait_type: zod.z.literal("Transport Manifest Code"),
|
|
1074
|
+
value: NonEmptyStringSchema.max(100).meta({
|
|
1075
|
+
title: "Transport Manifest Code",
|
|
1076
|
+
description: "Concatenated transport manifest code (Document Type + Document Number)",
|
|
1077
|
+
examples: ["MTR-4126", "TRN-67890", "TRANS-MANIFEST-456"]
|
|
1078
|
+
})
|
|
1079
|
+
}).meta({
|
|
1080
|
+
title: "Transport Manifest Code Attribute",
|
|
1081
|
+
description: "Transport manifest code attribute (optional)"
|
|
1082
|
+
});
|
|
1083
|
+
var MassIDAttributeWeighingCaptureMethodSchema = NftAttributeSchema.extend({
|
|
1084
|
+
trait_type: zod.z.literal("Weighing Capture Method"),
|
|
1085
|
+
value: NonEmptyStringSchema.max(100).meta({
|
|
1086
|
+
title: "Weighing Capture Method",
|
|
1087
|
+
description: "Method used to capture weight data",
|
|
1088
|
+
examples: ["Digital", "Manual", "Automated", "Electronic Scale"]
|
|
1089
|
+
})
|
|
1090
|
+
}).meta({
|
|
1091
|
+
title: "Weighing Capture Method Attribute",
|
|
1092
|
+
description: "Weighing capture method attribute (optional)"
|
|
1093
|
+
});
|
|
1094
|
+
var MassIDAttributeScaleTypeSchema = NftAttributeSchema.extend({
|
|
1095
|
+
trait_type: zod.z.literal("Scale Type"),
|
|
1096
|
+
value: NonEmptyStringSchema.max(100).meta({
|
|
1097
|
+
title: "Scale Type",
|
|
1098
|
+
description: "Type of scale used for weighing",
|
|
1099
|
+
examples: [
|
|
1100
|
+
"Weighbridge (Truck Scale)",
|
|
1101
|
+
"Floor Scale",
|
|
1102
|
+
"Bench Scale",
|
|
1103
|
+
"Crane Scale"
|
|
1104
|
+
]
|
|
1105
|
+
})
|
|
1106
|
+
}).meta({
|
|
1107
|
+
title: "Scale Type Attribute",
|
|
1108
|
+
description: "Scale type attribute (optional)"
|
|
1109
|
+
});
|
|
1110
|
+
var MassIDAttributeContainerTypeSchema = NftAttributeSchema.extend({
|
|
1111
|
+
trait_type: zod.z.literal("Container Type"),
|
|
1112
|
+
value: NonEmptyStringSchema.max(100).meta({
|
|
1113
|
+
title: "Container Type",
|
|
1114
|
+
description: "Type of container used for waste storage or transport",
|
|
1115
|
+
examples: ["Truck", "Dumpster", "Roll-off Container", "Compactor", "Bin"]
|
|
1116
|
+
})
|
|
1117
|
+
}).meta({
|
|
1118
|
+
title: "Container Type Attribute",
|
|
1119
|
+
description: "Container type attribute (optional)"
|
|
1120
|
+
});
|
|
1121
|
+
var MassIDAttributePickUpDateSchema = NftAttributeSchema.extend({
|
|
1122
|
+
trait_type: zod.z.literal("Pick-up Date"),
|
|
1123
|
+
value: UnixTimestampSchema.meta({
|
|
1124
|
+
title: "Pick-up Date",
|
|
1125
|
+
description: "Unix timestamp in milliseconds when the waste was picked up from the source",
|
|
1126
|
+
examples: [17105184e5, 17040672e5, 17152704e5]
|
|
1327
1127
|
}),
|
|
1328
|
-
|
|
1329
|
-
title: "Source Waste Net Weight",
|
|
1330
|
-
description: "Net weight of the source waste"
|
|
1331
|
-
})
|
|
1128
|
+
display_type: zod.z.literal("date")
|
|
1332
1129
|
}).meta({
|
|
1333
|
-
title: "
|
|
1334
|
-
description: "
|
|
1130
|
+
title: "Pick-up Date Attribute",
|
|
1131
|
+
description: "Pick-up date attribute with Unix timestamp"
|
|
1335
1132
|
});
|
|
1336
|
-
var
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
title: "Participant Name",
|
|
1343
|
-
description: "Name of the participant"
|
|
1133
|
+
var MassIDAttributeRecyclingDateSchema = NftAttributeSchema.extend({
|
|
1134
|
+
trait_type: zod.z.literal("Recycling Date"),
|
|
1135
|
+
value: UnixTimestampSchema.meta({
|
|
1136
|
+
title: "Recycling Date",
|
|
1137
|
+
description: "Unix timestamp in milliseconds when the waste was recycled/processed",
|
|
1138
|
+
examples: [17106048e5, 17041536e5, 17153568e5]
|
|
1344
1139
|
}),
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1140
|
+
display_type: zod.z.literal("date")
|
|
1141
|
+
}).meta({
|
|
1142
|
+
title: "Recycling Date Attribute",
|
|
1143
|
+
description: "Recycling date attribute with Unix timestamp"
|
|
1144
|
+
});
|
|
1145
|
+
var MassIDAttributesSchema = uniqueBy(
|
|
1146
|
+
zod.z.union([
|
|
1147
|
+
MassIDAttributeWasteTypeSchema,
|
|
1148
|
+
MassIDAttributeWasteSubtypeSchema,
|
|
1149
|
+
MassIDAttributeWeightSchema,
|
|
1150
|
+
MassIDAttributeOriginCountrySchema,
|
|
1151
|
+
MassIDAttributeOriginMunicipalitySchema,
|
|
1152
|
+
MassIDAttributeOriginDivisionSchema,
|
|
1153
|
+
MassIDAttributeVehicleTypeSchema,
|
|
1154
|
+
MassIDAttributeRecyclingMethodSchema,
|
|
1155
|
+
MassIDAttributeProcessingTimeSchema,
|
|
1156
|
+
MassIDAttributeLocalWasteClassificationIdSchema,
|
|
1157
|
+
MassIDAttributeRecyclingManifestCodeSchema,
|
|
1158
|
+
MassIDAttributeTransportManifestCodeSchema,
|
|
1159
|
+
MassIDAttributeWeighingCaptureMethodSchema,
|
|
1160
|
+
MassIDAttributeScaleTypeSchema,
|
|
1161
|
+
MassIDAttributeContainerTypeSchema,
|
|
1162
|
+
MassIDAttributePickUpDateSchema,
|
|
1163
|
+
MassIDAttributeRecyclingDateSchema
|
|
1164
|
+
]),
|
|
1165
|
+
(attr) => attr.trait_type
|
|
1166
|
+
).min(12).max(17).meta({
|
|
1167
|
+
title: "MassID Attributes",
|
|
1168
|
+
description: "MassID NFT attributes array containing attributes selected from the available attribute types. The schema validates array length but does not enforce which specific attributes must be present."
|
|
1169
|
+
});
|
|
1170
|
+
var MassIDLocalClassificationSchema = zod.z.strictObject({
|
|
1171
|
+
code: NonEmptyStringSchema.max(20).meta({
|
|
1172
|
+
title: "Classification Code",
|
|
1173
|
+
description: "Local waste classification code",
|
|
1174
|
+
examples: ["20 01 01", "D001", "EWC-150101", "IBAMA-A001"]
|
|
1348
1175
|
}),
|
|
1349
|
-
|
|
1350
|
-
title: "
|
|
1351
|
-
description: "
|
|
1176
|
+
description: NonEmptyStringSchema.max(200).meta({
|
|
1177
|
+
title: "Classification Description",
|
|
1178
|
+
description: "Local waste classification description",
|
|
1179
|
+
examples: [
|
|
1180
|
+
"Paper and cardboard packaging",
|
|
1181
|
+
"Ignitable waste",
|
|
1182
|
+
"Paper and cardboard packaging waste",
|
|
1183
|
+
"Municipal solid waste - organic fraction"
|
|
1184
|
+
]
|
|
1352
1185
|
}),
|
|
1353
|
-
|
|
1354
|
-
title: "
|
|
1355
|
-
description: "
|
|
1186
|
+
system: zod.z.enum(["IBAMA"]).meta({
|
|
1187
|
+
title: "Classification System",
|
|
1188
|
+
description: "Classification system name - currently supports IBAMA (Instituto Brasileiro do Meio Ambiente e dos Recursos Naturais Renov\xE1veis)",
|
|
1189
|
+
examples: ["IBAMA"]
|
|
1356
1190
|
})
|
|
1357
1191
|
}).meta({
|
|
1358
|
-
title: "
|
|
1359
|
-
description: "
|
|
1192
|
+
title: "Local Classification",
|
|
1193
|
+
description: "Local or regional waste classification codes and descriptions"
|
|
1360
1194
|
});
|
|
1361
|
-
var
|
|
1362
|
-
title: "
|
|
1363
|
-
description: "
|
|
1195
|
+
var MassIDMeasurementUnitSchema = zod.z.enum(["kg", "ton"]).meta({
|
|
1196
|
+
title: "Measurement Unit",
|
|
1197
|
+
description: "Unit of measurement for the waste quantity",
|
|
1198
|
+
examples: ["kg", "ton"]
|
|
1364
1199
|
});
|
|
1365
|
-
var
|
|
1366
|
-
|
|
1367
|
-
title: "
|
|
1368
|
-
description: "
|
|
1369
|
-
}),
|
|
1370
|
-
participant_name: ParticipantNameSchema.meta({
|
|
1371
|
-
title: "Participant Name",
|
|
1372
|
-
description: "Name of the participant receiving the reward"
|
|
1373
|
-
}),
|
|
1374
|
-
role: ParticipantRoleSchema.meta({
|
|
1375
|
-
title: "Participant Role",
|
|
1376
|
-
description: "Role of the participant in the supply chain"
|
|
1377
|
-
}),
|
|
1378
|
-
reward_percentage: PercentageSchema.meta({
|
|
1379
|
-
title: "Reward Percentage",
|
|
1380
|
-
description: "Reward percentage allocated to the participant"
|
|
1200
|
+
var MassIDWastePropertiesSchema = zod.z.strictObject({
|
|
1201
|
+
type: WasteTypeSchema.meta({
|
|
1202
|
+
title: "Waste Type",
|
|
1203
|
+
description: "Waste material category"
|
|
1381
1204
|
}),
|
|
1382
|
-
|
|
1383
|
-
title: "
|
|
1384
|
-
description: "
|
|
1205
|
+
subtype: WasteSubtypeSchema.meta({
|
|
1206
|
+
title: "Waste Subtype",
|
|
1207
|
+
description: "Specific subcategory of waste material"
|
|
1385
1208
|
}),
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1209
|
+
local_classification: MassIDLocalClassificationSchema.optional(),
|
|
1210
|
+
measurement_unit: MassIDMeasurementUnitSchema,
|
|
1211
|
+
net_weight: NonNegativeFloatSchema.meta({
|
|
1212
|
+
title: "Net Weight",
|
|
1213
|
+
description: "Net weight of the waste batch in the specified measurement unit"
|
|
1389
1214
|
})
|
|
1390
1215
|
}).meta({
|
|
1391
|
-
title: "
|
|
1392
|
-
description: "
|
|
1216
|
+
title: "Waste Properties",
|
|
1217
|
+
description: "Standardized waste material properties and regulatory information"
|
|
1393
1218
|
});
|
|
1394
|
-
var
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1219
|
+
var EventAttributeFormatSchema = zod.z.enum(["KILOGRAM", "DATE", "CURRENCY", "PERCENTAGE", "COORDINATE"]).meta({
|
|
1220
|
+
title: "Event Attribute Format",
|
|
1221
|
+
description: "Data format hint for proper display",
|
|
1222
|
+
examples: ["KILOGRAM", "DATE", "PERCENTAGE"]
|
|
1223
|
+
});
|
|
1224
|
+
var EventAttributeSchema = zod.z.strictObject({
|
|
1225
|
+
name: NonEmptyStringSchema.max(100).meta({
|
|
1226
|
+
title: "Attribute Name",
|
|
1227
|
+
description: "Event attribute name",
|
|
1398
1228
|
examples: [
|
|
1399
|
-
"
|
|
1229
|
+
"temperature",
|
|
1230
|
+
"humidity",
|
|
1231
|
+
"contamination_percentage",
|
|
1232
|
+
"quality_grade",
|
|
1233
|
+
"batch_number",
|
|
1234
|
+
"operator_id",
|
|
1235
|
+
"equipment_used",
|
|
1236
|
+
"processing_cost"
|
|
1400
1237
|
]
|
|
1401
1238
|
}),
|
|
1402
|
-
|
|
1403
|
-
title: "
|
|
1404
|
-
description: "
|
|
1239
|
+
value: zod.z.union([zod.z.string(), zod.z.number(), zod.z.boolean()]).optional().meta({
|
|
1240
|
+
title: "Attribute Value",
|
|
1241
|
+
description: "Event attribute value",
|
|
1405
1242
|
examples: [
|
|
1406
|
-
|
|
1243
|
+
25.5,
|
|
1244
|
+
"Grade A",
|
|
1245
|
+
true,
|
|
1246
|
+
"BATCH-2024-001",
|
|
1247
|
+
12.75,
|
|
1248
|
+
"Shredder-X200",
|
|
1249
|
+
false,
|
|
1250
|
+
"OP-456"
|
|
1407
1251
|
]
|
|
1408
|
-
})
|
|
1252
|
+
}),
|
|
1253
|
+
preserved_sensitivity: zod.z.boolean().optional().meta({
|
|
1254
|
+
title: "Preserved Sensitivity",
|
|
1255
|
+
description: "Indicates if the attribute contains sensitive information that was preserved"
|
|
1256
|
+
}),
|
|
1257
|
+
format: EventAttributeFormatSchema.optional()
|
|
1409
1258
|
}).meta({
|
|
1410
|
-
title: "
|
|
1411
|
-
description: "Additional
|
|
1259
|
+
title: "Event Attribute",
|
|
1260
|
+
description: "Additional attribute specific to an event"
|
|
1412
1261
|
});
|
|
1413
|
-
var
|
|
1414
|
-
|
|
1415
|
-
title: "
|
|
1416
|
-
description: "
|
|
1262
|
+
var EventAttachmentSchema = zod.z.strictObject({
|
|
1263
|
+
type: NonEmptyStringSchema.max(50).meta({
|
|
1264
|
+
title: "Attachment Type",
|
|
1265
|
+
description: "Type of supporting attachment",
|
|
1266
|
+
examples: [
|
|
1267
|
+
"Waste Transfer Note",
|
|
1268
|
+
"Certificate of Disposal",
|
|
1269
|
+
"Certificate of Final Destination",
|
|
1270
|
+
"Quality Assessment Report",
|
|
1271
|
+
"Transport Manifest",
|
|
1272
|
+
"Processing Receipt",
|
|
1273
|
+
"Environmental Permit",
|
|
1274
|
+
"Invoice"
|
|
1275
|
+
]
|
|
1417
1276
|
}),
|
|
1418
|
-
|
|
1419
|
-
title: "
|
|
1420
|
-
description: "
|
|
1277
|
+
document_number: NonEmptyStringSchema.max(50).optional().meta({
|
|
1278
|
+
title: "Document Number",
|
|
1279
|
+
description: "Official document number if applicable",
|
|
1280
|
+
examples: [
|
|
1281
|
+
"WTN-2024-001234",
|
|
1282
|
+
"CD-ENV-456789",
|
|
1283
|
+
"INV-2024-QTR1-789",
|
|
1284
|
+
"PERMIT-EPA-2024-001",
|
|
1285
|
+
"MANIFEST-DOT-567890"
|
|
1286
|
+
]
|
|
1421
1287
|
}),
|
|
1422
|
-
|
|
1423
|
-
title: "
|
|
1424
|
-
description: "
|
|
1288
|
+
reference: NonEmptyStringSchema.meta({
|
|
1289
|
+
title: "Attachment Reference",
|
|
1290
|
+
description: "Reference to attachment (IPFS hash, file name, or external URL)",
|
|
1291
|
+
examples: [
|
|
1292
|
+
"QmYjtig7VJQ6XsnUjqqJvj7QaMcCAwtrgNdahSiFofrE7o",
|
|
1293
|
+
"waste_transfer_note_2024_001.pdf",
|
|
1294
|
+
"https://docs.example.com/certificates/disposal_cert_456.pdf",
|
|
1295
|
+
"bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi",
|
|
1296
|
+
"processing_receipt_20240315.jpg"
|
|
1297
|
+
]
|
|
1298
|
+
}),
|
|
1299
|
+
issue_timestamp: UnixTimestampSchema.optional().meta({
|
|
1300
|
+
title: "Issue Timestamp",
|
|
1301
|
+
description: "Unix timestamp in milliseconds when the attachment was issued",
|
|
1302
|
+
examples: [17105184e5, 17040672e5, 17152704e5]
|
|
1303
|
+
}),
|
|
1304
|
+
issuer: NonEmptyStringSchema.max(100).optional().meta({
|
|
1305
|
+
title: "Attachment Issuer",
|
|
1306
|
+
description: "Entity that issued the attachment",
|
|
1307
|
+
examples: [
|
|
1308
|
+
"Environmental Protection Agency",
|
|
1309
|
+
"Waste Management Solutions Ltd",
|
|
1310
|
+
"Green Recycling Corp",
|
|
1311
|
+
"City Waste Authority",
|
|
1312
|
+
"EcoProcess Industries",
|
|
1313
|
+
"Regional Environmental Office"
|
|
1314
|
+
]
|
|
1425
1315
|
})
|
|
1426
1316
|
}).meta({
|
|
1427
|
-
title: "
|
|
1428
|
-
description: "
|
|
1429
|
-
});
|
|
1430
|
-
var MethodologyComplianceSchema = zod.z.enum(["PASSED", "FAILED"]).meta({
|
|
1431
|
-
title: "Methodology Compliance",
|
|
1432
|
-
description: "Result of methodology compliance check",
|
|
1433
|
-
examples: ["PASSED", "FAILED"]
|
|
1317
|
+
title: "Event Attachment",
|
|
1318
|
+
description: "Supporting event attachment"
|
|
1434
1319
|
});
|
|
1435
|
-
var
|
|
1436
|
-
|
|
1437
|
-
title: "
|
|
1438
|
-
description: "
|
|
1320
|
+
var MassIDChainOfCustodyEventSchema = zod.z.strictObject({
|
|
1321
|
+
event_id: UuidSchema.meta({
|
|
1322
|
+
title: "Event ID",
|
|
1323
|
+
description: "Unique event identifier"
|
|
1324
|
+
}),
|
|
1325
|
+
event_name: NonEmptyStringSchema.max(50).meta({
|
|
1326
|
+
title: "Event Name",
|
|
1327
|
+
description: "Name of custody or processing event",
|
|
1328
|
+
examples: ["Sorting", "Processing", "Recycling", "Weighing"]
|
|
1439
1329
|
}),
|
|
1440
|
-
|
|
1441
|
-
title: "
|
|
1442
|
-
description: "
|
|
1330
|
+
description: NonEmptyStringSchema.max(200).optional().meta({
|
|
1331
|
+
title: "Event Description",
|
|
1332
|
+
description: "Detailed description of what happened during this event",
|
|
1333
|
+
examples: [
|
|
1334
|
+
"Waste collected from residential area using collection truck",
|
|
1335
|
+
"Material sorted into recyclable and non-recyclable fractions",
|
|
1336
|
+
"Plastic waste processed through shredding and washing",
|
|
1337
|
+
"Waste transferred to authorized recycling facility",
|
|
1338
|
+
"Final disposal at licensed landfill site",
|
|
1339
|
+
"Quality inspection and contamination assessment completed"
|
|
1340
|
+
]
|
|
1443
1341
|
}),
|
|
1444
|
-
|
|
1445
|
-
title: "
|
|
1446
|
-
description: "
|
|
1342
|
+
timestamp: UnixTimestampSchema.meta({
|
|
1343
|
+
title: "Event Timestamp",
|
|
1344
|
+
description: "Unix timestamp in milliseconds when the event occurred",
|
|
1345
|
+
examples: [17105184e5, 17040672e5, 17152704e5]
|
|
1447
1346
|
}),
|
|
1448
|
-
|
|
1449
|
-
title: "
|
|
1450
|
-
description: "
|
|
1347
|
+
participant_id_hash: Sha256HashSchema.meta({
|
|
1348
|
+
title: "Participant ID Hash",
|
|
1349
|
+
description: "Reference to participant in the participants array"
|
|
1451
1350
|
}),
|
|
1452
|
-
|
|
1453
|
-
title: "
|
|
1454
|
-
description: "
|
|
1351
|
+
location_id_hash: Sha256HashSchema.meta({
|
|
1352
|
+
title: "Location ID Hash",
|
|
1353
|
+
description: "Reference to location in the locations array"
|
|
1455
1354
|
}),
|
|
1456
|
-
|
|
1457
|
-
title: "
|
|
1458
|
-
description: "
|
|
1355
|
+
weight: NonNegativeFloatSchema.optional().meta({
|
|
1356
|
+
title: "Event Weight",
|
|
1357
|
+
description: "Mass weight after this event"
|
|
1358
|
+
}),
|
|
1359
|
+
attributes: zod.z.array(EventAttributeSchema).optional().meta({
|
|
1360
|
+
title: "Event Attributes",
|
|
1361
|
+
description: "Additional attributes specific to this event"
|
|
1362
|
+
}),
|
|
1363
|
+
attachments: zod.z.array(EventAttachmentSchema).optional().meta({
|
|
1364
|
+
title: "Event Attachments",
|
|
1365
|
+
description: "Associated attachments for this event"
|
|
1459
1366
|
})
|
|
1460
1367
|
}).meta({
|
|
1461
|
-
title: "
|
|
1462
|
-
description: "
|
|
1368
|
+
title: "Chain of Custody Event",
|
|
1369
|
+
description: "Chain of custody event"
|
|
1463
1370
|
});
|
|
1464
|
-
var
|
|
1465
|
-
|
|
1466
|
-
title: "
|
|
1467
|
-
description: "
|
|
1468
|
-
}),
|
|
1469
|
-
token_id: TokenIdSchema.meta({
|
|
1470
|
-
title: "GasID Token ID",
|
|
1471
|
-
description: "NFT token ID of the GasID"
|
|
1472
|
-
}),
|
|
1473
|
-
external_url: ExternalUrlSchema.meta({
|
|
1474
|
-
title: "GasID External URL",
|
|
1475
|
-
description: "URL to view the GasID on Carrot Explorer"
|
|
1371
|
+
var MassIDChainOfCustodySchema = zod.z.strictObject({
|
|
1372
|
+
events: zod.z.array(MassIDChainOfCustodyEventSchema).min(1).meta({
|
|
1373
|
+
title: "Custody Events",
|
|
1374
|
+
description: "Chronological sequence of custody transfer and processing events"
|
|
1476
1375
|
}),
|
|
1477
|
-
|
|
1478
|
-
title: "
|
|
1479
|
-
description: "
|
|
1376
|
+
total_duration_minutes: MinutesSchema.meta({
|
|
1377
|
+
title: "Total Duration (minutes)",
|
|
1378
|
+
description: "Total time from first to last event in minutes"
|
|
1480
1379
|
})
|
|
1481
1380
|
}).meta({
|
|
1482
|
-
title: "
|
|
1483
|
-
description: "
|
|
1381
|
+
title: "Chain of Custody",
|
|
1382
|
+
description: "Complete chain of custody tracking from waste generation to final processing"
|
|
1484
1383
|
});
|
|
1485
|
-
var
|
|
1486
|
-
|
|
1487
|
-
title: "
|
|
1488
|
-
description: "
|
|
1384
|
+
var MassIDGeographicDataSchema = zod.z.strictObject({
|
|
1385
|
+
from_location_id_hash: Sha256HashSchema.meta({
|
|
1386
|
+
title: "From Location ID Hash",
|
|
1387
|
+
description: "Reference hash of the location where the waste started movement"
|
|
1489
1388
|
}),
|
|
1490
|
-
|
|
1491
|
-
title: "
|
|
1492
|
-
description: "
|
|
1389
|
+
to_location_id_hash: Sha256HashSchema.meta({
|
|
1390
|
+
title: "To Location ID Hash",
|
|
1391
|
+
description: "Reference hash of the location where the waste ended movement"
|
|
1493
1392
|
}),
|
|
1494
|
-
|
|
1495
|
-
title: "
|
|
1496
|
-
description: "
|
|
1393
|
+
first_reported_timestamp: UnixTimestampSchema.meta({
|
|
1394
|
+
title: "First Reported Timestamp",
|
|
1395
|
+
description: "Unix timestamp in milliseconds when the waste was first reported/collected at the origin location",
|
|
1396
|
+
examples: [17105184e5, 17040672e5, 17152704e5]
|
|
1497
1397
|
}),
|
|
1498
|
-
|
|
1499
|
-
title: "
|
|
1500
|
-
description: "
|
|
1398
|
+
last_reported_timestamp: UnixTimestampSchema.meta({
|
|
1399
|
+
title: "Last Reported Timestamp",
|
|
1400
|
+
description: "Unix timestamp in milliseconds when the waste was last reported/processed at the destination location",
|
|
1401
|
+
examples: [17106048e5, 17041536e5, 17153568e5]
|
|
1501
1402
|
})
|
|
1502
|
-
}).
|
|
1503
|
-
|
|
1504
|
-
|
|
1403
|
+
}).refine((data) => {
|
|
1404
|
+
return data.first_reported_timestamp <= data.last_reported_timestamp;
|
|
1405
|
+
}, "first_reported_timestamp must be before or equal to last_reported_timestamp").meta({
|
|
1406
|
+
title: "Geographic Data",
|
|
1407
|
+
description: "Simplified geographic information tracking waste movement from origin to destination with temporal bounds"
|
|
1505
1408
|
});
|
|
1506
|
-
var
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1409
|
+
var MassIDDataSchema = zod.z.strictObject({
|
|
1410
|
+
waste_properties: MassIDWastePropertiesSchema,
|
|
1411
|
+
locations: uniqueBy(
|
|
1412
|
+
LocationSchema,
|
|
1413
|
+
(loc) => loc.id_hash,
|
|
1414
|
+
"Location ID hashes must be unique"
|
|
1415
|
+
).min(1).meta({
|
|
1416
|
+
title: "Locations",
|
|
1417
|
+
description: "All locations referenced in this MassID, indexed by ID"
|
|
1515
1418
|
}),
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1419
|
+
participants: uniqueBy(
|
|
1420
|
+
ParticipantSchema,
|
|
1421
|
+
(p) => p.id_hash,
|
|
1422
|
+
"Participant ID hashes must be unique"
|
|
1423
|
+
).min(1).meta({
|
|
1424
|
+
title: "Participants",
|
|
1425
|
+
description: "All participants referenced in this MassID, indexed by ID"
|
|
1519
1426
|
}),
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1427
|
+
chain_of_custody: MassIDChainOfCustodySchema,
|
|
1428
|
+
geographic_data: MassIDGeographicDataSchema
|
|
1429
|
+
}).refine((data) => {
|
|
1430
|
+
const participantIdSet = new Set(
|
|
1431
|
+
data.participants.map((participant) => participant.id_hash)
|
|
1432
|
+
);
|
|
1433
|
+
const eventParticipantIds = data.chain_of_custody.events.map(
|
|
1434
|
+
(event) => event.participant_id_hash
|
|
1435
|
+
);
|
|
1436
|
+
const allEventParticipantsExist = eventParticipantIds.every(
|
|
1437
|
+
(participantId) => participantIdSet.has(participantId)
|
|
1438
|
+
);
|
|
1439
|
+
return allEventParticipantsExist;
|
|
1440
|
+
}, "All participant ID hashes in chain of custody events must exist in participants array").refine((data) => {
|
|
1441
|
+
const locationIdSet = new Set(
|
|
1442
|
+
data.locations.map((location) => location.id_hash)
|
|
1443
|
+
);
|
|
1444
|
+
const eventLocationIds = data.chain_of_custody.events.map(
|
|
1445
|
+
(event) => event.location_id_hash
|
|
1446
|
+
);
|
|
1447
|
+
const allEventLocationsExist = eventLocationIds.every(
|
|
1448
|
+
(locationId) => locationIdSet.has(locationId)
|
|
1449
|
+
);
|
|
1450
|
+
return allEventLocationsExist;
|
|
1451
|
+
}, "All location ID hashes in chain of custody events must exist in locations array").meta({
|
|
1452
|
+
title: "MassID Data",
|
|
1453
|
+
description: "MassID data containing waste tracking and chain of custody information"
|
|
1454
|
+
});
|
|
1455
|
+
var MassIDIpfsSchemaMeta = {
|
|
1456
|
+
title: "MassID NFT IPFS Record",
|
|
1457
|
+
description: "Complete MassID NFT IPFS record including fixed attributes and detailed waste tracking data",
|
|
1458
|
+
$id: buildSchemaUrl("mass-id/mass-id.schema.json"),
|
|
1459
|
+
version: getSchemaVersionOrDefault()
|
|
1460
|
+
};
|
|
1461
|
+
var MassIDIpfsSchema = NftIpfsSchema.safeExtend({
|
|
1462
|
+
schema: NftIpfsSchema.shape.schema.safeExtend({
|
|
1463
|
+
type: zod.z.literal("MassID").meta({
|
|
1464
|
+
title: "MassID Schema Type",
|
|
1465
|
+
description: "MassID NFT schema type"
|
|
1466
|
+
})
|
|
1523
1467
|
}),
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1468
|
+
attributes: MassIDAttributesSchema,
|
|
1469
|
+
data: MassIDDataSchema
|
|
1470
|
+
}).meta(MassIDIpfsSchemaMeta);
|
|
1471
|
+
var GasIDAttributeMethodologySchema = MethodologyAttributeSchema;
|
|
1472
|
+
var GasIDAttributeGasTypeSchema = NftAttributeSchema.extend({
|
|
1473
|
+
trait_type: zod.z.literal("Gas Type"),
|
|
1474
|
+
value: NonEmptyStringSchema.max(100).meta({
|
|
1475
|
+
title: "Gas Type",
|
|
1476
|
+
description: "Type of gas prevented",
|
|
1477
|
+
examples: ["Methane (CH\u2084)", "Carbon Dioxide (CO\u2082)"]
|
|
1527
1478
|
})
|
|
1528
1479
|
}).meta({
|
|
1529
|
-
title: "
|
|
1530
|
-
description: "
|
|
1480
|
+
title: "Gas Type Attribute",
|
|
1481
|
+
description: "Gas type attribute"
|
|
1482
|
+
});
|
|
1483
|
+
var GasIDAttributeCo2ePreventedSchema = NftAttributeSchema.extend({
|
|
1484
|
+
trait_type: zod.z.literal("CO\u2082e Prevented (kg)"),
|
|
1485
|
+
value: NonNegativeFloatSchema.meta({
|
|
1486
|
+
title: "CO\u2082e Prevented",
|
|
1487
|
+
description: "Total CO\u2082 equivalent emissions prevented in kilograms"
|
|
1488
|
+
}),
|
|
1489
|
+
display_type: zod.z.literal("number")
|
|
1490
|
+
}).meta({
|
|
1491
|
+
title: "CO\u2082e Prevented Attribute",
|
|
1492
|
+
description: "CO\u2082e prevented attribute with numeric display"
|
|
1493
|
+
});
|
|
1494
|
+
var GasIDAttributeCreditAmountSchema = CreditAmountAttributeSchema;
|
|
1495
|
+
var GasIDAttributeCreditTypeSchema = CreditTypeAttributeSchema;
|
|
1496
|
+
var GasIDAttributeSourceWasteTypeSchema = SourceWasteTypeAttributeSchema;
|
|
1497
|
+
var GasIDAttributeSourceWeightSchema = SourceWeightAttributeSchema;
|
|
1498
|
+
var GasIDAttributeOriginCountrySchema = OriginCountryAttributeSchema;
|
|
1499
|
+
var GasIDAttributeOriginMunicipalitySchema = OriginMunicipalityAttributeSchema;
|
|
1500
|
+
var GasIDAttributeRecyclerSchema = RecyclerAttributeSchema;
|
|
1501
|
+
var GasIDAttributeMassIDTokenIdSchema = MassIdTokenIdAttributeSchema;
|
|
1502
|
+
var GasIDAttributeMassIDRecyclingDateSchema = MassIdRecyclingDateAttributeSchema;
|
|
1503
|
+
var GasIDAttributesSchema = zod.z.tuple([
|
|
1504
|
+
GasIDAttributeMethodologySchema,
|
|
1505
|
+
GasIDAttributeGasTypeSchema,
|
|
1506
|
+
GasIDAttributeCo2ePreventedSchema,
|
|
1507
|
+
GasIDAttributeCreditAmountSchema,
|
|
1508
|
+
GasIDAttributeCreditTypeSchema,
|
|
1509
|
+
GasIDAttributeSourceWasteTypeSchema,
|
|
1510
|
+
GasIDAttributeSourceWeightSchema,
|
|
1511
|
+
GasIDAttributeOriginCountrySchema,
|
|
1512
|
+
GasIDAttributeOriginMunicipalitySchema,
|
|
1513
|
+
GasIDAttributeRecyclerSchema,
|
|
1514
|
+
GasIDAttributeMassIDTokenIdSchema,
|
|
1515
|
+
GasIDAttributeMassIDRecyclingDateSchema
|
|
1516
|
+
]).meta({
|
|
1517
|
+
title: "GasID NFT Attribute Array",
|
|
1518
|
+
description: "Schema for the fixed set of GasID NFT attributes, enforcing order and type for each trait"
|
|
1531
1519
|
});
|
|
1532
|
-
|
|
1533
|
-
// src/gas-id/gas-id.data.schema.ts
|
|
1534
1520
|
var GasIDSummarySchema = zod.z.strictObject({
|
|
1535
1521
|
gas_type: NonEmptyStringSchema.meta({
|
|
1536
1522
|
title: "Gas Type",
|
|
1537
1523
|
description: "Type of gas prevented",
|
|
1538
1524
|
examples: ["Methane (CH\u2084)", "Carbon Dioxide (CO\u2082)"]
|
|
1539
1525
|
}),
|
|
1540
|
-
credit_type:
|
|
1541
|
-
|
|
1542
|
-
description: "Type of credit issued",
|
|
1543
|
-
examples: ["Carrot Carbon (C-CARB)", "Carbon Credit"]
|
|
1544
|
-
}),
|
|
1545
|
-
credit_amount: NonNegativeFloatSchema.meta({
|
|
1546
|
-
title: "Credit Amount",
|
|
1547
|
-
description: "Amount of credits issued"
|
|
1548
|
-
}),
|
|
1526
|
+
credit_type: CreditTypeSchema,
|
|
1527
|
+
credit_amount: CreditAmountSchema,
|
|
1549
1528
|
prevented_co2e_kg: WeightKgSchema.meta({
|
|
1550
1529
|
title: "Prevented Emissions (CO\u2082e kg)",
|
|
1551
1530
|
description: "CO\u2082e weight of the prevented emissions"
|
|
@@ -1634,13 +1613,99 @@ var GasIDIpfsSchema = NftIpfsSchema.safeExtend({
|
|
|
1634
1613
|
attributes: GasIDAttributesSchema,
|
|
1635
1614
|
data: GasIDDataSchema
|
|
1636
1615
|
}).meta(GasIDIpfsSchemaMeta);
|
|
1616
|
+
var RecycledIDAttributeMethodologySchema = MethodologyAttributeSchema;
|
|
1617
|
+
var RecycledIDAttributeRecycledMassWeightSchema = NftAttributeSchema.extend({
|
|
1618
|
+
trait_type: zod.z.literal("Recycled Mass Weight (kg)"),
|
|
1619
|
+
value: WeightKgSchema.meta({
|
|
1620
|
+
title: "Recycled Mass Weight",
|
|
1621
|
+
description: "Total weight of recycled materials in kilograms"
|
|
1622
|
+
}),
|
|
1623
|
+
display_type: zod.z.literal("number")
|
|
1624
|
+
}).meta({
|
|
1625
|
+
title: "Recycled Mass Weight Attribute",
|
|
1626
|
+
description: "Recycled mass weight attribute with numeric display"
|
|
1627
|
+
});
|
|
1628
|
+
var RecycledIDAttributeCreditAmountSchema = CreditAmountAttributeSchema;
|
|
1629
|
+
var RecycledIDAttributeCreditTypeSchema = CreditTypeAttributeSchema;
|
|
1630
|
+
var RecycledIDAttributeSourceWasteTypeSchema = SourceWasteTypeAttributeSchema;
|
|
1631
|
+
var RecycledIDAttributeSourceWeightSchema = SourceWeightAttributeSchema;
|
|
1632
|
+
var RecycledIDAttributeOriginCountrySchema = OriginCountryAttributeSchema;
|
|
1633
|
+
var RecycledIDAttributeOriginMunicipalitySchema = OriginMunicipalityAttributeSchema;
|
|
1634
|
+
var RecycledIDAttributeRecyclerSchema = RecyclerAttributeSchema;
|
|
1635
|
+
var RecycledIDAttributeMassIDTokenIdSchema = MassIdTokenIdAttributeSchema;
|
|
1636
|
+
var RecycledIDAttributeMassIDRecyclingDateSchema = MassIdRecyclingDateAttributeSchema;
|
|
1637
|
+
var RecycledIDAttributesSchema = zod.z.tuple([
|
|
1638
|
+
RecycledIDAttributeMethodologySchema,
|
|
1639
|
+
RecycledIDAttributeRecycledMassWeightSchema,
|
|
1640
|
+
RecycledIDAttributeCreditAmountSchema,
|
|
1641
|
+
RecycledIDAttributeCreditTypeSchema,
|
|
1642
|
+
RecycledIDAttributeSourceWasteTypeSchema,
|
|
1643
|
+
RecycledIDAttributeSourceWeightSchema,
|
|
1644
|
+
RecycledIDAttributeOriginCountrySchema,
|
|
1645
|
+
RecycledIDAttributeOriginMunicipalitySchema,
|
|
1646
|
+
RecycledIDAttributeRecyclerSchema,
|
|
1647
|
+
RecycledIDAttributeMassIDTokenIdSchema,
|
|
1648
|
+
RecycledIDAttributeMassIDRecyclingDateSchema
|
|
1649
|
+
]).meta({
|
|
1650
|
+
title: "RecycledID NFT Attribute Array",
|
|
1651
|
+
description: "Schema for the fixed set of RecycledID NFT attributes, enforcing order and type for each trait"
|
|
1652
|
+
});
|
|
1653
|
+
var RecycledIDSummarySchema = zod.z.strictObject({
|
|
1654
|
+
recycled_mass_kg: WeightKgSchema.meta({
|
|
1655
|
+
title: "Recycled Mass Weight",
|
|
1656
|
+
description: "Total weight of materials successfully recycled"
|
|
1657
|
+
}),
|
|
1658
|
+
credit_type: CreditTypeSchema,
|
|
1659
|
+
credit_amount: CreditAmountSchema
|
|
1660
|
+
}).meta({
|
|
1661
|
+
title: "RecycledID Summary",
|
|
1662
|
+
description: "Summary information for the RecycledID certificate"
|
|
1663
|
+
});
|
|
1664
|
+
var RecycledIDDataSchema = zod.z.strictObject({
|
|
1665
|
+
summary: RecycledIDSummarySchema,
|
|
1666
|
+
methodology: MethodologyReferenceSchema,
|
|
1667
|
+
audit: AuditReferenceSchema,
|
|
1668
|
+
mass_id: MassIDReferenceSchema,
|
|
1669
|
+
waste_classification: WasteClassificationSchema,
|
|
1670
|
+
origin_location: LocationSchema.meta({
|
|
1671
|
+
title: "RecycledID Origin Location",
|
|
1672
|
+
description: "Source waste origin location details"
|
|
1673
|
+
}),
|
|
1674
|
+
accredited_participants: AccreditedParticipantsSchema,
|
|
1675
|
+
participant_rewards: ParticipantRewardsSchema.optional()
|
|
1676
|
+
}).meta({
|
|
1677
|
+
title: "RecycledID Data",
|
|
1678
|
+
description: "Complete data structure for RecycledID certificate"
|
|
1679
|
+
});
|
|
1680
|
+
var RecycledIDIpfsSchemaMeta = {
|
|
1681
|
+
title: "RecycledID NFT IPFS Record",
|
|
1682
|
+
description: "Complete RecycledID NFT IPFS record including fixed attributes and recycling outcome data",
|
|
1683
|
+
$id: buildSchemaUrl("recycled-id/recycled-id.schema.json"),
|
|
1684
|
+
version: getSchemaVersionOrDefault()
|
|
1685
|
+
};
|
|
1686
|
+
var RecycledIDIpfsSchema = NftIpfsSchema.safeExtend({
|
|
1687
|
+
schema: NftIpfsSchema.shape.schema.safeExtend({
|
|
1688
|
+
type: zod.z.literal("RecycledID").meta({
|
|
1689
|
+
title: "RecycledID Schema Type",
|
|
1690
|
+
description: "RecycledID NFT schema type"
|
|
1691
|
+
})
|
|
1692
|
+
}),
|
|
1693
|
+
attributes: RecycledIDAttributesSchema,
|
|
1694
|
+
data: RecycledIDDataSchema
|
|
1695
|
+
}).meta(RecycledIDIpfsSchemaMeta);
|
|
1637
1696
|
|
|
1638
1697
|
exports.AccreditedParticipantSchema = AccreditedParticipantSchema;
|
|
1639
1698
|
exports.AccreditedParticipantsSchema = AccreditedParticipantsSchema;
|
|
1699
|
+
exports.AdministrativeDivisionSchema = AdministrativeDivisionSchema;
|
|
1640
1700
|
exports.AuditReferenceSchema = AuditReferenceSchema;
|
|
1641
1701
|
exports.BaseIpfsSchema = BaseIpfsSchema;
|
|
1642
1702
|
exports.BlockchainChainIdSchema = BlockchainChainIdSchema;
|
|
1643
1703
|
exports.CoordinatesSchema = CoordinatesSchema;
|
|
1704
|
+
exports.CountryNameSchema = CountryNameSchema;
|
|
1705
|
+
exports.CreditAmountAttributeSchema = CreditAmountAttributeSchema;
|
|
1706
|
+
exports.CreditAmountSchema = CreditAmountSchema;
|
|
1707
|
+
exports.CreditTypeAttributeSchema = CreditTypeAttributeSchema;
|
|
1708
|
+
exports.CreditTypeSchema = CreditTypeSchema;
|
|
1644
1709
|
exports.DistributionNotesSchema = DistributionNotesSchema;
|
|
1645
1710
|
exports.EthereumAddressSchema = EthereumAddressSchema;
|
|
1646
1711
|
exports.ExternalIdSchema = ExternalIdSchema;
|
|
@@ -1667,14 +1732,21 @@ exports.MassIDDataSchema = MassIDDataSchema;
|
|
|
1667
1732
|
exports.MassIDIpfsSchema = MassIDIpfsSchema;
|
|
1668
1733
|
exports.MassIDIpfsSchemaMeta = MassIDIpfsSchemaMeta;
|
|
1669
1734
|
exports.MassIDReferenceSchema = MassIDReferenceSchema;
|
|
1735
|
+
exports.MassIdRecyclingDateAttributeSchema = MassIdRecyclingDateAttributeSchema;
|
|
1736
|
+
exports.MassIdTokenIdAttributeSchema = MassIdTokenIdAttributeSchema;
|
|
1737
|
+
exports.MethodologyAttributeSchema = MethodologyAttributeSchema;
|
|
1670
1738
|
exports.MethodologyComplianceSchema = MethodologyComplianceSchema;
|
|
1739
|
+
exports.MethodologyNameSchema = MethodologyNameSchema;
|
|
1671
1740
|
exports.MethodologyReferenceSchema = MethodologyReferenceSchema;
|
|
1672
1741
|
exports.MinutesSchema = MinutesSchema;
|
|
1742
|
+
exports.MunicipalitySchema = MunicipalitySchema;
|
|
1673
1743
|
exports.NftAttributeSchema = NftAttributeSchema;
|
|
1674
1744
|
exports.NftIpfsSchema = NftIpfsSchema;
|
|
1675
1745
|
exports.NonEmptyStringSchema = NonEmptyStringSchema;
|
|
1676
1746
|
exports.NonNegativeFloatSchema = NonNegativeFloatSchema;
|
|
1677
1747
|
exports.NonNegativeIntegerSchema = NonNegativeIntegerSchema;
|
|
1748
|
+
exports.OriginCountryAttributeSchema = OriginCountryAttributeSchema;
|
|
1749
|
+
exports.OriginMunicipalityAttributeSchema = OriginMunicipalityAttributeSchema;
|
|
1678
1750
|
exports.ParticipantNameSchema = ParticipantNameSchema;
|
|
1679
1751
|
exports.ParticipantRewardsSchema = ParticipantRewardsSchema;
|
|
1680
1752
|
exports.ParticipantRoleSchema = ParticipantRoleSchema;
|
|
@@ -1684,10 +1756,18 @@ exports.PositiveIntegerSchema = PositiveIntegerSchema;
|
|
|
1684
1756
|
exports.RecordEnvironmentSchema = RecordEnvironmentSchema;
|
|
1685
1757
|
exports.RecordRelationshipTypeSchema = RecordRelationshipTypeSchema;
|
|
1686
1758
|
exports.RecordSchemaTypeSchema = RecordSchemaTypeSchema;
|
|
1759
|
+
exports.RecycledIDAttributesSchema = RecycledIDAttributesSchema;
|
|
1760
|
+
exports.RecycledIDDataSchema = RecycledIDDataSchema;
|
|
1761
|
+
exports.RecycledIDIpfsSchema = RecycledIDIpfsSchema;
|
|
1762
|
+
exports.RecycledIDIpfsSchemaMeta = RecycledIDIpfsSchemaMeta;
|
|
1763
|
+
exports.RecyclerAttributeSchema = RecyclerAttributeSchema;
|
|
1687
1764
|
exports.RewardAllocationSchema = RewardAllocationSchema;
|
|
1688
1765
|
exports.SemanticVersionSchema = SemanticVersionSchema;
|
|
1689
1766
|
exports.Sha256HashSchema = Sha256HashSchema;
|
|
1690
1767
|
exports.SlugSchema = SlugSchema;
|
|
1768
|
+
exports.SourceWasteTypeAttributeSchema = SourceWasteTypeAttributeSchema;
|
|
1769
|
+
exports.SourceWeightAttributeSchema = SourceWeightAttributeSchema;
|
|
1770
|
+
exports.StringifiedTokenIdSchema = StringifiedTokenIdSchema;
|
|
1691
1771
|
exports.TokenIdSchema = TokenIdSchema;
|
|
1692
1772
|
exports.TokenSymbolSchema = TokenSymbolSchema;
|
|
1693
1773
|
exports.UnixTimestampSchema = UnixTimestampSchema;
|