@carrot-foundation/schemas 0.1.59 → 0.1.61
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 +732 -486
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +221 -144
- package/dist/index.d.ts +221 -144
- package/dist/index.js +722 -484
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/schemas/ipfs/collection/collection.example.json +4 -5
- package/schemas/ipfs/collection/collection.schema.json +9 -20
- package/schemas/ipfs/credit/credit.example.json +4 -5
- package/schemas/ipfs/credit/credit.schema.json +9 -20
- package/schemas/ipfs/credit-purchase-receipt/credit-purchase-receipt.example.json +6 -6
- package/schemas/ipfs/credit-purchase-receipt/credit-purchase-receipt.schema.json +127 -128
- package/schemas/ipfs/credit-retirement-receipt/credit-retirement-receipt.example.json +7 -6
- package/schemas/ipfs/credit-retirement-receipt/credit-retirement-receipt.schema.json +126 -117
- package/schemas/ipfs/gas-id/gas-id.example.json +9 -8
- package/schemas/ipfs/gas-id/gas-id.schema.json +48 -39
- package/schemas/ipfs/mass-id/mass-id.example.json +6 -6
- package/schemas/ipfs/mass-id/mass-id.schema.json +19 -20
- package/schemas/ipfs/mass-id-audit/mass-id-audit.example.json +18 -8
- package/schemas/ipfs/mass-id-audit/mass-id-audit.schema.json +138 -51
- package/schemas/ipfs/methodology/methodology.example.json +5 -6
- package/schemas/ipfs/methodology/methodology.schema.json +9 -20
- package/schemas/ipfs/recycled-id/recycled-id.example.json +8 -7
- package/schemas/ipfs/recycled-id/recycled-id.schema.json +48 -39
- package/schemas/schema-hashes.json +10 -10
package/dist/index.cjs
CHANGED
|
@@ -28409,9 +28409,9 @@ var RecordEnvironmentSchema = zod.z.strictObject({
|
|
|
28409
28409
|
description: "Environment information for the record"
|
|
28410
28410
|
});
|
|
28411
28411
|
var ViewerReferenceSchema = zod.z.strictObject({
|
|
28412
|
-
|
|
28413
|
-
title: "Viewer IPFS
|
|
28414
|
-
description: "IPFS
|
|
28412
|
+
ipfs_uri: IpfsUriSchema.meta({
|
|
28413
|
+
title: "Viewer IPFS URI",
|
|
28414
|
+
description: "IPFS URI of the metadata viewer dApp build"
|
|
28415
28415
|
}),
|
|
28416
28416
|
integrity_hash: Sha256HashSchema.meta({
|
|
28417
28417
|
title: "Viewer Integrity Hash",
|
|
@@ -28434,10 +28434,6 @@ var BaseIpfsSchema = zod.z.strictObject({
|
|
|
28434
28434
|
}),
|
|
28435
28435
|
external_id: ExternalIdSchema,
|
|
28436
28436
|
external_url: ExternalUrlSchema,
|
|
28437
|
-
original_content_hash: Sha256HashSchema.meta({
|
|
28438
|
-
title: "Original Content Hash",
|
|
28439
|
-
description: "SHA-256 hash of the original JSON content including private data before schema validation"
|
|
28440
|
-
}),
|
|
28441
28437
|
content_hash: Sha256HashSchema.meta({
|
|
28442
28438
|
title: "Content Hash",
|
|
28443
28439
|
description: "SHA-256 hash of RFC 8785 canonicalized JSON after schema validation"
|
|
@@ -28552,6 +28548,10 @@ var NftIpfsSchema = BaseIpfsSchema.safeExtend({
|
|
|
28552
28548
|
description: "Type/category of this NFT schema"
|
|
28553
28549
|
})
|
|
28554
28550
|
}),
|
|
28551
|
+
full_content_hash: Sha256HashSchema.meta({
|
|
28552
|
+
title: "Full Content Hash",
|
|
28553
|
+
description: "SHA-256 hash of the original JSON content including private data before schema validation"
|
|
28554
|
+
}),
|
|
28555
28555
|
viewer_reference: ViewerReferenceSchema,
|
|
28556
28556
|
environment: RecordEnvironmentSchema,
|
|
28557
28557
|
blockchain: BlockchainReferenceSchema,
|
|
@@ -29107,48 +29107,55 @@ var AuditReferenceSchema = zod.z.strictObject({
|
|
|
29107
29107
|
title: "Audit Reference",
|
|
29108
29108
|
description: "Reference to an audit record"
|
|
29109
29109
|
});
|
|
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
|
-
})
|
|
29110
|
+
var TokenReferenceBaseSchema = zod.z.strictObject({
|
|
29111
|
+
external_id: ExternalIdSchema,
|
|
29112
|
+
external_url: ExternalUrlSchema,
|
|
29113
|
+
ipfs_uri: IpfsUriSchema,
|
|
29114
|
+
smart_contract_address: SmartContractAddressSchema
|
|
29127
29115
|
}).meta({
|
|
29128
|
-
title: "
|
|
29129
|
-
description: "
|
|
29116
|
+
title: "Token Reference",
|
|
29117
|
+
description: "Base schema for all token references"
|
|
29130
29118
|
});
|
|
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
|
-
})
|
|
29119
|
+
var NftTokenReferenceBaseSchema = TokenReferenceBaseSchema.safeExtend({
|
|
29120
|
+
token_id: TokenIdSchema
|
|
29148
29121
|
}).meta({
|
|
29122
|
+
title: "NFT Token Reference",
|
|
29123
|
+
description: "Base schema for NFT token references"
|
|
29124
|
+
});
|
|
29125
|
+
|
|
29126
|
+
// src/shared/schemas/references/mass-id-reference.schema.ts
|
|
29127
|
+
var MassIDReferenceSchema = NftTokenReferenceBaseSchema.meta({
|
|
29149
29128
|
title: "MassID Reference",
|
|
29150
29129
|
description: "Reference to a MassID record"
|
|
29151
29130
|
});
|
|
29131
|
+
|
|
29132
|
+
// src/shared/schemas/references/certificate-reference.schema.ts
|
|
29133
|
+
var CertificateReferenceBaseSchema = NftTokenReferenceBaseSchema.safeExtend({
|
|
29134
|
+
type: CertificateTypeSchema,
|
|
29135
|
+
total_amount: CreditAmountSchema.meta({
|
|
29136
|
+
title: "Certificate Total Amount",
|
|
29137
|
+
description: "Total credits available in this certificate"
|
|
29138
|
+
}),
|
|
29139
|
+
mass_id: MassIDReferenceSchema
|
|
29140
|
+
}).meta({
|
|
29141
|
+
title: "Certificate Reference Base",
|
|
29142
|
+
description: "Base schema for certificate references"
|
|
29143
|
+
});
|
|
29144
|
+
|
|
29145
|
+
// src/shared/schemas/references/credit-reference.schema.ts
|
|
29146
|
+
var CreditReferenceSchema = TokenReferenceBaseSchema.safeExtend({
|
|
29147
|
+
slug: CreditTokenSlugSchema,
|
|
29148
|
+
symbol: CreditTokenSymbolSchema
|
|
29149
|
+
}).meta({
|
|
29150
|
+
title: "Credit Reference",
|
|
29151
|
+
description: "Reference to an ERC20 credit token"
|
|
29152
|
+
});
|
|
29153
|
+
|
|
29154
|
+
// src/shared/schemas/references/gas-id-reference.schema.ts
|
|
29155
|
+
var GasIDReferenceSchema = NftTokenReferenceBaseSchema.meta({
|
|
29156
|
+
title: "GasID Reference",
|
|
29157
|
+
description: "Reference to a GasID record"
|
|
29158
|
+
});
|
|
29152
29159
|
var MethodologyReferenceSchema = zod.z.strictObject({
|
|
29153
29160
|
external_id: ExternalIdSchema.meta({
|
|
29154
29161
|
title: "Methodology External ID",
|
|
@@ -29172,6 +29179,22 @@ var MethodologyReferenceSchema = zod.z.strictObject({
|
|
|
29172
29179
|
description: "Reference to a methodology record"
|
|
29173
29180
|
});
|
|
29174
29181
|
|
|
29182
|
+
// src/shared/schemas/references/receipt-reference.schema.ts
|
|
29183
|
+
var CreditPurchaseReceiptReferenceSchema = NftTokenReferenceBaseSchema.meta({
|
|
29184
|
+
title: "Credit Purchase Receipt Reference",
|
|
29185
|
+
description: "Reference to the credit purchase receipt when retirement occurs during purchase"
|
|
29186
|
+
});
|
|
29187
|
+
var CreditRetirementReceiptReferenceSchema = NftTokenReferenceBaseSchema.meta({
|
|
29188
|
+
title: "Credit Retirement Receipt Reference",
|
|
29189
|
+
description: "Reference to the retirement receipt NFT"
|
|
29190
|
+
});
|
|
29191
|
+
|
|
29192
|
+
// src/shared/schemas/references/recycled-id-reference.schema.ts
|
|
29193
|
+
var RecycledIDReferenceSchema = NftTokenReferenceBaseSchema.meta({
|
|
29194
|
+
title: "RecycledID Reference",
|
|
29195
|
+
description: "Reference to a RecycledID record"
|
|
29196
|
+
});
|
|
29197
|
+
|
|
29175
29198
|
// src/shared/schemas/audit.schema.ts
|
|
29176
29199
|
var AuditRuleDefinitionSchema = zod.z.strictObject({
|
|
29177
29200
|
id: UuidSchema.meta({
|
|
@@ -29306,6 +29329,16 @@ var AuditRuleExecutionResultSchema = zod.z.strictObject({
|
|
|
29306
29329
|
title: "Rule Execution Result",
|
|
29307
29330
|
description: "Result of the rule execution"
|
|
29308
29331
|
}),
|
|
29332
|
+
execution_message: NonEmptyStringSchema.max(2e3).optional().meta({
|
|
29333
|
+
title: "Execution Message",
|
|
29334
|
+
description: "Human-readable message explaining the rule execution result, including details about what was validated or calculated",
|
|
29335
|
+
examples: [
|
|
29336
|
+
"No other MassIDs with the same attributes were found.",
|
|
29337
|
+
"The MassID is not linked to a valid MassID Certificate",
|
|
29338
|
+
'The time between the "Drop-off" and "Recycled" events is 90 days, within the valid range (60-180 days).',
|
|
29339
|
+
"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"
|
|
29340
|
+
]
|
|
29341
|
+
}),
|
|
29309
29342
|
rule_processor_checksum: NonEmptyStringSchema.max(200).meta({
|
|
29310
29343
|
title: "Rule Processor Checksum",
|
|
29311
29344
|
description: "Checksum for rule processor integrity verification"
|
|
@@ -29560,12 +29593,6 @@ var ReceiptIdentitySchema = zod.z.strictObject({
|
|
|
29560
29593
|
title: "Identity",
|
|
29561
29594
|
description: "Participant identity information"
|
|
29562
29595
|
});
|
|
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
29596
|
function createReceiptCollectionSchema(params) {
|
|
29570
29597
|
const { meta } = params;
|
|
29571
29598
|
return zod.z.strictObject({
|
|
@@ -29585,26 +29612,6 @@ function createReceiptCollectionSchema(params) {
|
|
|
29585
29612
|
})
|
|
29586
29613
|
}).meta(meta);
|
|
29587
29614
|
}
|
|
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
29615
|
var CertificateCollectionItemPurchaseSchema = zod.z.strictObject({
|
|
29609
29616
|
slug: CollectionSlugSchema.meta({
|
|
29610
29617
|
title: "Collection Slug",
|
|
@@ -29632,37 +29639,6 @@ var CertificateCollectionItemRetirementSchema = zod.z.strictObject({
|
|
|
29632
29639
|
title: "Certificate Collection Item (Retirement)",
|
|
29633
29640
|
description: "Collection reference with retired amount for a certificate in a retirement receipt"
|
|
29634
29641
|
});
|
|
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
29642
|
function getSchemaBaseUrl() {
|
|
29667
29643
|
return `https://raw.githubusercontent.com/carrot-foundation/schemas/refs/tags/${getSchemaVersionOrDefault()}/schemas/ipfs`;
|
|
29668
29644
|
}
|
|
@@ -29671,7 +29647,7 @@ function buildSchemaUrl(schemaPath) {
|
|
|
29671
29647
|
return `${getSchemaBaseUrl()}/${cleanPath}`;
|
|
29672
29648
|
}
|
|
29673
29649
|
function getSchemaVersionOrDefault() {
|
|
29674
|
-
return "0.1.
|
|
29650
|
+
return "0.1.61";
|
|
29675
29651
|
}
|
|
29676
29652
|
|
|
29677
29653
|
// src/shared/schema-validation.ts
|
|
@@ -29730,6 +29706,48 @@ function validateCountMatches(params) {
|
|
|
29730
29706
|
});
|
|
29731
29707
|
}
|
|
29732
29708
|
}
|
|
29709
|
+
function validateNumericAttributeValue(params) {
|
|
29710
|
+
const {
|
|
29711
|
+
ctx,
|
|
29712
|
+
attributeByTraitType,
|
|
29713
|
+
traitType,
|
|
29714
|
+
expectedValue,
|
|
29715
|
+
epsilon,
|
|
29716
|
+
missingMessage,
|
|
29717
|
+
mismatchMessage
|
|
29718
|
+
} = params;
|
|
29719
|
+
const attribute = attributeByTraitType.get(traitType);
|
|
29720
|
+
if (!attribute) {
|
|
29721
|
+
ctx.addIssue({
|
|
29722
|
+
code: "custom",
|
|
29723
|
+
message: missingMessage,
|
|
29724
|
+
path: ["attributes"]
|
|
29725
|
+
});
|
|
29726
|
+
return;
|
|
29727
|
+
}
|
|
29728
|
+
const attributeValue = attribute.value;
|
|
29729
|
+
if (typeof attributeValue !== "number") {
|
|
29730
|
+
const attributeIndex = Array.from(attributeByTraitType.keys()).indexOf(
|
|
29731
|
+
traitType
|
|
29732
|
+
);
|
|
29733
|
+
ctx.addIssue({
|
|
29734
|
+
code: "custom",
|
|
29735
|
+
message: `${traitType} attribute value must be a number`,
|
|
29736
|
+
path: ["attributes", attributeIndex, "value"]
|
|
29737
|
+
});
|
|
29738
|
+
return;
|
|
29739
|
+
}
|
|
29740
|
+
if (!nearlyEqual(attributeValue, expectedValue, epsilon)) {
|
|
29741
|
+
const attributeIndex = Array.from(attributeByTraitType.keys()).indexOf(
|
|
29742
|
+
traitType
|
|
29743
|
+
);
|
|
29744
|
+
ctx.addIssue({
|
|
29745
|
+
code: "custom",
|
|
29746
|
+
message: mismatchMessage,
|
|
29747
|
+
path: ["attributes", attributeIndex, "value"]
|
|
29748
|
+
});
|
|
29749
|
+
}
|
|
29750
|
+
}
|
|
29733
29751
|
function validateAttributeValue(params) {
|
|
29734
29752
|
const {
|
|
29735
29753
|
ctx,
|
|
@@ -29740,6 +29758,19 @@ function validateAttributeValue(params) {
|
|
|
29740
29758
|
mismatchMessage,
|
|
29741
29759
|
path = ["attributes"]
|
|
29742
29760
|
} = params;
|
|
29761
|
+
if (expectedValue === void 0 || expectedValue === null) {
|
|
29762
|
+
const attributeIndex = Array.from(attributeByTraitType.keys()).indexOf(
|
|
29763
|
+
traitType
|
|
29764
|
+
);
|
|
29765
|
+
if (attributeIndex >= 0) {
|
|
29766
|
+
ctx.addIssue({
|
|
29767
|
+
code: "custom",
|
|
29768
|
+
message: missingMessage,
|
|
29769
|
+
path: ["attributes", attributeIndex]
|
|
29770
|
+
});
|
|
29771
|
+
}
|
|
29772
|
+
return;
|
|
29773
|
+
}
|
|
29743
29774
|
const attribute = attributeByTraitType.get(traitType);
|
|
29744
29775
|
if (!attribute) {
|
|
29745
29776
|
ctx.addIssue({
|
|
@@ -29750,10 +29781,13 @@ function validateAttributeValue(params) {
|
|
|
29750
29781
|
return;
|
|
29751
29782
|
}
|
|
29752
29783
|
if (attribute.value !== expectedValue) {
|
|
29784
|
+
const attributeIndex = Array.from(attributeByTraitType.keys()).indexOf(
|
|
29785
|
+
traitType
|
|
29786
|
+
);
|
|
29753
29787
|
ctx.addIssue({
|
|
29754
29788
|
code: "custom",
|
|
29755
29789
|
message: mismatchMessage,
|
|
29756
|
-
path
|
|
29790
|
+
path: ["attributes", attributeIndex, "value"]
|
|
29757
29791
|
});
|
|
29758
29792
|
}
|
|
29759
29793
|
}
|
|
@@ -29795,6 +29829,55 @@ function validateDateAttribute(params) {
|
|
|
29795
29829
|
});
|
|
29796
29830
|
}
|
|
29797
29831
|
}
|
|
29832
|
+
function validateDateTimeAttribute(params) {
|
|
29833
|
+
const {
|
|
29834
|
+
ctx,
|
|
29835
|
+
attributeByTraitType,
|
|
29836
|
+
traitType,
|
|
29837
|
+
dateTimeValue,
|
|
29838
|
+
missingMessage,
|
|
29839
|
+
invalidDateMessage,
|
|
29840
|
+
mismatchMessage,
|
|
29841
|
+
attributePath = ["attributes"],
|
|
29842
|
+
dateTimePath
|
|
29843
|
+
} = params;
|
|
29844
|
+
if (!dateTimeValue) {
|
|
29845
|
+
const attribute2 = attributeByTraitType.get(traitType);
|
|
29846
|
+
if (attribute2) {
|
|
29847
|
+
ctx.addIssue({
|
|
29848
|
+
code: "custom",
|
|
29849
|
+
message: missingMessage,
|
|
29850
|
+
path: attributePath
|
|
29851
|
+
});
|
|
29852
|
+
}
|
|
29853
|
+
return;
|
|
29854
|
+
}
|
|
29855
|
+
const attribute = attributeByTraitType.get(traitType);
|
|
29856
|
+
if (!attribute) {
|
|
29857
|
+
ctx.addIssue({
|
|
29858
|
+
code: "custom",
|
|
29859
|
+
message: missingMessage,
|
|
29860
|
+
path: attributePath
|
|
29861
|
+
});
|
|
29862
|
+
return;
|
|
29863
|
+
}
|
|
29864
|
+
const dateMs = Date.parse(dateTimeValue);
|
|
29865
|
+
if (Number.isNaN(dateMs)) {
|
|
29866
|
+
ctx.addIssue({
|
|
29867
|
+
code: "custom",
|
|
29868
|
+
message: invalidDateMessage,
|
|
29869
|
+
path: dateTimePath ?? attributePath
|
|
29870
|
+
});
|
|
29871
|
+
return;
|
|
29872
|
+
}
|
|
29873
|
+
if (attribute.value !== dateMs) {
|
|
29874
|
+
ctx.addIssue({
|
|
29875
|
+
code: "custom",
|
|
29876
|
+
message: mismatchMessage,
|
|
29877
|
+
path: attributePath
|
|
29878
|
+
});
|
|
29879
|
+
}
|
|
29880
|
+
}
|
|
29798
29881
|
function validateAttributesForItems(params) {
|
|
29799
29882
|
const {
|
|
29800
29883
|
ctx,
|
|
@@ -29925,6 +30008,35 @@ function validateCreditSymbolExists(params) {
|
|
|
29925
30008
|
});
|
|
29926
30009
|
}
|
|
29927
30010
|
}
|
|
30011
|
+
function validateTokenIdInName(params) {
|
|
30012
|
+
const {
|
|
30013
|
+
ctx,
|
|
30014
|
+
name,
|
|
30015
|
+
tokenId,
|
|
30016
|
+
pattern,
|
|
30017
|
+
path,
|
|
30018
|
+
message = `Name token_id must match blockchain.token_id: ${tokenId}`
|
|
30019
|
+
} = params;
|
|
30020
|
+
const match = pattern.exec(name);
|
|
30021
|
+
if (match?.[1] !== tokenId) {
|
|
30022
|
+
ctx.addIssue({
|
|
30023
|
+
code: "custom",
|
|
30024
|
+
message,
|
|
30025
|
+
path
|
|
30026
|
+
});
|
|
30027
|
+
}
|
|
30028
|
+
}
|
|
30029
|
+
function validateFormattedName(params) {
|
|
30030
|
+
const { ctx, name, schema, path } = params;
|
|
30031
|
+
const result = schema.safeParse(name);
|
|
30032
|
+
if (!result.success) {
|
|
30033
|
+
ctx.addIssue({
|
|
30034
|
+
code: "custom",
|
|
30035
|
+
message: result.error.issues[0].message,
|
|
30036
|
+
path
|
|
30037
|
+
});
|
|
30038
|
+
}
|
|
30039
|
+
}
|
|
29928
30040
|
function canonicalizeForHash(value) {
|
|
29929
30041
|
const canonical = canonicalize__default.default(value);
|
|
29930
30042
|
if (canonical === void 0) {
|
|
@@ -30350,151 +30462,143 @@ var MassIDIpfsSchema = NftIpfsSchema.safeExtend({
|
|
|
30350
30462
|
attributes: MassIDAttributesSchema,
|
|
30351
30463
|
data: MassIDDataSchema
|
|
30352
30464
|
}).superRefine((record, ctx) => {
|
|
30353
|
-
|
|
30354
|
-
|
|
30355
|
-
|
|
30356
|
-
|
|
30357
|
-
|
|
30358
|
-
|
|
30359
|
-
|
|
30360
|
-
|
|
30361
|
-
|
|
30362
|
-
|
|
30363
|
-
|
|
30364
|
-
|
|
30365
|
-
|
|
30366
|
-
|
|
30367
|
-
|
|
30368
|
-
path: ["short_name"]
|
|
30369
|
-
});
|
|
30370
|
-
}
|
|
30465
|
+
validateTokenIdInName({
|
|
30466
|
+
ctx,
|
|
30467
|
+
name: record.name,
|
|
30468
|
+
tokenId: record.blockchain.token_id,
|
|
30469
|
+
pattern: /^MassID #(\d+)/,
|
|
30470
|
+
path: ["name"]
|
|
30471
|
+
});
|
|
30472
|
+
validateTokenIdInName({
|
|
30473
|
+
ctx,
|
|
30474
|
+
name: record.short_name,
|
|
30475
|
+
tokenId: record.blockchain.token_id,
|
|
30476
|
+
pattern: /^MassID #(\d+)/,
|
|
30477
|
+
path: ["short_name"],
|
|
30478
|
+
message: `Short name token_id must match blockchain.token_id: ${record.blockchain.token_id}`
|
|
30479
|
+
});
|
|
30371
30480
|
const { data, attributes } = record;
|
|
30372
|
-
const
|
|
30373
|
-
|
|
30374
|
-
|
|
30375
|
-
|
|
30376
|
-
|
|
30377
|
-
|
|
30378
|
-
|
|
30379
|
-
|
|
30380
|
-
};
|
|
30381
|
-
|
|
30382
|
-
|
|
30383
|
-
|
|
30384
|
-
|
|
30385
|
-
|
|
30386
|
-
|
|
30387
|
-
|
|
30388
|
-
|
|
30389
|
-
|
|
30390
|
-
|
|
30391
|
-
|
|
30392
|
-
|
|
30393
|
-
|
|
30394
|
-
|
|
30395
|
-
|
|
30396
|
-
|
|
30397
|
-
|
|
30398
|
-
|
|
30399
|
-
|
|
30400
|
-
|
|
30401
|
-
|
|
30402
|
-
|
|
30403
|
-
|
|
30404
|
-
|
|
30405
|
-
message: `${traitType} attribute must equal ${sourceDescription}`
|
|
30406
|
-
});
|
|
30407
|
-
}
|
|
30408
|
-
};
|
|
30409
|
-
const assertTimestampAttributeMatches = (traitType, isoTimestamp, sourceDescription) => {
|
|
30410
|
-
if (!isoTimestamp) {
|
|
30411
|
-
assertAttributeMatches(traitType, void 0, sourceDescription);
|
|
30412
|
-
return;
|
|
30413
|
-
}
|
|
30414
|
-
const timestamp = Date.parse(isoTimestamp);
|
|
30415
|
-
if (Number.isNaN(timestamp)) {
|
|
30416
|
-
return;
|
|
30417
|
-
}
|
|
30418
|
-
assertAttributeMatches(traitType, timestamp, sourceDescription);
|
|
30419
|
-
};
|
|
30420
|
-
assertAttributeMatches(
|
|
30421
|
-
"Waste Type",
|
|
30422
|
-
data.waste_properties.type,
|
|
30423
|
-
"waste_properties.type"
|
|
30424
|
-
);
|
|
30425
|
-
assertAttributeMatches(
|
|
30426
|
-
"Waste Subtype",
|
|
30427
|
-
data.waste_properties.subtype,
|
|
30428
|
-
"waste_properties.subtype"
|
|
30429
|
-
);
|
|
30430
|
-
assertAttributeMatches(
|
|
30431
|
-
"Weight (kg)",
|
|
30432
|
-
data.waste_properties.net_weight_kg,
|
|
30433
|
-
"waste_properties.net_weight_kg"
|
|
30434
|
-
);
|
|
30435
|
-
assertAttributeMatches(
|
|
30436
|
-
"Local Waste Classification ID",
|
|
30437
|
-
data.waste_properties.local_classification?.code,
|
|
30438
|
-
"waste_properties.local_classification.code"
|
|
30439
|
-
);
|
|
30481
|
+
const attributeByTraitType = createAttributeMap(attributes);
|
|
30482
|
+
validateAttributeValue({
|
|
30483
|
+
ctx,
|
|
30484
|
+
attributeByTraitType,
|
|
30485
|
+
traitType: "Waste Type",
|
|
30486
|
+
expectedValue: data.waste_properties.type,
|
|
30487
|
+
missingMessage: "Waste Type attribute must be present and match waste_properties.type",
|
|
30488
|
+
mismatchMessage: "Waste Type attribute must equal waste_properties.type"
|
|
30489
|
+
});
|
|
30490
|
+
validateAttributeValue({
|
|
30491
|
+
ctx,
|
|
30492
|
+
attributeByTraitType,
|
|
30493
|
+
traitType: "Waste Subtype",
|
|
30494
|
+
expectedValue: data.waste_properties.subtype,
|
|
30495
|
+
missingMessage: "Waste Subtype attribute must be present and match waste_properties.subtype",
|
|
30496
|
+
mismatchMessage: "Waste Subtype attribute must equal waste_properties.subtype"
|
|
30497
|
+
});
|
|
30498
|
+
validateAttributeValue({
|
|
30499
|
+
ctx,
|
|
30500
|
+
attributeByTraitType,
|
|
30501
|
+
traitType: "Weight (kg)",
|
|
30502
|
+
expectedValue: data.waste_properties.net_weight_kg,
|
|
30503
|
+
missingMessage: "Weight (kg) attribute must be present and match waste_properties.net_weight_kg",
|
|
30504
|
+
mismatchMessage: "Weight (kg) attribute must equal waste_properties.net_weight_kg"
|
|
30505
|
+
});
|
|
30506
|
+
validateAttributeValue({
|
|
30507
|
+
ctx,
|
|
30508
|
+
attributeByTraitType,
|
|
30509
|
+
traitType: "Local Waste Classification ID",
|
|
30510
|
+
expectedValue: data.waste_properties.local_classification?.code,
|
|
30511
|
+
missingMessage: "Local Waste Classification ID attribute must be omitted when waste_properties.local_classification.code is not provided",
|
|
30512
|
+
mismatchMessage: "Local Waste Classification ID attribute must equal waste_properties.local_classification.code"
|
|
30513
|
+
});
|
|
30440
30514
|
const pickUpEvent = data.events.find(isPickUpEvent);
|
|
30441
30515
|
const pickUpLocation = pickUpEvent ? data.locations.find(
|
|
30442
30516
|
(location) => location.id_hash === pickUpEvent.location_id_hash
|
|
30443
30517
|
) : void 0;
|
|
30444
|
-
|
|
30445
|
-
|
|
30446
|
-
|
|
30447
|
-
"
|
|
30448
|
-
|
|
30449
|
-
|
|
30450
|
-
"Pick-up
|
|
30451
|
-
|
|
30452
|
-
|
|
30453
|
-
|
|
30454
|
-
|
|
30455
|
-
"Pick-up
|
|
30456
|
-
pickUpEvent?.
|
|
30457
|
-
"Pick-up event
|
|
30458
|
-
|
|
30459
|
-
|
|
30460
|
-
|
|
30461
|
-
|
|
30462
|
-
|
|
30463
|
-
|
|
30464
|
-
|
|
30465
|
-
|
|
30466
|
-
|
|
30467
|
-
"
|
|
30468
|
-
|
|
30469
|
-
|
|
30470
|
-
|
|
30471
|
-
|
|
30472
|
-
|
|
30473
|
-
"
|
|
30474
|
-
|
|
30475
|
-
"
|
|
30476
|
-
|
|
30477
|
-
|
|
30478
|
-
|
|
30479
|
-
|
|
30480
|
-
|
|
30481
|
-
|
|
30518
|
+
validateAttributeValue({
|
|
30519
|
+
ctx,
|
|
30520
|
+
attributeByTraitType,
|
|
30521
|
+
traitType: "Origin City",
|
|
30522
|
+
expectedValue: pickUpLocation?.city,
|
|
30523
|
+
missingMessage: "Origin City attribute must be omitted when Pick-up event location.city is not provided",
|
|
30524
|
+
mismatchMessage: "Origin City attribute must equal Pick-up event location.city"
|
|
30525
|
+
});
|
|
30526
|
+
validateDateTimeAttribute({
|
|
30527
|
+
ctx,
|
|
30528
|
+
attributeByTraitType,
|
|
30529
|
+
traitType: "Pick-up Date",
|
|
30530
|
+
dateTimeValue: pickUpEvent?.timestamp,
|
|
30531
|
+
missingMessage: "Pick-up Date attribute must be omitted when Pick-up event timestamp is not provided",
|
|
30532
|
+
invalidDateMessage: "Pick-up event timestamp must be a valid ISO 8601 date-time string",
|
|
30533
|
+
mismatchMessage: "Pick-up Date attribute must equal Pick-up event timestamp"
|
|
30534
|
+
});
|
|
30535
|
+
validateAttributeValue({
|
|
30536
|
+
ctx,
|
|
30537
|
+
attributeByTraitType,
|
|
30538
|
+
traitType: "Pick-up Vehicle Type",
|
|
30539
|
+
expectedValue: pickUpEvent?.data?.vehicle_type,
|
|
30540
|
+
missingMessage: "Pick-up Vehicle Type attribute must be omitted when Pick-up event vehicle_type is not provided",
|
|
30541
|
+
mismatchMessage: "Pick-up Vehicle Type attribute must equal Pick-up event vehicle_type"
|
|
30542
|
+
});
|
|
30543
|
+
const dropOffEvent = data.events.find(isDropOffEvent);
|
|
30544
|
+
validateDateTimeAttribute({
|
|
30545
|
+
ctx,
|
|
30546
|
+
attributeByTraitType,
|
|
30547
|
+
traitType: "Drop-off Date",
|
|
30548
|
+
dateTimeValue: dropOffEvent?.timestamp,
|
|
30549
|
+
missingMessage: "Drop-off Date attribute must be omitted when Drop-off event timestamp is not provided",
|
|
30550
|
+
invalidDateMessage: "Drop-off event timestamp must be a valid ISO 8601 date-time string",
|
|
30551
|
+
mismatchMessage: "Drop-off Date attribute must equal Drop-off event timestamp"
|
|
30552
|
+
});
|
|
30553
|
+
const recyclingEvent = data.events.find(isRecyclingEvent);
|
|
30554
|
+
validateDateTimeAttribute({
|
|
30555
|
+
ctx,
|
|
30556
|
+
attributeByTraitType,
|
|
30557
|
+
traitType: "Recycling Date",
|
|
30558
|
+
dateTimeValue: recyclingEvent?.timestamp,
|
|
30559
|
+
missingMessage: "Recycling Date attribute must be omitted when Recycling event timestamp is not provided",
|
|
30560
|
+
invalidDateMessage: "Recycling event timestamp must be a valid ISO 8601 date-time string",
|
|
30561
|
+
mismatchMessage: "Recycling Date attribute must equal Recycling event timestamp"
|
|
30562
|
+
});
|
|
30563
|
+
const weighingEvent = data.events.find(isWeighingEvent);
|
|
30564
|
+
validateAttributeValue({
|
|
30565
|
+
ctx,
|
|
30566
|
+
attributeByTraitType,
|
|
30567
|
+
traitType: "Weighing Capture Method",
|
|
30568
|
+
expectedValue: weighingEvent?.data?.weighing_capture_method,
|
|
30569
|
+
missingMessage: "Weighing Capture Method attribute must be omitted when Weighing event weighing_capture_method is not provided",
|
|
30570
|
+
mismatchMessage: "Weighing Capture Method attribute must equal Weighing event weighing_capture_method"
|
|
30571
|
+
});
|
|
30572
|
+
validateAttributeValue({
|
|
30573
|
+
ctx,
|
|
30574
|
+
attributeByTraitType,
|
|
30575
|
+
traitType: "Scale Type",
|
|
30576
|
+
expectedValue: weighingEvent?.data?.scale_type,
|
|
30577
|
+
missingMessage: "Scale Type attribute must be omitted when Weighing event scale_type is not provided",
|
|
30578
|
+
mismatchMessage: "Scale Type attribute must equal Weighing event scale_type"
|
|
30579
|
+
});
|
|
30482
30580
|
const recyclingManifest = data.attachments?.find(
|
|
30483
30581
|
(attachment) => attachment.type === "Recycling Manifest" && attachment.document_number
|
|
30484
30582
|
);
|
|
30485
|
-
|
|
30486
|
-
|
|
30487
|
-
|
|
30488
|
-
"Recycling Manifest
|
|
30489
|
-
|
|
30583
|
+
validateAttributeValue({
|
|
30584
|
+
ctx,
|
|
30585
|
+
attributeByTraitType,
|
|
30586
|
+
traitType: "Recycling Manifest Number",
|
|
30587
|
+
expectedValue: recyclingManifest?.document_number,
|
|
30588
|
+
missingMessage: recyclingManifest?.document_number ? "Recycling Manifest Number attribute must be present and match Recycling Manifest attachment document_number" : "Recycling Manifest Number attribute must be omitted when Recycling Manifest attachment document_number is not provided",
|
|
30589
|
+
mismatchMessage: "Recycling Manifest Number attribute must equal Recycling Manifest attachment document_number"
|
|
30590
|
+
});
|
|
30490
30591
|
const transportManifest = data.attachments?.find(
|
|
30491
30592
|
(attachment) => attachment.type === "Transport Manifest" && attachment.document_number
|
|
30492
30593
|
);
|
|
30493
|
-
|
|
30494
|
-
|
|
30495
|
-
|
|
30496
|
-
"Transport Manifest
|
|
30497
|
-
|
|
30594
|
+
validateAttributeValue({
|
|
30595
|
+
ctx,
|
|
30596
|
+
attributeByTraitType,
|
|
30597
|
+
traitType: "Transport Manifest Number",
|
|
30598
|
+
expectedValue: transportManifest?.document_number,
|
|
30599
|
+
missingMessage: transportManifest?.document_number ? "Transport Manifest Number attribute must be present and match Transport Manifest attachment document_number" : "Transport Manifest Number attribute must be omitted when Transport Manifest attachment document_number is not provided",
|
|
30600
|
+
mismatchMessage: "Transport Manifest Number attribute must equal Transport Manifest attachment document_number"
|
|
30601
|
+
});
|
|
30498
30602
|
}).meta(MassIDIpfsSchemaMeta);
|
|
30499
30603
|
var GasIDAttributeMethodologySchema = MethodologyAttributeSchema;
|
|
30500
30604
|
var GasIDAttributeGasTypeSchema = NftAttributeSchema.safeExtend({
|
|
@@ -30631,42 +30735,144 @@ var GasIDIpfsSchema = NftIpfsSchema.safeExtend({
|
|
|
30631
30735
|
attributes: GasIDAttributesSchema,
|
|
30632
30736
|
data: GasIDDataSchema
|
|
30633
30737
|
}).superRefine((record, ctx) => {
|
|
30634
|
-
|
|
30635
|
-
|
|
30636
|
-
|
|
30637
|
-
|
|
30638
|
-
|
|
30639
|
-
|
|
30640
|
-
|
|
30641
|
-
|
|
30642
|
-
|
|
30643
|
-
|
|
30644
|
-
|
|
30645
|
-
|
|
30646
|
-
|
|
30647
|
-
|
|
30648
|
-
|
|
30649
|
-
path: ["short_name"]
|
|
30650
|
-
});
|
|
30651
|
-
}
|
|
30738
|
+
validateTokenIdInName({
|
|
30739
|
+
ctx,
|
|
30740
|
+
name: record.name,
|
|
30741
|
+
tokenId: record.blockchain.token_id,
|
|
30742
|
+
pattern: /^GasID #(\d+)/,
|
|
30743
|
+
path: ["name"]
|
|
30744
|
+
});
|
|
30745
|
+
validateTokenIdInName({
|
|
30746
|
+
ctx,
|
|
30747
|
+
name: record.short_name,
|
|
30748
|
+
tokenId: record.blockchain.token_id,
|
|
30749
|
+
pattern: /^GasID #(\d+)/,
|
|
30750
|
+
path: ["short_name"],
|
|
30751
|
+
message: `Short name token_id must match blockchain.token_id: ${record.blockchain.token_id}`
|
|
30752
|
+
});
|
|
30652
30753
|
const nameSchema = createGasIDNameSchema(record.blockchain.token_id);
|
|
30653
|
-
|
|
30654
|
-
|
|
30655
|
-
|
|
30656
|
-
|
|
30657
|
-
|
|
30658
|
-
|
|
30659
|
-
});
|
|
30660
|
-
}
|
|
30754
|
+
validateFormattedName({
|
|
30755
|
+
ctx,
|
|
30756
|
+
name: record.name,
|
|
30757
|
+
schema: nameSchema,
|
|
30758
|
+
path: ["name"]
|
|
30759
|
+
});
|
|
30661
30760
|
const shortNameSchema = createGasIDShortNameSchema(
|
|
30662
30761
|
record.blockchain.token_id
|
|
30663
30762
|
);
|
|
30664
|
-
|
|
30665
|
-
|
|
30763
|
+
validateFormattedName({
|
|
30764
|
+
ctx,
|
|
30765
|
+
name: record.short_name,
|
|
30766
|
+
schema: shortNameSchema,
|
|
30767
|
+
path: ["short_name"]
|
|
30768
|
+
});
|
|
30769
|
+
const { data, attributes } = record;
|
|
30770
|
+
const attributeByTraitType = createAttributeMap(attributes);
|
|
30771
|
+
validateAttributeValue({
|
|
30772
|
+
ctx,
|
|
30773
|
+
attributeByTraitType,
|
|
30774
|
+
traitType: "Methodology",
|
|
30775
|
+
expectedValue: data.methodology.name,
|
|
30776
|
+
missingMessage: "Methodology attribute must be present and match data.methodology.name",
|
|
30777
|
+
mismatchMessage: "Methodology attribute must equal data.methodology.name"
|
|
30778
|
+
});
|
|
30779
|
+
validateAttributeValue({
|
|
30780
|
+
ctx,
|
|
30781
|
+
attributeByTraitType,
|
|
30782
|
+
traitType: "Gas Type",
|
|
30783
|
+
expectedValue: data.summary.gas_type,
|
|
30784
|
+
missingMessage: "Gas Type attribute must be present and match data.summary.gas_type",
|
|
30785
|
+
mismatchMessage: "Gas Type attribute must equal data.summary.gas_type"
|
|
30786
|
+
});
|
|
30787
|
+
validateNumericAttributeValue({
|
|
30788
|
+
ctx,
|
|
30789
|
+
attributeByTraitType,
|
|
30790
|
+
traitType: "CO\u2082e Prevented (kg)",
|
|
30791
|
+
expectedValue: data.summary.prevented_co2e_kg,
|
|
30792
|
+
epsilon: 0.01,
|
|
30793
|
+
missingMessage: "CO\u2082e Prevented (kg) attribute must be present and match data.summary.prevented_co2e_kg",
|
|
30794
|
+
mismatchMessage: "CO\u2082e Prevented (kg) attribute must equal data.summary.prevented_co2e_kg"
|
|
30795
|
+
});
|
|
30796
|
+
validateAttributeValue({
|
|
30797
|
+
ctx,
|
|
30798
|
+
attributeByTraitType,
|
|
30799
|
+
traitType: "Credit Amount",
|
|
30800
|
+
expectedValue: data.summary.credit_amount,
|
|
30801
|
+
missingMessage: "Credit Amount attribute must be present and match data.summary.credit_amount",
|
|
30802
|
+
mismatchMessage: "Credit Amount attribute must equal data.summary.credit_amount"
|
|
30803
|
+
});
|
|
30804
|
+
validateAttributeValue({
|
|
30805
|
+
ctx,
|
|
30806
|
+
attributeByTraitType,
|
|
30807
|
+
traitType: "Credit Type",
|
|
30808
|
+
expectedValue: data.summary.credit_type,
|
|
30809
|
+
missingMessage: "Credit Type attribute must be present and match data.summary.credit_type",
|
|
30810
|
+
mismatchMessage: "Credit Type attribute must equal data.summary.credit_type"
|
|
30811
|
+
});
|
|
30812
|
+
validateAttributeValue({
|
|
30813
|
+
ctx,
|
|
30814
|
+
attributeByTraitType,
|
|
30815
|
+
traitType: "Source Waste Type",
|
|
30816
|
+
expectedValue: data.waste_properties.type,
|
|
30817
|
+
missingMessage: "Source Waste Type attribute must be present and match data.waste_properties.type",
|
|
30818
|
+
mismatchMessage: "Source Waste Type attribute must equal data.waste_properties.type"
|
|
30819
|
+
});
|
|
30820
|
+
validateAttributeValue({
|
|
30821
|
+
ctx,
|
|
30822
|
+
attributeByTraitType,
|
|
30823
|
+
traitType: "Source Weight (kg)",
|
|
30824
|
+
expectedValue: data.waste_properties.net_weight_kg,
|
|
30825
|
+
missingMessage: "Source Weight (kg) attribute must be present and match data.waste_properties.net_weight_kg",
|
|
30826
|
+
mismatchMessage: "Source Weight (kg) attribute must equal data.waste_properties.net_weight_kg"
|
|
30827
|
+
});
|
|
30828
|
+
validateAttributeValue({
|
|
30829
|
+
ctx,
|
|
30830
|
+
attributeByTraitType,
|
|
30831
|
+
traitType: "Origin City",
|
|
30832
|
+
expectedValue: data.origin_location.city,
|
|
30833
|
+
missingMessage: "Origin City attribute must be present and match data.origin_location.city",
|
|
30834
|
+
mismatchMessage: "Origin City attribute must equal data.origin_location.city"
|
|
30835
|
+
});
|
|
30836
|
+
validateAttributeValue({
|
|
30837
|
+
ctx,
|
|
30838
|
+
attributeByTraitType,
|
|
30839
|
+
traitType: "MassID",
|
|
30840
|
+
expectedValue: `#${data.mass_id.token_id}`,
|
|
30841
|
+
missingMessage: "MassID attribute must be present and match data.mass_id.token_id as #<token_id>",
|
|
30842
|
+
mismatchMessage: "MassID attribute must equal data.mass_id.token_id as #<token_id>"
|
|
30843
|
+
});
|
|
30844
|
+
validateDateTimeAttribute({
|
|
30845
|
+
ctx,
|
|
30846
|
+
attributeByTraitType,
|
|
30847
|
+
traitType: "MassID Recycling Date",
|
|
30848
|
+
dateTimeValue: data.summary.issued_at,
|
|
30849
|
+
missingMessage: "MassID Recycling Date attribute must be present and match data.summary.issued_at",
|
|
30850
|
+
invalidDateMessage: "data.summary.issued_at must be a valid ISO 8601 date-time string",
|
|
30851
|
+
mismatchMessage: "MassID Recycling Date attribute must equal data.summary.issued_at as a Unix timestamp in milliseconds"
|
|
30852
|
+
});
|
|
30853
|
+
validateDateTimeAttribute({
|
|
30854
|
+
ctx,
|
|
30855
|
+
attributeByTraitType,
|
|
30856
|
+
traitType: "Certificate Issuance Date",
|
|
30857
|
+
dateTimeValue: data.summary.issued_at,
|
|
30858
|
+
missingMessage: "Certificate Issuance Date attribute must be present and match data.summary.issued_at",
|
|
30859
|
+
invalidDateMessage: "data.summary.issued_at must be a valid ISO 8601 date-time string",
|
|
30860
|
+
mismatchMessage: "Certificate Issuance Date attribute must equal data.summary.issued_at as a Unix timestamp in milliseconds"
|
|
30861
|
+
});
|
|
30862
|
+
const resultValue = data.prevented_emissions_calculation.values.find(
|
|
30863
|
+
(value) => value.reference === "R"
|
|
30864
|
+
);
|
|
30865
|
+
if (!resultValue) {
|
|
30666
30866
|
ctx.addIssue({
|
|
30667
30867
|
code: "custom",
|
|
30668
|
-
message:
|
|
30669
|
-
path: ["
|
|
30868
|
+
message: 'prevented_emissions_calculation.values must include a value with reference "R"',
|
|
30869
|
+
path: ["data", "prevented_emissions_calculation", "values"]
|
|
30870
|
+
});
|
|
30871
|
+
} else if (!nearlyEqual(resultValue.value, data.summary.prevented_co2e_kg, 0.01)) {
|
|
30872
|
+
ctx.addIssue({
|
|
30873
|
+
code: "custom",
|
|
30874
|
+
message: "prevented_emissions_calculation.values R value must match summary.prevented_co2e_kg",
|
|
30875
|
+
path: ["data", "prevented_emissions_calculation", "values"]
|
|
30670
30876
|
});
|
|
30671
30877
|
}
|
|
30672
30878
|
}).meta(GasIDIpfsSchemaMeta);
|
|
@@ -30749,44 +30955,122 @@ var RecycledIDIpfsSchema = NftIpfsSchema.safeExtend({
|
|
|
30749
30955
|
attributes: RecycledIDAttributesSchema,
|
|
30750
30956
|
data: RecycledIDDataSchema
|
|
30751
30957
|
}).superRefine((record, ctx) => {
|
|
30752
|
-
|
|
30753
|
-
|
|
30754
|
-
|
|
30755
|
-
|
|
30756
|
-
|
|
30757
|
-
|
|
30758
|
-
|
|
30759
|
-
|
|
30760
|
-
|
|
30761
|
-
|
|
30762
|
-
|
|
30763
|
-
|
|
30764
|
-
|
|
30765
|
-
|
|
30766
|
-
|
|
30767
|
-
path: ["short_name"]
|
|
30768
|
-
});
|
|
30769
|
-
}
|
|
30958
|
+
validateTokenIdInName({
|
|
30959
|
+
ctx,
|
|
30960
|
+
name: record.name,
|
|
30961
|
+
tokenId: record.blockchain.token_id,
|
|
30962
|
+
pattern: /^RecycledID #(\d+)/,
|
|
30963
|
+
path: ["name"]
|
|
30964
|
+
});
|
|
30965
|
+
validateTokenIdInName({
|
|
30966
|
+
ctx,
|
|
30967
|
+
name: record.short_name,
|
|
30968
|
+
tokenId: record.blockchain.token_id,
|
|
30969
|
+
pattern: /^RecycledID #(\d+)/,
|
|
30970
|
+
path: ["short_name"],
|
|
30971
|
+
message: `Short name token_id must match blockchain.token_id: ${record.blockchain.token_id}`
|
|
30972
|
+
});
|
|
30770
30973
|
const nameSchema = createRecycledIDNameSchema(record.blockchain.token_id);
|
|
30771
|
-
|
|
30772
|
-
|
|
30773
|
-
|
|
30774
|
-
|
|
30775
|
-
|
|
30776
|
-
|
|
30777
|
-
});
|
|
30778
|
-
}
|
|
30974
|
+
validateFormattedName({
|
|
30975
|
+
ctx,
|
|
30976
|
+
name: record.name,
|
|
30977
|
+
schema: nameSchema,
|
|
30978
|
+
path: ["name"]
|
|
30979
|
+
});
|
|
30779
30980
|
const shortNameSchema = createRecycledIDShortNameSchema(
|
|
30780
30981
|
record.blockchain.token_id
|
|
30781
30982
|
);
|
|
30782
|
-
|
|
30783
|
-
|
|
30784
|
-
|
|
30785
|
-
|
|
30786
|
-
|
|
30787
|
-
|
|
30788
|
-
|
|
30789
|
-
|
|
30983
|
+
validateFormattedName({
|
|
30984
|
+
ctx,
|
|
30985
|
+
name: record.short_name,
|
|
30986
|
+
schema: shortNameSchema,
|
|
30987
|
+
path: ["short_name"]
|
|
30988
|
+
});
|
|
30989
|
+
const { data, attributes } = record;
|
|
30990
|
+
const attributeByTraitType = createAttributeMap(attributes);
|
|
30991
|
+
validateAttributeValue({
|
|
30992
|
+
ctx,
|
|
30993
|
+
attributeByTraitType,
|
|
30994
|
+
traitType: "Methodology",
|
|
30995
|
+
expectedValue: data.methodology.name,
|
|
30996
|
+
missingMessage: "Methodology attribute must be present and match data.methodology.name",
|
|
30997
|
+
mismatchMessage: "Methodology attribute must equal data.methodology.name"
|
|
30998
|
+
});
|
|
30999
|
+
validateNumericAttributeValue({
|
|
31000
|
+
ctx,
|
|
31001
|
+
attributeByTraitType,
|
|
31002
|
+
traitType: "Recycled Mass Weight (kg)",
|
|
31003
|
+
expectedValue: data.summary.recycled_mass_kg,
|
|
31004
|
+
epsilon: 0.01,
|
|
31005
|
+
missingMessage: "Recycled Mass Weight (kg) attribute must be present and match data.summary.recycled_mass_kg",
|
|
31006
|
+
mismatchMessage: "Recycled Mass Weight (kg) attribute must equal data.summary.recycled_mass_kg"
|
|
31007
|
+
});
|
|
31008
|
+
validateAttributeValue({
|
|
31009
|
+
ctx,
|
|
31010
|
+
attributeByTraitType,
|
|
31011
|
+
traitType: "Credit Amount",
|
|
31012
|
+
expectedValue: data.summary.credit_amount,
|
|
31013
|
+
missingMessage: "Credit Amount attribute must be present and match data.summary.credit_amount",
|
|
31014
|
+
mismatchMessage: "Credit Amount attribute must equal data.summary.credit_amount"
|
|
31015
|
+
});
|
|
31016
|
+
validateAttributeValue({
|
|
31017
|
+
ctx,
|
|
31018
|
+
attributeByTraitType,
|
|
31019
|
+
traitType: "Credit Type",
|
|
31020
|
+
expectedValue: data.summary.credit_type,
|
|
31021
|
+
missingMessage: "Credit Type attribute must be present and match data.summary.credit_type",
|
|
31022
|
+
mismatchMessage: "Credit Type attribute must equal data.summary.credit_type"
|
|
31023
|
+
});
|
|
31024
|
+
validateAttributeValue({
|
|
31025
|
+
ctx,
|
|
31026
|
+
attributeByTraitType,
|
|
31027
|
+
traitType: "Source Waste Type",
|
|
31028
|
+
expectedValue: data.waste_properties.type,
|
|
31029
|
+
missingMessage: "Source Waste Type attribute must be present and match data.waste_properties.type",
|
|
31030
|
+
mismatchMessage: "Source Waste Type attribute must equal data.waste_properties.type"
|
|
31031
|
+
});
|
|
31032
|
+
validateAttributeValue({
|
|
31033
|
+
ctx,
|
|
31034
|
+
attributeByTraitType,
|
|
31035
|
+
traitType: "Source Weight (kg)",
|
|
31036
|
+
expectedValue: data.waste_properties.net_weight_kg,
|
|
31037
|
+
missingMessage: "Source Weight (kg) attribute must be present and match data.waste_properties.net_weight_kg",
|
|
31038
|
+
mismatchMessage: "Source Weight (kg) attribute must equal data.waste_properties.net_weight_kg"
|
|
31039
|
+
});
|
|
31040
|
+
validateAttributeValue({
|
|
31041
|
+
ctx,
|
|
31042
|
+
attributeByTraitType,
|
|
31043
|
+
traitType: "Origin City",
|
|
31044
|
+
expectedValue: data.origin_location.city,
|
|
31045
|
+
missingMessage: "Origin City attribute must be present and match data.origin_location.city",
|
|
31046
|
+
mismatchMessage: "Origin City attribute must equal data.origin_location.city"
|
|
31047
|
+
});
|
|
31048
|
+
validateAttributeValue({
|
|
31049
|
+
ctx,
|
|
31050
|
+
attributeByTraitType,
|
|
31051
|
+
traitType: "MassID",
|
|
31052
|
+
expectedValue: `#${data.mass_id.token_id}`,
|
|
31053
|
+
missingMessage: "MassID attribute must be present and match data.mass_id.token_id as #<token_id>",
|
|
31054
|
+
mismatchMessage: "MassID attribute must equal data.mass_id.token_id as #<token_id>"
|
|
31055
|
+
});
|
|
31056
|
+
validateDateTimeAttribute({
|
|
31057
|
+
ctx,
|
|
31058
|
+
attributeByTraitType,
|
|
31059
|
+
traitType: "MassID Recycling Date",
|
|
31060
|
+
dateTimeValue: data.summary.issued_at,
|
|
31061
|
+
missingMessage: "MassID Recycling Date attribute must be present and match data.summary.issued_at",
|
|
31062
|
+
invalidDateMessage: "data.summary.issued_at must be a valid ISO 8601 date-time string",
|
|
31063
|
+
mismatchMessage: "MassID Recycling Date attribute must equal data.summary.issued_at as a Unix timestamp in milliseconds"
|
|
31064
|
+
});
|
|
31065
|
+
validateDateTimeAttribute({
|
|
31066
|
+
ctx,
|
|
31067
|
+
attributeByTraitType,
|
|
31068
|
+
traitType: "Certificate Issuance Date",
|
|
31069
|
+
dateTimeValue: data.summary.issued_at,
|
|
31070
|
+
missingMessage: "Certificate Issuance Date attribute must be present and match data.summary.issued_at",
|
|
31071
|
+
invalidDateMessage: "data.summary.issued_at must be a valid ISO 8601 date-time string",
|
|
31072
|
+
mismatchMessage: "Certificate Issuance Date attribute must equal data.summary.issued_at as a Unix timestamp in milliseconds"
|
|
31073
|
+
});
|
|
30790
31074
|
}).meta(RecycledIDIpfsSchemaMeta);
|
|
30791
31075
|
var CreditPurchaseReceiptCreditAttributeSchema = NftAttributeSchema.safeExtend({
|
|
30792
31076
|
trait_type: CreditTokenSymbolSchema,
|
|
@@ -30902,30 +31186,25 @@ var CreditPurchaseReceiptCollectionSchema = createReceiptCollectionSchema({
|
|
|
30902
31186
|
description: "Collection included in the purchase"
|
|
30903
31187
|
}
|
|
30904
31188
|
});
|
|
30905
|
-
var CreditPurchaseReceiptCreditSchema =
|
|
30906
|
-
|
|
30907
|
-
|
|
30908
|
-
description: "Credit token included in the purchase"
|
|
30909
|
-
}
|
|
31189
|
+
var CreditPurchaseReceiptCreditSchema = CreditReferenceSchema.meta({
|
|
31190
|
+
title: "Credit",
|
|
31191
|
+
description: "Credit token included in the purchase"
|
|
30910
31192
|
});
|
|
30911
|
-
var CreditPurchaseReceiptCertificateSchema =
|
|
30912
|
-
|
|
30913
|
-
|
|
30914
|
-
|
|
30915
|
-
|
|
30916
|
-
|
|
30917
|
-
|
|
30918
|
-
|
|
30919
|
-
|
|
30920
|
-
|
|
30921
|
-
|
|
30922
|
-
|
|
30923
|
-
|
|
30924
|
-
|
|
30925
|
-
|
|
30926
|
-
title: "Certificate",
|
|
30927
|
-
description: "Certificate associated with the purchase"
|
|
30928
|
-
}
|
|
31193
|
+
var CreditPurchaseReceiptCertificateSchema = CertificateReferenceBaseSchema.safeExtend({
|
|
31194
|
+
credit_slug: CreditTokenSlugSchema.meta({
|
|
31195
|
+
description: "Slug of the credit type for this certificate"
|
|
31196
|
+
}),
|
|
31197
|
+
collections: uniqueBy(
|
|
31198
|
+
CertificateCollectionItemPurchaseSchema,
|
|
31199
|
+
(item) => item.slug,
|
|
31200
|
+
"Collection slugs within certificate collections must be unique"
|
|
31201
|
+
).min(1).meta({
|
|
31202
|
+
title: "Certificate Collections",
|
|
31203
|
+
description: "Collections associated with this certificate, each with purchased and retired amounts"
|
|
31204
|
+
})
|
|
31205
|
+
}).meta({
|
|
31206
|
+
title: "Certificate",
|
|
31207
|
+
description: "Certificate associated with the purchase"
|
|
30929
31208
|
});
|
|
30930
31209
|
var CreditPurchaseReceiptParticipantRewardSchema = zod.z.strictObject({
|
|
30931
31210
|
participant_id_hash: ParticipantIdHashSchema,
|
|
@@ -30944,28 +31223,7 @@ var CreditPurchaseReceiptParticipantRewardSchema = zod.z.strictObject({
|
|
|
30944
31223
|
title: "Participant Reward",
|
|
30945
31224
|
description: "Reward distribution for a participant"
|
|
30946
31225
|
});
|
|
30947
|
-
var CreditPurchaseReceiptRetirementReceiptSchema =
|
|
30948
|
-
token_id: TokenIdSchema.meta({
|
|
30949
|
-
title: "Retirement Receipt Token ID",
|
|
30950
|
-
description: "Token ID of the retirement receipt NFT"
|
|
30951
|
-
}),
|
|
30952
|
-
external_id: ExternalIdSchema.meta({
|
|
30953
|
-
title: "Retirement Receipt External ID",
|
|
30954
|
-
description: "External identifier for the retirement receipt"
|
|
30955
|
-
}),
|
|
30956
|
-
external_url: ExternalUrlSchema.meta({
|
|
30957
|
-
title: "Retirement Receipt External URL",
|
|
30958
|
-
description: "External URL for the retirement receipt"
|
|
30959
|
-
}),
|
|
30960
|
-
ipfs_uri: IpfsUriSchema.meta({
|
|
30961
|
-
title: "Retirement Receipt IPFS URI",
|
|
30962
|
-
description: "IPFS URI for the retirement receipt metadata"
|
|
30963
|
-
}),
|
|
30964
|
-
smart_contract_address: SmartContractAddressSchema
|
|
30965
|
-
}).meta({
|
|
30966
|
-
title: "Retirement Receipt Reference",
|
|
30967
|
-
description: "Reference to the retirement receipt NFT"
|
|
30968
|
-
});
|
|
31226
|
+
var CreditPurchaseReceiptRetirementReceiptSchema = CreditRetirementReceiptReferenceSchema;
|
|
30969
31227
|
var CreditPurchaseReceiptDataSchema = zod.z.strictObject({
|
|
30970
31228
|
summary: CreditPurchaseReceiptSummarySchema,
|
|
30971
31229
|
buyer: CreditPurchaseReceiptBuyerSchema,
|
|
@@ -31128,24 +31386,39 @@ var CreditPurchaseReceiptIpfsSchema = NftIpfsSchema.safeExtend({
|
|
|
31128
31386
|
attributes: CreditPurchaseReceiptAttributesSchema,
|
|
31129
31387
|
data: CreditPurchaseReceiptDataSchema
|
|
31130
31388
|
}).superRefine((value, ctx) => {
|
|
31131
|
-
|
|
31132
|
-
|
|
31133
|
-
|
|
31134
|
-
|
|
31135
|
-
|
|
31136
|
-
|
|
31137
|
-
|
|
31138
|
-
|
|
31139
|
-
|
|
31140
|
-
|
|
31141
|
-
|
|
31142
|
-
|
|
31143
|
-
|
|
31144
|
-
|
|
31145
|
-
|
|
31146
|
-
|
|
31147
|
-
|
|
31148
|
-
|
|
31389
|
+
validateTokenIdInName({
|
|
31390
|
+
ctx,
|
|
31391
|
+
name: value.name,
|
|
31392
|
+
tokenId: value.blockchain.token_id,
|
|
31393
|
+
pattern: /^Credit Purchase Receipt #(\d+)/,
|
|
31394
|
+
path: ["name"]
|
|
31395
|
+
});
|
|
31396
|
+
validateTokenIdInName({
|
|
31397
|
+
ctx,
|
|
31398
|
+
name: value.short_name,
|
|
31399
|
+
tokenId: value.blockchain.token_id,
|
|
31400
|
+
pattern: /^Purchase Receipt #(\d+)/,
|
|
31401
|
+
path: ["short_name"],
|
|
31402
|
+
message: `Short name token_id must match blockchain.token_id: ${value.blockchain.token_id}`
|
|
31403
|
+
});
|
|
31404
|
+
const nameSchema = createCreditPurchaseReceiptNameSchema(
|
|
31405
|
+
value.blockchain.token_id
|
|
31406
|
+
);
|
|
31407
|
+
validateFormattedName({
|
|
31408
|
+
ctx,
|
|
31409
|
+
name: value.name,
|
|
31410
|
+
schema: nameSchema,
|
|
31411
|
+
path: ["name"]
|
|
31412
|
+
});
|
|
31413
|
+
const shortNameSchema = createCreditPurchaseReceiptShortNameSchema(
|
|
31414
|
+
value.blockchain.token_id
|
|
31415
|
+
);
|
|
31416
|
+
validateFormattedName({
|
|
31417
|
+
ctx,
|
|
31418
|
+
name: value.short_name,
|
|
31419
|
+
schema: shortNameSchema,
|
|
31420
|
+
path: ["short_name"]
|
|
31421
|
+
});
|
|
31149
31422
|
const attributes = value.attributes;
|
|
31150
31423
|
const data = value.data;
|
|
31151
31424
|
const attributeByTraitType = createAttributeMap(attributes);
|
|
@@ -31252,28 +31525,6 @@ var CreditPurchaseReceiptIpfsSchema = NftIpfsSchema.safeExtend({
|
|
|
31252
31525
|
});
|
|
31253
31526
|
}
|
|
31254
31527
|
});
|
|
31255
|
-
const nameSchema = createCreditPurchaseReceiptNameSchema(
|
|
31256
|
-
value.blockchain.token_id
|
|
31257
|
-
);
|
|
31258
|
-
const nameResult = nameSchema.safeParse(value.name);
|
|
31259
|
-
if (!nameResult.success) {
|
|
31260
|
-
ctx.addIssue({
|
|
31261
|
-
code: "custom",
|
|
31262
|
-
message: nameResult.error.issues[0].message,
|
|
31263
|
-
path: ["name"]
|
|
31264
|
-
});
|
|
31265
|
-
}
|
|
31266
|
-
const shortNameSchema = createCreditPurchaseReceiptShortNameSchema(
|
|
31267
|
-
value.blockchain.token_id
|
|
31268
|
-
);
|
|
31269
|
-
const shortNameResult = shortNameSchema.safeParse(value.short_name);
|
|
31270
|
-
if (!shortNameResult.success) {
|
|
31271
|
-
ctx.addIssue({
|
|
31272
|
-
code: "custom",
|
|
31273
|
-
message: shortNameResult.error.issues[0].message,
|
|
31274
|
-
path: ["short_name"]
|
|
31275
|
-
});
|
|
31276
|
-
}
|
|
31277
31528
|
}).meta(CreditPurchaseReceiptIpfsSchemaMeta);
|
|
31278
31529
|
var CreditRetirementReceiptCreditAttributeSchema = NftAttributeSchema.safeExtend({
|
|
31279
31530
|
trait_type: CreditTokenSymbolSchema,
|
|
@@ -31397,11 +31648,9 @@ var CreditRetirementReceiptCollectionSchema = createReceiptCollectionSchema({
|
|
|
31397
31648
|
description: "Collection included in the retirement"
|
|
31398
31649
|
}
|
|
31399
31650
|
});
|
|
31400
|
-
var CreditRetirementReceiptCreditSchema =
|
|
31401
|
-
|
|
31402
|
-
|
|
31403
|
-
description: "Credit token retired in this receipt"
|
|
31404
|
-
}
|
|
31651
|
+
var CreditRetirementReceiptCreditSchema = CreditReferenceSchema.meta({
|
|
31652
|
+
title: "Credit",
|
|
31653
|
+
description: "Credit token retired in this receipt"
|
|
31405
31654
|
});
|
|
31406
31655
|
var CreditRetirementReceiptCertificateCreditSchema = zod.z.strictObject({
|
|
31407
31656
|
credit_symbol: CreditTokenSymbolSchema.meta({
|
|
@@ -31426,54 +31675,27 @@ var CreditRetirementReceiptCertificateCreditSchema = zod.z.strictObject({
|
|
|
31426
31675
|
title: "Certificate Credit Retirement",
|
|
31427
31676
|
description: "Credit retirement breakdown for a certificate"
|
|
31428
31677
|
});
|
|
31429
|
-
var
|
|
31430
|
-
|
|
31431
|
-
|
|
31432
|
-
|
|
31433
|
-
|
|
31434
|
-
|
|
31435
|
-
title: "
|
|
31436
|
-
description: "
|
|
31437
|
-
}),
|
|
31438
|
-
external_url: ExternalUrlSchema.meta({
|
|
31439
|
-
title: "Purchase Receipt External URL",
|
|
31440
|
-
description: "External URL for the purchase receipt"
|
|
31441
|
-
}),
|
|
31442
|
-
ipfs_uri: IpfsUriSchema.meta({
|
|
31443
|
-
title: "Purchase Receipt IPFS URI",
|
|
31444
|
-
description: "IPFS URI for the purchase receipt metadata"
|
|
31678
|
+
var CreditRetirementReceiptCertificateSchema = CertificateReferenceBaseSchema.safeExtend({
|
|
31679
|
+
collections: uniqueBy(
|
|
31680
|
+
CertificateCollectionItemRetirementSchema,
|
|
31681
|
+
(item) => item.slug,
|
|
31682
|
+
"Collection slugs within certificate collections must be unique"
|
|
31683
|
+
).min(1).meta({
|
|
31684
|
+
title: "Certificate Collections",
|
|
31685
|
+
description: "Collections associated with this certificate, each with retired amounts"
|
|
31445
31686
|
}),
|
|
31446
|
-
|
|
31687
|
+
credits_retired: uniqueBy(
|
|
31688
|
+
CreditRetirementReceiptCertificateCreditSchema,
|
|
31689
|
+
(credit) => credit.credit_symbol,
|
|
31690
|
+
"Credit symbols within credits_retired must be unique"
|
|
31691
|
+
).min(1).meta({
|
|
31692
|
+
title: "Credits Retired",
|
|
31693
|
+
description: "Breakdown of credits retired from this certificate by symbol"
|
|
31694
|
+
})
|
|
31447
31695
|
}).meta({
|
|
31448
|
-
title: "
|
|
31449
|
-
description: "
|
|
31696
|
+
title: "Certificate",
|
|
31697
|
+
description: "Certificate associated with the retirement"
|
|
31450
31698
|
});
|
|
31451
|
-
var CreditRetirementReceiptCertificateSchema = createReceiptCertificateSchema(
|
|
31452
|
-
{
|
|
31453
|
-
additionalShape: {
|
|
31454
|
-
collections: uniqueBy(
|
|
31455
|
-
CertificateCollectionItemRetirementSchema,
|
|
31456
|
-
(item) => item.slug,
|
|
31457
|
-
"Collection slugs within certificate collections must be unique"
|
|
31458
|
-
).min(1).meta({
|
|
31459
|
-
title: "Certificate Collections",
|
|
31460
|
-
description: "Collections associated with this certificate, each with retired amounts"
|
|
31461
|
-
}),
|
|
31462
|
-
credits_retired: uniqueBy(
|
|
31463
|
-
CreditRetirementReceiptCertificateCreditSchema,
|
|
31464
|
-
(credit) => credit.credit_symbol,
|
|
31465
|
-
"Credit symbols within credits_retired must be unique"
|
|
31466
|
-
).min(1).meta({
|
|
31467
|
-
title: "Credits Retired",
|
|
31468
|
-
description: "Breakdown of credits retired from this certificate by symbol"
|
|
31469
|
-
})
|
|
31470
|
-
},
|
|
31471
|
-
meta: {
|
|
31472
|
-
title: "Certificate",
|
|
31473
|
-
description: "Certificate associated with the retirement"
|
|
31474
|
-
}
|
|
31475
|
-
}
|
|
31476
|
-
);
|
|
31477
31699
|
var CreditRetirementReceiptDataSchema = zod.z.strictObject({
|
|
31478
31700
|
summary: CreditRetirementReceiptSummarySchema,
|
|
31479
31701
|
beneficiary: CreditRetirementReceiptBeneficiarySchema,
|
|
@@ -31623,9 +31845,6 @@ var CreditRetirementReceiptDataSchema = zod.z.strictObject({
|
|
|
31623
31845
|
title: "Credit Retirement Receipt Data",
|
|
31624
31846
|
description: "Complete data structure for a credit retirement receipt"
|
|
31625
31847
|
});
|
|
31626
|
-
var CreditRetirementReceiptIpfsSchemaBase = NftIpfsSchema.omit({
|
|
31627
|
-
original_content_hash: true
|
|
31628
|
-
});
|
|
31629
31848
|
var CreditRetirementReceiptIpfsSchemaMeta = {
|
|
31630
31849
|
title: "CreditRetirementReceipt NFT IPFS Record",
|
|
31631
31850
|
description: "Complete CreditRetirementReceipt NFT IPFS record including attributes and credit retirement data",
|
|
@@ -31634,8 +31853,8 @@ var CreditRetirementReceiptIpfsSchemaMeta = {
|
|
|
31634
31853
|
),
|
|
31635
31854
|
version: getSchemaVersionOrDefault()
|
|
31636
31855
|
};
|
|
31637
|
-
var CreditRetirementReceiptIpfsSchema =
|
|
31638
|
-
schema:
|
|
31856
|
+
var CreditRetirementReceiptIpfsSchema = NftIpfsSchema.safeExtend({
|
|
31857
|
+
schema: NftIpfsSchema.shape.schema.safeExtend({
|
|
31639
31858
|
type: zod.z.literal("CreditRetirementReceipt").meta({
|
|
31640
31859
|
title: "CreditRetirementReceipt Schema Type",
|
|
31641
31860
|
description: "Schema type identifier for this record"
|
|
@@ -31646,26 +31865,39 @@ var CreditRetirementReceiptIpfsSchema = CreditRetirementReceiptIpfsSchemaBase.sa
|
|
|
31646
31865
|
attributes: CreditRetirementReceiptAttributesSchema,
|
|
31647
31866
|
data: CreditRetirementReceiptDataSchema
|
|
31648
31867
|
}).superRefine((value, ctx) => {
|
|
31649
|
-
|
|
31650
|
-
|
|
31651
|
-
|
|
31652
|
-
|
|
31653
|
-
|
|
31654
|
-
|
|
31655
|
-
|
|
31656
|
-
|
|
31657
|
-
|
|
31658
|
-
|
|
31659
|
-
|
|
31660
|
-
|
|
31868
|
+
validateTokenIdInName({
|
|
31869
|
+
ctx,
|
|
31870
|
+
name: value.name,
|
|
31871
|
+
tokenId: value.blockchain.token_id,
|
|
31872
|
+
pattern: /^Credit Retirement Receipt #(\d+)/,
|
|
31873
|
+
path: ["name"]
|
|
31874
|
+
});
|
|
31875
|
+
validateTokenIdInName({
|
|
31876
|
+
ctx,
|
|
31877
|
+
name: value.short_name,
|
|
31878
|
+
tokenId: value.blockchain.token_id,
|
|
31879
|
+
pattern: /^Retirement Receipt #(\d+)/,
|
|
31880
|
+
path: ["short_name"],
|
|
31881
|
+
message: `Short name token_id must match blockchain.token_id: ${value.blockchain.token_id}`
|
|
31882
|
+
});
|
|
31883
|
+
const nameSchema = createCreditRetirementReceiptNameSchema(
|
|
31884
|
+
value.blockchain.token_id
|
|
31661
31885
|
);
|
|
31662
|
-
|
|
31663
|
-
ctx
|
|
31664
|
-
|
|
31665
|
-
|
|
31666
|
-
|
|
31667
|
-
|
|
31668
|
-
|
|
31886
|
+
validateFormattedName({
|
|
31887
|
+
ctx,
|
|
31888
|
+
name: value.name,
|
|
31889
|
+
schema: nameSchema,
|
|
31890
|
+
path: ["name"]
|
|
31891
|
+
});
|
|
31892
|
+
const shortNameSchema = createCreditRetirementReceiptShortNameSchema(
|
|
31893
|
+
value.blockchain.token_id
|
|
31894
|
+
);
|
|
31895
|
+
validateFormattedName({
|
|
31896
|
+
ctx,
|
|
31897
|
+
name: value.short_name,
|
|
31898
|
+
schema: shortNameSchema,
|
|
31899
|
+
path: ["short_name"]
|
|
31900
|
+
});
|
|
31669
31901
|
const attributes = value.attributes;
|
|
31670
31902
|
const data = value.data;
|
|
31671
31903
|
const attributeByTraitType = createAttributeMap(attributes);
|
|
@@ -31767,28 +31999,6 @@ var CreditRetirementReceiptIpfsSchema = CreditRetirementReceiptIpfsSchemaBase.sa
|
|
|
31767
31999
|
});
|
|
31768
32000
|
}
|
|
31769
32001
|
});
|
|
31770
|
-
const nameSchema = createCreditRetirementReceiptNameSchema(
|
|
31771
|
-
value.blockchain.token_id
|
|
31772
|
-
);
|
|
31773
|
-
const nameResult = nameSchema.safeParse(value.name);
|
|
31774
|
-
if (!nameResult.success) {
|
|
31775
|
-
ctx.addIssue({
|
|
31776
|
-
code: "custom",
|
|
31777
|
-
message: nameResult.error.issues[0].message,
|
|
31778
|
-
path: ["name"]
|
|
31779
|
-
});
|
|
31780
|
-
}
|
|
31781
|
-
const shortNameSchema = createCreditRetirementReceiptShortNameSchema(
|
|
31782
|
-
value.blockchain.token_id
|
|
31783
|
-
);
|
|
31784
|
-
const shortNameResult = shortNameSchema.safeParse(value.short_name);
|
|
31785
|
-
if (!shortNameResult.success) {
|
|
31786
|
-
ctx.addIssue({
|
|
31787
|
-
code: "custom",
|
|
31788
|
-
message: shortNameResult.error.issues[0].message,
|
|
31789
|
-
path: ["short_name"]
|
|
31790
|
-
});
|
|
31791
|
-
}
|
|
31792
32002
|
}).meta(CreditRetirementReceiptIpfsSchemaMeta);
|
|
31793
32003
|
var CollectionSchemaMeta = {
|
|
31794
32004
|
title: "Collection IPFS Record",
|
|
@@ -31943,12 +32153,40 @@ var MassIDAuditSummarySchema = zod.z.strictObject({
|
|
|
31943
32153
|
var MassIDAuditDataSchema = zod.z.strictObject({
|
|
31944
32154
|
methodology: MethodologyReferenceSchema,
|
|
31945
32155
|
mass_id: MassIDReferenceSchema,
|
|
31946
|
-
gas_id: GasIDReferenceSchema,
|
|
32156
|
+
gas_id: GasIDReferenceSchema.optional(),
|
|
32157
|
+
recycled_id: RecycledIDReferenceSchema.optional(),
|
|
31947
32158
|
audit_summary: MassIDAuditSummarySchema,
|
|
31948
32159
|
rule_execution_results: AuditRuleExecutionResultsSchema
|
|
32160
|
+
}).superRefine((data, ctx) => {
|
|
32161
|
+
const hasGasId = !!data.gas_id;
|
|
32162
|
+
const hasRecycledId = !!data.recycled_id;
|
|
32163
|
+
if (!hasGasId && !hasRecycledId) {
|
|
32164
|
+
ctx.addIssue({
|
|
32165
|
+
code: "custom",
|
|
32166
|
+
path: ["gas_id"],
|
|
32167
|
+
message: "Either gas_id or recycled_id must be provided"
|
|
32168
|
+
});
|
|
32169
|
+
ctx.addIssue({
|
|
32170
|
+
code: "custom",
|
|
32171
|
+
path: ["recycled_id"],
|
|
32172
|
+
message: "Either gas_id or recycled_id must be provided"
|
|
32173
|
+
});
|
|
32174
|
+
}
|
|
32175
|
+
if (hasGasId && hasRecycledId) {
|
|
32176
|
+
ctx.addIssue({
|
|
32177
|
+
code: "custom",
|
|
32178
|
+
path: ["gas_id"],
|
|
32179
|
+
message: "gas_id and recycled_id are mutually exclusive"
|
|
32180
|
+
});
|
|
32181
|
+
ctx.addIssue({
|
|
32182
|
+
code: "custom",
|
|
32183
|
+
path: ["recycled_id"],
|
|
32184
|
+
message: "gas_id and recycled_id are mutually exclusive"
|
|
32185
|
+
});
|
|
32186
|
+
}
|
|
31949
32187
|
}).meta({
|
|
31950
32188
|
title: "MassID Audit Data",
|
|
31951
|
-
description: "Complete data structure for MassID Audit records"
|
|
32189
|
+
description: "Complete data structure for MassID Audit records. Must include exactly one of gas_id or recycled_id."
|
|
31952
32190
|
});
|
|
31953
32191
|
|
|
31954
32192
|
// src/mass-id-audit/mass-id-audit.schema.ts
|
|
@@ -31987,6 +32225,7 @@ exports.BlockchainNetworkNameSchema = BlockchainNetworkNameSchema;
|
|
|
31987
32225
|
exports.CertificateCollectionItemPurchaseSchema = CertificateCollectionItemPurchaseSchema;
|
|
31988
32226
|
exports.CertificateCollectionItemRetirementSchema = CertificateCollectionItemRetirementSchema;
|
|
31989
32227
|
exports.CertificateIssuanceDateAttributeSchema = CertificateIssuanceDateAttributeSchema;
|
|
32228
|
+
exports.CertificateReferenceBaseSchema = CertificateReferenceBaseSchema;
|
|
31990
32229
|
exports.CertificateTypeSchema = CertificateTypeSchema;
|
|
31991
32230
|
exports.CitySchema = CitySchema;
|
|
31992
32231
|
exports.CollectionNameSchema = CollectionNameSchema;
|
|
@@ -32002,13 +32241,16 @@ exports.CreditPurchaseReceiptDataSchema = CreditPurchaseReceiptDataSchema;
|
|
|
32002
32241
|
exports.CreditPurchaseReceiptIpfsSchema = CreditPurchaseReceiptIpfsSchema;
|
|
32003
32242
|
exports.CreditPurchaseReceiptIpfsSchemaMeta = CreditPurchaseReceiptIpfsSchemaMeta;
|
|
32004
32243
|
exports.CreditPurchaseReceiptNameSchema = CreditPurchaseReceiptNameSchema;
|
|
32244
|
+
exports.CreditPurchaseReceiptReferenceSchema = CreditPurchaseReceiptReferenceSchema;
|
|
32005
32245
|
exports.CreditPurchaseReceiptShortNameSchema = CreditPurchaseReceiptShortNameSchema;
|
|
32006
32246
|
exports.CreditPurchaseReceiptSummarySchema = CreditPurchaseReceiptSummarySchema;
|
|
32247
|
+
exports.CreditReferenceSchema = CreditReferenceSchema;
|
|
32007
32248
|
exports.CreditRetirementReceiptAttributesSchema = CreditRetirementReceiptAttributesSchema;
|
|
32008
32249
|
exports.CreditRetirementReceiptDataSchema = CreditRetirementReceiptDataSchema;
|
|
32009
32250
|
exports.CreditRetirementReceiptIpfsSchema = CreditRetirementReceiptIpfsSchema;
|
|
32010
32251
|
exports.CreditRetirementReceiptIpfsSchemaMeta = CreditRetirementReceiptIpfsSchemaMeta;
|
|
32011
32252
|
exports.CreditRetirementReceiptNameSchema = CreditRetirementReceiptNameSchema;
|
|
32253
|
+
exports.CreditRetirementReceiptReferenceSchema = CreditRetirementReceiptReferenceSchema;
|
|
32012
32254
|
exports.CreditRetirementReceiptShortNameSchema = CreditRetirementReceiptShortNameSchema;
|
|
32013
32255
|
exports.CreditRetirementReceiptSummarySchema = CreditRetirementReceiptSummarySchema;
|
|
32014
32256
|
exports.CreditSchema = CreditSchema;
|
|
@@ -32055,7 +32297,6 @@ exports.MassIDIpfsSchemaMeta = MassIDIpfsSchemaMeta;
|
|
|
32055
32297
|
exports.MassIDNameSchema = MassIDNameSchema;
|
|
32056
32298
|
exports.MassIDRecyclingDateAttributeSchema = MassIDRecyclingDateAttributeSchema;
|
|
32057
32299
|
exports.MassIDReferenceSchema = MassIDReferenceSchema;
|
|
32058
|
-
exports.MassIDReferenceWithContractSchema = MassIDReferenceWithContractSchema;
|
|
32059
32300
|
exports.MassIDShortNameSchema = MassIDShortNameSchema;
|
|
32060
32301
|
exports.MassIDTokenIdAttributeSchema = MassIDTokenIdAttributeSchema;
|
|
32061
32302
|
exports.MethodologyAttributeSchema = MethodologyAttributeSchema;
|
|
@@ -32068,6 +32309,7 @@ exports.MethodologyShortNameSchema = MethodologyShortNameSchema;
|
|
|
32068
32309
|
exports.MethodologySlugSchema = MethodologySlugSchema;
|
|
32069
32310
|
exports.NftAttributeSchema = NftAttributeSchema;
|
|
32070
32311
|
exports.NftIpfsSchema = NftIpfsSchema;
|
|
32312
|
+
exports.NftTokenReferenceBaseSchema = NftTokenReferenceBaseSchema;
|
|
32071
32313
|
exports.NonEmptyStringSchema = NonEmptyStringSchema;
|
|
32072
32314
|
exports.NonNegativeFloatSchema = NonNegativeFloatSchema;
|
|
32073
32315
|
exports.NonNegativeIntegerSchema = NonNegativeIntegerSchema;
|
|
@@ -32086,6 +32328,7 @@ exports.RecycledIDDataSchema = RecycledIDDataSchema;
|
|
|
32086
32328
|
exports.RecycledIDIpfsSchema = RecycledIDIpfsSchema;
|
|
32087
32329
|
exports.RecycledIDIpfsSchemaMeta = RecycledIDIpfsSchemaMeta;
|
|
32088
32330
|
exports.RecycledIDNameSchema = RecycledIDNameSchema;
|
|
32331
|
+
exports.RecycledIDReferenceSchema = RecycledIDReferenceSchema;
|
|
32089
32332
|
exports.RecycledIDShortNameSchema = RecycledIDShortNameSchema;
|
|
32090
32333
|
exports.RewardAllocationSchema = RewardAllocationSchema;
|
|
32091
32334
|
exports.RewardDiscountSchema = RewardDiscountSchema;
|
|
@@ -32101,6 +32344,7 @@ exports.SourceWasteTypeAttributeSchema = SourceWasteTypeAttributeSchema;
|
|
|
32101
32344
|
exports.SourceWeightAttributeSchema = SourceWeightAttributeSchema;
|
|
32102
32345
|
exports.StringifiedTokenIdSchema = StringifiedTokenIdSchema;
|
|
32103
32346
|
exports.TokenIdSchema = TokenIdSchema;
|
|
32347
|
+
exports.TokenReferenceBaseSchema = TokenReferenceBaseSchema;
|
|
32104
32348
|
exports.UnixTimestampSchema = UnixTimestampSchema;
|
|
32105
32349
|
exports.UsdcAmountSchema = UsdcAmountSchema;
|
|
32106
32350
|
exports.UuidSchema = UuidSchema;
|
|
@@ -32125,9 +32369,7 @@ exports.createMassIDNameSchema = createMassIDNameSchema;
|
|
|
32125
32369
|
exports.createMassIDShortNameSchema = createMassIDShortNameSchema;
|
|
32126
32370
|
exports.createNumericAttributeSchema = createNumericAttributeSchema;
|
|
32127
32371
|
exports.createOrderedAttributesSchema = createOrderedAttributesSchema;
|
|
32128
|
-
exports.createReceiptCertificateSchema = createReceiptCertificateSchema;
|
|
32129
32372
|
exports.createReceiptCollectionSchema = createReceiptCollectionSchema;
|
|
32130
|
-
exports.createReceiptCreditSchema = createReceiptCreditSchema;
|
|
32131
32373
|
exports.createRecycledIDNameSchema = createRecycledIDNameSchema;
|
|
32132
32374
|
exports.createRecycledIDShortNameSchema = createRecycledIDShortNameSchema;
|
|
32133
32375
|
exports.createWeightAttributeSchema = createWeightAttributeSchema;
|
|
@@ -32146,9 +32388,13 @@ exports.validateCountMatches = validateCountMatches;
|
|
|
32146
32388
|
exports.validateCreditSlugExists = validateCreditSlugExists;
|
|
32147
32389
|
exports.validateCreditSymbolExists = validateCreditSymbolExists;
|
|
32148
32390
|
exports.validateDateAttribute = validateDateAttribute;
|
|
32391
|
+
exports.validateDateTimeAttribute = validateDateTimeAttribute;
|
|
32392
|
+
exports.validateFormattedName = validateFormattedName;
|
|
32149
32393
|
exports.validateLocationBrazilData = validateLocationBrazilData;
|
|
32394
|
+
exports.validateNumericAttributeValue = validateNumericAttributeValue;
|
|
32150
32395
|
exports.validateRetirementReceiptRequirement = validateRetirementReceiptRequirement;
|
|
32151
32396
|
exports.validateSummaryListMatchesData = validateSummaryListMatchesData;
|
|
32397
|
+
exports.validateTokenIdInName = validateTokenIdInName;
|
|
32152
32398
|
exports.validateTotalMatches = validateTotalMatches;
|
|
32153
32399
|
//# sourceMappingURL=index.cjs.map
|
|
32154
32400
|
//# sourceMappingURL=index.cjs.map
|