@campnetwork/origin 0.0.17 → 1.0.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
@@ -196,6 +196,18 @@ declare class SpotifyAPI {
196
196
  _fetchDataWithAuth(url: string): Promise<object>;
197
197
  }
198
198
 
199
+ interface Environment {
200
+ NAME: string;
201
+ AUTH_HUB_BASE_API: string;
202
+ AUTH_ENDPOINT: string;
203
+ ORIGIN_DASHBOARD: string;
204
+ DATANFT_CONTRACT_ADDRESS: string;
205
+ MARKETPLACE_CONTRACT_ADDRESS: string;
206
+ CHAIN: any;
207
+ IPNFT_ABI?: any;
208
+ MARKETPLACE_ABI?: any;
209
+ }
210
+
199
211
  /**
200
212
  * Represents the terms of a license for a digital asset.
201
213
  * @property price - The price of the asset in wei.
@@ -230,7 +242,7 @@ type IpNFTSource = "spotify" | "twitter" | "tiktok" | "file";
230
242
  * Mints a Data NFT with a signature.
231
243
  * @param to The address to mint the NFT to.
232
244
  * @param tokenId The ID of the token to mint.
233
- * @param parentId The ID of the parent NFT, if applicable.
245
+ * @param parents The IDs of the parent NFTs, if applicable.
234
246
  * @param hash The hash of the data associated with the NFT.
235
247
  * @param uri The URI of the NFT metadata.
236
248
  * @param licenseTerms The terms of the license for the NFT.
@@ -238,7 +250,7 @@ type IpNFTSource = "spotify" | "twitter" | "tiktok" | "file";
238
250
  * @param signature The signature for the minting operation.
239
251
  * @returns A promise that resolves when the minting is complete.
240
252
  */
241
- declare function mintWithSignature(this: Origin, to: Address, tokenId: bigint, parentId: bigint, hash: Hex, uri: string, licenseTerms: LicenseTerms, deadline: bigint, signature: Hex): Promise<any>;
253
+ declare function mintWithSignature(this: Origin, to: Address, tokenId: bigint, parents: bigint[], hash: Hex, uri: string, licenseTerms: LicenseTerms, deadline: bigint, signature: Hex): Promise<any>;
242
254
  /**
243
255
  * Registers a Data NFT with the Origin service in order to obtain a signature for minting.
244
256
  * @param source The source of the Data NFT (e.g., "spotify", "twitter", "tiktok", or "file").
@@ -246,7 +258,7 @@ declare function mintWithSignature(this: Origin, to: Address, tokenId: bigint, p
246
258
  * @param fileKey Optional file key for file uploads.
247
259
  * @return A promise that resolves with the registration data.
248
260
  */
249
- declare function registerIpNFT(this: Origin, source: IpNFTSource, deadline: bigint, licenseTerms: LicenseTerms, metadata: Record<string, unknown>, fileKey?: string | string[], parentId?: bigint): Promise<any>;
261
+ declare function registerIpNFT(this: Origin, source: IpNFTSource, deadline: bigint, licenseTerms: LicenseTerms, metadata: Record<string, unknown>, fileKey?: string | string[], parents?: bigint[]): Promise<any>;
250
262
 
251
263
  declare function updateTerms(this: Origin, tokenId: bigint, royaltyReceiver: Address, newTerms: LicenseTerms): Promise<any>;
252
264
 
@@ -328,14 +340,15 @@ declare class Origin {
328
340
  hasAccess: typeof hasAccess;
329
341
  subscriptionExpiry: typeof subscriptionExpiry;
330
342
  private jwt;
343
+ environment: Environment;
331
344
  private viemClient?;
332
- constructor(jwt: string, viemClient?: any);
345
+ constructor(jwt: string, environment: Environment, viemClient?: any);
333
346
  getJwt(): string;
334
347
  setViemClient(client: any): void;
335
348
  uploadFile: (file: File, options?: {
336
349
  progressCallback?: (percent: number) => void;
337
350
  }) => Promise<any>;
338
- mintFile: (file: File, metadata: Record<string, unknown>, license: LicenseTerms, parentId?: bigint, options?: {
351
+ mintFile: (file: File, metadata: Record<string, unknown>, license: LicenseTerms, parents?: bigint[], options?: {
339
352
  progressCallback?: (percent: number) => void;
340
353
  }) => Promise<string | null>;
341
354
  mintSocial: (source: "spotify" | "twitter" | "tiktok", metadata: Record<string, unknown>, license: LicenseTerms) => Promise<string | null>;
@@ -400,6 +413,7 @@ declare class Auth {
400
413
  userId: string | null;
401
414
  viem: any;
402
415
  origin: Origin | null;
416
+ environment: Environment;
403
417
  /**
404
418
  * Constructor for the Auth class.
405
419
  * @param {object} options The options object.
@@ -407,13 +421,15 @@ declare class Auth {
407
421
  * @param {string|object} options.redirectUri The redirect URI used for oauth. Leave empty if you want to use the current URL. If you want different redirect URIs for different socials, pass an object with the socials as keys and the redirect URIs as values.
408
422
  * @param {boolean} [options.allowAnalytics=true] Whether to allow analytics to be sent.
409
423
  * @param {object} [options.ackeeInstance] The Ackee instance.
424
+ * @param {("DEVELOPMENT"|"PRODUCTION")} [options.environment="DEVELOPMENT"] The environment to use.
410
425
  * @throws {APIError} - Throws an error if the clientId is not provided.
411
426
  */
412
- constructor({ clientId, redirectUri, allowAnalytics, ackeeInstance, }: {
427
+ constructor({ clientId, redirectUri, allowAnalytics, ackeeInstance, environment, }: {
413
428
  clientId: string;
414
429
  redirectUri: string | Record<string, string>;
415
430
  allowAnalytics?: boolean;
416
431
  ackeeInstance?: any;
432
+ environment?: "DEVELOPMENT" | "PRODUCTION";
417
433
  });
418
434
  /**
419
435
  * Subscribe to an event. Possible events are "state", "provider", "providers", and "viem".
@@ -449,6 +465,10 @@ declare class Auth {
449
465
  * @returns {void}
450
466
  */
451
467
  setWalletAddress(walletAddress: string): void;
468
+ /**
469
+ * Recover the provider from local storage.
470
+ * @returns {Promise<void>}
471
+ */
452
472
  recoverProvider(): Promise<void>;
453
473
  /**
454
474
  * Disconnect the user.
@@ -196,6 +196,18 @@ declare class SpotifyAPI {
196
196
  _fetchDataWithAuth(url: string): Promise<object>;
197
197
  }
198
198
 
199
+ interface Environment {
200
+ NAME: string;
201
+ AUTH_HUB_BASE_API: string;
202
+ AUTH_ENDPOINT: string;
203
+ ORIGIN_DASHBOARD: string;
204
+ DATANFT_CONTRACT_ADDRESS: string;
205
+ MARKETPLACE_CONTRACT_ADDRESS: string;
206
+ CHAIN: any;
207
+ IPNFT_ABI?: any;
208
+ MARKETPLACE_ABI?: any;
209
+ }
210
+
199
211
  /**
200
212
  * Represents the terms of a license for a digital asset.
201
213
  * @property price - The price of the asset in wei.
@@ -230,7 +242,7 @@ type IpNFTSource = "spotify" | "twitter" | "tiktok" | "file";
230
242
  * Mints a Data NFT with a signature.
231
243
  * @param to The address to mint the NFT to.
232
244
  * @param tokenId The ID of the token to mint.
233
- * @param parentId The ID of the parent NFT, if applicable.
245
+ * @param parents The IDs of the parent NFTs, if applicable.
234
246
  * @param hash The hash of the data associated with the NFT.
235
247
  * @param uri The URI of the NFT metadata.
236
248
  * @param licenseTerms The terms of the license for the NFT.
@@ -238,7 +250,7 @@ type IpNFTSource = "spotify" | "twitter" | "tiktok" | "file";
238
250
  * @param signature The signature for the minting operation.
239
251
  * @returns A promise that resolves when the minting is complete.
240
252
  */
241
- declare function mintWithSignature(this: Origin, to: Address, tokenId: bigint, parentId: bigint, hash: Hex, uri: string, licenseTerms: LicenseTerms, deadline: bigint, signature: Hex): Promise<any>;
253
+ declare function mintWithSignature(this: Origin, to: Address, tokenId: bigint, parents: bigint[], hash: Hex, uri: string, licenseTerms: LicenseTerms, deadline: bigint, signature: Hex): Promise<any>;
242
254
  /**
243
255
  * Registers a Data NFT with the Origin service in order to obtain a signature for minting.
244
256
  * @param source The source of the Data NFT (e.g., "spotify", "twitter", "tiktok", or "file").
@@ -246,7 +258,7 @@ declare function mintWithSignature(this: Origin, to: Address, tokenId: bigint, p
246
258
  * @param fileKey Optional file key for file uploads.
247
259
  * @return A promise that resolves with the registration data.
248
260
  */
249
- declare function registerIpNFT(this: Origin, source: IpNFTSource, deadline: bigint, licenseTerms: LicenseTerms, metadata: Record<string, unknown>, fileKey?: string | string[], parentId?: bigint): Promise<any>;
261
+ declare function registerIpNFT(this: Origin, source: IpNFTSource, deadline: bigint, licenseTerms: LicenseTerms, metadata: Record<string, unknown>, fileKey?: string | string[], parents?: bigint[]): Promise<any>;
250
262
 
251
263
  declare function updateTerms(this: Origin, tokenId: bigint, royaltyReceiver: Address, newTerms: LicenseTerms): Promise<any>;
252
264
 
@@ -328,14 +340,15 @@ declare class Origin {
328
340
  hasAccess: typeof hasAccess;
329
341
  subscriptionExpiry: typeof subscriptionExpiry;
330
342
  private jwt;
343
+ environment: Environment;
331
344
  private viemClient?;
332
- constructor(jwt: string, viemClient?: any);
345
+ constructor(jwt: string, environment: Environment, viemClient?: any);
333
346
  getJwt(): string;
334
347
  setViemClient(client: any): void;
335
348
  uploadFile: (file: File, options?: {
336
349
  progressCallback?: (percent: number) => void;
337
350
  }) => Promise<any>;
338
- mintFile: (file: File, metadata: Record<string, unknown>, license: LicenseTerms, parentId?: bigint, options?: {
351
+ mintFile: (file: File, metadata: Record<string, unknown>, license: LicenseTerms, parents?: bigint[], options?: {
339
352
  progressCallback?: (percent: number) => void;
340
353
  }) => Promise<string | null>;
341
354
  mintSocial: (source: "spotify" | "twitter" | "tiktok", metadata: Record<string, unknown>, license: LicenseTerms) => Promise<string | null>;
@@ -400,6 +413,7 @@ declare class Auth {
400
413
  userId: string | null;
401
414
  viem: any;
402
415
  origin: Origin | null;
416
+ environment: Environment;
403
417
  /**
404
418
  * Constructor for the Auth class.
405
419
  * @param {object} options The options object.
@@ -407,13 +421,15 @@ declare class Auth {
407
421
  * @param {string|object} options.redirectUri The redirect URI used for oauth. Leave empty if you want to use the current URL. If you want different redirect URIs for different socials, pass an object with the socials as keys and the redirect URIs as values.
408
422
  * @param {boolean} [options.allowAnalytics=true] Whether to allow analytics to be sent.
409
423
  * @param {object} [options.ackeeInstance] The Ackee instance.
424
+ * @param {("DEVELOPMENT"|"PRODUCTION")} [options.environment="DEVELOPMENT"] The environment to use.
410
425
  * @throws {APIError} - Throws an error if the clientId is not provided.
411
426
  */
412
- constructor({ clientId, redirectUri, allowAnalytics, ackeeInstance, }: {
427
+ constructor({ clientId, redirectUri, allowAnalytics, ackeeInstance, environment, }: {
413
428
  clientId: string;
414
429
  redirectUri: string | Record<string, string>;
415
430
  allowAnalytics?: boolean;
416
431
  ackeeInstance?: any;
432
+ environment?: "DEVELOPMENT" | "PRODUCTION";
417
433
  });
418
434
  /**
419
435
  * Subscribe to an event. Possible events are "state", "provider", "providers", and "viem".
@@ -449,6 +465,10 @@ declare class Auth {
449
465
  * @returns {void}
450
466
  */
451
467
  setWalletAddress(walletAddress: string): void;
468
+ /**
469
+ * Recover the provider from local storage.
470
+ * @returns {Promise<void>}
471
+ */
452
472
  recoverProvider(): Promise<void>;
453
473
  /**
454
474
  * Disconnect the user.