@zoralabs/coins-sdk 0.0.4 → 0.0.5

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
@@ -1,1008 +1,37 @@
1
1
  # Coins SDK
2
2
 
3
- The `@zoralabs/coins-sdk` package is currently a prerelease SDK.
3
+ The `@zoralabs/coins-sdk` package allows developers to interact with the ZORA coins protocol.
4
4
 
5
5
  This SDK is based off of viem v2 and exposes both functions to get the viem call to use with WAGMI, and also functions that complete the actions using the simulateContract and writeContract calls. Many reasonable defaults are set for fields, so read the action files and types to determine which parameters are needed for your actions.
6
6
 
7
7
  Devs can input their addresses in `platformReferrer` and `traderReferrer` fields to earn trade and create referral fees for their platform.
8
8
 
9
- This prerelease SDK has two main categories of functionality: Onchain Actions and Queries.
9
+ This SDK has two main categories of functionality: Onchain Actions and Offchain Queries.
10
10
 
11
11
  All the SDK functions are accessible from the main export (for example: `import {createCoin, getCoin} from "@zoralabs/coins-sdk"`).
12
12
 
13
- ## Table of Contents
13
+ All [documentation for coins](https://docs.zora.co/coins/sdk/getting-started) is available on [docs.zora.co](https://docs.zora.co/).
14
14
 
15
- ### Onchain Actions
16
-
17
-
18
- - [createCoin](#1-createcoin-creates-a-new-coin-with-the-given-parameters-to-trade)
19
- - [tradeCoin](#2-tradecoin-buys-or-sells-an-existing-coin)
20
- - [updateCoinURI](#3-updatecoinuri-updates-the-uri-for-an-existing-coin)
21
-
22
- ### Queries
23
-
24
-
25
- - [On chain queries](#onchain-queries)
26
- - [getOnchainCoinDetails](#1-getonchaincoindetails-gets-details-for-the-given-coin-from-the-blockchain)
27
- - [API Queries](#3-api-queries)
28
- - [API Key](#2-api-key)
29
- - [Cursor Pagination](#cursor-pagination)
30
- - Queries
31
- - [getCoin](#getcoin-get-details-for-a-specific-coin)
32
- - [getCoins](#getcoins-get-details-for-multiple-coins)
33
- - [getCoinComments](#getcoincomments-get-comments-for-a-coin)
34
- - [getProfile](#getprofile-get-profile-information)
35
- - [getProfileOwned](#getprofileowned-get-coins-owned-by-a-profile)
36
- - [getCoinsTopGainers](#getcoinstopgainers)
37
- - [getCoinsTopVolume24h](#getcoinstopvolume24h)
38
- - [getCoinsMostValuable](#getcoinsmostvaluable)
39
- - [getCoinsNew](#getcoinsnew)
40
- - [getCoinsLastTraded](#getcoinslasttraded)
41
- - [getCoinsLastTradedUnique](#getcoinslasttradedunique)
42
-
43
- ## Onchain Actions
44
-
45
- These are functions that interact directly with the blockchain and require transaction signing.
46
-
47
- ### 1. `createCoin`: Creates a new coin with the given parameters to trade.
48
-
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
- ```
125
-
126
- ### 2. `tradeCoin`: Buys or sells an existing coin.
127
-
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
- ```
214
-
215
- ### 3. `updateCoinURI`: Updates the URI for an existing coin.
216
-
217
- **Key Parameters:**
218
-
219
- - `coin`: The coin contract address.
220
- - `newURI`: The new URI for the coin metadata (must start with "ipfs://").
221
- **Key Parameters:**
222
-
223
- - `coin`: The coin contract address.
224
- - `newURI`: The new URI for the coin metadata (must start with "ipfs://").
225
-
226
- **Usage:**
227
-
228
- ```typescript
229
- const updateParams = {
230
- coin: "0xCoinAddress",
231
- newURI: "ipfs://new-metadata-uri",
232
- };
233
- **Usage:**
234
-
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
- ```
272
-
273
- ## Onchain Queries
274
-
275
- These are functions that read data from the blockchain or API without requiring transaction signing.
276
-
277
- ### 1. `getOnchainCoinDetails`: Gets details for the given coin from the blockchain.
278
-
279
- This query retrieves the most up-to-date coin information directly from the blockchain.
280
- It is strongly recommended to use the other API queries to fetch this information if possible.
281
-
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.
292
-
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.
311
-
312
- ### 2. API Queries
313
-
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
- }
15
+ Contact us at [x.com/zoradevs](https://x.com/zoradevs) [warpcast/~/channel/zora-devs](https://warpcast.com/~/channel/zora-devs).
441
16
 
442
- return allResults;
443
- }
444
- ```
445
17
 
446
- This pagination pattern works for all queries that return `pageInfo` with `endCursor` and `hasNextPage`, including:
18
+ ## Docs links
447
19
 
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
- ```
848
-
849
- #### `getCoinsTopGainers`: Get top gaining coins
850
-
851
-
852
- **Parameters:**
853
-
854
- - `count`: (Optional) Number of items to return, type: `number`
855
- - `after`: (Optional) Pagination cursor, type: `string`
856
-
857
- **Request Type:**
858
-
859
-
860
- ```typescript
861
- // Types from @zoralabs/coins-sdk
862
- export type RequestOptionsType = Omit<GetExploreData, "query">;
863
-
864
- export type QueryInnerType = {
865
- query: {
866
- count?: number;
867
- after?: string;
868
- };
869
- };
870
- ```
871
-
872
- **Return Type:**
873
-
874
- ```typescript
875
- {
876
- exploreList?: {
877
- edges?: Array<{
878
- node?: {
879
- id?: string;
880
- name?: string;
881
- description?: string;
882
- address?: string;
883
- symbol?: string;
884
- totalSupply?: string;
885
- totalVolume?: string;
886
- volume24h?: string;
887
- createdAt?: string;
888
- creatorAddress?: string;
889
- creatorEarnings?: Array<{...}>;
890
- marketCap?: string;
891
- marketCapDelta24h?: string;
892
- chainId?: number;
893
- creatorProfile?: string;
894
- handle?: string;
895
- avatar?: {...};
896
- media?: {...};
897
- transfers?: { count?: number };
898
- uniqueHolders?: number;
899
- };
900
- cursor?: string;
901
- }>;
902
- pageInfo?: {
903
- endCursor?: string;
904
- hasNextPage?: boolean;
905
- };
906
- };
907
- }
908
- ```
909
-
910
- #### `getCoinsTopVolume24h`: Get coins with highest 24h volume
911
-
912
-
913
- **Parameters:**
914
-
915
- - `count`: (Optional) Number of items to return, type: `number`
916
- - `after`: (Optional) Pagination cursor, type: `string`
917
-
918
- **Request Type:**
919
-
920
- ```typescript
921
- function getCoinsTopVolume24h(
922
- query: QueryInnerType,
923
- options?: RequestOptionsType,
924
- ): Promise<ExploreResponse>;
925
- ```
926
-
927
- **Request Type:** Same as `getCoinsTopGainers`
928
- **Return Type:** Same as `getCoinsTopGainers`
929
-
930
- #### `getCoinsMostValuable`: Get most valuable coins
931
-
932
-
933
- **Parameters:**
934
-
935
- - `count`: (Optional) Number of items to return, type: `number`
936
- - `after`: (Optional) Pagination cursor, type: `string`
937
-
938
- **Request Type:**
939
-
940
- ```typescript
941
- function getCoinsMostValuable(
942
- query: QueryInnerType,
943
- options?: RequestOptionsType,
944
- ): Promise<ExploreResponse>;
945
- ```
946
-
947
- **Request Type:** Same as `getCoinsTopGainers`
948
- **Return Type:** Same as `getCoinsTopGainers`
949
-
950
- #### `getCoinsNew`: Get newly created coins
951
-
952
-
953
- **Parameters:**
954
-
955
- - `count`: (Optional) Number of items to return, type: `number`
956
- - `after`: (Optional) Pagination cursor, type: `string`
957
-
958
- **Request Type:**
959
-
960
- ```typescript
961
- function getCoinsNew(
962
- query: QueryInnerType,
963
- options?: RequestOptionsType,
964
- ): Promise<ExploreResponse>;
965
- ```
966
-
967
- **Request Type:** Same as `getCoinsTopGainers`
968
- **Return Type:** Same as `getCoinsTopGainers`
969
-
970
- #### `getCoinsLastTraded`: Get recently traded coins
971
-
972
-
973
- **Parameters:**
974
-
975
- - `count`: (Optional) Number of items to return, type: `number`
976
- - `after`: (Optional) Pagination cursor, type: `string`
977
-
978
- **Request Type:**
979
-
980
- ```typescript
981
- function getCoinsLastTraded(
982
- query: QueryInnerType,
983
- options?: RequestOptionsType,
984
- ): Promise<ExploreResponse>;
985
- ```
986
-
987
- **Request Type:** Same as `getCoinsTopGainers`
988
- **Return Type:** Same as `getCoinsTopGainers`
989
-
990
- #### `getCoinsLastTradedUnique`: Get recently traded unique coins
991
-
992
-
993
- **Parameters:**
994
-
995
- - `count`: (Optional) Number of items to return, type: `number`
996
- - `after`: (Optional) Pagination cursor, type: `string`
20
+ ### Onchain Actions
997
21
 
998
- **Request Type:**
22
+ - [createCoin](https://docs.zora.co/coins/sdk/create-coin)
23
+ - [tradeCoin](https://docs.zora.co/coins/sdk/trade-coin)
24
+ - [updateCoinURI](https://docs.zora.co/coins/sdk/update-coin)
25
+ - [updatePayoutRecipient](https://docs.zora.co/coins/sdk/update-coin#updating-payout-recipient)
999
26
 
1000
- ```typescript
1001
- function getCoinsLastTradedUnique(
1002
- query: QueryInnerType,
1003
- options?: RequestOptionsType,
1004
- ): Promise<ExploreResponse>;
1005
- ```
27
+ ### Queries
1006
28
 
1007
- **Request Type:** Same as `getCoinsTopGainers`
1008
- **Return Type:** Same as `getCoinsTopGainers`
29
+ - Onchain queries
30
+ - [getOnchainCoinDetails](https://docs.zora.co/coins/sdk/queries/onchain)
31
+ - [API Queries](https://docs.zora.co/coins/sdk/queries)
32
+ - API Key
33
+ - Cursor Pagination
34
+ - Queries
35
+ - [Coin queries](https://docs.zora.co/coins/sdk/queries/coin)
36
+ - [Profile queries](https://docs.zora.co/coins/sdk/queries/profile)
37
+ - [Explore queries](https://docs.zora.co/coins/sdk/queries/profile)