@coinbase/cdp-api-client 0.0.102 → 0.0.104

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