@campnetwork/origin 1.2.0-3 → 1.2.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 +39 -222
- package/dist/core.cjs +92 -266
- package/dist/core.d.ts +11 -200
- package/dist/core.esm.d.ts +11 -200
- package/dist/core.esm.js +94 -267
- package/dist/react/index.esm.d.ts +14 -6
- package/dist/react/index.esm.js +27 -11
- package/package.json +1 -1
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;
|
|
@@ -254,6 +58,7 @@ type IpNFTSource = "spotify" | "twitter" | "tiktok" | "file";
|
|
|
254
58
|
* @param to The address to mint the NFT to.
|
|
255
59
|
* @param tokenId The ID of the token to mint.
|
|
256
60
|
* @param parents The IDs of the parent NFTs, if applicable.
|
|
61
|
+
* @param isIp Whether the NFT is an IP NFT.
|
|
257
62
|
* @param hash The hash of the data associated with the NFT.
|
|
258
63
|
* @param uri The URI of the NFT metadata.
|
|
259
64
|
* @param licenseTerms The terms of the license for the NFT.
|
|
@@ -266,7 +71,10 @@ declare function mintWithSignature(this: Origin, to: Address, tokenId: bigint, p
|
|
|
266
71
|
* Registers a Data NFT with the Origin service in order to obtain a signature for minting.
|
|
267
72
|
* @param source The source of the Data NFT (e.g., "spotify", "twitter", "tiktok", or "file").
|
|
268
73
|
* @param deadline The deadline for the registration operation.
|
|
269
|
-
* @param
|
|
74
|
+
* @param licenseTerms The terms of the license for the NFT.
|
|
75
|
+
* @param metadata The metadata associated with the NFT.
|
|
76
|
+
* @param fileKey The file key(s) if the source is "file".
|
|
77
|
+
* @param parents The IDs of the parent NFTs, if applicable.
|
|
270
78
|
* @return A promise that resolves with the registration data.
|
|
271
79
|
*/
|
|
272
80
|
declare function registerIpNFT(this: Origin, source: IpNFTSource, deadline: bigint, licenseTerms: LicenseTerms, metadata: Record<string, unknown>, fileKey?: string | string[], parents?: bigint[]): Promise<any>;
|
|
@@ -414,7 +222,8 @@ declare class Origin {
|
|
|
414
222
|
private jwt;
|
|
415
223
|
environment: Environment;
|
|
416
224
|
private viemClient?;
|
|
417
|
-
|
|
225
|
+
baseParentId?: bigint;
|
|
226
|
+
constructor(jwt: string, environment: Environment, viemClient?: WalletClient, baseParentId?: bigint);
|
|
418
227
|
getJwt(): string;
|
|
419
228
|
setViemClient(client: WalletClient): void;
|
|
420
229
|
uploadFile(file: File, options?: {
|
|
@@ -547,6 +356,7 @@ declare class Auth {
|
|
|
547
356
|
viem: any;
|
|
548
357
|
origin: Origin | null;
|
|
549
358
|
environment: Environment;
|
|
359
|
+
baseParentId?: bigint;
|
|
550
360
|
/**
|
|
551
361
|
* Constructor for the Auth class.
|
|
552
362
|
* @param {object} options The options object.
|
|
@@ -556,10 +366,11 @@ declare class Auth {
|
|
|
556
366
|
* @param {StorageAdapter} [options.storage] Custom storage adapter. Defaults to localStorage in browser, memory storage in Node.js.
|
|
557
367
|
* @throws {APIError} - Throws an error if the clientId is not provided.
|
|
558
368
|
*/
|
|
559
|
-
constructor({ clientId, redirectUri, environment, storage, }: {
|
|
369
|
+
constructor({ clientId, redirectUri, environment, baseParentId, storage, }: {
|
|
560
370
|
clientId: string;
|
|
561
371
|
redirectUri: string | Record<string, string>;
|
|
562
372
|
environment?: "DEVELOPMENT" | "PRODUCTION";
|
|
373
|
+
baseParentId?: bigint;
|
|
563
374
|
storage?: StorageAdapter;
|
|
564
375
|
});
|
|
565
376
|
/**
|
|
@@ -840,4 +651,4 @@ declare const mainnet: {
|
|
|
840
651
|
};
|
|
841
652
|
};
|
|
842
653
|
|
|
843
|
-
export { Auth, type BaseSigner, BrowserStorage, CustomSignerAdapter, DataStatus, EthersSignerAdapter, type LicenseTerms, MemoryStorage, type SignerAdapter, type SignerType,
|
|
654
|
+
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 };
|
package/dist/core.esm.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;
|
|
@@ -254,6 +58,7 @@ type IpNFTSource = "spotify" | "twitter" | "tiktok" | "file";
|
|
|
254
58
|
* @param to The address to mint the NFT to.
|
|
255
59
|
* @param tokenId The ID of the token to mint.
|
|
256
60
|
* @param parents The IDs of the parent NFTs, if applicable.
|
|
61
|
+
* @param isIp Whether the NFT is an IP NFT.
|
|
257
62
|
* @param hash The hash of the data associated with the NFT.
|
|
258
63
|
* @param uri The URI of the NFT metadata.
|
|
259
64
|
* @param licenseTerms The terms of the license for the NFT.
|
|
@@ -266,7 +71,10 @@ declare function mintWithSignature(this: Origin, to: Address, tokenId: bigint, p
|
|
|
266
71
|
* Registers a Data NFT with the Origin service in order to obtain a signature for minting.
|
|
267
72
|
* @param source The source of the Data NFT (e.g., "spotify", "twitter", "tiktok", or "file").
|
|
268
73
|
* @param deadline The deadline for the registration operation.
|
|
269
|
-
* @param
|
|
74
|
+
* @param licenseTerms The terms of the license for the NFT.
|
|
75
|
+
* @param metadata The metadata associated with the NFT.
|
|
76
|
+
* @param fileKey The file key(s) if the source is "file".
|
|
77
|
+
* @param parents The IDs of the parent NFTs, if applicable.
|
|
270
78
|
* @return A promise that resolves with the registration data.
|
|
271
79
|
*/
|
|
272
80
|
declare function registerIpNFT(this: Origin, source: IpNFTSource, deadline: bigint, licenseTerms: LicenseTerms, metadata: Record<string, unknown>, fileKey?: string | string[], parents?: bigint[]): Promise<any>;
|
|
@@ -414,7 +222,8 @@ declare class Origin {
|
|
|
414
222
|
private jwt;
|
|
415
223
|
environment: Environment;
|
|
416
224
|
private viemClient?;
|
|
417
|
-
|
|
225
|
+
baseParentId?: bigint;
|
|
226
|
+
constructor(jwt: string, environment: Environment, viemClient?: WalletClient, baseParentId?: bigint);
|
|
418
227
|
getJwt(): string;
|
|
419
228
|
setViemClient(client: WalletClient): void;
|
|
420
229
|
uploadFile(file: File, options?: {
|
|
@@ -547,6 +356,7 @@ declare class Auth {
|
|
|
547
356
|
viem: any;
|
|
548
357
|
origin: Origin | null;
|
|
549
358
|
environment: Environment;
|
|
359
|
+
baseParentId?: bigint;
|
|
550
360
|
/**
|
|
551
361
|
* Constructor for the Auth class.
|
|
552
362
|
* @param {object} options The options object.
|
|
@@ -556,10 +366,11 @@ declare class Auth {
|
|
|
556
366
|
* @param {StorageAdapter} [options.storage] Custom storage adapter. Defaults to localStorage in browser, memory storage in Node.js.
|
|
557
367
|
* @throws {APIError} - Throws an error if the clientId is not provided.
|
|
558
368
|
*/
|
|
559
|
-
constructor({ clientId, redirectUri, environment, storage, }: {
|
|
369
|
+
constructor({ clientId, redirectUri, environment, baseParentId, storage, }: {
|
|
560
370
|
clientId: string;
|
|
561
371
|
redirectUri: string | Record<string, string>;
|
|
562
372
|
environment?: "DEVELOPMENT" | "PRODUCTION";
|
|
373
|
+
baseParentId?: bigint;
|
|
563
374
|
storage?: StorageAdapter;
|
|
564
375
|
});
|
|
565
376
|
/**
|
|
@@ -840,4 +651,4 @@ declare const mainnet: {
|
|
|
840
651
|
};
|
|
841
652
|
};
|
|
842
653
|
|
|
843
|
-
export { Auth, type BaseSigner, BrowserStorage, CustomSignerAdapter, DataStatus, EthersSignerAdapter, type LicenseTerms, MemoryStorage, type SignerAdapter, type SignerType,
|
|
654
|
+
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 };
|