@metamask/core-backend 5.0.0 → 5.1.0
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/CHANGELOG.md +25 -1
- package/README.md +252 -1
- package/dist/AccountActivityService.cjs +1 -1
- package/dist/AccountActivityService.cjs.map +1 -1
- package/dist/AccountActivityService.mjs +1 -1
- package/dist/AccountActivityService.mjs.map +1 -1
- package/dist/BackendWebSocketService.cjs +5 -3
- package/dist/BackendWebSocketService.cjs.map +1 -1
- package/dist/BackendWebSocketService.d.cts +2 -2
- package/dist/BackendWebSocketService.d.cts.map +1 -1
- package/dist/BackendWebSocketService.d.mts +2 -2
- package/dist/BackendWebSocketService.d.mts.map +1 -1
- package/dist/BackendWebSocketService.mjs +5 -3
- package/dist/BackendWebSocketService.mjs.map +1 -1
- package/dist/api/ApiPlatformClient.cjs +177 -0
- package/dist/api/ApiPlatformClient.cjs.map +1 -0
- package/dist/api/ApiPlatformClient.d.cts +127 -0
- package/dist/api/ApiPlatformClient.d.cts.map +1 -0
- package/dist/api/ApiPlatformClient.d.mts +127 -0
- package/dist/api/ApiPlatformClient.d.mts.map +1 -0
- package/dist/api/ApiPlatformClient.mjs +172 -0
- package/dist/api/ApiPlatformClient.mjs.map +1 -0
- package/dist/api/accounts/client.cjs +492 -0
- package/dist/api/accounts/client.cjs.map +1 -0
- package/dist/api/accounts/client.d.cts +213 -0
- package/dist/api/accounts/client.d.cts.map +1 -0
- package/dist/api/accounts/client.d.mts +213 -0
- package/dist/api/accounts/client.d.mts.map +1 -0
- package/dist/api/accounts/client.mjs +488 -0
- package/dist/api/accounts/client.mjs.map +1 -0
- package/dist/api/accounts/index.cjs +9 -0
- package/dist/api/accounts/index.cjs.map +1 -0
- package/dist/api/accounts/index.d.cts +6 -0
- package/dist/api/accounts/index.d.cts.map +1 -0
- package/dist/api/accounts/index.d.mts +6 -0
- package/dist/api/accounts/index.d.mts.map +1 -0
- package/dist/api/accounts/index.mjs +5 -0
- package/dist/api/accounts/index.mjs.map +1 -0
- package/dist/api/accounts/types.cjs +7 -0
- package/dist/api/accounts/types.cjs.map +1 -0
- package/dist/api/accounts/types.d.cts +195 -0
- package/dist/api/accounts/types.d.cts.map +1 -0
- package/dist/api/accounts/types.d.mts +195 -0
- package/dist/api/accounts/types.d.mts.map +1 -0
- package/dist/api/accounts/types.mjs +6 -0
- package/dist/api/accounts/types.mjs.map +1 -0
- package/dist/api/base-client.cjs +149 -0
- package/dist/api/base-client.cjs.map +1 -0
- package/dist/api/base-client.d.cts +54 -0
- package/dist/api/base-client.d.cts.map +1 -0
- package/dist/api/base-client.d.mts +54 -0
- package/dist/api/base-client.d.mts.map +1 -0
- package/dist/api/base-client.mjs +143 -0
- package/dist/api/base-client.mjs.map +1 -0
- package/dist/api/index.cjs +35 -0
- package/dist/api/index.cjs.map +1 -0
- package/dist/api/index.d.cts +18 -0
- package/dist/api/index.d.cts.map +1 -0
- package/dist/api/index.d.mts +18 -0
- package/dist/api/index.d.mts.map +1 -0
- package/dist/api/index.mjs +18 -0
- package/dist/api/index.mjs.map +1 -0
- package/dist/api/prices/client.cjs +521 -0
- package/dist/api/prices/client.cjs.map +1 -0
- package/dist/api/prices/client.d.cts +235 -0
- package/dist/api/prices/client.d.cts.map +1 -0
- package/dist/api/prices/client.d.mts +235 -0
- package/dist/api/prices/client.d.mts.map +1 -0
- package/dist/api/prices/client.mjs +517 -0
- package/dist/api/prices/client.mjs.map +1 -0
- package/dist/api/prices/index.cjs +9 -0
- package/dist/api/prices/index.cjs.map +1 -0
- package/dist/api/prices/index.d.cts +6 -0
- package/dist/api/prices/index.d.cts.map +1 -0
- package/dist/api/prices/index.d.mts +6 -0
- package/dist/api/prices/index.d.mts.map +1 -0
- package/dist/api/prices/index.mjs +5 -0
- package/dist/api/prices/index.mjs.map +1 -0
- package/dist/api/prices/types.cjs +7 -0
- package/dist/api/prices/types.cjs.map +1 -0
- package/dist/api/prices/types.d.cts +61 -0
- package/dist/api/prices/types.d.cts.map +1 -0
- package/dist/api/prices/types.d.mts +61 -0
- package/dist/api/prices/types.d.mts.map +1 -0
- package/dist/api/prices/types.mjs +6 -0
- package/dist/api/prices/types.mjs.map +1 -0
- package/dist/api/shared-types.cjs +93 -0
- package/dist/api/shared-types.cjs.map +1 -0
- package/dist/api/shared-types.d.cts +131 -0
- package/dist/api/shared-types.d.cts.map +1 -0
- package/dist/api/shared-types.d.mts +131 -0
- package/dist/api/shared-types.d.mts.map +1 -0
- package/dist/api/shared-types.mjs +87 -0
- package/dist/api/shared-types.mjs.map +1 -0
- package/dist/api/test-utils.cjs +70 -0
- package/dist/api/test-utils.cjs.map +1 -0
- package/dist/api/test-utils.d.cts +30 -0
- package/dist/api/test-utils.d.cts.map +1 -0
- package/dist/api/test-utils.d.mts +30 -0
- package/dist/api/test-utils.d.mts.map +1 -0
- package/dist/api/test-utils.mjs +64 -0
- package/dist/api/test-utils.mjs.map +1 -0
- package/dist/api/token/client.cjs +342 -0
- package/dist/api/token/client.cjs.map +1 -0
- package/dist/api/token/client.d.cts +193 -0
- package/dist/api/token/client.d.cts.map +1 -0
- package/dist/api/token/client.d.mts +193 -0
- package/dist/api/token/client.d.mts.map +1 -0
- package/dist/api/token/client.mjs +338 -0
- package/dist/api/token/client.mjs.map +1 -0
- package/dist/api/token/index.cjs +9 -0
- package/dist/api/token/index.cjs.map +1 -0
- package/dist/api/token/index.d.cts +6 -0
- package/dist/api/token/index.d.cts.map +1 -0
- package/dist/api/token/index.d.mts +6 -0
- package/dist/api/token/index.d.mts.map +1 -0
- package/dist/api/token/index.mjs +5 -0
- package/dist/api/token/index.mjs.map +1 -0
- package/dist/api/token/types.cjs +7 -0
- package/dist/api/token/types.cjs.map +1 -0
- package/dist/api/token/types.d.cts +75 -0
- package/dist/api/token/types.d.cts.map +1 -0
- package/dist/api/token/types.d.mts +75 -0
- package/dist/api/token/types.d.mts.map +1 -0
- package/dist/api/token/types.mjs +6 -0
- package/dist/api/token/types.mjs.map +1 -0
- package/dist/api/tokens/client.cjs +91 -0
- package/dist/api/tokens/client.cjs.map +1 -0
- package/dist/api/tokens/client.d.cts +45 -0
- package/dist/api/tokens/client.d.cts.map +1 -0
- package/dist/api/tokens/client.d.mts +45 -0
- package/dist/api/tokens/client.d.mts.map +1 -0
- package/dist/api/tokens/client.mjs +87 -0
- package/dist/api/tokens/client.mjs.map +1 -0
- package/dist/api/tokens/index.cjs +9 -0
- package/dist/api/tokens/index.cjs.map +1 -0
- package/dist/api/tokens/index.d.cts +6 -0
- package/dist/api/tokens/index.d.cts.map +1 -0
- package/dist/api/tokens/index.d.mts +6 -0
- package/dist/api/tokens/index.d.mts.map +1 -0
- package/dist/api/tokens/index.mjs +5 -0
- package/dist/api/tokens/index.mjs.map +1 -0
- package/dist/api/tokens/types.cjs +7 -0
- package/dist/api/tokens/types.cjs.map +1 -0
- package/dist/api/tokens/types.d.cts +83 -0
- package/dist/api/tokens/types.d.cts.map +1 -0
- package/dist/api/tokens/types.d.mts +83 -0
- package/dist/api/tokens/types.d.mts.map +1 -0
- package/dist/api/tokens/types.mjs +6 -0
- package/dist/api/tokens/types.mjs.map +1 -0
- package/dist/index.cjs +33 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -7
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +6 -7
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +21 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -11
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base API Client - Shared HTTP functionality for all API clients.
|
|
3
|
+
*/
|
|
4
|
+
import { QueryClient } from "@tanstack/query-core";
|
|
5
|
+
import { API_URLS, STALE_TIMES, GC_TIMES, HttpError } from "./shared-types.mjs";
|
|
6
|
+
import type { ApiPlatformClientOptions } from "./shared-types.mjs";
|
|
7
|
+
export declare const authQueryKeys: {
|
|
8
|
+
readonly bearerToken: () => readonly unknown[];
|
|
9
|
+
};
|
|
10
|
+
export type { ApiPlatformClientOptions };
|
|
11
|
+
/**
|
|
12
|
+
* Internal fetch options for HTTP requests.
|
|
13
|
+
*/
|
|
14
|
+
export type InternalFetchOptions = {
|
|
15
|
+
signal?: AbortSignal;
|
|
16
|
+
params?: Record<string, string | string[] | number | number[] | boolean | undefined>;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Base API Client with shared HTTP and caching functionality.
|
|
20
|
+
* Extended by all specific API clients.
|
|
21
|
+
*/
|
|
22
|
+
export declare class BaseApiClient {
|
|
23
|
+
#private;
|
|
24
|
+
protected readonly clientProduct: string;
|
|
25
|
+
protected readonly clientVersion: string;
|
|
26
|
+
protected readonly getBearerToken?: () => Promise<string | undefined>;
|
|
27
|
+
/**
|
|
28
|
+
* Get the underlying QueryClient instance.
|
|
29
|
+
* Exposed for cache management operations.
|
|
30
|
+
*
|
|
31
|
+
* @returns The QueryClient instance.
|
|
32
|
+
*/
|
|
33
|
+
get queryClient(): QueryClient;
|
|
34
|
+
/**
|
|
35
|
+
* Invalidate the cached auth token.
|
|
36
|
+
* Call this when the user logs out or the token expires.
|
|
37
|
+
*
|
|
38
|
+
* Uses resetQueries() instead of invalidateQueries() to completely remove
|
|
39
|
+
* the cached value, ensuring the next request fetches a fresh token immediately.
|
|
40
|
+
*/
|
|
41
|
+
invalidateAuthToken(): Promise<void>;
|
|
42
|
+
constructor(options: ApiPlatformClientOptions);
|
|
43
|
+
/**
|
|
44
|
+
* Internal HTTP fetch method with authentication and error handling.
|
|
45
|
+
*
|
|
46
|
+
* @param baseUrl - The base URL for the API.
|
|
47
|
+
* @param path - The API endpoint path.
|
|
48
|
+
* @param options - Optional fetch configuration.
|
|
49
|
+
* @returns The parsed JSON response.
|
|
50
|
+
*/
|
|
51
|
+
protected fetch<ResponseType>(baseUrl: string, path: string, options?: InternalFetchOptions): Promise<ResponseType>;
|
|
52
|
+
}
|
|
53
|
+
export { API_URLS, STALE_TIMES, GC_TIMES, HttpError };
|
|
54
|
+
//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C"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base API Client - Shared HTTP functionality for all API clients.
|
|
3
|
+
*/
|
|
4
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
5
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
6
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
7
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
8
|
+
};
|
|
9
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
10
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
11
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
12
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
13
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
14
|
+
};
|
|
15
|
+
var _BaseApiClient_queryClientInstance;
|
|
16
|
+
import { QueryClient } from "@tanstack/query-core";
|
|
17
|
+
import { API_URLS, STALE_TIMES, GC_TIMES, calculateRetryDelay, shouldRetry, HttpError } from "./shared-types.mjs";
|
|
18
|
+
// Auth query keys - shared for token management across clients
|
|
19
|
+
export const authQueryKeys = {
|
|
20
|
+
bearerToken: () => ['auth', 'bearerToken'],
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Base API Client with shared HTTP and caching functionality.
|
|
24
|
+
* Extended by all specific API clients.
|
|
25
|
+
*/
|
|
26
|
+
export class BaseApiClient {
|
|
27
|
+
/**
|
|
28
|
+
* Get the underlying QueryClient instance.
|
|
29
|
+
* Exposed for cache management operations.
|
|
30
|
+
*
|
|
31
|
+
* @returns The QueryClient instance.
|
|
32
|
+
*/
|
|
33
|
+
get queryClient() {
|
|
34
|
+
return __classPrivateFieldGet(this, _BaseApiClient_queryClientInstance, "f");
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Invalidate the cached auth token.
|
|
38
|
+
* Call this when the user logs out or the token expires.
|
|
39
|
+
*
|
|
40
|
+
* Uses resetQueries() instead of invalidateQueries() to completely remove
|
|
41
|
+
* the cached value, ensuring the next request fetches a fresh token immediately.
|
|
42
|
+
*/
|
|
43
|
+
async invalidateAuthToken() {
|
|
44
|
+
await __classPrivateFieldGet(this, _BaseApiClient_queryClientInstance, "f").resetQueries({
|
|
45
|
+
queryKey: authQueryKeys.bearerToken(),
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
constructor(options) {
|
|
49
|
+
_BaseApiClient_queryClientInstance.set(this, void 0);
|
|
50
|
+
this.clientProduct = options.clientProduct;
|
|
51
|
+
this.clientVersion = options.clientVersion ?? '1.0.0';
|
|
52
|
+
this.getBearerToken = options.getBearerToken;
|
|
53
|
+
__classPrivateFieldSet(this, _BaseApiClient_queryClientInstance, options.queryClient ??
|
|
54
|
+
new QueryClient({
|
|
55
|
+
defaultOptions: {
|
|
56
|
+
queries: {
|
|
57
|
+
staleTime: STALE_TIMES.DEFAULT,
|
|
58
|
+
gcTime: GC_TIMES.DEFAULT,
|
|
59
|
+
retry: shouldRetry,
|
|
60
|
+
retryDelay: calculateRetryDelay,
|
|
61
|
+
refetchOnWindowFocus: false,
|
|
62
|
+
networkMode: 'always',
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
}), "f");
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Internal HTTP fetch method with authentication and error handling.
|
|
69
|
+
*
|
|
70
|
+
* @param baseUrl - The base URL for the API.
|
|
71
|
+
* @param path - The API endpoint path.
|
|
72
|
+
* @param options - Optional fetch configuration.
|
|
73
|
+
* @returns The parsed JSON response.
|
|
74
|
+
*/
|
|
75
|
+
async fetch(baseUrl, path, options) {
|
|
76
|
+
const url = new URL(path, baseUrl);
|
|
77
|
+
if (options?.params) {
|
|
78
|
+
for (const [key, value] of Object.entries(options.params)) {
|
|
79
|
+
if (value === undefined) {
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
if (Array.isArray(value)) {
|
|
83
|
+
// Convert array values (including number[]) to comma-separated string
|
|
84
|
+
url.searchParams.set(key, value.map(String).join(','));
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
url.searchParams.set(key, String(value));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const headers = {
|
|
92
|
+
'Content-Type': 'application/json',
|
|
93
|
+
'X-Client-Product': this.clientProduct,
|
|
94
|
+
'X-Client-Version': this.clientVersion,
|
|
95
|
+
};
|
|
96
|
+
// Get bearer token using fetchQuery for automatic deduplication
|
|
97
|
+
if (this.getBearerToken) {
|
|
98
|
+
const queryKey = authQueryKeys.bearerToken();
|
|
99
|
+
const { getBearerToken } = this;
|
|
100
|
+
try {
|
|
101
|
+
// fetchQuery handles caching and deduplicates concurrent requests
|
|
102
|
+
const token = await __classPrivateFieldGet(this, _BaseApiClient_queryClientInstance, "f").fetchQuery({
|
|
103
|
+
queryKey,
|
|
104
|
+
queryFn: async () => {
|
|
105
|
+
const result = await getBearerToken();
|
|
106
|
+
// Throw if no token - prevents caching null/undefined
|
|
107
|
+
// so subsequent requests can retry (e.g., after user logs in)
|
|
108
|
+
if (!result) {
|
|
109
|
+
throw new Error('No bearer token available');
|
|
110
|
+
}
|
|
111
|
+
return result;
|
|
112
|
+
},
|
|
113
|
+
staleTime: STALE_TIMES.AUTH_TOKEN,
|
|
114
|
+
retry: false, // Don't retry auth failures
|
|
115
|
+
});
|
|
116
|
+
headers.Authorization = `Bearer ${token}`;
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
// No token available - continue without auth header
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
const response = await fetch(url.toString(), {
|
|
123
|
+
method: 'GET',
|
|
124
|
+
headers,
|
|
125
|
+
signal: options?.signal,
|
|
126
|
+
});
|
|
127
|
+
if (!response.ok) {
|
|
128
|
+
let body;
|
|
129
|
+
try {
|
|
130
|
+
body = await response.json();
|
|
131
|
+
}
|
|
132
|
+
catch {
|
|
133
|
+
// Response body is not JSON or is empty, leave body as undefined
|
|
134
|
+
}
|
|
135
|
+
throw new HttpError(`HTTP ${response.status}: ${response.statusText}`, response.status, response.statusText, url.toString(), body);
|
|
136
|
+
}
|
|
137
|
+
return response.json();
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
_BaseApiClient_queryClientInstance = new WeakMap();
|
|
141
|
+
// Re-export constants for use by API clients
|
|
142
|
+
export { API_URLS, STALE_TIMES, GC_TIMES, HttpError };
|
|
143
|
+
//# sourceMappingURL=base-client.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-client.mjs","sourceRoot":"","sources":["../../src/api/base-client.ts"],"names":[],"mappings":"AAAA;;GAEG;;;;;;;;;;;;;AAEH,OAAO,EAAE,WAAW,EAAE,6BAA6B;AAGnD,OAAO,EACL,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,mBAAmB,EACnB,WAAW,EACX,SAAS,EACV,2BAAuB;AAGxB,+DAA+D;AAC/D,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,WAAW,EAAE,GAAa,EAAE,CAAC,CAAC,MAAM,EAAE,aAAa,CAAC;CAC5C,CAAC;AAeX;;;GAGG;AACH,MAAM,OAAO,aAAa;IASxB;;;;;OAKG;IACH,IAAI,WAAW;QACb,OAAO,uBAAA,IAAI,0CAAqB,CAAC;IACnC,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,mBAAmB;QACvB,MAAM,uBAAA,IAAI,0CAAqB,CAAC,YAAY,CAAC;YAC3C,QAAQ,EAAE,aAAa,CAAC,WAAW,EAAE;SACtC,CAAC,CAAC;IACL,CAAC;IAED,YAAY,O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AC,IAAI,EAAE,CAAC;YAC/B,CAAC;YAAC,MAAM,CAAC;gBACP,iEAAiE;YACnE,CAAC;YACD,MAAM,IAAI,SAAS,CACjB,QAAQ,QAAQ,CAAC,MAAM,KAAK,QAAQ,CAAC,UAAU,EAAE,EACjD,QAAQ,CAAC,MAAM,EACf,QAAQ,CAAC,UAAU,EACnB,GAAG,CAAC,QAAQ,EAAE,EACd,IAAI,CACL,CAAC;QACJ,CAAC;QAED,OAAO,QAAQ,CAAC,IAAI,EAA2B,CAAC;IAClD,CAAC;CACF;;AAED,6CAA6C;AAC7C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC","sourcesContent":["/**\n * Base API Client - Shared HTTP functionality for all API clients.\n */\n\nimport { QueryClient } from '@tanstack/query-core';\nimport type { QueryKey } from '@tanstack/query-core';\n\nimport {\n API_URLS,\n STALE_TIMES,\n GC_TIMES,\n calculateRetryDelay,\n shouldRetry,\n HttpError,\n} from './shared-types';\nimport type { ApiPlatformClientOptions } from './shared-types';\n\n// Auth query keys - shared for token management across clients\nexport const authQueryKeys = {\n bearerToken: (): QueryKey => ['auth', 'bearerToken'],\n} as const;\n\nexport type { ApiPlatformClientOptions };\n\n/**\n * Internal fetch options for HTTP requests.\n */\nexport type InternalFetchOptions = {\n signal?: AbortSignal;\n params?: Record<\n string,\n string | string[] | number | number[] | boolean | undefined\n >;\n};\n\n/**\n * Base API Client with shared HTTP and caching functionality.\n * Extended by all specific API clients.\n */\nexport class BaseApiClient {\n protected readonly clientProduct: string;\n\n protected readonly clientVersion: string;\n\n protected readonly getBearerToken?: () => Promise<string | undefined>;\n\n readonly #queryClientInstance: QueryClient;\n\n /**\n * Get the underlying QueryClient instance.\n * Exposed for cache management operations.\n *\n * @returns The QueryClient instance.\n */\n get queryClient(): QueryClient {\n return this.#queryClientInstance;\n }\n\n /**\n * Invalidate the cached auth token.\n * Call this when the user logs out or the token expires.\n *\n * Uses resetQueries() instead of invalidateQueries() to completely remove\n * the cached value, ensuring the next request fetches a fresh token immediately.\n */\n async invalidateAuthToken(): Promise<void> {\n await this.#queryClientInstance.resetQueries({\n queryKey: authQueryKeys.bearerToken(),\n });\n }\n\n constructor(options: ApiPlatformClientOptions) {\n this.clientProduct = options.clientProduct;\n this.clientVersion = options.clientVersion ?? '1.0.0';\n this.getBearerToken = options.getBearerToken;\n\n this.#queryClientInstance =\n options.queryClient ??\n new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: STALE_TIMES.DEFAULT,\n gcTime: GC_TIMES.DEFAULT,\n retry: shouldRetry,\n retryDelay: calculateRetryDelay,\n refetchOnWindowFocus: false,\n networkMode: 'always',\n },\n },\n });\n }\n\n /**\n * Internal HTTP fetch method with authentication and error handling.\n *\n * @param baseUrl - The base URL for the API.\n * @param path - The API endpoint path.\n * @param options - Optional fetch configuration.\n * @returns The parsed JSON response.\n */\n protected async fetch<ResponseType>(\n baseUrl: string,\n path: string,\n options?: InternalFetchOptions,\n ): Promise<ResponseType> {\n const url = new URL(path, baseUrl);\n\n if (options?.params) {\n for (const [key, value] of Object.entries(options.params)) {\n if (value === undefined) {\n continue;\n }\n if (Array.isArray(value)) {\n // Convert array values (including number[]) to comma-separated string\n url.searchParams.set(key, value.map(String).join(','));\n } else {\n url.searchParams.set(key, String(value));\n }\n }\n }\n\n const headers: Record<string, string> = {\n 'Content-Type': 'application/json',\n 'X-Client-Product': this.clientProduct,\n 'X-Client-Version': this.clientVersion,\n };\n\n // Get bearer token using fetchQuery for automatic deduplication\n if (this.getBearerToken) {\n const queryKey = authQueryKeys.bearerToken();\n const { getBearerToken } = this;\n\n try {\n // fetchQuery handles caching and deduplicates concurrent requests\n const token = await this.#queryClientInstance.fetchQuery({\n queryKey,\n queryFn: async () => {\n const result = await getBearerToken();\n // Throw if no token - prevents caching null/undefined\n // so subsequent requests can retry (e.g., after user logs in)\n if (!result) {\n throw new Error('No bearer token available');\n }\n return result;\n },\n staleTime: STALE_TIMES.AUTH_TOKEN,\n retry: false, // Don't retry auth failures\n });\n\n headers.Authorization = `Bearer ${token}`;\n } catch {\n // No token available - continue without auth header\n }\n }\n\n const response = await fetch(url.toString(), {\n method: 'GET',\n headers,\n signal: options?.signal,\n });\n\n if (!response.ok) {\n let body: unknown;\n try {\n body = await response.json();\n } catch {\n // Response body is not JSON or is empty, leave body as undefined\n }\n throw new HttpError(\n `HTTP ${response.status}: ${response.statusText}`,\n response.status,\n response.statusText,\n url.toString(),\n body,\n );\n }\n\n return response.json() as Promise<ResponseType>;\n }\n}\n\n// Re-export constants for use by API clients\nexport { API_URLS, STALE_TIMES, GC_TIMES, HttpError };\n"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* API barrel export.
|
|
4
|
+
* Re-exports all types and clients from the API folder.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.createApiPlatformClient = exports.ApiPlatformClient = exports.BaseApiClient = exports.TokensApiClient = exports.TokenApiClient = exports.PricesApiClient = exports.AccountsApiClient = exports.HttpError = exports.shouldRetry = exports.calculateRetryDelay = exports.RETRY_CONFIG = exports.GC_TIMES = exports.STALE_TIMES = exports.API_URLS = void 0;
|
|
8
|
+
var shared_types_1 = require("./shared-types.cjs");
|
|
9
|
+
Object.defineProperty(exports, "API_URLS", { enumerable: true, get: function () { return shared_types_1.API_URLS; } });
|
|
10
|
+
Object.defineProperty(exports, "STALE_TIMES", { enumerable: true, get: function () { return shared_types_1.STALE_TIMES; } });
|
|
11
|
+
Object.defineProperty(exports, "GC_TIMES", { enumerable: true, get: function () { return shared_types_1.GC_TIMES; } });
|
|
12
|
+
Object.defineProperty(exports, "RETRY_CONFIG", { enumerable: true, get: function () { return shared_types_1.RETRY_CONFIG; } });
|
|
13
|
+
Object.defineProperty(exports, "calculateRetryDelay", { enumerable: true, get: function () { return shared_types_1.calculateRetryDelay; } });
|
|
14
|
+
Object.defineProperty(exports, "shouldRetry", { enumerable: true, get: function () { return shared_types_1.shouldRetry; } });
|
|
15
|
+
Object.defineProperty(exports, "HttpError", { enumerable: true, get: function () { return shared_types_1.HttpError; } });
|
|
16
|
+
// Accounts API
|
|
17
|
+
var accounts_1 = require("./accounts/index.cjs");
|
|
18
|
+
Object.defineProperty(exports, "AccountsApiClient", { enumerable: true, get: function () { return accounts_1.AccountsApiClient; } });
|
|
19
|
+
// Prices API
|
|
20
|
+
var prices_1 = require("./prices/index.cjs");
|
|
21
|
+
Object.defineProperty(exports, "PricesApiClient", { enumerable: true, get: function () { return prices_1.PricesApiClient; } });
|
|
22
|
+
// Token API
|
|
23
|
+
var token_1 = require("./token/index.cjs");
|
|
24
|
+
Object.defineProperty(exports, "TokenApiClient", { enumerable: true, get: function () { return token_1.TokenApiClient; } });
|
|
25
|
+
// Tokens API
|
|
26
|
+
var tokens_1 = require("./tokens/index.cjs");
|
|
27
|
+
Object.defineProperty(exports, "TokensApiClient", { enumerable: true, get: function () { return tokens_1.TokensApiClient; } });
|
|
28
|
+
// Base client
|
|
29
|
+
var base_client_1 = require("./base-client.cjs");
|
|
30
|
+
Object.defineProperty(exports, "BaseApiClient", { enumerable: true, get: function () { return base_client_1.BaseApiClient; } });
|
|
31
|
+
// API Platform Client (unified client)
|
|
32
|
+
var ApiPlatformClient_1 = require("./ApiPlatformClient.cjs");
|
|
33
|
+
Object.defineProperty(exports, "ApiPlatformClient", { enumerable: true, get: function () { return ApiPlatformClient_1.ApiPlatformClient; } });
|
|
34
|
+
Object.defineProperty(exports, "createApiPlatformClient", { enumerable: true, get: function () { return ApiPlatformClient_1.createApiPlatformClient; } });
|
|
35
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAUH,mDAQwB;AAPtB,wGAAA,QAAQ,OAAA;AACR,2GAAA,WAAW,OAAA;AACX,wGAAA,QAAQ,OAAA;AACR,4GAAA,YAAY,OAAA;AACZ,mHAAA,mBAAmB,OAAA;AACnB,2GAAA,WAAW,OAAA;AACX,yGAAA,SAAS,OAAA;AAGX,eAAe;AACf,iDAA+C;AAAtC,6GAAA,iBAAiB,OAAA;AAqB1B,aAAa;AACb,6CAA2C;AAAlC,yGAAA,eAAe,OAAA;AAWxB,YAAY;AACZ,2CAAyC;AAAhC,uGAAA,cAAc,OAAA;AAavB,aAAa;AACb,6CAA2C;AAAlC,yGAAA,eAAe,OAAA;AAOxB,cAAc;AACd,iDAA8C;AAArC,4GAAA,aAAa,OAAA;AAGtB,uCAAuC;AACvC,6DAG6B;AAF3B,sHAAA,iBAAiB,OAAA;AACjB,4HAAA,uBAAuB,OAAA","sourcesContent":["/**\n * API barrel export.\n * Re-exports all types and clients from the API folder.\n */\n\n// Shared types and utilities\nexport type {\n PageInfo,\n SupportedCurrency,\n MarketDataDetails,\n ApiPlatformClientOptions,\n FetchOptions,\n} from './shared-types';\nexport {\n API_URLS,\n STALE_TIMES,\n GC_TIMES,\n RETRY_CONFIG,\n calculateRetryDelay,\n shouldRetry,\n HttpError,\n} from './shared-types';\n\n// Accounts API\nexport { AccountsApiClient } from './accounts';\nexport type {\n V5BalanceItem,\n V5BalancesResponse,\n V2BalanceItem,\n V2BalancesResponse,\n V4BalancesResponse,\n V1SupportedNetworksResponse,\n V2SupportedNetworksResponse,\n V2ActiveNetworksResponse,\n V1TransactionByHashResponse,\n V1AccountTransactionsResponse,\n V4MultiAccountTransactionsResponse,\n ValueTransfer,\n V1AccountRelationshipResult,\n NftItem,\n V2NftsResponse,\n TokenDiscoveryItem,\n V2TokensResponse,\n} from './accounts';\n\n// Prices API\nexport { PricesApiClient } from './prices';\nexport type {\n V3SpotPricesResponse,\n CoinGeckoSpotPrice,\n ExchangeRateInfo,\n V1ExchangeRatesResponse,\n PriceSupportedNetworksResponse,\n V1HistoricalPricesResponse,\n V3HistoricalPricesResponse,\n} from './prices';\n\n// Token API\nexport { TokenApiClient } from './token';\nexport type {\n TokenMetadata,\n V1TokenDescriptionResponse,\n NetworkInfo,\n TopAsset,\n TrendingSortBy,\n TrendingToken,\n TopGainersSortOption,\n TrendingSortOption,\n V1SuggestedOccurrenceFloorsResponse,\n} from './token';\n\n// Tokens API\nexport { TokensApiClient } from './tokens';\nexport type {\n V1TokenSupportedNetworksResponse,\n V2TokenSupportedNetworksResponse,\n V3AssetResponse,\n} from './tokens';\n\n// Base client\nexport { BaseApiClient } from './base-client';\nexport type { InternalFetchOptions } from './base-client';\n\n// API Platform Client (unified client)\nexport {\n ApiPlatformClient,\n createApiPlatformClient,\n} from './ApiPlatformClient';\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API barrel export.
|
|
3
|
+
* Re-exports all types and clients from the API folder.
|
|
4
|
+
*/
|
|
5
|
+
export type { PageInfo, SupportedCurrency, MarketDataDetails, ApiPlatformClientOptions, FetchOptions, } from "./shared-types.cjs";
|
|
6
|
+
export { API_URLS, STALE_TIMES, GC_TIMES, RETRY_CONFIG, calculateRetryDelay, shouldRetry, HttpError, } from "./shared-types.cjs";
|
|
7
|
+
export { AccountsApiClient } from "./accounts/index.cjs";
|
|
8
|
+
export type { V5BalanceItem, V5BalancesResponse, V2BalanceItem, V2BalancesResponse, V4BalancesResponse, V1SupportedNetworksResponse, V2SupportedNetworksResponse, V2ActiveNetworksResponse, V1TransactionByHashResponse, V1AccountTransactionsResponse, V4MultiAccountTransactionsResponse, ValueTransfer, V1AccountRelationshipResult, NftItem, V2NftsResponse, TokenDiscoveryItem, V2TokensResponse, } from "./accounts/index.cjs";
|
|
9
|
+
export { PricesApiClient } from "./prices/index.cjs";
|
|
10
|
+
export type { V3SpotPricesResponse, CoinGeckoSpotPrice, ExchangeRateInfo, V1ExchangeRatesResponse, PriceSupportedNetworksResponse, V1HistoricalPricesResponse, V3HistoricalPricesResponse, } from "./prices/index.cjs";
|
|
11
|
+
export { TokenApiClient } from "./token/index.cjs";
|
|
12
|
+
export type { TokenMetadata, V1TokenDescriptionResponse, NetworkInfo, TopAsset, TrendingSortBy, TrendingToken, TopGainersSortOption, TrendingSortOption, V1SuggestedOccurrenceFloorsResponse, } from "./token/index.cjs";
|
|
13
|
+
export { TokensApiClient } from "./tokens/index.cjs";
|
|
14
|
+
export type { V1TokenSupportedNetworksResponse, V2TokenSupportedNetworksResponse, V3AssetResponse, } from "./tokens/index.cjs";
|
|
15
|
+
export { BaseApiClient } from "./base-client.cjs";
|
|
16
|
+
export type { InternalFetchOptions } from "./base-client.cjs";
|
|
17
|
+
export { ApiPlatformClient, createApiPlatformClient, } from "./ApiPlatformClient.cjs";
|
|
18
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,YAAY,EACV,QAAQ,EACR,iBAAiB,EACjB,iBAAiB,EACjB,wBAAwB,EACxB,YAAY,GACb,2BAAuB;AACxB,OAAO,EACL,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,mBAAmB,EACnB,WAAW,EACX,SAAS,GACV,2BAAuB;AAGxB,OAAO,EAAE,iBAAiB,EAAE,6BAAmB;AAC/C,YAAY,EACV,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,2BAA2B,EAC3B,2BAA2B,EAC3B,wBAAwB,EACxB,2BAA2B,EAC3B,6BAA6B,EAC7B,kCAAkC,EAClC,aAAa,EACb,2BAA2B,EAC3B,OAAO,EACP,cAAc,EACd,kBAAkB,EAClB,gBAAgB,GACjB,6BAAmB;AAGpB,OAAO,EAAE,eAAe,EAAE,2BAAiB;AAC3C,YAAY,EACV,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,EACvB,8BAA8B,EAC9B,0BAA0B,EAC1B,0BAA0B,GAC3B,2BAAiB;AAGlB,OAAO,EAAE,cAAc,EAAE,0BAAgB;AACzC,YAAY,EACV,aAAa,EACb,0BAA0B,EAC1B,WAAW,EACX,QAAQ,EACR,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,mCAAmC,GACpC,0BAAgB;AAGjB,OAAO,EAAE,eAAe,EAAE,2BAAiB;AAC3C,YAAY,EACV,gCAAgC,EAChC,gCAAgC,EAChC,eAAe,GAChB,2BAAiB;AAGlB,OAAO,EAAE,aAAa,EAAE,0BAAsB;AAC9C,YAAY,EAAE,oBAAoB,EAAE,0BAAsB;AAG1D,OAAO,EACL,iBAAiB,EACjB,uBAAuB,GACxB,gCAA4B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API barrel export.
|
|
3
|
+
* Re-exports all types and clients from the API folder.
|
|
4
|
+
*/
|
|
5
|
+
export type { PageInfo, SupportedCurrency, MarketDataDetails, ApiPlatformClientOptions, FetchOptions, } from "./shared-types.mjs";
|
|
6
|
+
export { API_URLS, STALE_TIMES, GC_TIMES, RETRY_CONFIG, calculateRetryDelay, shouldRetry, HttpError, } from "./shared-types.mjs";
|
|
7
|
+
export { AccountsApiClient } from "./accounts/index.mjs";
|
|
8
|
+
export type { V5BalanceItem, V5BalancesResponse, V2BalanceItem, V2BalancesResponse, V4BalancesResponse, V1SupportedNetworksResponse, V2SupportedNetworksResponse, V2ActiveNetworksResponse, V1TransactionByHashResponse, V1AccountTransactionsResponse, V4MultiAccountTransactionsResponse, ValueTransfer, V1AccountRelationshipResult, NftItem, V2NftsResponse, TokenDiscoveryItem, V2TokensResponse, } from "./accounts/index.mjs";
|
|
9
|
+
export { PricesApiClient } from "./prices/index.mjs";
|
|
10
|
+
export type { V3SpotPricesResponse, CoinGeckoSpotPrice, ExchangeRateInfo, V1ExchangeRatesResponse, PriceSupportedNetworksResponse, V1HistoricalPricesResponse, V3HistoricalPricesResponse, } from "./prices/index.mjs";
|
|
11
|
+
export { TokenApiClient } from "./token/index.mjs";
|
|
12
|
+
export type { TokenMetadata, V1TokenDescriptionResponse, NetworkInfo, TopAsset, TrendingSortBy, TrendingToken, TopGainersSortOption, TrendingSortOption, V1SuggestedOccurrenceFloorsResponse, } from "./token/index.mjs";
|
|
13
|
+
export { TokensApiClient } from "./tokens/index.mjs";
|
|
14
|
+
export type { V1TokenSupportedNetworksResponse, V2TokenSupportedNetworksResponse, V3AssetResponse, } from "./tokens/index.mjs";
|
|
15
|
+
export { BaseApiClient } from "./base-client.mjs";
|
|
16
|
+
export type { InternalFetchOptions } from "./base-client.mjs";
|
|
17
|
+
export { ApiPlatformClient, createApiPlatformClient, } from "./ApiPlatformClient.mjs";
|
|
18
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,YAAY,EACV,QAAQ,EACR,iBAAiB,EACjB,iBAAiB,EACjB,wBAAwB,EACxB,YAAY,GACb,2BAAuB;AACxB,OAAO,EACL,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,mBAAmB,EACnB,WAAW,EACX,SAAS,GACV,2BAAuB;AAGxB,OAAO,EAAE,iBAAiB,EAAE,6BAAmB;AAC/C,YAAY,EACV,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,2BAA2B,EAC3B,2BAA2B,EAC3B,wBAAwB,EACxB,2BAA2B,EAC3B,6BAA6B,EAC7B,kCAAkC,EAClC,aAAa,EACb,2BAA2B,EAC3B,OAAO,EACP,cAAc,EACd,kBAAkB,EAClB,gBAAgB,GACjB,6BAAmB;AAGpB,OAAO,EAAE,eAAe,EAAE,2BAAiB;AAC3C,YAAY,EACV,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,EACvB,8BAA8B,EAC9B,0BAA0B,EAC1B,0BAA0B,GAC3B,2BAAiB;AAGlB,OAAO,EAAE,cAAc,EAAE,0BAAgB;AACzC,YAAY,EACV,aAAa,EACb,0BAA0B,EAC1B,WAAW,EACX,QAAQ,EACR,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,mCAAmC,GACpC,0BAAgB;AAGjB,OAAO,EAAE,eAAe,EAAE,2BAAiB;AAC3C,YAAY,EACV,gCAAgC,EAChC,gCAAgC,EAChC,eAAe,GAChB,2BAAiB;AAGlB,OAAO,EAAE,aAAa,EAAE,0BAAsB;AAC9C,YAAY,EAAE,oBAAoB,EAAE,0BAAsB;AAG1D,OAAO,EACL,iBAAiB,EACjB,uBAAuB,GACxB,gCAA4B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API barrel export.
|
|
3
|
+
* Re-exports all types and clients from the API folder.
|
|
4
|
+
*/
|
|
5
|
+
export { API_URLS, STALE_TIMES, GC_TIMES, RETRY_CONFIG, calculateRetryDelay, shouldRetry, HttpError } from "./shared-types.mjs";
|
|
6
|
+
// Accounts API
|
|
7
|
+
export { AccountsApiClient } from "./accounts/index.mjs";
|
|
8
|
+
// Prices API
|
|
9
|
+
export { PricesApiClient } from "./prices/index.mjs";
|
|
10
|
+
// Token API
|
|
11
|
+
export { TokenApiClient } from "./token/index.mjs";
|
|
12
|
+
// Tokens API
|
|
13
|
+
export { TokensApiClient } from "./tokens/index.mjs";
|
|
14
|
+
// Base client
|
|
15
|
+
export { BaseApiClient } from "./base-client.mjs";
|
|
16
|
+
// API Platform Client (unified client)
|
|
17
|
+
export { ApiPlatformClient, createApiPlatformClient } from "./ApiPlatformClient.mjs";
|
|
18
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,OAAO,EACL,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,mBAAmB,EACnB,WAAW,EACX,SAAS,EACV,2BAAuB;AAExB,eAAe;AACf,OAAO,EAAE,iBAAiB,EAAE,6BAAmB;AAqB/C,aAAa;AACb,OAAO,EAAE,eAAe,EAAE,2BAAiB;AAW3C,YAAY;AACZ,OAAO,EAAE,cAAc,EAAE,0BAAgB;AAazC,aAAa;AACb,OAAO,EAAE,eAAe,EAAE,2BAAiB;AAO3C,cAAc;AACd,OAAO,EAAE,aAAa,EAAE,0BAAsB;AAG9C,uCAAuC;AACvC,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACxB,gCAA4B","sourcesContent":["/**\n * API barrel export.\n * Re-exports all types and clients from the API folder.\n */\n\n// Shared types and utilities\nexport type {\n PageInfo,\n SupportedCurrency,\n MarketDataDetails,\n ApiPlatformClientOptions,\n FetchOptions,\n} from './shared-types';\nexport {\n API_URLS,\n STALE_TIMES,\n GC_TIMES,\n RETRY_CONFIG,\n calculateRetryDelay,\n shouldRetry,\n HttpError,\n} from './shared-types';\n\n// Accounts API\nexport { AccountsApiClient } from './accounts';\nexport type {\n V5BalanceItem,\n V5BalancesResponse,\n V2BalanceItem,\n V2BalancesResponse,\n V4BalancesResponse,\n V1SupportedNetworksResponse,\n V2SupportedNetworksResponse,\n V2ActiveNetworksResponse,\n V1TransactionByHashResponse,\n V1AccountTransactionsResponse,\n V4MultiAccountTransactionsResponse,\n ValueTransfer,\n V1AccountRelationshipResult,\n NftItem,\n V2NftsResponse,\n TokenDiscoveryItem,\n V2TokensResponse,\n} from './accounts';\n\n// Prices API\nexport { PricesApiClient } from './prices';\nexport type {\n V3SpotPricesResponse,\n CoinGeckoSpotPrice,\n ExchangeRateInfo,\n V1ExchangeRatesResponse,\n PriceSupportedNetworksResponse,\n V1HistoricalPricesResponse,\n V3HistoricalPricesResponse,\n} from './prices';\n\n// Token API\nexport { TokenApiClient } from './token';\nexport type {\n TokenMetadata,\n V1TokenDescriptionResponse,\n NetworkInfo,\n TopAsset,\n TrendingSortBy,\n TrendingToken,\n TopGainersSortOption,\n TrendingSortOption,\n V1SuggestedOccurrenceFloorsResponse,\n} from './token';\n\n// Tokens API\nexport { TokensApiClient } from './tokens';\nexport type {\n V1TokenSupportedNetworksResponse,\n V2TokenSupportedNetworksResponse,\n V3AssetResponse,\n} from './tokens';\n\n// Base client\nexport { BaseApiClient } from './base-client';\nexport type { InternalFetchOptions } from './base-client';\n\n// API Platform Client (unified client)\nexport {\n ApiPlatformClient,\n createApiPlatformClient,\n} from './ApiPlatformClient';\n"]}
|