@zoralabs/coins-sdk 0.0.2-sdkalpha.8 → 0.0.3

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
@@ -13,11 +13,15 @@ All the SDK functions are accessible from the main export (for example: `import
13
13
  ## Table of Contents
14
14
 
15
15
  ### Onchain Actions
16
+
17
+
16
18
  - [createCoin](#1-createcoin-creates-a-new-coin-with-the-given-parameters-to-trade)
17
19
  - [tradeCoin](#2-tradecoin-buys-or-sells-an-existing-coin)
18
20
  - [updateCoinURI](#3-updatecoinuri-updates-the-uri-for-an-existing-coin)
19
21
 
20
22
  ### Queries
23
+
24
+
21
25
  - [On chain queries](#onchain-queries)
22
26
  - [getOnchainCoinDetails](#1-getonchaincoindetails-gets-details-for-the-given-coin-from-the-blockchain)
23
27
  - [API Queries](#3-api-queries)
@@ -42,122 +46,229 @@ These are functions that interact directly with the blockchain and require trans
42
46
 
43
47
  ### 1. `createCoin`: Creates a new coin with the given parameters to trade.
44
48
 
45
- **Key Parameters:**
46
- - `name`: The name of the new coin.
47
- - `symbol`: The symbol for the new coin.
48
- - `uri`: The URI for the coin metadata.
49
- - `owners`: An array of owner addresses. (Optional)
50
- - `payoutRecipient`: The address that will receive the payout.
51
- - `platformReferrer`: The referrer address for the platform that earns referral fees. (Optional)
52
- - `initialPurchaseWei`: The initial purchase amount in Wei. (Optional)
53
-
54
- **Usage:**
55
- ```typescript
56
- const createCoinParams = {
57
- name: "MyCoin",
58
- symbol: "MYC",
59
- uri: "https://example.com/metadata",
60
- payoutRecipient: "0xRecipientAddress",
61
- };
62
-
63
- const result = await createCoin(createCoinParams, walletClient, publicClient);
64
- console.log(result);
65
- ```
66
-
67
- **Lower Level Call Method with WAGMI:**
68
- Use the `createCoinCall` function to get the contract call parameters and then use WAGMI's `useContractWrite` hook.
69
-
70
- ```typescript
71
- const createCoinParams = {
72
- name: "MyCoin",
73
- symbol: "MYC",
74
- uri: "https://example.com/metadata",
75
- payoutRecipient: "0xRecipientAddress",
76
- };
77
-
78
- const { config } = createCoinCall(createCoinParams);
79
- const { write } = useContractWrite(config);
80
-
81
- write(); // Execute the contract write
82
- // the receipt can be parsed from `getCoinCreateFromLogs(receipt.logs)`
83
- ```
49
+ **Key Parameters:**
50
+
51
+ - `name`: The name of the new coin.
52
+ - `symbol`: The symbol for the new coin.
53
+ - `uri`: The URI for the coin metadata.
54
+ - `owners`: An array of owner addresses. (Optional)
55
+ - `payoutRecipient`: The address that will receive the payout.
56
+ - `platformReferrer`: The referrer address for the platform that earns referral fees. (Optional)
57
+ - `initialPurchaseWei`: The initial purchase amount in Wei. (Optional)
58
+ **Key Parameters:**
59
+
60
+ - `name`: The name of the new coin.
61
+ - `symbol`: The symbol for the new coin.
62
+ - `uri`: The URI for the coin metadata.
63
+ - `owners`: An array of owner addresses. (Optional)
64
+ - `payoutRecipient`: The address that will receive the payout.
65
+ - `platformReferrer`: The referrer address for the platform that earns referral fees. (Optional)
66
+ - `initialPurchaseWei`: The initial purchase amount in Wei. (Optional)
67
+
68
+ **Usage:**
69
+
70
+ ```typescript
71
+ const createCoinParams = {
72
+ name: "MyCoin",
73
+ symbol: "MYC",
74
+ uri: "https://example.com/metadata",
75
+ payoutRecipient: "0xRecipientAddress",
76
+ };
77
+ **Usage:**
78
+
79
+ ```typescript
80
+ const createCoinParams = {
81
+ name: "MyCoin",
82
+ symbol: "MYC",
83
+ uri: "https://example.com/metadata",
84
+ payoutRecipient: "0xRecipientAddress",
85
+ };
86
+
87
+ const result = await createCoin(createCoinParams, walletClient, publicClient);
88
+ console.log(result);
89
+ ```
90
+ const result = await createCoin(createCoinParams, walletClient, publicClient);
91
+ console.log(result);
92
+ ```
93
+
94
+ **Lower Level Call Method with WAGMI:**
95
+ Use the `createCoinCall` function to get the contract call parameters and then use WAGMI's `useContractWrite` hook.
96
+ **Lower Level Call Method with WAGMI:**
97
+ Use the `createCoinCall` function to get the contract call parameters and then use WAGMI's `useContractWrite` hook.
98
+
99
+ ```typescript
100
+ const createCoinParams = {
101
+ name: "MyCoin",
102
+ symbol: "MYC",
103
+ uri: "https://example.com/metadata",
104
+ payoutRecipient: "0xRecipientAddress",
105
+ };
106
+ ```typescript
107
+ const createCoinParams = {
108
+ name: "MyCoin",
109
+ symbol: "MYC",
110
+ uri: "https://example.com/metadata",
111
+ payoutRecipient: "0xRecipientAddress",
112
+ };
113
+
114
+ const { config } = createCoinCall(createCoinParams);
115
+ const { write } = useContractWrite(config);
116
+ const { config } = createCoinCall(createCoinParams);
117
+ const { write } = useContractWrite(config);
118
+
119
+ write(); // Execute the contract write
120
+ // the receipt can be parsed from `getCoinCreateFromLogs(receipt.logs)`
121
+ ```
122
+ write(); // Execute the contract write
123
+ // the receipt can be parsed from `getCoinCreateFromLogs(receipt.logs)`
124
+ ```
84
125
 
85
126
  ### 2. `tradeCoin`: Buys or sells an existing coin.
86
127
 
87
- **Key Parameters:**
88
- - `direction`: The trade direction, either 'buy' or 'sell'.
89
- - `target`: The target coin contract address.
90
- - `args`: The trade arguments.
91
- - `recipient`: The recipient of the trade output.
92
- - `orderSize`: The size of the order.
93
- - `minAmountOut`: The minimum amount to receive. (Optional)
94
- - `sqrtPriceLimitX96`: The price limit for the trade. (Optional)
95
- - `tradeReferrer`: The platform referrer fee recipient address for the trade. (Optional)
96
-
97
- **Usage:**
98
- ```typescript
99
- const tradeParams = {
100
- direction: "buy",
101
- target: "0xTargetAddress",
102
- args: {
103
- recipient: "0xRecipientAddress",
104
- orderSize: 1000n,
105
- },
106
- };
107
-
108
- const result = await tradeCoin(tradeParams, walletClient, publicClient);
109
- console.log(result);
110
- ```
111
-
112
- **Lower Level Call Method with WAGMI:**
113
- Use the `tradeCoinCall` function to get the contract call parameters and then use WAGMI's `useContractWrite` hook.
114
-
115
- ```typescript
116
- const tradeParams = {
117
- direction: "buy",
118
- target: "0xTargetAddress",
119
- args: {
120
- recipient: "0xRecipientAddress",
121
- orderSize: 1000n,
122
- },
123
- };
124
-
125
- const { config } = tradeCoinCall(tradeParams);
126
- const { write } = useContractWrite(config);
127
-
128
- write(); // Execute the contract write
129
- // the receipt can be parsed from `getTradeFromLogs(receipt.logs)`
130
- ```
128
+ **Key Parameters:**
129
+
130
+ - `direction`: The trade direction, either 'buy' or 'sell'.
131
+ - `target`: The target coin contract address.
132
+ - `args`: The trade arguments.
133
+ - `recipient`: The recipient of the trade output.
134
+ - `orderSize`: The size of the order.
135
+ - `minAmountOut`: The minimum amount to receive. (Optional)
136
+ - `sqrtPriceLimitX96`: The price limit for the trade. (Optional)
137
+ - `tradeReferrer`: The platform referrer fee recipient address for the trade. (Optional)
138
+ **Key Parameters:**
139
+
140
+ - `direction`: The trade direction, either 'buy' or 'sell'.
141
+ - `target`: The target coin contract address.
142
+ - `args`: The trade arguments.
143
+ - `recipient`: The recipient of the trade output.
144
+ - `orderSize`: The size of the order.
145
+ - `minAmountOut`: The minimum amount to receive. (Optional)
146
+ - `sqrtPriceLimitX96`: The price limit for the trade. (Optional)
147
+ - `tradeReferrer`: The platform referrer fee recipient address for the trade. (Optional)
148
+
149
+ **Usage:**
150
+
151
+ ```typescript
152
+ const tradeParams = {
153
+ direction: "buy",
154
+ target: "0xTargetAddress",
155
+ args: {
156
+ recipient: "0xRecipientAddress",
157
+ orderSize: 1000n,
158
+ },
159
+ };
160
+ **Usage:**
161
+
162
+ ```typescript
163
+ const tradeParams = {
164
+ direction: "buy",
165
+ target: "0xTargetAddress",
166
+ args: {
167
+ recipient: "0xRecipientAddress",
168
+ orderSize: 1000n,
169
+ },
170
+ };
171
+
172
+ const result = await tradeCoin(tradeParams, walletClient, publicClient);
173
+ console.log(result);
174
+ ```
175
+ const result = await tradeCoin(tradeParams, walletClient, publicClient);
176
+ console.log(result);
177
+ ```
178
+
179
+ **Lower Level Call Method with WAGMI:**
180
+ Use the `tradeCoinCall` function to get the contract call parameters and then use WAGMI's `useContractWrite` hook.
181
+ **Lower Level Call Method with WAGMI:**
182
+ Use the `tradeCoinCall` function to get the contract call parameters and then use WAGMI's `useContractWrite` hook.
183
+
184
+ ```typescript
185
+ const tradeParams = {
186
+ direction: "buy",
187
+ target: "0xTargetAddress",
188
+ args: {
189
+ recipient: "0xRecipientAddress",
190
+ orderSize: 1000n,
191
+ },
192
+ };
193
+ ```typescript
194
+ const tradeParams = {
195
+ direction: "buy",
196
+ target: "0xTargetAddress",
197
+ args: {
198
+ recipient: "0xRecipientAddress",
199
+ orderSize: 1000n,
200
+ },
201
+ };
202
+
203
+ const { config } = tradeCoinCall(tradeParams);
204
+ const { write } = useContractWrite(config);
205
+ const { config } = tradeCoinCall(tradeParams);
206
+ const { write } = useContractWrite(config);
207
+
208
+ write(); // Execute the contract write
209
+ // the receipt can be parsed from `getTradeFromLogs(receipt.logs)`
210
+ ```
211
+ write(); // Execute the contract write
212
+ // the receipt can be parsed from `getTradeFromLogs(receipt.logs)`
213
+ ```
131
214
 
132
215
  ### 3. `updateCoinURI`: Updates the URI for an existing coin.
133
216
 
134
- **Key Parameters:**
135
- - `coin`: The coin contract address.
136
- - `newURI`: The new URI for the coin metadata (must start with "ipfs://").
217
+ **Key Parameters:**
137
218
 
138
- **Usage:**
139
- ```typescript
140
- const updateParams = {
141
- coin: "0xCoinAddress",
142
- newURI: "ipfs://new-metadata-uri",
143
- };
219
+ - `coin`: The coin contract address.
220
+ - `newURI`: The new URI for the coin metadata (must start with "ipfs://").
221
+ **Key Parameters:**
144
222
 
145
- const result = await updateCoinURI(updateParams, walletClient, publicClient);
146
- console.log(result);
147
- ```
223
+ - `coin`: The coin contract address.
224
+ - `newURI`: The new URI for the coin metadata (must start with "ipfs://").
148
225
 
149
- **Lower Level Call Method with WAGMI:**
150
- ```typescript
151
- const updateParams = {
152
- coin: "0xCoinAddress",
153
- newURI: "ipfs://new-metadata-uri",
154
- };
226
+ **Usage:**
155
227
 
156
- const { config } = updateCoinURICall(updateParams);
157
- const { write } = useContractWrite(config);
228
+ ```typescript
229
+ const updateParams = {
230
+ coin: "0xCoinAddress",
231
+ newURI: "ipfs://new-metadata-uri",
232
+ };
233
+ **Usage:**
158
234
 
159
- write(); // Execute the contract write
160
- ```
235
+ ```typescript
236
+ const updateParams = {
237
+ coin: "0xCoinAddress",
238
+ newURI: "ipfs://new-metadata-uri",
239
+ };
240
+
241
+ const result = await updateCoinURI(updateParams, walletClient, publicClient);
242
+ console.log(result);
243
+ ```
244
+ const result = await updateCoinURI(updateParams, walletClient, publicClient);
245
+ console.log(result);
246
+ ```
247
+
248
+ **Lower Level Call Method with WAGMI:**
249
+
250
+ ```typescript
251
+ const updateParams = {
252
+ coin: "0xCoinAddress",
253
+ newURI: "ipfs://new-metadata-uri",
254
+ };
255
+ **Lower Level Call Method with WAGMI:**
256
+
257
+ ```typescript
258
+ const updateParams = {
259
+ coin: "0xCoinAddress",
260
+ newURI: "ipfs://new-metadata-uri",
261
+ };
262
+
263
+ const { config } = updateCoinURICall(updateParams);
264
+ const { write } = useContractWrite(config);
265
+ const { config } = updateCoinURICall(updateParams);
266
+ const { write } = useContractWrite(config);
267
+
268
+ write(); // Execute the contract write
269
+ ```
270
+ write(); // Execute the contract write
271
+ ```
161
272
 
162
273
  ## Onchain Queries
163
274
 
@@ -168,293 +279,590 @@ These are functions that read data from the blockchain or API without requiring
168
279
  This query retrieves the most up-to-date coin information directly from the blockchain.
169
280
  It is strongly recommended to use the other API queries to fetch this information if possible.
170
281
 
171
- **Key Parameters:**
172
- - `coin`: The coin contract address.
173
- - `user`: The user address to check balance for. (Optional)
174
- - `publicClient`: The viem public client instance.
282
+ **Key Parameters:**
283
+
284
+ - `coin`: The coin contract address.
285
+ - `user`: The user address to check balance for. (Optional)
286
+ - `publicClient`: The viem public client instance.
287
+ **Key Parameters:**
288
+
289
+ - `coin`: The coin contract address.
290
+ - `user`: The user address to check balance for. (Optional)
291
+ - `publicClient`: The viem public client instance.
175
292
 
176
- **Return Value:**
177
- - `balance`: The user's balance of the coin.
178
- - `marketCap`: The market cap of the coin.
179
- - `liquidity`: The liquidity of the coin.
180
- - `pool`: Pool address.
181
- - `poolState`: Current state of the UniswapV3 pool.
182
- - `owners`: List of owners for the coin.
183
- - `payoutRecipient`: The payout recipient address.
293
+ **Return Value:**
294
+
295
+ - `balance`: The user's balance of the coin.
296
+ - `marketCap`: The market cap of the coin.
297
+ - `liquidity`: The liquidity of the coin.
298
+ - `pool`: Pool address.
299
+ - `poolState`: Current state of the UniswapV3 pool.
300
+ - `owners`: List of owners for the coin.
301
+ - `payoutRecipient`: The payout recipient address.
302
+ **Return Value:**
303
+
304
+ - `balance`: The user's balance of the coin.
305
+ - `marketCap`: The market cap of the coin.
306
+ - `liquidity`: The liquidity of the coin.
307
+ - `pool`: Pool address.
308
+ - `poolState`: Current state of the UniswapV3 pool.
309
+ - `owners`: List of owners for the coin.
310
+ - `payoutRecipient`: The payout recipient address.
184
311
 
185
312
  ### 2. API Queries
186
313
 
187
- These functions interact with the Zora API to fetch additional data:
188
-
189
- #### API Key
190
-
191
- To get a higher rate limit and fully use the zora API, an API key is required.
192
-
193
- To set the API key, you can use the `setApiKey` function which will apply your API key to all requests.
194
-
195
- ```typescript
196
- setApiKey("your-api-key");
197
- ```
198
-
199
- Please DM the Zora team to get the API key.
200
-
201
- These queries allow non-api-key access for reasonable development usage.
202
-
203
- #### Cursor Pagination
204
-
205
- Many queries support cursor-based pagination using the `after` parameter. To paginate through results:
206
-
207
- 1. Make your initial query without an `after` parameter
208
- 2. From the response, get the `endCursor` from the `pageInfo` object
209
- 3. Pass this `endCursor` as the `after` parameter in your next query
210
-
211
- **Example:**
212
- ```typescript
213
- // First page
214
- const firstPage = await getCoinsTopGainers({
215
- count: 10
216
- });
217
-
218
- // Get the cursor for the next page
219
- const nextCursor = firstPage.exploreList?.pageInfo?.endCursor;
220
-
221
- // Fetch next page using the cursor
222
- if (nextCursor) {
223
- const nextPage = await getCoinsTopGainers({
224
- count: 10,
225
- after: nextCursor
226
- });
227
- }
228
- ```
229
-
230
- **Complete Pagination Example:**
231
- ```typescript
232
- async function fetchAllTopGainers() {
233
- const allResults = [];
234
- let hasNextPage = true;
235
- let cursor: string | undefined;
236
-
237
- while (hasNextPage) {
238
- const response = await getCoinsTopGainers({
239
- count: 10,
240
- after: cursor
241
- });
242
-
243
- const { edges, pageInfo } = response.exploreList || {};
244
-
245
- if (edges) {
246
- allResults.push(...edges.map(edge => edge.node));
247
- }
248
-
249
- hasNextPage = pageInfo?.hasNextPage || false;
250
- cursor = pageInfo?.endCursor;
251
- }
252
-
253
- return allResults;
254
- }
255
- ```
256
-
257
- This pagination pattern works for all queries that return `pageInfo` with `endCursor` and `hasNextPage`, including:
258
- - All explore queries
259
- - `getCoinComments`
260
- - `getProfileOwned`
261
-
262
- ## All API Queries
263
-
264
- #### `getCoin`: Get details for a specific coin
265
- **Parameters:**
266
- - `address`: The coin contract address
267
- - `chain`: (Optional) The chain ID
268
-
269
- **Returns:**
270
- ```typescript
271
- {
272
- zora20Token?: {
273
- id?: string;
274
- name?: string;
275
- description?: string;
276
- address?: string;
277
- symbol?: string;
278
- totalSupply?: string;
279
- totalVolume?: string;
280
- volume24h?: string;
281
- createdAt?: string;
282
- creatorAddress?: string;
283
- creatorEarnings?: Array<{
284
- amount?: {
285
- currency?: { address?: string };
286
- amountRaw?: string;
287
- amountDecimal?: number;
288
- };
289
- amountUsd?: string;
290
- }>;
291
- marketCap?: string;
292
- marketCapDelta24h?: string;
293
- chainId?: number;
294
- creatorProfile?: string;
295
- handle?: string;
296
- avatar?: {
297
- previewImage?: string;
298
- blurhash?: string;
299
- small?: string;
300
- };
301
- media?: {
302
- mimeType?: string;
303
- originalUri?: string;
304
- format?: string;
305
- previewImage?: string;
306
- medium?: string;
307
- blurhash?: string;
308
- };
309
- transfers?: { count?: number };
310
- uniqueHolders?: number;
311
- }
312
- }
313
- ```
314
-
315
- #### `getCoins`: Get details for multiple coins
316
- **Parameters:**
317
- - `coins`: Array of coin objects with:
318
- - `chainId`: (Optional) The chain ID
319
- - `collectionAddress`: The coin contract address
320
-
321
- **Returns:** Array of coin details in the same format as `getCoin`
322
-
323
- #### `getCoinComments`: Get comments for a coin
324
- **Parameters:**
325
- - `address`: The coin contract address
326
- - `chain`: (Optional) The chain ID
327
- - `after`: (Optional) Pagination cursor
328
- - `count`: (Optional) Number of comments to return
329
-
330
- **Returns:**
331
- ```typescript
332
- {
333
- zora20Token?: {
334
- zoraComments?: {
335
- pageInfo?: {
336
- endCursor?: string;
337
- hasNextPage?: boolean;
338
- };
339
- count?: number;
340
- edges?: Array<{
341
- node?: string;
342
- txHash?: string;
343
- comment?: string;
344
- userAddress?: string;
345
- timestamp?: number;
346
- userProfile?: string;
347
- id?: string;
348
- handle?: string;
349
- avatar?: {
350
- previewImage?: string;
351
- blurhash?: string;
352
- small?: string;
353
- };
354
- replies?: {
355
- count?: number;
356
- edges?: Array<{
357
- node?: {
358
- txHash?: string;
359
- comment?: string;
360
- userAddress?: string;
361
- timestamp?: number;
362
- userProfile?: string;
363
- id?: string;
364
- handle?: string;
365
- avatar?: {
366
- previewImage?: string;
367
- blurhash?: string;
368
- small?: string;
369
- };
370
- };
371
- }>;
372
- };
373
- }>;
374
- };
375
- }
376
- }
377
- ```
378
-
379
- #### `getProfile`: Get profile information
380
- **Parameters:**
381
- - `identifier`: The profile identifier (username, handle, or address)
382
-
383
- **Returns:**
384
- ```typescript
385
- {
386
- profile?: string;
387
- id?: string;
388
- handle?: string;
389
- avatar?: {
390
- small?: string;
391
- medium?: string;
392
- blurhash?: string;
393
- };
394
- username?: string;
395
- displayName?: string;
396
- bio?: string;
397
- website?: string;
398
- publicWallet?: {
399
- walletAddress?: string;
400
- };
401
- linkedWallets?: {
402
- edges?: Array<{
403
- node?: {
404
- walletType?: "PRIVY" | "EXTERNAL" | "SMART_WALLET";
405
- walletAddress?: string;
406
- };
407
- }>;
408
- };
409
- }
410
- ```
411
-
412
- #### `getProfileOwned`: Get coins owned by a profile
413
- **Parameters:**
414
- - `identifier`: The profile identifier (username, handle, or address)
415
- - `count`: (Optional) Number of items to return
416
- - `after`: (Optional) Pagination cursor
417
- - `chainIds`: (Optional) Array of chain IDs to filter by
418
-
419
- **Returns:**
420
- ```typescript
421
- {
422
- profile?: string;
423
- id?: string;
424
- handle?: string;
425
- avatar?: {
426
- previewImage?: string;
427
- blurhash?: string;
428
- small?: string;
429
- };
430
- coinBalances?: {
431
- count?: number;
432
- edges?: Array<{
433
- node?: {
434
- balance?: string;
435
- id?: string;
436
- coin?: {
437
- // Same coin details as getCoin
438
- };
439
- };
440
- }>;
441
- pageInfo?: {
442
- hasNextPage?: boolean;
443
- endCursor?: string;
444
- };
445
- };
446
- }
447
- ```
314
+ These functions interact with the Zora API to fetch additional data:
315
+ These functions interact with the Zora API to fetch additional data:
316
+
317
+ #### API Key
318
+ #### API Key
319
+
320
+ To get a higher rate limit and fully use the zora API, an API key is required.
321
+ To get a higher rate limit and fully use the zora API, an API key is required.
322
+
323
+ To set the API key, you can use the `setApiKey` function which will apply your API key to all requests.
324
+ To set the API key, you can use the `setApiKey` function which will apply your API key to all requests.
325
+
326
+ ```typescript
327
+ setApiKey("your-api-key");
328
+ ```
329
+ ```typescript
330
+ setApiKey("your-api-key");
331
+ ```
332
+
333
+ Please DM the Zora team to get the API key.
334
+ Please DM the Zora team to get the API key.
335
+
336
+ These queries allow non-api-key access for reasonable development usage.
337
+ These queries allow non-api-key access for reasonable development usage.
338
+
339
+ #### Cursor Pagination
340
+ #### Cursor Pagination
341
+
342
+ Many queries support cursor-based pagination using the `after` parameter. To paginate through results:
343
+ Many queries support cursor-based pagination using the `after` parameter. To paginate through results:
344
+
345
+ 1. Make your initial query without an `after` parameter
346
+ 2. From the response, get the `endCursor` from the `pageInfo` object
347
+ 3. Pass this `endCursor` as the `after` parameter in your next query
348
+ 1. Make your initial query without an `after` parameter
349
+ 2. From the response, get the `endCursor` from the `pageInfo` object
350
+ 3. Pass this `endCursor` as the `after` parameter in your next query
351
+
352
+ **Example:**
353
+
354
+ ```typescript
355
+ // First page
356
+ const firstPage = await getCoinsTopGainers({
357
+ count: 10,
358
+ });
359
+
360
+ // Get the cursor for the next page
361
+ const nextCursor = firstPage.exploreList?.pageInfo?.endCursor;
362
+
363
+ // Fetch next page using the cursor
364
+ if (nextCursor) {
365
+ const nextPage = await getCoinsTopGainers({
366
+ count: 10,
367
+ after: nextCursor,
368
+ });
369
+ }
370
+ ```
371
+ **Example:**
372
+
373
+ ```typescript
374
+ // First page
375
+ const firstPage = await getCoinsTopGainers({
376
+ count: 10,
377
+ });
378
+
379
+ // Get the cursor for the next page
380
+ const nextCursor = firstPage.exploreList?.pageInfo?.endCursor;
381
+
382
+ // Fetch next page using the cursor
383
+ if (nextCursor) {
384
+ const nextPage = await getCoinsTopGainers({
385
+ count: 10,
386
+ after: nextCursor,
387
+ });
388
+ }
389
+ ```
390
+
391
+ **Complete Pagination Example:**
392
+
393
+ ```typescript
394
+ async function fetchAllTopGainers() {
395
+ const allResults = [];
396
+ let hasNextPage = true;
397
+ let cursor: string | undefined;
398
+
399
+ while (hasNextPage) {
400
+ const response = await getCoinsTopGainers({
401
+ count: 10,
402
+ after: cursor,
403
+ });
404
+
405
+ const { edges, pageInfo } = response.exploreList || {};
406
+
407
+ if (edges) {
408
+ allResults.push(...edges.map((edge) => edge.node));
409
+ }
410
+
411
+ hasNextPage = pageInfo?.hasNextPage || false;
412
+ cursor = pageInfo?.endCursor;
413
+ }
414
+
415
+ return allResults;
416
+ }
417
+ ```
418
+ **Complete Pagination Example:**
419
+
420
+ ```typescript
421
+ async function fetchAllTopGainers() {
422
+ const allResults = [];
423
+ let hasNextPage = true;
424
+ let cursor: string | undefined;
425
+
426
+ while (hasNextPage) {
427
+ const response = await getCoinsTopGainers({
428
+ count: 10,
429
+ after: cursor,
430
+ });
431
+
432
+ const { edges, pageInfo } = response.exploreList || {};
433
+
434
+ if (edges) {
435
+ allResults.push(...edges.map((edge) => edge.node));
436
+ }
437
+
438
+ hasNextPage = pageInfo?.hasNextPage || false;
439
+ cursor = pageInfo?.endCursor;
440
+ }
441
+
442
+ return allResults;
443
+ }
444
+ ```
445
+
446
+ This pagination pattern works for all queries that return `pageInfo` with `endCursor` and `hasNextPage`, including:
447
+
448
+ - All explore queries
449
+ - `getCoinComments`
450
+ - `getProfileOwned`
451
+
452
+ ## All API Queries
453
+ This pagination pattern works for all queries that return `pageInfo` with `endCursor` and `hasNextPage`, including:
454
+
455
+ - All explore queries
456
+ - `getCoinComments`
457
+ - `getProfileOwned`
458
+
459
+ ## All API Queries
460
+
461
+ #### `getCoin`: Get details for a specific coin
462
+
463
+ **Parameters:**
464
+
465
+ - `address`: The coin contract address
466
+ - `chain`: (Optional) The chain ID
467
+ #### `getCoin`: Get details for a specific coin
468
+
469
+ **Parameters:**
470
+
471
+ - `address`: The coin contract address
472
+ - `chain`: (Optional) The chain ID
473
+
474
+ **Returns:**
475
+
476
+ ```typescript
477
+ {
478
+ zora20Token?: {
479
+ id?: string;
480
+ name?: string;
481
+ description?: string;
482
+ address?: string;
483
+ symbol?: string;
484
+ totalSupply?: string;
485
+ totalVolume?: string;
486
+ volume24h?: string;
487
+ createdAt?: string;
488
+ creatorAddress?: string;
489
+ creatorEarnings?: Array<{
490
+ amount?: {
491
+ currency?: { address?: string };
492
+ amountRaw?: string;
493
+ amountDecimal?: number;
494
+ };
495
+ amountUsd?: string;
496
+ }>;
497
+ marketCap?: string;
498
+ marketCapDelta24h?: string;
499
+ chainId?: number;
500
+ creatorProfile?: string;
501
+ handle?: string;
502
+ avatar?: {
503
+ previewImage?: string;
504
+ blurhash?: string;
505
+ small?: string;
506
+ };
507
+ media?: {
508
+ mimeType?: string;
509
+ originalUri?: string;
510
+ format?: string;
511
+ previewImage?: string;
512
+ medium?: string;
513
+ blurhash?: string;
514
+ };
515
+ transfers?: { count?: number };
516
+ uniqueHolders?: number;
517
+ }
518
+ }
519
+ ```
520
+ **Returns:**
521
+
522
+ ```typescript
523
+ {
524
+ zora20Token?: {
525
+ id?: string;
526
+ name?: string;
527
+ description?: string;
528
+ address?: string;
529
+ symbol?: string;
530
+ totalSupply?: string;
531
+ totalVolume?: string;
532
+ volume24h?: string;
533
+ createdAt?: string;
534
+ creatorAddress?: string;
535
+ creatorEarnings?: Array<{
536
+ amount?: {
537
+ currency?: { address?: string };
538
+ amountRaw?: string;
539
+ amountDecimal?: number;
540
+ };
541
+ amountUsd?: string;
542
+ }>;
543
+ marketCap?: string;
544
+ marketCapDelta24h?: string;
545
+ chainId?: number;
546
+ creatorProfile?: string;
547
+ handle?: string;
548
+ avatar?: {
549
+ previewImage?: string;
550
+ blurhash?: string;
551
+ small?: string;
552
+ };
553
+ media?: {
554
+ mimeType?: string;
555
+ originalUri?: string;
556
+ format?: string;
557
+ previewImage?: string;
558
+ medium?: string;
559
+ blurhash?: string;
560
+ };
561
+ transfers?: { count?: number };
562
+ uniqueHolders?: number;
563
+ }
564
+ }
565
+ ```
566
+
567
+ #### `getCoins`: Get details for multiple coins
568
+
569
+ **Parameters:**
570
+
571
+ - `coins`: Array of coin objects with:
572
+ - `chainId`: (Optional) The chain ID
573
+ - `collectionAddress`: The coin contract address
574
+ #### `getCoins`: Get details for multiple coins
575
+
576
+ **Parameters:**
577
+
578
+ - `coins`: Array of coin objects with:
579
+ - `chainId`: (Optional) The chain ID
580
+ - `collectionAddress`: The coin contract address
581
+
582
+ **Returns:** Array of coin details in the same format as `getCoin`
583
+ **Returns:** Array of coin details in the same format as `getCoin`
584
+
585
+ #### `getCoinComments`: Get comments for a coin
586
+
587
+ **Parameters:**
588
+
589
+ - `address`: The coin contract address
590
+ - `chain`: (Optional) The chain ID
591
+ - `after`: (Optional) Pagination cursor
592
+ - `count`: (Optional) Number of comments to return
593
+ #### `getCoinComments`: Get comments for a coin
594
+
595
+ **Parameters:**
596
+
597
+ - `address`: The coin contract address
598
+ - `chain`: (Optional) The chain ID
599
+ - `after`: (Optional) Pagination cursor
600
+ - `count`: (Optional) Number of comments to return
601
+
602
+ **Returns:**
603
+
604
+ ```typescript
605
+ {
606
+ zora20Token?: {
607
+ zoraComments?: {
608
+ pageInfo?: {
609
+ endCursor?: string;
610
+ hasNextPage?: boolean;
611
+ };
612
+ count?: number;
613
+ edges?: Array<{
614
+ node?: string;
615
+ txHash?: string;
616
+ comment?: string;
617
+ userAddress?: string;
618
+ timestamp?: number;
619
+ userProfile?: string;
620
+ id?: string;
621
+ handle?: string;
622
+ avatar?: {
623
+ previewImage?: string;
624
+ blurhash?: string;
625
+ small?: string;
626
+ };
627
+ replies?: {
628
+ count?: number;
629
+ edges?: Array<{
630
+ node?: {
631
+ txHash?: string;
632
+ comment?: string;
633
+ userAddress?: string;
634
+ timestamp?: number;
635
+ userProfile?: string;
636
+ id?: string;
637
+ handle?: string;
638
+ avatar?: {
639
+ previewImage?: string;
640
+ blurhash?: string;
641
+ small?: string;
642
+ };
643
+ };
644
+ }>;
645
+ };
646
+ }>;
647
+ };
648
+ }
649
+ }
650
+ ```
651
+ **Returns:**
652
+
653
+ ```typescript
654
+ {
655
+ zora20Token?: {
656
+ zoraComments?: {
657
+ pageInfo?: {
658
+ endCursor?: string;
659
+ hasNextPage?: boolean;
660
+ };
661
+ count?: number;
662
+ edges?: Array<{
663
+ node?: string;
664
+ txHash?: string;
665
+ comment?: string;
666
+ userAddress?: string;
667
+ timestamp?: number;
668
+ userProfile?: string;
669
+ id?: string;
670
+ handle?: string;
671
+ avatar?: {
672
+ previewImage?: string;
673
+ blurhash?: string;
674
+ small?: string;
675
+ };
676
+ replies?: {
677
+ count?: number;
678
+ edges?: Array<{
679
+ node?: {
680
+ txHash?: string;
681
+ comment?: string;
682
+ userAddress?: string;
683
+ timestamp?: number;
684
+ userProfile?: string;
685
+ id?: string;
686
+ handle?: string;
687
+ avatar?: {
688
+ previewImage?: string;
689
+ blurhash?: string;
690
+ small?: string;
691
+ };
692
+ };
693
+ }>;
694
+ };
695
+ }>;
696
+ };
697
+ }
698
+ }
699
+ ```
700
+
701
+ #### `getProfile`: Get profile information
702
+
703
+ **Parameters:**
704
+
705
+ - `identifier`: The profile identifier (username, handle, or address)
706
+ #### `getProfile`: Get profile information
707
+
708
+ **Parameters:**
709
+
710
+ - `identifier`: The profile identifier (username, handle, or address)
711
+
712
+ **Returns:**
713
+
714
+ ```typescript
715
+ {
716
+ profile?: string;
717
+ id?: string;
718
+ handle?: string;
719
+ avatar?: {
720
+ small?: string;
721
+ medium?: string;
722
+ blurhash?: string;
723
+ };
724
+ username?: string;
725
+ displayName?: string;
726
+ bio?: string;
727
+ website?: string;
728
+ publicWallet?: {
729
+ walletAddress?: string;
730
+ };
731
+ linkedWallets?: {
732
+ edges?: Array<{
733
+ node?: {
734
+ walletType?: "PRIVY" | "EXTERNAL" | "SMART_WALLET";
735
+ walletAddress?: string;
736
+ };
737
+ }>;
738
+ };
739
+ }
740
+ ```
741
+ **Returns:**
742
+
743
+ ```typescript
744
+ {
745
+ profile?: string;
746
+ id?: string;
747
+ handle?: string;
748
+ avatar?: {
749
+ small?: string;
750
+ medium?: string;
751
+ blurhash?: string;
752
+ };
753
+ username?: string;
754
+ displayName?: string;
755
+ bio?: string;
756
+ website?: string;
757
+ publicWallet?: {
758
+ walletAddress?: string;
759
+ };
760
+ linkedWallets?: {
761
+ edges?: Array<{
762
+ node?: {
763
+ walletType?: "PRIVY" | "EXTERNAL" | "SMART_WALLET";
764
+ walletAddress?: string;
765
+ };
766
+ }>;
767
+ };
768
+ }
769
+ ```
770
+
771
+ #### `getProfileOwned`: Get coins owned by a profile
772
+
773
+ **Parameters:**
774
+
775
+ - `identifier`: The profile identifier (username, handle, or address)
776
+ - `count`: (Optional) Number of items to return
777
+ - `after`: (Optional) Pagination cursor
778
+ - `chainIds`: (Optional) Array of chain IDs to filter by
779
+ #### `getProfileOwned`: Get coins owned by a profile
780
+
781
+ **Parameters:**
782
+
783
+ - `identifier`: The profile identifier (username, handle, or address)
784
+ - `count`: (Optional) Number of items to return
785
+ - `after`: (Optional) Pagination cursor
786
+ - `chainIds`: (Optional) Array of chain IDs to filter by
787
+
788
+ **Returns:**
789
+
790
+ ```typescript
791
+ {
792
+ profile?: string;
793
+ id?: string;
794
+ handle?: string;
795
+ avatar?: {
796
+ previewImage?: string;
797
+ blurhash?: string;
798
+ small?: string;
799
+ };
800
+ coinBalances?: {
801
+ count?: number;
802
+ edges?: Array<{
803
+ node?: {
804
+ balance?: string;
805
+ id?: string;
806
+ coin?: {
807
+ // Same coin details as getCoin
808
+ };
809
+ };
810
+ }>;
811
+ pageInfo?: {
812
+ hasNextPage?: boolean;
813
+ endCursor?: string;
814
+ };
815
+ };
816
+ }
817
+ ```
818
+ **Returns:**
819
+
820
+ ```typescript
821
+ {
822
+ profile?: string;
823
+ id?: string;
824
+ handle?: string;
825
+ avatar?: {
826
+ previewImage?: string;
827
+ blurhash?: string;
828
+ small?: string;
829
+ };
830
+ coinBalances?: {
831
+ count?: number;
832
+ edges?: Array<{
833
+ node?: {
834
+ balance?: string;
835
+ id?: string;
836
+ coin?: {
837
+ // Same coin details as getCoin
838
+ };
839
+ };
840
+ }>;
841
+ pageInfo?: {
842
+ hasNextPage?: boolean;
843
+ endCursor?: string;
844
+ };
845
+ };
846
+ }
847
+ ```
448
848
 
449
849
  #### `getCoinsTopGainers`: Get top gaining coins
850
+
851
+
450
852
  **Parameters:**
853
+
451
854
  - `count`: (Optional) Number of items to return, type: `number`
452
855
  - `after`: (Optional) Pagination cursor, type: `string`
453
856
 
454
857
  **Request Type:**
858
+
859
+
455
860
  ```typescript
456
- type Options<T extends boolean = false> = {
457
- query?: {
861
+ // Types from @zoralabs/coins-sdk
862
+ export type RequestOptionsType = Omit<GetExploreData, "query">;
863
+
864
+ export type QueryInnerType = {
865
+ query: {
458
866
  count?: number;
459
867
  after?: string;
460
868
  };
@@ -462,6 +870,7 @@ type Options<T extends boolean = false> = {
462
870
  ```
463
871
 
464
872
  **Return Type:**
873
+
465
874
  ```typescript
466
875
  {
467
876
  exploreList?: {
@@ -499,86 +908,101 @@ type Options<T extends boolean = false> = {
499
908
  ```
500
909
 
501
910
  #### `getCoinsTopVolume24h`: Get coins with highest 24h volume
911
+
912
+
502
913
  **Parameters:**
914
+
503
915
  - `count`: (Optional) Number of items to return, type: `number`
504
916
  - `after`: (Optional) Pagination cursor, type: `string`
505
917
 
506
918
  **Request Type:**
919
+
507
920
  ```typescript
508
- type Options<T extends boolean = false> = {
509
- query?: {
510
- count?: number;
511
- after?: string;
512
- };
513
- };
921
+ function getCoinsTopVolume24h(
922
+ query: QueryInnerType,
923
+ options?: RequestOptionsType,
924
+ ): Promise<ExploreResponse>;
514
925
  ```
515
926
 
927
+ **Request Type:** Same as `getCoinsTopGainers`
516
928
  **Return Type:** Same as `getCoinsTopGainers`
517
929
 
518
930
  #### `getCoinsMostValuable`: Get most valuable coins
931
+
932
+
519
933
  **Parameters:**
934
+
520
935
  - `count`: (Optional) Number of items to return, type: `number`
521
936
  - `after`: (Optional) Pagination cursor, type: `string`
522
937
 
523
938
  **Request Type:**
939
+
524
940
  ```typescript
525
- type Options<T extends boolean = false> = {
526
- query?: {
527
- count?: number;
528
- after?: string;
529
- };
530
- };
941
+ function getCoinsMostValuable(
942
+ query: QueryInnerType,
943
+ options?: RequestOptionsType,
944
+ ): Promise<ExploreResponse>;
531
945
  ```
532
946
 
947
+ **Request Type:** Same as `getCoinsTopGainers`
533
948
  **Return Type:** Same as `getCoinsTopGainers`
534
949
 
535
950
  #### `getCoinsNew`: Get newly created coins
951
+
952
+
536
953
  **Parameters:**
954
+
537
955
  - `count`: (Optional) Number of items to return, type: `number`
538
956
  - `after`: (Optional) Pagination cursor, type: `string`
539
957
 
540
958
  **Request Type:**
959
+
541
960
  ```typescript
542
- type Options<T extends boolean = false> = {
543
- query?: {
544
- count?: number;
545
- after?: string;
546
- };
547
- };
961
+ function getCoinsNew(
962
+ query: QueryInnerType,
963
+ options?: RequestOptionsType,
964
+ ): Promise<ExploreResponse>;
548
965
  ```
549
966
 
967
+ **Request Type:** Same as `getCoinsTopGainers`
550
968
  **Return Type:** Same as `getCoinsTopGainers`
551
969
 
552
970
  #### `getCoinsLastTraded`: Get recently traded coins
971
+
972
+
553
973
  **Parameters:**
974
+
554
975
  - `count`: (Optional) Number of items to return, type: `number`
555
976
  - `after`: (Optional) Pagination cursor, type: `string`
556
977
 
557
978
  **Request Type:**
979
+
558
980
  ```typescript
559
- type Options<T extends boolean = false> = {
560
- query?: {
561
- count?: number;
562
- after?: string;
563
- };
564
- };
981
+ function getCoinsLastTraded(
982
+ query: QueryInnerType,
983
+ options?: RequestOptionsType,
984
+ ): Promise<ExploreResponse>;
565
985
  ```
566
986
 
987
+ **Request Type:** Same as `getCoinsTopGainers`
567
988
  **Return Type:** Same as `getCoinsTopGainers`
568
989
 
569
990
  #### `getCoinsLastTradedUnique`: Get recently traded unique coins
991
+
992
+
570
993
  **Parameters:**
994
+
571
995
  - `count`: (Optional) Number of items to return, type: `number`
572
996
  - `after`: (Optional) Pagination cursor, type: `string`
573
997
 
574
998
  **Request Type:**
999
+
575
1000
  ```typescript
576
- type Options<T extends boolean = false> = {
577
- query?: {
578
- count?: number;
579
- after?: string;
580
- };
581
- };
1001
+ function getCoinsLastTradedUnique(
1002
+ query: QueryInnerType,
1003
+ options?: RequestOptionsType,
1004
+ ): Promise<ExploreResponse>;
582
1005
  ```
583
1006
 
1007
+ **Request Type:** Same as `getCoinsTopGainers`
584
1008
  **Return Type:** Same as `getCoinsTopGainers`