@campnetwork/origin 0.0.16 → 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.
@@ -0,0 +1,10 @@
1
+ import React, { ReactNode } from "react";
2
+ interface ToastContextProps {
3
+ addToast: (message: string, type?: "info" | "success" | "error" | "warning", duration?: number) => void;
4
+ }
5
+ interface ToastProviderProps {
6
+ children: ReactNode;
7
+ }
8
+ export declare const ToastProvider: ({ children }: ToastProviderProps) => React.JSX.Element;
9
+ export declare const useToast: () => ToastContextProps;
10
+ export {};
@@ -2,6 +2,18 @@ import React, { JSX } from 'react';
2
2
  import { Address, Hex, Abi } from 'viem';
3
3
  import { UseQueryResult } from '@tanstack/react-query';
4
4
 
5
+ interface Environment {
6
+ NAME: string;
7
+ AUTH_HUB_BASE_API: string;
8
+ AUTH_ENDPOINT: string;
9
+ ORIGIN_DASHBOARD: string;
10
+ DATANFT_CONTRACT_ADDRESS: string;
11
+ MARKETPLACE_CONTRACT_ADDRESS: string;
12
+ CHAIN: any;
13
+ IPNFT_ABI?: any;
14
+ MARKETPLACE_ABI?: any;
15
+ }
16
+
5
17
  /**
6
18
  * Represents the terms of a license for a digital asset.
7
19
  * @property price - The price of the asset in wei.
@@ -36,7 +48,7 @@ type IpNFTSource = "spotify" | "twitter" | "tiktok" | "file";
36
48
  * Mints a Data NFT with a signature.
37
49
  * @param to The address to mint the NFT to.
38
50
  * @param tokenId The ID of the token to mint.
39
- * @param parentId The ID of the parent NFT, if applicable.
51
+ * @param parents The IDs of the parent NFTs, if applicable.
40
52
  * @param hash The hash of the data associated with the NFT.
41
53
  * @param uri The URI of the NFT metadata.
42
54
  * @param licenseTerms The terms of the license for the NFT.
@@ -44,7 +56,7 @@ type IpNFTSource = "spotify" | "twitter" | "tiktok" | "file";
44
56
  * @param signature The signature for the minting operation.
45
57
  * @returns A promise that resolves when the minting is complete.
46
58
  */
47
- declare function mintWithSignature(this: Origin, to: Address, tokenId: bigint, parentId: bigint, hash: Hex, uri: string, licenseTerms: LicenseTerms, deadline: bigint, signature: Hex): Promise<any>;
59
+ declare function mintWithSignature(this: Origin, to: Address, tokenId: bigint, parents: bigint[], hash: Hex, uri: string, licenseTerms: LicenseTerms, deadline: bigint, signature: Hex): Promise<any>;
48
60
  /**
49
61
  * Registers a Data NFT with the Origin service in order to obtain a signature for minting.
50
62
  * @param source The source of the Data NFT (e.g., "spotify", "twitter", "tiktok", or "file").
@@ -52,7 +64,7 @@ declare function mintWithSignature(this: Origin, to: Address, tokenId: bigint, p
52
64
  * @param fileKey Optional file key for file uploads.
53
65
  * @return A promise that resolves with the registration data.
54
66
  */
55
- declare function registerIpNFT(this: Origin, source: IpNFTSource, deadline: bigint, licenseTerms: LicenseTerms, metadata: Record<string, unknown>, fileKey?: string | string[], parentId?: bigint): Promise<any>;
67
+ declare function registerIpNFT(this: Origin, source: IpNFTSource, deadline: bigint, licenseTerms: LicenseTerms, metadata: Record<string, unknown>, fileKey?: string | string[], parents?: bigint[]): Promise<any>;
56
68
 
57
69
  declare function updateTerms(this: Origin, tokenId: bigint, royaltyReceiver: Address, newTerms: LicenseTerms): Promise<any>;
58
70
 
@@ -134,14 +146,15 @@ declare class Origin {
134
146
  hasAccess: typeof hasAccess;
135
147
  subscriptionExpiry: typeof subscriptionExpiry;
136
148
  private jwt;
149
+ environment: Environment;
137
150
  private viemClient?;
138
- constructor(jwt: string, viemClient?: any);
151
+ constructor(jwt: string, environment: Environment, viemClient?: any);
139
152
  getJwt(): string;
140
153
  setViemClient(client: any): void;
141
154
  uploadFile: (file: File, options?: {
142
155
  progressCallback?: (percent: number) => void;
143
156
  }) => Promise<any>;
144
- mintFile: (file: File, metadata: Record<string, unknown>, license: LicenseTerms, parentId?: bigint, options?: {
157
+ mintFile: (file: File, metadata: Record<string, unknown>, license: LicenseTerms, parents?: bigint[], options?: {
145
158
  progressCallback?: (percent: number) => void;
146
159
  }) => Promise<string | null>;
147
160
  mintSocial: (source: "spotify" | "twitter" | "tiktok", metadata: Record<string, unknown>, license: LicenseTerms) => Promise<string | null>;
@@ -206,6 +219,7 @@ declare class Auth {
206
219
  userId: string | null;
207
220
  viem: any;
208
221
  origin: Origin | null;
222
+ environment: Environment;
209
223
  /**
210
224
  * Constructor for the Auth class.
211
225
  * @param {object} options The options object.
@@ -213,13 +227,15 @@ declare class Auth {
213
227
  * @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.
214
228
  * @param {boolean} [options.allowAnalytics=true] Whether to allow analytics to be sent.
215
229
  * @param {object} [options.ackeeInstance] The Ackee instance.
230
+ * @param {("DEVELOPMENT"|"PRODUCTION")} [options.environment="DEVELOPMENT"] The environment to use.
216
231
  * @throws {APIError} - Throws an error if the clientId is not provided.
217
232
  */
218
- constructor({ clientId, redirectUri, allowAnalytics, ackeeInstance, }: {
233
+ constructor({ clientId, redirectUri, allowAnalytics, ackeeInstance, environment, }: {
219
234
  clientId: string;
220
235
  redirectUri: string | Record<string, string>;
221
236
  allowAnalytics?: boolean;
222
237
  ackeeInstance?: any;
238
+ environment?: "DEVELOPMENT" | "PRODUCTION";
223
239
  });
224
240
  /**
225
241
  * Subscribe to an event. Possible events are "state", "provider", "providers", and "viem".
@@ -255,6 +271,10 @@ declare class Auth {
255
271
  * @returns {void}
256
272
  */
257
273
  setWalletAddress(walletAddress: string): void;
274
+ /**
275
+ * Recover the provider from local storage.
276
+ * @returns {Promise<void>}
277
+ */
258
278
  recoverProvider(): Promise<void>;
259
279
  /**
260
280
  * Disconnect the user.
@@ -374,6 +394,7 @@ interface CampContextType {
374
394
  wagmiAvailable: boolean;
375
395
  ackee: any;
376
396
  setAckee: any;
397
+ environment: Environment;
377
398
  }
378
399
  declare const CampContext: React.Context<CampContextType>;
379
400
  /**
@@ -385,11 +406,12 @@ declare const CampContext: React.Context<CampContextType>;
385
406
  * @param {boolean} props.allowAnalytics Whether to allow analytics to be sent
386
407
  * @returns {JSX.Element} The CampProvider component
387
408
  */
388
- declare const CampProvider: ({ clientId, redirectUri, children, allowAnalytics, }: {
409
+ declare const CampProvider: ({ clientId, redirectUri, children, environment, }: {
389
410
  clientId: string;
390
411
  redirectUri?: string;
391
412
  children: React.ReactNode;
392
413
  allowAnalytics?: boolean;
414
+ environment?: "DEVELOPMENT" | "PRODUCTION";
393
415
  }) => React.JSX.Element;
394
416
 
395
417
  interface ModalContextProps {
@@ -407,6 +429,8 @@ declare const ModalContext: React.Context<ModalContextProps>;
407
429
  interface Provider {
408
430
  info: {
409
431
  uuid: string;
432
+ name?: string;
433
+ icon?: string;
410
434
  };
411
435
  provider: any;
412
436
  }