@coinlist-co/react 0.10.1 → 0.11.1-rc.10770e8
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 +32 -0
- package/dist/chunk-7CTH4KPU.js +2399 -0
- package/dist/chunk-7CTH4KPU.js.map +1 -0
- package/dist/{chunk-AQVCOWOV.js → chunk-LSPZETDH.js} +249 -317
- package/dist/chunk-LSPZETDH.js.map +1 -0
- package/dist/chunk-UZUQALFY.js +279 -0
- package/dist/chunk-UZUQALFY.js.map +1 -0
- package/dist/client/index.cjs +13430 -3308
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +5486 -899
- package/dist/client/index.d.ts +5486 -899
- package/dist/client/index.js +11025 -2388
- package/dist/client/index.js.map +1 -1
- package/dist/collections-BBI_XydI.d.cts +116 -0
- package/dist/collections-BrX9rRWc.d.ts +116 -0
- package/dist/config-CMl1bR3F.d.cts +2959 -0
- package/dist/config-CMl1bR3F.d.ts +2959 -0
- package/dist/server/index.cjs +1768 -511
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +266 -162
- package/dist/server/index.d.ts +266 -162
- package/dist/server/index.js +235 -169
- package/dist/server/index.js.map +1 -1
- package/dist/shared/index.cjs +2423 -926
- package/dist/shared/index.cjs.map +1 -1
- package/dist/shared/index.d.cts +325 -132
- package/dist/shared/index.d.ts +325 -132
- package/dist/shared/index.js +112 -28
- package/package.json +12 -8
- package/dist/chunk-AQVCOWOV.js.map +0 -1
- package/dist/chunk-TBU3EBNM.js +0 -442
- package/dist/chunk-TBU3EBNM.js.map +0 -1
- package/dist/chunk-UOHD7US2.js +0 -855
- package/dist/chunk-UOHD7US2.js.map +0 -1
- package/dist/collections-Bv1Oxzu_.d.ts +0 -28
- package/dist/collections-DDyxbOPZ.d.cts +0 -28
- package/dist/requirement-oVZA1INj.d.cts +0 -1040
- package/dist/requirement-oVZA1INj.d.ts +0 -1040
package/dist/server/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as AuthorizationCode, C as CodeVerifier, ak as OAuthSession, v as OAuthAccessToken, al as ClientCredentialsOAuth, u as Config, am as ClientSecret, an as Sender, L as Logger, w as OffersNamespace, F as Offer, ao as PaginationParams, ap as PaginatedResponse, O as OfferId, z as OfferDetail, R as RequirementsNamespace, d as OfferOptionId, s as Requirement, t as RequirementsNamespaceImpl, S as SharedNamespaceContext, o as WalletsNamespace, E as Erc20Namespace, c as CoinListTokenSaleNamespace, n as SuperstateSwapNamespace, g as OndoNamespace, T as TokensNamespace, U as PinoLoggerOptions } from '../config-CMl1bR3F.js';
|
|
2
2
|
import 'viem';
|
|
3
3
|
|
|
4
4
|
interface SessionStore {
|
|
@@ -18,67 +18,51 @@ interface SessionStore {
|
|
|
18
18
|
* invalidated refresh token. Simply **omit** `setSession` to prevent any
|
|
19
19
|
* refresh from being attempted.
|
|
20
20
|
*
|
|
21
|
-
* {@link
|
|
22
|
-
* always require a writable store and
|
|
23
|
-
* {@link WritableSessionStoreRequiredError} if `setSession` is absent.
|
|
21
|
+
* {@link ServerAuthNamespace.completeOAuth} and
|
|
22
|
+
* {@link ServerAuthNamespace.logout} always require a writable store and
|
|
23
|
+
* throw {@link WritableSessionStoreRequiredError} if `setSession` is absent.
|
|
24
24
|
*/
|
|
25
25
|
setSession?(session: OAuthSession | null): Promise<void>;
|
|
26
26
|
}
|
|
27
|
-
interface ServerConfig extends Config {
|
|
28
|
-
readonly clientSecret: ClientSecret;
|
|
29
|
-
readonly sessionStore: SessionStore;
|
|
30
|
-
/** Buffer in seconds before expiry to consider token expired for refresh. */
|
|
31
|
-
readonly accessTokenExpiryBufferSeconds?: number;
|
|
32
|
-
/**
|
|
33
|
-
* Whether SDK will throw an exception in cases it can be silent.
|
|
34
|
-
* For example, if token revokation on logout fails.
|
|
35
|
-
*/
|
|
36
|
-
readonly strict?: boolean;
|
|
37
|
-
}
|
|
38
27
|
/**
|
|
39
|
-
*
|
|
28
|
+
* The empty session store: holds no session, reads nothing, never writes.
|
|
40
29
|
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
30
|
+
* For server contexts that act without a user — the client-credentials grant
|
|
31
|
+
* (`auth.clientCredentials`) and the public token registry (`tokens`) read
|
|
32
|
+
* nothing from the store, so hosts building those paths need no store of
|
|
33
|
+
* their own.
|
|
43
34
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
35
|
+
* `setSession` is deliberately absent, not a no-op — see
|
|
36
|
+
* {@link SessionStore.setSession} for why a no-op is a bug.
|
|
37
|
+
*/
|
|
38
|
+
declare function emptySessionStore(): SessionStore;
|
|
39
|
+
/** The PKCE pair `CoinListClient#auth.completeOAuth` hands to the backend. */
|
|
40
|
+
interface CompleteOAuthParams {
|
|
41
|
+
/** The short-lived authorization code parsed out of the redirect URL. */
|
|
42
|
+
code: AuthorizationCode;
|
|
43
|
+
/** The `code_verifier` the browser generated when starting the flow. */
|
|
44
|
+
codeVerifier: CodeVerifier;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* OAuth session lifecycle on your backend: exchanging authorization codes,
|
|
48
|
+
* keeping the access token fresh, minting app-level tokens, and logging out.
|
|
46
49
|
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* {@link completeOAuth} and {@link logout} throw
|
|
50
|
-
* {@link WritableSessionStoreRequiredError}. {@link accessToken} may return
|
|
51
|
-
* an expired token (see its docs). Use this mode in execution contexts that
|
|
52
|
-
* can read the session but cannot write it back, such as Next.js Server
|
|
53
|
-
* Components.
|
|
50
|
+
* This namespace is server-only: every method needs the `clientSecret` and the
|
|
51
|
+
* {@link SessionStore}, neither of which may exist in a browser.
|
|
54
52
|
*/
|
|
55
|
-
interface
|
|
53
|
+
interface ServerAuthNamespace {
|
|
56
54
|
/**
|
|
57
|
-
* Exchanges an authorization code
|
|
58
|
-
* {@link SessionStore.setSession}.
|
|
55
|
+
* Exchanges an authorization code from `CoinListClient#auth.completeOAuth`
|
|
56
|
+
* for an OAuth session and persists it via {@link SessionStore.setSession}.
|
|
59
57
|
*
|
|
60
58
|
* Throws {@link WritableSessionStoreRequiredError} if the session store does
|
|
61
59
|
* not provide `setSession`.
|
|
62
60
|
*/
|
|
63
|
-
completeOAuth(
|
|
64
|
-
/**
|
|
65
|
-
* Obtains an app-level access token via the OAuth 2.0 `client_credentials`
|
|
66
|
-
* grant (RFC 6749 §4.4). No user is involved: the token authenticates the
|
|
67
|
-
* partner application itself and only grants access to app-level resources
|
|
68
|
-
* such as offers and offer requirements.
|
|
69
|
-
*
|
|
70
|
-
* The token is **not** persisted to the {@link SessionStore} and has no
|
|
71
|
-
* refresh token. It expires at `expiresAt`; once expired, call this method
|
|
72
|
-
* again to obtain a fresh token — the SDK does not renew it automatically.
|
|
73
|
-
*
|
|
74
|
-
* Pass the result to {@link fetchOffers}, {@link fetchOffersPage},
|
|
75
|
-
* {@link fetchOfferDetails}, or {@link fetchOfferRequirements} to call them
|
|
76
|
-
* without a user session.
|
|
77
|
-
*/
|
|
78
|
-
clientCredentialsOAuth(): Promise<ClientCredentialsOAuth>;
|
|
61
|
+
completeOAuth(params: CompleteOAuthParams): Promise<OAuthSession>;
|
|
79
62
|
/**
|
|
80
|
-
* Returns a valid access token for the current session, refreshing it if
|
|
81
|
-
*
|
|
63
|
+
* Returns a valid access token for the current session, refreshing it if it
|
|
64
|
+
* is expired or near expiry. This is what you serve to
|
|
65
|
+
* {@link ClientConfig.getAccessToken}.
|
|
82
66
|
*
|
|
83
67
|
* **Writable store**: if the token is expired, the SDK exchanges the refresh
|
|
84
68
|
* token for a new session, persists it, and returns the fresh access token.
|
|
@@ -94,157 +78,277 @@ interface CoinListServer {
|
|
|
94
78
|
* @returns the access token, or `null` if there is no session or the session
|
|
95
79
|
* could not be refreshed.
|
|
96
80
|
*/
|
|
97
|
-
|
|
81
|
+
getAccessToken(): Promise<OAuthAccessToken | null>;
|
|
98
82
|
/**
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*/
|
|
104
|
-
logout(): Promise<void>;
|
|
105
|
-
/**
|
|
106
|
-
* Fetches all offers by iterating through every paginated response.
|
|
107
|
-
*
|
|
108
|
-
* @param clientCreds optional app-level token from
|
|
109
|
-
* {@link clientCredentialsOAuth}. When provided, no user session is
|
|
110
|
-
* required; if a user session exists it takes precedence and `clientCreds`
|
|
111
|
-
* is used as a fallback.
|
|
112
|
-
*
|
|
113
|
-
* Throws {@link NotAuthenticatedError} if there is neither a user session
|
|
114
|
-
* nor `clientCreds`.
|
|
115
|
-
*/
|
|
116
|
-
fetchOffers(clientCreds?: ClientCredentialsOAuth): Promise<Offer[]>;
|
|
117
|
-
/**
|
|
118
|
-
* Fetches a single page of offers.
|
|
119
|
-
*
|
|
120
|
-
* @param clientCreds optional app-level token from
|
|
121
|
-
* {@link clientCredentialsOAuth}. When provided, no user session is
|
|
122
|
-
* required; if a user session exists it takes precedence and `clientCreds`
|
|
123
|
-
* is used as a fallback.
|
|
124
|
-
*
|
|
125
|
-
* Throws {@link NotAuthenticatedError} if there is neither a user session
|
|
126
|
-
* nor `clientCreds`.
|
|
127
|
-
*/
|
|
128
|
-
fetchOffersPage(params: PaginationParams, clientCreds?: ClientCredentialsOAuth): Promise<PaginatedResponse<Offer>>;
|
|
129
|
-
/**
|
|
130
|
-
* Fetches details for a given offer by its id.
|
|
83
|
+
* Obtains an app-level access token via the OAuth 2.0 `client_credentials`
|
|
84
|
+
* grant (RFC 6749 §4.4). No user is involved: the token authenticates the
|
|
85
|
+
* partner application itself and only grants access to app-level resources
|
|
86
|
+
* such as offers and offer requirements.
|
|
131
87
|
*
|
|
132
|
-
* @
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
* is used as a fallback.
|
|
88
|
+
* The token is **not** persisted to the {@link SessionStore} and has no
|
|
89
|
+
* refresh token. It expires at `expiresAt`; once expired, call this method
|
|
90
|
+
* again to obtain a fresh token — the SDK does not renew it automatically.
|
|
136
91
|
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
92
|
+
* Pass the result to `ServerOffersNamespace` or
|
|
93
|
+
* `ServerRequirementsNamespace.forOffer` to read without a user session.
|
|
139
94
|
*/
|
|
140
|
-
|
|
95
|
+
clientCredentials(): Promise<ClientCredentialsOAuth>;
|
|
141
96
|
/**
|
|
142
|
-
*
|
|
143
|
-
* chain. The user signs the returned {@link WalletOwnershipChallenge.message}
|
|
144
|
-
* with their wallet, then passes the signature to
|
|
145
|
-
* {@link connectExternalWallet}.
|
|
97
|
+
* Revokes the current token via `POST /oauth/revoke` and clears the session.
|
|
146
98
|
*
|
|
147
|
-
* Throws {@link
|
|
99
|
+
* Throws {@link WritableSessionStoreRequiredError} if the session store does
|
|
100
|
+
* not provide `setSession`.
|
|
148
101
|
*/
|
|
149
|
-
|
|
102
|
+
logout(): Promise<void>;
|
|
103
|
+
}
|
|
104
|
+
/** What {@link ServerAuthNamespaceImpl} needs out of `ServerConfig`. */
|
|
105
|
+
type ServerAuthConfig = Config & {
|
|
106
|
+
readonly clientSecret: ClientSecret;
|
|
107
|
+
readonly sessionStore: SessionStore;
|
|
108
|
+
/** Seconds before expiry at which a token counts as expired for refresh. */
|
|
109
|
+
readonly accessTokenExpiryBufferSeconds: number;
|
|
110
|
+
/** Whether to rethrow errors the SDK could otherwise swallow (e.g. revoke). */
|
|
111
|
+
readonly strict: boolean;
|
|
112
|
+
};
|
|
113
|
+
declare class ServerAuthNamespaceImpl implements ServerAuthNamespace {
|
|
114
|
+
private readonly api;
|
|
115
|
+
private readonly config;
|
|
116
|
+
private readonly log;
|
|
117
|
+
constructor(api: Sender, config: ServerAuthConfig);
|
|
118
|
+
completeOAuth(params: CompleteOAuthParams): Promise<OAuthSession>;
|
|
119
|
+
getAccessToken(): Promise<OAuthAccessToken | null>;
|
|
120
|
+
private readAccessToken;
|
|
121
|
+
private refreshSession;
|
|
122
|
+
clientCredentials(): Promise<ClientCredentialsOAuth>;
|
|
123
|
+
logout(): Promise<void>;
|
|
124
|
+
private revokeAndClear;
|
|
150
125
|
/**
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
* Throws {@link NotAuthenticatedError} if the user is not authenticated.
|
|
126
|
+
* Returns the store's `setSession`, or throws — the guard every
|
|
127
|
+
* session-writing operation shares.
|
|
155
128
|
*/
|
|
156
|
-
|
|
129
|
+
private writableSessionStore;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* What the server-only namespaces need, on top of what
|
|
134
|
+
* {@link SharedNamespaceContext} provides: authentication that a caller can
|
|
135
|
+
* satisfy with an app-level token instead of a user session.
|
|
136
|
+
*/
|
|
137
|
+
interface ServerNamespaceContext {
|
|
138
|
+
readonly api: Sender;
|
|
139
|
+
/** As {@link SharedNamespaceContext.logger}: the raw port, scoped per namespace. */
|
|
140
|
+
readonly logger: Logger | null;
|
|
157
141
|
/**
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
142
|
+
* Requires a user session, unless `clientCreds` is supplied — an app-level
|
|
143
|
+
* token authenticates the request on its own. Throws
|
|
144
|
+
* {@link NotAuthenticatedError} when neither is present.
|
|
161
145
|
*/
|
|
162
|
-
|
|
146
|
+
ensureAuthenticated(clientCreds?: ClientCredentialsOAuth): Promise<void>;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* The server-side offers namespace: the same reads as the shared
|
|
151
|
+
* {@link OffersNamespace}, each additionally callable with an app-level token
|
|
152
|
+
* from `ServerAuthNamespace.clientCredentials` instead of a user session.
|
|
153
|
+
*
|
|
154
|
+
* When a user session exists it takes precedence and `clientCreds` acts as a
|
|
155
|
+
* fallback. Without either, the reads throw {@link NotAuthenticatedError}.
|
|
156
|
+
*/
|
|
157
|
+
interface ServerOffersNamespace extends OffersNamespace {
|
|
158
|
+
/** @param clientCreds app-level token to read without a user session. */
|
|
159
|
+
list(clientCreds?: ClientCredentialsOAuth): Promise<Offer[]>;
|
|
160
|
+
/** @param clientCreds app-level token to read without a user session. */
|
|
161
|
+
listPage(params: PaginationParams, clientCreds?: ClientCredentialsOAuth): Promise<PaginatedResponse<Offer>>;
|
|
162
|
+
/** @param clientCreds app-level token to read without a user session. */
|
|
163
|
+
get(id: OfferId, clientCreds?: ClientCredentialsOAuth): Promise<OfferDetail>;
|
|
164
|
+
}
|
|
165
|
+
declare class ServerOffersNamespaceImpl implements ServerOffersNamespace {
|
|
166
|
+
private readonly ctx;
|
|
167
|
+
private readonly log;
|
|
168
|
+
constructor(ctx: ServerNamespaceContext);
|
|
169
|
+
list(clientCreds?: ClientCredentialsOAuth): Promise<Offer[]>;
|
|
170
|
+
listPage(params: PaginationParams, clientCreds?: ClientCredentialsOAuth): Promise<PaginatedResponse<Offer>>;
|
|
171
|
+
get(id: OfferId, clientCreds?: ClientCredentialsOAuth): Promise<OfferDetail>;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* The server-side requirements namespace: the same surface as the shared
|
|
176
|
+
* {@link RequirementsNamespace}, except {@link forOffer} — the offer's
|
|
177
|
+
* requirement definitions are app-level data, so it is additionally callable
|
|
178
|
+
* with a token from `ServerAuthNamespace.clientCredentials`.
|
|
179
|
+
*
|
|
180
|
+
* Everything else is per-user data and needs a user session. `handle` is
|
|
181
|
+
* client-only: there is no browser tab to open on a server.
|
|
182
|
+
*/
|
|
183
|
+
interface ServerRequirementsNamespace extends RequirementsNamespace {
|
|
184
|
+
/** @param clientCreds app-level token to read without a user session. */
|
|
185
|
+
forOffer(offerId: OfferId, clientCreds?: ClientCredentialsOAuth): Promise<Record<OfferOptionId, Requirement[]>>;
|
|
186
|
+
}
|
|
187
|
+
declare class ServerRequirementsNamespaceImpl extends RequirementsNamespaceImpl implements ServerRequirementsNamespace {
|
|
188
|
+
private readonly serverCtx;
|
|
189
|
+
constructor(serverCtx: SharedNamespaceContext & ServerNamespaceContext);
|
|
190
|
+
forOffer(offerId: OfferId, clientCreds?: ClientCredentialsOAuth): Promise<Record<OfferOptionId, Requirement[]>>;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
interface ServerConfig extends Config {
|
|
194
|
+
readonly clientSecret: ClientSecret;
|
|
195
|
+
readonly sessionStore: SessionStore;
|
|
196
|
+
/** Buffer in seconds before expiry to consider token expired for refresh. */
|
|
197
|
+
readonly accessTokenExpiryBufferSeconds?: number;
|
|
163
198
|
/**
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
* Throws {@link NotAuthenticatedError} if the user is not authenticated.
|
|
199
|
+
* Whether SDK will throw an exception in cases it can be silent.
|
|
200
|
+
* For example, if token revokation on logout fails.
|
|
167
201
|
*/
|
|
168
|
-
|
|
202
|
+
readonly strict?: boolean;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Server-side CoinList SDK client.
|
|
206
|
+
*
|
|
207
|
+
* Functionality is grouped into namespaces — `coinlist.auth.getAccessToken()`,
|
|
208
|
+
* `coinlist.offers.list()`, `coinlist.requirements.statuses(offerId)`.
|
|
209
|
+
*
|
|
210
|
+
* Operates in one of two modes depending on whether {@link SessionStore}
|
|
211
|
+
* includes a `setSession` implementation:
|
|
212
|
+
*
|
|
213
|
+
* - **Writable store** (`setSession` provided) — full functionality: token
|
|
214
|
+
* refresh, `auth.completeOAuth`, and `auth.logout` all work normally.
|
|
215
|
+
*
|
|
216
|
+
* - **Read-only store** (no `setSession`) — token refresh is skipped entirely,
|
|
217
|
+
* meaning no network call is made and no refresh token is consumed.
|
|
218
|
+
* `auth.completeOAuth` and `auth.logout` throw
|
|
219
|
+
* {@link WritableSessionStoreRequiredError}. `auth.getAccessToken` may
|
|
220
|
+
* return an expired token (see its docs). Use this mode in execution
|
|
221
|
+
* contexts that can read the session but cannot write it back, such as
|
|
222
|
+
* Next.js Server Components.
|
|
223
|
+
*
|
|
224
|
+
* Unless a namespace says otherwise, its methods require a user session and
|
|
225
|
+
* throw {@link NotAuthenticatedError} when there is none.
|
|
226
|
+
*/
|
|
227
|
+
interface CoinListServer {
|
|
169
228
|
/**
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
* {@link clientCredentialsOAuth}. When provided, no user session is
|
|
174
|
-
* required; if a user session exists it takes precedence and `clientCreds`
|
|
175
|
-
* is used as a fallback.
|
|
176
|
-
*
|
|
177
|
-
* Throws {@link NotAuthenticatedError} if there is neither a user session
|
|
178
|
-
* nor `clientCreds`.
|
|
229
|
+
* OAuth session lifecycle: exchanging an authorization code, serving a valid
|
|
230
|
+
* access token to the browser, minting app-level tokens, and logging out —
|
|
231
|
+
* e.g. `coinlist.auth.getAccessToken()`.
|
|
179
232
|
*/
|
|
180
|
-
|
|
233
|
+
readonly auth: ServerAuthNamespace;
|
|
181
234
|
/**
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
*
|
|
235
|
+
* The offer catalogue — e.g. `coinlist.offers.list()`. Every read also
|
|
236
|
+
* accepts an app-level token from {@link ServerAuthNamespace.clientCredentials}
|
|
237
|
+
* so it can run without a user session.
|
|
185
238
|
*/
|
|
186
|
-
|
|
239
|
+
readonly offers: ServerOffersNamespace;
|
|
187
240
|
/**
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
* W-8BEN. Fields the entity hasn't provided are `null`.
|
|
192
|
-
*
|
|
193
|
-
* Throws {@link NotAuthenticatedError} if the user is not authenticated.
|
|
241
|
+
* Offer requirements and the operations that satisfy them — e.g.
|
|
242
|
+
* `coinlist.requirements.statuses(offerId)`. `forOffer` also accepts an
|
|
243
|
+
* app-level token; the rest is per-user data and needs a user session.
|
|
194
244
|
*/
|
|
195
|
-
|
|
245
|
+
readonly requirements: ServerRequirementsNamespace;
|
|
196
246
|
/**
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
* signing-form values keyed by the document's DocuSeal field names,
|
|
200
|
-
* forwarded verbatim to Passport to pre-fill the document.
|
|
201
|
-
*
|
|
202
|
-
* Throws {@link NotAuthenticatedError} if the user is not authenticated.
|
|
247
|
+
* The user's external wallets: ownership proofs and offer-option bindings —
|
|
248
|
+
* e.g. `coinlist.wallets.list({ offerId, offerOptionId })`.
|
|
203
249
|
*/
|
|
204
|
-
|
|
250
|
+
readonly wallets: WalletsNamespace;
|
|
205
251
|
/**
|
|
206
252
|
* Generic ERC-20 reads (token allowance and balance) — e.g.
|
|
207
|
-
* `coinlist.erc20.
|
|
208
|
-
*
|
|
209
|
-
* These methods require a user session and throw
|
|
210
|
-
* {@link NotAuthenticatedError} if the user is not authenticated.
|
|
253
|
+
* `coinlist.erc20.getBalance({ ... })`.
|
|
211
254
|
*/
|
|
212
|
-
readonly erc20:
|
|
255
|
+
readonly erc20: Erc20Namespace;
|
|
213
256
|
/**
|
|
214
257
|
* Token-sale operations: listing, reading, and recording participations —
|
|
215
|
-
* e.g. `coinlist.tokenSale.
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
* These methods require a user session and throw
|
|
219
|
-
* {@link NotAuthenticatedError} if the user is not authenticated.
|
|
258
|
+
* e.g. `coinlist.tokenSale.list()`. The on-chain `execute`
|
|
259
|
+
* flow is client-only and is not exposed here.
|
|
220
260
|
*/
|
|
221
261
|
readonly tokenSale: CoinListTokenSaleNamespace;
|
|
222
262
|
/**
|
|
223
263
|
* On-chain swap operations: quoting a swap, reading swap-contract state, and
|
|
224
|
-
*
|
|
225
|
-
* `coinlist.
|
|
264
|
+
* allow-listing a proven wallet — e.g.
|
|
265
|
+
* `coinlist.superstate.getOutputToken({ contractAddress, chain })`.
|
|
266
|
+
*/
|
|
267
|
+
readonly superstate: SuperstateSwapNamespace;
|
|
268
|
+
/**
|
|
269
|
+
* Ondo swap reads: trading status and quoting. Both are free to poll.
|
|
270
|
+
*
|
|
271
|
+
* No CoinList fee is applied to a quote; see {@link OndoNamespace}.
|
|
226
272
|
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
*/
|
|
230
|
-
readonly
|
|
231
|
-
/**
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
* `
|
|
236
|
-
*
|
|
237
|
-
* an already-approved level can be executed again (e.g. to update stale
|
|
238
|
-
* PII).
|
|
273
|
+
* This is Ondo's whole surface for now — the wallet-driven half arrives with
|
|
274
|
+
* ENG-1680 and will be client-only, since it needs a wallet to sign with.
|
|
275
|
+
*/
|
|
276
|
+
readonly ondo: OndoNamespace;
|
|
277
|
+
/**
|
|
278
|
+
* Token display metadata (name, symbol, decimals, logos) from CoinList's
|
|
279
|
+
* public token registry, keyed by chain + contract address — e.g.
|
|
280
|
+
* `coinlist.tokens.get({ chain, address })` for an entry of
|
|
281
|
+
* `Offer.tokens`, or `coinlist.tokens.list()` for the whole
|
|
282
|
+
* catalogue in one request.
|
|
239
283
|
*
|
|
240
|
-
*
|
|
284
|
+
* Public and unauthenticated: unlike the other namespaces, its methods never
|
|
285
|
+
* require a session, so it also works with a read-only store.
|
|
241
286
|
*/
|
|
242
|
-
|
|
287
|
+
readonly tokens: TokensNamespace;
|
|
243
288
|
}
|
|
244
289
|
declare function createCoinListServer(config: ServerConfig): CoinListServer;
|
|
245
290
|
|
|
291
|
+
/**
|
|
292
|
+
* A {@link Logger} that writes newline-delimited JSON to stdout through pino.
|
|
293
|
+
*
|
|
294
|
+
* ```ts
|
|
295
|
+
* createCoinListServer({
|
|
296
|
+
* ...config,
|
|
297
|
+
* logger: pinoServerLogger({ isDev: false, level: 'info' }),
|
|
298
|
+
* });
|
|
299
|
+
* ```
|
|
300
|
+
*
|
|
301
|
+
* The Node counterpart of {@link pinoClientLogger}, for a route handler, a BFF
|
|
302
|
+
* or SSR. One line per record, which is what every log aggregator ingests
|
|
303
|
+
* without configuration.
|
|
304
|
+
*
|
|
305
|
+
* ## What it deliberately does not do
|
|
306
|
+
*
|
|
307
|
+
* **No transport, and no `pino-pretty`.** A pino transport runs on a worker
|
|
308
|
+
* thread through `thread-stream`, which every bundler has to be told about
|
|
309
|
+
* (`serverExternalPackages` in Next) and which edge runtimes cannot run at
|
|
310
|
+
* all. Pretty-printing is a pipe the host owns rather than a dependency the
|
|
311
|
+
* SDK takes on their behalf:
|
|
312
|
+
*
|
|
313
|
+
* ```sh
|
|
314
|
+
* node server.js | npx pino-pretty
|
|
315
|
+
* ```
|
|
316
|
+
*
|
|
317
|
+
* **No environment-dependent formatting.** `isDev` decides which levels are
|
|
318
|
+
* legal and nothing else, so a development record and a production record are
|
|
319
|
+
* the same shape - what you debug is what you ship.
|
|
320
|
+
*
|
|
321
|
+
* If you already run pino, or want transports, redaction or `destination`,
|
|
322
|
+
* implement {@link Logger} yourself: it is four methods over an event, and
|
|
323
|
+
* `@opentelemetry/instrumentation-pino` patches the pino module rather than an
|
|
324
|
+
* instance, so trace correlation reaches this logger either way.
|
|
325
|
+
*
|
|
326
|
+
* ## Production
|
|
327
|
+
*
|
|
328
|
+
* **Not advised in production**, the same as everywhere else this seam is
|
|
329
|
+
* documented: the SDK's default answer is to leave {@link Config.logger}
|
|
330
|
+
* undefined outside development, staging and incident reproduction. A backend
|
|
331
|
+
* is the least bad place to disregard that - the records go to your process
|
|
332
|
+
* and your sink rather than to a page the end user can read - but it is still
|
|
333
|
+
* a disregard, and the retention and access questions become yours.
|
|
334
|
+
*
|
|
335
|
+
* If you run one, `isDev: false` restricts you to `'error'`, `'warn'` and
|
|
336
|
+
* `'info'` - `{ isDev: false, level: 'debug' }` does not compile, see
|
|
337
|
+
* {@link PinoLoggerOptions}. Those levels are redacted by construction, which
|
|
338
|
+
* is a mechanism the SDK holds itself to; whether that clears your bar is a
|
|
339
|
+
* judgement the SDK is not in a position to make for you.
|
|
340
|
+
*
|
|
341
|
+
* Holds no module-level state: every call builds its own pino instance, and
|
|
342
|
+
* the level is fixed at construction, so two loggers never interfere. Fixed is
|
|
343
|
+
* this implementation's choice, not the seam's - the SDK re-reads
|
|
344
|
+
* {@link Logger.level} before every log call - so if you want a level you can
|
|
345
|
+
* change at runtime, implement {@link Logger} over your own pino instance
|
|
346
|
+
* rather than calling this.
|
|
347
|
+
*/
|
|
348
|
+
declare function pinoServerLogger(options: PinoLoggerOptions): Logger;
|
|
349
|
+
|
|
246
350
|
declare class WritableSessionStoreRequiredError extends Error {
|
|
247
351
|
constructor(message?: string);
|
|
248
352
|
}
|
|
249
353
|
|
|
250
|
-
export { type CoinListServer, type ServerConfig, type SessionStore, WritableSessionStoreRequiredError, createCoinListServer };
|
|
354
|
+
export { type CoinListServer, type CompleteOAuthParams, type ServerAuthConfig, type ServerAuthNamespace, ServerAuthNamespaceImpl, type ServerConfig, type ServerNamespaceContext, type ServerOffersNamespace, ServerOffersNamespaceImpl, type ServerRequirementsNamespace, ServerRequirementsNamespaceImpl, type SessionStore, WritableSessionStoreRequiredError, createCoinListServer, emptySessionStore, pinoServerLogger };
|