@carrot-foundation/schemas 3.0.0 → 3.1.1

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 CHANGED
@@ -29112,6 +29112,38 @@ var MethodologyReferenceSchema = zod.z.strictObject({
29112
29112
  title: "Methodology Reference",
29113
29113
  description: "Reference to a methodology record"
29114
29114
  });
29115
+ var OriginalNftSchema = zod.z.strictObject({
29116
+ chain_id: PositiveIntegerSchema.meta({
29117
+ title: "Chain ID",
29118
+ description: "Identifier of the blockchain network on which the original asset was minted",
29119
+ examples: [137, 80002]
29120
+ }),
29121
+ smart_contract_address: SmartContractAddressSchema.meta({
29122
+ title: "Smart Contract Address",
29123
+ description: "Address of the smart contract that minted and manages the original tokenized asset"
29124
+ }),
29125
+ token_id: TokenIdSchema.meta({
29126
+ title: "Token ID",
29127
+ description: "Identifier of the original tokenized asset within its smart contract"
29128
+ })
29129
+ }).meta({
29130
+ title: "Original NFT",
29131
+ description: "On-chain reference to the tokenized asset associated with the original sale"
29132
+ });
29133
+ var OriginalSaleReferenceSchema = zod.z.strictObject({
29134
+ order_id: UuidSchema.meta({
29135
+ title: "Order ID",
29136
+ description: "Identifier of the originating sale order"
29137
+ }),
29138
+ sold_at: IsoDateTimeSchema.meta({
29139
+ title: "Sold At",
29140
+ description: "Timestamp at which the original sale was completed"
29141
+ }),
29142
+ original_nft: OriginalNftSchema
29143
+ }).meta({
29144
+ title: "Original Sale Reference",
29145
+ description: "Reference to the sale that originated this record, linking it to the originating sale order and its tokenized asset"
29146
+ });
29115
29147
 
29116
29148
  // src/shared/schemas/references/receipt-reference.schema.ts
29117
29149
  var CreditPurchaseReceiptReferenceSchema = NftTokenReferenceBaseSchema.meta({
@@ -29490,7 +29522,7 @@ function buildSchemaUrl(schemaPath) {
29490
29522
  return `${getSchemaBaseUrl()}/${cleanPath}`;
29491
29523
  }
29492
29524
  function getSchemaVersionOrDefault() {
29493
- return "3.0.0";
29525
+ return "3.1.1";
29494
29526
  }
29495
29527
 
29496
29528
  // src/shared/schema-validation.ts
@@ -31156,7 +31188,8 @@ var CreditPurchaseReceiptDataSchema = zod.z.strictObject({
31156
31188
  title: "Certificates",
31157
31189
  description: "Environmental certificates allocated in this purchase, each linking a credit type to collection-level purchased and retired amounts"
31158
31190
  }),
31159
- retirement_receipt: CreditPurchaseReceiptRetirementReceiptSchema.optional()
31191
+ retirement_receipt: CreditPurchaseReceiptRetirementReceiptSchema.optional(),
31192
+ original_sale: OriginalSaleReferenceSchema.optional()
31160
31193
  }).superRefine((data, ctx) => {
31161
31194
  validateCountMatches({
31162
31195
  ctx,
@@ -31408,7 +31441,7 @@ var CreditPurchaseReceiptIpfsSchema = NftIpfsSchema.safeExtend({
31408
31441
  message: `Attribute for credit symbol ${credit.symbol} is required`,
31409
31442
  path: ["attributes"]
31410
31443
  });
31411
- } else if (Number(attribute.value) !== expectedTotal) {
31444
+ } else if (!nearlyEqual(Number(attribute.value), expectedTotal)) {
31412
31445
  ctx.addIssue({
31413
31446
  code: "custom",
31414
31447
  message: `Attribute for credit symbol ${credit.symbol} must match sum of certificates[].purchased_amount for the credit symbol`,
@@ -31901,7 +31934,7 @@ var CreditRetirementReceiptIpfsSchema = NftIpfsSchema.safeExtend({
31901
31934
  message: `Attribute for credit symbol ${credit.symbol} is required`,
31902
31935
  path: ["attributes"]
31903
31936
  });
31904
- } else if (Number(attribute.value) !== expectedTotal) {
31937
+ } else if (!nearlyEqual(Number(attribute.value), expectedTotal)) {
31905
31938
  ctx.addIssue({
31906
31939
  code: "custom",
31907
31940
  message: `Attribute for credit symbol ${credit.symbol} must match sum of certificate credits_retired amounts for the credit symbol`,
@@ -32223,6 +32256,7 @@ exports.NonNegativeFloatSchema = NonNegativeFloatSchema;
32223
32256
  exports.NonNegativeIntegerSchema = NonNegativeIntegerSchema;
32224
32257
  exports.OriginCityAttributeSchema = OriginCityAttributeSchema;
32225
32258
  exports.OriginCountrySubdivisionAttributeSchema = OriginCountrySubdivisionAttributeSchema;
32259
+ exports.OriginalSaleReferenceSchema = OriginalSaleReferenceSchema;
32226
32260
  exports.ParticipantIdHashSchema = ParticipantIdHashSchema;
32227
32261
  exports.ParticipantRoleSchema = ParticipantRoleSchema;
32228
32262
  exports.ParticipantSchema = ParticipantSchema;