@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/README.md CHANGED
@@ -15,8 +15,6 @@
15
15
  The Origin SDK currently exposes the following modules:
16
16
 
17
17
  - `"@campnetwork/origin"` - The main entry point for the SDK, exposes the following classes:
18
- - `TwitterAPI` - For fetching user Twitter data from Origin
19
- - `SpotifyAPI` - For fetching user Spotify data from Origin
20
18
  - `Auth` - For authenticating users with the Origin SDK (browser and Node.js)
21
19
  - Signer adapters and utilities for Node.js support (ethers, viem, custom signers)
22
20
  - Camp Network chain configurations (`campMainnet`, `campTestnet`)
@@ -45,229 +43,13 @@ The core modules can be imported either as a CommonJS module or as an ES6 module
45
43
  ### CommonJS
46
44
 
47
45
  ```js
48
- const { TwitterAPI, SpotifyAPI, Auth } = require("@campnetwork/origin");
46
+ const { Auth } = require("@campnetwork/origin");
49
47
  ```
50
48
 
51
49
  ### ES6
52
50
 
53
51
  ```js
54
- import { TwitterAPI, SpotifyAPI, Auth } from "@campnetwork/origin";
55
- ```
56
-
57
- ## Socials
58
-
59
- ### TwitterAPI
60
-
61
- The TwitterAPI class is the entry point for fetching user Twitter data from Origin. It requires an API key to be instantiated.
62
-
63
- **Note: The methods for fetching data will only return data for users who have authenticated to your app via the Origin SDK.**
64
-
65
- #### Constructor
66
-
67
- `apiKey` - The API key of your app.
68
-
69
- ```js
70
- const twitter = new TwitterAPI({
71
- apiKey: string,
72
- });
73
- ```
74
-
75
- #### Methods
76
-
77
- ##### fetchUserByUsername
78
-
79
- `fetchUserByUsername(twitterUserName: string)`
80
-
81
- ```js
82
- const user = await twitter.fetchUserByUsername("jack");
83
- ```
84
-
85
- ##### fetchTweetsByUsername
86
-
87
- `fetchTweetsByUsername(twitterUserName: string, page: number, limit: number)`
88
-
89
- ```js
90
- const tweets = await twitter.fetchTweetsByUsername("jack", 1, 10);
91
- ```
92
-
93
- ##### fetchFollowersByUsername
94
-
95
- `fetchFollowersByUsername(twitterUserName: string, page: number, limit: number)`
96
-
97
- ```js
98
- const followers = await twitter.fetchFollowersByUsername("jack", 1, 10);
99
- ```
100
-
101
- ##### fetchFollowingByUsername
102
-
103
- `fetchFollowingByUsername(twitterUserName: string, page: number, limit: number)`
104
-
105
- ```js
106
- const following = await twitter.fetchFollowingByUsername("jack", 1, 10);
107
- ```
108
-
109
- ##### fetchTweetById
110
-
111
- `fetchTweetById(tweetId: string)`
112
-
113
- ```js
114
- const tweet = await twitter.fetchTweetById("1234567890");
115
- ```
116
-
117
- ##### fetchUserByWalletAddress
118
-
119
- `fetchUserByWalletAddress(walletAddress: string, page: number, limit: number)`
120
-
121
- ```js
122
- const user = await twitter.fetchUserByWalletAddress("0x1234567890", 1, 10);
123
- ```
124
-
125
- ##### fetchRepostedByUsername
126
-
127
- `fetchRepostedByUsername(twitterUserName: string, page: number, limit: number)`
128
-
129
- ```js
130
- const reposts = await twitter.fetchRepostedByUsername("jack", 1, 10);
131
- ```
132
-
133
- ##### fetchRepliesByUsername
134
-
135
- `fetchRepliesByUsername(twitterUserName: string, page: number, limit: number)`
136
-
137
- ```js
138
- const replies = await twitter.fetchRepliesByUsername("jack", 1, 10);
139
- ```
140
-
141
- ##### fetchLikesByUsername
142
-
143
- `fetchLikesByUsername(twitterUserName: string, page: number, limit: number)`
144
-
145
- ```js
146
- const likes = await twitter.fetchLikesByUsername("jack", 1, 10);
147
- ```
148
-
149
- ##### fetchFollowsByUsername
150
-
151
- `fetchFollowsByUsername(twitterUserName: string, page: number, limit: number)`
152
-
153
- ```js
154
- const follows = await twitter.fetchFollowsByUsername("jack", 1, 10);
155
- ```
156
-
157
- ##### fetchViewedTweetsByUsername
158
-
159
- `fetchViewedTweetsByUsername(twitterUserName: string, page: number, limit: number)`
160
-
161
- ```js
162
- const viewedTweets = await twitter.fetchViewedTweetsByUsername("jack", 1, 10);
163
- ```
164
-
165
- ### SpotifyAPI
166
-
167
- The SpotifyAPI class is the entry point for fetching user Spotify data from Origin. It requires an API key to be instantiated.
168
-
169
- **Note: The methods for fetching data will only return data for users who have authenticated to your app via the Origin SDK.**
170
-
171
- #### Constructor
172
-
173
- `apiKey` - The API key of your app.
174
-
175
- ```js
176
- const spotify = new SpotifyAPI({
177
- apiKey: string,
178
- });
179
- ```
180
-
181
- #### Methods
182
-
183
- ##### fetchSavedTracksById
184
-
185
- `fetchSavedTracksById(spotifyId: string)`
186
-
187
- ```js
188
- const savedTracks = await spotify.fetchSavedTracksById("1234567890");
189
- ```
190
-
191
- ##### fetchPlayedTracksById
192
-
193
- `fetchPlayedTracksById(spotifyId: string)`
194
-
195
- ```js
196
- const playedTracks = await spotify.fetchPlayedTracksById("1234567890");
197
- ```
198
-
199
- ##### fetchSavedAlbumsById
200
-
201
- `fetchSavedAlbumsById(spotifyId: string)`
202
-
203
- ```js
204
- const savedAlbums = await spotify.fetchSavedAlbumsById("1234567890");
205
- ```
206
-
207
- ##### fetchSavedPlaylistsById
208
-
209
- `fetchSavedPlaylistsById(spotifyId: string)`
210
-
211
- ```js
212
- const savedPlaylists = await spotify.fetchSavedPlaylistsById("1234567890");
213
- ```
214
-
215
- ##### fetchTracksInAlbum
216
-
217
- `fetchTracksInAlbum(spotifyId: string, albumId: string)`
218
-
219
- ```js
220
- const tracks = await spotify.fetchTracksInAlbum("1234567890", "1234567890");
221
- ```
222
-
223
- ##### fetchTracksInPlaylist
224
-
225
- `fetchTracksInPlaylist(spotifyId: string, playlistId: string)`
226
-
227
- ```js
228
- const tracks = await spotify.fetchTracksInPlaylist("1234567890", "1234567890");
229
- ```
230
-
231
- ##### fetchUserByWalletAddress
232
-
233
- `fetchUserByWalletAddress(walletAddress: string)`
234
-
235
- ```js
236
- const user = await spotify.fetchUserByWalletAddress("0x1234567890");
237
- ```
238
-
239
- ### TikTokAPI
240
-
241
- The TikTokAPI class is the entry point for fetching user TikTok data from Origin. It requires an API key to be instantiated.
242
-
243
- **Note: The methods for fetching data will only return data for users who have authenticated to your app via the Origin SDK.**
244
-
245
- #### Constructor
246
-
247
- `apiKey` - The API key of your app.
248
-
249
- ```js
250
- const tiktok = new TikTokAPI({
251
- apiKey: string,
252
- });
253
- ```
254
-
255
- #### Methods
256
-
257
- ##### fetchUserByUsername
258
-
259
- `fetchUserByUsername(tiktokUserName: string)`
260
-
261
- ```js
262
- const user = await tiktok.fetchUserByUsername("jack");
263
- ```
264
-
265
- ##### fetchVideoById
266
-
267
- `fetchVideoById(userHandle: string, videoId: string)`
268
-
269
- ```js
270
- const video = await tiktok.fetchVideo("jack", "1234567890");
52
+ import { Auth } from "@campnetwork/origin";
271
53
  ```
272
54
 
273
55
  ## Auth
@@ -276,13 +58,13 @@ The Auth class is the entry point for authenticating users with the Origin SDK.
276
58
 
277
59
  ### Constructor
278
60
 
279
- - `clientId` - The client ID of your app. This is required to authenticate users with the Origin SDK.
61
+ - `clientId` - `string` - The client ID of your app. This is required to authenticate users with the Origin SDK.
280
62
  - `redirectUri` - The URI to redirect to after the user completes oauth for any of the socials. Defaults to `window.location.href`.
281
63
  The `redirectUri` can also be an object with the following optional properties:
282
64
  - `twitter` - The URI to redirect to after the user completes oauth for Twitter.
283
65
  - `spotify` - The URI to redirect to after the user completes oauth for Spotify.
284
- - `environment` - The environment to use. Can be either `DEVELOPMENT` or `PRODUCTION`. Defaults to `DEVELOPMENT`.
285
- - `baseParentId` - A valid tokenID to be used as the parent of all IPNFTs minted on your platform, making them all derivatives of your base asset.
66
+ - `environment` - `string` - The environment to use. Can be either `DEVELOPMENT` or `PRODUCTION`. Defaults to `DEVELOPMENT`.
67
+ - `baseParentId` - `bigint` - A valid tokenID to be used as the parent of all IPNFTs minted on your platform, making them all derivatives of your base asset.
286
68
 
287
69
  You may use the `redirectUri` object to redirect the user to different pages based on the social they are linking.
288
70
  You may only define the URIs for the socials you are using, the rest will default to `window.location.href`.
@@ -293,7 +75,6 @@ import { Auth } from "@campnetwork/origin";
293
75
  const auth = new Auth({
294
76
  clientId: string,
295
77
  redirectUri: string | object,
296
- allowAnalytics: boolean,
297
78
  });
298
79
  ```
299
80
 
@@ -307,6 +88,13 @@ const auth = new Auth({
307
88
  });
308
89
  ```
309
90
 
91
+ ```js
92
+ const auth = new Auth({
93
+ clientId: "your-client-id",
94
+ baseParentId: 123n,
95
+ });
96
+ ```
97
+
310
98
  ### Methods
311
99
 
312
100
  #### connect
@@ -1249,12 +1037,6 @@ Most methods mirror smart contract functions and require appropriate permissions
1249
1037
  - `buyAccessSmart(tokenId)` — Buys access, handles payment approval and license details - **Recommended in place of buyAccess**
1250
1038
  - `getData(tokenId)` — Fetches the underlying IP for a given IPNFT if the user has purchased access to it
1251
1039
 
1252
- ### User Data & Stats
1253
-
1254
- - `getOriginUploads()` — Fetch user's Origin file uploads (returns array or null)
1255
- - `getOriginUsage()` — Fetch user's Origin stats (returns object with multiplier, points, active, teams, dataSources)
1256
- - `setOriginConsent(consent: boolean)` — Set user's consent for Origin usage
1257
-
1258
1040
  ### Utility Methods
1259
1041
 
1260
1042
  - `getJwt()` — Get current JWT token