@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
|
@@ -13,6 +13,7 @@ interface Environment {
|
|
|
13
13
|
IPNFT_ABI?: any;
|
|
14
14
|
MARKETPLACE_ABI?: any;
|
|
15
15
|
ROYALTY_VAULT_ABI?: any;
|
|
16
|
+
TBA_ABI?: any;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
/**
|
|
@@ -57,7 +58,7 @@ type IpNFTSource = "spotify" | "twitter" | "tiktok" | "file";
|
|
|
57
58
|
* @param signature The signature for the minting operation.
|
|
58
59
|
* @returns A promise that resolves when the minting is complete.
|
|
59
60
|
*/
|
|
60
|
-
declare function mintWithSignature(this: Origin, to: Address, tokenId: bigint, parents: bigint[], hash: Hex, uri: string, licenseTerms: LicenseTerms, deadline: bigint, signature: Hex): Promise<any>;
|
|
61
|
+
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>;
|
|
61
62
|
/**
|
|
62
63
|
* Registers a Data NFT with the Origin service in order to obtain a signature for minting.
|
|
63
64
|
* @param source The source of the Data NFT (e.g., "spotify", "twitter", "tiktok", or "file").
|
|
@@ -173,7 +174,7 @@ interface OriginUsageReturnType {
|
|
|
173
174
|
dataSources: Array<any>;
|
|
174
175
|
}
|
|
175
176
|
interface RoyaltyInfo {
|
|
176
|
-
|
|
177
|
+
tokenBoundAccount: Address;
|
|
177
178
|
balance: bigint;
|
|
178
179
|
balanceFormatted: string;
|
|
179
180
|
}
|
|
@@ -252,29 +253,50 @@ declare class Origin {
|
|
|
252
253
|
buyAccessSmart(tokenId: bigint): Promise<any>;
|
|
253
254
|
getData(tokenId: bigint): Promise<any>;
|
|
254
255
|
/**
|
|
255
|
-
* Get
|
|
256
|
+
* Get the Token Bound Account (TBA) address for a specific token ID.
|
|
257
|
+
* @param {bigint} tokenId - The token ID to get the TBA address for.
|
|
258
|
+
* @returns {Promise<Address>} A promise that resolves with the TBA address.
|
|
259
|
+
* @throws {Error} Throws an error if the TBA address cannot be retrieved.
|
|
260
|
+
* @example
|
|
261
|
+
* ```typescript
|
|
262
|
+
* const tbaAddress = await origin.getTokenBoundAccount(1n);
|
|
263
|
+
* console.log(`TBA Address: ${tbaAddress}`);
|
|
264
|
+
* ```
|
|
265
|
+
*/
|
|
266
|
+
getTokenBoundAccount(tokenId: bigint): Promise<Address>;
|
|
267
|
+
/**
|
|
268
|
+
* Get royalty information for a token ID, including the token bound account address and its balance.
|
|
269
|
+
* @param {bigint} tokenId - The token ID to check royalties for.
|
|
256
270
|
* @param {Address} [token] - Optional token address to check royalties for. If not provided, checks for native token.
|
|
257
|
-
* @
|
|
258
|
-
* @
|
|
259
|
-
* @throws {Error} Throws an error if no wallet is connected and no owner address is provided.
|
|
271
|
+
* @returns {Promise<RoyaltyInfo>} A promise that resolves with the token bound account address and balance information.
|
|
272
|
+
* @throws {Error} Throws an error if the token bound account cannot be retrieved.
|
|
260
273
|
* @example
|
|
261
274
|
* ```typescript
|
|
262
|
-
* // Get royalties for
|
|
263
|
-
* const royalties = await origin.getRoyalties();
|
|
275
|
+
* // Get royalties for a specific token
|
|
276
|
+
* const royalties = await origin.getRoyalties(1n);
|
|
264
277
|
*
|
|
265
|
-
* // Get royalties for specific
|
|
266
|
-
* const royalties = await origin.getRoyalties("0x1234...");
|
|
278
|
+
* // Get ERC20 token royalties for a specific token
|
|
279
|
+
* const royalties = await origin.getRoyalties(1n, "0x1234...");
|
|
267
280
|
* ```
|
|
268
281
|
*/
|
|
269
|
-
getRoyalties(
|
|
282
|
+
getRoyalties(tokenId: bigint, token?: Address): Promise<RoyaltyInfo>;
|
|
270
283
|
/**
|
|
271
|
-
* Claim royalties from
|
|
284
|
+
* Claim royalties from a token's Token Bound Account (TBA).
|
|
285
|
+
* @param {bigint} tokenId - The token ID to claim royalties from.
|
|
286
|
+
* @param {Address} [recipient] - Optional recipient address. If not provided, uses the connected wallet.
|
|
272
287
|
* @param {Address} [token] - Optional token address to claim royalties in. If not provided, claims in native token.
|
|
273
|
-
* @param {Address} [owner] - Optional wallet address to claim royalties for. If not provided, uses the connected wallet.
|
|
274
288
|
* @returns {Promise<any>} A promise that resolves when the claim transaction is confirmed.
|
|
275
|
-
* @throws {Error} Throws an error if no wallet is connected and no
|
|
289
|
+
* @throws {Error} Throws an error if no wallet is connected and no recipient address is provided.
|
|
290
|
+
* @example
|
|
291
|
+
* ```typescript
|
|
292
|
+
* // Claim native token royalties for token #1 to connected wallet
|
|
293
|
+
* await origin.claimRoyalties(1n);
|
|
294
|
+
*
|
|
295
|
+
* // Claim ERC20 token royalties to a specific address
|
|
296
|
+
* await origin.claimRoyalties(1n, "0xRecipient...", "0xToken...");
|
|
297
|
+
* ```
|
|
276
298
|
*/
|
|
277
|
-
claimRoyalties(
|
|
299
|
+
claimRoyalties(tokenId: bigint, recipient?: Address, token?: Address): Promise<any>;
|
|
278
300
|
}
|
|
279
301
|
|
|
280
302
|
declare global {
|