@campnetwork/origin 1.1.0 → 1.2.0-1

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
@@ -207,6 +207,7 @@ interface Environment {
207
207
  IPNFT_ABI?: any;
208
208
  MARKETPLACE_ABI?: any;
209
209
  ROYALTY_VAULT_ABI?: any;
210
+ TBA_ABI?: any;
210
211
  }
211
212
 
212
213
  /**
@@ -367,7 +368,7 @@ interface OriginUsageReturnType {
367
368
  dataSources: Array<any>;
368
369
  }
369
370
  interface RoyaltyInfo {
370
- royaltyVault: Address;
371
+ tokenBoundAccount: Address;
371
372
  balance: bigint;
372
373
  balanceFormatted: string;
373
374
  }
@@ -446,29 +447,50 @@ declare class Origin {
446
447
  buyAccessSmart(tokenId: bigint): Promise<any>;
447
448
  getData(tokenId: bigint): Promise<any>;
448
449
  /**
449
- * Get royalty information for a wallet address, including the royalty vault address and its balance.
450
+ * Get the Token Bound Account (TBA) address for a specific token ID.
451
+ * @param {bigint} tokenId - The token ID to get the TBA address for.
452
+ * @returns {Promise<Address>} A promise that resolves with the TBA address.
453
+ * @throws {Error} Throws an error if the TBA address cannot be retrieved.
454
+ * @example
455
+ * ```typescript
456
+ * const tbaAddress = await origin.getTokenBoundAccount(1n);
457
+ * console.log(`TBA Address: ${tbaAddress}`);
458
+ * ```
459
+ */
460
+ getTokenBoundAccount(tokenId: bigint): Promise<Address>;
461
+ /**
462
+ * Get royalty information for a token ID, including the token bound account address and its balance.
463
+ * @param {bigint} tokenId - The token ID to check royalties for.
450
464
  * @param {Address} [token] - Optional token address to check royalties for. If not provided, checks for native token.
451
- * @param {Address} [owner] - Optional wallet address to check royalties for. If not provided, uses the connected wallet.
452
- * @returns {Promise<RoyaltyInfo>} A promise that resolves with the royalty vault address and balance information.
453
- * @throws {Error} Throws an error if no wallet is connected and no owner address is provided.
465
+ * @returns {Promise<RoyaltyInfo>} A promise that resolves with the token bound account address and balance information.
466
+ * @throws {Error} Throws an error if the token bound account cannot be retrieved.
454
467
  * @example
455
468
  * ```typescript
456
- * // Get royalties for connected wallet
457
- * const royalties = await origin.getRoyalties();
469
+ * // Get royalties for a specific token
470
+ * const royalties = await origin.getRoyalties(1n);
458
471
  *
459
- * // Get royalties for specific address
460
- * const royalties = await origin.getRoyalties("0x1234...");
472
+ * // Get ERC20 token royalties for a specific token
473
+ * const royalties = await origin.getRoyalties(1n, "0x1234...");
461
474
  * ```
462
475
  */
463
- getRoyalties(token?: Address, owner?: Address): Promise<RoyaltyInfo>;
476
+ getRoyalties(tokenId: bigint, token?: Address): Promise<RoyaltyInfo>;
464
477
  /**
465
- * Claim royalties from the royalty vault.
478
+ * Claim royalties from a token's Token Bound Account (TBA).
479
+ * @param {bigint} tokenId - The token ID to claim royalties from.
480
+ * @param {Address} [recipient] - Optional recipient address. If not provided, uses the connected wallet.
466
481
  * @param {Address} [token] - Optional token address to claim royalties in. If not provided, claims in native token.
467
- * @param {Address} [owner] - Optional wallet address to claim royalties for. If not provided, uses the connected wallet.
468
482
  * @returns {Promise<any>} A promise that resolves when the claim transaction is confirmed.
469
- * @throws {Error} Throws an error if no wallet is connected and no owner address is provided.
483
+ * @throws {Error} Throws an error if no wallet is connected and no recipient address is provided.
484
+ * @example
485
+ * ```typescript
486
+ * // Claim native token royalties for token #1 to connected wallet
487
+ * await origin.claimRoyalties(1n);
488
+ *
489
+ * // Claim ERC20 token royalties to a specific address
490
+ * await origin.claimRoyalties(1n, "0xRecipient...", "0xToken...");
491
+ * ```
470
492
  */
471
- claimRoyalties(token?: Address, owner?: Address): Promise<any>;
493
+ claimRoyalties(tokenId: bigint, recipient?: Address, token?: Address): Promise<any>;
472
494
  }
473
495
 
474
496
  declare global {
@@ -207,6 +207,7 @@ interface Environment {
207
207
  IPNFT_ABI?: any;
208
208
  MARKETPLACE_ABI?: any;
209
209
  ROYALTY_VAULT_ABI?: any;
210
+ TBA_ABI?: any;
210
211
  }
211
212
 
212
213
  /**
@@ -367,7 +368,7 @@ interface OriginUsageReturnType {
367
368
  dataSources: Array<any>;
368
369
  }
369
370
  interface RoyaltyInfo {
370
- royaltyVault: Address;
371
+ tokenBoundAccount: Address;
371
372
  balance: bigint;
372
373
  balanceFormatted: string;
373
374
  }
@@ -446,29 +447,50 @@ declare class Origin {
446
447
  buyAccessSmart(tokenId: bigint): Promise<any>;
447
448
  getData(tokenId: bigint): Promise<any>;
448
449
  /**
449
- * Get royalty information for a wallet address, including the royalty vault address and its balance.
450
+ * Get the Token Bound Account (TBA) address for a specific token ID.
451
+ * @param {bigint} tokenId - The token ID to get the TBA address for.
452
+ * @returns {Promise<Address>} A promise that resolves with the TBA address.
453
+ * @throws {Error} Throws an error if the TBA address cannot be retrieved.
454
+ * @example
455
+ * ```typescript
456
+ * const tbaAddress = await origin.getTokenBoundAccount(1n);
457
+ * console.log(`TBA Address: ${tbaAddress}`);
458
+ * ```
459
+ */
460
+ getTokenBoundAccount(tokenId: bigint): Promise<Address>;
461
+ /**
462
+ * Get royalty information for a token ID, including the token bound account address and its balance.
463
+ * @param {bigint} tokenId - The token ID to check royalties for.
450
464
  * @param {Address} [token] - Optional token address to check royalties for. If not provided, checks for native token.
451
- * @param {Address} [owner] - Optional wallet address to check royalties for. If not provided, uses the connected wallet.
452
- * @returns {Promise<RoyaltyInfo>} A promise that resolves with the royalty vault address and balance information.
453
- * @throws {Error} Throws an error if no wallet is connected and no owner address is provided.
465
+ * @returns {Promise<RoyaltyInfo>} A promise that resolves with the token bound account address and balance information.
466
+ * @throws {Error} Throws an error if the token bound account cannot be retrieved.
454
467
  * @example
455
468
  * ```typescript
456
- * // Get royalties for connected wallet
457
- * const royalties = await origin.getRoyalties();
469
+ * // Get royalties for a specific token
470
+ * const royalties = await origin.getRoyalties(1n);
458
471
  *
459
- * // Get royalties for specific address
460
- * const royalties = await origin.getRoyalties("0x1234...");
472
+ * // Get ERC20 token royalties for a specific token
473
+ * const royalties = await origin.getRoyalties(1n, "0x1234...");
461
474
  * ```
462
475
  */
463
- getRoyalties(token?: Address, owner?: Address): Promise<RoyaltyInfo>;
476
+ getRoyalties(tokenId: bigint, token?: Address): Promise<RoyaltyInfo>;
464
477
  /**
465
- * Claim royalties from the royalty vault.
478
+ * Claim royalties from a token's Token Bound Account (TBA).
479
+ * @param {bigint} tokenId - The token ID to claim royalties from.
480
+ * @param {Address} [recipient] - Optional recipient address. If not provided, uses the connected wallet.
466
481
  * @param {Address} [token] - Optional token address to claim royalties in. If not provided, claims in native token.
467
- * @param {Address} [owner] - Optional wallet address to claim royalties for. If not provided, uses the connected wallet.
468
482
  * @returns {Promise<any>} A promise that resolves when the claim transaction is confirmed.
469
- * @throws {Error} Throws an error if no wallet is connected and no owner address is provided.
483
+ * @throws {Error} Throws an error if no wallet is connected and no recipient address is provided.
484
+ * @example
485
+ * ```typescript
486
+ * // Claim native token royalties for token #1 to connected wallet
487
+ * await origin.claimRoyalties(1n);
488
+ *
489
+ * // Claim ERC20 token royalties to a specific address
490
+ * await origin.claimRoyalties(1n, "0xRecipient...", "0xToken...");
491
+ * ```
470
492
  */
471
- claimRoyalties(token?: Address, owner?: Address): Promise<any>;
493
+ claimRoyalties(tokenId: bigint, recipient?: Address, token?: Address): Promise<any>;
472
494
  }
473
495
 
474
496
  declare global {