@campnetwork/origin 1.3.0-alpha.0 → 1.3.0-alpha.10

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
@@ -134,7 +134,6 @@ declare const mainnet: {
134
134
  interface Environment {
135
135
  NAME: string;
136
136
  AUTH_HUB_BASE_API: string;
137
- AUTH_ENDPOINT: string;
138
137
  ORIGIN_DASHBOARD: string;
139
138
  DATANFT_CONTRACT_ADDRESS: string;
140
139
  MARKETPLACE_CONTRACT_ADDRESS: string;
@@ -142,6 +141,7 @@ interface Environment {
142
141
  DISPUTE_CONTRACT_ADDRESS?: string;
143
142
  FRACTIONALIZER_CONTRACT_ADDRESS?: string;
144
143
  APP_REGISTRY_CONTRACT_ADDRESS?: string;
144
+ USDC_CONTRACT_ADDRESS: string;
145
145
  CHAIN: any;
146
146
  IPNFT_ABI?: any;
147
147
  MARKETPLACE_ABI?: any;
@@ -269,7 +269,7 @@ type IpNFTSource = "spotify" | "twitter" | "tiktok" | "file";
269
269
  * @param licenseTerms The terms of the license for the NFT.
270
270
  * @param deadline The deadline for the minting operation.
271
271
  * @param signature The signature for the minting operation.
272
- * @param appId Optional app ID for the minting operation. Defaults to the SDK's appId (clientId).
272
+ * @param appId Optional app ID for the minting operation.
273
273
  * @returns A promise that resolves when the minting is complete.
274
274
  */
275
275
  declare function mintWithSignature(this: Origin, to: Address, tokenId: bigint, parents: bigint[], isIp: boolean, hash: Hex, uri: string, licenseTerms: LicenseTerms, deadline: bigint, signature: Hex, appId?: string): Promise<any>;
@@ -283,7 +283,7 @@ declare function mintWithSignature(this: Origin, to: Address, tokenId: bigint, p
283
283
  * @param parents The IDs of the parent NFTs, if applicable.
284
284
  * @return A promise that resolves with the registration data.
285
285
  */
286
- declare function registerIpNFT(this: Origin, source: IpNFTSource, deadline: bigint, licenseTerms: LicenseTerms, metadata: Record<string, unknown>, fileKey?: string | string[], parents?: bigint[]): Promise<any>;
286
+ declare function registerIpNFT(this: Origin, source: IpNFTSource, deadline: bigint, licenseTerms: LicenseTerms, metadata: Record<string, unknown>, isIp: boolean, fileKey?: string | string[], parents?: bigint[], appId?: string): Promise<any>;
287
287
 
288
288
  /**
289
289
  * Updates the license terms of a specified IPNFT.
@@ -433,11 +433,12 @@ declare function getDataWithIntent(this: Origin, tokenId: bigint, signer?: any,
433
433
 
434
434
  /**
435
435
  * Raises a dispute against an IP NFT.
436
- * Requires the caller to have the dispute bond amount in dispute tokens.
436
+ * Automatically handles token approval for ERC20 bonds or native token value.
437
+ * Includes the protocol dispute fee in the transaction.
437
438
  *
438
439
  * @param targetIpId The token ID of the IP NFT to dispute.
439
440
  * @param evidenceHash The hash of evidence supporting the dispute.
440
- * @param disputeTag A tag identifying the type of dispute.
441
+ * @param disputeTag A tag identifying the type of dispute (bytes32).
441
442
  * @returns A promise that resolves with the transaction result including the dispute ID.
442
443
  *
443
444
  * @example
@@ -445,12 +446,59 @@ declare function getDataWithIntent(this: Origin, tokenId: bigint, signer?: any,
445
446
  * const result = await origin.raiseDispute(
446
447
  * 1n,
447
448
  * "0x1234...", // evidence hash
448
- * "0x5678..." // dispute tag (e.g., "infringement", "fraud")
449
+ * "0x0100000000000000000000000000000000000000000000000000000000000000" // dispute tag (bytes32)
449
450
  * );
450
451
  * ```
451
452
  */
452
453
  declare function raiseDispute(this: Origin, targetIpId: bigint, evidenceHash: Hex, disputeTag: Hex): Promise<any>;
453
454
 
455
+ interface RaiseDisputeSmartResult {
456
+ transactionResult: any;
457
+ evidenceCid: string;
458
+ evidenceHash: Hex;
459
+ }
460
+ /**
461
+ * Raises a dispute with automatic evidence upload to IPFS.
462
+ * Uploads evidence JSON to IPFS, encodes the CID to bytes32 for on-chain storage,
463
+ * and calls raiseDispute.
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
+ *
469
+ * @param targetIpId The token ID of the IP NFT to dispute.
470
+ * @param evidence The evidence JSON object to upload to IPFS.
471
+ * @param disputeTag A tag identifying the type of dispute.
472
+ * @returns A promise that resolves with the transaction result, IPFS CID, and evidence hash.
473
+ *
474
+ * @example
475
+ * ```typescript
476
+ * const result = await origin.raiseDisputeSmart(
477
+ * 1n,
478
+ * { reason: "copyright", details: "Unauthorized use of copyrighted material" },
479
+ * "0x696e6672696e67656d656e74..." // dispute tag
480
+ * );
481
+ *
482
+ * // The CID can be recovered from evidenceHash using decodeCidFromBytes32
483
+ * console.log("Evidence CID:", result.evidenceCid);
484
+ *
485
+ * // Fetch evidence via IPFS gateway
486
+ * // https://ipfs.io/ipfs/{result.evidenceCid}
487
+ * ```
488
+ */
489
+ declare function raiseDisputeSmart(this: Origin, targetIpId: bigint, evidence: Record<string, any>, disputeTag: Hex): Promise<RaiseDisputeSmartResult>;
490
+
491
+ /**
492
+ * Encode a CID to bytes32 by extracting the 32-byte SHA-256 digest.
493
+ * Supports both CIDv0 (starts with "Qm") and CIDv1 (starts with "bafy").
494
+ */
495
+ declare function encodeCidToBytes32(cid: string): Hex;
496
+ /**
497
+ * Decode bytes32 back to CIDv1 format (base32, dag-pb codec).
498
+ * Returns a CID starting with "bafybei" that works with Pinata gateways.
499
+ */
500
+ declare function decodeCidFromBytes32(bytes32: Hex): string;
501
+
454
502
  /**
455
503
  * Asserts a dispute as the IP owner with counter-evidence.
456
504
  * Must be called by the owner of the disputed IP within the cooldown period.
@@ -466,6 +514,42 @@ declare function raiseDispute(this: Origin, targetIpId: bigint, evidenceHash: He
466
514
  */
467
515
  declare function disputeAssertion(this: Origin, disputeId: bigint, counterEvidenceHash: Hex): Promise<any>;
468
516
 
517
+ interface DisputeAssertionSmartResult {
518
+ transactionResult: any;
519
+ counterEvidenceCid: string;
520
+ counterEvidenceHash: Hex;
521
+ }
522
+ /**
523
+ * Asserts a dispute with automatic counter-evidence upload to IPFS.
524
+ * Uploads counter-evidence JSON to IPFS, encodes the CID to bytes32 for on-chain storage,
525
+ * and calls disputeAssertion.
526
+ *
527
+ * The CID is encoded by stripping the 0x1220 multihash prefix from CIDv0,
528
+ * leaving only the 32-byte SHA-256 digest. This encoding is reversible,
529
+ * allowing the original CID to be reconstructed from the on-chain data.
530
+ *
531
+ * Must be called by the owner of the disputed IP within the cooldown period.
532
+ *
533
+ * @param disputeId The ID of the dispute to assert.
534
+ * @param counterEvidence The counter-evidence JSON object to upload to IPFS.
535
+ * @returns A promise that resolves with the transaction result, IPFS CID, and counter-evidence hash.
536
+ *
537
+ * @example
538
+ * ```typescript
539
+ * const result = await origin.disputeAssertionSmart(
540
+ * 1n,
541
+ * { description: "This is my original work", proofUrl: "https://..." }
542
+ * );
543
+ *
544
+ * // The CID can be recovered from counterEvidenceHash using decodeCidFromBytes32
545
+ * console.log("Counter-evidence CID:", result.counterEvidenceCid);
546
+ *
547
+ * // Fetch counter-evidence via IPFS gateway
548
+ * // https://ipfs.io/ipfs/{result.counterEvidenceCid}
549
+ * ```
550
+ */
551
+ declare function disputeAssertionSmart(this: Origin, disputeId: bigint, counterEvidence: Record<string, any>): Promise<DisputeAssertionSmartResult>;
552
+
469
553
  /**
470
554
  * Votes on a dispute as a CAMP token staker.
471
555
  * Only users who staked before the dispute was raised can vote.
@@ -645,6 +729,31 @@ interface DisputeProgress {
645
729
  */
646
730
  declare function getDisputeProgress(this: Origin, disputeId: bigint): Promise<DisputeProgress>;
647
731
 
732
+ interface DisputeRequirements {
733
+ bondAmount: bigint;
734
+ protocolFee: bigint;
735
+ totalRequired: bigint;
736
+ tokenAddress: Address;
737
+ isNativeToken: boolean;
738
+ userBalance: bigint;
739
+ hasSufficientBalance: boolean;
740
+ }
741
+ /**
742
+ * Gets the requirements for raising a dispute, including balance check.
743
+ *
744
+ * @param userAddress The address to check balance for.
745
+ * @returns A promise that resolves with the dispute requirements.
746
+ *
747
+ * @example
748
+ * ```typescript
749
+ * const requirements = await origin.getDisputeRequirements(walletAddress);
750
+ * if (!requirements.hasSufficientBalance) {
751
+ * console.log(`Need ${requirements.totalRequired} but only have ${requirements.userBalance}`);
752
+ * }
753
+ * ```
754
+ */
755
+ declare function getDisputeRequirements(this: Origin, userAddress: Address): Promise<DisputeRequirements>;
756
+
648
757
  /**
649
758
  * Fractionalizes an IP NFT into fungible ERC20 tokens.
650
759
  * The NFT is transferred to the fractionalizer contract and a new ERC20 token is created.
@@ -1014,7 +1123,9 @@ declare class Origin {
1014
1123
  buildPurchaseParams: typeof buildPurchaseParams;
1015
1124
  checkActiveStatus: typeof checkActiveStatus;
1016
1125
  raiseDispute: typeof raiseDispute;
1126
+ raiseDisputeSmart: typeof raiseDisputeSmart;
1017
1127
  disputeAssertion: typeof disputeAssertion;
1128
+ disputeAssertionSmart: typeof disputeAssertionSmart;
1018
1129
  voteOnDispute: typeof voteOnDispute;
1019
1130
  resolveDispute: typeof resolveDispute;
1020
1131
  cancelDispute: typeof cancelDispute;
@@ -1022,6 +1133,7 @@ declare class Origin {
1022
1133
  getDispute: typeof getDispute;
1023
1134
  canVoteOnDispute: typeof canVoteOnDispute;
1024
1135
  getDisputeProgress: typeof getDisputeProgress;
1136
+ getDisputeRequirements: typeof getDisputeRequirements;
1025
1137
  fractionalize: typeof fractionalize;
1026
1138
  redeem: typeof redeem;
1027
1139
  getTokenForNFT: typeof getTokenForNFT;
@@ -1038,6 +1150,21 @@ declare class Origin {
1038
1150
  constructor(environment?: Environment | string, jwt?: string, viemClient?: WalletClient, baseParentId?: bigint, appId?: string);
1039
1151
  getJwt(): string | undefined;
1040
1152
  setViemClient(client: WalletClient): void;
1153
+ /**
1154
+ * Approves an ERC20 token for spending by a spender address if the current allowance is insufficient.
1155
+ * Waits for the approval transaction to be confirmed before returning.
1156
+ * @param tokenAddress The address of the ERC20 token.
1157
+ * @param spender The address that will be approved to spend the tokens.
1158
+ * @param amount The amount of tokens to approve.
1159
+ */
1160
+ approveERC20IfNeeded(tokenAddress: Address, spender: Address, amount: bigint): Promise<void>;
1161
+ /**
1162
+ * Uploads a JSON object to IPFS and returns the resulting CID.
1163
+ * @param data The JSON object to upload.
1164
+ * @returns The CID of the uploaded JSON.
1165
+ * @throws {APIError} If the upload fails.
1166
+ */
1167
+ uploadJSONToIPFS(data: Record<string, any>): Promise<string>;
1041
1168
  /**
1042
1169
  * Mints a file-based IpNFT.
1043
1170
  * @param file The file to mint.
@@ -1175,6 +1302,7 @@ declare class Auth {
1175
1302
  #private;
1176
1303
  redirectUri: Record<string, string>;
1177
1304
  clientId: string;
1305
+ appId: string;
1178
1306
  isAuthenticated: boolean;
1179
1307
  jwt: string | null;
1180
1308
  walletAddress: string | null;
@@ -1192,8 +1320,9 @@ declare class Auth {
1192
1320
  * @param {StorageAdapter} [options.storage] Custom storage adapter. Defaults to localStorage in browser, memory storage in Node.js.
1193
1321
  * @throws {APIError} - Throws an error if the clientId is not provided.
1194
1322
  */
1195
- constructor({ clientId, redirectUri, environment, baseParentId, storage, }: {
1323
+ constructor({ clientId, appId, redirectUri, environment, baseParentId, storage, }: {
1196
1324
  clientId: string;
1325
+ appId: string;
1197
1326
  redirectUri: string | Record<string, string>;
1198
1327
  environment?: "DEVELOPMENT" | "PRODUCTION";
1199
1328
  baseParentId?: bigint;
@@ -1375,4 +1504,4 @@ declare class Auth {
1375
1504
  unlinkTelegram(): Promise<any>;
1376
1505
  }
1377
1506
 
1378
- export { type AppInfo, Auth, type BaseSigner, BrowserStorage, type BulkCostPreview, type BuyParams, CustomSignerAdapter, DataStatus, type Dispute, type DisputeProgress, DisputeStatus, EthersSignerAdapter, type FractionOwnership, type FractionalizeEligibility, type LicenseTerms, LicenseType, MemoryStorage, Origin, type SignerAdapter, type SignerType, type StorageAdapter, type TokenInfo, type TolerantResult, ViemSignerAdapter, type VoteEligibility, mainnet as campMainnet, testnet as campTestnet, createLicenseTerms, createNodeWalletClient, createSignerAdapter };
1507
+ export { type AppInfo, Auth, type BaseSigner, BrowserStorage, type BulkCostPreview, type BuyParams, CustomSignerAdapter, DataStatus, type Dispute, type DisputeProgress, DisputeStatus, EthersSignerAdapter, type FractionOwnership, type FractionalizeEligibility, type LicenseTerms, LicenseType, MemoryStorage, Origin, type SignerAdapter, type SignerType, type StorageAdapter, type TokenInfo, type TolerantResult, ViemSignerAdapter, type VoteEligibility, mainnet as campMainnet, testnet as campTestnet, createLicenseTerms, createNodeWalletClient, createSignerAdapter, decodeCidFromBytes32, encodeCidToBytes32 };
@@ -134,7 +134,6 @@ declare const mainnet: {
134
134
  interface Environment {
135
135
  NAME: string;
136
136
  AUTH_HUB_BASE_API: string;
137
- AUTH_ENDPOINT: string;
138
137
  ORIGIN_DASHBOARD: string;
139
138
  DATANFT_CONTRACT_ADDRESS: string;
140
139
  MARKETPLACE_CONTRACT_ADDRESS: string;
@@ -142,6 +141,7 @@ interface Environment {
142
141
  DISPUTE_CONTRACT_ADDRESS?: string;
143
142
  FRACTIONALIZER_CONTRACT_ADDRESS?: string;
144
143
  APP_REGISTRY_CONTRACT_ADDRESS?: string;
144
+ USDC_CONTRACT_ADDRESS: string;
145
145
  CHAIN: any;
146
146
  IPNFT_ABI?: any;
147
147
  MARKETPLACE_ABI?: any;
@@ -269,7 +269,7 @@ type IpNFTSource = "spotify" | "twitter" | "tiktok" | "file";
269
269
  * @param licenseTerms The terms of the license for the NFT.
270
270
  * @param deadline The deadline for the minting operation.
271
271
  * @param signature The signature for the minting operation.
272
- * @param appId Optional app ID for the minting operation. Defaults to the SDK's appId (clientId).
272
+ * @param appId Optional app ID for the minting operation.
273
273
  * @returns A promise that resolves when the minting is complete.
274
274
  */
275
275
  declare function mintWithSignature(this: Origin, to: Address, tokenId: bigint, parents: bigint[], isIp: boolean, hash: Hex, uri: string, licenseTerms: LicenseTerms, deadline: bigint, signature: Hex, appId?: string): Promise<any>;
@@ -283,7 +283,7 @@ declare function mintWithSignature(this: Origin, to: Address, tokenId: bigint, p
283
283
  * @param parents The IDs of the parent NFTs, if applicable.
284
284
  * @return A promise that resolves with the registration data.
285
285
  */
286
- declare function registerIpNFT(this: Origin, source: IpNFTSource, deadline: bigint, licenseTerms: LicenseTerms, metadata: Record<string, unknown>, fileKey?: string | string[], parents?: bigint[]): Promise<any>;
286
+ declare function registerIpNFT(this: Origin, source: IpNFTSource, deadline: bigint, licenseTerms: LicenseTerms, metadata: Record<string, unknown>, isIp: boolean, fileKey?: string | string[], parents?: bigint[], appId?: string): Promise<any>;
287
287
 
288
288
  /**
289
289
  * Updates the license terms of a specified IPNFT.
@@ -433,11 +433,12 @@ declare function getDataWithIntent(this: Origin, tokenId: bigint, signer?: any,
433
433
 
434
434
  /**
435
435
  * Raises a dispute against an IP NFT.
436
- * Requires the caller to have the dispute bond amount in dispute tokens.
436
+ * Automatically handles token approval for ERC20 bonds or native token value.
437
+ * Includes the protocol dispute fee in the transaction.
437
438
  *
438
439
  * @param targetIpId The token ID of the IP NFT to dispute.
439
440
  * @param evidenceHash The hash of evidence supporting the dispute.
440
- * @param disputeTag A tag identifying the type of dispute.
441
+ * @param disputeTag A tag identifying the type of dispute (bytes32).
441
442
  * @returns A promise that resolves with the transaction result including the dispute ID.
442
443
  *
443
444
  * @example
@@ -445,12 +446,59 @@ declare function getDataWithIntent(this: Origin, tokenId: bigint, signer?: any,
445
446
  * const result = await origin.raiseDispute(
446
447
  * 1n,
447
448
  * "0x1234...", // evidence hash
448
- * "0x5678..." // dispute tag (e.g., "infringement", "fraud")
449
+ * "0x0100000000000000000000000000000000000000000000000000000000000000" // dispute tag (bytes32)
449
450
  * );
450
451
  * ```
451
452
  */
452
453
  declare function raiseDispute(this: Origin, targetIpId: bigint, evidenceHash: Hex, disputeTag: Hex): Promise<any>;
453
454
 
455
+ interface RaiseDisputeSmartResult {
456
+ transactionResult: any;
457
+ evidenceCid: string;
458
+ evidenceHash: Hex;
459
+ }
460
+ /**
461
+ * Raises a dispute with automatic evidence upload to IPFS.
462
+ * Uploads evidence JSON to IPFS, encodes the CID to bytes32 for on-chain storage,
463
+ * and calls raiseDispute.
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
+ *
469
+ * @param targetIpId The token ID of the IP NFT to dispute.
470
+ * @param evidence The evidence JSON object to upload to IPFS.
471
+ * @param disputeTag A tag identifying the type of dispute.
472
+ * @returns A promise that resolves with the transaction result, IPFS CID, and evidence hash.
473
+ *
474
+ * @example
475
+ * ```typescript
476
+ * const result = await origin.raiseDisputeSmart(
477
+ * 1n,
478
+ * { reason: "copyright", details: "Unauthorized use of copyrighted material" },
479
+ * "0x696e6672696e67656d656e74..." // dispute tag
480
+ * );
481
+ *
482
+ * // The CID can be recovered from evidenceHash using decodeCidFromBytes32
483
+ * console.log("Evidence CID:", result.evidenceCid);
484
+ *
485
+ * // Fetch evidence via IPFS gateway
486
+ * // https://ipfs.io/ipfs/{result.evidenceCid}
487
+ * ```
488
+ */
489
+ declare function raiseDisputeSmart(this: Origin, targetIpId: bigint, evidence: Record<string, any>, disputeTag: Hex): Promise<RaiseDisputeSmartResult>;
490
+
491
+ /**
492
+ * Encode a CID to bytes32 by extracting the 32-byte SHA-256 digest.
493
+ * Supports both CIDv0 (starts with "Qm") and CIDv1 (starts with "bafy").
494
+ */
495
+ declare function encodeCidToBytes32(cid: string): Hex;
496
+ /**
497
+ * Decode bytes32 back to CIDv1 format (base32, dag-pb codec).
498
+ * Returns a CID starting with "bafybei" that works with Pinata gateways.
499
+ */
500
+ declare function decodeCidFromBytes32(bytes32: Hex): string;
501
+
454
502
  /**
455
503
  * Asserts a dispute as the IP owner with counter-evidence.
456
504
  * Must be called by the owner of the disputed IP within the cooldown period.
@@ -466,6 +514,42 @@ declare function raiseDispute(this: Origin, targetIpId: bigint, evidenceHash: He
466
514
  */
467
515
  declare function disputeAssertion(this: Origin, disputeId: bigint, counterEvidenceHash: Hex): Promise<any>;
468
516
 
517
+ interface DisputeAssertionSmartResult {
518
+ transactionResult: any;
519
+ counterEvidenceCid: string;
520
+ counterEvidenceHash: Hex;
521
+ }
522
+ /**
523
+ * Asserts a dispute with automatic counter-evidence upload to IPFS.
524
+ * Uploads counter-evidence JSON to IPFS, encodes the CID to bytes32 for on-chain storage,
525
+ * and calls disputeAssertion.
526
+ *
527
+ * The CID is encoded by stripping the 0x1220 multihash prefix from CIDv0,
528
+ * leaving only the 32-byte SHA-256 digest. This encoding is reversible,
529
+ * allowing the original CID to be reconstructed from the on-chain data.
530
+ *
531
+ * Must be called by the owner of the disputed IP within the cooldown period.
532
+ *
533
+ * @param disputeId The ID of the dispute to assert.
534
+ * @param counterEvidence The counter-evidence JSON object to upload to IPFS.
535
+ * @returns A promise that resolves with the transaction result, IPFS CID, and counter-evidence hash.
536
+ *
537
+ * @example
538
+ * ```typescript
539
+ * const result = await origin.disputeAssertionSmart(
540
+ * 1n,
541
+ * { description: "This is my original work", proofUrl: "https://..." }
542
+ * );
543
+ *
544
+ * // The CID can be recovered from counterEvidenceHash using decodeCidFromBytes32
545
+ * console.log("Counter-evidence CID:", result.counterEvidenceCid);
546
+ *
547
+ * // Fetch counter-evidence via IPFS gateway
548
+ * // https://ipfs.io/ipfs/{result.counterEvidenceCid}
549
+ * ```
550
+ */
551
+ declare function disputeAssertionSmart(this: Origin, disputeId: bigint, counterEvidence: Record<string, any>): Promise<DisputeAssertionSmartResult>;
552
+
469
553
  /**
470
554
  * Votes on a dispute as a CAMP token staker.
471
555
  * Only users who staked before the dispute was raised can vote.
@@ -645,6 +729,31 @@ interface DisputeProgress {
645
729
  */
646
730
  declare function getDisputeProgress(this: Origin, disputeId: bigint): Promise<DisputeProgress>;
647
731
 
732
+ interface DisputeRequirements {
733
+ bondAmount: bigint;
734
+ protocolFee: bigint;
735
+ totalRequired: bigint;
736
+ tokenAddress: Address;
737
+ isNativeToken: boolean;
738
+ userBalance: bigint;
739
+ hasSufficientBalance: boolean;
740
+ }
741
+ /**
742
+ * Gets the requirements for raising a dispute, including balance check.
743
+ *
744
+ * @param userAddress The address to check balance for.
745
+ * @returns A promise that resolves with the dispute requirements.
746
+ *
747
+ * @example
748
+ * ```typescript
749
+ * const requirements = await origin.getDisputeRequirements(walletAddress);
750
+ * if (!requirements.hasSufficientBalance) {
751
+ * console.log(`Need ${requirements.totalRequired} but only have ${requirements.userBalance}`);
752
+ * }
753
+ * ```
754
+ */
755
+ declare function getDisputeRequirements(this: Origin, userAddress: Address): Promise<DisputeRequirements>;
756
+
648
757
  /**
649
758
  * Fractionalizes an IP NFT into fungible ERC20 tokens.
650
759
  * The NFT is transferred to the fractionalizer contract and a new ERC20 token is created.
@@ -1014,7 +1123,9 @@ declare class Origin {
1014
1123
  buildPurchaseParams: typeof buildPurchaseParams;
1015
1124
  checkActiveStatus: typeof checkActiveStatus;
1016
1125
  raiseDispute: typeof raiseDispute;
1126
+ raiseDisputeSmart: typeof raiseDisputeSmart;
1017
1127
  disputeAssertion: typeof disputeAssertion;
1128
+ disputeAssertionSmart: typeof disputeAssertionSmart;
1018
1129
  voteOnDispute: typeof voteOnDispute;
1019
1130
  resolveDispute: typeof resolveDispute;
1020
1131
  cancelDispute: typeof cancelDispute;
@@ -1022,6 +1133,7 @@ declare class Origin {
1022
1133
  getDispute: typeof getDispute;
1023
1134
  canVoteOnDispute: typeof canVoteOnDispute;
1024
1135
  getDisputeProgress: typeof getDisputeProgress;
1136
+ getDisputeRequirements: typeof getDisputeRequirements;
1025
1137
  fractionalize: typeof fractionalize;
1026
1138
  redeem: typeof redeem;
1027
1139
  getTokenForNFT: typeof getTokenForNFT;
@@ -1038,6 +1150,21 @@ declare class Origin {
1038
1150
  constructor(environment?: Environment | string, jwt?: string, viemClient?: WalletClient, baseParentId?: bigint, appId?: string);
1039
1151
  getJwt(): string | undefined;
1040
1152
  setViemClient(client: WalletClient): void;
1153
+ /**
1154
+ * Approves an ERC20 token for spending by a spender address if the current allowance is insufficient.
1155
+ * Waits for the approval transaction to be confirmed before returning.
1156
+ * @param tokenAddress The address of the ERC20 token.
1157
+ * @param spender The address that will be approved to spend the tokens.
1158
+ * @param amount The amount of tokens to approve.
1159
+ */
1160
+ approveERC20IfNeeded(tokenAddress: Address, spender: Address, amount: bigint): Promise<void>;
1161
+ /**
1162
+ * Uploads a JSON object to IPFS and returns the resulting CID.
1163
+ * @param data The JSON object to upload.
1164
+ * @returns The CID of the uploaded JSON.
1165
+ * @throws {APIError} If the upload fails.
1166
+ */
1167
+ uploadJSONToIPFS(data: Record<string, any>): Promise<string>;
1041
1168
  /**
1042
1169
  * Mints a file-based IpNFT.
1043
1170
  * @param file The file to mint.
@@ -1175,6 +1302,7 @@ declare class Auth {
1175
1302
  #private;
1176
1303
  redirectUri: Record<string, string>;
1177
1304
  clientId: string;
1305
+ appId: string;
1178
1306
  isAuthenticated: boolean;
1179
1307
  jwt: string | null;
1180
1308
  walletAddress: string | null;
@@ -1192,8 +1320,9 @@ declare class Auth {
1192
1320
  * @param {StorageAdapter} [options.storage] Custom storage adapter. Defaults to localStorage in browser, memory storage in Node.js.
1193
1321
  * @throws {APIError} - Throws an error if the clientId is not provided.
1194
1322
  */
1195
- constructor({ clientId, redirectUri, environment, baseParentId, storage, }: {
1323
+ constructor({ clientId, appId, redirectUri, environment, baseParentId, storage, }: {
1196
1324
  clientId: string;
1325
+ appId: string;
1197
1326
  redirectUri: string | Record<string, string>;
1198
1327
  environment?: "DEVELOPMENT" | "PRODUCTION";
1199
1328
  baseParentId?: bigint;
@@ -1375,4 +1504,4 @@ declare class Auth {
1375
1504
  unlinkTelegram(): Promise<any>;
1376
1505
  }
1377
1506
 
1378
- export { type AppInfo, Auth, type BaseSigner, BrowserStorage, type BulkCostPreview, type BuyParams, CustomSignerAdapter, DataStatus, type Dispute, type DisputeProgress, DisputeStatus, EthersSignerAdapter, type FractionOwnership, type FractionalizeEligibility, type LicenseTerms, LicenseType, MemoryStorage, Origin, type SignerAdapter, type SignerType, type StorageAdapter, type TokenInfo, type TolerantResult, ViemSignerAdapter, type VoteEligibility, mainnet as campMainnet, testnet as campTestnet, createLicenseTerms, createNodeWalletClient, createSignerAdapter };
1507
+ export { type AppInfo, Auth, type BaseSigner, BrowserStorage, type BulkCostPreview, type BuyParams, CustomSignerAdapter, DataStatus, type Dispute, type DisputeProgress, DisputeStatus, EthersSignerAdapter, type FractionOwnership, type FractionalizeEligibility, type LicenseTerms, LicenseType, MemoryStorage, Origin, type SignerAdapter, type SignerType, type StorageAdapter, type TokenInfo, type TolerantResult, ViemSignerAdapter, type VoteEligibility, mainnet as campMainnet, testnet as campTestnet, createLicenseTerms, createNodeWalletClient, createSignerAdapter, decodeCidFromBytes32, encodeCidToBytes32 };