@zoralabs/coins-sdk 0.0.2-sdkalpha.2 → 0.0.2-sdkalpha.4

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +448 -18
  3. package/dist/actions/createCoin.d.ts.map +1 -1
  4. package/dist/actions/{getCoinDetails.d.ts → getOnchainCoinDetails.d.ts} +9 -8
  5. package/dist/actions/getOnchainCoinDetails.d.ts.map +1 -0
  6. package/dist/api/api-key.d.ts +9 -0
  7. package/dist/api/api-key.d.ts.map +1 -0
  8. package/dist/api/explore.d.ts +347 -0
  9. package/dist/api/explore.d.ts.map +1 -0
  10. package/dist/api/index.d.ts +4 -0
  11. package/dist/api/index.d.ts.map +1 -0
  12. package/dist/api/queries.d.ts +345 -0
  13. package/dist/api/queries.d.ts.map +1 -0
  14. package/dist/client/client.gen.d.ts +13 -0
  15. package/dist/client/client.gen.d.ts.map +1 -0
  16. package/dist/client/index.d.ts +3 -0
  17. package/dist/client/index.d.ts.map +1 -0
  18. package/dist/client/sdk.gen.d.ts +366 -0
  19. package/dist/client/sdk.gen.d.ts.map +1 -0
  20. package/dist/client/types.gen.d.ts +549 -0
  21. package/dist/client/types.gen.d.ts.map +1 -0
  22. package/dist/index.cjs +185 -33
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.ts +5 -3
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +179 -33
  27. package/dist/index.js.map +1 -1
  28. package/dist/utils/genericPublicClient.d.ts +3 -0
  29. package/dist/utils/genericPublicClient.d.ts.map +1 -0
  30. package/dist/utils/validateClientNetwork.d.ts +1 -1
  31. package/dist/utils/validateClientNetwork.d.ts.map +1 -1
  32. package/package.json +7 -4
  33. package/src/actions/createCoin.ts +5 -0
  34. package/src/actions/{getCoinDetails.ts → getOnchainCoinDetails.ts} +111 -76
  35. package/src/api/api-key.ts +15 -0
  36. package/src/api/explore.ts +55 -0
  37. package/src/api/index.ts +8 -0
  38. package/src/api/queries.ts +60 -0
  39. package/src/client/client.gen.ts +18 -0
  40. package/src/client/index.ts +3 -0
  41. package/src/client/sdk.gen.ts +117 -0
  42. package/src/client/types.gen.ts +580 -0
  43. package/src/index.ts +18 -4
  44. package/src/utils/genericPublicClient.ts +5 -0
  45. package/src/utils/validateClientNetwork.ts +16 -12
  46. package/dist/actions/getCoinDetails.d.ts.map +0 -1
@@ -0,0 +1,580 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+
3
+ export type GetCoinData = {
4
+ body?: never;
5
+ path?: never;
6
+ query: {
7
+ address: string;
8
+ chain?: number;
9
+ };
10
+ url: "/coin";
11
+ };
12
+
13
+ export type GetCoinResponses = {
14
+ /**
15
+ * response
16
+ */
17
+ 200: {
18
+ zora20Token?: {
19
+ /**
20
+ * The Globally Unique ID of this object
21
+ */
22
+ id?: string;
23
+ name?: string;
24
+ description?: string;
25
+ address?: string;
26
+ symbol?: string;
27
+ totalSupply?: string;
28
+ totalVolume?: string;
29
+ volume24h?: string;
30
+ createdAt?: string;
31
+ creatorAddress?: string;
32
+ creatorEarnings?: Array<{
33
+ amount?: {
34
+ currency?: {
35
+ address?: string;
36
+ };
37
+ amountRaw?: string;
38
+ amountDecimal?: number;
39
+ };
40
+ amountUsd?: string;
41
+ }>;
42
+ marketCap?: string;
43
+ marketCapDelta24h?: string;
44
+ chainId?: number;
45
+ creatorProfile?: string;
46
+ handle?: string;
47
+ avatar?: {
48
+ previewImage?: string;
49
+ blurhash?: string;
50
+ small?: string;
51
+ };
52
+ media?: {
53
+ mimeType?: string;
54
+ originalUri?: string;
55
+ format?: string;
56
+ previewImage?: string;
57
+ medium?: string;
58
+ blurhash?: string;
59
+ };
60
+ transfers?: {
61
+ count?: number;
62
+ };
63
+ uniqueHolders?: number;
64
+ zoraComments?: {
65
+ /**
66
+ * Information to aid in pagination.
67
+ */
68
+ pageInfo?: {
69
+ /**
70
+ * When paginating forwards, the cursor to continue.
71
+ */
72
+ endCursor?: string;
73
+ /**
74
+ * When paginating forwards, are there more items?
75
+ */
76
+ hasNextPage?: boolean;
77
+ };
78
+ count?: number;
79
+ edges?: Array<{
80
+ node?: string;
81
+ txHash?: string;
82
+ comment?: string;
83
+ userAddress?: string;
84
+ timestamp?: number;
85
+ userProfile?: string;
86
+ /**
87
+ * The Globally Unique ID of this object
88
+ */
89
+ id?: string;
90
+ handle?: string;
91
+ avatar?: {
92
+ previewImage?: string;
93
+ blurhash?: string;
94
+ small?: string;
95
+ };
96
+ }>;
97
+ };
98
+ };
99
+ };
100
+ };
101
+
102
+ export type GetCoinResponse = GetCoinResponses[keyof GetCoinResponses];
103
+
104
+ export type GetCoinCommentsData = {
105
+ body?: never;
106
+ path?: never;
107
+ query: {
108
+ address: string;
109
+ chain?: number;
110
+ after?: string;
111
+ count?: number;
112
+ };
113
+ url: "/coinComments";
114
+ };
115
+
116
+ export type GetCoinCommentsResponses = {
117
+ /**
118
+ * response
119
+ */
120
+ 200: {
121
+ zora20Token?: {
122
+ zoraComments?: {
123
+ /**
124
+ * Information to aid in pagination.
125
+ */
126
+ pageInfo?: {
127
+ /**
128
+ * When paginating forwards, the cursor to continue.
129
+ */
130
+ endCursor?: string;
131
+ /**
132
+ * When paginating forwards, are there more items?
133
+ */
134
+ hasNextPage?: boolean;
135
+ };
136
+ count?: number;
137
+ edges?: Array<{
138
+ node?: string;
139
+ txHash?: string;
140
+ comment?: string;
141
+ userAddress?: string;
142
+ timestamp?: number;
143
+ userProfile?: string;
144
+ /**
145
+ * The Globally Unique ID of this object
146
+ */
147
+ id?: string;
148
+ handle?: string;
149
+ avatar?: {
150
+ previewImage?: string;
151
+ blurhash?: string;
152
+ small?: string;
153
+ };
154
+ replies?: {
155
+ count?: number;
156
+ edges?: Array<{
157
+ node?: {
158
+ txHash?: string;
159
+ comment?: string;
160
+ userAddress?: string;
161
+ timestamp?: number;
162
+ userProfile?: string;
163
+ /**
164
+ * The Globally Unique ID of this object
165
+ */
166
+ id?: string;
167
+ handle?: string;
168
+ avatar?: {
169
+ previewImage?: string;
170
+ blurhash?: string;
171
+ small?: string;
172
+ };
173
+ };
174
+ }>;
175
+ };
176
+ }>;
177
+ };
178
+ };
179
+ };
180
+ };
181
+
182
+ export type GetCoinCommentsResponse =
183
+ GetCoinCommentsResponses[keyof GetCoinCommentsResponses];
184
+
185
+ export type GetCoinsData = {
186
+ body?: never;
187
+ path?: never;
188
+ query: {
189
+ coins: Array<{
190
+ chainId?: number;
191
+ collectionAddress?: string;
192
+ }>;
193
+ };
194
+ url: "/coins";
195
+ };
196
+
197
+ export type GetCoinsResponses = {
198
+ /**
199
+ * response
200
+ */
201
+ 200: {
202
+ zora20Tokens?: Array<{
203
+ /**
204
+ * The Globally Unique ID of this object
205
+ */
206
+ id?: string;
207
+ name?: string;
208
+ description?: string;
209
+ address?: string;
210
+ symbol?: string;
211
+ totalSupply?: string;
212
+ totalVolume?: string;
213
+ volume24h?: string;
214
+ createdAt?: string;
215
+ creatorAddress?: string;
216
+ creatorEarnings?: Array<{
217
+ amount?: {
218
+ currency?: {
219
+ address?: string;
220
+ };
221
+ amountRaw?: string;
222
+ amountDecimal?: number;
223
+ };
224
+ amountUsd?: string;
225
+ }>;
226
+ marketCap?: string;
227
+ marketCapDelta24h?: string;
228
+ chainId?: number;
229
+ creatorProfile?: string;
230
+ handle?: string;
231
+ avatar?: {
232
+ previewImage?: string;
233
+ blurhash?: string;
234
+ small?: string;
235
+ };
236
+ media?: {
237
+ mimeType?: string;
238
+ originalUri?: string;
239
+ format?: string;
240
+ previewImage?: string;
241
+ medium?: string;
242
+ blurhash?: string;
243
+ };
244
+ transfers?: {
245
+ count?: number;
246
+ };
247
+ uniqueHolders?: number;
248
+ zoraComments?: {
249
+ /**
250
+ * Information to aid in pagination.
251
+ */
252
+ pageInfo?: {
253
+ /**
254
+ * When paginating forwards, the cursor to continue.
255
+ */
256
+ endCursor?: string;
257
+ /**
258
+ * When paginating forwards, are there more items?
259
+ */
260
+ hasNextPage?: boolean;
261
+ };
262
+ count?: number;
263
+ edges?: Array<{
264
+ node?: string;
265
+ txHash?: string;
266
+ comment?: string;
267
+ userAddress?: string;
268
+ timestamp?: number;
269
+ userProfile?: string;
270
+ /**
271
+ * The Globally Unique ID of this object
272
+ */
273
+ id?: string;
274
+ handle?: string;
275
+ avatar?: {
276
+ previewImage?: string;
277
+ blurhash?: string;
278
+ small?: string;
279
+ };
280
+ }>;
281
+ };
282
+ }>;
283
+ };
284
+ };
285
+
286
+ export type GetCoinsResponse = GetCoinsResponses[keyof GetCoinsResponses];
287
+
288
+ export type GetExploreData = {
289
+ body?: never;
290
+ path?: never;
291
+ query: {
292
+ listType:
293
+ | "TOP_GAINERS"
294
+ | "TOP_VOLUME_24H"
295
+ | "MOST_VALUABLE"
296
+ | "NEW"
297
+ | "LAST_TRADED"
298
+ | "LAST_TRADED_UNIQUE";
299
+ count?: number;
300
+ after?: string;
301
+ };
302
+ url: "/explore";
303
+ };
304
+
305
+ export type GetExploreResponses = {
306
+ /**
307
+ * response
308
+ */
309
+ 200: {
310
+ exploreList?: {
311
+ edges?: Array<{
312
+ node?: {
313
+ /**
314
+ * The Globally Unique ID of this object
315
+ */
316
+ id?: string;
317
+ name?: string;
318
+ description?: string;
319
+ address?: string;
320
+ symbol?: string;
321
+ totalSupply?: string;
322
+ totalVolume?: string;
323
+ volume24h?: string;
324
+ createdAt?: string;
325
+ creatorAddress?: string;
326
+ creatorEarnings?: Array<{
327
+ amount?: {
328
+ currency?: {
329
+ address?: string;
330
+ };
331
+ amountRaw?: string;
332
+ amountDecimal?: number;
333
+ };
334
+ amountUsd?: string;
335
+ }>;
336
+ marketCap?: string;
337
+ marketCapDelta24h?: string;
338
+ chainId?: number;
339
+ creatorProfile?: string;
340
+ handle?: string;
341
+ avatar?: {
342
+ previewImage?: string;
343
+ blurhash?: string;
344
+ small?: string;
345
+ };
346
+ media?: {
347
+ mimeType?: string;
348
+ originalUri?: string;
349
+ format?: string;
350
+ previewImage?: string;
351
+ medium?: string;
352
+ blurhash?: string;
353
+ };
354
+ transfers?: {
355
+ count?: number;
356
+ };
357
+ uniqueHolders?: number;
358
+ };
359
+ cursor?: string;
360
+ }>;
361
+ /**
362
+ * Information to aid in pagination.
363
+ */
364
+ pageInfo?: {
365
+ /**
366
+ * When paginating forwards, the cursor to continue.
367
+ */
368
+ endCursor?: string;
369
+ /**
370
+ * When paginating forwards, are there more items?
371
+ */
372
+ hasNextPage?: boolean;
373
+ };
374
+ };
375
+ };
376
+ };
377
+
378
+ export type GetExploreResponse = GetExploreResponses[keyof GetExploreResponses];
379
+
380
+ export type GetProfileData = {
381
+ body?: never;
382
+ path?: never;
383
+ query: {
384
+ identifier: string;
385
+ };
386
+ url: "/profile";
387
+ };
388
+
389
+ export type GetProfileResponses = {
390
+ /**
391
+ * response
392
+ */
393
+ 200: {
394
+ profile?: string;
395
+ /**
396
+ * The Globally Unique ID of this object
397
+ */
398
+ id?: string;
399
+ handle?: string;
400
+ avatar?: {
401
+ small?: string;
402
+ medium?: string;
403
+ blurhash?: string;
404
+ };
405
+ username?: string;
406
+ displayName?: string;
407
+ bio?: string;
408
+ website?: string;
409
+ publicWallet?: {
410
+ walletAddress?: string;
411
+ };
412
+ linkedWallets?: {
413
+ edges?: Array<{
414
+ node?: {
415
+ walletType?: "PRIVY" | "EXTERNAL" | "SMART_WALLET";
416
+ walletAddress?: string;
417
+ };
418
+ }>;
419
+ };
420
+ };
421
+ };
422
+
423
+ export type GetProfileResponse = GetProfileResponses[keyof GetProfileResponses];
424
+
425
+ export type GetProfileOwnedData = {
426
+ body?: never;
427
+ path?: never;
428
+ query: {
429
+ /**
430
+ * The identifier of the profile to get. This can be a username, handle, or address.
431
+ */
432
+ identifier: string;
433
+ /**
434
+ * The number of items to return.
435
+ */
436
+ count?: number;
437
+ /**
438
+ * The cursor to continue.
439
+ */
440
+ after?: string;
441
+ chainIds?: Array<number>;
442
+ };
443
+ url: "/profileOwned";
444
+ };
445
+
446
+ export type GetProfileOwnedResponses = {
447
+ /**
448
+ * response
449
+ */
450
+ 200: {
451
+ profile?: string;
452
+ /**
453
+ * The Globally Unique ID of this object
454
+ */
455
+ id?: string;
456
+ handle?: string;
457
+ avatar?: {
458
+ previewImage?: string;
459
+ blurhash?: string;
460
+ small?: string;
461
+ };
462
+ coinBalances?: {
463
+ count?: number;
464
+ edges?: Array<{
465
+ node?: {
466
+ balance?: string;
467
+ /**
468
+ * The Globally Unique ID of this object
469
+ */
470
+ id?: string;
471
+ coin?: {
472
+ /**
473
+ * The Globally Unique ID of this object
474
+ */
475
+ id?: string;
476
+ name?: string;
477
+ description?: string;
478
+ address?: string;
479
+ symbol?: string;
480
+ totalSupply?: string;
481
+ totalVolume?: string;
482
+ volume24h?: string;
483
+ createdAt?: string;
484
+ creatorAddress?: string;
485
+ creatorEarnings?: Array<{
486
+ amount?: {
487
+ currency?: {
488
+ address?: string;
489
+ };
490
+ amountRaw?: string;
491
+ amountDecimal?: number;
492
+ };
493
+ amountUsd?: string;
494
+ }>;
495
+ marketCap?: string;
496
+ marketCapDelta24h?: string;
497
+ chainId?: number;
498
+ creatorProfile?: string;
499
+ handle?: string;
500
+ avatar?: {
501
+ previewImage?: string;
502
+ blurhash?: string;
503
+ small?: string;
504
+ };
505
+ media?: {
506
+ mimeType?: string;
507
+ originalUri?: string;
508
+ format?: string;
509
+ previewImage?: string;
510
+ medium?: string;
511
+ blurhash?: string;
512
+ };
513
+ transfers?: {
514
+ count?: number;
515
+ };
516
+ uniqueHolders?: number;
517
+ zoraComments?: {
518
+ /**
519
+ * Information to aid in pagination.
520
+ */
521
+ pageInfo?: {
522
+ /**
523
+ * When paginating forwards, the cursor to continue.
524
+ */
525
+ endCursor?: string;
526
+ /**
527
+ * When paginating forwards, are there more items?
528
+ */
529
+ hasNextPage?: boolean;
530
+ };
531
+ count?: number;
532
+ edges?: Array<{
533
+ node?: string;
534
+ txHash?: string;
535
+ comment?: string;
536
+ userAddress?: string;
537
+ timestamp?: number;
538
+ userProfile?: string;
539
+ /**
540
+ * The Globally Unique ID of this object
541
+ */
542
+ id?: string;
543
+ handle?: string;
544
+ avatar?: {
545
+ previewImage?: string;
546
+ blurhash?: string;
547
+ small?: string;
548
+ };
549
+ }>;
550
+ };
551
+ };
552
+ };
553
+ }>;
554
+ /**
555
+ * Information to aid in pagination.
556
+ */
557
+ pageInfo?: {
558
+ /**
559
+ * When paginating forwards, are there more items?
560
+ */
561
+ hasNextPage?: boolean;
562
+ /**
563
+ * When paginating forwards, the cursor to continue.
564
+ */
565
+ endCursor?: string;
566
+ };
567
+ };
568
+ };
569
+ };
570
+
571
+ export type GetProfileOwnedResponse =
572
+ GetProfileOwnedResponses[keyof GetProfileOwnedResponses];
573
+
574
+ export type ClientOptions = {
575
+ baseUrl:
576
+ | "https://api-sdk.zora.engineering/"
577
+ | "https://api-sdk-staging.zora.engineering/"
578
+ | "http://localhost:8787/"
579
+ | (string & {});
580
+ };
package/src/index.ts CHANGED
@@ -1,5 +1,19 @@
1
-
2
- export { createCoin, createCoinCall, getCoinCreateFromLogs } from "./actions/createCoin";
3
- export { tradeCoin, tradeCoinCall, getTradeFromLogs } from "./actions/tradeCoin";
4
- export { getCoinDetails, type CoinDetails } from "./actions/getCoinDetails";
1
+ export {
2
+ createCoin,
3
+ createCoinCall,
4
+ getCoinCreateFromLogs,
5
+ } from "./actions/createCoin";
6
+ export {
7
+ tradeCoin,
8
+ tradeCoinCall,
9
+ getTradeFromLogs,
10
+ } from "./actions/tradeCoin";
11
+ export {
12
+ getOnchainCoinDetails,
13
+ type OnchainCoinDetails,
14
+ } from "./actions/getOnchainCoinDetails";
5
15
  export { updateCoinURI, updateCoinURICall } from "./actions/updateCoinURI";
16
+
17
+ // API Read Actions
18
+ export * from "./api/queries";
19
+ export * from "./api/explore";
@@ -0,0 +1,5 @@
1
+ import { PublicClient as VanillaPublicClient } from "viem";
2
+
3
+ // A bit messy for now but it works with peerdeps.
4
+ // TODO: Make this a more clear type.
5
+ export type GenericPublicClient = VanillaPublicClient<any, any, any, any>;
@@ -1,14 +1,18 @@
1
- import { PublicClient } from "viem"
2
- import { base, baseSepolia } from "viem/chains"
1
+ import { PublicClient } from "viem";
2
+ import { base, baseSepolia } from "viem/chains";
3
3
 
4
- export const validateClientNetwork = (publicClient: PublicClient) => {
5
- const clientChainId = publicClient?.chain?.id;
6
- if (clientChainId === base.id) {
7
- return;
8
- }
9
- if (clientChainId === baseSepolia.id) {
10
- return;
11
- }
4
+ export const validateClientNetwork = (
5
+ publicClient: PublicClient<any, any, any, any>,
6
+ ) => {
7
+ const clientChainId = publicClient?.chain?.id;
8
+ if (clientChainId === base.id) {
9
+ return;
10
+ }
11
+ if (clientChainId === baseSepolia.id) {
12
+ return;
13
+ }
12
14
 
13
- throw new Error('Client network needs to be base or baseSepolia for current coin deployments.');
14
- }
15
+ throw new Error(
16
+ "Client network needs to be base or baseSepolia for current coin deployments.",
17
+ );
18
+ };
@@ -1 +0,0 @@
1
- {"version":3,"file":"getCoinDetails.d.ts","sourceRoot":"","sources":["../../src/actions/getCoinDetails.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAyC,YAAY,EAAe,MAAM,MAAM,CAAC;AAGjG,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,EAAE,MAAM,CAAC;IACzB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,0BAA0B,EAAE,MAAM,CAAC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;CACpB,CAAA;AAED;;;;;;;;;;GAUG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC;IACzB,SAAS,EAAE,aAAa,CAAC;IACzB,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,WAAW,CAAC;IACvB,MAAM,EAAE,SAAS,OAAO,EAAE,CAAC;IAC3B,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAAC,EACnC,IAAI,EACJ,IAAkB,EAClB,YAAY,GACb,EAAE;IACD,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,EAAE,YAAY,CAAC;CAC5B,GAAG,OAAO,CAAC,WAAW,CAAC,CA+FvB"}