@dynamic-labs-sdk/client 0.20.0 → 0.22.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.
Files changed (81) hide show
  1. package/dist/{InvalidParamError-C8i6ExCF.esm.js → InvalidParamError-CxahHqE2.esm.js} +463 -11
  2. package/dist/InvalidParamError-CxahHqE2.esm.js.map +1 -0
  3. package/dist/{InvalidParamError-C9egR24p.cjs.js → InvalidParamError-D7xRBKr4.cjs.js} +511 -35
  4. package/dist/InvalidParamError-D7xRBKr4.cjs.js.map +1 -0
  5. package/dist/{NotWaasWalletAccountError-BI9ZiEz_.esm.js → NotWaasWalletAccountError-CoqWYjd1.esm.js} +18 -6
  6. package/dist/{NotWaasWalletAccountError-BI9ZiEz_.esm.js.map → NotWaasWalletAccountError-CoqWYjd1.esm.js.map} +1 -1
  7. package/dist/{NotWaasWalletAccountError-DoCmrSvg.cjs.js → NotWaasWalletAccountError-Da0wXVcL.cjs.js} +19 -7
  8. package/dist/NotWaasWalletAccountError-Da0wXVcL.cjs.js.map +1 -0
  9. package/dist/client/defaultClient/defaultClient.d.ts.map +1 -1
  10. package/dist/core.cjs.js +121 -49
  11. package/dist/core.cjs.js.map +1 -1
  12. package/dist/core.esm.js +84 -12
  13. package/dist/core.esm.js.map +1 -1
  14. package/dist/errors/base/BaseError.d.ts.map +1 -1
  15. package/dist/exports/index.d.ts +1 -1
  16. package/dist/exports/index.d.ts.map +1 -1
  17. package/dist/{getNetworkProviderFromNetworkId-CwHLK1vS.esm.js → getNetworkProviderFromNetworkId-DFfDAd0n.esm.js} +268 -16
  18. package/dist/getNetworkProviderFromNetworkId-DFfDAd0n.esm.js.map +1 -0
  19. package/dist/{getNetworkProviderFromNetworkId-Bd5KJOTp.cjs.js → getNetworkProviderFromNetworkId-nk9uXEoJ.cjs.js} +321 -69
  20. package/dist/getNetworkProviderFromNetworkId-nk9uXEoJ.cjs.js.map +1 -0
  21. package/dist/{getSignedSessionId-CHIq5TnT.cjs.js → getSignedSessionId-BVPDe38W.cjs.js} +33 -9
  22. package/dist/{getSignedSessionId-CHIq5TnT.cjs.js.map → getSignedSessionId-BVPDe38W.cjs.js.map} +1 -1
  23. package/dist/{getSignedSessionId-BMJxU50H.esm.js → getSignedSessionId-Bpb-PAHO.esm.js} +30 -6
  24. package/dist/{getSignedSessionId-BMJxU50H.esm.js.map → getSignedSessionId-Bpb-PAHO.esm.js.map} +1 -1
  25. package/dist/{getVerifiedCredentialForWalletAccount-CsJEjM3D.cjs.js → getVerifiedCredentialForWalletAccount-C8Po-OFi.cjs.js} +164 -56
  26. package/dist/getVerifiedCredentialForWalletAccount-C8Po-OFi.cjs.js.map +1 -0
  27. package/dist/{getVerifiedCredentialForWalletAccount-DBJ_U78Y.esm.js → getVerifiedCredentialForWalletAccount-C8SCA6xu.esm.js} +118 -10
  28. package/dist/getVerifiedCredentialForWalletAccount-C8SCA6xu.esm.js.map +1 -0
  29. package/dist/index.cjs.js +1328 -320
  30. package/dist/index.cjs.js.map +1 -1
  31. package/dist/index.esm.js +1232 -224
  32. package/dist/index.esm.js.map +1 -1
  33. package/dist/{isMfaRequiredForAction-D5Mgfi6K.cjs.js → isMfaRequiredForAction-BOZQJorF.cjs.js} +32 -8
  34. package/dist/isMfaRequiredForAction-BOZQJorF.cjs.js.map +1 -0
  35. package/dist/{isMfaRequiredForAction-Bc6KzFrM.esm.js → isMfaRequiredForAction-DFFSz7P4.esm.js} +29 -5
  36. package/dist/isMfaRequiredForAction-DFFSz7P4.esm.js.map +1 -0
  37. package/dist/modules/apiClient/utils/convertToApiErrorMiddleware/convertToApiErrorMiddleware.d.ts.map +1 -1
  38. package/dist/modules/checkout/checkout.types.d.ts +1 -1
  39. package/dist/modules/checkout/checkout.types.d.ts.map +1 -1
  40. package/dist/modules/checkout/submitCheckoutTransaction/submitCheckoutTransaction.d.ts.map +1 -1
  41. package/dist/modules/clientEvents/clientEvents.d.ts.map +1 -1
  42. package/dist/modules/legacyWalletBook/getWalletConnectCatalog/getChainFromWalletSchema/getChainFromWalletSchema.d.ts.map +1 -1
  43. package/dist/modules/projectSettings/fetchProjectSettings/fetchProjectSettings.d.ts +1 -2
  44. package/dist/modules/projectSettings/fetchProjectSettings/fetchProjectSettings.d.ts.map +1 -1
  45. package/dist/modules/wallets/constants.d.ts.map +1 -1
  46. package/dist/modules/wallets/proveWalletAccountOwnership/proveWalletAccountOwnership.d.ts +1 -1
  47. package/dist/modules/wallets/proveWalletAccountOwnership/proveWalletAccountOwnership.d.ts.map +1 -1
  48. package/dist/modules/wallets/utils/getSignInMessage/getSignInMessage.d.ts +2 -1
  49. package/dist/modules/wallets/utils/getSignInMessage/getSignInMessage.d.ts.map +1 -1
  50. package/dist/modules/wallets/walletProvider/walletProvider.types.d.ts +8 -1
  51. package/dist/modules/wallets/walletProvider/walletProvider.types.d.ts.map +1 -1
  52. package/dist/services/instrumentation/connectLoggerToInstrumentation/connectLoggerToInstrumentation.d.ts.map +1 -1
  53. package/dist/services/instrumentation/createInstrumentation/createInstrumentation.d.ts.map +1 -1
  54. package/dist/services/instrumentation/instrumentFunction/instrumentFunction.d.ts +1 -0
  55. package/dist/services/instrumentation/instrumentFunction/instrumentFunction.d.ts.map +1 -1
  56. package/dist/services/instrumentation/instrumentation.types.d.ts +13 -1
  57. package/dist/services/instrumentation/instrumentation.types.d.ts.map +1 -1
  58. package/dist/services/instrumentation/scrubParameters/scrubParameters.d.ts.map +1 -1
  59. package/dist/services/instrumentation/transports/createDynamicTransport/createDynamicTransport.d.ts.map +1 -1
  60. package/dist/services/realtime/createRealtimeService/createRealtimeService.d.ts.map +1 -1
  61. package/dist/services/storage/createStorage/formatForStorage/storageFormat.d.ts.map +1 -1
  62. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  63. package/dist/utils/isMobile/isMobile.d.ts.map +1 -1
  64. package/dist/waas.cjs.js +12 -11
  65. package/dist/waas.cjs.js.map +1 -1
  66. package/dist/waas.esm.js +11 -10
  67. package/dist/waas.esm.js.map +1 -1
  68. package/dist/waasCore.cjs.js +26 -26
  69. package/dist/waasCore.cjs.js.map +1 -1
  70. package/dist/waasCore.esm.js +25 -25
  71. package/dist/waasCore.esm.js.map +1 -1
  72. package/package.json +3 -3
  73. package/dist/InvalidParamError-C8i6ExCF.esm.js.map +0 -1
  74. package/dist/InvalidParamError-C9egR24p.cjs.js.map +0 -1
  75. package/dist/NotWaasWalletAccountError-DoCmrSvg.cjs.js.map +0 -1
  76. package/dist/getNetworkProviderFromNetworkId-Bd5KJOTp.cjs.js.map +0 -1
  77. package/dist/getNetworkProviderFromNetworkId-CwHLK1vS.esm.js.map +0 -1
  78. package/dist/getVerifiedCredentialForWalletAccount-CsJEjM3D.cjs.js.map +0 -1
  79. package/dist/getVerifiedCredentialForWalletAccount-DBJ_U78Y.esm.js.map +0 -1
  80. package/dist/isMfaRequiredForAction-Bc6KzFrM.esm.js.map +0 -1
  81. package/dist/isMfaRequiredForAction-D5Mgfi6K.cjs.js.map +0 -1
@@ -1,13 +1,13 @@
1
- const require_getNetworkProviderFromNetworkId = require('./getNetworkProviderFromNetworkId-Bd5KJOTp.cjs.js');
1
+ const require_getNetworkProviderFromNetworkId = require('./getNetworkProviderFromNetworkId-nk9uXEoJ.cjs.js');
2
2
  let _dynamic_labs_sdk_api_core = require("@dynamic-labs/sdk-api-core");
3
3
 
4
4
  //#region package.json
5
5
  var name = "@dynamic-labs-sdk/client";
6
- var version = "0.20.0";
6
+ var version = "0.22.0";
7
7
  var dependencies = {
8
8
  "@dynamic-labs-sdk/assert-package-version": "workspace:*",
9
9
  "@dynamic-labs-wallet/browser-wallet-client": "0.0.286",
10
- "@dynamic-labs/sdk-api-core": "0.0.915",
10
+ "@dynamic-labs/sdk-api-core": "0.0.921",
11
11
  "@simplewebauthn/browser": "13.1.0",
12
12
  "ably": "2.17.1",
13
13
  "buffer": "6.0.3",
@@ -195,6 +195,357 @@ const isCookieEnabled = (client) => {
195
195
  return dynamicCookiesEnabled || byoJwtCookieEnabled;
196
196
  };
197
197
 
198
+ //#endregion
199
+ //#region src/modules/auth/extractSessionId/extractSessionId.ts
200
+ /**
201
+ * Extracts the session ID (`sid` claim) from a JWT token string.
202
+ *
203
+ * Decodes the base64url-encoded payload segment of the token and reads the
204
+ * `sid` field. This is used to correlate instrumentation events with the
205
+ * authenticated session, without ever forwarding the full token.
206
+ *
207
+ * Returns `null` when no token is present, when the token is malformed, or
208
+ * when the payload does not contain a `sid` claim.
209
+ * @not-instrumented
210
+ */
211
+ const extractSessionId = (token) => {
212
+ try {
213
+ const payload = token.split(".")[1];
214
+ return JSON.parse(atob(payload)).sid ?? null;
215
+ } catch {
216
+ return null;
217
+ }
218
+ };
219
+
220
+ //#endregion
221
+ //#region src/utils/getUserAgent/getUserAgent.ts
222
+ /**
223
+ * Returns the browser's `navigator.userAgent` string for inclusion in
224
+ * instrumentation events.
225
+ *
226
+ * Falls back to an empty string in environments where `navigator` is not
227
+ * available (e.g., Node.js SSR, service workers) so that callers never need
228
+ * to guard against undefined.
229
+ * @not-instrumented
230
+ */
231
+ const getUserAgent = () => {
232
+ try {
233
+ return navigator.userAgent;
234
+ } catch {
235
+ return "";
236
+ }
237
+ };
238
+
239
+ //#endregion
240
+ //#region src/services/instrumentation/constants.ts
241
+ const DEFAULT_PII_FIELDS = [
242
+ "password",
243
+ "token",
244
+ "secret",
245
+ "privateKey",
246
+ "mnemonic",
247
+ "seed",
248
+ "email",
249
+ "phone",
250
+ "ssn",
251
+ "address",
252
+ "authorization"
253
+ ];
254
+ const REDACTED_VALUE = "[REDACTED]";
255
+ const MAX_STRING_LENGTH = 500;
256
+ const TRUNCATED_SUFFIX = "...[truncated]";
257
+ /**
258
+ * Label prefix for binary data placeholders. The full placeholder includes the
259
+ * byte length, e.g. `[Binary:16 bytes]`, so consumers can gauge data size
260
+ * without the actual bytes appearing in logs.
261
+ */
262
+ const BINARY_LABEL = "Binary";
263
+ /**
264
+ * Placeholder emitted when a circular reference is detected in the value tree.
265
+ * Using a named constant makes it easy to search for or filter in downstream
266
+ * log tooling.
267
+ */
268
+ const CIRCULAR_VALUE = "[Circular]";
269
+
270
+ //#endregion
271
+ //#region src/services/instrumentation/scrubParameters/scrubParameters.ts
272
+ const scrubString = ({ key, piiFieldsLower, redactAll, value }) => {
273
+ if (piiFieldsLower.includes(key.toLowerCase())) return REDACTED_VALUE;
274
+ if (redactAll) return REDACTED_VALUE;
275
+ if (value.length > MAX_STRING_LENGTH) return value.slice(0, MAX_STRING_LENGTH) + TRUNCATED_SUFFIX;
276
+ return value;
277
+ };
278
+ const scrubArray = ({ context, value }) => {
279
+ if (context.visited.has(value)) return [CIRCULAR_VALUE];
280
+ context.visited.add(value);
281
+ const result = value.map((item, index) => scrubValue({
282
+ context,
283
+ key: String(index),
284
+ value: item
285
+ }));
286
+ context.visited.delete(value);
287
+ return result;
288
+ };
289
+ const scrubObject = ({ context, value }) => {
290
+ if (context.visited.has(value)) return { [CIRCULAR_VALUE]: true };
291
+ context.visited.add(value);
292
+ const result = Object.create(null);
293
+ for (const key of Object.keys(value)) result[key] = scrubValue({
294
+ context,
295
+ key,
296
+ value: value[key]
297
+ });
298
+ context.visited.delete(value);
299
+ return result;
300
+ };
301
+ const scrubValue = ({ context, key, value }) => {
302
+ if (value === null || value === void 0) return value;
303
+ if (value instanceof Uint8Array) return `[${BINARY_LABEL}:${value.byteLength} bytes]`;
304
+ if (context.piiFieldsLower.includes(key.toLowerCase())) return REDACTED_VALUE;
305
+ if (typeof value === "string") return scrubString({
306
+ key,
307
+ piiFieldsLower: context.piiFieldsLower,
308
+ redactAll: context.redactAll,
309
+ value
310
+ });
311
+ if (Array.isArray(value)) return scrubArray({
312
+ context,
313
+ value
314
+ });
315
+ if (value instanceof Set) {
316
+ if (context.visited.has(value)) return [CIRCULAR_VALUE];
317
+ context.visited.add(value);
318
+ const setResult = scrubArray({
319
+ context,
320
+ value: [...value]
321
+ });
322
+ context.visited.delete(value);
323
+ return setResult;
324
+ }
325
+ if (value instanceof Map) {
326
+ if (context.visited.has(value)) return { [CIRCULAR_VALUE]: true };
327
+ context.visited.add(value);
328
+ const asObject = Object.create(null);
329
+ for (const [k, v] of value.entries()) asObject[String(k)] = v;
330
+ const mapResult = scrubObject({
331
+ context,
332
+ value: asObject
333
+ });
334
+ context.visited.delete(value);
335
+ return mapResult;
336
+ }
337
+ if (value instanceof WeakMap) return "[WeakMap]";
338
+ if (value instanceof WeakSet) return "[WeakSet]";
339
+ if (value instanceof Date) return value.toISOString();
340
+ if (value instanceof Error) return `[Error: ${value.message}]`;
341
+ if (typeof value === "object") return scrubObject({
342
+ context,
343
+ value
344
+ });
345
+ return value;
346
+ };
347
+ /** @not-instrumented */
348
+ const scrubParameters = ({ piiFields, redactAll, value }) => {
349
+ return scrubObject({
350
+ context: {
351
+ piiFieldsLower: piiFields.map((field) => field.toLowerCase()),
352
+ redactAll,
353
+ visited: /* @__PURE__ */ new WeakSet()
354
+ },
355
+ value
356
+ });
357
+ };
358
+
359
+ //#endregion
360
+ //#region src/services/instrumentation/instrumentFunction/extractParams/extractParams.ts
361
+ /**
362
+ * Normalises the raw positional arguments of an instrumented function call
363
+ * into a flat `Record<string, unknown>` suitable for structured logging.
364
+ *
365
+ * ## Why this is needed
366
+ *
367
+ * Instrumented functions are wrapped with `(...args: unknown[])`, so their
368
+ * parameters arrive as an array. Logging a raw array loses the semantic names
369
+ * of each argument. This function recovers a named representation:
370
+ *
371
+ * - **No arguments** → `{}`
372
+ * - **Single plain-object argument** → that object is returned as-is, because
373
+ * SDK functions follow the single-object-parameter convention, so the object
374
+ * already carries named keys (`{ amount, to }`, etc.).
375
+ * - **Everything else** (multiple args, a single primitive, a single array) →
376
+ * each value is indexed as `arg0`, `arg1`, …
377
+ *
378
+ * ## Why arrays are NOT treated as plain objects
379
+ *
380
+ * `typeof [] === 'object'` and `[] !== null`, so without the `Array.isArray`
381
+ * guard a single-array argument would be returned as-is. That would produce
382
+ * an object with numeric string keys (`{ '0': ..., '1': ... }`), which is
383
+ * misleading and inconsistent with how multi-arg calls are handled. Instead,
384
+ * arrays fall through to the indexed `arg0` path.
385
+ * @not-instrumented
386
+ */
387
+ const extractParams = (args) => {
388
+ if (args.length === 0) return {};
389
+ if (args.length === 1 && typeof args[0] === "object" && args[0] !== null && !Array.isArray(args[0])) return args[0];
390
+ const result = {};
391
+ for (let i = 0; i < args.length; i++) result[`arg${i}`] = args[i];
392
+ return result;
393
+ };
394
+
395
+ //#endregion
396
+ //#region src/services/instrumentation/instrumentFunction/scrubResolvedValue/scrubResolvedValue.ts
397
+ /**
398
+ * Scrubs a resolved return value of any type before logging it.
399
+ * Routes through `scrubParameters` by wrapping the value so that strings,
400
+ * arrays, Dates, Errors, and all other types are handled identically to
401
+ * nested object fields.
402
+ * @not-instrumented
403
+ */
404
+ const scrubResolvedValue = ({ piiFields, redactAll, value }) => scrubParameters({
405
+ piiFields,
406
+ redactAll,
407
+ value: { result: value }
408
+ }).result;
409
+
410
+ //#endregion
411
+ //#region src/services/instrumentation/instrumentFunction/instrumentFunction.ts
412
+ const serializeError = (error) => {
413
+ if (error instanceof Error) return {
414
+ message: error.message,
415
+ name: error.name,
416
+ stack: error.stack
417
+ };
418
+ return {
419
+ message: String(error),
420
+ name: "UnknownError"
421
+ };
422
+ };
423
+ /**
424
+ * Wraps a function so that each invocation emits a structured
425
+ * `FunctionInstrumentationEvent` at three lifecycle points:
426
+ *
427
+ * - **started** — immediately before the function body executes, with the
428
+ * PII-scrubbed call parameters.
429
+ * - **resolved** — after the function (or its returned Promise) settles
430
+ * successfully, with the PII-scrubbed return value.
431
+ * - **rejected** — if the function throws synchronously or its returned
432
+ * Promise rejects.
433
+ *
434
+ * The original return value (or thrown error) is always forwarded to the
435
+ * caller unchanged — instrumentation is purely observational.
436
+ *
437
+ * ## Usage
438
+ *
439
+ * ```ts
440
+ * const transfer = instrumentFunction({
441
+ * fn: rawTransfer,
442
+ * functionName: 'transfer',
443
+ * getCore: () => core,
444
+ * });
445
+ *
446
+ * // When called, three events are emitted automatically:
447
+ * await transfer({ amount: 1, to: '0xabc' });
448
+ * ```
449
+ *
450
+ * ## How functions are wrapped
451
+ *
452
+ * `instrumentFunction` is not called manually in application code. Instead,
453
+ * the esbuild instrumentation plugin (`tools/instrumentation-plugin`) injects
454
+ * it at build time: any exported function annotated with `@instrumented` in its
455
+ * JSDoc is automatically wrapped by the plugin during the build step.
456
+ * The plugin strips the original `export`, renames the function, and re-exports
457
+ * it under the original name via `instrumentFunction(...)` — so the public API
458
+ * is unchanged and no call sites need to be updated.
459
+ *
460
+ * ## Opting out
461
+ *
462
+ * Instrumentation is skipped entirely when:
463
+ * - `getCore()` returns `undefined` (SDK not initialised), or
464
+ * - `core.instrumentation.config.enabled` is `false`.
465
+ *
466
+ * In both cases the original function is called directly with no overhead.
467
+ *
468
+ * ## PII scrubbing
469
+ *
470
+ * All string values whose key appears in `piiFields` are replaced with
471
+ * `"[redacted]"` before events are emitted. Pass `redactAll: true` to redact
472
+ * every field, regardless of key name.
473
+ * @not-instrumented
474
+ */
475
+ const instrumentFunction = ({ fn, functionName, getCore: getCore$1, redactAll }) => {
476
+ const wrapped = (...args) => {
477
+ const core = getCore$1();
478
+ if (!core) return fn(...args);
479
+ if (!core.instrumentation.config.enabled) return fn(...args);
480
+ const instrumentation = core.instrumentation;
481
+ const state = core.state.get();
482
+ const baseEvent = {
483
+ environmentId: core.environmentId,
484
+ functionName,
485
+ parameters: scrubParameters({
486
+ piiFields: instrumentation.config.piiFields,
487
+ redactAll,
488
+ value: extractParams(args)
489
+ }),
490
+ sdkSessionId: core.sdkSessionId,
491
+ sdkVersion: core.version,
492
+ status: "info",
493
+ tokenSessionId: state.token ? extractSessionId(state.token) : null,
494
+ userAgent: getUserAgent(),
495
+ userId: state.user?.id ?? null
496
+ };
497
+ instrumentation.logFunction({
498
+ ...baseEvent,
499
+ phase: "started",
500
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
501
+ });
502
+ try {
503
+ const result = fn(...args);
504
+ if (result instanceof Promise) return result.then((value) => {
505
+ instrumentation.logFunction({
506
+ ...baseEvent,
507
+ phase: "resolved",
508
+ resolvedValue: scrubResolvedValue({
509
+ piiFields: instrumentation.config.piiFields,
510
+ redactAll,
511
+ value
512
+ }),
513
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
514
+ });
515
+ return value;
516
+ }).catch((error) => {
517
+ instrumentation.logFunction({
518
+ ...baseEvent,
519
+ phase: "rejected",
520
+ rejectedError: serializeError(error),
521
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
522
+ });
523
+ throw error;
524
+ });
525
+ instrumentation.logFunction({
526
+ ...baseEvent,
527
+ phase: "resolved",
528
+ resolvedValue: scrubResolvedValue({
529
+ piiFields: instrumentation.config.piiFields,
530
+ redactAll,
531
+ value: result
532
+ }),
533
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
534
+ });
535
+ return result;
536
+ } catch (error) {
537
+ instrumentation.logFunction({
538
+ ...baseEvent,
539
+ phase: "rejected",
540
+ rejectedError: serializeError(error),
541
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
542
+ });
543
+ throw error;
544
+ }
545
+ };
546
+ return wrapped;
547
+ };
548
+
198
549
  //#endregion
199
550
  //#region src/modules/sessionKeys/getSessionKeys/getSessionKeys.ts
200
551
  /** @instrumented */
@@ -203,6 +554,18 @@ const getSessionKeys = (client) => {
203
554
  if (!publicKey) return;
204
555
  return { publicKey };
205
556
  };
557
+ const __getSessionKeys_impl = getSessionKeys;
558
+ const __getSessionKeys_wrapped = instrumentFunction({
559
+ fn: __getSessionKeys_impl,
560
+ functionName: "getSessionKeys",
561
+ getCore: () => {
562
+ try {
563
+ return getCore(getDefaultClient());
564
+ } catch {
565
+ return;
566
+ }
567
+ }
568
+ });
206
569
 
207
570
  //#endregion
208
571
  //#region src/modules/auth/getElevatedAccessToken/getElevatedAccessToken.ts
@@ -246,6 +609,18 @@ const getElevatedAccessToken = ({ consume = true, scope }, client = getDefaultCl
246
609
  }
247
610
  return token.token;
248
611
  };
612
+ const __getElevatedAccessToken_impl = getElevatedAccessToken;
613
+ const __getElevatedAccessToken_wrapped = instrumentFunction({
614
+ fn: __getElevatedAccessToken_impl,
615
+ functionName: "getElevatedAccessToken",
616
+ getCore: () => {
617
+ try {
618
+ return getCore(getDefaultClient());
619
+ } catch {
620
+ return;
621
+ }
622
+ }
623
+ });
249
624
 
250
625
  //#endregion
251
626
  //#region src/errors/APIError/APIError.ts
@@ -428,6 +803,18 @@ const getNonce = async (client) => {
428
803
  await fetchAndStoreNonces(client);
429
804
  return getNonce(client);
430
805
  };
806
+ const __getNonce_impl = getNonce;
807
+ const __getNonce_wrapped = instrumentFunction({
808
+ fn: __getNonce_impl,
809
+ functionName: "getNonce",
810
+ getCore: () => {
811
+ try {
812
+ return getCore(getDefaultClient());
813
+ } catch {
814
+ return;
815
+ }
816
+ }
817
+ });
431
818
 
432
819
  //#endregion
433
820
  //#region src/modules/deviceRegistration/getDeviceSigner/getDeviceSigner.ts
@@ -446,6 +833,18 @@ const getDeviceSigner = async (client) => {
446
833
  sign: (payload) => keychain.sign(keyName, payload)
447
834
  };
448
835
  };
836
+ const __getDeviceSigner_impl = getDeviceSigner;
837
+ const __getDeviceSigner_wrapped = instrumentFunction({
838
+ fn: __getDeviceSigner_impl,
839
+ functionName: "getDeviceSigner",
840
+ getCore: () => {
841
+ try {
842
+ return getCore(getDefaultClient());
843
+ } catch {
844
+ return;
845
+ }
846
+ }
847
+ });
449
848
 
450
849
  //#endregion
451
850
  //#region src/modules/deviceRegistration/getHeadersForNonceSignedByDeviceSigners/getHeadersForNonceSignedByDeviceSigners.ts
@@ -459,8 +858,8 @@ const getHeadersForNonceSignedByDeviceSigners = async (client) => {
459
858
  * Then we dont need to provide the headers
460
859
  */
461
860
  if (isCookieEnabled(client)) return {};
462
- const deviceSigner = await getDeviceSigner(client);
463
- const nonce = await getNonce(client);
861
+ const deviceSigner = await __getDeviceSigner_wrapped(client);
862
+ const nonce = await __getNonce_wrapped(client);
464
863
  const signedNonce = await deviceSigner.sign(nonce);
465
864
  const publicKey = await deviceSigner.getPublicKey();
466
865
  return {
@@ -469,6 +868,18 @@ const getHeadersForNonceSignedByDeviceSigners = async (client) => {
469
868
  "x-dynamic-device-signed-nonce": signedNonce
470
869
  };
471
870
  };
871
+ const __getHeadersForNonceSignedByDeviceSigners_impl = getHeadersForNonceSignedByDeviceSigners;
872
+ const __getHeadersForNonceSignedByDeviceSigners_wrapped = instrumentFunction({
873
+ fn: __getHeadersForNonceSignedByDeviceSigners_impl,
874
+ functionName: "getHeadersForNonceSignedByDeviceSigners",
875
+ getCore: () => {
876
+ try {
877
+ return getCore(getDefaultClient());
878
+ } catch {
879
+ return;
880
+ }
881
+ }
882
+ });
472
883
 
473
884
  //#endregion
474
885
  //#region src/modules/apiClient/utils/deviceSignatureHeadersMiddleware/createDeviceSignatureHeadersMiddleware.ts
@@ -479,7 +890,7 @@ const createDeviceSignatureHeadersMiddleware = (client) => {
479
890
  * The signed nonce is not required for cookie based environments.
480
891
  */
481
892
  if ((0, _dynamic_labs_sdk_api_core.isDeviceNonceSignatureRequiredForUrl)(context.url) && !isCookieEnabled(client)) {
482
- const deviceSignerHeaders = await getHeadersForNonceSignedByDeviceSigners(client);
893
+ const deviceSignerHeaders = await __getHeadersForNonceSignedByDeviceSigners_wrapped(client);
483
894
  return {
484
895
  init: {
485
896
  ...context.init,
@@ -493,6 +904,18 @@ const createDeviceSignatureHeadersMiddleware = (client) => {
493
904
  }
494
905
  } };
495
906
  };
907
+ const __createDeviceSignatureHeadersMiddleware_impl = createDeviceSignatureHeadersMiddleware;
908
+ const __createDeviceSignatureHeadersMiddleware_wrapped = instrumentFunction({
909
+ fn: __createDeviceSignatureHeadersMiddleware_impl,
910
+ functionName: "createDeviceSignatureHeadersMiddleware",
911
+ getCore: () => {
912
+ try {
913
+ return getCore(getDefaultClient());
914
+ } catch {
915
+ return;
916
+ }
917
+ }
918
+ });
496
919
 
497
920
  //#endregion
498
921
  //#region src/errors/UnauthorizedError.ts
@@ -550,22 +973,34 @@ const createApiClient = (options = {}, client) => {
550
973
  if (client.projectSettings && isCookieEnabled(client)) settings.credentials = "include";
551
974
  if (options.includeMfaToken && coreState.mfaToken) settings.headers[MFA_TOKEN_HEADER] = coreState.mfaToken;
552
975
  if (options.elevatedAccessTokenScope) {
553
- const elevatedToken = getElevatedAccessToken({ scope: options.elevatedAccessTokenScope }, client);
976
+ const elevatedToken = __getElevatedAccessToken_wrapped({ scope: options.elevatedAccessTokenScope }, client);
554
977
  if (elevatedToken) settings.headers[ELEVATED_ACCESS_TOKEN_HEADER] = elevatedToken;
555
978
  }
556
- const sessionPublicKey = getSessionKeys(client)?.publicKey;
979
+ const sessionPublicKey = __getSessionKeys_wrapped(client)?.publicKey;
557
980
  const isSessionPublicKeyHeaderPresent = settings.headers[SESSION_PUBLIC_KEY_HEADER] !== void 0;
558
981
  if (sessionPublicKey && !isSessionPublicKeyHeaderPresent) settings.headers[SESSION_PUBLIC_KEY_HEADER] = sessionPublicKey;
559
982
  return new _dynamic_labs_sdk_api_core.SDKApi(new _dynamic_labs_sdk_api_core.Configuration({
560
983
  ...settings,
561
984
  fetchApi: core.fetch,
562
985
  middleware: [
563
- createDeviceSignatureHeadersMiddleware(client),
986
+ __createDeviceSignatureHeadersMiddleware_wrapped(client),
564
987
  createConvertToApiErrorMiddleware({ errorMappers: [...options.errorMappers || [], clientErrorMapper] }),
565
988
  createUnauthorizedMiddleware()
566
989
  ]
567
990
  }));
568
991
  };
992
+ const __createApiClient_impl = createApiClient;
993
+ const __createApiClient_wrapped = instrumentFunction({
994
+ fn: __createApiClient_impl,
995
+ functionName: "createApiClient",
996
+ getCore: () => {
997
+ try {
998
+ return getCore(getDefaultClient());
999
+ } catch {
1000
+ return;
1001
+ }
1002
+ }
1003
+ });
569
1004
 
570
1005
  //#endregion
571
1006
  //#region src/utils/getNonce/fetchAndStoreNonces/fetchAndStoreNonces.ts
@@ -583,7 +1018,7 @@ const createApiClient = (options = {}, client) => {
583
1018
  const fetchAndStoreNonces = async (client) => {
584
1019
  const core = getCore(client);
585
1020
  const { environmentId } = core;
586
- const { nonces } = await createApiClient({}, client).getNonces({
1021
+ const { nonces } = await __createApiClient_wrapped({}, client).getNonces({
587
1022
  count: NONCE_POOL_SIZE,
588
1023
  environmentId
589
1024
  });
@@ -636,6 +1071,11 @@ const CHAINS_INFO_MAP = {
636
1071
  blockchainName: "Flow",
637
1072
  verifiedCredentialChainName: "flow"
638
1073
  },
1074
+ MIDNIGHT: {
1075
+ apiChainName: "midnight",
1076
+ blockchainName: "Midnight",
1077
+ verifiedCredentialChainName: "midnight"
1078
+ },
639
1079
  SOL: {
640
1080
  apiChainName: "solana",
641
1081
  blockchainName: "Solana",
@@ -687,6 +1127,18 @@ const getChainFromVerifiedCredentialChain = (verifiedCredentialChain) => {
687
1127
  assertDefined(chain, `Unknown chain: ${verifiedCredentialChain}`);
688
1128
  return chain;
689
1129
  };
1130
+ const __getChainFromVerifiedCredentialChain_impl = getChainFromVerifiedCredentialChain;
1131
+ const __getChainFromVerifiedCredentialChain_wrapped = instrumentFunction({
1132
+ fn: __getChainFromVerifiedCredentialChain_impl,
1133
+ functionName: "getChainFromVerifiedCredentialChain",
1134
+ getCore: () => {
1135
+ try {
1136
+ return getCore(getDefaultClient());
1137
+ } catch {
1138
+ return;
1139
+ }
1140
+ }
1141
+ });
690
1142
 
691
1143
  //#endregion
692
1144
  //#region src/constants.ts
@@ -748,6 +1200,12 @@ Object.defineProperty(exports, 'ClientNotFoundError', {
748
1200
  return ClientNotFoundError;
749
1201
  }
750
1202
  });
1203
+ Object.defineProperty(exports, 'DEFAULT_PII_FIELDS', {
1204
+ enumerable: true,
1205
+ get: function () {
1206
+ return DEFAULT_PII_FIELDS;
1207
+ }
1208
+ });
751
1209
  Object.defineProperty(exports, 'DEFAULT_WAAS_BASE_API_URL', {
752
1210
  enumerable: true,
753
1211
  get: function () {
@@ -838,76 +1296,94 @@ Object.defineProperty(exports, 'ValueMustBeDefinedError', {
838
1296
  return ValueMustBeDefinedError;
839
1297
  }
840
1298
  });
841
- Object.defineProperty(exports, 'assertDefined', {
1299
+ Object.defineProperty(exports, '__createApiClient_wrapped', {
842
1300
  enumerable: true,
843
1301
  get: function () {
844
- return assertDefined;
1302
+ return __createApiClient_wrapped;
845
1303
  }
846
1304
  });
847
- Object.defineProperty(exports, 'createApiClient', {
1305
+ Object.defineProperty(exports, '__createDeviceSignatureHeadersMiddleware_wrapped', {
848
1306
  enumerable: true,
849
1307
  get: function () {
850
- return createApiClient;
1308
+ return __createDeviceSignatureHeadersMiddleware_wrapped;
851
1309
  }
852
1310
  });
853
- Object.defineProperty(exports, 'createDeviceSignatureHeadersMiddleware', {
1311
+ Object.defineProperty(exports, '__getChainFromVerifiedCredentialChain_wrapped', {
854
1312
  enumerable: true,
855
1313
  get: function () {
856
- return createDeviceSignatureHeadersMiddleware;
1314
+ return __getChainFromVerifiedCredentialChain_wrapped;
857
1315
  }
858
1316
  });
859
- Object.defineProperty(exports, 'fetchAndStoreNonces', {
1317
+ Object.defineProperty(exports, '__getDeviceSigner_wrapped', {
860
1318
  enumerable: true,
861
1319
  get: function () {
862
- return fetchAndStoreNonces;
1320
+ return __getDeviceSigner_wrapped;
863
1321
  }
864
1322
  });
865
- Object.defineProperty(exports, 'getChainFromVerifiedCredentialChain', {
1323
+ Object.defineProperty(exports, '__getElevatedAccessToken_wrapped', {
866
1324
  enumerable: true,
867
1325
  get: function () {
868
- return getChainFromVerifiedCredentialChain;
1326
+ return __getElevatedAccessToken_wrapped;
869
1327
  }
870
1328
  });
871
- Object.defineProperty(exports, 'getCore', {
1329
+ Object.defineProperty(exports, '__getHeadersForNonceSignedByDeviceSigners_wrapped', {
872
1330
  enumerable: true,
873
1331
  get: function () {
874
- return getCore;
1332
+ return __getHeadersForNonceSignedByDeviceSigners_wrapped;
875
1333
  }
876
1334
  });
877
- Object.defineProperty(exports, 'getDefaultClient', {
1335
+ Object.defineProperty(exports, '__getNonce_wrapped', {
878
1336
  enumerable: true,
879
1337
  get: function () {
880
- return getDefaultClient;
1338
+ return __getNonce_wrapped;
881
1339
  }
882
1340
  });
883
- Object.defineProperty(exports, 'getDeviceSigner', {
1341
+ Object.defineProperty(exports, '__getSessionKeys_wrapped', {
884
1342
  enumerable: true,
885
1343
  get: function () {
886
- return getDeviceSigner;
1344
+ return __getSessionKeys_wrapped;
887
1345
  }
888
1346
  });
889
- Object.defineProperty(exports, 'getElevatedAccessToken', {
1347
+ Object.defineProperty(exports, 'assertDefined', {
1348
+ enumerable: true,
1349
+ get: function () {
1350
+ return assertDefined;
1351
+ }
1352
+ });
1353
+ Object.defineProperty(exports, 'extractSessionId', {
1354
+ enumerable: true,
1355
+ get: function () {
1356
+ return extractSessionId;
1357
+ }
1358
+ });
1359
+ Object.defineProperty(exports, 'fetchAndStoreNonces', {
1360
+ enumerable: true,
1361
+ get: function () {
1362
+ return fetchAndStoreNonces;
1363
+ }
1364
+ });
1365
+ Object.defineProperty(exports, 'getCore', {
890
1366
  enumerable: true,
891
1367
  get: function () {
892
- return getElevatedAccessToken;
1368
+ return getCore;
893
1369
  }
894
1370
  });
895
- Object.defineProperty(exports, 'getHeadersForNonceSignedByDeviceSigners', {
1371
+ Object.defineProperty(exports, 'getDefaultClient', {
896
1372
  enumerable: true,
897
1373
  get: function () {
898
- return getHeadersForNonceSignedByDeviceSigners;
1374
+ return getDefaultClient;
899
1375
  }
900
1376
  });
901
- Object.defineProperty(exports, 'getNonce', {
1377
+ Object.defineProperty(exports, 'getUserAgent', {
902
1378
  enumerable: true,
903
1379
  get: function () {
904
- return getNonce;
1380
+ return getUserAgent;
905
1381
  }
906
1382
  });
907
- Object.defineProperty(exports, 'getSessionKeys', {
1383
+ Object.defineProperty(exports, 'instrumentFunction', {
908
1384
  enumerable: true,
909
1385
  get: function () {
910
- return getSessionKeys;
1386
+ return instrumentFunction;
911
1387
  }
912
1388
  });
913
1389
  Object.defineProperty(exports, 'isCookieEnabled', {
@@ -940,4 +1416,4 @@ Object.defineProperty(exports, 'version', {
940
1416
  return version;
941
1417
  }
942
1418
  });
943
- //# sourceMappingURL=InvalidParamError-C9egR24p.cjs.js.map
1419
+ //# sourceMappingURL=InvalidParamError-D7xRBKr4.cjs.js.map