@campnetwork/origin 0.0.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/LICENSE +21 -0
- package/README.md +1007 -0
- package/dist/core.cjs +448 -0
- package/dist/core.d.ts +503 -0
- package/dist/core.esm.d.ts +503 -0
- package/dist/core.esm.js +446 -0
- package/dist/react/components/Tooltip.d.ts +17 -0
- package/dist/react/index.esm.d.ts +194 -0
- package/dist/react/index.esm.js +2406 -0
- package/package.json +73 -0
package/dist/core.d.ts
ADDED
|
@@ -0,0 +1,503 @@
|
|
|
1
|
+
import { Abi } from 'viem';
|
|
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
|
+
interface OriginUsageReturnType {
|
|
200
|
+
user: {
|
|
201
|
+
multiplier: number;
|
|
202
|
+
points: number;
|
|
203
|
+
active: boolean;
|
|
204
|
+
};
|
|
205
|
+
teams: Array<any>;
|
|
206
|
+
dataSources: Array<any>;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* The Origin class
|
|
210
|
+
* Handles the upload of files to Origin, as well as querying the user's stats
|
|
211
|
+
*/
|
|
212
|
+
declare class Origin {
|
|
213
|
+
#private;
|
|
214
|
+
private jwt;
|
|
215
|
+
constructor(jwt: string);
|
|
216
|
+
uploadFile: (file: File, options?: {
|
|
217
|
+
progressCallback?: (percent: number) => void;
|
|
218
|
+
}) => Promise<void>;
|
|
219
|
+
getOriginUploads: () => Promise<any>;
|
|
220
|
+
/**
|
|
221
|
+
* Get the user's Origin stats (multiplier, consent, usage, etc.).
|
|
222
|
+
* @returns {Promise<OriginUsageReturnType>} A promise that resolves with the user's Origin stats.
|
|
223
|
+
*/
|
|
224
|
+
getOriginUsage(): Promise<OriginUsageReturnType>;
|
|
225
|
+
/**
|
|
226
|
+
* Set the user's consent for Origin usage.
|
|
227
|
+
* @param {boolean} consent The user's consent.
|
|
228
|
+
* @returns {Promise<void>}
|
|
229
|
+
* @throws {Error|APIError} - Throws an error if the user is not authenticated. Also throws an error if the consent is not provided.
|
|
230
|
+
*/
|
|
231
|
+
setOriginConsent(consent: boolean): Promise<void>;
|
|
232
|
+
/**
|
|
233
|
+
* Set the user's Origin multiplier.
|
|
234
|
+
* @param {number} multiplier The user's Origin multiplier.
|
|
235
|
+
* @returns {Promise<void>}
|
|
236
|
+
* @throws {Error|APIError} - Throws an error if the user is not authenticated. Also throws an error if the multiplier is not provided.
|
|
237
|
+
*/
|
|
238
|
+
setOriginMultiplier(multiplier: number): Promise<void>;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
declare global {
|
|
242
|
+
interface Window {
|
|
243
|
+
ethereum?: any;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
type CallOptions = {
|
|
247
|
+
value?: bigint;
|
|
248
|
+
gas?: bigint;
|
|
249
|
+
waitForReceipt?: boolean;
|
|
250
|
+
};
|
|
251
|
+
/**
|
|
252
|
+
* The Auth class.
|
|
253
|
+
* @class
|
|
254
|
+
* @classdesc The Auth class is used to authenticate the user.
|
|
255
|
+
*/
|
|
256
|
+
declare class Auth {
|
|
257
|
+
#private;
|
|
258
|
+
redirectUri: Record<string, string>;
|
|
259
|
+
clientId: string;
|
|
260
|
+
isAuthenticated: boolean;
|
|
261
|
+
jwt: string | null;
|
|
262
|
+
walletAddress: string | null;
|
|
263
|
+
userId: string | null;
|
|
264
|
+
viem: any;
|
|
265
|
+
origin: Origin | null;
|
|
266
|
+
/**
|
|
267
|
+
* Constructor for the Auth class.
|
|
268
|
+
* @param {object} options The options object.
|
|
269
|
+
* @param {string} options.clientId The client ID.
|
|
270
|
+
* @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.
|
|
271
|
+
* @param {boolean} [options.allowAnalytics=true] Whether to allow analytics to be sent.
|
|
272
|
+
* @param {object} [options.ackeeInstance] The Ackee instance.
|
|
273
|
+
* @throws {APIError} - Throws an error if the clientId is not provided.
|
|
274
|
+
*/
|
|
275
|
+
constructor({ clientId, redirectUri, allowAnalytics, ackeeInstance, }: {
|
|
276
|
+
clientId: string;
|
|
277
|
+
redirectUri: string | Record<string, string>;
|
|
278
|
+
allowAnalytics?: boolean;
|
|
279
|
+
ackeeInstance?: any;
|
|
280
|
+
});
|
|
281
|
+
/**
|
|
282
|
+
* Subscribe to an event. Possible events are "state", "provider", "providers", and "viem".
|
|
283
|
+
* @param {("state"|"provider"|"providers"|"viem")} event The event.
|
|
284
|
+
* @param {function} callback The callback function.
|
|
285
|
+
* @returns {void}
|
|
286
|
+
* @example
|
|
287
|
+
* auth.on("state", (state) => {
|
|
288
|
+
* console.log(state);
|
|
289
|
+
* });
|
|
290
|
+
*/
|
|
291
|
+
on(event: "state" | "provider" | "providers" | "viem", callback: Function): void;
|
|
292
|
+
/**
|
|
293
|
+
* Set the loading state.
|
|
294
|
+
* @param {boolean} loading The loading state.
|
|
295
|
+
* @returns {void}
|
|
296
|
+
*/
|
|
297
|
+
setLoading(loading: boolean): void;
|
|
298
|
+
/**
|
|
299
|
+
* Set the provider. This is useful for setting the provider when the user selects a provider from the UI or when dApp wishes to use a specific provider.
|
|
300
|
+
* @param {object} options The options object. Includes the provider and the provider info.
|
|
301
|
+
* @returns {void}
|
|
302
|
+
* @throws {APIError} - Throws an error if the provider is not provided.
|
|
303
|
+
*/
|
|
304
|
+
setProvider({ provider, info, address, }: {
|
|
305
|
+
provider: any;
|
|
306
|
+
info: any;
|
|
307
|
+
address?: string;
|
|
308
|
+
}): void;
|
|
309
|
+
/**
|
|
310
|
+
* Set the wallet address. This is useful for edge cases where the provider can't return the wallet address. Don't use this unless you know what you're doing.
|
|
311
|
+
* @param {string} walletAddress The wallet address.
|
|
312
|
+
* @returns {void}
|
|
313
|
+
*/
|
|
314
|
+
setWalletAddress(walletAddress: string): void;
|
|
315
|
+
/**
|
|
316
|
+
* Disconnect the user.
|
|
317
|
+
* @returns {Promise<void>}
|
|
318
|
+
*/
|
|
319
|
+
disconnect(): Promise<void>;
|
|
320
|
+
/**
|
|
321
|
+
* Connect the user's wallet and sign the message.
|
|
322
|
+
* @returns {Promise<{ success: boolean; message: string; walletAddress: string }>} A promise that resolves with the authentication result.
|
|
323
|
+
* @throws {APIError} - Throws an error if the user cannot be authenticated.
|
|
324
|
+
*/
|
|
325
|
+
connect(): Promise<{
|
|
326
|
+
success: boolean;
|
|
327
|
+
message: string;
|
|
328
|
+
walletAddress: string;
|
|
329
|
+
}>;
|
|
330
|
+
/**
|
|
331
|
+
* Get the user's linked social accounts.
|
|
332
|
+
* @returns {Promise<Record<string, boolean>>} A promise that resolves with the user's linked social accounts.
|
|
333
|
+
* @throws {Error|APIError} - Throws an error if the user is not authenticated or if the request fails.
|
|
334
|
+
* @example
|
|
335
|
+
* const auth = new Auth({ clientId: "your-client-id" });
|
|
336
|
+
* const socials = await auth.getLinkedSocials();
|
|
337
|
+
* console.log(socials);
|
|
338
|
+
*/
|
|
339
|
+
getLinkedSocials(): Promise<Record<string, boolean>>;
|
|
340
|
+
/**
|
|
341
|
+
* Link the user's Twitter account.
|
|
342
|
+
* @returns {Promise<void>}
|
|
343
|
+
* @throws {Error} - Throws an error if the user is not authenticated.
|
|
344
|
+
*/
|
|
345
|
+
linkTwitter(): Promise<void>;
|
|
346
|
+
/**
|
|
347
|
+
* Link the user's Discord account.
|
|
348
|
+
* @returns {Promise<void>}
|
|
349
|
+
* @throws {Error} - Throws an error if the user is not authenticated.
|
|
350
|
+
*/
|
|
351
|
+
linkDiscord(): Promise<void>;
|
|
352
|
+
/**
|
|
353
|
+
* Link the user's Spotify account.
|
|
354
|
+
* @returns {Promise<void>}
|
|
355
|
+
* @throws {Error} - Throws an error if the user is not authenticated.
|
|
356
|
+
*/
|
|
357
|
+
linkSpotify(): Promise<void>;
|
|
358
|
+
/**
|
|
359
|
+
* Link the user's TikTok account.
|
|
360
|
+
* @param {string} handle The user's TikTok handle.
|
|
361
|
+
* @returns {Promise<any>} A promise that resolves with the TikTok account data.
|
|
362
|
+
* @throws {Error|APIError} - Throws an error if the user is not authenticated.
|
|
363
|
+
*/
|
|
364
|
+
linkTikTok(handle: string): Promise<any>;
|
|
365
|
+
/**
|
|
366
|
+
* Send an OTP to the user's Telegram account.
|
|
367
|
+
* @param {string} phoneNumber The user's phone number.
|
|
368
|
+
* @returns {Promise<any>} A promise that resolves with the OTP data.
|
|
369
|
+
* @throws {Error|APIError} - Throws an error if the user is not authenticated.
|
|
370
|
+
*/
|
|
371
|
+
sendTelegramOTP(phoneNumber: string): Promise<any>;
|
|
372
|
+
/**
|
|
373
|
+
* Link the user's Telegram account.
|
|
374
|
+
* @param {string} phoneNumber The user's phone number.
|
|
375
|
+
* @param {string} otp The OTP.
|
|
376
|
+
* @param {string} phoneCodeHash The phone code hash.
|
|
377
|
+
* @returns {Promise<object>} A promise that resolves with the Telegram account data.
|
|
378
|
+
* @throws {APIError|Error} - Throws an error if the user is not authenticated. Also throws an error if the phone number, OTP, and phone code hash are not provided.
|
|
379
|
+
*/
|
|
380
|
+
linkTelegram(phoneNumber: string, otp: string, phoneCodeHash: string): Promise<any>;
|
|
381
|
+
/**
|
|
382
|
+
* Unlink the user's Twitter account.
|
|
383
|
+
* @returns {Promise<any>} A promise that resolves with the unlink result.
|
|
384
|
+
* @throws {Error} - Throws an error if the user is not authenticated.
|
|
385
|
+
* @throws {APIError} - Throws an error if the request fails.
|
|
386
|
+
*/
|
|
387
|
+
unlinkTwitter(): Promise<any>;
|
|
388
|
+
/**
|
|
389
|
+
* Unlink the user's Discord account.
|
|
390
|
+
* @returns {Promise<any>} A promise that resolves with the unlink result.
|
|
391
|
+
* @throws {Error} - Throws an error if the user is not authenticated.
|
|
392
|
+
* @throws {APIError} - Throws an error if the request fails.
|
|
393
|
+
*/
|
|
394
|
+
unlinkDiscord(): Promise<any>;
|
|
395
|
+
/**
|
|
396
|
+
* Unlink the user's Spotify account.
|
|
397
|
+
* @returns {Promise<any>} A promise that resolves with the unlink result.
|
|
398
|
+
* @throws {Error} - Throws an error if the user is not authenticated.
|
|
399
|
+
* @throws {APIError} - Throws an error if the request fails.
|
|
400
|
+
*/
|
|
401
|
+
unlinkSpotify(): Promise<any>;
|
|
402
|
+
/**
|
|
403
|
+
* Unlink the user's TikTok account.
|
|
404
|
+
* @returns {Promise<any>} A promise that resolves with the unlink result.
|
|
405
|
+
* @throws {Error} - Throws an error if the user is not authenticated.
|
|
406
|
+
* @throws {APIError} - Throws an error if the request fails.
|
|
407
|
+
*/
|
|
408
|
+
unlinkTikTok(): Promise<any>;
|
|
409
|
+
/**
|
|
410
|
+
* Unlink the user's Telegram account.
|
|
411
|
+
* @returns {Promise<any>} A promise that resolves with the unlink result.
|
|
412
|
+
* @throws {Error} - Throws an error if the user is not authenticated.
|
|
413
|
+
* @throws {APIError} - Throws an error if the request fails.
|
|
414
|
+
*/
|
|
415
|
+
unlinkTelegram(): Promise<any>;
|
|
416
|
+
/**
|
|
417
|
+
* Call a contract method.
|
|
418
|
+
* @param {string} contractAddress The contract address.
|
|
419
|
+
* @param {Abi} abi The contract ABI.
|
|
420
|
+
* @param {string} methodName The method name.
|
|
421
|
+
* @param {any[]} params The method parameters.
|
|
422
|
+
* @param {CallOptions} [options] The call options.
|
|
423
|
+
* @returns {Promise<any>} A promise that resolves with the result of the contract call or transaction hash.
|
|
424
|
+
* @throws {Error} - Throws an error if the wallet client is not connected or if the method is not a view function.
|
|
425
|
+
*/
|
|
426
|
+
callContractMethod(contractAddress: string, abi: Abi, methodName: string, params: any[], options?: CallOptions): Promise<any>;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
The MIT License (MIT)
|
|
431
|
+
|
|
432
|
+
Copyright (c) Tobias Reich
|
|
433
|
+
|
|
434
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
435
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
436
|
+
in the Software without restriction, including without limitation the rights
|
|
437
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
438
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
439
|
+
furnished to do so, subject to the following conditions:
|
|
440
|
+
|
|
441
|
+
The above copyright notice and this permission notice shall be included in
|
|
442
|
+
all copies or substantial portions of the Software.
|
|
443
|
+
|
|
444
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
445
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
446
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
447
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
448
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
449
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
450
|
+
THE SOFTWARE.
|
|
451
|
+
*/
|
|
452
|
+
interface Options {
|
|
453
|
+
detailed?: boolean;
|
|
454
|
+
ignoreLocalhost?: boolean;
|
|
455
|
+
ignoreOwnVisits?: boolean;
|
|
456
|
+
}
|
|
457
|
+
interface Attributes {
|
|
458
|
+
siteLocation: string;
|
|
459
|
+
siteReferrer: string;
|
|
460
|
+
source?: string;
|
|
461
|
+
siteLanguage?: string;
|
|
462
|
+
screenWidth?: number;
|
|
463
|
+
screenHeight?: number;
|
|
464
|
+
screenColorDepth?: number;
|
|
465
|
+
browserWidth?: number;
|
|
466
|
+
browserHeight?: number;
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* Gathers all platform-, screen- and user-related information.
|
|
470
|
+
* @param {Boolean} detailed - Include personal data.
|
|
471
|
+
* @returns {Object} attributes - User-related information.
|
|
472
|
+
*/
|
|
473
|
+
declare const attributes: (detailed?: boolean) => Attributes;
|
|
474
|
+
/**
|
|
475
|
+
* Looks for an element with Ackee attributes and executes Ackee with the given attributes.
|
|
476
|
+
* Fails silently.
|
|
477
|
+
*/
|
|
478
|
+
declare const detect: () => void;
|
|
479
|
+
/**
|
|
480
|
+
* Creates a new instance.
|
|
481
|
+
* @param {String} server - URL of the Ackee server.
|
|
482
|
+
* @param {?Object} opts
|
|
483
|
+
* @returns {Object} instance
|
|
484
|
+
*/
|
|
485
|
+
declare const create: (server: string, opts?: Options) => {
|
|
486
|
+
record: (domainId: string, attrs?: Attributes, next?: (recordId: string) => void) => {
|
|
487
|
+
stop: () => void;
|
|
488
|
+
};
|
|
489
|
+
updateRecord: (recordId: string) => {
|
|
490
|
+
stop: () => void;
|
|
491
|
+
};
|
|
492
|
+
action: (eventId: string, attrs: any, next?: (actionId: string) => void) => void;
|
|
493
|
+
updateAction: (actionId: string, attrs: any) => void;
|
|
494
|
+
};
|
|
495
|
+
|
|
496
|
+
declare const ackeeUtil_attributes: typeof attributes;
|
|
497
|
+
declare const ackeeUtil_create: typeof create;
|
|
498
|
+
declare const ackeeUtil_detect: typeof detect;
|
|
499
|
+
declare namespace ackeeUtil {
|
|
500
|
+
export { ackeeUtil_attributes as attributes, ackeeUtil_create as create, ackeeUtil_detect as detect };
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
export { ackeeUtil as Ackee, Auth, SpotifyAPI, TwitterAPI };
|