@carrot-foundation/schemas 0.4.2 → 0.5.0

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.d.cts CHANGED
@@ -1943,18 +1943,18 @@ declare const CreditPurchaseReceiptAttributesSchema: z.ZodArray<z.ZodObject<{
1943
1943
  type CreditPurchaseReceiptAttributes = z.infer<typeof CreditPurchaseReceiptAttributesSchema>;
1944
1944
 
1945
1945
  declare const CreditPurchaseReceiptIdentitySchema: z.ZodObject<{
1946
- name: z.ZodString;
1947
- external_id: z.ZodUUID;
1948
- external_url: z.ZodURL;
1946
+ name: z.ZodOptional<z.ZodString>;
1947
+ external_id: z.ZodOptional<z.ZodUUID>;
1948
+ external_url: z.ZodOptional<z.ZodURL>;
1949
1949
  }, z.core.$strict>;
1950
1950
  type CreditPurchaseReceiptIdentity = z.infer<typeof CreditPurchaseReceiptIdentitySchema>;
1951
1951
  declare const CreditPurchaseReceiptBuyerSchema: z.ZodObject<{
1952
1952
  wallet_address: z.ZodString;
1953
1953
  id: z.ZodOptional<z.ZodUUID>;
1954
1954
  identity: z.ZodOptional<z.ZodObject<{
1955
- name: z.ZodString;
1956
- external_id: z.ZodUUID;
1957
- external_url: z.ZodURL;
1955
+ name: z.ZodOptional<z.ZodString>;
1956
+ external_id: z.ZodOptional<z.ZodUUID>;
1957
+ external_url: z.ZodOptional<z.ZodURL>;
1958
1958
  }, z.core.$strict>>;
1959
1959
  }, z.core.$strict>;
1960
1960
  type CreditPurchaseReceiptBuyer = z.infer<typeof CreditPurchaseReceiptBuyerSchema>;
@@ -2044,9 +2044,9 @@ declare const CreditPurchaseReceiptDataSchema: z.ZodObject<{
2044
2044
  wallet_address: z.ZodString;
2045
2045
  id: z.ZodOptional<z.ZodUUID>;
2046
2046
  identity: z.ZodOptional<z.ZodObject<{
2047
- name: z.ZodString;
2048
- external_id: z.ZodUUID;
2049
- external_url: z.ZodURL;
2047
+ name: z.ZodOptional<z.ZodString>;
2048
+ external_id: z.ZodOptional<z.ZodUUID>;
2049
+ external_url: z.ZodOptional<z.ZodURL>;
2050
2050
  }, z.core.$strict>>;
2051
2051
  }, z.core.$strict>;
2052
2052
  collections: z.ZodArray<z.ZodObject<{
@@ -2202,9 +2202,9 @@ declare const CreditPurchaseReceiptIpfsSchema: z.ZodObject<{
2202
2202
  wallet_address: z.ZodString;
2203
2203
  id: z.ZodOptional<z.ZodUUID>;
2204
2204
  identity: z.ZodOptional<z.ZodObject<{
2205
- name: z.ZodString;
2206
- external_id: z.ZodUUID;
2207
- external_url: z.ZodURL;
2205
+ name: z.ZodOptional<z.ZodString>;
2206
+ external_id: z.ZodOptional<z.ZodUUID>;
2207
+ external_url: z.ZodOptional<z.ZodURL>;
2208
2208
  }, z.core.$strict>>;
2209
2209
  }, z.core.$strict>;
2210
2210
  collections: z.ZodArray<z.ZodObject<{
@@ -2296,26 +2296,26 @@ declare const CreditRetirementReceiptAttributesSchema: z.ZodArray<z.ZodObject<{
2296
2296
  type CreditRetirementReceiptAttributes = z.infer<typeof CreditRetirementReceiptAttributesSchema>;
2297
2297
 
2298
2298
  declare const CreditRetirementReceiptIdentitySchema: z.ZodObject<{
2299
- name: z.ZodString;
2300
- external_id: z.ZodUUID;
2301
- external_url: z.ZodURL;
2299
+ name: z.ZodOptional<z.ZodString>;
2300
+ external_id: z.ZodOptional<z.ZodUUID>;
2301
+ external_url: z.ZodOptional<z.ZodURL>;
2302
2302
  }, z.core.$strict>;
2303
2303
  type CreditRetirementReceiptIdentity = z.infer<typeof CreditRetirementReceiptIdentitySchema>;
2304
2304
  declare const CreditRetirementReceiptBeneficiarySchema: z.ZodObject<{
2305
2305
  beneficiary_id: z.ZodUUID;
2306
- identity: z.ZodObject<{
2307
- name: z.ZodString;
2308
- external_id: z.ZodUUID;
2309
- external_url: z.ZodURL;
2310
- }, z.core.$strict>;
2306
+ identity: z.ZodOptional<z.ZodObject<{
2307
+ name: z.ZodOptional<z.ZodString>;
2308
+ external_id: z.ZodOptional<z.ZodUUID>;
2309
+ external_url: z.ZodOptional<z.ZodURL>;
2310
+ }, z.core.$strict>>;
2311
2311
  }, z.core.$strict>;
2312
2312
  type CreditRetirementReceiptBeneficiary = z.infer<typeof CreditRetirementReceiptBeneficiarySchema>;
2313
2313
  declare const CreditRetirementReceiptCreditHolderSchema: z.ZodObject<{
2314
2314
  wallet_address: z.ZodString;
2315
2315
  identity: z.ZodOptional<z.ZodObject<{
2316
- name: z.ZodString;
2317
- external_id: z.ZodUUID;
2318
- external_url: z.ZodURL;
2316
+ name: z.ZodOptional<z.ZodString>;
2317
+ external_id: z.ZodOptional<z.ZodUUID>;
2318
+ external_url: z.ZodOptional<z.ZodURL>;
2319
2319
  }, z.core.$strict>>;
2320
2320
  }, z.core.$strict>;
2321
2321
  type CreditRetirementReceiptCreditHolder = z.infer<typeof CreditRetirementReceiptCreditHolderSchema>;
@@ -2416,18 +2416,18 @@ declare const CreditRetirementReceiptDataSchema: z.ZodObject<{
2416
2416
  }, z.core.$strict>;
2417
2417
  beneficiary: z.ZodObject<{
2418
2418
  beneficiary_id: z.ZodUUID;
2419
- identity: z.ZodObject<{
2420
- name: z.ZodString;
2421
- external_id: z.ZodUUID;
2422
- external_url: z.ZodURL;
2423
- }, z.core.$strict>;
2419
+ identity: z.ZodOptional<z.ZodObject<{
2420
+ name: z.ZodOptional<z.ZodString>;
2421
+ external_id: z.ZodOptional<z.ZodUUID>;
2422
+ external_url: z.ZodOptional<z.ZodURL>;
2423
+ }, z.core.$strict>>;
2424
2424
  }, z.core.$strict>;
2425
2425
  credit_holder: z.ZodObject<{
2426
2426
  wallet_address: z.ZodString;
2427
2427
  identity: z.ZodOptional<z.ZodObject<{
2428
- name: z.ZodString;
2429
- external_id: z.ZodUUID;
2430
- external_url: z.ZodURL;
2428
+ name: z.ZodOptional<z.ZodString>;
2429
+ external_id: z.ZodOptional<z.ZodUUID>;
2430
+ external_url: z.ZodOptional<z.ZodURL>;
2431
2431
  }, z.core.$strict>>;
2432
2432
  }, z.core.$strict>;
2433
2433
  collections: z.ZodArray<z.ZodObject<{
@@ -2514,7 +2514,7 @@ type CreditRetirementReceiptData = z.infer<typeof CreditRetirementReceiptDataSch
2514
2514
 
2515
2515
  declare const CreditRetirementReceiptIpfsSchemaMeta: {
2516
2516
  readonly title: "CreditRetirementReceipt NFT IPFS Record";
2517
- readonly description: "Complete CreditRetirementReceipt NFT IPFS record including retirement summary, beneficiary and credit holder details, credit breakdowns, certificate allocations, and NFT display attributes";
2517
+ readonly description: "Complete CreditRetirementReceipt NFT IPFS record including retirement summary, beneficiary and credit holder details (identity optional), credit breakdowns, certificate allocations, and NFT display attributes";
2518
2518
  readonly $id: string;
2519
2519
  readonly version: string;
2520
2520
  };
@@ -2588,18 +2588,18 @@ declare const CreditRetirementReceiptIpfsSchema: z.ZodObject<{
2588
2588
  }, z.core.$strict>;
2589
2589
  beneficiary: z.ZodObject<{
2590
2590
  beneficiary_id: z.ZodUUID;
2591
- identity: z.ZodObject<{
2592
- name: z.ZodString;
2593
- external_id: z.ZodUUID;
2594
- external_url: z.ZodURL;
2595
- }, z.core.$strict>;
2591
+ identity: z.ZodOptional<z.ZodObject<{
2592
+ name: z.ZodOptional<z.ZodString>;
2593
+ external_id: z.ZodOptional<z.ZodUUID>;
2594
+ external_url: z.ZodOptional<z.ZodURL>;
2595
+ }, z.core.$strict>>;
2596
2596
  }, z.core.$strict>;
2597
2597
  credit_holder: z.ZodObject<{
2598
2598
  wallet_address: z.ZodString;
2599
2599
  identity: z.ZodOptional<z.ZodObject<{
2600
- name: z.ZodString;
2601
- external_id: z.ZodUUID;
2602
- external_url: z.ZodURL;
2600
+ name: z.ZodOptional<z.ZodString>;
2601
+ external_id: z.ZodOptional<z.ZodUUID>;
2602
+ external_url: z.ZodOptional<z.ZodURL>;
2603
2603
  }, z.core.$strict>>;
2604
2604
  }, z.core.$strict>;
2605
2605
  collections: z.ZodArray<z.ZodObject<{
@@ -3926,9 +3926,9 @@ declare const CreditRetirementReceiptSummarySchema: z.ZodObject<{
3926
3926
  }, z.core.$strict>;
3927
3927
  type CreditRetirementReceiptSummary = z.infer<typeof CreditRetirementReceiptSummarySchema>;
3928
3928
  declare const ReceiptIdentitySchema: z.ZodObject<{
3929
- name: z.ZodString;
3930
- external_id: z.ZodUUID;
3931
- external_url: z.ZodURL;
3929
+ name: z.ZodOptional<z.ZodString>;
3930
+ external_id: z.ZodOptional<z.ZodUUID>;
3931
+ external_url: z.ZodOptional<z.ZodURL>;
3932
3932
  }, z.core.$strict>;
3933
3933
  type ReceiptIdentity = z.infer<typeof ReceiptIdentitySchema>;
3934
3934
  declare function createReceiptCollectionSchema(params: {
package/dist/index.d.ts CHANGED
@@ -1943,18 +1943,18 @@ declare const CreditPurchaseReceiptAttributesSchema: z.ZodArray<z.ZodObject<{
1943
1943
  type CreditPurchaseReceiptAttributes = z.infer<typeof CreditPurchaseReceiptAttributesSchema>;
1944
1944
 
1945
1945
  declare const CreditPurchaseReceiptIdentitySchema: z.ZodObject<{
1946
- name: z.ZodString;
1947
- external_id: z.ZodUUID;
1948
- external_url: z.ZodURL;
1946
+ name: z.ZodOptional<z.ZodString>;
1947
+ external_id: z.ZodOptional<z.ZodUUID>;
1948
+ external_url: z.ZodOptional<z.ZodURL>;
1949
1949
  }, z.core.$strict>;
1950
1950
  type CreditPurchaseReceiptIdentity = z.infer<typeof CreditPurchaseReceiptIdentitySchema>;
1951
1951
  declare const CreditPurchaseReceiptBuyerSchema: z.ZodObject<{
1952
1952
  wallet_address: z.ZodString;
1953
1953
  id: z.ZodOptional<z.ZodUUID>;
1954
1954
  identity: z.ZodOptional<z.ZodObject<{
1955
- name: z.ZodString;
1956
- external_id: z.ZodUUID;
1957
- external_url: z.ZodURL;
1955
+ name: z.ZodOptional<z.ZodString>;
1956
+ external_id: z.ZodOptional<z.ZodUUID>;
1957
+ external_url: z.ZodOptional<z.ZodURL>;
1958
1958
  }, z.core.$strict>>;
1959
1959
  }, z.core.$strict>;
1960
1960
  type CreditPurchaseReceiptBuyer = z.infer<typeof CreditPurchaseReceiptBuyerSchema>;
@@ -2044,9 +2044,9 @@ declare const CreditPurchaseReceiptDataSchema: z.ZodObject<{
2044
2044
  wallet_address: z.ZodString;
2045
2045
  id: z.ZodOptional<z.ZodUUID>;
2046
2046
  identity: z.ZodOptional<z.ZodObject<{
2047
- name: z.ZodString;
2048
- external_id: z.ZodUUID;
2049
- external_url: z.ZodURL;
2047
+ name: z.ZodOptional<z.ZodString>;
2048
+ external_id: z.ZodOptional<z.ZodUUID>;
2049
+ external_url: z.ZodOptional<z.ZodURL>;
2050
2050
  }, z.core.$strict>>;
2051
2051
  }, z.core.$strict>;
2052
2052
  collections: z.ZodArray<z.ZodObject<{
@@ -2202,9 +2202,9 @@ declare const CreditPurchaseReceiptIpfsSchema: z.ZodObject<{
2202
2202
  wallet_address: z.ZodString;
2203
2203
  id: z.ZodOptional<z.ZodUUID>;
2204
2204
  identity: z.ZodOptional<z.ZodObject<{
2205
- name: z.ZodString;
2206
- external_id: z.ZodUUID;
2207
- external_url: z.ZodURL;
2205
+ name: z.ZodOptional<z.ZodString>;
2206
+ external_id: z.ZodOptional<z.ZodUUID>;
2207
+ external_url: z.ZodOptional<z.ZodURL>;
2208
2208
  }, z.core.$strict>>;
2209
2209
  }, z.core.$strict>;
2210
2210
  collections: z.ZodArray<z.ZodObject<{
@@ -2296,26 +2296,26 @@ declare const CreditRetirementReceiptAttributesSchema: z.ZodArray<z.ZodObject<{
2296
2296
  type CreditRetirementReceiptAttributes = z.infer<typeof CreditRetirementReceiptAttributesSchema>;
2297
2297
 
2298
2298
  declare const CreditRetirementReceiptIdentitySchema: z.ZodObject<{
2299
- name: z.ZodString;
2300
- external_id: z.ZodUUID;
2301
- external_url: z.ZodURL;
2299
+ name: z.ZodOptional<z.ZodString>;
2300
+ external_id: z.ZodOptional<z.ZodUUID>;
2301
+ external_url: z.ZodOptional<z.ZodURL>;
2302
2302
  }, z.core.$strict>;
2303
2303
  type CreditRetirementReceiptIdentity = z.infer<typeof CreditRetirementReceiptIdentitySchema>;
2304
2304
  declare const CreditRetirementReceiptBeneficiarySchema: z.ZodObject<{
2305
2305
  beneficiary_id: z.ZodUUID;
2306
- identity: z.ZodObject<{
2307
- name: z.ZodString;
2308
- external_id: z.ZodUUID;
2309
- external_url: z.ZodURL;
2310
- }, z.core.$strict>;
2306
+ identity: z.ZodOptional<z.ZodObject<{
2307
+ name: z.ZodOptional<z.ZodString>;
2308
+ external_id: z.ZodOptional<z.ZodUUID>;
2309
+ external_url: z.ZodOptional<z.ZodURL>;
2310
+ }, z.core.$strict>>;
2311
2311
  }, z.core.$strict>;
2312
2312
  type CreditRetirementReceiptBeneficiary = z.infer<typeof CreditRetirementReceiptBeneficiarySchema>;
2313
2313
  declare const CreditRetirementReceiptCreditHolderSchema: z.ZodObject<{
2314
2314
  wallet_address: z.ZodString;
2315
2315
  identity: z.ZodOptional<z.ZodObject<{
2316
- name: z.ZodString;
2317
- external_id: z.ZodUUID;
2318
- external_url: z.ZodURL;
2316
+ name: z.ZodOptional<z.ZodString>;
2317
+ external_id: z.ZodOptional<z.ZodUUID>;
2318
+ external_url: z.ZodOptional<z.ZodURL>;
2319
2319
  }, z.core.$strict>>;
2320
2320
  }, z.core.$strict>;
2321
2321
  type CreditRetirementReceiptCreditHolder = z.infer<typeof CreditRetirementReceiptCreditHolderSchema>;
@@ -2416,18 +2416,18 @@ declare const CreditRetirementReceiptDataSchema: z.ZodObject<{
2416
2416
  }, z.core.$strict>;
2417
2417
  beneficiary: z.ZodObject<{
2418
2418
  beneficiary_id: z.ZodUUID;
2419
- identity: z.ZodObject<{
2420
- name: z.ZodString;
2421
- external_id: z.ZodUUID;
2422
- external_url: z.ZodURL;
2423
- }, z.core.$strict>;
2419
+ identity: z.ZodOptional<z.ZodObject<{
2420
+ name: z.ZodOptional<z.ZodString>;
2421
+ external_id: z.ZodOptional<z.ZodUUID>;
2422
+ external_url: z.ZodOptional<z.ZodURL>;
2423
+ }, z.core.$strict>>;
2424
2424
  }, z.core.$strict>;
2425
2425
  credit_holder: z.ZodObject<{
2426
2426
  wallet_address: z.ZodString;
2427
2427
  identity: z.ZodOptional<z.ZodObject<{
2428
- name: z.ZodString;
2429
- external_id: z.ZodUUID;
2430
- external_url: z.ZodURL;
2428
+ name: z.ZodOptional<z.ZodString>;
2429
+ external_id: z.ZodOptional<z.ZodUUID>;
2430
+ external_url: z.ZodOptional<z.ZodURL>;
2431
2431
  }, z.core.$strict>>;
2432
2432
  }, z.core.$strict>;
2433
2433
  collections: z.ZodArray<z.ZodObject<{
@@ -2514,7 +2514,7 @@ type CreditRetirementReceiptData = z.infer<typeof CreditRetirementReceiptDataSch
2514
2514
 
2515
2515
  declare const CreditRetirementReceiptIpfsSchemaMeta: {
2516
2516
  readonly title: "CreditRetirementReceipt NFT IPFS Record";
2517
- readonly description: "Complete CreditRetirementReceipt NFT IPFS record including retirement summary, beneficiary and credit holder details, credit breakdowns, certificate allocations, and NFT display attributes";
2517
+ readonly description: "Complete CreditRetirementReceipt NFT IPFS record including retirement summary, beneficiary and credit holder details (identity optional), credit breakdowns, certificate allocations, and NFT display attributes";
2518
2518
  readonly $id: string;
2519
2519
  readonly version: string;
2520
2520
  };
@@ -2588,18 +2588,18 @@ declare const CreditRetirementReceiptIpfsSchema: z.ZodObject<{
2588
2588
  }, z.core.$strict>;
2589
2589
  beneficiary: z.ZodObject<{
2590
2590
  beneficiary_id: z.ZodUUID;
2591
- identity: z.ZodObject<{
2592
- name: z.ZodString;
2593
- external_id: z.ZodUUID;
2594
- external_url: z.ZodURL;
2595
- }, z.core.$strict>;
2591
+ identity: z.ZodOptional<z.ZodObject<{
2592
+ name: z.ZodOptional<z.ZodString>;
2593
+ external_id: z.ZodOptional<z.ZodUUID>;
2594
+ external_url: z.ZodOptional<z.ZodURL>;
2595
+ }, z.core.$strict>>;
2596
2596
  }, z.core.$strict>;
2597
2597
  credit_holder: z.ZodObject<{
2598
2598
  wallet_address: z.ZodString;
2599
2599
  identity: z.ZodOptional<z.ZodObject<{
2600
- name: z.ZodString;
2601
- external_id: z.ZodUUID;
2602
- external_url: z.ZodURL;
2600
+ name: z.ZodOptional<z.ZodString>;
2601
+ external_id: z.ZodOptional<z.ZodUUID>;
2602
+ external_url: z.ZodOptional<z.ZodURL>;
2603
2603
  }, z.core.$strict>>;
2604
2604
  }, z.core.$strict>;
2605
2605
  collections: z.ZodArray<z.ZodObject<{
@@ -3926,9 +3926,9 @@ declare const CreditRetirementReceiptSummarySchema: z.ZodObject<{
3926
3926
  }, z.core.$strict>;
3927
3927
  type CreditRetirementReceiptSummary = z.infer<typeof CreditRetirementReceiptSummarySchema>;
3928
3928
  declare const ReceiptIdentitySchema: z.ZodObject<{
3929
- name: z.ZodString;
3930
- external_id: z.ZodUUID;
3931
- external_url: z.ZodURL;
3929
+ name: z.ZodOptional<z.ZodString>;
3930
+ external_id: z.ZodOptional<z.ZodUUID>;
3931
+ external_url: z.ZodOptional<z.ZodURL>;
3932
3932
  }, z.core.$strict>;
3933
3933
  type ReceiptIdentity = z.infer<typeof ReceiptIdentitySchema>;
3934
3934
  declare function createReceiptCollectionSchema(params: {
package/dist/index.js CHANGED
@@ -29409,22 +29409,27 @@ var CreditRetirementReceiptSummarySchema = SummaryBaseSchema.safeExtend({
29409
29409
  description: "Summary totals for the credit retirement including credit quantity, certificate count, and timestamp"
29410
29410
  });
29411
29411
  var ReceiptIdentitySchema = z.strictObject({
29412
- name: NonEmptyStringSchema.max(100).meta({
29412
+ name: NonEmptyStringSchema.max(100).optional().meta({
29413
29413
  title: "Identity Name",
29414
29414
  description: "Display name of the buyer or beneficiary on the receipt",
29415
29415
  examples: ["EcoTech Solutions Inc.", "Climate Action Corp"]
29416
29416
  }),
29417
- external_id: ExternalIdSchema.meta({
29417
+ external_id: ExternalIdSchema.optional().meta({
29418
29418
  title: "Identity External ID",
29419
29419
  description: "Unique identifier for the buyer or beneficiary in the Carrot platform"
29420
29420
  }),
29421
- external_url: ExternalUrlSchema.meta({
29421
+ external_url: ExternalUrlSchema.optional().meta({
29422
29422
  title: "Identity External URL",
29423
29423
  description: "Link to the buyer or beneficiary profile page on the Carrot platform"
29424
29424
  })
29425
- }).meta({
29425
+ }).refine(
29426
+ (value) => value.name !== void 0 || value.external_id !== void 0 || value.external_url !== void 0,
29427
+ {
29428
+ message: "identity must include at least one of: name, external_id, external_url"
29429
+ }
29430
+ ).meta({
29426
29431
  title: "Identity",
29427
- description: "Identity information for the buyer or beneficiary associated with this receipt"
29432
+ description: "Identity information for the buyer or beneficiary associated with this receipt. All fields are optional, but at least one must be provided when the identity block is present."
29428
29433
  });
29429
29434
  function createReceiptCollectionSchema(params) {
29430
29435
  const { meta } = params;
@@ -29480,7 +29485,7 @@ function buildSchemaUrl(schemaPath) {
29480
29485
  return `${getSchemaBaseUrl()}/${cleanPath}`;
29481
29486
  }
29482
29487
  function getSchemaVersionOrDefault() {
29483
- return "0.4.2";
29488
+ return "0.5.0";
29484
29489
  }
29485
29490
 
29486
29491
  // src/shared/schema-validation.ts
@@ -31473,11 +31478,11 @@ var CreditRetirementReceiptPurchaseReceiptAttributeSchema = NftAttributeSchema.s
31473
31478
  });
31474
31479
  var REQUIRED_CREDIT_RETIREMENT_RECEIPT_ATTRIBUTES = [
31475
31480
  CreditRetirementReceiptTotalCreditsAttributeSchema,
31476
- CreditRetirementReceiptBeneficiaryAttributeSchema,
31477
31481
  CreditRetirementReceiptRetirementDateAttributeSchema,
31478
31482
  CreditRetirementReceiptCertificatesAttributeSchema
31479
31483
  ];
31480
31484
  var CONDITIONAL_CREDIT_RETIREMENT_RECEIPT_ATTRIBUTES = [
31485
+ CreditRetirementReceiptBeneficiaryAttributeSchema,
31481
31486
  CreditRetirementReceiptCreditHolderAttributeSchema,
31482
31487
  CreditRetirementReceiptPurchaseDateAttributeSchema,
31483
31488
  CreditRetirementReceiptPurchaseReceiptAttributeSchema
@@ -31492,11 +31497,10 @@ var CreditRetirementReceiptAttributesSchema = createOrderedAttributesSchema({
31492
31497
  ...DYNAMIC_CREDIT_RETIREMENT_RECEIPT_ATTRIBUTES
31493
31498
  ],
31494
31499
  title: "Credit Retirement Receipt NFT Attribute Array",
31495
- description: "Attributes for credit retirement receipts including per-credit breakdowns, totals, beneficiary, credit holder, retirement date, certificate count, and optional purchase info. Fixed required attributes: Total Credits Retired, Beneficiary, Retirement Date, Certificates Retired. Conditional attributes: Credit Holder (required when credit_holder.identity.name is provided), Purchase Date (optional, when purchase_receipt is present), Purchase Receipt (optional, when purchase_receipt is present). Dynamic attributes: Credit attributes (one per credit symbol in data.credits).",
31500
+ description: "Attributes for credit retirement receipts including per-credit breakdowns, totals, beneficiary, credit holder, retirement date, certificate count, and optional purchase info. Fixed required attributes: Total Credits Retired, Retirement Date, Certificates Retired. Conditional attributes: Beneficiary (required when beneficiary.identity.name is provided), Credit Holder (required when credit_holder.identity.name is provided), Purchase Date (optional, when purchase_receipt is present), Purchase Receipt (optional, when purchase_receipt is present). Dynamic attributes: Credit attributes (one per credit symbol in data.credits).",
31496
31501
  uniqueBySelector: (attribute) => attribute.trait_type,
31497
31502
  requiredTraitTypes: [
31498
31503
  "Total Credits Retired",
31499
- "Beneficiary",
31500
31504
  "Retirement Date",
31501
31505
  "Certificates Retired"
31502
31506
  ]
@@ -31507,7 +31511,7 @@ var CreditRetirementReceiptBeneficiarySchema = z.strictObject({
31507
31511
  title: "Retirement Beneficiary ID",
31508
31512
  description: "UUID identifying the beneficiary of the retirement (bytes16 normalized to UUID)"
31509
31513
  }),
31510
- identity: CreditRetirementReceiptIdentitySchema
31514
+ identity: CreditRetirementReceiptIdentitySchema.optional()
31511
31515
  }).meta({
31512
31516
  title: "Beneficiary",
31513
31517
  description: "Beneficiary receiving the retirement benefit"
@@ -31727,7 +31731,7 @@ var CreditRetirementReceiptDataSchema = z.strictObject({
31727
31731
  });
31728
31732
  var CreditRetirementReceiptIpfsSchemaMeta = {
31729
31733
  title: "CreditRetirementReceipt NFT IPFS Record",
31730
- description: "Complete CreditRetirementReceipt NFT IPFS record including retirement summary, beneficiary and credit holder details, credit breakdowns, certificate allocations, and NFT display attributes",
31734
+ description: "Complete CreditRetirementReceipt NFT IPFS record including retirement summary, beneficiary and credit holder details (identity optional), credit breakdowns, certificate allocations, and NFT display attributes",
31731
31735
  $id: buildSchemaUrl(
31732
31736
  "credit-retirement-receipt/credit-retirement-receipt.schema.json"
31733
31737
  ),
@@ -31797,14 +31801,17 @@ var CreditRetirementReceiptIpfsSchema = NftIpfsSchema.safeExtend({
31797
31801
  missingMessage: 'Attribute "Certificates Retired" is required',
31798
31802
  mismatchMessage: 'Attribute "Certificates Retired" must match data.summary.total_certificates'
31799
31803
  });
31800
- validateAttributeValue({
31801
- ctx,
31802
- attributeByTraitType,
31803
- traitType: "Beneficiary",
31804
- expectedValue: String(data.beneficiary.identity.name),
31805
- missingMessage: 'Attribute "Beneficiary" is required',
31806
- mismatchMessage: 'Attribute "Beneficiary" must match beneficiary.identity.name'
31807
- });
31804
+ const beneficiaryName = data.beneficiary.identity?.name;
31805
+ if (beneficiaryName) {
31806
+ validateAttributeValue({
31807
+ ctx,
31808
+ attributeByTraitType,
31809
+ traitType: "Beneficiary",
31810
+ expectedValue: String(beneficiaryName),
31811
+ missingMessage: 'Attribute "Beneficiary" is required when beneficiary.identity.name is provided',
31812
+ mismatchMessage: 'Attribute "Beneficiary" must match beneficiary.identity.name'
31813
+ });
31814
+ }
31808
31815
  const creditHolderName = data.credit_holder.identity?.name;
31809
31816
  if (creditHolderName) {
31810
31817
  validateAttributeValue({