@campnetwork/origin 1.0.0-alpha.0 → 1.0.0-alpha.10
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/LICENSE +21 -21
- package/README.md +1139 -1139
- package/dist/core.cjs +114 -39
- package/dist/core.d.ts +111 -34
- package/dist/core.esm.d.ts +111 -34
- package/dist/core.esm.js +155 -80
- package/dist/react/index.esm.d.ts +111 -34
- package/dist/react/index.esm.js +521 -235
- package/package.json +73 -73
package/dist/core.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Address, Hex, Abi } from 'viem';
|
|
1
|
+
import { Address, Hex, WalletClient, Abi } from 'viem';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* The TwitterAPI class.
|
|
@@ -206,6 +206,7 @@ interface Environment {
|
|
|
206
206
|
CHAIN: any;
|
|
207
207
|
IPNFT_ABI?: any;
|
|
208
208
|
MARKETPLACE_ABI?: any;
|
|
209
|
+
ROYALTY_VAULT_ABI?: any;
|
|
209
210
|
}
|
|
210
211
|
|
|
211
212
|
/**
|
|
@@ -260,26 +261,70 @@ declare function mintWithSignature(this: Origin, to: Address, tokenId: bigint, p
|
|
|
260
261
|
*/
|
|
261
262
|
declare function registerIpNFT(this: Origin, source: IpNFTSource, deadline: bigint, licenseTerms: LicenseTerms, metadata: Record<string, unknown>, fileKey?: string | string[], parents?: bigint[]): Promise<any>;
|
|
262
263
|
|
|
263
|
-
|
|
264
|
+
/**
|
|
265
|
+
* Updates the license terms of a specified IPNFT.
|
|
266
|
+
* @param tokenId The ID of the IPNFT to update.
|
|
267
|
+
* @param newTerms The new license terms to set.
|
|
268
|
+
* @returns A promise that resolves when the transaction is complete.
|
|
269
|
+
*/
|
|
270
|
+
declare function updateTerms(this: Origin, tokenId: bigint, newTerms: LicenseTerms): Promise<any>;
|
|
264
271
|
|
|
265
|
-
|
|
272
|
+
/**
|
|
273
|
+
* Sets the IPNFT as deleted
|
|
274
|
+
* @param tokenId The token ID to set as deleted.
|
|
275
|
+
* @returns A promise that resolves when the transaction is complete.
|
|
276
|
+
*/
|
|
277
|
+
declare function finalizeDelete(this: Origin, tokenId: bigint): Promise<any>;
|
|
266
278
|
|
|
279
|
+
/**
|
|
280
|
+
* Calls the getOrCreateRoyaltyVault method on the IPNFT contract.
|
|
281
|
+
* @param tokenOwner The address of the token owner for whom to get or create the royalty vault.
|
|
282
|
+
* @param simulateOnly If true, simulates the transaction without executing it.
|
|
283
|
+
* @returns The address of the royalty vault associated with the specified token owner.
|
|
284
|
+
*/
|
|
285
|
+
declare function getOrCreateRoyaltyVault(this: Origin, tokenOwner: Address, simulateOnly?: boolean): Promise<Address>;
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Returns the license terms associated with a specific token ID.
|
|
289
|
+
* @param tokenId The token ID to query.
|
|
290
|
+
* @returns The license terms of the token ID.
|
|
291
|
+
*/
|
|
267
292
|
declare function getTerms(this: Origin, tokenId: bigint): Promise<any>;
|
|
268
293
|
|
|
294
|
+
/**
|
|
295
|
+
* Returns the owner of the specified IPNFT.
|
|
296
|
+
* @param tokenId The ID of the IPNFT to query.
|
|
297
|
+
* @returns The address of the owner of the IPNFT.
|
|
298
|
+
*/
|
|
269
299
|
declare function ownerOf(this: Origin, tokenId: bigint): Promise<any>;
|
|
270
300
|
|
|
301
|
+
/**
|
|
302
|
+
* Returns the number of IPNFTs owned by the given address.
|
|
303
|
+
* @param owner The address to query.
|
|
304
|
+
* @returns The number of IPNFTs owned by the address.
|
|
305
|
+
*/
|
|
271
306
|
declare function balanceOf(this: Origin, owner: Address): Promise<any>;
|
|
272
307
|
|
|
273
|
-
|
|
274
|
-
|
|
308
|
+
/**
|
|
309
|
+
* Returns the metadata URI associated with a specific token ID.
|
|
310
|
+
* @param tokenId The token ID to query.
|
|
311
|
+
* @returns The metadata URI of the token ID.
|
|
312
|
+
*/
|
|
275
313
|
declare function tokenURI(this: Origin, tokenId: bigint): Promise<any>;
|
|
276
314
|
|
|
315
|
+
/**
|
|
316
|
+
* Returns the data status of the given token ID.
|
|
317
|
+
* @param tokenId The token ID to query.
|
|
318
|
+
* @returns The data status of the token ID.
|
|
319
|
+
*/
|
|
277
320
|
declare function dataStatus(this: Origin, tokenId: bigint): Promise<DataStatus>;
|
|
278
321
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
322
|
+
/**
|
|
323
|
+
* Checks if an operator is approved to manage all assets of a given owner.
|
|
324
|
+
* @param owner The address of the asset owner.
|
|
325
|
+
* @param operator The address of the operator to check.
|
|
326
|
+
* @return A promise that resolves to a boolean indicating if the operator is approved for all assets of the owner.
|
|
327
|
+
*/
|
|
283
328
|
declare function isApprovedForAll(this: Origin, owner: Address, operator: Address): Promise<boolean>;
|
|
284
329
|
|
|
285
330
|
declare function transferFrom(this: Origin, from: Address, to: Address, tokenId: bigint): Promise<any>;
|
|
@@ -290,10 +335,24 @@ declare function approve(this: Origin, to: Address, tokenId: bigint): Promise<an
|
|
|
290
335
|
|
|
291
336
|
declare function setApprovalForAll(this: Origin, operator: Address, approved: boolean): Promise<any>;
|
|
292
337
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
338
|
+
/**
|
|
339
|
+
* Buys access to a data NFT for a specified duration.
|
|
340
|
+
* @param buyer The address of the buyer.
|
|
341
|
+
* @param tokenId The ID of the data NFT.
|
|
342
|
+
* @param expectedPrice The expected price for the access.
|
|
343
|
+
* @param expectedDuration The expected duration of the access in seconds.
|
|
344
|
+
* @param expectedPaymentToken The address of the payment token (use zero address for native token).
|
|
345
|
+
* @param value The amount of native token to send (only required if paying with native token).
|
|
346
|
+
* @returns A promise that resolves when the transaction is confirmed.
|
|
347
|
+
*/
|
|
348
|
+
declare function buyAccess(this: Origin, buyer: Address, tokenId: bigint, expectedPrice: bigint, expectedDuration: bigint, expectedPaymentToken: Address, value?: bigint): Promise<any>;
|
|
296
349
|
|
|
350
|
+
/**
|
|
351
|
+
* Checks if a user has access to a specific token based on subscription expiry.
|
|
352
|
+
* @param user - The address of the user.
|
|
353
|
+
* @param tokenId - The ID of the token.
|
|
354
|
+
* @returns A promise that resolves to a boolean indicating if the user has access.
|
|
355
|
+
*/
|
|
297
356
|
declare function hasAccess(this: Origin, user: Address, tokenId: bigint): Promise<boolean>;
|
|
298
357
|
|
|
299
358
|
declare function subscriptionExpiry(this: Origin, tokenId: bigint, user: Address): Promise<bigint>;
|
|
@@ -307,10 +366,16 @@ interface OriginUsageReturnType {
|
|
|
307
366
|
teams: Array<any>;
|
|
308
367
|
dataSources: Array<any>;
|
|
309
368
|
}
|
|
369
|
+
interface RoyaltyInfo {
|
|
370
|
+
royaltyVault: Address;
|
|
371
|
+
balance: bigint;
|
|
372
|
+
balanceFormatted: string;
|
|
373
|
+
}
|
|
310
374
|
type CallOptions = {
|
|
311
375
|
value?: bigint;
|
|
312
376
|
gas?: bigint;
|
|
313
377
|
waitForReceipt?: boolean;
|
|
378
|
+
simulate?: boolean;
|
|
314
379
|
};
|
|
315
380
|
/**
|
|
316
381
|
* The Origin class
|
|
@@ -321,38 +386,35 @@ declare class Origin {
|
|
|
321
386
|
mintWithSignature: typeof mintWithSignature;
|
|
322
387
|
registerIpNFT: typeof registerIpNFT;
|
|
323
388
|
updateTerms: typeof updateTerms;
|
|
324
|
-
|
|
389
|
+
finalizeDelete: typeof finalizeDelete;
|
|
390
|
+
getOrCreateRoyaltyVault: typeof getOrCreateRoyaltyVault;
|
|
325
391
|
getTerms: typeof getTerms;
|
|
326
392
|
ownerOf: typeof ownerOf;
|
|
327
393
|
balanceOf: typeof balanceOf;
|
|
328
|
-
contentHash: typeof contentHash;
|
|
329
394
|
tokenURI: typeof tokenURI;
|
|
330
395
|
dataStatus: typeof dataStatus;
|
|
331
|
-
royaltyInfo: typeof royaltyInfo;
|
|
332
|
-
getApproved: typeof getApproved;
|
|
333
396
|
isApprovedForAll: typeof isApprovedForAll;
|
|
334
397
|
transferFrom: typeof transferFrom;
|
|
335
398
|
safeTransferFrom: typeof safeTransferFrom;
|
|
336
399
|
approve: typeof approve;
|
|
337
400
|
setApprovalForAll: typeof setApprovalForAll;
|
|
338
401
|
buyAccess: typeof buyAccess;
|
|
339
|
-
renewAccess: typeof renewAccess;
|
|
340
402
|
hasAccess: typeof hasAccess;
|
|
341
403
|
subscriptionExpiry: typeof subscriptionExpiry;
|
|
342
404
|
private jwt;
|
|
343
405
|
environment: Environment;
|
|
344
406
|
private viemClient?;
|
|
345
|
-
constructor(jwt: string, environment: Environment, viemClient?:
|
|
407
|
+
constructor(jwt: string, environment: Environment, viemClient?: WalletClient);
|
|
346
408
|
getJwt(): string;
|
|
347
|
-
setViemClient(client:
|
|
348
|
-
uploadFile
|
|
409
|
+
setViemClient(client: WalletClient): void;
|
|
410
|
+
uploadFile(file: File, options?: {
|
|
349
411
|
progressCallback?: (percent: number) => void;
|
|
350
|
-
})
|
|
351
|
-
mintFile
|
|
412
|
+
}): Promise<any>;
|
|
413
|
+
mintFile(file: File, metadata: Record<string, unknown>, license: LicenseTerms, parents?: bigint[], options?: {
|
|
352
414
|
progressCallback?: (percent: number) => void;
|
|
353
|
-
})
|
|
354
|
-
mintSocial
|
|
355
|
-
getOriginUploads
|
|
415
|
+
}): Promise<string | null>;
|
|
416
|
+
mintSocial(source: "spotify" | "twitter" | "tiktok", metadata: Record<string, unknown>, license: LicenseTerms): Promise<string | null>;
|
|
417
|
+
getOriginUploads(): Promise<any[] | null>;
|
|
356
418
|
/**
|
|
357
419
|
* Get the user's Origin stats (multiplier, consent, usage, etc.).
|
|
358
420
|
* @returns {Promise<OriginUsageReturnType>} A promise that resolves with the user's Origin stats.
|
|
@@ -365,13 +427,6 @@ declare class Origin {
|
|
|
365
427
|
* @throws {Error|APIError} - Throws an error if the user is not authenticated. Also throws an error if the consent is not provided.
|
|
366
428
|
*/
|
|
367
429
|
setOriginConsent(consent: boolean): Promise<void>;
|
|
368
|
-
/**
|
|
369
|
-
* Set the user's Origin multiplier.
|
|
370
|
-
* @param {number} multiplier The user's Origin multiplier.
|
|
371
|
-
* @returns {Promise<void>}
|
|
372
|
-
* @throws {Error|APIError} - Throws an error if the user is not authenticated. Also throws an error if the multiplier is not provided.
|
|
373
|
-
*/
|
|
374
|
-
setOriginMultiplier(multiplier: number): Promise<void>;
|
|
375
430
|
/**
|
|
376
431
|
* Call a contract method.
|
|
377
432
|
* @param {string} contractAddress The contract address.
|
|
@@ -386,11 +441,33 @@ declare class Origin {
|
|
|
386
441
|
/**
|
|
387
442
|
* Buy access to an asset by first checking its price via getTerms, then calling buyAccess.
|
|
388
443
|
* @param {bigint} tokenId The token ID of the asset.
|
|
389
|
-
* @param {number} periods The number of periods to buy access for.
|
|
390
444
|
* @returns {Promise<any>} The result of the buyAccess call.
|
|
391
445
|
*/
|
|
392
|
-
buyAccessSmart(tokenId: bigint
|
|
446
|
+
buyAccessSmart(tokenId: bigint): Promise<any>;
|
|
393
447
|
getData(tokenId: bigint): Promise<any>;
|
|
448
|
+
/**
|
|
449
|
+
* Get royalty information for a wallet address, including the royalty vault address and its balance.
|
|
450
|
+
* @param {Address} [owner] - Optional wallet address to check royalties for. If not provided, uses the connected wallet.
|
|
451
|
+
* @returns {Promise<RoyaltyInfo>} A promise that resolves with the royalty vault address and balance information.
|
|
452
|
+
* @throws {Error} Throws an error if no wallet is connected and no owner address is provided.
|
|
453
|
+
* @example
|
|
454
|
+
* ```typescript
|
|
455
|
+
* // Get royalties for connected wallet
|
|
456
|
+
* const royalties = await origin.getRoyalties();
|
|
457
|
+
*
|
|
458
|
+
* // Get royalties for specific address
|
|
459
|
+
* const royalties = await origin.getRoyalties("0x1234...");
|
|
460
|
+
* ```
|
|
461
|
+
*/
|
|
462
|
+
getRoyalties(token?: Address, owner?: Address): Promise<RoyaltyInfo>;
|
|
463
|
+
/**
|
|
464
|
+
* Claim royalties from the royalty vault.
|
|
465
|
+
* @param {Address} [token] - Optional token address to claim royalties in. If not provided, claims in native token.
|
|
466
|
+
* @param {Address} [owner] - Optional wallet address to claim royalties for. If not provided, uses the connected wallet.
|
|
467
|
+
* @returns {Promise<any>} A promise that resolves when the claim transaction is confirmed.
|
|
468
|
+
* @throws {Error} Throws an error if no wallet is connected and no owner address is provided.
|
|
469
|
+
*/
|
|
470
|
+
claimRoyalties(token?: Address, owner?: Address): Promise<any>;
|
|
394
471
|
}
|
|
395
472
|
|
|
396
473
|
declare global {
|
package/dist/core.esm.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Address, Hex, Abi } from 'viem';
|
|
1
|
+
import { Address, Hex, WalletClient, Abi } from 'viem';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* The TwitterAPI class.
|
|
@@ -206,6 +206,7 @@ interface Environment {
|
|
|
206
206
|
CHAIN: any;
|
|
207
207
|
IPNFT_ABI?: any;
|
|
208
208
|
MARKETPLACE_ABI?: any;
|
|
209
|
+
ROYALTY_VAULT_ABI?: any;
|
|
209
210
|
}
|
|
210
211
|
|
|
211
212
|
/**
|
|
@@ -260,26 +261,70 @@ declare function mintWithSignature(this: Origin, to: Address, tokenId: bigint, p
|
|
|
260
261
|
*/
|
|
261
262
|
declare function registerIpNFT(this: Origin, source: IpNFTSource, deadline: bigint, licenseTerms: LicenseTerms, metadata: Record<string, unknown>, fileKey?: string | string[], parents?: bigint[]): Promise<any>;
|
|
262
263
|
|
|
263
|
-
|
|
264
|
+
/**
|
|
265
|
+
* Updates the license terms of a specified IPNFT.
|
|
266
|
+
* @param tokenId The ID of the IPNFT to update.
|
|
267
|
+
* @param newTerms The new license terms to set.
|
|
268
|
+
* @returns A promise that resolves when the transaction is complete.
|
|
269
|
+
*/
|
|
270
|
+
declare function updateTerms(this: Origin, tokenId: bigint, newTerms: LicenseTerms): Promise<any>;
|
|
264
271
|
|
|
265
|
-
|
|
272
|
+
/**
|
|
273
|
+
* Sets the IPNFT as deleted
|
|
274
|
+
* @param tokenId The token ID to set as deleted.
|
|
275
|
+
* @returns A promise that resolves when the transaction is complete.
|
|
276
|
+
*/
|
|
277
|
+
declare function finalizeDelete(this: Origin, tokenId: bigint): Promise<any>;
|
|
266
278
|
|
|
279
|
+
/**
|
|
280
|
+
* Calls the getOrCreateRoyaltyVault method on the IPNFT contract.
|
|
281
|
+
* @param tokenOwner The address of the token owner for whom to get or create the royalty vault.
|
|
282
|
+
* @param simulateOnly If true, simulates the transaction without executing it.
|
|
283
|
+
* @returns The address of the royalty vault associated with the specified token owner.
|
|
284
|
+
*/
|
|
285
|
+
declare function getOrCreateRoyaltyVault(this: Origin, tokenOwner: Address, simulateOnly?: boolean): Promise<Address>;
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Returns the license terms associated with a specific token ID.
|
|
289
|
+
* @param tokenId The token ID to query.
|
|
290
|
+
* @returns The license terms of the token ID.
|
|
291
|
+
*/
|
|
267
292
|
declare function getTerms(this: Origin, tokenId: bigint): Promise<any>;
|
|
268
293
|
|
|
294
|
+
/**
|
|
295
|
+
* Returns the owner of the specified IPNFT.
|
|
296
|
+
* @param tokenId The ID of the IPNFT to query.
|
|
297
|
+
* @returns The address of the owner of the IPNFT.
|
|
298
|
+
*/
|
|
269
299
|
declare function ownerOf(this: Origin, tokenId: bigint): Promise<any>;
|
|
270
300
|
|
|
301
|
+
/**
|
|
302
|
+
* Returns the number of IPNFTs owned by the given address.
|
|
303
|
+
* @param owner The address to query.
|
|
304
|
+
* @returns The number of IPNFTs owned by the address.
|
|
305
|
+
*/
|
|
271
306
|
declare function balanceOf(this: Origin, owner: Address): Promise<any>;
|
|
272
307
|
|
|
273
|
-
|
|
274
|
-
|
|
308
|
+
/**
|
|
309
|
+
* Returns the metadata URI associated with a specific token ID.
|
|
310
|
+
* @param tokenId The token ID to query.
|
|
311
|
+
* @returns The metadata URI of the token ID.
|
|
312
|
+
*/
|
|
275
313
|
declare function tokenURI(this: Origin, tokenId: bigint): Promise<any>;
|
|
276
314
|
|
|
315
|
+
/**
|
|
316
|
+
* Returns the data status of the given token ID.
|
|
317
|
+
* @param tokenId The token ID to query.
|
|
318
|
+
* @returns The data status of the token ID.
|
|
319
|
+
*/
|
|
277
320
|
declare function dataStatus(this: Origin, tokenId: bigint): Promise<DataStatus>;
|
|
278
321
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
322
|
+
/**
|
|
323
|
+
* Checks if an operator is approved to manage all assets of a given owner.
|
|
324
|
+
* @param owner The address of the asset owner.
|
|
325
|
+
* @param operator The address of the operator to check.
|
|
326
|
+
* @return A promise that resolves to a boolean indicating if the operator is approved for all assets of the owner.
|
|
327
|
+
*/
|
|
283
328
|
declare function isApprovedForAll(this: Origin, owner: Address, operator: Address): Promise<boolean>;
|
|
284
329
|
|
|
285
330
|
declare function transferFrom(this: Origin, from: Address, to: Address, tokenId: bigint): Promise<any>;
|
|
@@ -290,10 +335,24 @@ declare function approve(this: Origin, to: Address, tokenId: bigint): Promise<an
|
|
|
290
335
|
|
|
291
336
|
declare function setApprovalForAll(this: Origin, operator: Address, approved: boolean): Promise<any>;
|
|
292
337
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
338
|
+
/**
|
|
339
|
+
* Buys access to a data NFT for a specified duration.
|
|
340
|
+
* @param buyer The address of the buyer.
|
|
341
|
+
* @param tokenId The ID of the data NFT.
|
|
342
|
+
* @param expectedPrice The expected price for the access.
|
|
343
|
+
* @param expectedDuration The expected duration of the access in seconds.
|
|
344
|
+
* @param expectedPaymentToken The address of the payment token (use zero address for native token).
|
|
345
|
+
* @param value The amount of native token to send (only required if paying with native token).
|
|
346
|
+
* @returns A promise that resolves when the transaction is confirmed.
|
|
347
|
+
*/
|
|
348
|
+
declare function buyAccess(this: Origin, buyer: Address, tokenId: bigint, expectedPrice: bigint, expectedDuration: bigint, expectedPaymentToken: Address, value?: bigint): Promise<any>;
|
|
296
349
|
|
|
350
|
+
/**
|
|
351
|
+
* Checks if a user has access to a specific token based on subscription expiry.
|
|
352
|
+
* @param user - The address of the user.
|
|
353
|
+
* @param tokenId - The ID of the token.
|
|
354
|
+
* @returns A promise that resolves to a boolean indicating if the user has access.
|
|
355
|
+
*/
|
|
297
356
|
declare function hasAccess(this: Origin, user: Address, tokenId: bigint): Promise<boolean>;
|
|
298
357
|
|
|
299
358
|
declare function subscriptionExpiry(this: Origin, tokenId: bigint, user: Address): Promise<bigint>;
|
|
@@ -307,10 +366,16 @@ interface OriginUsageReturnType {
|
|
|
307
366
|
teams: Array<any>;
|
|
308
367
|
dataSources: Array<any>;
|
|
309
368
|
}
|
|
369
|
+
interface RoyaltyInfo {
|
|
370
|
+
royaltyVault: Address;
|
|
371
|
+
balance: bigint;
|
|
372
|
+
balanceFormatted: string;
|
|
373
|
+
}
|
|
310
374
|
type CallOptions = {
|
|
311
375
|
value?: bigint;
|
|
312
376
|
gas?: bigint;
|
|
313
377
|
waitForReceipt?: boolean;
|
|
378
|
+
simulate?: boolean;
|
|
314
379
|
};
|
|
315
380
|
/**
|
|
316
381
|
* The Origin class
|
|
@@ -321,38 +386,35 @@ declare class Origin {
|
|
|
321
386
|
mintWithSignature: typeof mintWithSignature;
|
|
322
387
|
registerIpNFT: typeof registerIpNFT;
|
|
323
388
|
updateTerms: typeof updateTerms;
|
|
324
|
-
|
|
389
|
+
finalizeDelete: typeof finalizeDelete;
|
|
390
|
+
getOrCreateRoyaltyVault: typeof getOrCreateRoyaltyVault;
|
|
325
391
|
getTerms: typeof getTerms;
|
|
326
392
|
ownerOf: typeof ownerOf;
|
|
327
393
|
balanceOf: typeof balanceOf;
|
|
328
|
-
contentHash: typeof contentHash;
|
|
329
394
|
tokenURI: typeof tokenURI;
|
|
330
395
|
dataStatus: typeof dataStatus;
|
|
331
|
-
royaltyInfo: typeof royaltyInfo;
|
|
332
|
-
getApproved: typeof getApproved;
|
|
333
396
|
isApprovedForAll: typeof isApprovedForAll;
|
|
334
397
|
transferFrom: typeof transferFrom;
|
|
335
398
|
safeTransferFrom: typeof safeTransferFrom;
|
|
336
399
|
approve: typeof approve;
|
|
337
400
|
setApprovalForAll: typeof setApprovalForAll;
|
|
338
401
|
buyAccess: typeof buyAccess;
|
|
339
|
-
renewAccess: typeof renewAccess;
|
|
340
402
|
hasAccess: typeof hasAccess;
|
|
341
403
|
subscriptionExpiry: typeof subscriptionExpiry;
|
|
342
404
|
private jwt;
|
|
343
405
|
environment: Environment;
|
|
344
406
|
private viemClient?;
|
|
345
|
-
constructor(jwt: string, environment: Environment, viemClient?:
|
|
407
|
+
constructor(jwt: string, environment: Environment, viemClient?: WalletClient);
|
|
346
408
|
getJwt(): string;
|
|
347
|
-
setViemClient(client:
|
|
348
|
-
uploadFile
|
|
409
|
+
setViemClient(client: WalletClient): void;
|
|
410
|
+
uploadFile(file: File, options?: {
|
|
349
411
|
progressCallback?: (percent: number) => void;
|
|
350
|
-
})
|
|
351
|
-
mintFile
|
|
412
|
+
}): Promise<any>;
|
|
413
|
+
mintFile(file: File, metadata: Record<string, unknown>, license: LicenseTerms, parents?: bigint[], options?: {
|
|
352
414
|
progressCallback?: (percent: number) => void;
|
|
353
|
-
})
|
|
354
|
-
mintSocial
|
|
355
|
-
getOriginUploads
|
|
415
|
+
}): Promise<string | null>;
|
|
416
|
+
mintSocial(source: "spotify" | "twitter" | "tiktok", metadata: Record<string, unknown>, license: LicenseTerms): Promise<string | null>;
|
|
417
|
+
getOriginUploads(): Promise<any[] | null>;
|
|
356
418
|
/**
|
|
357
419
|
* Get the user's Origin stats (multiplier, consent, usage, etc.).
|
|
358
420
|
* @returns {Promise<OriginUsageReturnType>} A promise that resolves with the user's Origin stats.
|
|
@@ -365,13 +427,6 @@ declare class Origin {
|
|
|
365
427
|
* @throws {Error|APIError} - Throws an error if the user is not authenticated. Also throws an error if the consent is not provided.
|
|
366
428
|
*/
|
|
367
429
|
setOriginConsent(consent: boolean): Promise<void>;
|
|
368
|
-
/**
|
|
369
|
-
* Set the user's Origin multiplier.
|
|
370
|
-
* @param {number} multiplier The user's Origin multiplier.
|
|
371
|
-
* @returns {Promise<void>}
|
|
372
|
-
* @throws {Error|APIError} - Throws an error if the user is not authenticated. Also throws an error if the multiplier is not provided.
|
|
373
|
-
*/
|
|
374
|
-
setOriginMultiplier(multiplier: number): Promise<void>;
|
|
375
430
|
/**
|
|
376
431
|
* Call a contract method.
|
|
377
432
|
* @param {string} contractAddress The contract address.
|
|
@@ -386,11 +441,33 @@ declare class Origin {
|
|
|
386
441
|
/**
|
|
387
442
|
* Buy access to an asset by first checking its price via getTerms, then calling buyAccess.
|
|
388
443
|
* @param {bigint} tokenId The token ID of the asset.
|
|
389
|
-
* @param {number} periods The number of periods to buy access for.
|
|
390
444
|
* @returns {Promise<any>} The result of the buyAccess call.
|
|
391
445
|
*/
|
|
392
|
-
buyAccessSmart(tokenId: bigint
|
|
446
|
+
buyAccessSmart(tokenId: bigint): Promise<any>;
|
|
393
447
|
getData(tokenId: bigint): Promise<any>;
|
|
448
|
+
/**
|
|
449
|
+
* Get royalty information for a wallet address, including the royalty vault address and its balance.
|
|
450
|
+
* @param {Address} [owner] - Optional wallet address to check royalties for. If not provided, uses the connected wallet.
|
|
451
|
+
* @returns {Promise<RoyaltyInfo>} A promise that resolves with the royalty vault address and balance information.
|
|
452
|
+
* @throws {Error} Throws an error if no wallet is connected and no owner address is provided.
|
|
453
|
+
* @example
|
|
454
|
+
* ```typescript
|
|
455
|
+
* // Get royalties for connected wallet
|
|
456
|
+
* const royalties = await origin.getRoyalties();
|
|
457
|
+
*
|
|
458
|
+
* // Get royalties for specific address
|
|
459
|
+
* const royalties = await origin.getRoyalties("0x1234...");
|
|
460
|
+
* ```
|
|
461
|
+
*/
|
|
462
|
+
getRoyalties(token?: Address, owner?: Address): Promise<RoyaltyInfo>;
|
|
463
|
+
/**
|
|
464
|
+
* Claim royalties from the royalty vault.
|
|
465
|
+
* @param {Address} [token] - Optional token address to claim royalties in. If not provided, claims in native token.
|
|
466
|
+
* @param {Address} [owner] - Optional wallet address to claim royalties for. If not provided, uses the connected wallet.
|
|
467
|
+
* @returns {Promise<any>} A promise that resolves when the claim transaction is confirmed.
|
|
468
|
+
* @throws {Error} Throws an error if no wallet is connected and no owner address is provided.
|
|
469
|
+
*/
|
|
470
|
+
claimRoyalties(token?: Address, owner?: Address): Promise<any>;
|
|
394
471
|
}
|
|
395
472
|
|
|
396
473
|
declare global {
|