@zoralabs/coins-sdk 0.0.3 → 0.0.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.
@@ -6,6 +6,7 @@ import {
6
6
  GetCoinsData,
7
7
  GetCoinsResponse,
8
8
  GetProfileBalancesData,
9
+ GetProfileBalancesResponse,
9
10
  GetProfileData,
10
11
  GetProfileResponse,
11
12
  } from "../client/types.gen";
@@ -18,10 +19,9 @@ import {
18
19
  } from "../client/sdk.gen";
19
20
  import { getApiKeyMeta } from "./api-key";
20
21
  import { RequestOptionsType } from "./query-types";
22
+ import { RequestResult } from "@hey-api/client-fetch";
21
23
 
22
- type APIQueryDataResponse<T> = Promise<{ data?: T }>;
23
-
24
- export type { APIQueryDataResponse };
24
+ export type { RequestResult };
25
25
 
26
26
  type GetCoinQuery = GetCoinData["query"];
27
27
  export type { GetCoinQuery, GetCoinData };
@@ -32,7 +32,7 @@ export type CoinData = NonNullable<GetCoinResponse["zora20Token"]>;
32
32
  export const getCoin = async (
33
33
  query: GetCoinQuery,
34
34
  options?: RequestOptionsType<GetCoinData>,
35
- ): Promise<{ data?: GetCoinResponse }> => {
35
+ ): Promise<RequestResult<GetCoinResponse>> => {
36
36
  return await getCoinSDK({
37
37
  ...options,
38
38
  query,
@@ -40,23 +40,17 @@ export const getCoin = async (
40
40
  });
41
41
  };
42
42
 
43
- type GetCoinsQuery = {
44
- coinAddresses: string[];
45
- chainId?: number;
46
- };
43
+ type GetCoinsQuery = GetCoinsData["query"];
47
44
  export type { GetCoinsQuery, GetCoinsData };
48
45
  export type { GetCoinsResponse } from "../client/types.gen";
49
46
 
50
47
  export const getCoins = async (
51
- { coinAddresses, chainId }: GetCoinsQuery,
48
+ query: GetCoinsQuery,
52
49
  options?: RequestOptionsType<GetCoinsData>,
53
- ): APIQueryDataResponse<GetCoinsResponse> => {
50
+ ): Promise<RequestResult<GetCoinsResponse>> => {
54
51
  return await getCoinsSDK({
55
52
  query: {
56
- coins: coinAddresses.map((collectionAddress) => ({
57
- chainId,
58
- collectionAddress,
59
- })),
53
+ coins: query.coins.map((coinData) => JSON.stringify(coinData)) as any,
60
54
  },
61
55
  meta: getApiKeyMeta(),
62
56
  ...options,
@@ -70,7 +64,7 @@ export type { GetCoinCommentsResponse } from "../client/types.gen";
70
64
  export const getCoinComments = async (
71
65
  query: GetCoinCommentsQuery,
72
66
  options?: RequestOptionsType<GetCoinCommentsData>,
73
- ): APIQueryDataResponse<GetCoinCommentsResponse> => {
67
+ ): Promise<RequestResult<GetCoinCommentsResponse>> => {
74
68
  return await getCoinCommentsSDK({
75
69
  query,
76
70
  meta: getApiKeyMeta(),
@@ -85,7 +79,7 @@ export type { GetProfileResponse } from "../client/types.gen";
85
79
  export const getProfile = async (
86
80
  query: GetProfileQuery,
87
81
  options?: RequestOptionsType<GetProfileData>,
88
- ): APIQueryDataResponse<GetProfileResponse> => {
82
+ ): Promise<RequestResult<GetProfileResponse>> => {
89
83
  return await getProfileSDK({
90
84
  query,
91
85
  meta: getApiKeyMeta(),
@@ -98,9 +92,9 @@ export type { GetProfileBalancesQuery, GetProfileBalancesData };
98
92
  export type { GetProfileBalancesResponse } from "../client/types.gen";
99
93
 
100
94
  export const getProfileBalances = async (
101
- query: GetProfileBalancesData["query"],
95
+ query: GetProfileBalancesQuery,
102
96
  options?: RequestOptionsType<GetProfileBalancesData>,
103
- ) => {
97
+ ): Promise<RequestResult<GetProfileBalancesResponse>> => {
104
98
  return await getProfileBalancesSDK({
105
99
  query,
106
100
  meta: getApiKeyMeta(),
@@ -38,6 +38,9 @@ export type Options<
38
38
  meta?: Record<string, unknown>;
39
39
  };
40
40
 
41
+ /**
42
+ * zoraSDK_coin query
43
+ */
41
44
  export const getCoin = <ThrowOnError extends boolean = false>(
42
45
  options: Options<GetCoinData, ThrowOnError>,
43
46
  ) => {
@@ -51,6 +54,9 @@ export const getCoin = <ThrowOnError extends boolean = false>(
51
54
  });
52
55
  };
53
56
 
57
+ /**
58
+ * zoraSDK_coinComments query
59
+ */
54
60
  export const getCoinComments = <ThrowOnError extends boolean = false>(
55
61
  options: Options<GetCoinCommentsData, ThrowOnError>,
56
62
  ) => {
@@ -64,6 +70,9 @@ export const getCoinComments = <ThrowOnError extends boolean = false>(
64
70
  });
65
71
  };
66
72
 
73
+ /**
74
+ * zoraSDK_coins query
75
+ */
67
76
  export const getCoins = <ThrowOnError extends boolean = false>(
68
77
  options: Options<GetCoinsData, ThrowOnError>,
69
78
  ) => {
@@ -77,6 +86,9 @@ export const getCoins = <ThrowOnError extends boolean = false>(
77
86
  });
78
87
  };
79
88
 
89
+ /**
90
+ * zoraSDK_explore query
91
+ */
80
92
  export const getExplore = <ThrowOnError extends boolean = false>(
81
93
  options: Options<GetExploreData, ThrowOnError>,
82
94
  ) => {
@@ -90,6 +102,9 @@ export const getExplore = <ThrowOnError extends boolean = false>(
90
102
  });
91
103
  };
92
104
 
105
+ /**
106
+ * zoraSDK_profile query
107
+ */
93
108
  export const getProfile = <ThrowOnError extends boolean = false>(
94
109
  options: Options<GetProfileData, ThrowOnError>,
95
110
  ) => {
@@ -103,6 +118,9 @@ export const getProfile = <ThrowOnError extends boolean = false>(
103
118
  });
104
119
  };
105
120
 
121
+ /**
122
+ * zoraSDK_profileBalances query
123
+ */
106
124
  export const getProfileBalances = <ThrowOnError extends boolean = false>(
107
125
  options: Options<GetProfileBalancesData, ThrowOnError>,
108
126
  ) => {