@campnetwork/origin 1.2.8 → 1.3.0-alpha.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.
@@ -10,36 +10,108 @@ interface Environment {
10
10
  DATANFT_CONTRACT_ADDRESS: string;
11
11
  MARKETPLACE_CONTRACT_ADDRESS: string;
12
12
  BATCH_PURCHASE_CONTRACT_ADDRESS: string;
13
+ DISPUTE_CONTRACT_ADDRESS?: string;
14
+ FRACTIONALIZER_CONTRACT_ADDRESS?: string;
15
+ APP_REGISTRY_CONTRACT_ADDRESS?: string;
13
16
  CHAIN: any;
14
17
  IPNFT_ABI?: any;
15
18
  MARKETPLACE_ABI?: any;
16
19
  TBA_ABI?: any;
17
20
  BATCH_PURCHASE_ABI?: any;
21
+ DISPUTE_ABI?: any;
22
+ FRACTIONALIZER_ABI?: any;
23
+ APP_REGISTRY_ABI?: any;
18
24
  }
19
25
 
26
+ /**
27
+ * Enum representing the type of license for an IP NFT.
28
+ * - DURATION_BASED: License expires after a set duration (subscription model).
29
+ * - SINGLE_PAYMENT: One-time payment for perpetual access.
30
+ * - X402: HTTP 402-based micropayment license (no on-chain payments).
31
+ */
32
+ declare enum LicenseType {
33
+ DURATION_BASED = 0,
34
+ SINGLE_PAYMENT = 1,
35
+ X402 = 2
36
+ }
20
37
  /**
21
38
  * Represents the terms of a license for a digital asset.
22
39
  * @property price - The price of the asset in wei.
23
- * @property duration - The duration of the license in seconds.
40
+ * @property duration - The duration of the license in seconds (0 for SINGLE_PAYMENT and X402).
24
41
  * @property royaltyBps - The royalty percentage in basis points (0-10000).
25
42
  * @property paymentToken - The address of the payment token (ERC20 / address(0) for native currency).
43
+ * @property licenseType - The type of license (DURATION_BASED, SINGLE_PAYMENT, or X402).
26
44
  */
27
45
  type LicenseTerms = {
28
46
  price: bigint;
29
47
  duration: number;
30
48
  royaltyBps: number;
31
49
  paymentToken: Address;
50
+ licenseType: LicenseType;
32
51
  };
33
52
  /**
34
53
  * Enum representing the status of data in the system.
35
- * * - ACTIVE: The data is currently active and available.
36
- * * - PENDING_DELETE: The data is scheduled for deletion but not yet removed.
37
- * * - DELETED: The data has been deleted and is no longer available.
54
+ * - ACTIVE: The data is currently active and available.
55
+ * - DELETED: The data has been deleted and is no longer available.
56
+ * - DISPUTED: The data has been disputed and marked as potentially infringing.
38
57
  */
39
58
  declare enum DataStatus {
40
59
  ACTIVE = 0,
41
- PENDING_DELETE = 1,
42
- DELETED = 2
60
+ DELETED = 1,
61
+ DISPUTED = 2
62
+ }
63
+ /**
64
+ * Enum representing the status of a dispute.
65
+ * - Uninitialized: Dispute does not exist.
66
+ * - Raised: Dispute has been raised but not yet asserted by IP owner.
67
+ * - Asserted: IP owner has responded to the dispute.
68
+ * - Resolved: Dispute has been resolved (either valid or invalid).
69
+ * - Cancelled: Dispute was cancelled by the initiator.
70
+ */
71
+ declare enum DisputeStatus {
72
+ Uninitialized = 0,
73
+ Raised = 1,
74
+ Asserted = 2,
75
+ Resolved = 3,
76
+ Cancelled = 4
77
+ }
78
+ /**
79
+ * Represents a dispute against an IP NFT.
80
+ */
81
+ interface Dispute {
82
+ initiator: Address;
83
+ targetId: bigint;
84
+ disputeTag: Hex;
85
+ disputeEvidenceHash: Hex;
86
+ counterEvidenceHash: Hex;
87
+ disputeTimestamp: bigint;
88
+ assertionTimestamp: bigint;
89
+ yesVotes: bigint;
90
+ noVotes: bigint;
91
+ status: DisputeStatus;
92
+ bondAmount: bigint;
93
+ protocolFeeAmount: bigint;
94
+ }
95
+ /**
96
+ * Represents app information from the AppRegistry.
97
+ */
98
+ interface AppInfo {
99
+ treasury: Address;
100
+ revenueShareBps: number;
101
+ isActive: boolean;
102
+ }
103
+ /**
104
+ * Comprehensive token information returned by getTokenInfoSmart.
105
+ */
106
+ interface TokenInfo {
107
+ tokenId: bigint;
108
+ owner: Address;
109
+ uri: string;
110
+ status: DataStatus;
111
+ terms: LicenseTerms;
112
+ hasAccess: boolean;
113
+ accessExpiry: bigint | null;
114
+ appId: string;
43
115
  }
44
116
  /**
45
117
  * Represents the source of an IpNFT.
@@ -58,9 +130,10 @@ type IpNFTSource = "spotify" | "twitter" | "tiktok" | "file";
58
130
  * @param licenseTerms The terms of the license for the NFT.
59
131
  * @param deadline The deadline for the minting operation.
60
132
  * @param signature The signature for the minting operation.
133
+ * @param appId Optional app ID for the minting operation. Defaults to the SDK's appId (clientId).
61
134
  * @returns A promise that resolves when the minting is complete.
62
135
  */
63
- declare function mintWithSignature(this: Origin, to: Address, tokenId: bigint, parents: bigint[], isIp: boolean, hash: Hex, uri: string, licenseTerms: LicenseTerms, deadline: bigint, signature: Hex): Promise<any>;
136
+ 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>;
64
137
  /**
65
138
  * Registers a Data NFT with the Origin service in order to obtain a signature for minting.
66
139
  * @param source The source of the Data NFT (e.g., "spotify", "twitter", "tiktok", or "file").
@@ -154,10 +227,12 @@ declare function setApprovalForAll(this: Origin, operator: Address, approved: bo
154
227
  * @param expectedPrice The expected price for the access.
155
228
  * @param expectedDuration The expected duration of the access in seconds.
156
229
  * @param expectedPaymentToken The address of the payment token (use zero address for native token).
230
+ * @param expectedProtocolFeeBps The expected protocol fee in basis points (0-10000). Defaults to 0.
231
+ * @param expectedAppFeeBps The expected app fee in basis points (0-10000). Defaults to 0.
157
232
  * @param value The amount of native token to send (only required if paying with native token).
158
233
  * @returns A promise that resolves when the transaction is confirmed.
159
234
  */
160
- declare function buyAccess(this: Origin, buyer: Address, tokenId: bigint, expectedPrice: bigint, expectedDuration: bigint, expectedPaymentToken: Address, value?: bigint): Promise<any>;
235
+ declare function buyAccess(this: Origin, buyer: Address, tokenId: bigint, expectedPrice: bigint, expectedDuration: bigint, expectedPaymentToken: Address, expectedProtocolFeeBps?: number, expectedAppFeeBps?: number, value?: bigint): Promise<any>;
161
236
 
162
237
  /**
163
238
  * Checks if a user has access to a specific token based on subscription expiry.
@@ -217,6 +292,414 @@ declare function settlePaymentIntent(this: Origin, paymentIntentResponse: X402Re
217
292
  */
218
293
  declare function getDataWithIntent(this: Origin, tokenId: bigint, signer?: any, decide?: (terms: any) => Promise<boolean>): Promise<any>;
219
294
 
295
+ /**
296
+ * Raises a dispute against an IP NFT.
297
+ * Requires the caller to have the dispute bond amount in dispute tokens.
298
+ *
299
+ * @param targetIpId The token ID of the IP NFT to dispute.
300
+ * @param evidenceHash The hash of evidence supporting the dispute.
301
+ * @param disputeTag A tag identifying the type of dispute.
302
+ * @returns A promise that resolves with the transaction result including the dispute ID.
303
+ *
304
+ * @example
305
+ * ```typescript
306
+ * const result = await origin.raiseDispute(
307
+ * 1n,
308
+ * "0x1234...", // evidence hash
309
+ * "0x5678..." // dispute tag (e.g., "infringement", "fraud")
310
+ * );
311
+ * ```
312
+ */
313
+ declare function raiseDispute(this: Origin, targetIpId: bigint, evidenceHash: Hex, disputeTag: Hex): Promise<any>;
314
+
315
+ /**
316
+ * Asserts a dispute as the IP owner with counter-evidence.
317
+ * Must be called by the owner of the disputed IP within the cooldown period.
318
+ *
319
+ * @param disputeId The ID of the dispute to assert.
320
+ * @param counterEvidenceHash The hash of evidence countering the dispute.
321
+ * @returns A promise that resolves with the transaction result.
322
+ *
323
+ * @example
324
+ * ```typescript
325
+ * await origin.disputeAssertion(1n, "0x1234..."); // counter-evidence hash
326
+ * ```
327
+ */
328
+ declare function disputeAssertion(this: Origin, disputeId: bigint, counterEvidenceHash: Hex): Promise<any>;
329
+
330
+ /**
331
+ * Votes on a dispute as a CAMP token staker.
332
+ * Only users who staked before the dispute was raised can vote.
333
+ * Requires the caller to have voting power >= staking threshold.
334
+ *
335
+ * @param disputeId The ID of the dispute to vote on.
336
+ * @param support True to vote in favor of the dispute, false to vote against.
337
+ * @returns A promise that resolves with the transaction result.
338
+ *
339
+ * @example
340
+ * ```typescript
341
+ * // Vote in favor of the dispute
342
+ * await origin.voteOnDispute(1n, true);
343
+ *
344
+ * // Vote against the dispute
345
+ * await origin.voteOnDispute(1n, false);
346
+ * ```
347
+ */
348
+ declare function voteOnDispute(this: Origin, disputeId: bigint, support: boolean): Promise<any>;
349
+
350
+ /**
351
+ * Resolves a dispute after the voting period has ended.
352
+ * Can be called by anyone - resolution is deterministic based on votes and quorum.
353
+ * If the dispute is valid, the IP is marked as disputed and bond is returned.
354
+ * If invalid, the bond is split between the IP owner and resolver (protocol fee to caller).
355
+ *
356
+ * @param disputeId The ID of the dispute to resolve.
357
+ * @returns A promise that resolves with the transaction result.
358
+ *
359
+ * @example
360
+ * ```typescript
361
+ * await origin.resolveDispute(1n);
362
+ * ```
363
+ */
364
+ declare function resolveDispute(this: Origin, disputeId: bigint): Promise<any>;
365
+
366
+ /**
367
+ * Cancels a dispute that is still in the raised state.
368
+ * Can only be called by the dispute initiator during the cooldown period.
369
+ * The bond is returned to the initiator.
370
+ *
371
+ * @param disputeId The ID of the dispute to cancel.
372
+ * @returns A promise that resolves with the transaction result.
373
+ *
374
+ * @example
375
+ * ```typescript
376
+ * await origin.cancelDispute(1n);
377
+ * ```
378
+ */
379
+ declare function cancelDispute(this: Origin, disputeId: bigint): Promise<any>;
380
+
381
+ /**
382
+ * Tags a child IP as disputed if its parent has been successfully disputed.
383
+ * This propagates the dispute status to derivative IPs.
384
+ *
385
+ * @param childIpId The token ID of the child IP to tag.
386
+ * @param infringerDisputeId The ID of the resolved dispute against the parent IP.
387
+ * @returns A promise that resolves with the transaction result.
388
+ *
389
+ * @example
390
+ * ```typescript
391
+ * // After parent IP (tokenId 1) has been disputed, tag child IP (tokenId 2)
392
+ * await origin.tagChildIp(2n, 1n); // childIpId, disputeId of parent
393
+ * ```
394
+ */
395
+ declare function tagChildIp(this: Origin, childIpId: bigint, infringerDisputeId: bigint): Promise<any>;
396
+
397
+ /**
398
+ * Gets the details of a dispute by its ID.
399
+ *
400
+ * @param disputeId The ID of the dispute to fetch.
401
+ * @returns A promise that resolves with the dispute details.
402
+ *
403
+ * @example
404
+ * ```typescript
405
+ * const dispute = await origin.getDispute(1n);
406
+ * console.log(`Status: ${dispute.status}`);
407
+ * console.log(`Yes votes: ${dispute.yesVotes}`);
408
+ * console.log(`No votes: ${dispute.noVotes}`);
409
+ * ```
410
+ */
411
+ declare function getDispute(this: Origin, disputeId: bigint): Promise<Dispute>;
412
+
413
+ /**
414
+ * Result of checking if a user can vote on a dispute.
415
+ */
416
+ interface VoteEligibility {
417
+ canVote: boolean;
418
+ /** Reason why user cannot vote (if canVote is false) */
419
+ reason?: string;
420
+ /** User's voting weight (staked CAMP balance) */
421
+ votingWeight: bigint;
422
+ /** Minimum required stake to vote */
423
+ stakingThreshold: bigint;
424
+ hasAlreadyVoted: boolean;
425
+ /** Timestamp when user staked (0 if never staked) */
426
+ userStakeTimestamp: bigint;
427
+ disputeTimestamp: bigint;
428
+ disputeStatus: DisputeStatus;
429
+ isVotingPeriodActive: boolean;
430
+ }
431
+ /**
432
+ * Checks if a user meets the requirements to vote on a dispute.
433
+ * Returns detailed information about eligibility and reason if ineligible.
434
+ *
435
+ * @param disputeId The ID of the dispute to check.
436
+ * @param voter Optional address to check. If not provided, uses connected wallet.
437
+ * @returns A promise that resolves with the vote eligibility details.
438
+ *
439
+ * @example
440
+ * ```typescript
441
+ * const eligibility = await origin.canVoteOnDispute(1n);
442
+ *
443
+ * if (eligibility.canVote) {
444
+ * console.log(`You can vote with weight: ${eligibility.votingWeight}`);
445
+ * await origin.voteOnDispute(1n, true);
446
+ * } else {
447
+ * console.log(`Cannot vote: ${eligibility.reason}`);
448
+ * }
449
+ * ```
450
+ */
451
+ declare function canVoteOnDispute(this: Origin, disputeId: bigint, voter?: Address): Promise<VoteEligibility>;
452
+
453
+ /**
454
+ * Progress and voting statistics for a dispute.
455
+ */
456
+ interface DisputeProgress {
457
+ disputeId: bigint;
458
+ status: DisputeStatus;
459
+ /** Total YES votes (weighted by stake) */
460
+ yesVotes: bigint;
461
+ /** Total NO votes (weighted by stake) */
462
+ noVotes: bigint;
463
+ totalVotes: bigint;
464
+ /** YES votes as percentage (0-100) */
465
+ yesPercentage: number;
466
+ /** NO votes as percentage (0-100) */
467
+ noPercentage: number;
468
+ /** Required quorum for valid resolution */
469
+ quorum: bigint;
470
+ /** Current progress toward quorum (0-100+) */
471
+ quorumPercentage: number;
472
+ quorumMet: boolean;
473
+ /** Projected outcome if resolved now */
474
+ projectedOutcome: "dispute_succeeds" | "dispute_fails" | "no_quorum";
475
+ timeline: {
476
+ raisedAt: Date;
477
+ /** When the cooldown period ends (owner can no longer assert) */
478
+ cooldownEndsAt: Date;
479
+ votingEndsAt: Date;
480
+ canResolveNow: boolean;
481
+ /** Time remaining until resolution (in seconds, 0 if can resolve) */
482
+ timeUntilResolution: number;
483
+ };
484
+ }
485
+ /**
486
+ * Gets detailed progress and voting statistics for a dispute.
487
+ * Includes vote counts, percentages, quorum progress, and timeline.
488
+ *
489
+ * @param disputeId The ID of the dispute to check.
490
+ * @returns A promise that resolves with the dispute progress details.
491
+ *
492
+ * @example
493
+ * ```typescript
494
+ * const progress = await origin.getDisputeProgress(1n);
495
+ *
496
+ * console.log(`Yes: ${progress.yesPercentage}% | No: ${progress.noPercentage}%`);
497
+ * console.log(`Quorum: ${progress.quorumPercentage}% (${progress.quorumMet ? 'met' : 'not met'})`);
498
+ * console.log(`Projected outcome: ${progress.projectedOutcome}`);
499
+ *
500
+ * if (progress.timeline.canResolveNow) {
501
+ * await origin.resolveDispute(1n);
502
+ * } else {
503
+ * console.log(`Can resolve in ${progress.timeline.timeUntilResolution} seconds`);
504
+ * }
505
+ * ```
506
+ */
507
+ declare function getDisputeProgress(this: Origin, disputeId: bigint): Promise<DisputeProgress>;
508
+
509
+ /**
510
+ * Fractionalizes an IP NFT into fungible ERC20 tokens.
511
+ * The NFT is transferred to the fractionalizer contract and a new ERC20 token is created.
512
+ * The caller receives the full supply of fractional tokens.
513
+ *
514
+ * @param tokenId The token ID of the IP NFT to fractionalize.
515
+ * @returns A promise that resolves with the transaction result.
516
+ *
517
+ * @example
518
+ * ```typescript
519
+ * // First approve the fractionalizer contract to transfer your NFT
520
+ * await origin.approve(fractionalizerAddress, tokenId);
521
+ *
522
+ * // Then fractionalize
523
+ * const result = await origin.fractionalize(1n);
524
+ * ```
525
+ */
526
+ declare function fractionalize(this: Origin, tokenId: bigint): Promise<any>;
527
+
528
+ /**
529
+ * Redeems an IP NFT by burning all of its fractional tokens.
530
+ * The caller must hold the entire supply of the NFT's fractional token.
531
+ * After redemption, the NFT is transferred back to the caller.
532
+ *
533
+ * @param tokenId The token ID of the IP NFT to redeem.
534
+ * @returns A promise that resolves with the transaction result.
535
+ *
536
+ * @example
537
+ * ```typescript
538
+ * // Requires holding 100% of the fractional token supply
539
+ * await origin.redeem(1n);
540
+ * ```
541
+ */
542
+ declare function redeem(this: Origin, tokenId: bigint): Promise<any>;
543
+
544
+ /**
545
+ * Gets the fractional ERC20 token address for a specific IP NFT.
546
+ * Returns zero address if the NFT has not been fractionalized.
547
+ *
548
+ * @param tokenId The token ID of the IP NFT.
549
+ * @returns A promise that resolves with the fractional token address.
550
+ *
551
+ * @example
552
+ * ```typescript
553
+ * const fractionalToken = await origin.getTokenForNFT(1n);
554
+ * if (fractionalToken !== zeroAddress) {
555
+ * console.log(`Fractional token: ${fractionalToken}`);
556
+ * } else {
557
+ * console.log("NFT has not been fractionalized");
558
+ * }
559
+ * ```
560
+ */
561
+ declare function getTokenForNFT(this: Origin, tokenId: bigint): Promise<Address>;
562
+
563
+ /**
564
+ * Fractionalizes an IP NFT with automatic approval.
565
+ * This method first approves the fractionalizer contract to transfer your NFT,
566
+ * then calls fractionalize. This is the recommended method for most use cases.
567
+ *
568
+ * @param tokenId The token ID of the IP NFT to fractionalize.
569
+ * @returns A promise that resolves with the transaction result.
570
+ *
571
+ * @example
572
+ * ```typescript
573
+ * // Single call handles approval and fractionalization
574
+ * const result = await origin.fractionalizeWithApproval(1n);
575
+ * ```
576
+ */
577
+ declare function fractionalizeWithApproval(this: Origin, tokenId: bigint): Promise<any>;
578
+
579
+ /**
580
+ * Redeems fractional tokens for the underlying NFT, but only if the caller owns 100% of the supply.
581
+ * This method checks the caller's balance before attempting to redeem, providing a clear error
582
+ * if they don't hold the full supply.
583
+ *
584
+ * @param tokenId The token ID of the original NFT to redeem.
585
+ * @returns A promise that resolves with the transaction result.
586
+ * @throws Error if the caller doesn't own 100% of the fractional tokens.
587
+ *
588
+ * @example
589
+ * ```typescript
590
+ * try {
591
+ * const result = await origin.redeemIfComplete(1n);
592
+ * console.log("NFT redeemed successfully!");
593
+ * } catch (error) {
594
+ * console.log("You don't own all fractional tokens yet");
595
+ * }
596
+ * ```
597
+ */
598
+ declare function redeemIfComplete(this: Origin, tokenId: bigint): Promise<any>;
599
+
600
+ /**
601
+ * Ownership information for fractional tokens.
602
+ */
603
+ interface FractionOwnership {
604
+ tokenId: bigint;
605
+ /** The ERC20 token address (zero if not fractionalized) */
606
+ erc20Address: Address;
607
+ isFractionalized: boolean;
608
+ /** User's balance of fractional tokens */
609
+ balance: bigint;
610
+ /** Total supply of fractional tokens */
611
+ totalSupply: bigint;
612
+ /** User's ownership percentage (0-100) */
613
+ ownershipPercentage: number;
614
+ /** Whether user owns 100% and can redeem */
615
+ canRedeem: boolean;
616
+ decimals: number;
617
+ }
618
+ /**
619
+ * Gets a user's ownership percentage of a fractionalized NFT.
620
+ * Returns detailed information about the user's fractional token holdings.
621
+ *
622
+ * @param tokenId The token ID of the original NFT.
623
+ * @param owner Optional address to check. If not provided, uses connected wallet.
624
+ * @returns A promise that resolves with the ownership details.
625
+ *
626
+ * @example
627
+ * ```typescript
628
+ * const ownership = await origin.getFractionOwnership(1n);
629
+ *
630
+ * if (!ownership.isFractionalized) {
631
+ * console.log("This NFT has not been fractionalized");
632
+ * } else {
633
+ * console.log(`You own ${ownership.ownershipPercentage}% of this NFT`);
634
+ * console.log(`Balance: ${ownership.balance} / ${ownership.totalSupply}`);
635
+ *
636
+ * if (ownership.canRedeem) {
637
+ * console.log("You can redeem the original NFT!");
638
+ * await origin.redeem(1n);
639
+ * }
640
+ * }
641
+ * ```
642
+ */
643
+ declare function getFractionOwnership(this: Origin, tokenId: bigint, owner?: Address): Promise<FractionOwnership>;
644
+
645
+ /**
646
+ * Result of checking if a user can fractionalize an NFT.
647
+ */
648
+ interface FractionalizeEligibility {
649
+ canFractionalize: boolean;
650
+ /** Reason why user cannot fractionalize (if canFractionalize is false) */
651
+ reason?: string;
652
+ isOwner: boolean;
653
+ currentOwner: Address;
654
+ isAlreadyFractionalized: boolean;
655
+ /** ERC20 address if already fractionalized */
656
+ existingErc20Address?: Address;
657
+ dataStatus: DataStatus;
658
+ isApproved: boolean;
659
+ needsApproval: boolean;
660
+ }
661
+ /**
662
+ * Checks if a user can fractionalize an NFT and why not if they can't.
663
+ * Returns detailed information about eligibility requirements.
664
+ *
665
+ * @param tokenId The token ID of the NFT to check.
666
+ * @param owner Optional address to check. If not provided, uses connected wallet.
667
+ * @returns A promise that resolves with the fractionalize eligibility details.
668
+ *
669
+ * @example
670
+ * ```typescript
671
+ * const eligibility = await origin.canFractionalize(1n);
672
+ *
673
+ * if (eligibility.canFractionalize) {
674
+ * if (eligibility.needsApproval) {
675
+ * // Use fractionalizeWithApproval for convenience
676
+ * await origin.fractionalizeWithApproval(1n);
677
+ * } else {
678
+ * await origin.fractionalize(1n);
679
+ * }
680
+ * } else {
681
+ * console.log(`Cannot fractionalize: ${eligibility.reason}`);
682
+ * }
683
+ * ```
684
+ */
685
+ declare function canFractionalize(this: Origin, tokenId: bigint, owner?: Address): Promise<FractionalizeEligibility>;
686
+
687
+ /**
688
+ * Gets information about a registered app from the AppRegistry.
689
+ *
690
+ * @param appId The app ID to look up.
691
+ * @returns A promise that resolves with the app information.
692
+ *
693
+ * @example
694
+ * ```typescript
695
+ * const appInfo = await origin.getAppInfo("my-app-id");
696
+ * console.log(`Treasury: ${appInfo.treasury}`);
697
+ * console.log(`Revenue Share: ${appInfo.revenueShareBps / 100}%`);
698
+ * console.log(`Active: ${appInfo.isActive}`);
699
+ * ```
700
+ */
701
+ declare function getAppInfo(this: Origin, appId: string): Promise<AppInfo>;
702
+
220
703
  /**
221
704
  * Parameters for a single purchase in a bulk buy operation.
222
705
  */
@@ -225,6 +708,8 @@ interface BuyParams {
225
708
  expectedPrice: bigint;
226
709
  expectedDuration: number;
227
710
  expectedPaymentToken: Address;
711
+ expectedProtocolFeeBps: number;
712
+ expectedAppFeeBps: number;
228
713
  }
229
714
  /**
230
715
  * Preview of bulk purchase costs.
@@ -379,11 +864,29 @@ declare class Origin {
379
864
  previewBulkCost: typeof previewBulkCost;
380
865
  buildPurchaseParams: typeof buildPurchaseParams;
381
866
  checkActiveStatus: typeof checkActiveStatus;
867
+ raiseDispute: typeof raiseDispute;
868
+ disputeAssertion: typeof disputeAssertion;
869
+ voteOnDispute: typeof voteOnDispute;
870
+ resolveDispute: typeof resolveDispute;
871
+ cancelDispute: typeof cancelDispute;
872
+ tagChildIp: typeof tagChildIp;
873
+ getDispute: typeof getDispute;
874
+ canVoteOnDispute: typeof canVoteOnDispute;
875
+ getDisputeProgress: typeof getDisputeProgress;
876
+ fractionalize: typeof fractionalize;
877
+ redeem: typeof redeem;
878
+ getTokenForNFT: typeof getTokenForNFT;
879
+ fractionalizeWithApproval: typeof fractionalizeWithApproval;
880
+ redeemIfComplete: typeof redeemIfComplete;
881
+ getFractionOwnership: typeof getFractionOwnership;
882
+ canFractionalize: typeof canFractionalize;
883
+ getAppInfo: typeof getAppInfo;
382
884
  private jwt?;
383
885
  environment: Environment;
384
886
  private viemClient?;
385
887
  baseParentId?: bigint;
386
- constructor(environment?: Environment | string, jwt?: string, viemClient?: WalletClient, baseParentId?: bigint);
888
+ appId?: string;
889
+ constructor(environment?: Environment | string, jwt?: string, viemClient?: WalletClient, baseParentId?: bigint, appId?: string);
387
890
  getJwt(): string | undefined;
388
891
  setViemClient(client: WalletClient): void;
389
892
  /**
@@ -419,12 +922,42 @@ declare class Origin {
419
922
  * @throws {Error} - Throws an error if the wallet client is not connected and the method is not a view function.
420
923
  */
421
924
  callContractMethod(contractAddress: string, abi: Abi, methodName: string, params: any[], options?: CallOptions): Promise<any>;
925
+ /**
926
+ * Gets comprehensive token information in a single call.
927
+ * Combines owner, status, terms, URI, and access information.
928
+ *
929
+ * @param tokenId The token ID to get information for.
930
+ * @param owner Optional address to check access for. If not provided, uses connected wallet.
931
+ * @returns A promise that resolves with comprehensive token information.
932
+ *
933
+ * @example
934
+ * ```typescript
935
+ * const info = await origin.getTokenInfoSmart(1n);
936
+ * console.log(`Owner: ${info.owner}`);
937
+ * console.log(`Price: ${info.terms.price}`);
938
+ * console.log(`Has access: ${info.hasAccess}`);
939
+ * ```
940
+ */
941
+ getTokenInfoSmart(tokenId: bigint, owner?: Address): Promise<TokenInfo>;
422
942
  /**
423
943
  * Buy access to an asset by first checking its price via getTerms, then calling buyAccess.
424
- * @param {bigint} tokenId The token ID of the asset.
425
- * @returns {Promise<any>} The result of the buyAccess call.
944
+ * Automatically fetches protocol and app fees from the contracts.
945
+ * If the user already has access, returns null without making a transaction.
946
+ *
947
+ * @param tokenId The token ID of the asset.
948
+ * @returns The result of the buyAccess call, or null if user already has access.
949
+ *
950
+ * @example
951
+ * ```typescript
952
+ * const result = await origin.buyAccessSmart(1n);
953
+ * if (result === null) {
954
+ * console.log("You already have access to this asset");
955
+ * } else {
956
+ * console.log("Access purchased:", result.txHash);
957
+ * }
958
+ * ```
426
959
  */
427
- buyAccessSmart(tokenId: bigint): Promise<any>;
960
+ buyAccessSmart(tokenId: bigint): Promise<any | null>;
428
961
  /**
429
962
  * Fetch the underlying data associated with a specific token ID.
430
963
  * @param {bigint} tokenId - The token ID to fetch data for.