@calm-xyz/core 0.9.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/dist/index.d.ts +3159 -0
- package/dist/index.js +1198 -0
- package/package.json +30 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1198 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed error every operation throws on a non-2xx response; carries `code`
|
|
3
|
+
* and `status`.
|
|
4
|
+
*
|
|
5
|
+
* @see https://docs.calmtreasury.xyz/sdk/errors
|
|
6
|
+
*/
|
|
7
|
+
var ApiError = class extends Error {
|
|
8
|
+
code;
|
|
9
|
+
status;
|
|
10
|
+
constructor(args) {
|
|
11
|
+
super(args.message);
|
|
12
|
+
this.name = "ApiError";
|
|
13
|
+
this.code = args.code;
|
|
14
|
+
this.status = args.status;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
let baseConfig = {};
|
|
18
|
+
function getConfig() {
|
|
19
|
+
return baseConfig;
|
|
20
|
+
}
|
|
21
|
+
function setConfig(config) {
|
|
22
|
+
baseConfig = config;
|
|
23
|
+
return baseConfig;
|
|
24
|
+
}
|
|
25
|
+
async function request(paramsConfig) {
|
|
26
|
+
const config = {
|
|
27
|
+
...baseConfig,
|
|
28
|
+
...paramsConfig
|
|
29
|
+
};
|
|
30
|
+
const searchParams = new URLSearchParams();
|
|
31
|
+
for (const [key, value] of Object.entries(config.params ?? {})) if (value != null) searchParams.append(key, String(value));
|
|
32
|
+
let targetUrl = [config.apiUrl, config.url].filter(Boolean).join("");
|
|
33
|
+
if (config.params) targetUrl += `?${searchParams}`;
|
|
34
|
+
const hasBody = config.data !== void 0;
|
|
35
|
+
const response = await fetch(targetUrl, {
|
|
36
|
+
credentials: config.credentials ?? "include",
|
|
37
|
+
method: config.method,
|
|
38
|
+
body: hasBody ? JSON.stringify(config.data) : void 0,
|
|
39
|
+
signal: config.signal,
|
|
40
|
+
headers: hasBody ? {
|
|
41
|
+
"Content-Type": "application/json",
|
|
42
|
+
...normalizeHeaders(config.headers)
|
|
43
|
+
} : normalizeHeaders(config.headers)
|
|
44
|
+
});
|
|
45
|
+
const data = response.status === 204 ? void 0 : await response.json();
|
|
46
|
+
if (!response.ok) {
|
|
47
|
+
const envelope = data;
|
|
48
|
+
throw new ApiError({
|
|
49
|
+
message: envelope?.error?.message ?? "API error",
|
|
50
|
+
code: envelope?.error?.code,
|
|
51
|
+
status: response.status
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
data,
|
|
56
|
+
status: response.status,
|
|
57
|
+
statusText: response.statusText,
|
|
58
|
+
headers: response.headers
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function normalizeHeaders(headers) {
|
|
62
|
+
if (!headers) return void 0;
|
|
63
|
+
return Array.isArray(headers) ? Object.fromEntries(headers) : headers;
|
|
64
|
+
}
|
|
65
|
+
const client = request;
|
|
66
|
+
/**
|
|
67
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
68
|
+
* Do not edit manually.
|
|
69
|
+
*/
|
|
70
|
+
function getCheckoutStripeSessionUrl(address, sessionId) {
|
|
71
|
+
return {
|
|
72
|
+
method: "POST",
|
|
73
|
+
url: `/v1/wallets/${address}/stripe/session/${sessionId}/checkout`
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* @description Checks out a session and returns its `client_secret`. Driven by the client SDK's `performCheckout` callback — never called standalone; the SDK handles required next actions (3DS) between calls.
|
|
78
|
+
* @summary Check out a Stripe onramp session
|
|
79
|
+
* {@link /v1/wallets/:address/stripe/session/:sessionId/checkout}
|
|
80
|
+
*/
|
|
81
|
+
async function checkoutStripeSession(address, sessionId, config = {}) {
|
|
82
|
+
const { client: request = client, ...requestConfig } = config;
|
|
83
|
+
return (await request({
|
|
84
|
+
method: "POST",
|
|
85
|
+
url: getCheckoutStripeSessionUrl(address, sessionId).url.toString(),
|
|
86
|
+
...requestConfig
|
|
87
|
+
})).data;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
91
|
+
* Do not edit manually.
|
|
92
|
+
*/
|
|
93
|
+
function getClearSessionUrl() {
|
|
94
|
+
return {
|
|
95
|
+
method: "POST",
|
|
96
|
+
url: `/v1/session/clear`
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* @description Ends the session: clears both cookies and invalidates the refresh credential. No auth required; idempotent.
|
|
101
|
+
* @summary Clear a session
|
|
102
|
+
* {@link /v1/session/clear}
|
|
103
|
+
*/
|
|
104
|
+
async function clearSession(config = {}) {
|
|
105
|
+
const { client: request = client, ...requestConfig } = config;
|
|
106
|
+
return (await request({
|
|
107
|
+
method: "POST",
|
|
108
|
+
url: getClearSessionUrl().url.toString(),
|
|
109
|
+
...requestConfig
|
|
110
|
+
})).data;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
114
|
+
* Do not edit manually.
|
|
115
|
+
*/
|
|
116
|
+
function getConnectExchangeUrl(address, exchange) {
|
|
117
|
+
return {
|
|
118
|
+
method: "POST",
|
|
119
|
+
url: `/v1/wallets/${address}/exchange/${exchange}`
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* @description Starts an exchange connection and returns the URL the user authorizes at. On success, the connection turns live and can be read via `GET .../exchange/:exchange`.
|
|
124
|
+
* @summary Connect an exchange
|
|
125
|
+
* {@link /v1/wallets/:address/exchange/:exchange}
|
|
126
|
+
*/
|
|
127
|
+
async function connectExchange(address, exchange, config = {}) {
|
|
128
|
+
const { client: request = client, ...requestConfig } = config;
|
|
129
|
+
return (await request({
|
|
130
|
+
method: "POST",
|
|
131
|
+
url: getConnectExchangeUrl(address, exchange).url.toString(),
|
|
132
|
+
...requestConfig
|
|
133
|
+
})).data;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
137
|
+
* Do not edit manually.
|
|
138
|
+
*/
|
|
139
|
+
function getCreateCardLinkUrl(address) {
|
|
140
|
+
return {
|
|
141
|
+
method: "POST",
|
|
142
|
+
url: `/v1/wallets/${address}/card`
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* @description Returns the hosted card-onramp URL for the wallet. The card provider authenticates the cardholder and settles USDC to the wallet.
|
|
147
|
+
* @summary Get the card-onramp link
|
|
148
|
+
* {@link /v1/wallets/:address/card}
|
|
149
|
+
*/
|
|
150
|
+
async function createCardLink(address, data, config = {}) {
|
|
151
|
+
const { client: request = client, ...requestConfig } = config;
|
|
152
|
+
const requestData = data;
|
|
153
|
+
return (await request({
|
|
154
|
+
method: "POST",
|
|
155
|
+
url: getCreateCardLinkUrl(address).url.toString(),
|
|
156
|
+
data: requestData,
|
|
157
|
+
...requestConfig
|
|
158
|
+
})).data;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
162
|
+
* Do not edit manually.
|
|
163
|
+
*/
|
|
164
|
+
function getCreateCashAppOrderUrl(address) {
|
|
165
|
+
return {
|
|
166
|
+
method: "POST",
|
|
167
|
+
url: `/v1/wallets/${address}/cashapp`
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* @description Opens a Cash App onramp order and returns it, including the Cash App payment link. Poll `GET .../cashapp/:id` for status.
|
|
172
|
+
* @summary Create a Cash App order
|
|
173
|
+
* {@link /v1/wallets/:address/cashapp}
|
|
174
|
+
*/
|
|
175
|
+
async function createCashAppOrder(address, data, config = {}) {
|
|
176
|
+
const { client: request = client, ...requestConfig } = config;
|
|
177
|
+
const requestData = data;
|
|
178
|
+
return (await request({
|
|
179
|
+
method: "POST",
|
|
180
|
+
url: getCreateCashAppOrderUrl(address).url.toString(),
|
|
181
|
+
data: requestData,
|
|
182
|
+
...requestConfig
|
|
183
|
+
})).data;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
187
|
+
* Do not edit manually.
|
|
188
|
+
*/
|
|
189
|
+
function getCreateCashAppQuoteUrl(address) {
|
|
190
|
+
return {
|
|
191
|
+
method: "POST",
|
|
192
|
+
url: `/v1/wallets/${address}/cashapp/quote`
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* @description Returns a pricing preview for a Cash App order — the destination amount, the fee, and the fee in basis points.
|
|
197
|
+
* @summary Quote a Cash App order
|
|
198
|
+
* {@link /v1/wallets/:address/cashapp/quote}
|
|
199
|
+
*/
|
|
200
|
+
async function createCashAppQuote(address, data, config = {}) {
|
|
201
|
+
const { client: request = client, ...requestConfig } = config;
|
|
202
|
+
const requestData = data;
|
|
203
|
+
return (await request({
|
|
204
|
+
method: "POST",
|
|
205
|
+
url: getCreateCashAppQuoteUrl(address).url.toString(),
|
|
206
|
+
data: requestData,
|
|
207
|
+
...requestConfig
|
|
208
|
+
})).data;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
212
|
+
* Do not edit manually.
|
|
213
|
+
*/
|
|
214
|
+
function getCreateDepositAddressUrl(address) {
|
|
215
|
+
return {
|
|
216
|
+
method: "POST",
|
|
217
|
+
url: `/v1/wallets/${address}/deposit-address`
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* @description Returns an intake address for a `(source chain, source token) → destination` route. Funding it delivers USDC to the destination; the same route reuses one address.
|
|
222
|
+
* @summary Create a crypto deposit address
|
|
223
|
+
* {@link /v1/wallets/:address/deposit-address}
|
|
224
|
+
*/
|
|
225
|
+
async function createDepositAddress(address, data, config = {}) {
|
|
226
|
+
const { client: request = client, ...requestConfig } = config;
|
|
227
|
+
const requestData = data;
|
|
228
|
+
return (await request({
|
|
229
|
+
method: "POST",
|
|
230
|
+
url: getCreateDepositAddressUrl(address).url.toString(),
|
|
231
|
+
data: requestData,
|
|
232
|
+
...requestConfig
|
|
233
|
+
})).data;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
237
|
+
* Do not edit manually.
|
|
238
|
+
*/
|
|
239
|
+
function getCreateExchangeWithdrawQuoteUrl(address, exchange) {
|
|
240
|
+
return {
|
|
241
|
+
method: "POST",
|
|
242
|
+
url: `/v1/wallets/${address}/exchange/${exchange}/withdraw/quote`
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* @description Quotes a USDC withdrawal from the connected exchange to a deposit address that settles to the chosen destination. The returned `id` is the handle the withdraw call executes.
|
|
247
|
+
* @summary Quote an exchange withdrawal
|
|
248
|
+
* {@link /v1/wallets/:address/exchange/:exchange/withdraw/quote}
|
|
249
|
+
*/
|
|
250
|
+
async function createExchangeWithdrawQuote(address, exchange, data, config = {}) {
|
|
251
|
+
const { client: request = client, ...requestConfig } = config;
|
|
252
|
+
const requestData = data;
|
|
253
|
+
return (await request({
|
|
254
|
+
method: "POST",
|
|
255
|
+
url: getCreateExchangeWithdrawQuoteUrl(address, exchange).url.toString(),
|
|
256
|
+
data: requestData,
|
|
257
|
+
...requestConfig
|
|
258
|
+
})).data;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
262
|
+
* Do not edit manually.
|
|
263
|
+
*/
|
|
264
|
+
function getCreateSessionDynamicUrl(address) {
|
|
265
|
+
return {
|
|
266
|
+
method: "POST",
|
|
267
|
+
url: `/v1/session/${address}/dynamic`
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* @description Verifies a Dynamic identity-token bearer, checks the wallet is linked to the user, resolves the tenant from the publishable key, and mints the session cookie pair. Requires an `Authorization: Bearer <token>` header.
|
|
272
|
+
* @summary Create a session (Dynamic)
|
|
273
|
+
* {@link /v1/session/:address/dynamic}
|
|
274
|
+
*/
|
|
275
|
+
async function createSessionDynamic(address, config = {}) {
|
|
276
|
+
const { client: request = client, ...requestConfig } = config;
|
|
277
|
+
return (await request({
|
|
278
|
+
method: "POST",
|
|
279
|
+
url: getCreateSessionDynamicUrl(address).url.toString(),
|
|
280
|
+
...requestConfig
|
|
281
|
+
})).data;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
285
|
+
* Do not edit manually.
|
|
286
|
+
*/
|
|
287
|
+
function getCreateSessionPrivyUrl(address) {
|
|
288
|
+
return {
|
|
289
|
+
method: "POST",
|
|
290
|
+
url: `/v1/session/${address}/privy`
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* @description Verifies a Privy identity-token bearer, checks the wallet is linked to the user, resolves the tenant from the publishable key, and mints the session cookie pair. Requires an `Authorization: Bearer <token>` header.
|
|
295
|
+
* @summary Create a session (Privy)
|
|
296
|
+
* {@link /v1/session/:address/privy}
|
|
297
|
+
*/
|
|
298
|
+
async function createSessionPrivy(address, config = {}) {
|
|
299
|
+
const { client: request = client, ...requestConfig } = config;
|
|
300
|
+
return (await request({
|
|
301
|
+
method: "POST",
|
|
302
|
+
url: getCreateSessionPrivyUrl(address).url.toString(),
|
|
303
|
+
...requestConfig
|
|
304
|
+
})).data;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
308
|
+
* Do not edit manually.
|
|
309
|
+
*/
|
|
310
|
+
function getCreateSessionSiweUrl(address) {
|
|
311
|
+
return {
|
|
312
|
+
method: "POST",
|
|
313
|
+
url: `/v1/session/${address}/siwe`
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* @description Verifies a signed EIP-4361 message and its nonce binding, then mints the session cookie pair. The publishable key rides inside the signed message's `Resources` field, so the wallet attests it.
|
|
318
|
+
* @summary Create a session (SIWE)
|
|
319
|
+
* {@link /v1/session/:address/siwe}
|
|
320
|
+
*/
|
|
321
|
+
async function createSessionSiwe(address, data, config = {}) {
|
|
322
|
+
const { client: request = client, ...requestConfig } = config;
|
|
323
|
+
const requestData = data;
|
|
324
|
+
return (await request({
|
|
325
|
+
method: "POST",
|
|
326
|
+
url: getCreateSessionSiweUrl(address).url.toString(),
|
|
327
|
+
data: requestData,
|
|
328
|
+
...requestConfig
|
|
329
|
+
})).data;
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
333
|
+
* Do not edit manually.
|
|
334
|
+
*/
|
|
335
|
+
function getCreateSiweNonceUrl(address) {
|
|
336
|
+
return {
|
|
337
|
+
method: "POST",
|
|
338
|
+
url: `/v1/session/${address}/siwe/nonce`
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* @description Returns a nonce to embed in an EIP-4361 message and a short-lived binding to echo back on the SIWE create. Each call issues a fresh nonce; the binding expires after a few minutes.
|
|
343
|
+
* @summary Issue a SIWE nonce binding
|
|
344
|
+
* {@link /v1/session/:address/siwe/nonce}
|
|
345
|
+
*/
|
|
346
|
+
async function createSiweNonce(address, config = {}) {
|
|
347
|
+
const { client: request = client, ...requestConfig } = config;
|
|
348
|
+
return (await request({
|
|
349
|
+
method: "POST",
|
|
350
|
+
url: getCreateSiweNonceUrl(address).url.toString(),
|
|
351
|
+
...requestConfig
|
|
352
|
+
})).data;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
356
|
+
* Do not edit manually.
|
|
357
|
+
*/
|
|
358
|
+
function getCreateStripeAuthIntentUrl(address) {
|
|
359
|
+
return {
|
|
360
|
+
method: "POST",
|
|
361
|
+
url: `/v1/wallets/${address}/stripe/auth-intent`
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* @description Opens a Link OAuth intent for the buyer's email and returns its id (handed to the client SDK's `authenticate(...)`) plus its expiry. Read-passthrough — nothing is persisted here.
|
|
366
|
+
* @summary Open a Stripe Link auth intent
|
|
367
|
+
* {@link /v1/wallets/:address/stripe/auth-intent}
|
|
368
|
+
*/
|
|
369
|
+
async function createStripeAuthIntent(address, data, config = {}) {
|
|
370
|
+
const { client: request = client, ...requestConfig } = config;
|
|
371
|
+
const requestData = data;
|
|
372
|
+
return (await request({
|
|
373
|
+
method: "POST",
|
|
374
|
+
url: getCreateStripeAuthIntentUrl(address).url.toString(),
|
|
375
|
+
data: requestData,
|
|
376
|
+
...requestConfig
|
|
377
|
+
})).data;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
381
|
+
* Do not edit manually.
|
|
382
|
+
*/
|
|
383
|
+
function getCreateStripeCustomerUrl(address, crypto_customer_id) {
|
|
384
|
+
return {
|
|
385
|
+
method: "POST",
|
|
386
|
+
url: `/v1/wallets/${address}/stripe/customer/${crypto_customer_id}`
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* @description Validates the crypto customer exists and persists the customer id onto the session so `/status` can re-derive it after a reopen.
|
|
391
|
+
* @summary Persist a Stripe crypto customer
|
|
392
|
+
* {@link /v1/wallets/:address/stripe/customer/:crypto_customer_id}
|
|
393
|
+
*/
|
|
394
|
+
async function createStripeCustomer(address, crypto_customer_id, config = {}) {
|
|
395
|
+
const { client: request = client, ...requestConfig } = config;
|
|
396
|
+
return (await request({
|
|
397
|
+
method: "POST",
|
|
398
|
+
url: getCreateStripeCustomerUrl(address, crypto_customer_id).url.toString(),
|
|
399
|
+
...requestConfig
|
|
400
|
+
})).data;
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
404
|
+
* Do not edit manually.
|
|
405
|
+
*/
|
|
406
|
+
function getCreateStripeSessionUrl(address) {
|
|
407
|
+
return {
|
|
408
|
+
method: "POST",
|
|
409
|
+
url: `/v1/wallets/${address}/stripe/session`
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* @description Opens a headless onramp session and mirrors it into a local order. Returns Stripe's `session_id` (fed to the client SDK's `performCheckout`) plus our own `order_id` to poll via `GET .../stripe/order/:id`. Pass exactly one of `source_amount` / `destination_amount`.
|
|
414
|
+
* @summary Open a Stripe onramp session
|
|
415
|
+
* {@link /v1/wallets/:address/stripe/session}
|
|
416
|
+
*/
|
|
417
|
+
async function createStripeSession(address, data, config = {}) {
|
|
418
|
+
const { client: request = client, ...requestConfig } = config;
|
|
419
|
+
const requestData = data;
|
|
420
|
+
return (await request({
|
|
421
|
+
method: "POST",
|
|
422
|
+
url: getCreateStripeSessionUrl(address).url.toString(),
|
|
423
|
+
data: requestData,
|
|
424
|
+
...requestConfig
|
|
425
|
+
})).data;
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
429
|
+
* Do not edit manually.
|
|
430
|
+
*/
|
|
431
|
+
function getCreateStripeTokensUrl(address) {
|
|
432
|
+
return {
|
|
433
|
+
method: "POST",
|
|
434
|
+
url: `/v1/wallets/${address}/stripe/tokens`
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* @description Exchanges a consented auth intent for the per-user OAuth tokens and stores them server-side. Returns 204; the access token never reaches the browser. The bound intent must match this session.
|
|
439
|
+
* @summary Exchange an auth intent for tokens
|
|
440
|
+
* {@link /v1/wallets/:address/stripe/tokens}
|
|
441
|
+
*/
|
|
442
|
+
async function createStripeTokens(address, data, config = {}) {
|
|
443
|
+
const { client: request = client, ...requestConfig } = config;
|
|
444
|
+
const requestData = data;
|
|
445
|
+
return (await request({
|
|
446
|
+
method: "POST",
|
|
447
|
+
url: getCreateStripeTokensUrl(address).url.toString(),
|
|
448
|
+
data: requestData,
|
|
449
|
+
...requestConfig
|
|
450
|
+
})).data;
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
454
|
+
* Do not edit manually.
|
|
455
|
+
*/
|
|
456
|
+
function getCreateSwapQuoteUrl(address) {
|
|
457
|
+
return {
|
|
458
|
+
method: "POST",
|
|
459
|
+
url: `/v1/wallets/${address}/swap/quote`
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* @description Returns an executable quote for swapping a source token into destination USDC. The response carries the steps the client executes on-chain; source and destination chains may differ.
|
|
464
|
+
* @summary Quote a swap
|
|
465
|
+
* {@link /v1/wallets/:address/swap/quote}
|
|
466
|
+
*/
|
|
467
|
+
async function createSwapQuote(address, data, config = {}) {
|
|
468
|
+
const { client: request = client, ...requestConfig } = config;
|
|
469
|
+
const requestData = data;
|
|
470
|
+
return (await request({
|
|
471
|
+
method: "POST",
|
|
472
|
+
url: getCreateSwapQuoteUrl(address).url.toString(),
|
|
473
|
+
data: requestData,
|
|
474
|
+
...requestConfig
|
|
475
|
+
})).data;
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
479
|
+
* Do not edit manually.
|
|
480
|
+
*/
|
|
481
|
+
function getCreateVirtualAccountUrl(address) {
|
|
482
|
+
return {
|
|
483
|
+
method: "POST",
|
|
484
|
+
url: `/v1/wallets/${address}/virtual-accounts`
|
|
485
|
+
};
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* @description Provisions a fiat→USDC virtual account for a `(currency, destination chain)` pair. Requires an approved identity verification. Returns 204; refetch the list to see the new account.
|
|
489
|
+
* @summary Create a virtual account
|
|
490
|
+
* {@link /v1/wallets/:address/virtual-accounts}
|
|
491
|
+
*/
|
|
492
|
+
async function createVirtualAccount(address, data, config = {}) {
|
|
493
|
+
const { client: request = client, ...requestConfig } = config;
|
|
494
|
+
const requestData = data;
|
|
495
|
+
return (await request({
|
|
496
|
+
method: "POST",
|
|
497
|
+
url: getCreateVirtualAccountUrl(address).url.toString(),
|
|
498
|
+
data: requestData,
|
|
499
|
+
...requestConfig
|
|
500
|
+
})).data;
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
504
|
+
* Do not edit manually.
|
|
505
|
+
*/
|
|
506
|
+
function getDisconnectExchangeUrl(address, exchange) {
|
|
507
|
+
return {
|
|
508
|
+
method: "DELETE",
|
|
509
|
+
url: `/v1/wallets/${address}/exchange/${exchange}`
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* @description Disconnects an exchange and returns 204. Idempotent: disconnecting an already-disconnected exchange still returns 204.
|
|
514
|
+
* @summary Disconnect an exchange
|
|
515
|
+
* {@link /v1/wallets/:address/exchange/:exchange}
|
|
516
|
+
*/
|
|
517
|
+
async function disconnectExchange(address, exchange, config = {}) {
|
|
518
|
+
const { client: request = client, ...requestConfig } = config;
|
|
519
|
+
return (await request({
|
|
520
|
+
method: "DELETE",
|
|
521
|
+
url: getDisconnectExchangeUrl(address, exchange).url.toString(),
|
|
522
|
+
...requestConfig
|
|
523
|
+
})).data;
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
527
|
+
* Do not edit manually.
|
|
528
|
+
*/
|
|
529
|
+
function getExecuteExchangeWithdrawalUrl(address, exchange) {
|
|
530
|
+
return {
|
|
531
|
+
method: "POST",
|
|
532
|
+
url: `/v1/wallets/${address}/exchange/${exchange}/withdraw`
|
|
533
|
+
};
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* @description Executes a quoted withdrawal. Returns the withdrawal (now `pending`), or `{ requires_2fa: true }` when the exchange demands a 2FA code — re-submit with `twofa`.
|
|
537
|
+
* @summary Execute an exchange withdrawal
|
|
538
|
+
* {@link /v1/wallets/:address/exchange/:exchange/withdraw}
|
|
539
|
+
*/
|
|
540
|
+
async function executeExchangeWithdrawal(address, exchange, data, config = {}) {
|
|
541
|
+
const { client: request = client, ...requestConfig } = config;
|
|
542
|
+
const requestData = data;
|
|
543
|
+
return (await request({
|
|
544
|
+
method: "POST",
|
|
545
|
+
url: getExecuteExchangeWithdrawalUrl(address, exchange).url.toString(),
|
|
546
|
+
data: requestData,
|
|
547
|
+
...requestConfig
|
|
548
|
+
})).data;
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
552
|
+
* Do not edit manually.
|
|
553
|
+
*/
|
|
554
|
+
function getGetBalanceUrl(address, chain, token) {
|
|
555
|
+
return {
|
|
556
|
+
method: "GET",
|
|
557
|
+
url: `/v1/wallets/${address}/balances/${chain}/${token}`
|
|
558
|
+
};
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* @description Returns a single token's balance on one chain. `token` is a catalog symbol (`eth`, `hype`, `usdc`, `usdt`).
|
|
562
|
+
* @summary Get one token balance
|
|
563
|
+
* {@link /v1/wallets/:address/balances/:chain/:token}
|
|
564
|
+
*/
|
|
565
|
+
async function getBalance(address, chain, token, config = {}) {
|
|
566
|
+
const { client: request = client, ...requestConfig } = config;
|
|
567
|
+
return (await request({
|
|
568
|
+
method: "GET",
|
|
569
|
+
url: getGetBalanceUrl(address, chain, token).url.toString(),
|
|
570
|
+
...requestConfig
|
|
571
|
+
})).data;
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
575
|
+
* Do not edit manually.
|
|
576
|
+
*/
|
|
577
|
+
function getGetBalancesUrl(address) {
|
|
578
|
+
return {
|
|
579
|
+
method: "GET",
|
|
580
|
+
url: `/v1/wallets/${address}/balances`
|
|
581
|
+
};
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* @description Returns the wallet's token balances across the supported source chains, each with its USD value. Filter with `?chains=1,8453`; the default is every readable chain.
|
|
585
|
+
* @summary List wallet balances
|
|
586
|
+
* {@link /v1/wallets/:address/balances}
|
|
587
|
+
*/
|
|
588
|
+
async function getBalances(address, params, config = {}) {
|
|
589
|
+
const { client: request = client, ...requestConfig } = config;
|
|
590
|
+
return (await request({
|
|
591
|
+
method: "GET",
|
|
592
|
+
url: getGetBalancesUrl(address).url.toString(),
|
|
593
|
+
params,
|
|
594
|
+
...requestConfig
|
|
595
|
+
})).data;
|
|
596
|
+
}
|
|
597
|
+
/**
|
|
598
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
599
|
+
* Do not edit manually.
|
|
600
|
+
*/
|
|
601
|
+
function getGetCashAppOrderUrl(address, id) {
|
|
602
|
+
return {
|
|
603
|
+
method: "GET",
|
|
604
|
+
url: `/v1/wallets/${address}/cashapp/${id}`
|
|
605
|
+
};
|
|
606
|
+
}
|
|
607
|
+
/**
|
|
608
|
+
* @description Returns a Cash App order by id, including its current status and payment link.
|
|
609
|
+
* @summary Get a Cash App order
|
|
610
|
+
* {@link /v1/wallets/:address/cashapp/:id}
|
|
611
|
+
*/
|
|
612
|
+
async function getCashAppOrder(address, id, config = {}) {
|
|
613
|
+
const { client: request = client, ...requestConfig } = config;
|
|
614
|
+
return (await request({
|
|
615
|
+
method: "GET",
|
|
616
|
+
url: getGetCashAppOrderUrl(address, id).url.toString(),
|
|
617
|
+
...requestConfig
|
|
618
|
+
})).data;
|
|
619
|
+
}
|
|
620
|
+
/**
|
|
621
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
622
|
+
* Do not edit manually.
|
|
623
|
+
*/
|
|
624
|
+
function getGetExchangeUrl(address, exchange) {
|
|
625
|
+
return {
|
|
626
|
+
method: "GET",
|
|
627
|
+
url: `/v1/wallets/${address}/exchange/${exchange}`
|
|
628
|
+
};
|
|
629
|
+
}
|
|
630
|
+
/**
|
|
631
|
+
* @description Returns the connection status for an exchange. Not-connected is a 200 with `connected: false` — poll this to drive the connect UI.
|
|
632
|
+
* @summary Get exchange connection status
|
|
633
|
+
* {@link /v1/wallets/:address/exchange/:exchange}
|
|
634
|
+
*/
|
|
635
|
+
async function getExchange(address, exchange, config = {}) {
|
|
636
|
+
const { client: request = client, ...requestConfig } = config;
|
|
637
|
+
return (await request({
|
|
638
|
+
method: "GET",
|
|
639
|
+
url: getGetExchangeUrl(address, exchange).url.toString(),
|
|
640
|
+
...requestConfig
|
|
641
|
+
})).data;
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
645
|
+
* Do not edit manually.
|
|
646
|
+
*/
|
|
647
|
+
function getGetExchangeAssetsUrl(address, exchange) {
|
|
648
|
+
return {
|
|
649
|
+
method: "GET",
|
|
650
|
+
url: `/v1/wallets/${address}/exchange/${exchange}/assets`
|
|
651
|
+
};
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
654
|
+
* @description Returns the assets the connected exchange can pay out and, per asset, the networks it withdraws to with their live per-network limits.
|
|
655
|
+
* @summary List exchange withdrawable assets
|
|
656
|
+
* {@link /v1/wallets/:address/exchange/:exchange/assets}
|
|
657
|
+
*/
|
|
658
|
+
async function getExchangeAssets(address, exchange, config = {}) {
|
|
659
|
+
const { client: request = client, ...requestConfig } = config;
|
|
660
|
+
return (await request({
|
|
661
|
+
method: "GET",
|
|
662
|
+
url: getGetExchangeAssetsUrl(address, exchange).url.toString(),
|
|
663
|
+
...requestConfig
|
|
664
|
+
})).data;
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
667
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
668
|
+
* Do not edit manually.
|
|
669
|
+
*/
|
|
670
|
+
function getGetExchangeWithdrawalUrl(address, exchange, id) {
|
|
671
|
+
return {
|
|
672
|
+
method: "GET",
|
|
673
|
+
url: `/v1/wallets/${address}/exchange/${exchange}/withdraw/${id}`
|
|
674
|
+
};
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* @description Returns a withdrawal by id, including its status and — once broadcast — its transaction hash.
|
|
678
|
+
* @summary Get an exchange withdrawal
|
|
679
|
+
* {@link /v1/wallets/:address/exchange/:exchange/withdraw/:id}
|
|
680
|
+
*/
|
|
681
|
+
async function getExchangeWithdrawal(address, exchange, id, config = {}) {
|
|
682
|
+
const { client: request = client, ...requestConfig } = config;
|
|
683
|
+
return (await request({
|
|
684
|
+
method: "GET",
|
|
685
|
+
url: getGetExchangeWithdrawalUrl(address, exchange, id).url.toString(),
|
|
686
|
+
...requestConfig
|
|
687
|
+
})).data;
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
691
|
+
* Do not edit manually.
|
|
692
|
+
*/
|
|
693
|
+
function getGetFxRatesUrl() {
|
|
694
|
+
return {
|
|
695
|
+
method: "GET",
|
|
696
|
+
url: `/v1/fx`
|
|
697
|
+
};
|
|
698
|
+
}
|
|
699
|
+
/**
|
|
700
|
+
* @description Returns USD→currency rates for showing amounts in the app's display currency. Public; rates are cached upstream.
|
|
701
|
+
* @summary Get display-currency exchange rates
|
|
702
|
+
* {@link /v1/fx}
|
|
703
|
+
*/
|
|
704
|
+
async function getFxRates(config = {}) {
|
|
705
|
+
const { client: request = client, ...requestConfig } = config;
|
|
706
|
+
return (await request({
|
|
707
|
+
method: "GET",
|
|
708
|
+
url: getGetFxRatesUrl().url.toString(),
|
|
709
|
+
...requestConfig
|
|
710
|
+
})).data;
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
714
|
+
* Do not edit manually.
|
|
715
|
+
*/
|
|
716
|
+
function getGetIdentityVerificationLinkUrl(address) {
|
|
717
|
+
return {
|
|
718
|
+
method: "POST",
|
|
719
|
+
url: `/v1/wallets/${address}/identity-verification`
|
|
720
|
+
};
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* @description Returns the hosted identity-verification URL for the wallet. Present it to the user, then poll `GET /v1/wallets/:address` for the resulting status.
|
|
724
|
+
* @summary Get the identity-verification link
|
|
725
|
+
* {@link /v1/wallets/:address/identity-verification}
|
|
726
|
+
*/
|
|
727
|
+
async function getIdentityVerificationLink(address, config = {}) {
|
|
728
|
+
const { client: request = client, ...requestConfig } = config;
|
|
729
|
+
return (await request({
|
|
730
|
+
method: "POST",
|
|
731
|
+
url: getGetIdentityVerificationLinkUrl(address).url.toString(),
|
|
732
|
+
...requestConfig
|
|
733
|
+
})).data;
|
|
734
|
+
}
|
|
735
|
+
/**
|
|
736
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
737
|
+
* Do not edit manually.
|
|
738
|
+
*/
|
|
739
|
+
function getGetStripeConfigUrl(address) {
|
|
740
|
+
return {
|
|
741
|
+
method: "GET",
|
|
742
|
+
url: `/v1/wallets/${address}/stripe/config`
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
746
|
+
* @description Returns the environment's Stripe publishable key, which the SDK feeds to `loadCryptoOnrampAndInitialize(pk)` on init. `session`-gated for consistency with the rest of the onramp routes, not secrecy — a publishable key is public by design.
|
|
747
|
+
* @summary Get the Stripe publishable key
|
|
748
|
+
* {@link /v1/wallets/:address/stripe/config}
|
|
749
|
+
*/
|
|
750
|
+
async function getStripeConfig(address, config = {}) {
|
|
751
|
+
const { client: request = client, ...requestConfig } = config;
|
|
752
|
+
return (await request({
|
|
753
|
+
method: "GET",
|
|
754
|
+
url: getGetStripeConfigUrl(address).url.toString(),
|
|
755
|
+
...requestConfig
|
|
756
|
+
})).data;
|
|
757
|
+
}
|
|
758
|
+
/**
|
|
759
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
760
|
+
* Do not edit manually.
|
|
761
|
+
*/
|
|
762
|
+
function getGetStripeCustomerStatusUrl(address, crypto_customer_id) {
|
|
763
|
+
return {
|
|
764
|
+
method: "GET",
|
|
765
|
+
url: `/v1/wallets/${address}/stripe/customer/${crypto_customer_id}`
|
|
766
|
+
};
|
|
767
|
+
}
|
|
768
|
+
/**
|
|
769
|
+
* @description Reads the crypto customer's KYC and document-verification statuses (the two the SDK branches on) plus its provided fields — the same projection as the customer POST, but a pure read with no persistence. The SDK polls it while the verifying step is on screen.
|
|
770
|
+
* @summary Poll a Stripe crypto customer's status
|
|
771
|
+
* {@link /v1/wallets/:address/stripe/customer/:crypto_customer_id}
|
|
772
|
+
*/
|
|
773
|
+
async function getStripeCustomerStatus(address, crypto_customer_id, config = {}) {
|
|
774
|
+
const { client: request = client, ...requestConfig } = config;
|
|
775
|
+
return (await request({
|
|
776
|
+
method: "GET",
|
|
777
|
+
url: getGetStripeCustomerStatusUrl(address, crypto_customer_id).url.toString(),
|
|
778
|
+
...requestConfig
|
|
779
|
+
})).data;
|
|
780
|
+
}
|
|
781
|
+
/**
|
|
782
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
783
|
+
* Do not edit manually.
|
|
784
|
+
*/
|
|
785
|
+
function getGetStripeOrderUrl(address, id) {
|
|
786
|
+
return {
|
|
787
|
+
method: "GET",
|
|
788
|
+
url: `/v1/wallets/${address}/stripe/order/${id}`
|
|
789
|
+
};
|
|
790
|
+
}
|
|
791
|
+
/**
|
|
792
|
+
* @description Returns the settlement status of one onramp order from the local mirror, scoped to the session's wallet. The SDK polls this after checkout for the webhook-confirmed `fulfillment_complete` (or a `rejected` / `error` terminal state).
|
|
793
|
+
* @summary Get a Stripe onramp order
|
|
794
|
+
* {@link /v1/wallets/:address/stripe/order/:id}
|
|
795
|
+
*/
|
|
796
|
+
async function getStripeOrder(address, id, config = {}) {
|
|
797
|
+
const { client: request = client, ...requestConfig } = config;
|
|
798
|
+
return (await request({
|
|
799
|
+
method: "GET",
|
|
800
|
+
url: getGetStripeOrderUrl(address, id).url.toString(),
|
|
801
|
+
...requestConfig
|
|
802
|
+
})).data;
|
|
803
|
+
}
|
|
804
|
+
/**
|
|
805
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
806
|
+
* Do not edit manually.
|
|
807
|
+
*/
|
|
808
|
+
function getGetStripeQuoteUrl(address) {
|
|
809
|
+
return {
|
|
810
|
+
method: "GET",
|
|
811
|
+
url: `/v1/wallets/${address}/stripe/quote`
|
|
812
|
+
};
|
|
813
|
+
}
|
|
814
|
+
/**
|
|
815
|
+
* @description Returns an informational price estimate for a source amount (fiat spend) or destination amount (target USDC) — the destination amount, the buyer's all-in source total, the fee components, and when the rate was fetched. Pin exactly one. No customer, token, or session is involved (it prices with the secret key alone), so it's `session`-gated only. Display-only: Stripe sets the final amounts at session creation.
|
|
816
|
+
* @summary Quote a Stripe onramp amount
|
|
817
|
+
* {@link /v1/wallets/:address/stripe/quote}
|
|
818
|
+
*/
|
|
819
|
+
async function getStripeQuote(address, params, config = {}) {
|
|
820
|
+
const { client: request = client, ...requestConfig } = config;
|
|
821
|
+
return (await request({
|
|
822
|
+
method: "GET",
|
|
823
|
+
url: getGetStripeQuoteUrl(address).url.toString(),
|
|
824
|
+
params,
|
|
825
|
+
...requestConfig
|
|
826
|
+
})).data;
|
|
827
|
+
}
|
|
828
|
+
/**
|
|
829
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
830
|
+
* Do not edit manually.
|
|
831
|
+
*/
|
|
832
|
+
function getGetStripeStatusUrl(address) {
|
|
833
|
+
return {
|
|
834
|
+
method: "GET",
|
|
835
|
+
url: `/v1/wallets/${address}/stripe/status`
|
|
836
|
+
};
|
|
837
|
+
}
|
|
838
|
+
/**
|
|
839
|
+
* @description Reports whether this session is still Link-authenticated and, once the customer POST has run, the persisted crypto customer id and the Link account email. Reads Redis only, so an un-authed session is a 200 with `authenticated: false` (not a 401) — the SDK polls it to re-derive the Stripe session on a cold open.
|
|
840
|
+
* @summary Get the session's Stripe login state
|
|
841
|
+
* {@link /v1/wallets/:address/stripe/status}
|
|
842
|
+
*/
|
|
843
|
+
async function getStripeStatus(address, config = {}) {
|
|
844
|
+
const { client: request = client, ...requestConfig } = config;
|
|
845
|
+
return (await request({
|
|
846
|
+
method: "GET",
|
|
847
|
+
url: getGetStripeStatusUrl(address).url.toString(),
|
|
848
|
+
...requestConfig
|
|
849
|
+
})).data;
|
|
850
|
+
}
|
|
851
|
+
/**
|
|
852
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
853
|
+
* Do not edit manually.
|
|
854
|
+
*/
|
|
855
|
+
function getGetTermsOfServiceLinkUrl(address) {
|
|
856
|
+
return {
|
|
857
|
+
method: "POST",
|
|
858
|
+
url: `/v1/wallets/${address}/terms-of-service`
|
|
859
|
+
};
|
|
860
|
+
}
|
|
861
|
+
/**
|
|
862
|
+
* @description Returns the hosted terms-of-service URL for the wallet. Present it to the user, then poll `GET /v1/wallets/:address` for acceptance.
|
|
863
|
+
* @summary Get the terms-of-service link
|
|
864
|
+
* {@link /v1/wallets/:address/terms-of-service}
|
|
865
|
+
*/
|
|
866
|
+
async function getTermsOfServiceLink(address, config = {}) {
|
|
867
|
+
const { client: request = client, ...requestConfig } = config;
|
|
868
|
+
return (await request({
|
|
869
|
+
method: "POST",
|
|
870
|
+
url: getGetTermsOfServiceLinkUrl(address).url.toString(),
|
|
871
|
+
...requestConfig
|
|
872
|
+
})).data;
|
|
873
|
+
}
|
|
874
|
+
/**
|
|
875
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
876
|
+
* Do not edit manually.
|
|
877
|
+
*/
|
|
878
|
+
function getGetWalletUrl(address) {
|
|
879
|
+
return {
|
|
880
|
+
method: "GET",
|
|
881
|
+
url: `/v1/wallets/${address}`
|
|
882
|
+
};
|
|
883
|
+
}
|
|
884
|
+
/**
|
|
885
|
+
* @description Returns the current state facts for a wallet: verification status, terms acceptance, and event timestamps. Requires a valid session cookie for the same wallet.
|
|
886
|
+
* @summary Get wallet state
|
|
887
|
+
* {@link /v1/wallets/:address}
|
|
888
|
+
*/
|
|
889
|
+
async function getWallet(address, config = {}) {
|
|
890
|
+
const { client: request = client, ...requestConfig } = config;
|
|
891
|
+
return (await request({
|
|
892
|
+
method: "GET",
|
|
893
|
+
url: getGetWalletUrl(address).url.toString(),
|
|
894
|
+
...requestConfig
|
|
895
|
+
})).data;
|
|
896
|
+
}
|
|
897
|
+
/**
|
|
898
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
899
|
+
* Do not edit manually.
|
|
900
|
+
*/
|
|
901
|
+
function getListStripePaymentTokensUrl(address) {
|
|
902
|
+
return {
|
|
903
|
+
method: "GET",
|
|
904
|
+
url: `/v1/wallets/${address}/stripe/payment-tokens`
|
|
905
|
+
};
|
|
906
|
+
}
|
|
907
|
+
/**
|
|
908
|
+
* @description Returns the payment methods the customer has on file. Read-passthrough — the SDK checks this before `collectPaymentMethod` to offer a saved method.
|
|
909
|
+
* @summary List the customer's payment methods
|
|
910
|
+
* {@link /v1/wallets/:address/stripe/payment-tokens}
|
|
911
|
+
*/
|
|
912
|
+
async function listStripePaymentTokens(address, params, config = {}) {
|
|
913
|
+
const { client: request = client, ...requestConfig } = config;
|
|
914
|
+
return (await request({
|
|
915
|
+
method: "GET",
|
|
916
|
+
url: getListStripePaymentTokensUrl(address).url.toString(),
|
|
917
|
+
params,
|
|
918
|
+
...requestConfig
|
|
919
|
+
})).data;
|
|
920
|
+
}
|
|
921
|
+
/**
|
|
922
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
923
|
+
* Do not edit manually.
|
|
924
|
+
*/
|
|
925
|
+
function getListStripeWalletsUrl(address) {
|
|
926
|
+
return {
|
|
927
|
+
method: "GET",
|
|
928
|
+
url: `/v1/wallets/${address}/stripe/wallets`
|
|
929
|
+
};
|
|
930
|
+
}
|
|
931
|
+
/**
|
|
932
|
+
* @description Returns the crypto wallets registered to the customer's Link account. Read-passthrough — the SDK checks this before `registerWalletAddress` to avoid re-registering a known address.
|
|
933
|
+
* @summary List the customer's crypto wallets
|
|
934
|
+
* {@link /v1/wallets/:address/stripe/wallets}
|
|
935
|
+
*/
|
|
936
|
+
async function listStripeWallets(address, params, config = {}) {
|
|
937
|
+
const { client: request = client, ...requestConfig } = config;
|
|
938
|
+
return (await request({
|
|
939
|
+
method: "GET",
|
|
940
|
+
url: getListStripeWalletsUrl(address).url.toString(),
|
|
941
|
+
params,
|
|
942
|
+
...requestConfig
|
|
943
|
+
})).data;
|
|
944
|
+
}
|
|
945
|
+
/**
|
|
946
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
947
|
+
* Do not edit manually.
|
|
948
|
+
*/
|
|
949
|
+
function getListVirtualAccountsUrl(address) {
|
|
950
|
+
return {
|
|
951
|
+
method: "GET",
|
|
952
|
+
url: `/v1/wallets/${address}/virtual-accounts`
|
|
953
|
+
};
|
|
954
|
+
}
|
|
955
|
+
/**
|
|
956
|
+
* @description Returns the wallet's virtual accounts, each with the bank-side deposit instructions the user needs to send fiat.
|
|
957
|
+
* @summary List virtual accounts
|
|
958
|
+
* {@link /v1/wallets/:address/virtual-accounts}
|
|
959
|
+
*/
|
|
960
|
+
async function listVirtualAccounts(address, config = {}) {
|
|
961
|
+
const { client: request = client, ...requestConfig } = config;
|
|
962
|
+
return (await request({
|
|
963
|
+
method: "GET",
|
|
964
|
+
url: getListVirtualAccountsUrl(address).url.toString(),
|
|
965
|
+
...requestConfig
|
|
966
|
+
})).data;
|
|
967
|
+
}
|
|
968
|
+
/**
|
|
969
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
970
|
+
* Do not edit manually.
|
|
971
|
+
*/
|
|
972
|
+
function getRefreshSessionUrl(address) {
|
|
973
|
+
return {
|
|
974
|
+
method: "POST",
|
|
975
|
+
url: `/v1/session/${address}/refresh`
|
|
976
|
+
};
|
|
977
|
+
}
|
|
978
|
+
/**
|
|
979
|
+
* @description Rotates the refresh cookie and mints a fresh session cookie pair. The `calm_refresh` cookie is the only credential — no body or headers required.
|
|
980
|
+
* @summary Refresh a session
|
|
981
|
+
* {@link /v1/session/:address/refresh}
|
|
982
|
+
*/
|
|
983
|
+
async function refreshSession(address, config = {}) {
|
|
984
|
+
const { client: request = client, ...requestConfig } = config;
|
|
985
|
+
return (await request({
|
|
986
|
+
method: "POST",
|
|
987
|
+
url: getRefreshSessionUrl(address).url.toString(),
|
|
988
|
+
...requestConfig
|
|
989
|
+
})).data;
|
|
990
|
+
}
|
|
991
|
+
/**
|
|
992
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
993
|
+
* Do not edit manually.
|
|
994
|
+
*/
|
|
995
|
+
function getRegisterWalletUrl(address) {
|
|
996
|
+
return {
|
|
997
|
+
method: "POST",
|
|
998
|
+
url: `/v1/wallets/${address}/register`
|
|
999
|
+
};
|
|
1000
|
+
}
|
|
1001
|
+
/**
|
|
1002
|
+
* @description Submits the registration form (name + email) for the wallet. Returns 204; the SDK refetches the wallet state to pick up the new facts.
|
|
1003
|
+
* @summary Register a wallet
|
|
1004
|
+
* {@link /v1/wallets/:address/register}
|
|
1005
|
+
*/
|
|
1006
|
+
async function registerWallet(address, data, config = {}) {
|
|
1007
|
+
const { client: request = client, ...requestConfig } = config;
|
|
1008
|
+
const requestData = data;
|
|
1009
|
+
return (await request({
|
|
1010
|
+
method: "POST",
|
|
1011
|
+
url: getRegisterWalletUrl(address).url.toString(),
|
|
1012
|
+
data: requestData,
|
|
1013
|
+
...requestConfig
|
|
1014
|
+
})).data;
|
|
1015
|
+
}
|
|
1016
|
+
/**
|
|
1017
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
1018
|
+
* Do not edit manually.
|
|
1019
|
+
*/
|
|
1020
|
+
function getSubmitIdentityVerificationUrl(address) {
|
|
1021
|
+
return {
|
|
1022
|
+
method: "POST",
|
|
1023
|
+
url: `/v1/wallets/${address}/identity-verification/submit`
|
|
1024
|
+
};
|
|
1025
|
+
}
|
|
1026
|
+
/**
|
|
1027
|
+
* @description Records that the user finished the identity-verification flow and returns 204. Internal to the SDK's instant-submit UX — partners should create the link, then poll `GET /v1/wallets/:address` for the resulting status instead.
|
|
1028
|
+
* @summary Record identity-verification completion
|
|
1029
|
+
* {@link /v1/wallets/:address/identity-verification/submit}
|
|
1030
|
+
*/
|
|
1031
|
+
async function submitIdentityVerification(address, config = {}) {
|
|
1032
|
+
const { client: request = client, ...requestConfig } = config;
|
|
1033
|
+
return (await request({
|
|
1034
|
+
method: "POST",
|
|
1035
|
+
url: getSubmitIdentityVerificationUrl(address).url.toString(),
|
|
1036
|
+
...requestConfig
|
|
1037
|
+
})).data;
|
|
1038
|
+
}
|
|
1039
|
+
/**
|
|
1040
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
1041
|
+
* Do not edit manually.
|
|
1042
|
+
*/
|
|
1043
|
+
function getSubmitTermsOfServiceUrl(address) {
|
|
1044
|
+
return {
|
|
1045
|
+
method: "POST",
|
|
1046
|
+
url: `/v1/wallets/${address}/terms-of-service/submit`
|
|
1047
|
+
};
|
|
1048
|
+
}
|
|
1049
|
+
/**
|
|
1050
|
+
* @description Records that the user finished the terms-of-service flow and returns 204. Internal to the SDK's instant-submit UX — partners should create the link, then poll `GET /v1/wallets/:address` for acceptance instead.
|
|
1051
|
+
* @summary Record terms-of-service completion
|
|
1052
|
+
* {@link /v1/wallets/:address/terms-of-service/submit}
|
|
1053
|
+
*/
|
|
1054
|
+
async function submitTermsOfService(address, config = {}) {
|
|
1055
|
+
const { client: request = client, ...requestConfig } = config;
|
|
1056
|
+
return (await request({
|
|
1057
|
+
method: "POST",
|
|
1058
|
+
url: getSubmitTermsOfServiceUrl(address).url.toString(),
|
|
1059
|
+
...requestConfig
|
|
1060
|
+
})).data;
|
|
1061
|
+
}
|
|
1062
|
+
/**
|
|
1063
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
1064
|
+
* Do not edit manually.
|
|
1065
|
+
*/
|
|
1066
|
+
function getUpdateVirtualAccountUrl(address, virtualAccountId) {
|
|
1067
|
+
return {
|
|
1068
|
+
method: "PATCH",
|
|
1069
|
+
url: `/v1/wallets/${address}/virtual-accounts/${virtualAccountId}`
|
|
1070
|
+
};
|
|
1071
|
+
}
|
|
1072
|
+
/**
|
|
1073
|
+
* @description Updates a virtual account's destination chain. Returns 204; refetch the list to see the change.
|
|
1074
|
+
* @summary Update a virtual account
|
|
1075
|
+
* {@link /v1/wallets/:address/virtual-accounts/:virtual-account-id}
|
|
1076
|
+
*/
|
|
1077
|
+
async function updateVirtualAccount(address, virtualAccountId, data, config = {}) {
|
|
1078
|
+
const { client: request = client, ...requestConfig } = config;
|
|
1079
|
+
const requestData = data;
|
|
1080
|
+
return (await request({
|
|
1081
|
+
method: "PATCH",
|
|
1082
|
+
url: getUpdateVirtualAccountUrl(address, virtualAccountId).url.toString(),
|
|
1083
|
+
data: requestData,
|
|
1084
|
+
...requestConfig
|
|
1085
|
+
})).data;
|
|
1086
|
+
}
|
|
1087
|
+
const connectExchangePathParamsExchangeEnum = { coinbase: "coinbase" };
|
|
1088
|
+
const createCardLinkMutationRequestCurrencyEnum = {
|
|
1089
|
+
usd: "usd",
|
|
1090
|
+
gbp: "gbp",
|
|
1091
|
+
eur: "eur"
|
|
1092
|
+
};
|
|
1093
|
+
const createCashAppOrder200StatusEnum = {
|
|
1094
|
+
pending: "pending",
|
|
1095
|
+
processing: "processing",
|
|
1096
|
+
confirming: "confirming",
|
|
1097
|
+
swapping: "swapping",
|
|
1098
|
+
bridging: "bridging",
|
|
1099
|
+
awaiting_approval: "awaiting_approval",
|
|
1100
|
+
delivering: "delivering",
|
|
1101
|
+
completed: "completed",
|
|
1102
|
+
failed: "failed",
|
|
1103
|
+
refunding: "refunding",
|
|
1104
|
+
refunded: "refunded",
|
|
1105
|
+
unfulfilled: "unfulfilled",
|
|
1106
|
+
expired: "expired"
|
|
1107
|
+
};
|
|
1108
|
+
const createDepositAddressMutationRequestSourceTokenEnum = {
|
|
1109
|
+
eth: "eth",
|
|
1110
|
+
hype: "hype",
|
|
1111
|
+
usdc: "usdc",
|
|
1112
|
+
usdt: "usdt"
|
|
1113
|
+
};
|
|
1114
|
+
const createExchangeWithdrawQuotePathParamsExchangeEnum = { coinbase: "coinbase" };
|
|
1115
|
+
const createSwapQuoteMutationRequestSourceTokenEnum = {
|
|
1116
|
+
eth: "eth",
|
|
1117
|
+
hype: "hype",
|
|
1118
|
+
usdc: "usdc",
|
|
1119
|
+
usdt: "usdt"
|
|
1120
|
+
};
|
|
1121
|
+
const createSwapQuoteMutationRequestTradeTypeEnum = {
|
|
1122
|
+
EXACT_INPUT: "EXACT_INPUT",
|
|
1123
|
+
EXACT_OUTPUT: "EXACT_OUTPUT",
|
|
1124
|
+
EXPECTED_OUTPUT: "EXPECTED_OUTPUT"
|
|
1125
|
+
};
|
|
1126
|
+
const createVirtualAccountMutationRequestCurrencyEnum = {
|
|
1127
|
+
usd: "usd",
|
|
1128
|
+
gbp: "gbp",
|
|
1129
|
+
eur: "eur"
|
|
1130
|
+
};
|
|
1131
|
+
const disconnectExchangePathParamsExchangeEnum = { coinbase: "coinbase" };
|
|
1132
|
+
const executeExchangeWithdrawalPathParamsExchangeEnum = { coinbase: "coinbase" };
|
|
1133
|
+
const executeExchangeWithdrawal200StatusEnum = {
|
|
1134
|
+
quoted: "quoted",
|
|
1135
|
+
pending: "pending",
|
|
1136
|
+
broadcasted: "broadcasted",
|
|
1137
|
+
failed: "failed",
|
|
1138
|
+
delayed: "delayed"
|
|
1139
|
+
};
|
|
1140
|
+
const getBalancePathParamsTokenEnum = {
|
|
1141
|
+
eth: "eth",
|
|
1142
|
+
hype: "hype",
|
|
1143
|
+
usdc: "usdc",
|
|
1144
|
+
usdt: "usdt"
|
|
1145
|
+
};
|
|
1146
|
+
const getCashAppOrder200StatusEnum = {
|
|
1147
|
+
pending: "pending",
|
|
1148
|
+
processing: "processing",
|
|
1149
|
+
confirming: "confirming",
|
|
1150
|
+
swapping: "swapping",
|
|
1151
|
+
bridging: "bridging",
|
|
1152
|
+
awaiting_approval: "awaiting_approval",
|
|
1153
|
+
delivering: "delivering",
|
|
1154
|
+
completed: "completed",
|
|
1155
|
+
failed: "failed",
|
|
1156
|
+
refunding: "refunding",
|
|
1157
|
+
refunded: "refunded",
|
|
1158
|
+
unfulfilled: "unfulfilled",
|
|
1159
|
+
expired: "expired"
|
|
1160
|
+
};
|
|
1161
|
+
const getExchangePathParamsExchangeEnum = { coinbase: "coinbase" };
|
|
1162
|
+
const getExchangeAssetsPathParamsExchangeEnum = { coinbase: "coinbase" };
|
|
1163
|
+
const getExchangeWithdrawalPathParamsExchangeEnum = { coinbase: "coinbase" };
|
|
1164
|
+
const getExchangeWithdrawal200StatusEnum = {
|
|
1165
|
+
quoted: "quoted",
|
|
1166
|
+
pending: "pending",
|
|
1167
|
+
broadcasted: "broadcasted",
|
|
1168
|
+
failed: "failed",
|
|
1169
|
+
delayed: "delayed"
|
|
1170
|
+
};
|
|
1171
|
+
const getStripeOrder200StatusEnum = {
|
|
1172
|
+
initialized: "initialized",
|
|
1173
|
+
requires_payment: "requires_payment",
|
|
1174
|
+
fulfillment_processing: "fulfillment_processing",
|
|
1175
|
+
fulfillment_complete: "fulfillment_complete",
|
|
1176
|
+
rejected: "rejected",
|
|
1177
|
+
error: "error"
|
|
1178
|
+
};
|
|
1179
|
+
const getWallet200IdentityVerificationStatusEnum = {
|
|
1180
|
+
not_started: "not_started",
|
|
1181
|
+
incomplete: "incomplete",
|
|
1182
|
+
awaiting_questionnaire: "awaiting_questionnaire",
|
|
1183
|
+
awaiting_ubo: "awaiting_ubo",
|
|
1184
|
+
under_review: "under_review",
|
|
1185
|
+
active: "active",
|
|
1186
|
+
rejected: "rejected",
|
|
1187
|
+
paused: "paused",
|
|
1188
|
+
offboarded: "offboarded"
|
|
1189
|
+
};
|
|
1190
|
+
const dataCurrencyEnum = {
|
|
1191
|
+
usd: "usd",
|
|
1192
|
+
gbp: "gbp",
|
|
1193
|
+
eur: "eur"
|
|
1194
|
+
};
|
|
1195
|
+
function configureCalm(options) {
|
|
1196
|
+
setConfig({ apiUrl: options.apiUrl });
|
|
1197
|
+
}
|
|
1198
|
+
export { ApiError, checkoutStripeSession, clearSession, client, client as default, configureCalm, connectExchange, connectExchangePathParamsExchangeEnum, createCardLink, createCardLinkMutationRequestCurrencyEnum, createCashAppOrder, createCashAppOrder200StatusEnum, createCashAppQuote, createDepositAddress, createDepositAddressMutationRequestSourceTokenEnum, createExchangeWithdrawQuote, createExchangeWithdrawQuotePathParamsExchangeEnum, createSessionDynamic, createSessionPrivy, createSessionSiwe, createSiweNonce, createStripeAuthIntent, createStripeCustomer, createStripeSession, createStripeTokens, createSwapQuote, createSwapQuoteMutationRequestSourceTokenEnum, createSwapQuoteMutationRequestTradeTypeEnum, createVirtualAccount, createVirtualAccountMutationRequestCurrencyEnum, dataCurrencyEnum, disconnectExchange, disconnectExchangePathParamsExchangeEnum, executeExchangeWithdrawal, executeExchangeWithdrawal200StatusEnum, executeExchangeWithdrawalPathParamsExchangeEnum, getBalance, getBalancePathParamsTokenEnum, getBalances, getCashAppOrder, getCashAppOrder200StatusEnum, getConfig, getExchange, getExchangeAssets, getExchangeAssetsPathParamsExchangeEnum, getExchangePathParamsExchangeEnum, getExchangeWithdrawal, getExchangeWithdrawal200StatusEnum, getExchangeWithdrawalPathParamsExchangeEnum, getFxRates, getIdentityVerificationLink, getStripeConfig, getStripeCustomerStatus, getStripeOrder, getStripeOrder200StatusEnum, getStripeQuote, getStripeStatus, getTermsOfServiceLink, getWallet, getWallet200IdentityVerificationStatusEnum, listStripePaymentTokens, listStripeWallets, listVirtualAccounts, refreshSession, registerWallet, setConfig, submitIdentityVerification, submitTermsOfService, updateVirtualAccount };
|