@carrot-foundation/schemas 0.1.61 → 0.1.62
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 +41 -169
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +108 -283
- package/dist/index.d.ts +108 -283
- package/dist/index.js +41 -165
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/schemas/ipfs/collection/collection.example.json +3 -4
- package/schemas/ipfs/collection/collection.schema.json +2 -12
- package/schemas/ipfs/credit/credit.example.json +3 -4
- package/schemas/ipfs/credit/credit.schema.json +2 -12
- package/schemas/ipfs/credit-purchase-receipt/credit-purchase-receipt.example.json +4 -87
- package/schemas/ipfs/credit-purchase-receipt/credit-purchase-receipt.schema.json +7 -85
- package/schemas/ipfs/credit-retirement-receipt/credit-retirement-receipt.example.json +4 -5
- package/schemas/ipfs/credit-retirement-receipt/credit-retirement-receipt.schema.json +6 -16
- package/schemas/ipfs/gas-id/gas-id.example.json +10 -55
- package/schemas/ipfs/gas-id/gas-id.schema.json +60 -217
- package/schemas/ipfs/mass-id/mass-id.example.json +9 -6
- package/schemas/ipfs/mass-id/mass-id.schema.json +59 -21
- package/schemas/ipfs/mass-id-audit/mass-id-audit.example.json +3 -4
- package/schemas/ipfs/mass-id-audit/mass-id-audit.schema.json +2 -12
- package/schemas/ipfs/methodology/methodology.example.json +3 -4
- package/schemas/ipfs/methodology/methodology.schema.json +2 -12
- package/schemas/ipfs/recycled-id/recycled-id.example.json +11 -74
- package/schemas/ipfs/recycled-id/recycled-id.schema.json +64 -221
- package/schemas/schema-hashes.json +10 -10
package/dist/index.cjs
CHANGED
|
@@ -28434,10 +28434,6 @@ var BaseIpfsSchema = zod.z.strictObject({
|
|
|
28434
28434
|
}),
|
|
28435
28435
|
external_id: ExternalIdSchema,
|
|
28436
28436
|
external_url: ExternalUrlSchema,
|
|
28437
|
-
content_hash: Sha256HashSchema.meta({
|
|
28438
|
-
title: "Content Hash",
|
|
28439
|
-
description: "SHA-256 hash of RFC 8785 canonicalized JSON after schema validation"
|
|
28440
|
-
}),
|
|
28441
28437
|
viewer_reference: ViewerReferenceSchema.optional(),
|
|
28442
28438
|
environment: RecordEnvironmentSchema.optional(),
|
|
28443
28439
|
data: zod.z.record(zod.z.string(), zod.z.unknown()).optional().meta({
|
|
@@ -28548,9 +28544,9 @@ var NftIpfsSchema = BaseIpfsSchema.safeExtend({
|
|
|
28548
28544
|
description: "Type/category of this NFT schema"
|
|
28549
28545
|
})
|
|
28550
28546
|
}),
|
|
28551
|
-
|
|
28552
|
-
title: "
|
|
28553
|
-
description: "SHA-256 hash of the original JSON content including private data before schema validation"
|
|
28547
|
+
audit_data_hash: Sha256HashSchema.meta({
|
|
28548
|
+
title: "Audit Data Hash",
|
|
28549
|
+
description: "SHA-256 hash of the original JSON content including private data before schema validation, used for data audit purposes"
|
|
28554
28550
|
}),
|
|
28555
28551
|
viewer_reference: ViewerReferenceSchema,
|
|
28556
28552
|
environment: RecordEnvironmentSchema,
|
|
@@ -29073,6 +29069,13 @@ var OriginCityAttributeSchema = NftAttributeSchema.safeExtend({
|
|
|
29073
29069
|
title: "Origin City Attribute",
|
|
29074
29070
|
description: "City or municipality where waste was originally generated and picked up"
|
|
29075
29071
|
});
|
|
29072
|
+
var OriginCountrySubdivisionAttributeSchema = NftAttributeSchema.safeExtend({
|
|
29073
|
+
trait_type: zod.z.literal("Origin Country Subdivision"),
|
|
29074
|
+
value: IsoCountrySubdivisionCodeSchema
|
|
29075
|
+
}).meta({
|
|
29076
|
+
title: "Origin Country Subdivision Attribute",
|
|
29077
|
+
description: "ISO 3166-2 country subdivision code where waste was originally generated and picked up"
|
|
29078
|
+
});
|
|
29076
29079
|
var AuditResultSchema = zod.z.enum(["PASSED", "FAILED"]).meta({
|
|
29077
29080
|
title: "Audit Result",
|
|
29078
29081
|
description: "Result of audit execution",
|
|
@@ -29099,7 +29102,7 @@ var AuditReferenceSchema = zod.z.strictObject({
|
|
|
29099
29102
|
title: "Rules Executed",
|
|
29100
29103
|
description: "Number of rules executed during the audit"
|
|
29101
29104
|
}),
|
|
29102
|
-
|
|
29105
|
+
ipfs_uri: IpfsUriSchema.meta({
|
|
29103
29106
|
title: "Audit Report",
|
|
29104
29107
|
description: "IPFS URI of the audit report"
|
|
29105
29108
|
})
|
|
@@ -29435,7 +29438,7 @@ var WastePropertiesSchema = zod.z.strictObject({
|
|
|
29435
29438
|
title: "Source Waste Subtype",
|
|
29436
29439
|
description: "Subtype of the source waste"
|
|
29437
29440
|
}),
|
|
29438
|
-
|
|
29441
|
+
weight_kg: WeightKgSchema.meta({
|
|
29439
29442
|
title: "Source Waste Net Weight",
|
|
29440
29443
|
description: "Net weight of the source waste in kilograms (kg)"
|
|
29441
29444
|
})
|
|
@@ -29443,102 +29446,6 @@ var WastePropertiesSchema = zod.z.strictObject({
|
|
|
29443
29446
|
title: "Waste Properties",
|
|
29444
29447
|
description: "Properties of the source waste (MassID)"
|
|
29445
29448
|
});
|
|
29446
|
-
var RewardDiscountTypeSchema = zod.z.enum(["large_business", "supply_chain_digitization"]).meta({
|
|
29447
|
-
title: "Discount Type",
|
|
29448
|
-
description: "Type of discount applied to the reward allocation",
|
|
29449
|
-
examples: ["large_business", "supply_chain_digitization"]
|
|
29450
|
-
});
|
|
29451
|
-
var RewardDiscountSchema = zod.z.strictObject({
|
|
29452
|
-
type: RewardDiscountTypeSchema.meta({
|
|
29453
|
-
title: "Discount Type",
|
|
29454
|
-
description: "Type of discount applied"
|
|
29455
|
-
}),
|
|
29456
|
-
percentage: PercentageSchema.meta({
|
|
29457
|
-
title: "Discount Percentage",
|
|
29458
|
-
description: "Percentage reduction applied (e.g., 50 for 50% discount)",
|
|
29459
|
-
examples: [25, 50]
|
|
29460
|
-
}),
|
|
29461
|
-
reason: NonEmptyStringSchema.max(200).meta({
|
|
29462
|
-
title: "Discount Reason",
|
|
29463
|
-
description: "Human-readable explanation of why the discount was applied",
|
|
29464
|
-
examples: [
|
|
29465
|
-
"Waste Generator not identified - Supply Chain Digitization Incentive",
|
|
29466
|
-
"Large business with >$4M annual revenue",
|
|
29467
|
-
"Brazil Tax Authority Group I Large Business classification"
|
|
29468
|
-
]
|
|
29469
|
-
})
|
|
29470
|
-
}).meta({
|
|
29471
|
-
title: "Discount",
|
|
29472
|
-
description: "Discount applied to a reward allocation"
|
|
29473
|
-
});
|
|
29474
|
-
var RewardAllocationSchema = zod.z.strictObject({
|
|
29475
|
-
participant_id_hash: ParticipantIdHashSchema,
|
|
29476
|
-
role: ParticipantRoleSchema.meta({
|
|
29477
|
-
title: "Participant Role",
|
|
29478
|
-
description: "Role of the participant in the supply chain"
|
|
29479
|
-
}),
|
|
29480
|
-
reward_percentage: PercentageSchema.meta({
|
|
29481
|
-
title: "Reward Percentage",
|
|
29482
|
-
description: "Reward percentage allocated to the participant"
|
|
29483
|
-
}),
|
|
29484
|
-
discounts: zod.z.array(RewardDiscountSchema).optional().meta({
|
|
29485
|
-
title: "Discounts",
|
|
29486
|
-
description: "Discounts applied to this participant's reward allocation"
|
|
29487
|
-
}),
|
|
29488
|
-
effective_percentage: PercentageSchema.meta({
|
|
29489
|
-
title: "Effective Percentage",
|
|
29490
|
-
description: "Effective percentage of the reward after discounts"
|
|
29491
|
-
})
|
|
29492
|
-
}).meta({
|
|
29493
|
-
title: "Reward Allocation",
|
|
29494
|
-
description: "Reward allocation for a specific participant"
|
|
29495
|
-
});
|
|
29496
|
-
var DistributionNotesSchema = zod.z.strictObject({
|
|
29497
|
-
discounts_applied: zod.z.array(NonEmptyStringSchema.max(200)).optional().meta({
|
|
29498
|
-
title: "Discounts Applied",
|
|
29499
|
-
description: "Descriptions of discounts applied to the distribution",
|
|
29500
|
-
examples: [
|
|
29501
|
-
[
|
|
29502
|
-
"50% reduction applied to Waste Generator participants with >$4M annual revenue",
|
|
29503
|
-
"25% Supply Chain Digitization Incentive applied to logistics providers due to unidentified Waste Generator"
|
|
29504
|
-
]
|
|
29505
|
-
]
|
|
29506
|
-
}),
|
|
29507
|
-
redirected_rewards: NonEmptyStringSchema.max(300).optional().meta({
|
|
29508
|
-
title: "Redirected Rewards",
|
|
29509
|
-
description: "Description of rewards redirected to community pools or other recipients",
|
|
29510
|
-
examples: [
|
|
29511
|
-
"Discounted rewards from large businesses redirected to the Community Impact Pool managed by Carrot Foundation"
|
|
29512
|
-
]
|
|
29513
|
-
}),
|
|
29514
|
-
special_circumstances: zod.z.array(NonEmptyStringSchema.max(200)).optional().meta({
|
|
29515
|
-
title: "Special Circumstances",
|
|
29516
|
-
description: "Any special circumstances affecting the distribution",
|
|
29517
|
-
examples: [
|
|
29518
|
-
"Country-specific threshold applied: Brazil Tax Authority Group I Large Business classification"
|
|
29519
|
-
]
|
|
29520
|
-
})
|
|
29521
|
-
}).meta({
|
|
29522
|
-
title: "Distribution Notes",
|
|
29523
|
-
description: "Additional notes about the reward distribution, discounts, and special circumstances"
|
|
29524
|
-
});
|
|
29525
|
-
var ParticipantRewardsSchema = zod.z.strictObject({
|
|
29526
|
-
distribution_basis: NonEmptyStringSchema.max(200).meta({
|
|
29527
|
-
title: "Distribution Basis",
|
|
29528
|
-
description: "Basis for the rewards distribution"
|
|
29529
|
-
}),
|
|
29530
|
-
reward_allocations: zod.z.array(RewardAllocationSchema).min(1).meta({
|
|
29531
|
-
title: "Reward Allocations",
|
|
29532
|
-
description: "Rewards percentage allocated to each participant"
|
|
29533
|
-
}),
|
|
29534
|
-
distribution_notes: DistributionNotesSchema.optional().meta({
|
|
29535
|
-
title: "Distribution Notes",
|
|
29536
|
-
description: "Additional notes about the reward distribution"
|
|
29537
|
-
})
|
|
29538
|
-
}).meta({
|
|
29539
|
-
title: "Participant Rewards",
|
|
29540
|
-
description: "Rewards distribution to participants"
|
|
29541
|
-
});
|
|
29542
29449
|
var SummaryBaseSchema = zod.z.strictObject({
|
|
29543
29450
|
total_certificates: PositiveIntegerSchema.meta({
|
|
29544
29451
|
title: "Total Certificates",
|
|
@@ -29647,7 +29554,7 @@ function buildSchemaUrl(schemaPath) {
|
|
|
29647
29554
|
return `${getSchemaBaseUrl()}/${cleanPath}`;
|
|
29648
29555
|
}
|
|
29649
29556
|
function getSchemaVersionOrDefault() {
|
|
29650
|
-
return "0.1.
|
|
29557
|
+
return "0.1.62";
|
|
29651
29558
|
}
|
|
29652
29559
|
|
|
29653
29560
|
// src/shared/schema-validation.ts
|
|
@@ -30073,6 +29980,7 @@ var MassIDAttributeWeightSchema = createWeightAttributeSchema({
|
|
|
30073
29980
|
description: "Net batch weight in kilograms (kg) for this MassID"
|
|
30074
29981
|
});
|
|
30075
29982
|
var MassIDAttributeOriginCitySchema = OriginCityAttributeSchema;
|
|
29983
|
+
var MassIDAttributeOriginCountrySubdivisionSchema = OriginCountrySubdivisionAttributeSchema;
|
|
30076
29984
|
var MassIDAttributePickUpVehicleTypeSchema = NftAttributeSchema.safeExtend({
|
|
30077
29985
|
trait_type: zod.z.literal("Pick-up Vehicle Type"),
|
|
30078
29986
|
value: VehicleTypeSchema.meta({
|
|
@@ -30157,6 +30065,7 @@ var REQUIRED_MASS_ID_ATTRIBUTES = [
|
|
|
30157
30065
|
MassIDAttributeWasteSubtypeSchema,
|
|
30158
30066
|
MassIDAttributeWeightSchema,
|
|
30159
30067
|
MassIDAttributeOriginCitySchema,
|
|
30068
|
+
MassIDAttributeOriginCountrySubdivisionSchema,
|
|
30160
30069
|
MassIDAttributePickUpVehicleTypeSchema,
|
|
30161
30070
|
MassIDAttributeRecyclingMethodSchema,
|
|
30162
30071
|
MassIDAttributePickUpDateSchema,
|
|
@@ -30181,6 +30090,7 @@ var MassIDAttributesSchema = createOrderedAttributesSchema({
|
|
|
30181
30090
|
"Waste Subtype",
|
|
30182
30091
|
"Weight (kg)",
|
|
30183
30092
|
"Origin City",
|
|
30093
|
+
"Origin Country Subdivision",
|
|
30184
30094
|
"Pick-up Vehicle Type",
|
|
30185
30095
|
"Recycling Method",
|
|
30186
30096
|
"Pick-up Date",
|
|
@@ -30216,7 +30126,7 @@ var MassIDWastePropertiesSchema = zod.z.strictObject({
|
|
|
30216
30126
|
description: "Specific subcategory of waste material"
|
|
30217
30127
|
}),
|
|
30218
30128
|
local_classification: MassIDLocalClassificationSchema.optional(),
|
|
30219
|
-
|
|
30129
|
+
weight_kg: WeightKgSchema.meta({
|
|
30220
30130
|
title: "Net Weight",
|
|
30221
30131
|
description: "Net weight of the waste batch in kilograms (kg)",
|
|
30222
30132
|
examples: [3e3]
|
|
@@ -30499,9 +30409,9 @@ var MassIDIpfsSchema = NftIpfsSchema.safeExtend({
|
|
|
30499
30409
|
ctx,
|
|
30500
30410
|
attributeByTraitType,
|
|
30501
30411
|
traitType: "Weight (kg)",
|
|
30502
|
-
expectedValue: data.waste_properties.
|
|
30503
|
-
missingMessage: "Weight (kg) attribute must be present and match waste_properties.
|
|
30504
|
-
mismatchMessage: "Weight (kg) attribute must equal waste_properties.
|
|
30412
|
+
expectedValue: data.waste_properties.weight_kg,
|
|
30413
|
+
missingMessage: "Weight (kg) attribute must be present and match waste_properties.weight_kg",
|
|
30414
|
+
mismatchMessage: "Weight (kg) attribute must equal waste_properties.weight_kg"
|
|
30505
30415
|
});
|
|
30506
30416
|
validateAttributeValue({
|
|
30507
30417
|
ctx,
|
|
@@ -30619,6 +30529,7 @@ var GasIDAttributeCreditTypeSchema = CreditTypeAttributeSchema;
|
|
|
30619
30529
|
var GasIDAttributeSourceWasteTypeSchema = SourceWasteTypeAttributeSchema;
|
|
30620
30530
|
var GasIDAttributeSourceWeightSchema = SourceWeightAttributeSchema;
|
|
30621
30531
|
var GasIDAttributeOriginCitySchema = OriginCityAttributeSchema;
|
|
30532
|
+
var GasIDAttributeOriginCountrySubdivisionSchema = OriginCountrySubdivisionAttributeSchema;
|
|
30622
30533
|
var GasIDAttributeMassIDTokenIdSchema = MassIDTokenIdAttributeSchema;
|
|
30623
30534
|
var GasIDAttributeMassIDRecyclingDateSchema = MassIDRecyclingDateAttributeSchema;
|
|
30624
30535
|
var GasIDAttributeCertificateIssuanceDateSchema = CertificateIssuanceDateAttributeSchema;
|
|
@@ -30631,12 +30542,13 @@ var GasIDAttributesSchema = zod.z.tuple([
|
|
|
30631
30542
|
GasIDAttributeSourceWasteTypeSchema,
|
|
30632
30543
|
GasIDAttributeSourceWeightSchema,
|
|
30633
30544
|
GasIDAttributeOriginCitySchema,
|
|
30545
|
+
GasIDAttributeOriginCountrySubdivisionSchema,
|
|
30634
30546
|
GasIDAttributeMassIDTokenIdSchema,
|
|
30635
30547
|
GasIDAttributeMassIDRecyclingDateSchema,
|
|
30636
30548
|
GasIDAttributeCertificateIssuanceDateSchema
|
|
30637
30549
|
]).meta({
|
|
30638
30550
|
title: "GasID NFT Attribute Array",
|
|
30639
|
-
description: "Schema for the fixed set of GasID NFT attributes, enforcing order and type for each trait.\n\nRequired attributes (
|
|
30551
|
+
description: "Schema for the fixed set of GasID NFT attributes, enforcing order and type for each trait.\n\nRequired attributes (12, in order): Methodology, Gas Type, CO\u2082e Prevented (kg), Credit Amount, Credit Type, Source Waste Type, Source Weight (kg), Origin City, Origin Country Subdivision, MassID, MassID Recycling Date, Certificate Issuance Date."
|
|
30640
30552
|
});
|
|
30641
30553
|
var GasIDSummarySchema = zod.z.strictObject({
|
|
30642
30554
|
gas_type: GasTypeSchema,
|
|
@@ -30711,8 +30623,7 @@ var GasIDDataSchema = zod.z.strictObject({
|
|
|
30711
30623
|
title: "Source Waste Origin Location",
|
|
30712
30624
|
description: "Location of the waste origin"
|
|
30713
30625
|
}),
|
|
30714
|
-
prevented_emissions_calculation: PreventedEmissionsCalculationSchema
|
|
30715
|
-
participant_rewards: ParticipantRewardsSchema
|
|
30626
|
+
prevented_emissions_calculation: PreventedEmissionsCalculationSchema
|
|
30716
30627
|
}).meta({
|
|
30717
30628
|
title: "GasID Data",
|
|
30718
30629
|
description: "Complete data structure for GasID certificate"
|
|
@@ -30821,9 +30732,9 @@ var GasIDIpfsSchema = NftIpfsSchema.safeExtend({
|
|
|
30821
30732
|
ctx,
|
|
30822
30733
|
attributeByTraitType,
|
|
30823
30734
|
traitType: "Source Weight (kg)",
|
|
30824
|
-
expectedValue: data.waste_properties.
|
|
30825
|
-
missingMessage: "Source Weight (kg) attribute must be present and match data.waste_properties.
|
|
30826
|
-
mismatchMessage: "Source Weight (kg) attribute must equal data.waste_properties.
|
|
30735
|
+
expectedValue: data.waste_properties.weight_kg,
|
|
30736
|
+
missingMessage: "Source Weight (kg) attribute must be present and match data.waste_properties.weight_kg",
|
|
30737
|
+
mismatchMessage: "Source Weight (kg) attribute must equal data.waste_properties.weight_kg"
|
|
30827
30738
|
});
|
|
30828
30739
|
validateAttributeValue({
|
|
30829
30740
|
ctx,
|
|
@@ -30879,8 +30790,8 @@ var GasIDIpfsSchema = NftIpfsSchema.safeExtend({
|
|
|
30879
30790
|
var RecycledIDAttributeMethodologySchema = MethodologyAttributeSchema;
|
|
30880
30791
|
var RecycledIDAttributeRecycledMassWeightSchema = createWeightAttributeSchema(
|
|
30881
30792
|
{
|
|
30882
|
-
traitType: "Recycled
|
|
30883
|
-
title: "Recycled
|
|
30793
|
+
traitType: "Recycled Weight (kg)",
|
|
30794
|
+
title: "Recycled Weight",
|
|
30884
30795
|
description: "Total weight of recycled materials in kilograms"
|
|
30885
30796
|
}
|
|
30886
30797
|
);
|
|
@@ -30889,6 +30800,7 @@ var RecycledIDAttributeCreditTypeSchema = CreditTypeAttributeSchema;
|
|
|
30889
30800
|
var RecycledIDAttributeSourceWasteTypeSchema = SourceWasteTypeAttributeSchema;
|
|
30890
30801
|
var RecycledIDAttributeSourceWeightSchema = SourceWeightAttributeSchema;
|
|
30891
30802
|
var RecycledIDAttributeOriginCitySchema = OriginCityAttributeSchema;
|
|
30803
|
+
var RecycledIDAttributeOriginCountrySubdivisionSchema = OriginCountrySubdivisionAttributeSchema;
|
|
30892
30804
|
var RecycledIDAttributeMassIDTokenIdSchema = MassIDTokenIdAttributeSchema;
|
|
30893
30805
|
var RecycledIDAttributeMassIDRecyclingDateSchema = MassIDRecyclingDateAttributeSchema;
|
|
30894
30806
|
var RecycledIDAttributeCertificateIssuanceDateSchema = CertificateIssuanceDateAttributeSchema;
|
|
@@ -30900,16 +30812,17 @@ var RecycledIDAttributesSchema = zod.z.tuple([
|
|
|
30900
30812
|
RecycledIDAttributeSourceWasteTypeSchema,
|
|
30901
30813
|
RecycledIDAttributeSourceWeightSchema,
|
|
30902
30814
|
RecycledIDAttributeOriginCitySchema,
|
|
30815
|
+
RecycledIDAttributeOriginCountrySubdivisionSchema,
|
|
30903
30816
|
RecycledIDAttributeMassIDTokenIdSchema,
|
|
30904
30817
|
RecycledIDAttributeMassIDRecyclingDateSchema,
|
|
30905
30818
|
RecycledIDAttributeCertificateIssuanceDateSchema
|
|
30906
30819
|
]).meta({
|
|
30907
30820
|
title: "RecycledID NFT Attribute Array",
|
|
30908
|
-
description: "Schema for the fixed set of RecycledID NFT attributes, enforcing order and type for each trait.\n\nRequired attributes (
|
|
30821
|
+
description: "Schema for the fixed set of RecycledID NFT attributes, enforcing order and type for each trait.\n\nRequired attributes (11, in order): Methodology, Recycled Weight (kg), Credit Amount, Credit Type, Source Waste Type, Source Weight (kg), Origin City, Origin Country Subdivision, MassID, MassID Recycling Date, Certificate Issuance Date."
|
|
30909
30822
|
});
|
|
30910
30823
|
var RecycledIDSummarySchema = zod.z.strictObject({
|
|
30911
30824
|
recycled_mass_kg: WeightKgSchema.meta({
|
|
30912
|
-
title: "Recycled
|
|
30825
|
+
title: "Recycled Weight",
|
|
30913
30826
|
description: "Total weight of materials successfully recycled in kilograms (kg)"
|
|
30914
30827
|
}),
|
|
30915
30828
|
credit_type: CreditTypeSchema,
|
|
@@ -30931,8 +30844,7 @@ var RecycledIDDataSchema = zod.z.strictObject({
|
|
|
30931
30844
|
origin_location: LocationSchema.meta({
|
|
30932
30845
|
title: "RecycledID Origin Location",
|
|
30933
30846
|
description: "Source waste origin location details"
|
|
30934
|
-
})
|
|
30935
|
-
participant_rewards: ParticipantRewardsSchema
|
|
30847
|
+
})
|
|
30936
30848
|
}).meta({
|
|
30937
30849
|
title: "RecycledID Data",
|
|
30938
30850
|
description: "Complete data structure for RecycledID certificate"
|
|
@@ -30999,11 +30911,11 @@ var RecycledIDIpfsSchema = NftIpfsSchema.safeExtend({
|
|
|
30999
30911
|
validateNumericAttributeValue({
|
|
31000
30912
|
ctx,
|
|
31001
30913
|
attributeByTraitType,
|
|
31002
|
-
traitType: "Recycled
|
|
30914
|
+
traitType: "Recycled Weight (kg)",
|
|
31003
30915
|
expectedValue: data.summary.recycled_mass_kg,
|
|
31004
30916
|
epsilon: 0.01,
|
|
31005
|
-
missingMessage: "Recycled
|
|
31006
|
-
mismatchMessage: "Recycled
|
|
30917
|
+
missingMessage: "Recycled Weight (kg) attribute must be present and match data.summary.recycled_mass_kg",
|
|
30918
|
+
mismatchMessage: "Recycled Weight (kg) attribute must equal data.summary.recycled_mass_kg"
|
|
31007
30919
|
});
|
|
31008
30920
|
validateAttributeValue({
|
|
31009
30921
|
ctx,
|
|
@@ -31033,9 +30945,9 @@ var RecycledIDIpfsSchema = NftIpfsSchema.safeExtend({
|
|
|
31033
30945
|
ctx,
|
|
31034
30946
|
attributeByTraitType,
|
|
31035
30947
|
traitType: "Source Weight (kg)",
|
|
31036
|
-
expectedValue: data.waste_properties.
|
|
31037
|
-
missingMessage: "Source Weight (kg) attribute must be present and match data.waste_properties.
|
|
31038
|
-
mismatchMessage: "Source Weight (kg) attribute must equal data.waste_properties.
|
|
30948
|
+
expectedValue: data.waste_properties.weight_kg,
|
|
30949
|
+
missingMessage: "Source Weight (kg) attribute must be present and match data.waste_properties.weight_kg",
|
|
30950
|
+
mismatchMessage: "Source Weight (kg) attribute must equal data.waste_properties.weight_kg"
|
|
31039
30951
|
});
|
|
31040
30952
|
validateAttributeValue({
|
|
31041
30953
|
ctx,
|
|
@@ -31206,23 +31118,6 @@ var CreditPurchaseReceiptCertificateSchema = CertificateReferenceBaseSchema.safe
|
|
|
31206
31118
|
title: "Certificate",
|
|
31207
31119
|
description: "Certificate associated with the purchase"
|
|
31208
31120
|
});
|
|
31209
|
-
var CreditPurchaseReceiptParticipantRewardSchema = zod.z.strictObject({
|
|
31210
|
-
participant_id_hash: ParticipantIdHashSchema,
|
|
31211
|
-
roles: uniqueArrayItems(
|
|
31212
|
-
ParticipantRoleSchema,
|
|
31213
|
-
"Participant roles must be unique"
|
|
31214
|
-
).min(1).meta({
|
|
31215
|
-
title: "Participant Roles",
|
|
31216
|
-
description: "Roles the participant has in the supply chain"
|
|
31217
|
-
}),
|
|
31218
|
-
usdc_amount: UsdcAmountSchema.meta({
|
|
31219
|
-
title: "USDC Reward Amount",
|
|
31220
|
-
description: "USDC amount allocated to this participant"
|
|
31221
|
-
})
|
|
31222
|
-
}).meta({
|
|
31223
|
-
title: "Participant Reward",
|
|
31224
|
-
description: "Reward distribution for a participant"
|
|
31225
|
-
});
|
|
31226
31121
|
var CreditPurchaseReceiptRetirementReceiptSchema = CreditRetirementReceiptReferenceSchema;
|
|
31227
31122
|
var CreditPurchaseReceiptDataSchema = zod.z.strictObject({
|
|
31228
31123
|
summary: CreditPurchaseReceiptSummarySchema,
|
|
@@ -31251,14 +31146,6 @@ var CreditPurchaseReceiptDataSchema = zod.z.strictObject({
|
|
|
31251
31146
|
title: "Certificates",
|
|
31252
31147
|
description: "Certificates involved in the purchase"
|
|
31253
31148
|
}),
|
|
31254
|
-
participant_rewards: uniqueBy(
|
|
31255
|
-
CreditPurchaseReceiptParticipantRewardSchema,
|
|
31256
|
-
(reward) => reward.participant_id_hash,
|
|
31257
|
-
"Participant participant_id_hash must be unique"
|
|
31258
|
-
).min(1).meta({
|
|
31259
|
-
title: "Participant Rewards",
|
|
31260
|
-
description: "Rewards distributed to participants in the supply chain for this purchase"
|
|
31261
|
-
}),
|
|
31262
31149
|
retirement_receipt: CreditPurchaseReceiptRetirementReceiptSchema.optional()
|
|
31263
31150
|
}).superRefine((data, ctx) => {
|
|
31264
31151
|
validateCountMatches({
|
|
@@ -31351,17 +31238,6 @@ var CreditPurchaseReceiptDataSchema = zod.z.strictObject({
|
|
|
31351
31238
|
hasRetirementReceipt: !!data.retirement_receipt,
|
|
31352
31239
|
totalRetiredAmount: certificateCollectionRetiredTotal
|
|
31353
31240
|
});
|
|
31354
|
-
const participantRewardTotal = data.participant_rewards.reduce(
|
|
31355
|
-
(sum, reward) => sum + Number(reward.usdc_amount),
|
|
31356
|
-
0
|
|
31357
|
-
);
|
|
31358
|
-
validateTotalMatches({
|
|
31359
|
-
ctx,
|
|
31360
|
-
actualTotal: participantRewardTotal,
|
|
31361
|
-
expectedTotal: data.summary.total_amount_usdc,
|
|
31362
|
-
path: ["summary", "total_amount_usdc"],
|
|
31363
|
-
message: "summary.total_amount_usdc must equal sum of participant_rewards.usdc_amount"
|
|
31364
|
-
});
|
|
31365
31241
|
}).meta({
|
|
31366
31242
|
title: "Credit Purchase Receipt Data",
|
|
31367
31243
|
description: "Complete data structure for a credit purchase receipt"
|
|
@@ -32260,7 +32136,6 @@ exports.CreditTokenSlugSchema = CreditTokenSlugSchema;
|
|
|
32260
32136
|
exports.CreditTokenSymbolSchema = CreditTokenSymbolSchema;
|
|
32261
32137
|
exports.CreditTypeAttributeSchema = CreditTypeAttributeSchema;
|
|
32262
32138
|
exports.CreditTypeSchema = CreditTypeSchema;
|
|
32263
|
-
exports.DistributionNotesSchema = DistributionNotesSchema;
|
|
32264
32139
|
exports.EPSILON = EPSILON;
|
|
32265
32140
|
exports.EnsDomainSchema = EnsDomainSchema;
|
|
32266
32141
|
exports.EthereumAddressSchema = EthereumAddressSchema;
|
|
@@ -32314,8 +32189,8 @@ exports.NonEmptyStringSchema = NonEmptyStringSchema;
|
|
|
32314
32189
|
exports.NonNegativeFloatSchema = NonNegativeFloatSchema;
|
|
32315
32190
|
exports.NonNegativeIntegerSchema = NonNegativeIntegerSchema;
|
|
32316
32191
|
exports.OriginCityAttributeSchema = OriginCityAttributeSchema;
|
|
32192
|
+
exports.OriginCountrySubdivisionAttributeSchema = OriginCountrySubdivisionAttributeSchema;
|
|
32317
32193
|
exports.ParticipantIdHashSchema = ParticipantIdHashSchema;
|
|
32318
|
-
exports.ParticipantRewardsSchema = ParticipantRewardsSchema;
|
|
32319
32194
|
exports.ParticipantRoleSchema = ParticipantRoleSchema;
|
|
32320
32195
|
exports.ParticipantSchema = ParticipantSchema;
|
|
32321
32196
|
exports.PercentageSchema = PercentageSchema;
|
|
@@ -32330,9 +32205,6 @@ exports.RecycledIDIpfsSchemaMeta = RecycledIDIpfsSchemaMeta;
|
|
|
32330
32205
|
exports.RecycledIDNameSchema = RecycledIDNameSchema;
|
|
32331
32206
|
exports.RecycledIDReferenceSchema = RecycledIDReferenceSchema;
|
|
32332
32207
|
exports.RecycledIDShortNameSchema = RecycledIDShortNameSchema;
|
|
32333
|
-
exports.RewardAllocationSchema = RewardAllocationSchema;
|
|
32334
|
-
exports.RewardDiscountSchema = RewardDiscountSchema;
|
|
32335
|
-
exports.RewardDiscountTypeSchema = RewardDiscountTypeSchema;
|
|
32336
32208
|
exports.ScaleTypeSchema = ScaleTypeSchema;
|
|
32337
32209
|
exports.SchemaInfoSchema = SchemaInfoSchema;
|
|
32338
32210
|
exports.SemanticVersionSchema = SemanticVersionSchema;
|