@carrot-foundation/schemas 0.1.60 → 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 +187 -365
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +276 -408
- package/dist/index.d.ts +276 -408
- package/dist/index.js +180 -358
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/schemas/ipfs/collection/collection.example.json +3 -5
- package/schemas/ipfs/collection/collection.schema.json +2 -22
- package/schemas/ipfs/credit/credit.example.json +3 -5
- package/schemas/ipfs/credit/credit.schema.json +2 -22
- package/schemas/ipfs/credit-purchase-receipt/credit-purchase-receipt.example.json +4 -87
- package/schemas/ipfs/credit-purchase-receipt/credit-purchase-receipt.schema.json +121 -199
- package/schemas/ipfs/credit-retirement-receipt/credit-retirement-receipt.example.json +5 -5
- package/schemas/ipfs/credit-retirement-receipt/credit-retirement-receipt.schema.json +119 -119
- package/schemas/ipfs/gas-id/gas-id.example.json +12 -56
- package/schemas/ipfs/gas-id/gas-id.schema.json +95 -242
- package/schemas/ipfs/mass-id/mass-id.example.json +9 -6
- package/schemas/ipfs/mass-id/mass-id.schema.json +65 -27
- package/schemas/ipfs/mass-id-audit/mass-id-audit.example.json +17 -8
- package/schemas/ipfs/mass-id-audit/mass-id-audit.schema.json +131 -53
- package/schemas/ipfs/methodology/methodology.example.json +4 -6
- package/schemas/ipfs/methodology/methodology.schema.json +2 -22
- package/schemas/ipfs/recycled-id/recycled-id.example.json +13 -75
- package/schemas/ipfs/recycled-id/recycled-id.schema.json +99 -246
- package/schemas/schema-hashes.json +10 -10
package/dist/index.cjs
CHANGED
|
@@ -28434,14 +28434,6 @@ var BaseIpfsSchema = zod.z.strictObject({
|
|
|
28434
28434
|
}),
|
|
28435
28435
|
external_id: ExternalIdSchema,
|
|
28436
28436
|
external_url: ExternalUrlSchema,
|
|
28437
|
-
full_content_hash: Sha256HashSchema.meta({
|
|
28438
|
-
title: "Full Content Hash",
|
|
28439
|
-
description: "SHA-256 hash of the original JSON content including private data before schema validation"
|
|
28440
|
-
}),
|
|
28441
|
-
content_hash: Sha256HashSchema.meta({
|
|
28442
|
-
title: "Content Hash",
|
|
28443
|
-
description: "SHA-256 hash of RFC 8785 canonicalized JSON after schema validation"
|
|
28444
|
-
}),
|
|
28445
28437
|
viewer_reference: ViewerReferenceSchema.optional(),
|
|
28446
28438
|
environment: RecordEnvironmentSchema.optional(),
|
|
28447
28439
|
data: zod.z.record(zod.z.string(), zod.z.unknown()).optional().meta({
|
|
@@ -28552,6 +28544,10 @@ var NftIpfsSchema = BaseIpfsSchema.safeExtend({
|
|
|
28552
28544
|
description: "Type/category of this NFT schema"
|
|
28553
28545
|
})
|
|
28554
28546
|
}),
|
|
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"
|
|
28550
|
+
}),
|
|
28555
28551
|
viewer_reference: ViewerReferenceSchema,
|
|
28556
28552
|
environment: RecordEnvironmentSchema,
|
|
28557
28553
|
blockchain: BlockchainReferenceSchema,
|
|
@@ -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
|
})
|
|
@@ -29107,48 +29110,55 @@ var AuditReferenceSchema = zod.z.strictObject({
|
|
|
29107
29110
|
title: "Audit Reference",
|
|
29108
29111
|
description: "Reference to an audit record"
|
|
29109
29112
|
});
|
|
29110
|
-
var
|
|
29111
|
-
external_id: ExternalIdSchema
|
|
29112
|
-
|
|
29113
|
-
|
|
29114
|
-
|
|
29115
|
-
token_id: TokenIdSchema.meta({
|
|
29116
|
-
title: "GasID Token ID",
|
|
29117
|
-
description: "NFT token ID of the GasID"
|
|
29118
|
-
}),
|
|
29119
|
-
external_url: ExternalUrlSchema.meta({
|
|
29120
|
-
title: "GasID External URL",
|
|
29121
|
-
description: "URL to view the GasID on Carrot Explorer"
|
|
29122
|
-
}),
|
|
29123
|
-
ipfs_uri: IpfsUriSchema.meta({
|
|
29124
|
-
title: "GasID IPFS URI",
|
|
29125
|
-
description: "IPFS URI of the GasID record"
|
|
29126
|
-
})
|
|
29113
|
+
var TokenReferenceBaseSchema = zod.z.strictObject({
|
|
29114
|
+
external_id: ExternalIdSchema,
|
|
29115
|
+
external_url: ExternalUrlSchema,
|
|
29116
|
+
ipfs_uri: IpfsUriSchema,
|
|
29117
|
+
smart_contract_address: SmartContractAddressSchema
|
|
29127
29118
|
}).meta({
|
|
29128
|
-
title: "
|
|
29129
|
-
description: "
|
|
29119
|
+
title: "Token Reference",
|
|
29120
|
+
description: "Base schema for all token references"
|
|
29130
29121
|
});
|
|
29131
|
-
var
|
|
29132
|
-
|
|
29133
|
-
title: "MassID External ID",
|
|
29134
|
-
description: "Unique identifier for the MassID"
|
|
29135
|
-
}),
|
|
29136
|
-
token_id: TokenIdSchema.meta({
|
|
29137
|
-
title: "MassID Token ID",
|
|
29138
|
-
description: "NFT token ID of the MassID"
|
|
29139
|
-
}),
|
|
29140
|
-
external_url: ExternalUrlSchema.meta({
|
|
29141
|
-
title: "MassID External URL",
|
|
29142
|
-
description: "URL to view the MassID on Carrot Explorer"
|
|
29143
|
-
}),
|
|
29144
|
-
ipfs_uri: IpfsUriSchema.meta({
|
|
29145
|
-
title: "MassID IPFS URI",
|
|
29146
|
-
description: "IPFS URI of the MassID record"
|
|
29147
|
-
})
|
|
29122
|
+
var NftTokenReferenceBaseSchema = TokenReferenceBaseSchema.safeExtend({
|
|
29123
|
+
token_id: TokenIdSchema
|
|
29148
29124
|
}).meta({
|
|
29125
|
+
title: "NFT Token Reference",
|
|
29126
|
+
description: "Base schema for NFT token references"
|
|
29127
|
+
});
|
|
29128
|
+
|
|
29129
|
+
// src/shared/schemas/references/mass-id-reference.schema.ts
|
|
29130
|
+
var MassIDReferenceSchema = NftTokenReferenceBaseSchema.meta({
|
|
29149
29131
|
title: "MassID Reference",
|
|
29150
29132
|
description: "Reference to a MassID record"
|
|
29151
29133
|
});
|
|
29134
|
+
|
|
29135
|
+
// src/shared/schemas/references/certificate-reference.schema.ts
|
|
29136
|
+
var CertificateReferenceBaseSchema = NftTokenReferenceBaseSchema.safeExtend({
|
|
29137
|
+
type: CertificateTypeSchema,
|
|
29138
|
+
total_amount: CreditAmountSchema.meta({
|
|
29139
|
+
title: "Certificate Total Amount",
|
|
29140
|
+
description: "Total credits available in this certificate"
|
|
29141
|
+
}),
|
|
29142
|
+
mass_id: MassIDReferenceSchema
|
|
29143
|
+
}).meta({
|
|
29144
|
+
title: "Certificate Reference Base",
|
|
29145
|
+
description: "Base schema for certificate references"
|
|
29146
|
+
});
|
|
29147
|
+
|
|
29148
|
+
// src/shared/schemas/references/credit-reference.schema.ts
|
|
29149
|
+
var CreditReferenceSchema = TokenReferenceBaseSchema.safeExtend({
|
|
29150
|
+
slug: CreditTokenSlugSchema,
|
|
29151
|
+
symbol: CreditTokenSymbolSchema
|
|
29152
|
+
}).meta({
|
|
29153
|
+
title: "Credit Reference",
|
|
29154
|
+
description: "Reference to an ERC20 credit token"
|
|
29155
|
+
});
|
|
29156
|
+
|
|
29157
|
+
// src/shared/schemas/references/gas-id-reference.schema.ts
|
|
29158
|
+
var GasIDReferenceSchema = NftTokenReferenceBaseSchema.meta({
|
|
29159
|
+
title: "GasID Reference",
|
|
29160
|
+
description: "Reference to a GasID record"
|
|
29161
|
+
});
|
|
29152
29162
|
var MethodologyReferenceSchema = zod.z.strictObject({
|
|
29153
29163
|
external_id: ExternalIdSchema.meta({
|
|
29154
29164
|
title: "Methodology External ID",
|
|
@@ -29172,6 +29182,22 @@ var MethodologyReferenceSchema = zod.z.strictObject({
|
|
|
29172
29182
|
description: "Reference to a methodology record"
|
|
29173
29183
|
});
|
|
29174
29184
|
|
|
29185
|
+
// src/shared/schemas/references/receipt-reference.schema.ts
|
|
29186
|
+
var CreditPurchaseReceiptReferenceSchema = NftTokenReferenceBaseSchema.meta({
|
|
29187
|
+
title: "Credit Purchase Receipt Reference",
|
|
29188
|
+
description: "Reference to the credit purchase receipt when retirement occurs during purchase"
|
|
29189
|
+
});
|
|
29190
|
+
var CreditRetirementReceiptReferenceSchema = NftTokenReferenceBaseSchema.meta({
|
|
29191
|
+
title: "Credit Retirement Receipt Reference",
|
|
29192
|
+
description: "Reference to the retirement receipt NFT"
|
|
29193
|
+
});
|
|
29194
|
+
|
|
29195
|
+
// src/shared/schemas/references/recycled-id-reference.schema.ts
|
|
29196
|
+
var RecycledIDReferenceSchema = NftTokenReferenceBaseSchema.meta({
|
|
29197
|
+
title: "RecycledID Reference",
|
|
29198
|
+
description: "Reference to a RecycledID record"
|
|
29199
|
+
});
|
|
29200
|
+
|
|
29175
29201
|
// src/shared/schemas/audit.schema.ts
|
|
29176
29202
|
var AuditRuleDefinitionSchema = zod.z.strictObject({
|
|
29177
29203
|
id: UuidSchema.meta({
|
|
@@ -29306,6 +29332,16 @@ var AuditRuleExecutionResultSchema = zod.z.strictObject({
|
|
|
29306
29332
|
title: "Rule Execution Result",
|
|
29307
29333
|
description: "Result of the rule execution"
|
|
29308
29334
|
}),
|
|
29335
|
+
execution_message: NonEmptyStringSchema.max(2e3).optional().meta({
|
|
29336
|
+
title: "Execution Message",
|
|
29337
|
+
description: "Human-readable message explaining the rule execution result, including details about what was validated or calculated",
|
|
29338
|
+
examples: [
|
|
29339
|
+
"No other MassIDs with the same attributes were found.",
|
|
29340
|
+
"The MassID is not linked to a valid MassID Certificate",
|
|
29341
|
+
'The time between the "Drop-off" and "Recycled" events is 90 days, within the valid range (60-180 days).',
|
|
29342
|
+
"The prevented emissions were calculated as 419.93 kg CO\u2082e using the formula (1 - 0.029) x 0.067 x 6454.8 = 419.93"
|
|
29343
|
+
]
|
|
29344
|
+
}),
|
|
29309
29345
|
rule_processor_checksum: NonEmptyStringSchema.max(200).meta({
|
|
29310
29346
|
title: "Rule Processor Checksum",
|
|
29311
29347
|
description: "Checksum for rule processor integrity verification"
|
|
@@ -29402,7 +29438,7 @@ var WastePropertiesSchema = zod.z.strictObject({
|
|
|
29402
29438
|
title: "Source Waste Subtype",
|
|
29403
29439
|
description: "Subtype of the source waste"
|
|
29404
29440
|
}),
|
|
29405
|
-
|
|
29441
|
+
weight_kg: WeightKgSchema.meta({
|
|
29406
29442
|
title: "Source Waste Net Weight",
|
|
29407
29443
|
description: "Net weight of the source waste in kilograms (kg)"
|
|
29408
29444
|
})
|
|
@@ -29410,102 +29446,6 @@ var WastePropertiesSchema = zod.z.strictObject({
|
|
|
29410
29446
|
title: "Waste Properties",
|
|
29411
29447
|
description: "Properties of the source waste (MassID)"
|
|
29412
29448
|
});
|
|
29413
|
-
var RewardDiscountTypeSchema = zod.z.enum(["large_business", "supply_chain_digitization"]).meta({
|
|
29414
|
-
title: "Discount Type",
|
|
29415
|
-
description: "Type of discount applied to the reward allocation",
|
|
29416
|
-
examples: ["large_business", "supply_chain_digitization"]
|
|
29417
|
-
});
|
|
29418
|
-
var RewardDiscountSchema = zod.z.strictObject({
|
|
29419
|
-
type: RewardDiscountTypeSchema.meta({
|
|
29420
|
-
title: "Discount Type",
|
|
29421
|
-
description: "Type of discount applied"
|
|
29422
|
-
}),
|
|
29423
|
-
percentage: PercentageSchema.meta({
|
|
29424
|
-
title: "Discount Percentage",
|
|
29425
|
-
description: "Percentage reduction applied (e.g., 50 for 50% discount)",
|
|
29426
|
-
examples: [25, 50]
|
|
29427
|
-
}),
|
|
29428
|
-
reason: NonEmptyStringSchema.max(200).meta({
|
|
29429
|
-
title: "Discount Reason",
|
|
29430
|
-
description: "Human-readable explanation of why the discount was applied",
|
|
29431
|
-
examples: [
|
|
29432
|
-
"Waste Generator not identified - Supply Chain Digitization Incentive",
|
|
29433
|
-
"Large business with >$4M annual revenue",
|
|
29434
|
-
"Brazil Tax Authority Group I Large Business classification"
|
|
29435
|
-
]
|
|
29436
|
-
})
|
|
29437
|
-
}).meta({
|
|
29438
|
-
title: "Discount",
|
|
29439
|
-
description: "Discount applied to a reward allocation"
|
|
29440
|
-
});
|
|
29441
|
-
var RewardAllocationSchema = zod.z.strictObject({
|
|
29442
|
-
participant_id_hash: ParticipantIdHashSchema,
|
|
29443
|
-
role: ParticipantRoleSchema.meta({
|
|
29444
|
-
title: "Participant Role",
|
|
29445
|
-
description: "Role of the participant in the supply chain"
|
|
29446
|
-
}),
|
|
29447
|
-
reward_percentage: PercentageSchema.meta({
|
|
29448
|
-
title: "Reward Percentage",
|
|
29449
|
-
description: "Reward percentage allocated to the participant"
|
|
29450
|
-
}),
|
|
29451
|
-
discounts: zod.z.array(RewardDiscountSchema).optional().meta({
|
|
29452
|
-
title: "Discounts",
|
|
29453
|
-
description: "Discounts applied to this participant's reward allocation"
|
|
29454
|
-
}),
|
|
29455
|
-
effective_percentage: PercentageSchema.meta({
|
|
29456
|
-
title: "Effective Percentage",
|
|
29457
|
-
description: "Effective percentage of the reward after discounts"
|
|
29458
|
-
})
|
|
29459
|
-
}).meta({
|
|
29460
|
-
title: "Reward Allocation",
|
|
29461
|
-
description: "Reward allocation for a specific participant"
|
|
29462
|
-
});
|
|
29463
|
-
var DistributionNotesSchema = zod.z.strictObject({
|
|
29464
|
-
discounts_applied: zod.z.array(NonEmptyStringSchema.max(200)).optional().meta({
|
|
29465
|
-
title: "Discounts Applied",
|
|
29466
|
-
description: "Descriptions of discounts applied to the distribution",
|
|
29467
|
-
examples: [
|
|
29468
|
-
[
|
|
29469
|
-
"50% reduction applied to Waste Generator participants with >$4M annual revenue",
|
|
29470
|
-
"25% Supply Chain Digitization Incentive applied to logistics providers due to unidentified Waste Generator"
|
|
29471
|
-
]
|
|
29472
|
-
]
|
|
29473
|
-
}),
|
|
29474
|
-
redirected_rewards: NonEmptyStringSchema.max(300).optional().meta({
|
|
29475
|
-
title: "Redirected Rewards",
|
|
29476
|
-
description: "Description of rewards redirected to community pools or other recipients",
|
|
29477
|
-
examples: [
|
|
29478
|
-
"Discounted rewards from large businesses redirected to the Community Impact Pool managed by Carrot Foundation"
|
|
29479
|
-
]
|
|
29480
|
-
}),
|
|
29481
|
-
special_circumstances: zod.z.array(NonEmptyStringSchema.max(200)).optional().meta({
|
|
29482
|
-
title: "Special Circumstances",
|
|
29483
|
-
description: "Any special circumstances affecting the distribution",
|
|
29484
|
-
examples: [
|
|
29485
|
-
"Country-specific threshold applied: Brazil Tax Authority Group I Large Business classification"
|
|
29486
|
-
]
|
|
29487
|
-
})
|
|
29488
|
-
}).meta({
|
|
29489
|
-
title: "Distribution Notes",
|
|
29490
|
-
description: "Additional notes about the reward distribution, discounts, and special circumstances"
|
|
29491
|
-
});
|
|
29492
|
-
var ParticipantRewardsSchema = zod.z.strictObject({
|
|
29493
|
-
distribution_basis: NonEmptyStringSchema.max(200).meta({
|
|
29494
|
-
title: "Distribution Basis",
|
|
29495
|
-
description: "Basis for the rewards distribution"
|
|
29496
|
-
}),
|
|
29497
|
-
reward_allocations: zod.z.array(RewardAllocationSchema).min(1).meta({
|
|
29498
|
-
title: "Reward Allocations",
|
|
29499
|
-
description: "Rewards percentage allocated to each participant"
|
|
29500
|
-
}),
|
|
29501
|
-
distribution_notes: DistributionNotesSchema.optional().meta({
|
|
29502
|
-
title: "Distribution Notes",
|
|
29503
|
-
description: "Additional notes about the reward distribution"
|
|
29504
|
-
})
|
|
29505
|
-
}).meta({
|
|
29506
|
-
title: "Participant Rewards",
|
|
29507
|
-
description: "Rewards distribution to participants"
|
|
29508
|
-
});
|
|
29509
29449
|
var SummaryBaseSchema = zod.z.strictObject({
|
|
29510
29450
|
total_certificates: PositiveIntegerSchema.meta({
|
|
29511
29451
|
title: "Total Certificates",
|
|
@@ -29560,12 +29500,6 @@ var ReceiptIdentitySchema = zod.z.strictObject({
|
|
|
29560
29500
|
title: "Identity",
|
|
29561
29501
|
description: "Participant identity information"
|
|
29562
29502
|
});
|
|
29563
|
-
var MassIDReferenceWithContractSchema = MassIDReferenceSchema.safeExtend({
|
|
29564
|
-
smart_contract_address: SmartContractAddressSchema
|
|
29565
|
-
}).meta({
|
|
29566
|
-
title: "MassID Reference with Smart Contract",
|
|
29567
|
-
description: "Reference to a MassID record with smart contract address"
|
|
29568
|
-
});
|
|
29569
29503
|
function createReceiptCollectionSchema(params) {
|
|
29570
29504
|
const { meta } = params;
|
|
29571
29505
|
return zod.z.strictObject({
|
|
@@ -29585,26 +29519,6 @@ function createReceiptCollectionSchema(params) {
|
|
|
29585
29519
|
})
|
|
29586
29520
|
}).meta(meta);
|
|
29587
29521
|
}
|
|
29588
|
-
function createReceiptCreditSchema(params) {
|
|
29589
|
-
const { meta } = params;
|
|
29590
|
-
return zod.z.strictObject({
|
|
29591
|
-
slug: CreditTokenSlugSchema,
|
|
29592
|
-
symbol: CreditTokenSymbolSchema,
|
|
29593
|
-
external_id: ExternalIdSchema.meta({
|
|
29594
|
-
title: "Credit External ID",
|
|
29595
|
-
description: "External identifier for the credit"
|
|
29596
|
-
}),
|
|
29597
|
-
external_url: ExternalUrlSchema.meta({
|
|
29598
|
-
title: "Credit External URL",
|
|
29599
|
-
description: "External URL for the credit"
|
|
29600
|
-
}),
|
|
29601
|
-
ipfs_uri: IpfsUriSchema.meta({
|
|
29602
|
-
title: "Credit IPFS URI",
|
|
29603
|
-
description: "IPFS URI for the credit details"
|
|
29604
|
-
}),
|
|
29605
|
-
smart_contract_address: SmartContractAddressSchema
|
|
29606
|
-
}).meta(meta);
|
|
29607
|
-
}
|
|
29608
29522
|
var CertificateCollectionItemPurchaseSchema = zod.z.strictObject({
|
|
29609
29523
|
slug: CollectionSlugSchema.meta({
|
|
29610
29524
|
title: "Collection Slug",
|
|
@@ -29632,37 +29546,6 @@ var CertificateCollectionItemRetirementSchema = zod.z.strictObject({
|
|
|
29632
29546
|
title: "Certificate Collection Item (Retirement)",
|
|
29633
29547
|
description: "Collection reference with retired amount for a certificate in a retirement receipt"
|
|
29634
29548
|
});
|
|
29635
|
-
var certificateBaseShape = {
|
|
29636
|
-
token_id: TokenIdSchema.meta({
|
|
29637
|
-
title: "Certificate Token ID",
|
|
29638
|
-
description: "Token ID of the certificate"
|
|
29639
|
-
}),
|
|
29640
|
-
type: CertificateTypeSchema,
|
|
29641
|
-
external_id: ExternalIdSchema.meta({
|
|
29642
|
-
title: "Certificate External ID",
|
|
29643
|
-
description: "External identifier for the certificate"
|
|
29644
|
-
}),
|
|
29645
|
-
external_url: ExternalUrlSchema.meta({
|
|
29646
|
-
title: "Certificate External URL",
|
|
29647
|
-
description: "External URL for the certificate"
|
|
29648
|
-
}),
|
|
29649
|
-
ipfs_uri: IpfsUriSchema.meta({
|
|
29650
|
-
title: "Certificate IPFS URI",
|
|
29651
|
-
description: "IPFS URI for the certificate metadata"
|
|
29652
|
-
}),
|
|
29653
|
-
smart_contract_address: SmartContractAddressSchema,
|
|
29654
|
-
total_amount: CreditAmountSchema.meta({
|
|
29655
|
-
title: "Certificate Total Amount",
|
|
29656
|
-
description: "Total credits available in this certificate"
|
|
29657
|
-
}),
|
|
29658
|
-
mass_id: MassIDReferenceWithContractSchema
|
|
29659
|
-
};
|
|
29660
|
-
function createReceiptCertificateSchema(params) {
|
|
29661
|
-
return zod.z.strictObject({
|
|
29662
|
-
...certificateBaseShape,
|
|
29663
|
-
...params.additionalShape
|
|
29664
|
-
}).meta(params.meta);
|
|
29665
|
-
}
|
|
29666
29549
|
function getSchemaBaseUrl() {
|
|
29667
29550
|
return `https://raw.githubusercontent.com/carrot-foundation/schemas/refs/tags/${getSchemaVersionOrDefault()}/schemas/ipfs`;
|
|
29668
29551
|
}
|
|
@@ -29671,7 +29554,7 @@ function buildSchemaUrl(schemaPath) {
|
|
|
29671
29554
|
return `${getSchemaBaseUrl()}/${cleanPath}`;
|
|
29672
29555
|
}
|
|
29673
29556
|
function getSchemaVersionOrDefault() {
|
|
29674
|
-
return "0.1.
|
|
29557
|
+
return "0.1.62";
|
|
29675
29558
|
}
|
|
29676
29559
|
|
|
29677
29560
|
// src/shared/schema-validation.ts
|
|
@@ -30097,6 +29980,7 @@ var MassIDAttributeWeightSchema = createWeightAttributeSchema({
|
|
|
30097
29980
|
description: "Net batch weight in kilograms (kg) for this MassID"
|
|
30098
29981
|
});
|
|
30099
29982
|
var MassIDAttributeOriginCitySchema = OriginCityAttributeSchema;
|
|
29983
|
+
var MassIDAttributeOriginCountrySubdivisionSchema = OriginCountrySubdivisionAttributeSchema;
|
|
30100
29984
|
var MassIDAttributePickUpVehicleTypeSchema = NftAttributeSchema.safeExtend({
|
|
30101
29985
|
trait_type: zod.z.literal("Pick-up Vehicle Type"),
|
|
30102
29986
|
value: VehicleTypeSchema.meta({
|
|
@@ -30181,6 +30065,7 @@ var REQUIRED_MASS_ID_ATTRIBUTES = [
|
|
|
30181
30065
|
MassIDAttributeWasteSubtypeSchema,
|
|
30182
30066
|
MassIDAttributeWeightSchema,
|
|
30183
30067
|
MassIDAttributeOriginCitySchema,
|
|
30068
|
+
MassIDAttributeOriginCountrySubdivisionSchema,
|
|
30184
30069
|
MassIDAttributePickUpVehicleTypeSchema,
|
|
30185
30070
|
MassIDAttributeRecyclingMethodSchema,
|
|
30186
30071
|
MassIDAttributePickUpDateSchema,
|
|
@@ -30205,6 +30090,7 @@ var MassIDAttributesSchema = createOrderedAttributesSchema({
|
|
|
30205
30090
|
"Waste Subtype",
|
|
30206
30091
|
"Weight (kg)",
|
|
30207
30092
|
"Origin City",
|
|
30093
|
+
"Origin Country Subdivision",
|
|
30208
30094
|
"Pick-up Vehicle Type",
|
|
30209
30095
|
"Recycling Method",
|
|
30210
30096
|
"Pick-up Date",
|
|
@@ -30240,7 +30126,7 @@ var MassIDWastePropertiesSchema = zod.z.strictObject({
|
|
|
30240
30126
|
description: "Specific subcategory of waste material"
|
|
30241
30127
|
}),
|
|
30242
30128
|
local_classification: MassIDLocalClassificationSchema.optional(),
|
|
30243
|
-
|
|
30129
|
+
weight_kg: WeightKgSchema.meta({
|
|
30244
30130
|
title: "Net Weight",
|
|
30245
30131
|
description: "Net weight of the waste batch in kilograms (kg)",
|
|
30246
30132
|
examples: [3e3]
|
|
@@ -30523,9 +30409,9 @@ var MassIDIpfsSchema = NftIpfsSchema.safeExtend({
|
|
|
30523
30409
|
ctx,
|
|
30524
30410
|
attributeByTraitType,
|
|
30525
30411
|
traitType: "Weight (kg)",
|
|
30526
|
-
expectedValue: data.waste_properties.
|
|
30527
|
-
missingMessage: "Weight (kg) attribute must be present and match waste_properties.
|
|
30528
|
-
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"
|
|
30529
30415
|
});
|
|
30530
30416
|
validateAttributeValue({
|
|
30531
30417
|
ctx,
|
|
@@ -30643,6 +30529,7 @@ var GasIDAttributeCreditTypeSchema = CreditTypeAttributeSchema;
|
|
|
30643
30529
|
var GasIDAttributeSourceWasteTypeSchema = SourceWasteTypeAttributeSchema;
|
|
30644
30530
|
var GasIDAttributeSourceWeightSchema = SourceWeightAttributeSchema;
|
|
30645
30531
|
var GasIDAttributeOriginCitySchema = OriginCityAttributeSchema;
|
|
30532
|
+
var GasIDAttributeOriginCountrySubdivisionSchema = OriginCountrySubdivisionAttributeSchema;
|
|
30646
30533
|
var GasIDAttributeMassIDTokenIdSchema = MassIDTokenIdAttributeSchema;
|
|
30647
30534
|
var GasIDAttributeMassIDRecyclingDateSchema = MassIDRecyclingDateAttributeSchema;
|
|
30648
30535
|
var GasIDAttributeCertificateIssuanceDateSchema = CertificateIssuanceDateAttributeSchema;
|
|
@@ -30655,12 +30542,13 @@ var GasIDAttributesSchema = zod.z.tuple([
|
|
|
30655
30542
|
GasIDAttributeSourceWasteTypeSchema,
|
|
30656
30543
|
GasIDAttributeSourceWeightSchema,
|
|
30657
30544
|
GasIDAttributeOriginCitySchema,
|
|
30545
|
+
GasIDAttributeOriginCountrySubdivisionSchema,
|
|
30658
30546
|
GasIDAttributeMassIDTokenIdSchema,
|
|
30659
30547
|
GasIDAttributeMassIDRecyclingDateSchema,
|
|
30660
30548
|
GasIDAttributeCertificateIssuanceDateSchema
|
|
30661
30549
|
]).meta({
|
|
30662
30550
|
title: "GasID NFT Attribute Array",
|
|
30663
|
-
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."
|
|
30664
30552
|
});
|
|
30665
30553
|
var GasIDSummarySchema = zod.z.strictObject({
|
|
30666
30554
|
gas_type: GasTypeSchema,
|
|
@@ -30735,8 +30623,7 @@ var GasIDDataSchema = zod.z.strictObject({
|
|
|
30735
30623
|
title: "Source Waste Origin Location",
|
|
30736
30624
|
description: "Location of the waste origin"
|
|
30737
30625
|
}),
|
|
30738
|
-
prevented_emissions_calculation: PreventedEmissionsCalculationSchema
|
|
30739
|
-
participant_rewards: ParticipantRewardsSchema
|
|
30626
|
+
prevented_emissions_calculation: PreventedEmissionsCalculationSchema
|
|
30740
30627
|
}).meta({
|
|
30741
30628
|
title: "GasID Data",
|
|
30742
30629
|
description: "Complete data structure for GasID certificate"
|
|
@@ -30845,9 +30732,9 @@ var GasIDIpfsSchema = NftIpfsSchema.safeExtend({
|
|
|
30845
30732
|
ctx,
|
|
30846
30733
|
attributeByTraitType,
|
|
30847
30734
|
traitType: "Source Weight (kg)",
|
|
30848
|
-
expectedValue: data.waste_properties.
|
|
30849
|
-
missingMessage: "Source Weight (kg) attribute must be present and match data.waste_properties.
|
|
30850
|
-
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"
|
|
30851
30738
|
});
|
|
30852
30739
|
validateAttributeValue({
|
|
30853
30740
|
ctx,
|
|
@@ -30903,8 +30790,8 @@ var GasIDIpfsSchema = NftIpfsSchema.safeExtend({
|
|
|
30903
30790
|
var RecycledIDAttributeMethodologySchema = MethodologyAttributeSchema;
|
|
30904
30791
|
var RecycledIDAttributeRecycledMassWeightSchema = createWeightAttributeSchema(
|
|
30905
30792
|
{
|
|
30906
|
-
traitType: "Recycled
|
|
30907
|
-
title: "Recycled
|
|
30793
|
+
traitType: "Recycled Weight (kg)",
|
|
30794
|
+
title: "Recycled Weight",
|
|
30908
30795
|
description: "Total weight of recycled materials in kilograms"
|
|
30909
30796
|
}
|
|
30910
30797
|
);
|
|
@@ -30913,6 +30800,7 @@ var RecycledIDAttributeCreditTypeSchema = CreditTypeAttributeSchema;
|
|
|
30913
30800
|
var RecycledIDAttributeSourceWasteTypeSchema = SourceWasteTypeAttributeSchema;
|
|
30914
30801
|
var RecycledIDAttributeSourceWeightSchema = SourceWeightAttributeSchema;
|
|
30915
30802
|
var RecycledIDAttributeOriginCitySchema = OriginCityAttributeSchema;
|
|
30803
|
+
var RecycledIDAttributeOriginCountrySubdivisionSchema = OriginCountrySubdivisionAttributeSchema;
|
|
30916
30804
|
var RecycledIDAttributeMassIDTokenIdSchema = MassIDTokenIdAttributeSchema;
|
|
30917
30805
|
var RecycledIDAttributeMassIDRecyclingDateSchema = MassIDRecyclingDateAttributeSchema;
|
|
30918
30806
|
var RecycledIDAttributeCertificateIssuanceDateSchema = CertificateIssuanceDateAttributeSchema;
|
|
@@ -30924,16 +30812,17 @@ var RecycledIDAttributesSchema = zod.z.tuple([
|
|
|
30924
30812
|
RecycledIDAttributeSourceWasteTypeSchema,
|
|
30925
30813
|
RecycledIDAttributeSourceWeightSchema,
|
|
30926
30814
|
RecycledIDAttributeOriginCitySchema,
|
|
30815
|
+
RecycledIDAttributeOriginCountrySubdivisionSchema,
|
|
30927
30816
|
RecycledIDAttributeMassIDTokenIdSchema,
|
|
30928
30817
|
RecycledIDAttributeMassIDRecyclingDateSchema,
|
|
30929
30818
|
RecycledIDAttributeCertificateIssuanceDateSchema
|
|
30930
30819
|
]).meta({
|
|
30931
30820
|
title: "RecycledID NFT Attribute Array",
|
|
30932
|
-
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."
|
|
30933
30822
|
});
|
|
30934
30823
|
var RecycledIDSummarySchema = zod.z.strictObject({
|
|
30935
30824
|
recycled_mass_kg: WeightKgSchema.meta({
|
|
30936
|
-
title: "Recycled
|
|
30825
|
+
title: "Recycled Weight",
|
|
30937
30826
|
description: "Total weight of materials successfully recycled in kilograms (kg)"
|
|
30938
30827
|
}),
|
|
30939
30828
|
credit_type: CreditTypeSchema,
|
|
@@ -30955,8 +30844,7 @@ var RecycledIDDataSchema = zod.z.strictObject({
|
|
|
30955
30844
|
origin_location: LocationSchema.meta({
|
|
30956
30845
|
title: "RecycledID Origin Location",
|
|
30957
30846
|
description: "Source waste origin location details"
|
|
30958
|
-
})
|
|
30959
|
-
participant_rewards: ParticipantRewardsSchema
|
|
30847
|
+
})
|
|
30960
30848
|
}).meta({
|
|
30961
30849
|
title: "RecycledID Data",
|
|
30962
30850
|
description: "Complete data structure for RecycledID certificate"
|
|
@@ -31023,11 +30911,11 @@ var RecycledIDIpfsSchema = NftIpfsSchema.safeExtend({
|
|
|
31023
30911
|
validateNumericAttributeValue({
|
|
31024
30912
|
ctx,
|
|
31025
30913
|
attributeByTraitType,
|
|
31026
|
-
traitType: "Recycled
|
|
30914
|
+
traitType: "Recycled Weight (kg)",
|
|
31027
30915
|
expectedValue: data.summary.recycled_mass_kg,
|
|
31028
30916
|
epsilon: 0.01,
|
|
31029
|
-
missingMessage: "Recycled
|
|
31030
|
-
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"
|
|
31031
30919
|
});
|
|
31032
30920
|
validateAttributeValue({
|
|
31033
30921
|
ctx,
|
|
@@ -31057,9 +30945,9 @@ var RecycledIDIpfsSchema = NftIpfsSchema.safeExtend({
|
|
|
31057
30945
|
ctx,
|
|
31058
30946
|
attributeByTraitType,
|
|
31059
30947
|
traitType: "Source Weight (kg)",
|
|
31060
|
-
expectedValue: data.waste_properties.
|
|
31061
|
-
missingMessage: "Source Weight (kg) attribute must be present and match data.waste_properties.
|
|
31062
|
-
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"
|
|
31063
30951
|
});
|
|
31064
30952
|
validateAttributeValue({
|
|
31065
30953
|
ctx,
|
|
@@ -31210,70 +31098,27 @@ var CreditPurchaseReceiptCollectionSchema = createReceiptCollectionSchema({
|
|
|
31210
31098
|
description: "Collection included in the purchase"
|
|
31211
31099
|
}
|
|
31212
31100
|
});
|
|
31213
|
-
var CreditPurchaseReceiptCreditSchema =
|
|
31214
|
-
|
|
31215
|
-
|
|
31216
|
-
description: "Credit token included in the purchase"
|
|
31217
|
-
}
|
|
31101
|
+
var CreditPurchaseReceiptCreditSchema = CreditReferenceSchema.meta({
|
|
31102
|
+
title: "Credit",
|
|
31103
|
+
description: "Credit token included in the purchase"
|
|
31218
31104
|
});
|
|
31219
|
-
var CreditPurchaseReceiptCertificateSchema =
|
|
31220
|
-
|
|
31221
|
-
|
|
31222
|
-
description: "Slug of the credit type for this certificate"
|
|
31223
|
-
}),
|
|
31224
|
-
collections: uniqueBy(
|
|
31225
|
-
CertificateCollectionItemPurchaseSchema,
|
|
31226
|
-
(item) => item.slug,
|
|
31227
|
-
"Collection slugs within certificate collections must be unique"
|
|
31228
|
-
).min(1).meta({
|
|
31229
|
-
title: "Certificate Collections",
|
|
31230
|
-
description: "Collections associated with this certificate, each with purchased and retired amounts"
|
|
31231
|
-
})
|
|
31232
|
-
},
|
|
31233
|
-
meta: {
|
|
31234
|
-
title: "Certificate",
|
|
31235
|
-
description: "Certificate associated with the purchase"
|
|
31236
|
-
}
|
|
31237
|
-
});
|
|
31238
|
-
var CreditPurchaseReceiptParticipantRewardSchema = zod.z.strictObject({
|
|
31239
|
-
participant_id_hash: ParticipantIdHashSchema,
|
|
31240
|
-
roles: uniqueArrayItems(
|
|
31241
|
-
ParticipantRoleSchema,
|
|
31242
|
-
"Participant roles must be unique"
|
|
31243
|
-
).min(1).meta({
|
|
31244
|
-
title: "Participant Roles",
|
|
31245
|
-
description: "Roles the participant has in the supply chain"
|
|
31105
|
+
var CreditPurchaseReceiptCertificateSchema = CertificateReferenceBaseSchema.safeExtend({
|
|
31106
|
+
credit_slug: CreditTokenSlugSchema.meta({
|
|
31107
|
+
description: "Slug of the credit type for this certificate"
|
|
31246
31108
|
}),
|
|
31247
|
-
|
|
31248
|
-
|
|
31249
|
-
|
|
31109
|
+
collections: uniqueBy(
|
|
31110
|
+
CertificateCollectionItemPurchaseSchema,
|
|
31111
|
+
(item) => item.slug,
|
|
31112
|
+
"Collection slugs within certificate collections must be unique"
|
|
31113
|
+
).min(1).meta({
|
|
31114
|
+
title: "Certificate Collections",
|
|
31115
|
+
description: "Collections associated with this certificate, each with purchased and retired amounts"
|
|
31250
31116
|
})
|
|
31251
31117
|
}).meta({
|
|
31252
|
-
title: "
|
|
31253
|
-
description: "
|
|
31254
|
-
});
|
|
31255
|
-
var CreditPurchaseReceiptRetirementReceiptSchema = zod.z.strictObject({
|
|
31256
|
-
token_id: TokenIdSchema.meta({
|
|
31257
|
-
title: "Retirement Receipt Token ID",
|
|
31258
|
-
description: "Token ID of the retirement receipt NFT"
|
|
31259
|
-
}),
|
|
31260
|
-
external_id: ExternalIdSchema.meta({
|
|
31261
|
-
title: "Retirement Receipt External ID",
|
|
31262
|
-
description: "External identifier for the retirement receipt"
|
|
31263
|
-
}),
|
|
31264
|
-
external_url: ExternalUrlSchema.meta({
|
|
31265
|
-
title: "Retirement Receipt External URL",
|
|
31266
|
-
description: "External URL for the retirement receipt"
|
|
31267
|
-
}),
|
|
31268
|
-
ipfs_uri: IpfsUriSchema.meta({
|
|
31269
|
-
title: "Retirement Receipt IPFS URI",
|
|
31270
|
-
description: "IPFS URI for the retirement receipt metadata"
|
|
31271
|
-
}),
|
|
31272
|
-
smart_contract_address: SmartContractAddressSchema
|
|
31273
|
-
}).meta({
|
|
31274
|
-
title: "Retirement Receipt Reference",
|
|
31275
|
-
description: "Reference to the retirement receipt NFT"
|
|
31118
|
+
title: "Certificate",
|
|
31119
|
+
description: "Certificate associated with the purchase"
|
|
31276
31120
|
});
|
|
31121
|
+
var CreditPurchaseReceiptRetirementReceiptSchema = CreditRetirementReceiptReferenceSchema;
|
|
31277
31122
|
var CreditPurchaseReceiptDataSchema = zod.z.strictObject({
|
|
31278
31123
|
summary: CreditPurchaseReceiptSummarySchema,
|
|
31279
31124
|
buyer: CreditPurchaseReceiptBuyerSchema,
|
|
@@ -31301,14 +31146,6 @@ var CreditPurchaseReceiptDataSchema = zod.z.strictObject({
|
|
|
31301
31146
|
title: "Certificates",
|
|
31302
31147
|
description: "Certificates involved in the purchase"
|
|
31303
31148
|
}),
|
|
31304
|
-
participant_rewards: uniqueBy(
|
|
31305
|
-
CreditPurchaseReceiptParticipantRewardSchema,
|
|
31306
|
-
(reward) => reward.participant_id_hash,
|
|
31307
|
-
"Participant participant_id_hash must be unique"
|
|
31308
|
-
).min(1).meta({
|
|
31309
|
-
title: "Participant Rewards",
|
|
31310
|
-
description: "Rewards distributed to participants in the supply chain for this purchase"
|
|
31311
|
-
}),
|
|
31312
31149
|
retirement_receipt: CreditPurchaseReceiptRetirementReceiptSchema.optional()
|
|
31313
31150
|
}).superRefine((data, ctx) => {
|
|
31314
31151
|
validateCountMatches({
|
|
@@ -31401,17 +31238,6 @@ var CreditPurchaseReceiptDataSchema = zod.z.strictObject({
|
|
|
31401
31238
|
hasRetirementReceipt: !!data.retirement_receipt,
|
|
31402
31239
|
totalRetiredAmount: certificateCollectionRetiredTotal
|
|
31403
31240
|
});
|
|
31404
|
-
const participantRewardTotal = data.participant_rewards.reduce(
|
|
31405
|
-
(sum, reward) => sum + Number(reward.usdc_amount),
|
|
31406
|
-
0
|
|
31407
|
-
);
|
|
31408
|
-
validateTotalMatches({
|
|
31409
|
-
ctx,
|
|
31410
|
-
actualTotal: participantRewardTotal,
|
|
31411
|
-
expectedTotal: data.summary.total_amount_usdc,
|
|
31412
|
-
path: ["summary", "total_amount_usdc"],
|
|
31413
|
-
message: "summary.total_amount_usdc must equal sum of participant_rewards.usdc_amount"
|
|
31414
|
-
});
|
|
31415
31241
|
}).meta({
|
|
31416
31242
|
title: "Credit Purchase Receipt Data",
|
|
31417
31243
|
description: "Complete data structure for a credit purchase receipt"
|
|
@@ -31698,11 +31524,9 @@ var CreditRetirementReceiptCollectionSchema = createReceiptCollectionSchema({
|
|
|
31698
31524
|
description: "Collection included in the retirement"
|
|
31699
31525
|
}
|
|
31700
31526
|
});
|
|
31701
|
-
var CreditRetirementReceiptCreditSchema =
|
|
31702
|
-
|
|
31703
|
-
|
|
31704
|
-
description: "Credit token retired in this receipt"
|
|
31705
|
-
}
|
|
31527
|
+
var CreditRetirementReceiptCreditSchema = CreditReferenceSchema.meta({
|
|
31528
|
+
title: "Credit",
|
|
31529
|
+
description: "Credit token retired in this receipt"
|
|
31706
31530
|
});
|
|
31707
31531
|
var CreditRetirementReceiptCertificateCreditSchema = zod.z.strictObject({
|
|
31708
31532
|
credit_symbol: CreditTokenSymbolSchema.meta({
|
|
@@ -31727,54 +31551,27 @@ var CreditRetirementReceiptCertificateCreditSchema = zod.z.strictObject({
|
|
|
31727
31551
|
title: "Certificate Credit Retirement",
|
|
31728
31552
|
description: "Credit retirement breakdown for a certificate"
|
|
31729
31553
|
});
|
|
31730
|
-
var
|
|
31731
|
-
|
|
31732
|
-
|
|
31733
|
-
|
|
31734
|
-
|
|
31735
|
-
|
|
31736
|
-
title: "
|
|
31737
|
-
description: "
|
|
31738
|
-
}),
|
|
31739
|
-
external_url: ExternalUrlSchema.meta({
|
|
31740
|
-
title: "Purchase Receipt External URL",
|
|
31741
|
-
description: "External URL for the purchase receipt"
|
|
31742
|
-
}),
|
|
31743
|
-
ipfs_uri: IpfsUriSchema.meta({
|
|
31744
|
-
title: "Purchase Receipt IPFS URI",
|
|
31745
|
-
description: "IPFS URI for the purchase receipt metadata"
|
|
31554
|
+
var CreditRetirementReceiptCertificateSchema = CertificateReferenceBaseSchema.safeExtend({
|
|
31555
|
+
collections: uniqueBy(
|
|
31556
|
+
CertificateCollectionItemRetirementSchema,
|
|
31557
|
+
(item) => item.slug,
|
|
31558
|
+
"Collection slugs within certificate collections must be unique"
|
|
31559
|
+
).min(1).meta({
|
|
31560
|
+
title: "Certificate Collections",
|
|
31561
|
+
description: "Collections associated with this certificate, each with retired amounts"
|
|
31746
31562
|
}),
|
|
31747
|
-
|
|
31563
|
+
credits_retired: uniqueBy(
|
|
31564
|
+
CreditRetirementReceiptCertificateCreditSchema,
|
|
31565
|
+
(credit) => credit.credit_symbol,
|
|
31566
|
+
"Credit symbols within credits_retired must be unique"
|
|
31567
|
+
).min(1).meta({
|
|
31568
|
+
title: "Credits Retired",
|
|
31569
|
+
description: "Breakdown of credits retired from this certificate by symbol"
|
|
31570
|
+
})
|
|
31748
31571
|
}).meta({
|
|
31749
|
-
title: "
|
|
31750
|
-
description: "
|
|
31572
|
+
title: "Certificate",
|
|
31573
|
+
description: "Certificate associated with the retirement"
|
|
31751
31574
|
});
|
|
31752
|
-
var CreditRetirementReceiptCertificateSchema = createReceiptCertificateSchema(
|
|
31753
|
-
{
|
|
31754
|
-
additionalShape: {
|
|
31755
|
-
collections: uniqueBy(
|
|
31756
|
-
CertificateCollectionItemRetirementSchema,
|
|
31757
|
-
(item) => item.slug,
|
|
31758
|
-
"Collection slugs within certificate collections must be unique"
|
|
31759
|
-
).min(1).meta({
|
|
31760
|
-
title: "Certificate Collections",
|
|
31761
|
-
description: "Collections associated with this certificate, each with retired amounts"
|
|
31762
|
-
}),
|
|
31763
|
-
credits_retired: uniqueBy(
|
|
31764
|
-
CreditRetirementReceiptCertificateCreditSchema,
|
|
31765
|
-
(credit) => credit.credit_symbol,
|
|
31766
|
-
"Credit symbols within credits_retired must be unique"
|
|
31767
|
-
).min(1).meta({
|
|
31768
|
-
title: "Credits Retired",
|
|
31769
|
-
description: "Breakdown of credits retired from this certificate by symbol"
|
|
31770
|
-
})
|
|
31771
|
-
},
|
|
31772
|
-
meta: {
|
|
31773
|
-
title: "Certificate",
|
|
31774
|
-
description: "Certificate associated with the retirement"
|
|
31775
|
-
}
|
|
31776
|
-
}
|
|
31777
|
-
);
|
|
31778
31575
|
var CreditRetirementReceiptDataSchema = zod.z.strictObject({
|
|
31779
31576
|
summary: CreditRetirementReceiptSummarySchema,
|
|
31780
31577
|
beneficiary: CreditRetirementReceiptBeneficiarySchema,
|
|
@@ -31924,9 +31721,6 @@ var CreditRetirementReceiptDataSchema = zod.z.strictObject({
|
|
|
31924
31721
|
title: "Credit Retirement Receipt Data",
|
|
31925
31722
|
description: "Complete data structure for a credit retirement receipt"
|
|
31926
31723
|
});
|
|
31927
|
-
var CreditRetirementReceiptIpfsSchemaBase = NftIpfsSchema.omit({
|
|
31928
|
-
full_content_hash: true
|
|
31929
|
-
});
|
|
31930
31724
|
var CreditRetirementReceiptIpfsSchemaMeta = {
|
|
31931
31725
|
title: "CreditRetirementReceipt NFT IPFS Record",
|
|
31932
31726
|
description: "Complete CreditRetirementReceipt NFT IPFS record including attributes and credit retirement data",
|
|
@@ -31935,8 +31729,8 @@ var CreditRetirementReceiptIpfsSchemaMeta = {
|
|
|
31935
31729
|
),
|
|
31936
31730
|
version: getSchemaVersionOrDefault()
|
|
31937
31731
|
};
|
|
31938
|
-
var CreditRetirementReceiptIpfsSchema =
|
|
31939
|
-
schema:
|
|
31732
|
+
var CreditRetirementReceiptIpfsSchema = NftIpfsSchema.safeExtend({
|
|
31733
|
+
schema: NftIpfsSchema.shape.schema.safeExtend({
|
|
31940
31734
|
type: zod.z.literal("CreditRetirementReceipt").meta({
|
|
31941
31735
|
title: "CreditRetirementReceipt Schema Type",
|
|
31942
31736
|
description: "Schema type identifier for this record"
|
|
@@ -32235,12 +32029,40 @@ var MassIDAuditSummarySchema = zod.z.strictObject({
|
|
|
32235
32029
|
var MassIDAuditDataSchema = zod.z.strictObject({
|
|
32236
32030
|
methodology: MethodologyReferenceSchema,
|
|
32237
32031
|
mass_id: MassIDReferenceSchema,
|
|
32238
|
-
gas_id: GasIDReferenceSchema,
|
|
32032
|
+
gas_id: GasIDReferenceSchema.optional(),
|
|
32033
|
+
recycled_id: RecycledIDReferenceSchema.optional(),
|
|
32239
32034
|
audit_summary: MassIDAuditSummarySchema,
|
|
32240
32035
|
rule_execution_results: AuditRuleExecutionResultsSchema
|
|
32036
|
+
}).superRefine((data, ctx) => {
|
|
32037
|
+
const hasGasId = !!data.gas_id;
|
|
32038
|
+
const hasRecycledId = !!data.recycled_id;
|
|
32039
|
+
if (!hasGasId && !hasRecycledId) {
|
|
32040
|
+
ctx.addIssue({
|
|
32041
|
+
code: "custom",
|
|
32042
|
+
path: ["gas_id"],
|
|
32043
|
+
message: "Either gas_id or recycled_id must be provided"
|
|
32044
|
+
});
|
|
32045
|
+
ctx.addIssue({
|
|
32046
|
+
code: "custom",
|
|
32047
|
+
path: ["recycled_id"],
|
|
32048
|
+
message: "Either gas_id or recycled_id must be provided"
|
|
32049
|
+
});
|
|
32050
|
+
}
|
|
32051
|
+
if (hasGasId && hasRecycledId) {
|
|
32052
|
+
ctx.addIssue({
|
|
32053
|
+
code: "custom",
|
|
32054
|
+
path: ["gas_id"],
|
|
32055
|
+
message: "gas_id and recycled_id are mutually exclusive"
|
|
32056
|
+
});
|
|
32057
|
+
ctx.addIssue({
|
|
32058
|
+
code: "custom",
|
|
32059
|
+
path: ["recycled_id"],
|
|
32060
|
+
message: "gas_id and recycled_id are mutually exclusive"
|
|
32061
|
+
});
|
|
32062
|
+
}
|
|
32241
32063
|
}).meta({
|
|
32242
32064
|
title: "MassID Audit Data",
|
|
32243
|
-
description: "Complete data structure for MassID Audit records"
|
|
32065
|
+
description: "Complete data structure for MassID Audit records. Must include exactly one of gas_id or recycled_id."
|
|
32244
32066
|
});
|
|
32245
32067
|
|
|
32246
32068
|
// src/mass-id-audit/mass-id-audit.schema.ts
|
|
@@ -32279,6 +32101,7 @@ exports.BlockchainNetworkNameSchema = BlockchainNetworkNameSchema;
|
|
|
32279
32101
|
exports.CertificateCollectionItemPurchaseSchema = CertificateCollectionItemPurchaseSchema;
|
|
32280
32102
|
exports.CertificateCollectionItemRetirementSchema = CertificateCollectionItemRetirementSchema;
|
|
32281
32103
|
exports.CertificateIssuanceDateAttributeSchema = CertificateIssuanceDateAttributeSchema;
|
|
32104
|
+
exports.CertificateReferenceBaseSchema = CertificateReferenceBaseSchema;
|
|
32282
32105
|
exports.CertificateTypeSchema = CertificateTypeSchema;
|
|
32283
32106
|
exports.CitySchema = CitySchema;
|
|
32284
32107
|
exports.CollectionNameSchema = CollectionNameSchema;
|
|
@@ -32294,13 +32117,16 @@ exports.CreditPurchaseReceiptDataSchema = CreditPurchaseReceiptDataSchema;
|
|
|
32294
32117
|
exports.CreditPurchaseReceiptIpfsSchema = CreditPurchaseReceiptIpfsSchema;
|
|
32295
32118
|
exports.CreditPurchaseReceiptIpfsSchemaMeta = CreditPurchaseReceiptIpfsSchemaMeta;
|
|
32296
32119
|
exports.CreditPurchaseReceiptNameSchema = CreditPurchaseReceiptNameSchema;
|
|
32120
|
+
exports.CreditPurchaseReceiptReferenceSchema = CreditPurchaseReceiptReferenceSchema;
|
|
32297
32121
|
exports.CreditPurchaseReceiptShortNameSchema = CreditPurchaseReceiptShortNameSchema;
|
|
32298
32122
|
exports.CreditPurchaseReceiptSummarySchema = CreditPurchaseReceiptSummarySchema;
|
|
32123
|
+
exports.CreditReferenceSchema = CreditReferenceSchema;
|
|
32299
32124
|
exports.CreditRetirementReceiptAttributesSchema = CreditRetirementReceiptAttributesSchema;
|
|
32300
32125
|
exports.CreditRetirementReceiptDataSchema = CreditRetirementReceiptDataSchema;
|
|
32301
32126
|
exports.CreditRetirementReceiptIpfsSchema = CreditRetirementReceiptIpfsSchema;
|
|
32302
32127
|
exports.CreditRetirementReceiptIpfsSchemaMeta = CreditRetirementReceiptIpfsSchemaMeta;
|
|
32303
32128
|
exports.CreditRetirementReceiptNameSchema = CreditRetirementReceiptNameSchema;
|
|
32129
|
+
exports.CreditRetirementReceiptReferenceSchema = CreditRetirementReceiptReferenceSchema;
|
|
32304
32130
|
exports.CreditRetirementReceiptShortNameSchema = CreditRetirementReceiptShortNameSchema;
|
|
32305
32131
|
exports.CreditRetirementReceiptSummarySchema = CreditRetirementReceiptSummarySchema;
|
|
32306
32132
|
exports.CreditSchema = CreditSchema;
|
|
@@ -32310,7 +32136,6 @@ exports.CreditTokenSlugSchema = CreditTokenSlugSchema;
|
|
|
32310
32136
|
exports.CreditTokenSymbolSchema = CreditTokenSymbolSchema;
|
|
32311
32137
|
exports.CreditTypeAttributeSchema = CreditTypeAttributeSchema;
|
|
32312
32138
|
exports.CreditTypeSchema = CreditTypeSchema;
|
|
32313
|
-
exports.DistributionNotesSchema = DistributionNotesSchema;
|
|
32314
32139
|
exports.EPSILON = EPSILON;
|
|
32315
32140
|
exports.EnsDomainSchema = EnsDomainSchema;
|
|
32316
32141
|
exports.EthereumAddressSchema = EthereumAddressSchema;
|
|
@@ -32347,7 +32172,6 @@ exports.MassIDIpfsSchemaMeta = MassIDIpfsSchemaMeta;
|
|
|
32347
32172
|
exports.MassIDNameSchema = MassIDNameSchema;
|
|
32348
32173
|
exports.MassIDRecyclingDateAttributeSchema = MassIDRecyclingDateAttributeSchema;
|
|
32349
32174
|
exports.MassIDReferenceSchema = MassIDReferenceSchema;
|
|
32350
|
-
exports.MassIDReferenceWithContractSchema = MassIDReferenceWithContractSchema;
|
|
32351
32175
|
exports.MassIDShortNameSchema = MassIDShortNameSchema;
|
|
32352
32176
|
exports.MassIDTokenIdAttributeSchema = MassIDTokenIdAttributeSchema;
|
|
32353
32177
|
exports.MethodologyAttributeSchema = MethodologyAttributeSchema;
|
|
@@ -32360,12 +32184,13 @@ exports.MethodologyShortNameSchema = MethodologyShortNameSchema;
|
|
|
32360
32184
|
exports.MethodologySlugSchema = MethodologySlugSchema;
|
|
32361
32185
|
exports.NftAttributeSchema = NftAttributeSchema;
|
|
32362
32186
|
exports.NftIpfsSchema = NftIpfsSchema;
|
|
32187
|
+
exports.NftTokenReferenceBaseSchema = NftTokenReferenceBaseSchema;
|
|
32363
32188
|
exports.NonEmptyStringSchema = NonEmptyStringSchema;
|
|
32364
32189
|
exports.NonNegativeFloatSchema = NonNegativeFloatSchema;
|
|
32365
32190
|
exports.NonNegativeIntegerSchema = NonNegativeIntegerSchema;
|
|
32366
32191
|
exports.OriginCityAttributeSchema = OriginCityAttributeSchema;
|
|
32192
|
+
exports.OriginCountrySubdivisionAttributeSchema = OriginCountrySubdivisionAttributeSchema;
|
|
32367
32193
|
exports.ParticipantIdHashSchema = ParticipantIdHashSchema;
|
|
32368
|
-
exports.ParticipantRewardsSchema = ParticipantRewardsSchema;
|
|
32369
32194
|
exports.ParticipantRoleSchema = ParticipantRoleSchema;
|
|
32370
32195
|
exports.ParticipantSchema = ParticipantSchema;
|
|
32371
32196
|
exports.PercentageSchema = PercentageSchema;
|
|
@@ -32378,10 +32203,8 @@ exports.RecycledIDDataSchema = RecycledIDDataSchema;
|
|
|
32378
32203
|
exports.RecycledIDIpfsSchema = RecycledIDIpfsSchema;
|
|
32379
32204
|
exports.RecycledIDIpfsSchemaMeta = RecycledIDIpfsSchemaMeta;
|
|
32380
32205
|
exports.RecycledIDNameSchema = RecycledIDNameSchema;
|
|
32206
|
+
exports.RecycledIDReferenceSchema = RecycledIDReferenceSchema;
|
|
32381
32207
|
exports.RecycledIDShortNameSchema = RecycledIDShortNameSchema;
|
|
32382
|
-
exports.RewardAllocationSchema = RewardAllocationSchema;
|
|
32383
|
-
exports.RewardDiscountSchema = RewardDiscountSchema;
|
|
32384
|
-
exports.RewardDiscountTypeSchema = RewardDiscountTypeSchema;
|
|
32385
32208
|
exports.ScaleTypeSchema = ScaleTypeSchema;
|
|
32386
32209
|
exports.SchemaInfoSchema = SchemaInfoSchema;
|
|
32387
32210
|
exports.SemanticVersionSchema = SemanticVersionSchema;
|
|
@@ -32393,6 +32216,7 @@ exports.SourceWasteTypeAttributeSchema = SourceWasteTypeAttributeSchema;
|
|
|
32393
32216
|
exports.SourceWeightAttributeSchema = SourceWeightAttributeSchema;
|
|
32394
32217
|
exports.StringifiedTokenIdSchema = StringifiedTokenIdSchema;
|
|
32395
32218
|
exports.TokenIdSchema = TokenIdSchema;
|
|
32219
|
+
exports.TokenReferenceBaseSchema = TokenReferenceBaseSchema;
|
|
32396
32220
|
exports.UnixTimestampSchema = UnixTimestampSchema;
|
|
32397
32221
|
exports.UsdcAmountSchema = UsdcAmountSchema;
|
|
32398
32222
|
exports.UuidSchema = UuidSchema;
|
|
@@ -32417,9 +32241,7 @@ exports.createMassIDNameSchema = createMassIDNameSchema;
|
|
|
32417
32241
|
exports.createMassIDShortNameSchema = createMassIDShortNameSchema;
|
|
32418
32242
|
exports.createNumericAttributeSchema = createNumericAttributeSchema;
|
|
32419
32243
|
exports.createOrderedAttributesSchema = createOrderedAttributesSchema;
|
|
32420
|
-
exports.createReceiptCertificateSchema = createReceiptCertificateSchema;
|
|
32421
32244
|
exports.createReceiptCollectionSchema = createReceiptCollectionSchema;
|
|
32422
|
-
exports.createReceiptCreditSchema = createReceiptCreditSchema;
|
|
32423
32245
|
exports.createRecycledIDNameSchema = createRecycledIDNameSchema;
|
|
32424
32246
|
exports.createRecycledIDShortNameSchema = createRecycledIDShortNameSchema;
|
|
32425
32247
|
exports.createWeightAttributeSchema = createWeightAttributeSchema;
|