@campnetwork/origin 1.3.0-alpha.6 → 1.3.0-alpha.7

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/core.d.ts CHANGED
@@ -459,9 +459,13 @@ interface RaiseDisputeSmartResult {
459
459
  }
460
460
  /**
461
461
  * Raises a dispute with automatic evidence upload to IPFS.
462
- * Uploads evidence JSON to IPFS, hashes the CID to bytes32 for on-chain storage,
462
+ * Uploads evidence JSON to IPFS, encodes the CID to bytes32 for on-chain storage,
463
463
  * and calls raiseDispute.
464
464
  *
465
+ * The CID is encoded by stripping the 0x1220 multihash prefix from CIDv0,
466
+ * leaving only the 32-byte SHA-256 digest. This encoding is reversible,
467
+ * allowing the original CID to be reconstructed from the on-chain data.
468
+ *
465
469
  * @param targetIpId The token ID of the IP NFT to dispute.
466
470
  * @param evidence The evidence JSON object to upload to IPFS.
467
471
  * @param disputeTag A tag identifying the type of dispute.
@@ -475,13 +479,11 @@ interface RaiseDisputeSmartResult {
475
479
  * "0x696e6672696e67656d656e74..." // dispute tag
476
480
  * );
477
481
  *
478
- * // Store the CID for evidence retrieval
482
+ * // The CID can be recovered from evidenceHash using decodeCidFromBytes32
479
483
  * console.log("Evidence CID:", result.evidenceCid);
480
484
  *
481
- * // Fetch evidence later via IPFS gateway
485
+ * // Fetch evidence via IPFS gateway
482
486
  * // https://ipfs.io/ipfs/{result.evidenceCid}
483
- *
484
- * // Verify evidence hash matches on-chain: keccak256(toHex(evidenceCid)) === evidenceHash
485
487
  * ```
486
488
  */
487
489
  declare function raiseDisputeSmart(this: Origin, targetIpId: bigint, evidence: Record<string, any>, disputeTag: Hex): Promise<RaiseDisputeSmartResult>;
@@ -501,6 +503,42 @@ declare function raiseDisputeSmart(this: Origin, targetIpId: bigint, evidence: R
501
503
  */
502
504
  declare function disputeAssertion(this: Origin, disputeId: bigint, counterEvidenceHash: Hex): Promise<any>;
503
505
 
506
+ interface DisputeAssertionSmartResult {
507
+ transactionResult: any;
508
+ counterEvidenceCid: string;
509
+ counterEvidenceHash: Hex;
510
+ }
511
+ /**
512
+ * Asserts a dispute with automatic counter-evidence upload to IPFS.
513
+ * Uploads counter-evidence JSON to IPFS, encodes the CID to bytes32 for on-chain storage,
514
+ * and calls disputeAssertion.
515
+ *
516
+ * The CID is encoded by stripping the 0x1220 multihash prefix from CIDv0,
517
+ * leaving only the 32-byte SHA-256 digest. This encoding is reversible,
518
+ * allowing the original CID to be reconstructed from the on-chain data.
519
+ *
520
+ * Must be called by the owner of the disputed IP within the cooldown period.
521
+ *
522
+ * @param disputeId The ID of the dispute to assert.
523
+ * @param counterEvidence The counter-evidence JSON object to upload to IPFS.
524
+ * @returns A promise that resolves with the transaction result, IPFS CID, and counter-evidence hash.
525
+ *
526
+ * @example
527
+ * ```typescript
528
+ * const result = await origin.disputeAssertionSmart(
529
+ * 1n,
530
+ * { description: "This is my original work", proofUrl: "https://..." }
531
+ * );
532
+ *
533
+ * // The CID can be recovered from counterEvidenceHash using decodeCidFromBytes32
534
+ * console.log("Counter-evidence CID:", result.counterEvidenceCid);
535
+ *
536
+ * // Fetch counter-evidence via IPFS gateway
537
+ * // https://ipfs.io/ipfs/{result.counterEvidenceCid}
538
+ * ```
539
+ */
540
+ declare function disputeAssertionSmart(this: Origin, disputeId: bigint, counterEvidence: Record<string, any>): Promise<DisputeAssertionSmartResult>;
541
+
504
542
  /**
505
543
  * Votes on a dispute as a CAMP token staker.
506
544
  * Only users who staked before the dispute was raised can vote.
@@ -1076,6 +1114,7 @@ declare class Origin {
1076
1114
  raiseDispute: typeof raiseDispute;
1077
1115
  raiseDisputeSmart: typeof raiseDisputeSmart;
1078
1116
  disputeAssertion: typeof disputeAssertion;
1117
+ disputeAssertionSmart: typeof disputeAssertionSmart;
1079
1118
  voteOnDispute: typeof voteOnDispute;
1080
1119
  resolveDispute: typeof resolveDispute;
1081
1120
  cancelDispute: typeof cancelDispute;
@@ -459,9 +459,13 @@ interface RaiseDisputeSmartResult {
459
459
  }
460
460
  /**
461
461
  * Raises a dispute with automatic evidence upload to IPFS.
462
- * Uploads evidence JSON to IPFS, hashes the CID to bytes32 for on-chain storage,
462
+ * Uploads evidence JSON to IPFS, encodes the CID to bytes32 for on-chain storage,
463
463
  * and calls raiseDispute.
464
464
  *
465
+ * The CID is encoded by stripping the 0x1220 multihash prefix from CIDv0,
466
+ * leaving only the 32-byte SHA-256 digest. This encoding is reversible,
467
+ * allowing the original CID to be reconstructed from the on-chain data.
468
+ *
465
469
  * @param targetIpId The token ID of the IP NFT to dispute.
466
470
  * @param evidence The evidence JSON object to upload to IPFS.
467
471
  * @param disputeTag A tag identifying the type of dispute.
@@ -475,13 +479,11 @@ interface RaiseDisputeSmartResult {
475
479
  * "0x696e6672696e67656d656e74..." // dispute tag
476
480
  * );
477
481
  *
478
- * // Store the CID for evidence retrieval
482
+ * // The CID can be recovered from evidenceHash using decodeCidFromBytes32
479
483
  * console.log("Evidence CID:", result.evidenceCid);
480
484
  *
481
- * // Fetch evidence later via IPFS gateway
485
+ * // Fetch evidence via IPFS gateway
482
486
  * // https://ipfs.io/ipfs/{result.evidenceCid}
483
- *
484
- * // Verify evidence hash matches on-chain: keccak256(toHex(evidenceCid)) === evidenceHash
485
487
  * ```
486
488
  */
487
489
  declare function raiseDisputeSmart(this: Origin, targetIpId: bigint, evidence: Record<string, any>, disputeTag: Hex): Promise<RaiseDisputeSmartResult>;
@@ -501,6 +503,42 @@ declare function raiseDisputeSmart(this: Origin, targetIpId: bigint, evidence: R
501
503
  */
502
504
  declare function disputeAssertion(this: Origin, disputeId: bigint, counterEvidenceHash: Hex): Promise<any>;
503
505
 
506
+ interface DisputeAssertionSmartResult {
507
+ transactionResult: any;
508
+ counterEvidenceCid: string;
509
+ counterEvidenceHash: Hex;
510
+ }
511
+ /**
512
+ * Asserts a dispute with automatic counter-evidence upload to IPFS.
513
+ * Uploads counter-evidence JSON to IPFS, encodes the CID to bytes32 for on-chain storage,
514
+ * and calls disputeAssertion.
515
+ *
516
+ * The CID is encoded by stripping the 0x1220 multihash prefix from CIDv0,
517
+ * leaving only the 32-byte SHA-256 digest. This encoding is reversible,
518
+ * allowing the original CID to be reconstructed from the on-chain data.
519
+ *
520
+ * Must be called by the owner of the disputed IP within the cooldown period.
521
+ *
522
+ * @param disputeId The ID of the dispute to assert.
523
+ * @param counterEvidence The counter-evidence JSON object to upload to IPFS.
524
+ * @returns A promise that resolves with the transaction result, IPFS CID, and counter-evidence hash.
525
+ *
526
+ * @example
527
+ * ```typescript
528
+ * const result = await origin.disputeAssertionSmart(
529
+ * 1n,
530
+ * { description: "This is my original work", proofUrl: "https://..." }
531
+ * );
532
+ *
533
+ * // The CID can be recovered from counterEvidenceHash using decodeCidFromBytes32
534
+ * console.log("Counter-evidence CID:", result.counterEvidenceCid);
535
+ *
536
+ * // Fetch counter-evidence via IPFS gateway
537
+ * // https://ipfs.io/ipfs/{result.counterEvidenceCid}
538
+ * ```
539
+ */
540
+ declare function disputeAssertionSmart(this: Origin, disputeId: bigint, counterEvidence: Record<string, any>): Promise<DisputeAssertionSmartResult>;
541
+
504
542
  /**
505
543
  * Votes on a dispute as a CAMP token staker.
506
544
  * Only users who staked before the dispute was raised can vote.
@@ -1076,6 +1114,7 @@ declare class Origin {
1076
1114
  raiseDispute: typeof raiseDispute;
1077
1115
  raiseDisputeSmart: typeof raiseDisputeSmart;
1078
1116
  disputeAssertion: typeof disputeAssertion;
1117
+ disputeAssertionSmart: typeof disputeAssertionSmart;
1079
1118
  voteOnDispute: typeof voteOnDispute;
1080
1119
  resolveDispute: typeof resolveDispute;
1081
1120
  cancelDispute: typeof cancelDispute;