@campnetwork/origin 1.0.1 → 1.2.0-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/README.md +4 -4
- package/dist/core.cjs +102 -73
- package/dist/core.d.ts +37 -15
- package/dist/core.esm.d.ts +37 -15
- package/dist/core.esm.js +123 -94
- package/dist/react/index.esm.d.ts +37 -15
- package/dist/react/index.esm.js +2143 -1565
- package/package.json +1 -1
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
|
/**
|
|
@@ -251,7 +252,7 @@ type IpNFTSource = "spotify" | "twitter" | "tiktok" | "file";
|
|
|
251
252
|
* @param signature The signature for the minting operation.
|
|
252
253
|
* @returns A promise that resolves when the minting is complete.
|
|
253
254
|
*/
|
|
254
|
-
declare function mintWithSignature(this: Origin, to: Address, tokenId: bigint, parents: bigint[], hash: Hex, uri: string, licenseTerms: LicenseTerms, deadline: bigint, signature: Hex): Promise<any>;
|
|
255
|
+
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>;
|
|
255
256
|
/**
|
|
256
257
|
* Registers a Data NFT with the Origin service in order to obtain a signature for minting.
|
|
257
258
|
* @param source The source of the Data NFT (e.g., "spotify", "twitter", "tiktok", or "file").
|
|
@@ -367,7 +368,7 @@ interface OriginUsageReturnType {
|
|
|
367
368
|
dataSources: Array<any>;
|
|
368
369
|
}
|
|
369
370
|
interface RoyaltyInfo {
|
|
370
|
-
|
|
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
|
|
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
|
-
* @
|
|
452
|
-
* @
|
|
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
|
|
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
|
|
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(
|
|
476
|
+
getRoyalties(tokenId: bigint, token?: Address): Promise<RoyaltyInfo>;
|
|
464
477
|
/**
|
|
465
|
-
* Claim royalties from
|
|
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
|
|
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(
|
|
493
|
+
claimRoyalties(tokenId: bigint, recipient?: Address, token?: Address): Promise<any>;
|
|
472
494
|
}
|
|
473
495
|
|
|
474
496
|
declare global {
|
package/dist/core.esm.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
|
/**
|
|
@@ -251,7 +252,7 @@ type IpNFTSource = "spotify" | "twitter" | "tiktok" | "file";
|
|
|
251
252
|
* @param signature The signature for the minting operation.
|
|
252
253
|
* @returns A promise that resolves when the minting is complete.
|
|
253
254
|
*/
|
|
254
|
-
declare function mintWithSignature(this: Origin, to: Address, tokenId: bigint, parents: bigint[], hash: Hex, uri: string, licenseTerms: LicenseTerms, deadline: bigint, signature: Hex): Promise<any>;
|
|
255
|
+
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>;
|
|
255
256
|
/**
|
|
256
257
|
* Registers a Data NFT with the Origin service in order to obtain a signature for minting.
|
|
257
258
|
* @param source The source of the Data NFT (e.g., "spotify", "twitter", "tiktok", or "file").
|
|
@@ -367,7 +368,7 @@ interface OriginUsageReturnType {
|
|
|
367
368
|
dataSources: Array<any>;
|
|
368
369
|
}
|
|
369
370
|
interface RoyaltyInfo {
|
|
370
|
-
|
|
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
|
|
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
|
-
* @
|
|
452
|
-
* @
|
|
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
|
|
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
|
|
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(
|
|
476
|
+
getRoyalties(tokenId: bigint, token?: Address): Promise<RoyaltyInfo>;
|
|
464
477
|
/**
|
|
465
|
-
* Claim royalties from
|
|
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
|
|
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(
|
|
493
|
+
claimRoyalties(tokenId: bigint, recipient?: Address, token?: Address): Promise<any>;
|
|
472
494
|
}
|
|
473
495
|
|
|
474
496
|
declare global {
|