@coinbase/cdp-api-client 0.0.110 → 0.0.111

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.
@@ -1,498 +1,262 @@
1
- import { cdpApiClient as d } from "./index7.js";
2
- const i = (e, t) => d(
3
- { url: `/v2/embedded-wallet-api/projects/${e}/attestation/challenge`, method: "POST" },
4
- t
5
- ), l = (e, t, n) => d(
6
- {
7
- url: `/v2/embedded-wallet-api/projects/${e}/attestation/register`,
8
- method: "POST",
9
- headers: { "Content-Type": "application/json" },
10
- data: t
11
- },
12
- n
13
- ), p = (e, t, n) => d(
14
- {
15
- url: `/v2/embedded-wallet-api/projects/${e}/auth/init`,
16
- method: "POST",
17
- headers: { "Content-Type": "application/json" },
18
- data: t
19
- },
20
- n
21
- ), c = (e, t, n) => d(
22
- {
23
- url: `/v2/embedded-wallet-api/projects/${e}/auth/verify/email`,
24
- method: "POST",
25
- headers: { "Content-Type": "application/json" },
26
- data: t
27
- },
28
- n
29
- ), u = (e, t, n) => d(
30
- {
31
- url: `/v2/embedded-wallet-api/projects/${e}/auth/verify/sms`,
32
- method: "POST",
33
- headers: { "Content-Type": "application/json" },
34
- data: t
35
- },
36
- n
37
- ), m = (e, t, n, a) => d(
38
- {
39
- url: `/v2/embedded-wallet-api/projects/${e}/auth/verify/oauth/${t}`,
40
- method: "POST",
41
- headers: { "Content-Type": "application/json" },
42
- data: n
43
- },
44
- a
45
- ), h = (e, t, n, a) => d(
46
- {
47
- url: `/v2/embedded-wallet-api/projects/${e}/auth/verify/oauth/${t}`,
48
- method: "PUT",
49
- headers: { "Content-Type": "application/json" },
50
- data: n
51
- },
52
- a
53
- ), T = (e, t, n) => d(
54
- {
55
- url: `/v2/embedded-wallet-api/projects/${e}/auth/verify/siwe`,
56
- method: "POST",
57
- headers: { "Content-Type": "application/json" },
58
- data: t
59
- },
60
- n
61
- ), v = (e, t, n) => d(
62
- {
63
- url: `/v2/embedded-wallet-api/projects/${e}/auth/refresh`,
64
- method: "POST",
65
- headers: { "Content-Type": "application/json" },
66
- data: t
67
- },
68
- n
69
- ), $ = (e, t, n) => d(
70
- {
71
- url: `/v2/embedded-wallet-api/projects/${e}/auth/logout`,
72
- method: "POST",
73
- headers: { "Content-Type": "application/json" },
74
- data: t
75
- },
76
- n
77
- ), E = (e, t) => d(
78
- {
79
- url: `/v2/embedded-wallet-api/projects/${e}/auth/custom/authenticate`,
80
- method: "POST"
81
- },
82
- t
83
- ), b = (e, t) => d(
84
- { url: `/v2/embedded-wallet-api/projects/${e}/config`, method: "GET" },
85
- t
86
- ), w = (e, t) => d(
87
- { url: `/v2/embedded-wallet-api/projects/${e}/auth/mfa`, method: "GET" },
88
- t
89
- ), y = (e, t, n) => d(
90
- { url: `/v2/embedded-wallet-api/end-users/${e}`, method: "GET", params: t },
91
- n
92
- ), S = (e, t, n, a) => d(
93
- {
94
- url: `/v2/embedded-wallet-api/end-users/${e}/wallet-secrets`,
95
- method: "PUT",
96
- headers: { "Content-Type": "application/json" },
97
- data: t,
98
- params: n
99
- },
100
- a
101
- ), j = (e, t, n, a) => d(
102
- {
103
- url: `/v2/embedded-wallet-api/end-users/${e}/evm`,
104
- method: "POST",
105
- headers: { "Content-Type": "application/json" },
106
- data: t,
107
- params: n
108
- },
109
- a
110
- ), g = (e, t, n, a) => d(
111
- {
112
- url: `/v2/embedded-wallet-api/end-users/${e}/evm/sign`,
113
- method: "POST",
114
- headers: { "Content-Type": "application/json" },
115
- data: t,
116
- params: n
117
- },
118
- a
119
- ), P = (e, t, n, a) => d(
120
- {
121
- url: `/v2/embedded-wallet-api/end-users/${e}/evm/sign/transaction`,
122
- method: "POST",
123
- headers: { "Content-Type": "application/json" },
124
- data: t,
125
- params: n
126
- },
127
- a
128
- ), O = (e, t, n, a) => d(
129
- {
130
- url: `/v2/embedded-wallet-api/end-users/${e}/evm/send/transaction`,
131
- method: "POST",
132
- headers: { "Content-Type": "application/json" },
133
- data: t,
134
- params: n
135
- },
136
- a
137
- ), C = (e, t, n, a, r, s) => d(
138
- {
139
- url: `/v2/embedded-wallet-api/end-users/${e}/evm/${t}/send/${n}`,
140
- method: "POST",
141
- headers: { "Content-Type": "application/json" },
142
- data: a,
143
- params: r
144
- },
145
- s
146
- ), A = (e, t, n, a) => d(
147
- {
148
- url: `/v2/embedded-wallet-api/end-users/${e}/evm/sign/message`,
149
- method: "POST",
150
- headers: { "Content-Type": "application/json" },
151
- data: t,
152
- params: n
153
- },
154
- a
155
- ), U = (e, t, n, a) => d(
156
- {
157
- url: `/v2/embedded-wallet-api/end-users/${e}/evm/sign/typed-data`,
158
- method: "POST",
159
- headers: { "Content-Type": "application/json" },
160
- data: t,
161
- params: n
162
- },
163
- a
164
- ), f = (e, t, n, a) => d(
165
- {
166
- url: `/v2/embedded-wallet-api/end-users/${e}/evm/export`,
167
- method: "POST",
168
- headers: { "Content-Type": "application/json" },
169
- data: t,
170
- params: n
171
- },
172
- a
173
- ), W = (e, t, n, a) => d(
174
- {
175
- url: `/v2/embedded-wallet-api/end-users/${e}/delegation`,
176
- method: "POST",
177
- headers: { "Content-Type": "application/json" },
178
- data: t,
179
- params: n
180
- },
181
- a
182
- ), D = (e, t, n) => d(
183
- { url: `/v2/embedded-wallet-api/end-users/${e}/delegation`, method: "GET", params: t },
184
- n
185
- ), G = (e, t, n, a) => d(
186
- {
187
- url: `/v2/embedded-wallet-api/end-users/${e}/delegation`,
188
- method: "DELETE",
189
- headers: { "Content-Type": "application/json" },
190
- data: t,
191
- params: n
192
- },
193
- a
194
- ), M = (e, t, n, a, r) => d(
195
- {
196
- url: `/v2/embedded-wallet-api/end-users/${e}/address/${t}/delegation`,
197
- method: "POST",
198
- headers: { "Content-Type": "application/json" },
199
- data: n,
200
- params: a
201
- },
202
- r
203
- ), F = (e, t, n, a) => d(
204
- {
205
- url: `/v2/embedded-wallet-api/end-users/${e}/address/${t}/delegation`,
206
- method: "GET",
207
- params: n
208
- },
209
- a
210
- ), k = (e, t, n, a, r) => d(
211
- {
212
- url: `/v2/embedded-wallet-api/end-users/${e}/address/${t}/delegation`,
213
- method: "DELETE",
214
- headers: { "Content-Type": "application/json" },
215
- data: n,
216
- params: a
217
- },
218
- r
219
- ), x = (e, t, n, a) => d(
220
- {
221
- url: `/v2/embedded-wallet-api/end-users/${e}/evm/eip7702/delegation`,
222
- method: "POST",
223
- headers: { "Content-Type": "application/json" },
224
- data: t,
225
- params: n
226
- },
227
- a
228
- ), B = (e, t, n, a) => d(
229
- {
230
- url: `/v2/embedded-wallet-api/end-users/${e}/evm/eip7702/delegation-operations/${t}`,
231
- method: "GET",
232
- params: n
233
- },
234
- a
235
- ), H = (e, t, n, a) => d(
236
- {
237
- url: `/v2/embedded-wallet-api/end-users/${e}/evm/smart-accounts`,
238
- method: "POST",
239
- headers: { "Content-Type": "application/json" },
240
- data: t,
241
- params: n
242
- },
243
- a
244
- ), I = (e, t, n, a, r) => d(
245
- {
246
- url: `/v2/embedded-wallet-api/end-users/${e}/evm/smart-accounts/${t}/user-operations/${n}`,
247
- method: "GET",
248
- params: a
249
- },
250
- r
251
- ), L = (e, t, n, a, r) => d(
252
- {
253
- url: `/v2/embedded-wallet-api/end-users/${e}/evm/smart-accounts/${t}/send`,
254
- method: "POST",
255
- headers: { "Content-Type": "application/json" },
256
- data: n,
257
- params: a
258
- },
259
- r
260
- ), V = (e, t, n, a, r) => d(
261
- {
262
- url: `/v2/embedded-wallet-api/end-users/${e}/evm/smart-accounts/${t}/spend-permissions`,
263
- method: "POST",
264
- headers: { "Content-Type": "application/json" },
265
- data: n,
266
- params: a
267
- },
268
- r
269
- ), q = (e, t, n, a) => d(
270
- {
271
- url: `/v2/embedded-wallet-api/end-users/${e}/evm/smart-accounts/${t}/spend-permissions/list`,
272
- method: "GET",
273
- params: n
274
- },
275
- a
276
- ), z = (e, t, n, a, r) => d(
277
- {
278
- url: `/v2/embedded-wallet-api/end-users/${e}/evm/smart-accounts/${t}/spend-permissions/revoke`,
279
- method: "POST",
280
- headers: { "Content-Type": "application/json" },
281
- data: n,
282
- params: a
283
- },
284
- r
285
- ), J = (e, t, n, a, r) => d(
286
- {
287
- url: `/v2/embedded-wallet-api/end-users/${e}/evm/smart-accounts/${t}/spend-permissions/enable`,
288
- method: "POST",
289
- headers: { "Content-Type": "application/json" },
290
- data: n,
291
- params: a
292
- },
293
- r
294
- ), K = (e, t, n) => d(
295
- { url: `/v2/embedded-wallet-api/end-users/${e}/evm/swaps/price`, method: "GET", params: t },
296
- n
297
- ), N = (e, t, n, a) => d(
298
- {
299
- url: `/v2/embedded-wallet-api/end-users/${e}/evm/swaps`,
300
- method: "POST",
301
- headers: { "Content-Type": "application/json" },
302
- data: t,
303
- params: n
304
- },
305
- a
306
- ), Q = (e, t, n, a) => d(
307
- {
308
- url: `/v2/embedded-wallet-api/end-users/${e}/solana`,
309
- method: "POST",
310
- headers: { "Content-Type": "application/json" },
311
- data: t,
312
- params: n
313
- },
314
- a
315
- ), R = (e, t, n, a) => d(
316
- {
317
- url: `/v2/embedded-wallet-api/end-users/${e}/solana/export`,
318
- method: "POST",
319
- headers: { "Content-Type": "application/json" },
320
- data: t,
321
- params: n
322
- },
323
- a
324
- ), X = (e, t, n, a) => d(
325
- {
326
- url: `/v2/embedded-wallet-api/end-users/${e}/solana/sign`,
327
- method: "POST",
328
- headers: { "Content-Type": "application/json" },
329
- data: t,
330
- params: n
331
- },
332
- a
333
- ), Y = (e, t, n, a) => d(
334
- {
335
- url: `/v2/embedded-wallet-api/end-users/${e}/solana/sign/message`,
336
- method: "POST",
337
- headers: { "Content-Type": "application/json" },
338
- data: t,
339
- params: n
340
- },
341
- a
342
- ), Z = (e, t, n, a) => d(
343
- {
344
- url: `/v2/embedded-wallet-api/end-users/${e}/solana/sign/transaction`,
345
- method: "POST",
346
- headers: { "Content-Type": "application/json" },
347
- data: t,
348
- params: n
349
- },
350
- a
351
- ), _ = (e, t, n, a) => d(
352
- {
353
- url: `/v2/embedded-wallet-api/end-users/${e}/solana/send/transaction`,
354
- method: "POST",
355
- headers: { "Content-Type": "application/json" },
356
- data: t,
357
- params: n
358
- },
359
- a
360
- ), ee = (e, t, n, a, r, s) => d(
361
- {
362
- url: `/v2/embedded-wallet-api/end-users/${e}/solana/${t}/send/${n}`,
363
- method: "POST",
364
- headers: { "Content-Type": "application/json" },
365
- data: a,
366
- params: r
367
- },
368
- s
369
- ), te = (e, t, n, a) => d(
370
- {
371
- url: `/v2/embedded-wallet-api/end-users/${e}/btc`,
372
- method: "POST",
373
- headers: { "Content-Type": "application/json" },
374
- data: t,
375
- params: n
376
- },
377
- a
378
- ), ne = (e, t, n, a) => d(
379
- {
380
- url: `/v2/embedded-wallet-api/end-users/${e}/btc/sign`,
381
- method: "POST",
382
- headers: { "Content-Type": "application/json" },
383
- data: t,
384
- params: n
385
- },
386
- a
387
- ), ae = (e, t, n, a) => d(
388
- {
389
- url: `/v2/embedded-wallet-api/end-users/${e}/onramp/orders`,
390
- method: "POST",
391
- headers: { "Content-Type": "application/json" },
392
- data: t,
393
- params: n
394
- },
395
- a
396
- ), de = (e, t, n, a) => d(
397
- {
398
- url: `/v2/embedded-wallet-api/end-users/${e}/mfa/enroll/${t}/init`,
399
- method: "POST",
400
- params: n
401
- },
402
- a
403
- ), re = (e, t, n, a, r) => d(
404
- {
405
- url: `/v2/embedded-wallet-api/end-users/${e}/mfa/enroll/${t}/initiate`,
406
- method: "POST",
407
- headers: { "Content-Type": "application/json" },
408
- data: n,
409
- params: a
410
- },
411
- r
412
- ), se = (e, t, n, a, r) => d(
413
- {
414
- url: `/v2/embedded-wallet-api/end-users/${e}/mfa/enroll/${t}/submit`,
415
- method: "POST",
416
- headers: { "Content-Type": "application/json" },
417
- data: n,
418
- params: a
419
- },
420
- r
421
- ), oe = (e, t, n, a) => d(
422
- {
423
- url: `/v2/embedded-wallet-api/end-users/${e}/mfa/verify/${t}/init`,
424
- method: "POST",
425
- params: n
426
- },
427
- a
428
- ), ie = (e, t, n, a, r) => d(
429
- {
430
- url: `/v2/embedded-wallet-api/end-users/${e}/mfa/verify/${t}/submit`,
431
- method: "POST",
432
- headers: { "Content-Type": "application/json" },
433
- data: n,
434
- params: a
435
- },
436
- r
437
- ), le = (e, t, n) => d(
438
- { url: `/v2/embedded-wallet-api/end-users/${e}/mfa/prompt`, method: "PUT", params: t },
439
- n
440
- );
1
+ import { Analytics as o } from "./index2.js";
2
+ import "./index3.js";
3
+ import c from "axios";
4
+ import { ERROR_DOCS_PAGE_URL as h } from "./index9.js";
5
+ import { UnknownApiError as R, HttpErrorType as u, isOpenAPIError as A, APIError as d, UnknownError as k } from "./index7.js";
6
+ const w = () => typeof window < "u" && typeof document < "u";
7
+ let a = c.create({
8
+ baseURL: "https://api.cdp.coinbase.com/platform"
9
+ }), i = null;
10
+ const O = (t) => {
11
+ if (a = c.create({
12
+ baseURL: t.basePath || "https://api.cdp.coinbase.com/platform",
13
+ // Only enable cookies in browser environments where they're supported
14
+ withCredentials: w()
15
+ }), a.interceptors.request.use(async (r) => {
16
+ const e = U(r), s = f(r);
17
+ if (!i || v(s.pathname) || _(s.pathname) && !await i.isSignedIn() || !I(s.pathname))
18
+ return r;
19
+ const n = await i.getXWalletAuth({
20
+ requestMethod: e,
21
+ requestHost: s.host,
22
+ requestPath: s.pathname,
23
+ requestData: r.data
24
+ });
25
+ return n && (r.headers["X-Wallet-Auth"] = n), r;
26
+ }), a.interceptors.request.use(async (r) => {
27
+ const e = f(r);
28
+ if (!i || v(e.pathname) || _(e.pathname) && !await i.isSignedIn())
29
+ return r;
30
+ const s = await i.getToken();
31
+ return s && s !== "" && (r.headers.Authorization = `Bearer ${s}`), r;
32
+ }), !w()) {
33
+ const r = t.platform ? `CDP/reactnative/${t.platform}` : "CDP/reactnative";
34
+ a.interceptors.request.use(async (e) => {
35
+ let s = e.headers["User-Agent"];
36
+ return s = s ? `${s} ${r}` : r, e.headers["User-Agent"] = s, e;
37
+ });
38
+ }
39
+ t.refreshTokenStorage && P(t.refreshTokenStorage), t.appAttestation && y(t.appAttestation, t.platform), t.debugging && (a.interceptors.request.use((r) => (console.log("Request:", r), r)), a.interceptors.response.use((r) => (console.log("Response:", r), r)));
40
+ }, D = (t) => {
41
+ i = t;
42
+ }, y = (t, r) => {
43
+ a.interceptors.request.use(async (e) => {
44
+ const s = f(e);
45
+ if (!q(s.pathname) || !t.isEnabled())
46
+ return e;
47
+ try {
48
+ if (r === "ios") {
49
+ const n = s.pathname.match(/\/projects\/([^/]+)\//);
50
+ if (!n || !n[1])
51
+ return e;
52
+ const g = `/v2/embedded-wallet-api/projects/${n[1]}/attestation/challenge`, l = (await a.post(g)).data.challenge;
53
+ if (!l)
54
+ return console.warn("Failed to fetch assertion challenge"), e;
55
+ const p = await t.generateAssertion(l);
56
+ if (!p)
57
+ return e;
58
+ e.headers["X-App-Attestation-Assertion"] = p.assertion, e.headers["X-App-Attestation-Key-ID"] = p.keyId, e.headers["X-App-Attestation-Challenge"] = l;
59
+ } else {
60
+ const n = await t.generateAssertion(JSON.stringify(e.data));
61
+ if (!n)
62
+ return e;
63
+ e.headers["X-Integrity-Token"] = n.assertion, e.headers["X-Package-Name"] = t.appIdentifier;
64
+ }
65
+ return e;
66
+ } catch (n) {
67
+ throw new Error(
68
+ `App attestation required but assertion generation failed: ${n instanceof Error ? n.message : String(n)}`
69
+ );
70
+ }
71
+ });
72
+ }, E = (t, r) => ({
73
+ ...t,
74
+ headers: {
75
+ ...t.headers || {},
76
+ "X-Idempotency-Key": r
77
+ }
78
+ }), z = async (t, r) => {
79
+ $(t), r && r !== "" && (t = E(t, r));
80
+ try {
81
+ return (await a(t)).data;
82
+ } catch (e) {
83
+ if (c.isAxiosError(e) && !e.response)
84
+ throw new R(
85
+ u.unknown,
86
+ e.cause instanceof Error ? e.cause.message : e.message,
87
+ e.cause
88
+ );
89
+ if (c.isAxiosError(e) && e.response) {
90
+ if (A(e.response.data))
91
+ throw new d(
92
+ e.response.status,
93
+ e.response.data.errorType,
94
+ e.response.data.errorMessage,
95
+ e.response.data.correlationId,
96
+ e.response.data.errorLink,
97
+ e.cause
98
+ );
99
+ {
100
+ const s = e.response.status;
101
+ switch (s) {
102
+ case 401:
103
+ throw new d(
104
+ s,
105
+ u.unauthorized,
106
+ "Unauthorized.",
107
+ void 0,
108
+ `${h}#unauthorized`,
109
+ e.cause
110
+ );
111
+ case 404:
112
+ throw new d(
113
+ s,
114
+ u.not_found,
115
+ "API not found.",
116
+ void 0,
117
+ `${h}#not_found`,
118
+ e.cause
119
+ );
120
+ case 502:
121
+ throw new d(
122
+ s,
123
+ u.bad_gateway,
124
+ "Bad gateway.",
125
+ void 0,
126
+ `${h}`,
127
+ e.cause
128
+ );
129
+ case 503:
130
+ throw new d(
131
+ s,
132
+ u.service_unavailable,
133
+ "Service unavailable. Please try again later.",
134
+ void 0,
135
+ `${h}`,
136
+ e.cause
137
+ );
138
+ default: {
139
+ let n = "";
140
+ if (e.response.data)
141
+ try {
142
+ n = JSON.stringify(e.response.data);
143
+ } catch {
144
+ n = String(e.response.data);
145
+ }
146
+ const m = n ? `An unexpected error occurred: ${n}` : "An unexpected error occurred.";
147
+ throw new d(
148
+ s,
149
+ u.unexpected_error,
150
+ m,
151
+ void 0,
152
+ `${h}`,
153
+ e.cause
154
+ );
155
+ }
156
+ }
157
+ }
158
+ }
159
+ throw new k("Something went wrong.", e instanceof Error ? e : void 0);
160
+ }
161
+ }, P = (t) => {
162
+ a.interceptors.response.use(
163
+ async (r) => {
164
+ try {
165
+ if (b(r)) {
166
+ o.sendSessionRefreshEvent({
167
+ name: "refresh_token_response"
168
+ });
169
+ const e = r.data?.refreshToken;
170
+ e && (o.sendSessionRefreshEvent({
171
+ name: "refresh_token_received"
172
+ }), await Promise.race([
173
+ t.setRefreshToken(e),
174
+ new Promise(
175
+ (s, n) => setTimeout(() => n(new Error("setRefreshToken timed out after 5000ms")), 5e3)
176
+ )
177
+ ]), o.sendSessionRefreshEvent({
178
+ name: "refresh_token_stored"
179
+ }));
180
+ }
181
+ } catch (e) {
182
+ const s = e instanceof Error ? e.message : String(e);
183
+ o.sendSessionRefreshEvent({
184
+ name: "refresh_token_store_failed",
185
+ error_message: s
186
+ }), console.warn("Failed to store refresh token:", e);
187
+ }
188
+ return r;
189
+ },
190
+ (r) => Promise.reject(r)
191
+ ), a.interceptors.request.use(async (r) => {
192
+ try {
193
+ if (T(r.url)) {
194
+ const e = await t.getRefreshToken();
195
+ e || setTimeout(() => {
196
+ t.getRefreshToken().then((s) => {
197
+ s && o.sendSessionRefreshEvent({
198
+ name: "refresh_token_received_after_missing"
199
+ });
200
+ }).catch((s) => {
201
+ const n = s instanceof Error ? s.message : String(s);
202
+ o.sendSessionRefreshEvent({
203
+ name: "refresh_token_retrieve_failed_after_missing",
204
+ error_message: n
205
+ });
206
+ });
207
+ }, 10), e ? (o.sendSessionRefreshEvent({
208
+ name: "refresh_token_retrieved"
209
+ }), r.data = {
210
+ ...r.data,
211
+ refreshToken: e
212
+ }) : o.sendSessionRefreshEvent({
213
+ name: "refresh_token_missing"
214
+ });
215
+ }
216
+ S(r.url) && (o.sendSessionRefreshEvent({
217
+ name: "refresh_token_removing_token"
218
+ }), await t.removeRefreshToken());
219
+ } catch (e) {
220
+ const s = e instanceof Error ? e.message : String(e);
221
+ o.sendSessionRefreshEvent({
222
+ name: "refresh_token_retrieve_failed",
223
+ error_message: s
224
+ }), console.warn("Failed to retrieve refresh token:", e);
225
+ }
226
+ return r;
227
+ });
228
+ }, S = (t) => t ? /^\/v2\/embedded-wallet-api\/projects\/[^/]+\/auth\/logout$/.test(t) : !1, T = (t) => t ? /^\/v2\/embedded-wallet-api\/projects\/[^/]+\/auth\/(refresh|logout)$/.test(t) : !1, b = (t) => {
229
+ const r = t.config.url;
230
+ return r ? /^\/v2\/embedded-wallet-api\/projects\/[^/]+\/auth\/(verify\/(email|sms|siwe|oauth\/.*)|refresh)$/.test(
231
+ r
232
+ ) : !1;
233
+ }, $ = (t) => {
234
+ if (!a.getUri() || a.getUri() === "")
235
+ throw new Error("CDP client URI not configured. Call configure() first.");
236
+ if (!t.url || t.url === "")
237
+ throw new Error("AxiosRequestConfig URL is empty. This should never happen.");
238
+ if (!t.method || t.method === "")
239
+ throw new Error("AxiosRequestConfig method is empty. This should never happen.");
240
+ }, U = (t) => t.method?.toString().toUpperCase() || "GET", f = (t) => {
241
+ if (!t.url)
242
+ throw new Error("URL is required for authentication");
243
+ const r = a.getUri() + t.url;
244
+ return new URL(r);
245
+ }, v = (t) => {
246
+ const r = /^\/platform\/v2\/embedded-wallet-api\/projects\/[^/]+\/auth\/(refresh|logout)$/, e = /^\/platform\/v2\/embedded-wallet-api\/projects\/[^/]+\/auth\/(mfa)$/, s = /^\/platform\/v2\/embedded-wallet-api\/projects\/[^/]+\/config$/, n = /^\/platform\/v2\/embedded-wallet-api\/projects\/[^/]+\/attestation\/(challenge|register)$/;
247
+ return r.test(t) || e.test(t) || s.test(t) || n.test(t);
248
+ }, I = (t) => !/^\/platform\/v2\/embedded-wallet-api\/projects\/[^/]+\/auth\/custom\/authenticate$/.test(t), _ = (t) => {
249
+ const r = /^\/platform\/v2\/embedded-wallet-api\/projects\/[^/]+\/auth\/(init)$/, e = /^\/platform\/v2\/embedded-wallet-api\/projects\/[^/]+\/auth\/verify\//;
250
+ return r.test(t) || e.test(t);
251
+ }, q = (t) => [
252
+ // Auth flows: prevent account takeover on mobile clients
253
+ /\/auth\/verify\//,
254
+ // VerifyEmailAuthentication, VerifySmsAuthentication, VerifyOAuthCode, VerifyOAuthEndUserIdentity
255
+ /\/auth\/refresh$/
256
+ // RefreshAccessToken
257
+ ].some((e) => e.test(t));
441
258
  export {
442
- E as authenticateUserWithCustomAuth,
443
- W as createDelegationForEndUser,
444
- M as createDelegationForEndUserAccount,
445
- ae as createEndUserApplePayOnrampOrder,
446
- te as createEndUserBtcAccount,
447
- j as createEndUserEvmAccount,
448
- H as createEndUserEvmSmartAccount,
449
- N as createEndUserEvmSwap,
450
- Q as createEndUserSolanaAccount,
451
- x as createEvmEip7702DelegationWithEndUserAccount,
452
- V as createSpendPermissionWithEndUserAccount,
453
- J as enableSpendPermissionWithEndUserAccount,
454
- f as exportEndUserEvmAccount,
455
- R as exportEndUserSolanaAccount,
456
- i as generateAttestationChallenge,
457
- y as getAuthenticatedEndUser,
458
- D as getDelegationForEndUser,
459
- F as getDelegationForEndUserAccount,
460
- K as getEndUserEvmSwapPrice,
461
- B as getEvmEip7702DelegationOperationByIdWithEndUserAccount,
462
- w as getMfaConfig,
463
- b as getProjectConfig,
464
- I as getUserOperationWithEndUserAccount,
465
- p as initiateAuthentication,
466
- de as initiateMfaEnrollment,
467
- re as initiateMfaEnrollment2,
468
- oe as initiateMfaVerification,
469
- q as listSpendPermissionsWithEndUserAccount,
470
- $ as logOutEndUser,
471
- le as recordMfaEnrollmentPrompted,
472
- v as refreshAccessToken,
473
- l as registerAttestation,
474
- S as registerTemporaryWalletSecret,
475
- G as revokeDelegationForEndUser,
476
- k as revokeDelegationForEndUserAccount,
477
- z as revokeSpendPermissionWithEndUserAccount,
478
- C as sendEvmAssetWithEndUserAccount,
479
- O as sendEvmTransactionWithEndUserAccount,
480
- ee as sendSolanaAssetWithEndUserAccount,
481
- _ as sendSolanaTransactionWithEndUserAccount,
482
- L as sendUserOperationWithEndUserAccount,
483
- ne as signBtcHashWithEndUserAccount,
484
- g as signEvmHashWithEndUserAccount,
485
- A as signEvmMessageWithEndUserAccount,
486
- P as signEvmTransactionWithEndUserAccount,
487
- U as signEvmTypedDataWithEndUserAccount,
488
- X as signSolanaHashWithEndUserAccount,
489
- Y as signSolanaMessageWithEndUserAccount,
490
- Z as signSolanaTransactionWithEndUserAccount,
491
- se as submitMfaEnrollment,
492
- ie as submitMfaVerification,
493
- c as verifyEmailAuthentication,
494
- m as verifyOAuthCode,
495
- h as verifyOAuthEndUserIdentity,
496
- T as verifySiweAuthentication,
497
- u as verifySmsAuthentication
259
+ z as cdpApiClient,
260
+ O as configureCdpApiClient,
261
+ D as setAuthManager
498
262
  };