@campnetwork/origin 1.3.2 → 1.4.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.
package/dist/core.d.ts CHANGED
@@ -139,17 +139,16 @@ interface Environment {
139
139
  MARKETPLACE_CONTRACT_ADDRESS: string;
140
140
  BATCH_OPERATIONS_CONTRACT_ADDRESS: string;
141
141
  DISPUTE_CONTRACT_ADDRESS?: string;
142
- FRACTIONALIZER_CONTRACT_ADDRESS?: string;
143
142
  APP_REGISTRY_CONTRACT_ADDRESS?: string;
144
- USDC_CONTRACT_ADDRESS: string;
143
+ IP_ROYALTY_VAULT_FACTORY_CONTRACT_ADDRESS?: string;
145
144
  CHAIN: any;
146
145
  IPNFT_ABI?: any;
147
146
  MARKETPLACE_ABI?: any;
148
147
  TBA_ABI?: any;
149
148
  BATCH_OPERATIONS_ABI?: any;
150
149
  DISPUTE_ABI?: any;
151
- FRACTIONALIZER_ABI?: any;
152
150
  APP_REGISTRY_ABI?: any;
151
+ IP_ROYALTY_VAULT_FACTORY_ABI?: any;
153
152
  }
154
153
 
155
154
  /**
@@ -300,14 +299,6 @@ declare function updateTerms(this: Origin, tokenId: bigint, newTerms: LicenseTer
300
299
  */
301
300
  declare function finalizeDelete(this: Origin, tokenId: bigint): Promise<any>;
302
301
 
303
- /**
304
- * Calls the getOrCreateRoyaltyVault method on the IPNFT contract.
305
- * @param tokenOwner The address of the token owner for whom to get or create the royalty vault.
306
- * @param simulateOnly If true, simulates the transaction without executing it.
307
- * @returns The address of the royalty vault associated with the specified token owner.
308
- */
309
- declare function getOrCreateRoyaltyVault(this: Origin, tokenOwner: Address, simulateOnly?: boolean): Promise<Address>;
310
-
311
302
  /**
312
303
  * Returns the license terms associated with a specific token ID.
313
304
  * @param tokenId The token ID to query.
@@ -707,182 +698,78 @@ interface DisputeRequirements {
707
698
  declare function getDisputeRequirements(this: Origin, userAddress: Address): Promise<DisputeRequirements>;
708
699
 
709
700
  /**
710
- * Fractionalizes an IP NFT into fungible ERC20 tokens.
711
- * The NFT is transferred to the fractionalizer contract and a new ERC20 token is created.
712
- * The caller receives the full supply of fractional tokens.
713
- *
714
- * @param tokenId The token ID of the IP NFT to fractionalize.
715
- * @returns A promise that resolves with the transaction result.
716
- *
717
- * @example
718
- * ```typescript
719
- * // First approve the fractionalizer contract to transfer your NFT
720
- * await origin.approve(fractionalizerAddress, tokenId);
701
+ * Gets the royalty vault address for a given token ID.
702
+ * Returns null if no vault has been deployed yet.
721
703
  *
722
- * // Then fractionalize
723
- * const result = await origin.fractionalize(1n);
724
- * ```
704
+ * @param tokenId The token ID to look up.
705
+ * @returns The vault address, or null if no vault exists.
725
706
  */
726
- declare function fractionalize(this: Origin, tokenId: bigint): Promise<any>;
707
+ declare function getRoyaltyVault(this: Origin, tokenId: bigint): Promise<Address | null>;
727
708
 
728
709
  /**
729
- * Redeems an IP NFT by burning all of its fractional tokens.
730
- * The caller must hold the entire supply of the NFT's fractional token.
731
- * After redemption, the NFT is transferred back to the caller.
732
- *
733
- * @param tokenId The token ID of the IP NFT to redeem.
734
- * @returns A promise that resolves with the transaction result.
710
+ * Gets the list of revenue token addresses that have accumulated in a token's vault.
735
711
  *
736
- * @example
737
- * ```typescript
738
- * // Requires holding 100% of the fractional token supply
739
- * await origin.redeem(1n);
740
- * ```
712
+ * @param tokenId The token ID to look up.
713
+ * @returns An array of ERC20 token addresses with revenue in the vault.
741
714
  */
742
- declare function redeem(this: Origin, tokenId: bigint): Promise<any>;
715
+ declare function getVaultRevenueTokens(this: Origin, tokenId: bigint): Promise<Address[]>;
743
716
 
744
717
  /**
745
- * Gets the fractional ERC20 token address for a specific IP NFT.
746
- * Returns zero address if the NFT has not been fractionalized.
747
- *
748
- * @param tokenId The token ID of the IP NFT.
749
- * @returns A promise that resolves with the fractional token address.
718
+ * Returns the amount of revenue claimable by a holder for a given token and revenue token.
719
+ * If no holder is provided, the connected wallet address is used.
750
720
  *
751
- * @example
752
- * ```typescript
753
- * const fractionalToken = await origin.getTokenForNFT(1n);
754
- * if (fractionalToken !== zeroAddress) {
755
- * console.log(`Fractional token: ${fractionalToken}`);
756
- * } else {
757
- * console.log("NFT has not been fractionalized");
758
- * }
759
- * ```
721
+ * @param tokenId The token ID whose vault to query.
722
+ * @param revenueToken The ERC20 revenue token address.
723
+ * @param holder Optional holder address. Defaults to connected wallet.
724
+ * @returns The claimable amount in the revenue token's smallest unit.
760
725
  */
761
- declare function getTokenForNFT(this: Origin, tokenId: bigint): Promise<Address>;
726
+ declare function claimableRevenue(this: Origin, tokenId: bigint, revenueToken: Address, holder?: Address): Promise<bigint>;
762
727
 
763
728
  /**
764
- * Fractionalizes an IP NFT with automatic approval.
765
- * This method first approves the fractionalizer contract to transfer your NFT,
766
- * then calls fractionalize. This is the recommended method for most use cases.
767
- *
768
- * @param tokenId The token ID of the IP NFT to fractionalize.
769
- * @returns A promise that resolves with the transaction result.
729
+ * Claims accumulated revenue for a token from a specific revenue token.
730
+ * The caller must hold Royalty Tokens to claim their proportional share.
770
731
  *
771
- * @example
772
- * ```typescript
773
- * // Single call handles approval and fractionalization
774
- * const result = await origin.fractionalizeWithApproval(1n);
775
- * ```
732
+ * @param tokenId The token ID whose vault to claim from.
733
+ * @param revenueToken The ERC20 revenue token address to claim.
734
+ * @returns The transaction result.
776
735
  */
777
- declare function fractionalizeWithApproval(this: Origin, tokenId: bigint): Promise<any>;
736
+ declare function claimRevenue(this: Origin, tokenId: bigint, revenueToken: Address): Promise<any>;
778
737
 
779
738
  /**
780
- * Redeems fractional tokens for the underlying NFT, but only if the caller owns 100% of the supply.
781
- * This method checks the caller's balance before attempting to redeem, providing a clear error
782
- * if they don't hold the full supply.
739
+ * Claims accumulated revenue for a token from multiple revenue tokens in a single transaction.
740
+ * The caller must hold Royalty Tokens to claim their proportional share.
783
741
  *
784
- * @param tokenId The token ID of the original NFT to redeem.
785
- * @returns A promise that resolves with the transaction result.
786
- * @throws Error if the caller doesn't own 100% of the fractional tokens.
787
- *
788
- * @example
789
- * ```typescript
790
- * try {
791
- * const result = await origin.redeemIfComplete(1n);
792
- * console.log("NFT redeemed successfully!");
793
- * } catch (error) {
794
- * console.log("You don't own all fractional tokens yet");
795
- * }
796
- * ```
742
+ * @param tokenId The token ID whose vault to claim from.
743
+ * @param revenueTokens Array of ERC20 revenue token addresses to claim.
744
+ * @returns The transaction result.
797
745
  */
798
- declare function redeemIfComplete(this: Origin, tokenId: bigint): Promise<any>;
746
+ declare function claimRevenueBatch(this: Origin, tokenId: bigint, revenueTokens: Address[]): Promise<any>;
799
747
 
800
748
  /**
801
- * Ownership information for fractional tokens.
749
+ * Deploys a new royalty vault for an existing NFT that was minted before the vault system.
750
+ * This is used to migrate old NFTs to the new royalty vault system.
751
+ *
752
+ * @param tokenId The token ID to deploy a vault for.
753
+ * @returns The transaction result including the new vault address.
802
754
  */
803
- interface FractionOwnership {
804
- tokenId: bigint;
805
- /** The ERC20 token address (zero if not fractionalized) */
806
- erc20Address: Address;
807
- isFractionalized: boolean;
808
- /** User's balance of fractional tokens */
755
+ declare function deployVaultForExistingNFT(this: Origin, tokenId: bigint): Promise<any>;
756
+
757
+ interface RoyaltyTokenBalance {
758
+ vaultAddress: Address;
809
759
  balance: bigint;
810
- /** Total supply of fractional tokens */
811
760
  totalSupply: bigint;
812
- /** User's ownership percentage (0-100) */
813
- ownershipPercentage: number;
814
- /** Whether user owns 100% and can redeem */
815
- canRedeem: boolean;
761
+ percentage: number;
816
762
  decimals: number;
817
763
  }
818
764
  /**
819
- * Gets a user's ownership percentage of a fractionalized NFT.
820
- * Returns detailed information about the user's fractional token holdings.
821
- *
822
- * @param tokenId The token ID of the original NFT.
823
- * @param owner Optional address to check. If not provided, uses connected wallet.
824
- * @returns A promise that resolves with the ownership details.
825
- *
826
- * @example
827
- * ```typescript
828
- * const ownership = await origin.getFractionOwnership(1n);
829
- *
830
- * if (!ownership.isFractionalized) {
831
- * console.log("This NFT has not been fractionalized");
832
- * } else {
833
- * console.log(`You own ${ownership.ownershipPercentage}% of this NFT`);
834
- * console.log(`Balance: ${ownership.balance} / ${ownership.totalSupply}`);
835
- *
836
- * if (ownership.canRedeem) {
837
- * console.log("You can redeem the original NFT!");
838
- * await origin.redeem(1n);
839
- * }
840
- * }
841
- * ```
842
- */
843
- declare function getFractionOwnership(this: Origin, tokenId: bigint, owner?: Address): Promise<FractionOwnership>;
844
-
845
- /**
846
- * Result of checking if a user can fractionalize an NFT.
847
- */
848
- interface FractionalizeEligibility {
849
- canFractionalize: boolean;
850
- /** Reason why user cannot fractionalize (if canFractionalize is false) */
851
- reason?: string;
852
- isOwner: boolean;
853
- currentOwner: Address;
854
- isAlreadyFractionalized: boolean;
855
- /** ERC20 address if already fractionalized */
856
- existingErc20Address?: Address;
857
- dataStatus: DataStatus;
858
- isApproved: boolean;
859
- needsApproval: boolean;
860
- }
861
- /**
862
- * Checks if a user can fractionalize an NFT and why not if they can't.
863
- * Returns detailed information about eligibility requirements.
765
+ * Gets the Royalty Token balance for a holder in a token's vault.
766
+ * If no holder is provided, the connected wallet address is used.
864
767
  *
865
- * @param tokenId The token ID of the NFT to check.
866
- * @param owner Optional address to check. If not provided, uses connected wallet.
867
- * @returns A promise that resolves with the fractionalize eligibility details.
868
- *
869
- * @example
870
- * ```typescript
871
- * const eligibility = await origin.canFractionalize(1n);
872
- *
873
- * if (eligibility.canFractionalize) {
874
- * if (eligibility.needsApproval) {
875
- * // Use fractionalizeWithApproval for convenience
876
- * await origin.fractionalizeWithApproval(1n);
877
- * } else {
878
- * await origin.fractionalize(1n);
879
- * }
880
- * } else {
881
- * console.log(`Cannot fractionalize: ${eligibility.reason}`);
882
- * }
883
- * ```
768
+ * @param tokenId The token ID whose vault to query.
769
+ * @param holder Optional holder address. Defaults to connected wallet.
770
+ * @returns The royalty token balance info including vault address, balance, total supply, percentage, and decimals.
884
771
  */
885
- declare function canFractionalize(this: Origin, tokenId: bigint, owner?: Address): Promise<FractionalizeEligibility>;
772
+ declare function getRoyaltyTokenBalance(this: Origin, tokenId: bigint, holder?: Address): Promise<RoyaltyTokenBalance>;
886
773
 
887
774
  /**
888
775
  * Gets information about a registered app from the AppRegistry.
@@ -1127,7 +1014,6 @@ declare class Origin {
1127
1014
  registerIpNFT: typeof registerIpNFT;
1128
1015
  updateTerms: typeof updateTerms;
1129
1016
  finalizeDelete: typeof finalizeDelete;
1130
- getOrCreateRoyaltyVault: typeof getOrCreateRoyaltyVault;
1131
1017
  getTerms: typeof getTerms;
1132
1018
  ownerOf: typeof ownerOf;
1133
1019
  balanceOf: typeof balanceOf;
@@ -1161,13 +1047,13 @@ declare class Origin {
1161
1047
  canVoteOnDispute: typeof canVoteOnDispute;
1162
1048
  getDisputeProgress: typeof getDisputeProgress;
1163
1049
  getDisputeRequirements: typeof getDisputeRequirements;
1164
- fractionalize: typeof fractionalize;
1165
- redeem: typeof redeem;
1166
- getTokenForNFT: typeof getTokenForNFT;
1167
- fractionalizeWithApproval: typeof fractionalizeWithApproval;
1168
- redeemIfComplete: typeof redeemIfComplete;
1169
- getFractionOwnership: typeof getFractionOwnership;
1170
- canFractionalize: typeof canFractionalize;
1050
+ getRoyaltyVault: typeof getRoyaltyVault;
1051
+ getVaultRevenueTokens: typeof getVaultRevenueTokens;
1052
+ claimableRevenue: typeof claimableRevenue;
1053
+ claimRevenue: typeof claimRevenue;
1054
+ claimRevenueBatch: typeof claimRevenueBatch;
1055
+ deployVaultForExistingNFT: typeof deployVaultForExistingNFT;
1056
+ getRoyaltyTokenBalance: typeof getRoyaltyTokenBalance;
1171
1057
  getAppInfo: typeof getAppInfo;
1172
1058
  private jwt?;
1173
1059
  environment: Environment;
@@ -1563,4 +1449,4 @@ declare class Auth {
1563
1449
  unlinkTelegram(): Promise<any>;
1564
1450
  }
1565
1451
 
1566
- export { type AppInfo, Auth, type BaseSigner, BrowserStorage, type BulkCostPreview, type BulkMintFileEntry, type BuyParams, CustomSignerAdapter, DataStatus, type Dispute, type DisputeProgress, DisputeStatus, EthersSignerAdapter, type FractionOwnership, type FractionalizeEligibility, type LicenseTerms, LicenseType, MemoryStorage, type MintParams, Origin, type SignerAdapter, type SignerType, type StorageAdapter, type TokenInfo, type TolerantMintResult, type TolerantResult, ViemSignerAdapter, type VoteEligibility, mainnet as campMainnet, testnet as campTestnet, createLicenseTerms, createNodeWalletClient, createSignerAdapter, decodeCidFromBytes32, encodeCidToBytes32 };
1452
+ export { type AppInfo, Auth, type BaseSigner, BrowserStorage, type BulkCostPreview, type BulkMintFileEntry, type BuyParams, CustomSignerAdapter, DataStatus, type Dispute, type DisputeProgress, DisputeStatus, EthersSignerAdapter, type LicenseTerms, LicenseType, MemoryStorage, type MintParams, Origin, type RoyaltyTokenBalance, type SignerAdapter, type SignerType, type StorageAdapter, type TokenInfo, type TolerantMintResult, type TolerantResult, ViemSignerAdapter, type VoteEligibility, mainnet as campMainnet, testnet as campTestnet, createLicenseTerms, createNodeWalletClient, createSignerAdapter, decodeCidFromBytes32, encodeCidToBytes32 };
@@ -139,17 +139,16 @@ interface Environment {
139
139
  MARKETPLACE_CONTRACT_ADDRESS: string;
140
140
  BATCH_OPERATIONS_CONTRACT_ADDRESS: string;
141
141
  DISPUTE_CONTRACT_ADDRESS?: string;
142
- FRACTIONALIZER_CONTRACT_ADDRESS?: string;
143
142
  APP_REGISTRY_CONTRACT_ADDRESS?: string;
144
- USDC_CONTRACT_ADDRESS: string;
143
+ IP_ROYALTY_VAULT_FACTORY_CONTRACT_ADDRESS?: string;
145
144
  CHAIN: any;
146
145
  IPNFT_ABI?: any;
147
146
  MARKETPLACE_ABI?: any;
148
147
  TBA_ABI?: any;
149
148
  BATCH_OPERATIONS_ABI?: any;
150
149
  DISPUTE_ABI?: any;
151
- FRACTIONALIZER_ABI?: any;
152
150
  APP_REGISTRY_ABI?: any;
151
+ IP_ROYALTY_VAULT_FACTORY_ABI?: any;
153
152
  }
154
153
 
155
154
  /**
@@ -300,14 +299,6 @@ declare function updateTerms(this: Origin, tokenId: bigint, newTerms: LicenseTer
300
299
  */
301
300
  declare function finalizeDelete(this: Origin, tokenId: bigint): Promise<any>;
302
301
 
303
- /**
304
- * Calls the getOrCreateRoyaltyVault method on the IPNFT contract.
305
- * @param tokenOwner The address of the token owner for whom to get or create the royalty vault.
306
- * @param simulateOnly If true, simulates the transaction without executing it.
307
- * @returns The address of the royalty vault associated with the specified token owner.
308
- */
309
- declare function getOrCreateRoyaltyVault(this: Origin, tokenOwner: Address, simulateOnly?: boolean): Promise<Address>;
310
-
311
302
  /**
312
303
  * Returns the license terms associated with a specific token ID.
313
304
  * @param tokenId The token ID to query.
@@ -707,182 +698,78 @@ interface DisputeRequirements {
707
698
  declare function getDisputeRequirements(this: Origin, userAddress: Address): Promise<DisputeRequirements>;
708
699
 
709
700
  /**
710
- * Fractionalizes an IP NFT into fungible ERC20 tokens.
711
- * The NFT is transferred to the fractionalizer contract and a new ERC20 token is created.
712
- * The caller receives the full supply of fractional tokens.
713
- *
714
- * @param tokenId The token ID of the IP NFT to fractionalize.
715
- * @returns A promise that resolves with the transaction result.
716
- *
717
- * @example
718
- * ```typescript
719
- * // First approve the fractionalizer contract to transfer your NFT
720
- * await origin.approve(fractionalizerAddress, tokenId);
701
+ * Gets the royalty vault address for a given token ID.
702
+ * Returns null if no vault has been deployed yet.
721
703
  *
722
- * // Then fractionalize
723
- * const result = await origin.fractionalize(1n);
724
- * ```
704
+ * @param tokenId The token ID to look up.
705
+ * @returns The vault address, or null if no vault exists.
725
706
  */
726
- declare function fractionalize(this: Origin, tokenId: bigint): Promise<any>;
707
+ declare function getRoyaltyVault(this: Origin, tokenId: bigint): Promise<Address | null>;
727
708
 
728
709
  /**
729
- * Redeems an IP NFT by burning all of its fractional tokens.
730
- * The caller must hold the entire supply of the NFT's fractional token.
731
- * After redemption, the NFT is transferred back to the caller.
732
- *
733
- * @param tokenId The token ID of the IP NFT to redeem.
734
- * @returns A promise that resolves with the transaction result.
710
+ * Gets the list of revenue token addresses that have accumulated in a token's vault.
735
711
  *
736
- * @example
737
- * ```typescript
738
- * // Requires holding 100% of the fractional token supply
739
- * await origin.redeem(1n);
740
- * ```
712
+ * @param tokenId The token ID to look up.
713
+ * @returns An array of ERC20 token addresses with revenue in the vault.
741
714
  */
742
- declare function redeem(this: Origin, tokenId: bigint): Promise<any>;
715
+ declare function getVaultRevenueTokens(this: Origin, tokenId: bigint): Promise<Address[]>;
743
716
 
744
717
  /**
745
- * Gets the fractional ERC20 token address for a specific IP NFT.
746
- * Returns zero address if the NFT has not been fractionalized.
747
- *
748
- * @param tokenId The token ID of the IP NFT.
749
- * @returns A promise that resolves with the fractional token address.
718
+ * Returns the amount of revenue claimable by a holder for a given token and revenue token.
719
+ * If no holder is provided, the connected wallet address is used.
750
720
  *
751
- * @example
752
- * ```typescript
753
- * const fractionalToken = await origin.getTokenForNFT(1n);
754
- * if (fractionalToken !== zeroAddress) {
755
- * console.log(`Fractional token: ${fractionalToken}`);
756
- * } else {
757
- * console.log("NFT has not been fractionalized");
758
- * }
759
- * ```
721
+ * @param tokenId The token ID whose vault to query.
722
+ * @param revenueToken The ERC20 revenue token address.
723
+ * @param holder Optional holder address. Defaults to connected wallet.
724
+ * @returns The claimable amount in the revenue token's smallest unit.
760
725
  */
761
- declare function getTokenForNFT(this: Origin, tokenId: bigint): Promise<Address>;
726
+ declare function claimableRevenue(this: Origin, tokenId: bigint, revenueToken: Address, holder?: Address): Promise<bigint>;
762
727
 
763
728
  /**
764
- * Fractionalizes an IP NFT with automatic approval.
765
- * This method first approves the fractionalizer contract to transfer your NFT,
766
- * then calls fractionalize. This is the recommended method for most use cases.
767
- *
768
- * @param tokenId The token ID of the IP NFT to fractionalize.
769
- * @returns A promise that resolves with the transaction result.
729
+ * Claims accumulated revenue for a token from a specific revenue token.
730
+ * The caller must hold Royalty Tokens to claim their proportional share.
770
731
  *
771
- * @example
772
- * ```typescript
773
- * // Single call handles approval and fractionalization
774
- * const result = await origin.fractionalizeWithApproval(1n);
775
- * ```
732
+ * @param tokenId The token ID whose vault to claim from.
733
+ * @param revenueToken The ERC20 revenue token address to claim.
734
+ * @returns The transaction result.
776
735
  */
777
- declare function fractionalizeWithApproval(this: Origin, tokenId: bigint): Promise<any>;
736
+ declare function claimRevenue(this: Origin, tokenId: bigint, revenueToken: Address): Promise<any>;
778
737
 
779
738
  /**
780
- * Redeems fractional tokens for the underlying NFT, but only if the caller owns 100% of the supply.
781
- * This method checks the caller's balance before attempting to redeem, providing a clear error
782
- * if they don't hold the full supply.
739
+ * Claims accumulated revenue for a token from multiple revenue tokens in a single transaction.
740
+ * The caller must hold Royalty Tokens to claim their proportional share.
783
741
  *
784
- * @param tokenId The token ID of the original NFT to redeem.
785
- * @returns A promise that resolves with the transaction result.
786
- * @throws Error if the caller doesn't own 100% of the fractional tokens.
787
- *
788
- * @example
789
- * ```typescript
790
- * try {
791
- * const result = await origin.redeemIfComplete(1n);
792
- * console.log("NFT redeemed successfully!");
793
- * } catch (error) {
794
- * console.log("You don't own all fractional tokens yet");
795
- * }
796
- * ```
742
+ * @param tokenId The token ID whose vault to claim from.
743
+ * @param revenueTokens Array of ERC20 revenue token addresses to claim.
744
+ * @returns The transaction result.
797
745
  */
798
- declare function redeemIfComplete(this: Origin, tokenId: bigint): Promise<any>;
746
+ declare function claimRevenueBatch(this: Origin, tokenId: bigint, revenueTokens: Address[]): Promise<any>;
799
747
 
800
748
  /**
801
- * Ownership information for fractional tokens.
749
+ * Deploys a new royalty vault for an existing NFT that was minted before the vault system.
750
+ * This is used to migrate old NFTs to the new royalty vault system.
751
+ *
752
+ * @param tokenId The token ID to deploy a vault for.
753
+ * @returns The transaction result including the new vault address.
802
754
  */
803
- interface FractionOwnership {
804
- tokenId: bigint;
805
- /** The ERC20 token address (zero if not fractionalized) */
806
- erc20Address: Address;
807
- isFractionalized: boolean;
808
- /** User's balance of fractional tokens */
755
+ declare function deployVaultForExistingNFT(this: Origin, tokenId: bigint): Promise<any>;
756
+
757
+ interface RoyaltyTokenBalance {
758
+ vaultAddress: Address;
809
759
  balance: bigint;
810
- /** Total supply of fractional tokens */
811
760
  totalSupply: bigint;
812
- /** User's ownership percentage (0-100) */
813
- ownershipPercentage: number;
814
- /** Whether user owns 100% and can redeem */
815
- canRedeem: boolean;
761
+ percentage: number;
816
762
  decimals: number;
817
763
  }
818
764
  /**
819
- * Gets a user's ownership percentage of a fractionalized NFT.
820
- * Returns detailed information about the user's fractional token holdings.
821
- *
822
- * @param tokenId The token ID of the original NFT.
823
- * @param owner Optional address to check. If not provided, uses connected wallet.
824
- * @returns A promise that resolves with the ownership details.
825
- *
826
- * @example
827
- * ```typescript
828
- * const ownership = await origin.getFractionOwnership(1n);
829
- *
830
- * if (!ownership.isFractionalized) {
831
- * console.log("This NFT has not been fractionalized");
832
- * } else {
833
- * console.log(`You own ${ownership.ownershipPercentage}% of this NFT`);
834
- * console.log(`Balance: ${ownership.balance} / ${ownership.totalSupply}`);
835
- *
836
- * if (ownership.canRedeem) {
837
- * console.log("You can redeem the original NFT!");
838
- * await origin.redeem(1n);
839
- * }
840
- * }
841
- * ```
842
- */
843
- declare function getFractionOwnership(this: Origin, tokenId: bigint, owner?: Address): Promise<FractionOwnership>;
844
-
845
- /**
846
- * Result of checking if a user can fractionalize an NFT.
847
- */
848
- interface FractionalizeEligibility {
849
- canFractionalize: boolean;
850
- /** Reason why user cannot fractionalize (if canFractionalize is false) */
851
- reason?: string;
852
- isOwner: boolean;
853
- currentOwner: Address;
854
- isAlreadyFractionalized: boolean;
855
- /** ERC20 address if already fractionalized */
856
- existingErc20Address?: Address;
857
- dataStatus: DataStatus;
858
- isApproved: boolean;
859
- needsApproval: boolean;
860
- }
861
- /**
862
- * Checks if a user can fractionalize an NFT and why not if they can't.
863
- * Returns detailed information about eligibility requirements.
765
+ * Gets the Royalty Token balance for a holder in a token's vault.
766
+ * If no holder is provided, the connected wallet address is used.
864
767
  *
865
- * @param tokenId The token ID of the NFT to check.
866
- * @param owner Optional address to check. If not provided, uses connected wallet.
867
- * @returns A promise that resolves with the fractionalize eligibility details.
868
- *
869
- * @example
870
- * ```typescript
871
- * const eligibility = await origin.canFractionalize(1n);
872
- *
873
- * if (eligibility.canFractionalize) {
874
- * if (eligibility.needsApproval) {
875
- * // Use fractionalizeWithApproval for convenience
876
- * await origin.fractionalizeWithApproval(1n);
877
- * } else {
878
- * await origin.fractionalize(1n);
879
- * }
880
- * } else {
881
- * console.log(`Cannot fractionalize: ${eligibility.reason}`);
882
- * }
883
- * ```
768
+ * @param tokenId The token ID whose vault to query.
769
+ * @param holder Optional holder address. Defaults to connected wallet.
770
+ * @returns The royalty token balance info including vault address, balance, total supply, percentage, and decimals.
884
771
  */
885
- declare function canFractionalize(this: Origin, tokenId: bigint, owner?: Address): Promise<FractionalizeEligibility>;
772
+ declare function getRoyaltyTokenBalance(this: Origin, tokenId: bigint, holder?: Address): Promise<RoyaltyTokenBalance>;
886
773
 
887
774
  /**
888
775
  * Gets information about a registered app from the AppRegistry.
@@ -1127,7 +1014,6 @@ declare class Origin {
1127
1014
  registerIpNFT: typeof registerIpNFT;
1128
1015
  updateTerms: typeof updateTerms;
1129
1016
  finalizeDelete: typeof finalizeDelete;
1130
- getOrCreateRoyaltyVault: typeof getOrCreateRoyaltyVault;
1131
1017
  getTerms: typeof getTerms;
1132
1018
  ownerOf: typeof ownerOf;
1133
1019
  balanceOf: typeof balanceOf;
@@ -1161,13 +1047,13 @@ declare class Origin {
1161
1047
  canVoteOnDispute: typeof canVoteOnDispute;
1162
1048
  getDisputeProgress: typeof getDisputeProgress;
1163
1049
  getDisputeRequirements: typeof getDisputeRequirements;
1164
- fractionalize: typeof fractionalize;
1165
- redeem: typeof redeem;
1166
- getTokenForNFT: typeof getTokenForNFT;
1167
- fractionalizeWithApproval: typeof fractionalizeWithApproval;
1168
- redeemIfComplete: typeof redeemIfComplete;
1169
- getFractionOwnership: typeof getFractionOwnership;
1170
- canFractionalize: typeof canFractionalize;
1050
+ getRoyaltyVault: typeof getRoyaltyVault;
1051
+ getVaultRevenueTokens: typeof getVaultRevenueTokens;
1052
+ claimableRevenue: typeof claimableRevenue;
1053
+ claimRevenue: typeof claimRevenue;
1054
+ claimRevenueBatch: typeof claimRevenueBatch;
1055
+ deployVaultForExistingNFT: typeof deployVaultForExistingNFT;
1056
+ getRoyaltyTokenBalance: typeof getRoyaltyTokenBalance;
1171
1057
  getAppInfo: typeof getAppInfo;
1172
1058
  private jwt?;
1173
1059
  environment: Environment;
@@ -1563,4 +1449,4 @@ declare class Auth {
1563
1449
  unlinkTelegram(): Promise<any>;
1564
1450
  }
1565
1451
 
1566
- export { type AppInfo, Auth, type BaseSigner, BrowserStorage, type BulkCostPreview, type BulkMintFileEntry, type BuyParams, CustomSignerAdapter, DataStatus, type Dispute, type DisputeProgress, DisputeStatus, EthersSignerAdapter, type FractionOwnership, type FractionalizeEligibility, type LicenseTerms, LicenseType, MemoryStorage, type MintParams, Origin, type SignerAdapter, type SignerType, type StorageAdapter, type TokenInfo, type TolerantMintResult, type TolerantResult, ViemSignerAdapter, type VoteEligibility, mainnet as campMainnet, testnet as campTestnet, createLicenseTerms, createNodeWalletClient, createSignerAdapter, decodeCidFromBytes32, encodeCidToBytes32 };
1452
+ export { type AppInfo, Auth, type BaseSigner, BrowserStorage, type BulkCostPreview, type BulkMintFileEntry, type BuyParams, CustomSignerAdapter, DataStatus, type Dispute, type DisputeProgress, DisputeStatus, EthersSignerAdapter, type LicenseTerms, LicenseType, MemoryStorage, type MintParams, Origin, type RoyaltyTokenBalance, type SignerAdapter, type SignerType, type StorageAdapter, type TokenInfo, type TolerantMintResult, type TolerantResult, ViemSignerAdapter, type VoteEligibility, mainnet as campMainnet, testnet as campTestnet, createLicenseTerms, createNodeWalletClient, createSignerAdapter, decodeCidFromBytes32, encodeCidToBytes32 };