@campnetwork/origin 1.2.0-4 → 1.2.1

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
@@ -1,201 +1,5 @@
1
1
  import { Address, Hex, WalletClient, Abi, Account, Chain } from 'viem';
2
2
 
3
- /**
4
- * The TwitterAPI class.
5
- * @class
6
- * @classdesc The TwitterAPI class is used to interact with the Twitter API.
7
- */
8
- declare class TwitterAPI {
9
- apiKey: string;
10
- /**
11
- * Constructor for the TwitterAPI class.
12
- * @param {object} options - The options object.
13
- * @param {string} options.apiKey - The API key. (Needed for data fetching)
14
- */
15
- constructor({ apiKey }: {
16
- apiKey: string;
17
- });
18
- /**
19
- * Fetch Twitter user details by username.
20
- * @param {string} twitterUserName - The Twitter username.
21
- * @returns {Promise<object>} - The user details.
22
- * @throws {APIError} - Throws an error if the request fails.
23
- */
24
- fetchUserByUsername(twitterUserName: string): Promise<object>;
25
- /**
26
- * Fetch tweets by Twitter username.
27
- * @param {string} twitterUserName - The Twitter username.
28
- * @param {number} page - The page number.
29
- * @param {number} limit - The number of items per page.
30
- * @returns {Promise<object>} - The tweets.
31
- * @throws {APIError} - Throws an error if the request fails.
32
- */
33
- fetchTweetsByUsername(twitterUserName: string, page?: number, limit?: number): Promise<object>;
34
- /**
35
- * Fetch followers by Twitter username.
36
- * @param {string} twitterUserName - The Twitter username.
37
- * @param {number} page - The page number.
38
- * @param {number} limit - The number of items per page.
39
- * @returns {Promise<object>} - The followers.
40
- * @throws {APIError} - Throws an error if the request fails.
41
- */
42
- fetchFollowersByUsername(twitterUserName: string, page?: number, limit?: number): Promise<object>;
43
- /**
44
- * Fetch following by Twitter username.
45
- * @param {string} twitterUserName - The Twitter username.
46
- * @param {number} page - The page number.
47
- * @param {number} limit - The number of items per page.
48
- * @returns {Promise<object>} - The following.
49
- * @throws {APIError} - Throws an error if the request fails.
50
- */
51
- fetchFollowingByUsername(twitterUserName: string, page?: number, limit?: number): Promise<object>;
52
- /**
53
- * Fetch tweet by tweet ID.
54
- * @param {string} tweetId - The tweet ID.
55
- * @returns {Promise<object>} - The tweet.
56
- * @throws {APIError} - Throws an error if the request fails.
57
- */
58
- fetchTweetById(tweetId: string): Promise<object>;
59
- /**
60
- * Fetch user by wallet address.
61
- * @param {string} walletAddress - The wallet address.
62
- * @param {number} page - The page number.
63
- * @param {number} limit - The number of items per page.
64
- * @returns {Promise<object>} - The user data.
65
- * @throws {APIError} - Throws an error if the request fails.
66
- */
67
- fetchUserByWalletAddress(walletAddress: string, page?: number, limit?: number): Promise<object>;
68
- /**
69
- * Fetch reposted tweets by Twitter username.
70
- * @param {string} twitterUserName - The Twitter username.
71
- * @param {number} page - The page number.
72
- * @param {number} limit - The number of items per page.
73
- * @returns {Promise<object>} - The reposted tweets.
74
- * @throws {APIError} - Throws an error if the request fails.
75
- */
76
- fetchRepostedByUsername(twitterUserName: string, page?: number, limit?: number): Promise<object>;
77
- /**
78
- * Fetch replies by Twitter username.
79
- * @param {string} twitterUserName - The Twitter username.
80
- * @param {number} page - The page number.
81
- * @param {number} limit - The number of items per page.
82
- * @returns {Promise<object>} - The replies.
83
- * @throws {APIError} - Throws an error if the request fails.
84
- */
85
- fetchRepliesByUsername(twitterUserName: string, page?: number, limit?: number): Promise<object>;
86
- /**
87
- * Fetch likes by Twitter username.
88
- * @param {string} twitterUserName - The Twitter username.
89
- * @param {number} page - The page number.
90
- * @param {number} limit - The number of items per page.
91
- * @returns {Promise<object>} - The likes.
92
- * @throws {APIError} - Throws an error if the request fails.
93
- */
94
- fetchLikesByUsername(twitterUserName: string, page?: number, limit?: number): Promise<object>;
95
- /**
96
- * Fetch follows by Twitter username.
97
- * @param {string} twitterUserName - The Twitter username.
98
- * @param {number} page - The page number.
99
- * @param {number} limit - The number of items per page.
100
- * @returns {Promise<object>} - The follows.
101
- * @throws {APIError} - Throws an error if the request fails.
102
- */
103
- fetchFollowsByUsername(twitterUserName: string, page?: number, limit?: number): Promise<object>;
104
- /**
105
- * Fetch viewed tweets by Twitter username.
106
- * @param {string} twitterUserName - The Twitter username.
107
- * @param {number} page - The page number.
108
- * @param {number} limit - The number of items per page.
109
- * @returns {Promise<object>} - The viewed tweets.
110
- * @throws {APIError} - Throws an error if the request fails.
111
- */
112
- fetchViewedTweetsByUsername(twitterUserName: string, page?: number, limit?: number): Promise<object>;
113
- /**
114
- * Private method to fetch data with authorization header.
115
- * @param {string} url - The URL to fetch.
116
- * @returns {Promise<object>} - The response data.
117
- * @throws {APIError} - Throws an error if the request fails.
118
- */
119
- _fetchDataWithAuth(url: string): Promise<object>;
120
- }
121
-
122
- interface SpotifyAPIOptions {
123
- apiKey: string;
124
- }
125
- /**
126
- * The SpotifyAPI class.
127
- * @class
128
- */
129
- declare class SpotifyAPI {
130
- apiKey: string;
131
- /**
132
- * Constructor for the SpotifyAPI class.
133
- * @constructor
134
- * @param {SpotifyAPIOptions} options - The Spotify API options.
135
- * @param {string} options.apiKey - The Spotify API key.
136
- * @throws {Error} - Throws an error if the API key is not provided.
137
- */
138
- constructor(options: SpotifyAPIOptions);
139
- /**
140
- * Fetch the user's saved tracks by Spotify user ID.
141
- * @param {string} spotifyId - The user's Spotify ID.
142
- * @returns {Promise<object>} - The saved tracks.
143
- * @throws {APIError} - Throws an error if the request fails.
144
- */
145
- fetchSavedTracksById(spotifyId: string): Promise<object>;
146
- /**
147
- * Fetch the played tracks of a user by Spotify ID.
148
- * @param {string} spotifyId - The user's Spotify ID.
149
- * @returns {Promise<object>} - The played tracks.
150
- * @throws {APIError} - Throws an error if the request fails.
151
- */
152
- fetchPlayedTracksById(spotifyId: string): Promise<object>;
153
- /**
154
- * Fetch the user's saved albums by Spotify user ID.
155
- * @param {string} spotifyId - The user's Spotify ID.
156
- * @returns {Promise<object>} - The saved albums.
157
- * @throws {APIError} - Throws an error if the request fails.
158
- */
159
- fetchSavedAlbumsById(spotifyId: string): Promise<object>;
160
- /**
161
- * Fetch the user's saved playlists by Spotify user ID.
162
- * @param {string} spotifyId - The user's Spotify ID.
163
- * @returns {Promise<object>} - The saved playlists.
164
- * @throws {APIError} - Throws an error if the request fails.
165
- */
166
- fetchSavedPlaylistsById(spotifyId: string): Promise<object>;
167
- /**
168
- * Fetch the tracks of an album by album ID.
169
- * @param {string} spotifyId - The Spotify ID of the user.
170
- * @param {string} albumId - The album ID.
171
- * @returns {Promise<object>} - The tracks in the album.
172
- * @throws {APIError} - Throws an error if the request fails.
173
- */
174
- fetchTracksInAlbum(spotifyId: string, albumId: string): Promise<object>;
175
- /**
176
- * Fetch the tracks in a playlist by playlist ID.
177
- * @param {string} spotifyId - The Spotify ID of the user.
178
- * @param {string} playlistId - The playlist ID.
179
- * @returns {Promise<object>} - The tracks in the playlist.
180
- * @throws {APIError} - Throws an error if the request fails.
181
- */
182
- fetchTracksInPlaylist(spotifyId: string, playlistId: string): Promise<object>;
183
- /**
184
- * Fetch the user's Spotify data by wallet address.
185
- * @param {string} walletAddress - The wallet address.
186
- * @returns {Promise<object>} - The user's Spotify data.
187
- * @throws {APIError} - Throws an error if the request fails.
188
- */
189
- fetchUserByWalletAddress(walletAddress: string): Promise<object>;
190
- /**
191
- * Private method to fetch data with authorization header.
192
- * @param {string} url - The URL to fetch.
193
- * @returns {Promise<object>} - The response data.
194
- * @throws {APIError} - Throws an error if the request fails.
195
- */
196
- _fetchDataWithAuth(url: string): Promise<object>;
197
- }
198
-
199
3
  interface Environment {
200
4
  NAME: string;
201
5
  AUTH_HUB_BASE_API: string;
@@ -371,15 +175,6 @@ declare function hasAccess(this: Origin, user: Address, tokenId: bigint): Promis
371
175
 
372
176
  declare function subscriptionExpiry(this: Origin, tokenId: bigint, user: Address): Promise<bigint>;
373
177
 
374
- interface OriginUsageReturnType {
375
- user: {
376
- multiplier: number;
377
- points: number;
378
- active: boolean;
379
- };
380
- teams: Array<any>;
381
- dataSources: Array<any>;
382
- }
383
178
  interface RoyaltyInfo {
384
179
  tokenBoundAccount: Address;
385
180
  balance: bigint;
@@ -422,26 +217,10 @@ declare class Origin {
422
217
  constructor(jwt: string, environment: Environment, viemClient?: WalletClient, baseParentId?: bigint);
423
218
  getJwt(): string;
424
219
  setViemClient(client: WalletClient): void;
425
- uploadFile(file: File, options?: {
426
- progressCallback?: (percent: number) => void;
427
- }): Promise<any>;
428
220
  mintFile(file: File, metadata: Record<string, unknown>, license: LicenseTerms, parents?: bigint[], options?: {
429
221
  progressCallback?: (percent: number) => void;
430
222
  }): Promise<string | null>;
431
223
  mintSocial(source: "spotify" | "twitter" | "tiktok", metadata: Record<string, unknown>, license: LicenseTerms): Promise<string | null>;
432
- getOriginUploads(): Promise<any[] | null>;
433
- /**
434
- * Get the user's Origin stats (multiplier, consent, usage, etc.).
435
- * @returns {Promise<OriginUsageReturnType>} A promise that resolves with the user's Origin stats.
436
- */
437
- getOriginUsage(): Promise<OriginUsageReturnType>;
438
- /**
439
- * Set the user's consent for Origin usage.
440
- * @param {boolean} consent The user's consent.
441
- * @returns {Promise<void>}
442
- * @throws {Error|APIError} - Throws an error if the user is not authenticated. Also throws an error if the consent is not provided.
443
- */
444
- setOriginConsent(consent: boolean): Promise<void>;
445
224
  /**
446
225
  * Call a contract method.
447
226
  * @param {string} contractAddress The contract address.
@@ -847,4 +626,4 @@ declare const mainnet: {
847
626
  };
848
627
  };
849
628
 
850
- export { Auth, type BaseSigner, BrowserStorage, CustomSignerAdapter, DataStatus, EthersSignerAdapter, type LicenseTerms, MemoryStorage, type SignerAdapter, type SignerType, SpotifyAPI, type StorageAdapter, TwitterAPI, ViemSignerAdapter, mainnet as campMainnet, testnet as campTestnet, createLicenseTerms, createNodeWalletClient, createSignerAdapter };
629
+ export { Auth, type BaseSigner, BrowserStorage, CustomSignerAdapter, DataStatus, EthersSignerAdapter, type LicenseTerms, MemoryStorage, type SignerAdapter, type SignerType, type StorageAdapter, ViemSignerAdapter, mainnet as campMainnet, testnet as campTestnet, createLicenseTerms, createNodeWalletClient, createSignerAdapter };
@@ -1,201 +1,5 @@
1
1
  import { Address, Hex, WalletClient, Abi, Account, Chain } from 'viem';
2
2
 
3
- /**
4
- * The TwitterAPI class.
5
- * @class
6
- * @classdesc The TwitterAPI class is used to interact with the Twitter API.
7
- */
8
- declare class TwitterAPI {
9
- apiKey: string;
10
- /**
11
- * Constructor for the TwitterAPI class.
12
- * @param {object} options - The options object.
13
- * @param {string} options.apiKey - The API key. (Needed for data fetching)
14
- */
15
- constructor({ apiKey }: {
16
- apiKey: string;
17
- });
18
- /**
19
- * Fetch Twitter user details by username.
20
- * @param {string} twitterUserName - The Twitter username.
21
- * @returns {Promise<object>} - The user details.
22
- * @throws {APIError} - Throws an error if the request fails.
23
- */
24
- fetchUserByUsername(twitterUserName: string): Promise<object>;
25
- /**
26
- * Fetch tweets by Twitter username.
27
- * @param {string} twitterUserName - The Twitter username.
28
- * @param {number} page - The page number.
29
- * @param {number} limit - The number of items per page.
30
- * @returns {Promise<object>} - The tweets.
31
- * @throws {APIError} - Throws an error if the request fails.
32
- */
33
- fetchTweetsByUsername(twitterUserName: string, page?: number, limit?: number): Promise<object>;
34
- /**
35
- * Fetch followers by Twitter username.
36
- * @param {string} twitterUserName - The Twitter username.
37
- * @param {number} page - The page number.
38
- * @param {number} limit - The number of items per page.
39
- * @returns {Promise<object>} - The followers.
40
- * @throws {APIError} - Throws an error if the request fails.
41
- */
42
- fetchFollowersByUsername(twitterUserName: string, page?: number, limit?: number): Promise<object>;
43
- /**
44
- * Fetch following by Twitter username.
45
- * @param {string} twitterUserName - The Twitter username.
46
- * @param {number} page - The page number.
47
- * @param {number} limit - The number of items per page.
48
- * @returns {Promise<object>} - The following.
49
- * @throws {APIError} - Throws an error if the request fails.
50
- */
51
- fetchFollowingByUsername(twitterUserName: string, page?: number, limit?: number): Promise<object>;
52
- /**
53
- * Fetch tweet by tweet ID.
54
- * @param {string} tweetId - The tweet ID.
55
- * @returns {Promise<object>} - The tweet.
56
- * @throws {APIError} - Throws an error if the request fails.
57
- */
58
- fetchTweetById(tweetId: string): Promise<object>;
59
- /**
60
- * Fetch user by wallet address.
61
- * @param {string} walletAddress - The wallet address.
62
- * @param {number} page - The page number.
63
- * @param {number} limit - The number of items per page.
64
- * @returns {Promise<object>} - The user data.
65
- * @throws {APIError} - Throws an error if the request fails.
66
- */
67
- fetchUserByWalletAddress(walletAddress: string, page?: number, limit?: number): Promise<object>;
68
- /**
69
- * Fetch reposted tweets by Twitter username.
70
- * @param {string} twitterUserName - The Twitter username.
71
- * @param {number} page - The page number.
72
- * @param {number} limit - The number of items per page.
73
- * @returns {Promise<object>} - The reposted tweets.
74
- * @throws {APIError} - Throws an error if the request fails.
75
- */
76
- fetchRepostedByUsername(twitterUserName: string, page?: number, limit?: number): Promise<object>;
77
- /**
78
- * Fetch replies by Twitter username.
79
- * @param {string} twitterUserName - The Twitter username.
80
- * @param {number} page - The page number.
81
- * @param {number} limit - The number of items per page.
82
- * @returns {Promise<object>} - The replies.
83
- * @throws {APIError} - Throws an error if the request fails.
84
- */
85
- fetchRepliesByUsername(twitterUserName: string, page?: number, limit?: number): Promise<object>;
86
- /**
87
- * Fetch likes by Twitter username.
88
- * @param {string} twitterUserName - The Twitter username.
89
- * @param {number} page - The page number.
90
- * @param {number} limit - The number of items per page.
91
- * @returns {Promise<object>} - The likes.
92
- * @throws {APIError} - Throws an error if the request fails.
93
- */
94
- fetchLikesByUsername(twitterUserName: string, page?: number, limit?: number): Promise<object>;
95
- /**
96
- * Fetch follows by Twitter username.
97
- * @param {string} twitterUserName - The Twitter username.
98
- * @param {number} page - The page number.
99
- * @param {number} limit - The number of items per page.
100
- * @returns {Promise<object>} - The follows.
101
- * @throws {APIError} - Throws an error if the request fails.
102
- */
103
- fetchFollowsByUsername(twitterUserName: string, page?: number, limit?: number): Promise<object>;
104
- /**
105
- * Fetch viewed tweets by Twitter username.
106
- * @param {string} twitterUserName - The Twitter username.
107
- * @param {number} page - The page number.
108
- * @param {number} limit - The number of items per page.
109
- * @returns {Promise<object>} - The viewed tweets.
110
- * @throws {APIError} - Throws an error if the request fails.
111
- */
112
- fetchViewedTweetsByUsername(twitterUserName: string, page?: number, limit?: number): Promise<object>;
113
- /**
114
- * Private method to fetch data with authorization header.
115
- * @param {string} url - The URL to fetch.
116
- * @returns {Promise<object>} - The response data.
117
- * @throws {APIError} - Throws an error if the request fails.
118
- */
119
- _fetchDataWithAuth(url: string): Promise<object>;
120
- }
121
-
122
- interface SpotifyAPIOptions {
123
- apiKey: string;
124
- }
125
- /**
126
- * The SpotifyAPI class.
127
- * @class
128
- */
129
- declare class SpotifyAPI {
130
- apiKey: string;
131
- /**
132
- * Constructor for the SpotifyAPI class.
133
- * @constructor
134
- * @param {SpotifyAPIOptions} options - The Spotify API options.
135
- * @param {string} options.apiKey - The Spotify API key.
136
- * @throws {Error} - Throws an error if the API key is not provided.
137
- */
138
- constructor(options: SpotifyAPIOptions);
139
- /**
140
- * Fetch the user's saved tracks by Spotify user ID.
141
- * @param {string} spotifyId - The user's Spotify ID.
142
- * @returns {Promise<object>} - The saved tracks.
143
- * @throws {APIError} - Throws an error if the request fails.
144
- */
145
- fetchSavedTracksById(spotifyId: string): Promise<object>;
146
- /**
147
- * Fetch the played tracks of a user by Spotify ID.
148
- * @param {string} spotifyId - The user's Spotify ID.
149
- * @returns {Promise<object>} - The played tracks.
150
- * @throws {APIError} - Throws an error if the request fails.
151
- */
152
- fetchPlayedTracksById(spotifyId: string): Promise<object>;
153
- /**
154
- * Fetch the user's saved albums by Spotify user ID.
155
- * @param {string} spotifyId - The user's Spotify ID.
156
- * @returns {Promise<object>} - The saved albums.
157
- * @throws {APIError} - Throws an error if the request fails.
158
- */
159
- fetchSavedAlbumsById(spotifyId: string): Promise<object>;
160
- /**
161
- * Fetch the user's saved playlists by Spotify user ID.
162
- * @param {string} spotifyId - The user's Spotify ID.
163
- * @returns {Promise<object>} - The saved playlists.
164
- * @throws {APIError} - Throws an error if the request fails.
165
- */
166
- fetchSavedPlaylistsById(spotifyId: string): Promise<object>;
167
- /**
168
- * Fetch the tracks of an album by album ID.
169
- * @param {string} spotifyId - The Spotify ID of the user.
170
- * @param {string} albumId - The album ID.
171
- * @returns {Promise<object>} - The tracks in the album.
172
- * @throws {APIError} - Throws an error if the request fails.
173
- */
174
- fetchTracksInAlbum(spotifyId: string, albumId: string): Promise<object>;
175
- /**
176
- * Fetch the tracks in a playlist by playlist ID.
177
- * @param {string} spotifyId - The Spotify ID of the user.
178
- * @param {string} playlistId - The playlist ID.
179
- * @returns {Promise<object>} - The tracks in the playlist.
180
- * @throws {APIError} - Throws an error if the request fails.
181
- */
182
- fetchTracksInPlaylist(spotifyId: string, playlistId: string): Promise<object>;
183
- /**
184
- * Fetch the user's Spotify data by wallet address.
185
- * @param {string} walletAddress - The wallet address.
186
- * @returns {Promise<object>} - The user's Spotify data.
187
- * @throws {APIError} - Throws an error if the request fails.
188
- */
189
- fetchUserByWalletAddress(walletAddress: string): Promise<object>;
190
- /**
191
- * Private method to fetch data with authorization header.
192
- * @param {string} url - The URL to fetch.
193
- * @returns {Promise<object>} - The response data.
194
- * @throws {APIError} - Throws an error if the request fails.
195
- */
196
- _fetchDataWithAuth(url: string): Promise<object>;
197
- }
198
-
199
3
  interface Environment {
200
4
  NAME: string;
201
5
  AUTH_HUB_BASE_API: string;
@@ -371,15 +175,6 @@ declare function hasAccess(this: Origin, user: Address, tokenId: bigint): Promis
371
175
 
372
176
  declare function subscriptionExpiry(this: Origin, tokenId: bigint, user: Address): Promise<bigint>;
373
177
 
374
- interface OriginUsageReturnType {
375
- user: {
376
- multiplier: number;
377
- points: number;
378
- active: boolean;
379
- };
380
- teams: Array<any>;
381
- dataSources: Array<any>;
382
- }
383
178
  interface RoyaltyInfo {
384
179
  tokenBoundAccount: Address;
385
180
  balance: bigint;
@@ -422,26 +217,10 @@ declare class Origin {
422
217
  constructor(jwt: string, environment: Environment, viemClient?: WalletClient, baseParentId?: bigint);
423
218
  getJwt(): string;
424
219
  setViemClient(client: WalletClient): void;
425
- uploadFile(file: File, options?: {
426
- progressCallback?: (percent: number) => void;
427
- }): Promise<any>;
428
220
  mintFile(file: File, metadata: Record<string, unknown>, license: LicenseTerms, parents?: bigint[], options?: {
429
221
  progressCallback?: (percent: number) => void;
430
222
  }): Promise<string | null>;
431
223
  mintSocial(source: "spotify" | "twitter" | "tiktok", metadata: Record<string, unknown>, license: LicenseTerms): Promise<string | null>;
432
- getOriginUploads(): Promise<any[] | null>;
433
- /**
434
- * Get the user's Origin stats (multiplier, consent, usage, etc.).
435
- * @returns {Promise<OriginUsageReturnType>} A promise that resolves with the user's Origin stats.
436
- */
437
- getOriginUsage(): Promise<OriginUsageReturnType>;
438
- /**
439
- * Set the user's consent for Origin usage.
440
- * @param {boolean} consent The user's consent.
441
- * @returns {Promise<void>}
442
- * @throws {Error|APIError} - Throws an error if the user is not authenticated. Also throws an error if the consent is not provided.
443
- */
444
- setOriginConsent(consent: boolean): Promise<void>;
445
224
  /**
446
225
  * Call a contract method.
447
226
  * @param {string} contractAddress The contract address.
@@ -847,4 +626,4 @@ declare const mainnet: {
847
626
  };
848
627
  };
849
628
 
850
- export { Auth, type BaseSigner, BrowserStorage, CustomSignerAdapter, DataStatus, EthersSignerAdapter, type LicenseTerms, MemoryStorage, type SignerAdapter, type SignerType, SpotifyAPI, type StorageAdapter, TwitterAPI, ViemSignerAdapter, mainnet as campMainnet, testnet as campTestnet, createLicenseTerms, createNodeWalletClient, createSignerAdapter };
629
+ export { Auth, type BaseSigner, BrowserStorage, CustomSignerAdapter, DataStatus, EthersSignerAdapter, type LicenseTerms, MemoryStorage, type SignerAdapter, type SignerType, type StorageAdapter, ViemSignerAdapter, mainnet as campMainnet, testnet as campTestnet, createLicenseTerms, createNodeWalletClient, createSignerAdapter };