@circle-fin/app-kit 1.10.0 → 1.11.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/CHANGELOG.md CHANGED
@@ -1,5 +1,39 @@
1
1
  # @circle-fin/app-kit
2
2
 
3
+ ## 1.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - AppKit now accepts `disableAnalytics` to turn off success analytics in its
8
+ underlying EarnKit, SwapKit, and UnifiedBalanceKit operations. Use the existing
9
+ `disableErrorReporting` option to turn off error reporting.
10
+
11
+ ### Patch Changes
12
+
13
+ - Clarify Unified Balance `removeFund` documentation as a recovery path with a
14
+ 7-day withdrawal delay.
15
+ - Make the SDK safe to bundle and run in browsers/client-side apps.
16
+
17
+ - Browser requests omit Node-only headers that would cause CORS failures, including EarnKit’s SDK-version header.
18
+ - Solana operations in App Kit, Adapter Solana Kit, and Gateway work in a browser without requiring a consumer-provided `Buffer` polyfill.
19
+ - Supplying a `kitKey` or Circle Wallets `apiKey` in a browser now fails early. Keep those secrets on the server and forward a prepared transaction or other safe result to the client.
20
+
21
+ - EarnKit now sends structured telemetry for public-operation errors and for
22
+ completed vault lookups, vault discovery, deposits, withdrawals, and reward
23
+ claims. No code changes are required. Telemetry is enabled by default and
24
+ contains no wallet addresses or amounts. To opt out when constructing
25
+ `EarnKit`:
26
+
27
+ ```ts
28
+ const kit = new EarnKit({
29
+ disableAnalytics: true,
30
+ disableErrorReporting: true,
31
+ });
32
+ ```
33
+
34
+ AppKit now forwards its existing `disableErrorReporting` option to its EarnKit
35
+ operations.
36
+
3
37
  ## 1.10.0
4
38
 
5
39
  ### Minor Changes
package/bridge.cjs CHANGED
@@ -18,6 +18,17 @@
18
18
 
19
19
  'use strict';
20
20
 
21
+ // Buffer polyfill setup - executes before any other code
22
+ // Ensures globalThis.Buffer is available for Solana libraries
23
+ const { Buffer } = require('buffer');
24
+ if (typeof globalThis !== 'undefined' && typeof globalThis.Buffer === 'undefined') {
25
+ globalThis.Buffer = Buffer;
26
+ }
27
+ if (typeof window !== 'undefined' && typeof window.Buffer === 'undefined') {
28
+ window.Buffer = Buffer;
29
+ }
30
+
31
+
21
32
  var zod = require('zod');
22
33
  var pino = require('pino');
23
34
  var units = require('@ethersproject/units');
@@ -51,6 +62,27 @@ var bs58__default = /*#__PURE__*/_interopDefault(bs58);
51
62
  * }
52
63
  * ```
53
64
  */ const isNodeEnvironment = ()=>typeof process !== 'undefined' && typeof process.versions === 'object' && typeof process.versions.node === 'string';
65
+ /**
66
+ * Return the SDK User-Agent request header only when running in Node.js.
67
+ *
68
+ * Browsers forbid manually setting `User-Agent`, and a custom fallback header
69
+ * can trigger CORS preflight. Non-Node server runtimes also omit this optional
70
+ * attribution header because they cannot set it reliably.
71
+ *
72
+ * @returns A User-Agent header in Node.js, or an empty object otherwise.
73
+ *
74
+ * @example
75
+ * ```typescript
76
+ * import { getNodeUserAgentHeader } from '@core/utils'
77
+ *
78
+ * const headers = {
79
+ * 'Content-Type': 'application/json',
80
+ * ...getNodeUserAgentHeader(),
81
+ * }
82
+ * ```
83
+ */ const getNodeUserAgentHeader = ()=>isNodeEnvironment() ? {
84
+ 'User-Agent': getUserAgent()
85
+ } : {};
54
86
  /**
55
87
  * Detect the runtime environment and return a shortened identifier.
56
88
  *
@@ -7477,13 +7509,12 @@ const swapTokenEnumSchema = zod.z.enum([
7477
7509
  headers: {
7478
7510
  ...DEFAULT_CONFIG$1.headers,
7479
7511
  ...config.headers ?? {},
7480
- // In browser environments, directly setting the 'User-Agent' or similar headers is restricted and may be ignored or cause errors.
7481
- // This is why we use the 'X-User-Agent' header instead.
7482
- ...typeof window === 'undefined' ? {
7483
- 'User-Agent': getUserAgent()
7484
- } : {
7485
- 'X-User-Agent': getUserAgent()
7486
- }
7512
+ // Browsers forbid setting a user-agent request header, and the custom
7513
+ // fallback header the SDK used instead trips CORS preflight against the
7514
+ // Circle APIs (it isn't in their `Access-Control-Allow-Headers`),
7515
+ // blocking the request. So send the SDK user agent only in Node;
7516
+ // browsers omit it entirely.
7517
+ ...getNodeUserAgentHeader()
7487
7518
  }
7488
7519
  };
7489
7520
  let lastError;
@@ -9269,6 +9300,7 @@ function resolveOptions(options) {
9269
9300
  if (payload.tokenIn !== undefined) safe['tokenIn'] = payload.tokenIn;
9270
9301
  if (payload.tokenOut !== undefined) safe['tokenOut'] = payload.tokenOut;
9271
9302
  if (payload.txHash !== undefined) safe['txHash'] = payload.txHash;
9303
+ if (payload.correlationId !== undefined) safe['correlationId'] = payload.correlationId;
9272
9304
  if (payload.errorDetails !== undefined) {
9273
9305
  const errorDetails = {
9274
9306
  ...payload.errorDetails.errorCode !== undefined && {
@@ -9339,18 +9371,15 @@ function resolveOptions(options) {
9339
9371
  timeoutHandle.unref();
9340
9372
  }
9341
9373
  try {
9342
- const isNode = isNodeEnvironment();
9343
- const userAgent = getUserAgent();
9344
9374
  await fetch(getLogsUrl(), {
9345
9375
  method: 'POST',
9346
9376
  headers: {
9347
9377
  'Content-Type': 'application/json',
9348
- // Browser restricts setting User-Agent; use X-User-Agent instead.
9349
- ...isNode ? {
9350
- 'User-Agent': userAgent
9351
- } : {
9352
- 'X-User-Agent': userAgent
9353
- }
9378
+ // Browsers forbid setting a user-agent request header, and the custom
9379
+ // fallback header the SDK used instead trips CORS preflight (it isn't
9380
+ // in the telemetry endpoint's `Access-Control-Allow-Headers`), so send
9381
+ // it only in Node; browsers omit it entirely.
9382
+ ...getNodeUserAgentHeader()
9354
9383
  },
9355
9384
  body: JSON.stringify(toSafePayload(payload)),
9356
9385
  signal: controller.signal
@@ -9481,7 +9510,7 @@ function resolveOptions(options) {
9481
9510
  // discards the stack trace, nested `cause`, and any custom Error
9482
9511
  // properties — exactly the context an on-call needs when a
9483
9512
  // resolver-closure regression triggers this path.
9484
- console.warn(`[stablecoin-kits telemetry] dropped error event '${eventType}':`, cause);
9513
+ console.warn(`[stablecoin-kits telemetry] dropped event '${eventType}':`, cause);
9485
9514
  } catch {
9486
9515
  // console.warn itself throwing is the user's environment; nothing more we
9487
9516
  // can do without risking the original operation error.
@@ -9497,7 +9526,9 @@ function resolveOptions(options) {
9497
9526
  sdkVersion: config.sdkVersion,
9498
9527
  eventType,
9499
9528
  timestamp: new Date().toISOString(),
9500
- errorDetails,
9529
+ ...errorDetails !== undefined && {
9530
+ errorDetails
9531
+ },
9501
9532
  clientContext: buildClientContext(),
9502
9533
  ...context?.sourceChain != null && {
9503
9534
  sourceChain: context.sourceChain
@@ -9513,6 +9544,9 @@ function resolveOptions(options) {
9513
9544
  },
9514
9545
  ...context?.txHash != null && {
9515
9546
  txHash: context.txHash
9547
+ },
9548
+ ...context?.correlationId != null && {
9549
+ correlationId: context.correlationId
9516
9550
  }
9517
9551
  };
9518
9552
  }
@@ -9626,7 +9660,7 @@ function resolveOptions(options) {
9626
9660
  }
9627
9661
 
9628
9662
  var name$2 = "@circle-fin/bridge-kit";
9629
- var version$3 = "1.12.1";
9663
+ var version$3 = "1.12.2";
9630
9664
  var pkg$3 = {
9631
9665
  name: name$2,
9632
9666
  version: version$3};
@@ -12223,7 +12257,13 @@ const FAST_TIER_FINALITY_THRESHOLD = 1000;
12223
12257
  /**
12224
12258
  * The ASCII "cctp-forward" magic, hex-encoded (no `0x`), that a forward-friendly
12225
12259
  * hookData must start with.
12226
- */ const CCTP_FORWARD_MAGIC_HEX = Buffer.from(CCTP_FORWARD_MAGIC_PREFIX, 'ascii').toString('hex');
12260
+ *
12261
+ * Encoded with `TextEncoder` (a browser-safe Web API) rather than `Buffer.from`
12262
+ * so this module-level constant does not reference the Node `Buffer` global at
12263
+ * import time. App Kit inlines this provider into its bundle without a Buffer polyfill, and a
12264
+ * bare `Buffer` here crashes browser bundles (e.g. Vite) on load — even for apps
12265
+ * that never touch the prepaid FORWARD path. Mirrors `buildForwardingHookData`.
12266
+ */ const CCTP_FORWARD_MAGIC_HEX = Array.from(new TextEncoder().encode(CCTP_FORWARD_MAGIC_PREFIX)).map((byte)=>byte.toString(16).padStart(2, '0')).join('');
12227
12267
  /**
12228
12268
  * Determine whether a hookData blob begins with the `cctp-forward` envelope.
12229
12269
  *
@@ -14661,7 +14701,7 @@ const mockAttestationMessage = {
14661
14701
  return step;
14662
14702
  }
14663
14703
 
14664
- var version$2 = "1.10.0";
14704
+ var version$2 = "1.10.1";
14665
14705
  var pkg$2 = {
14666
14706
  version: version$2};
14667
14707
 
@@ -17275,7 +17315,7 @@ registerKit(`${pkg$3.name}/${pkg$3.version}`);
17275
17315
  };
17276
17316
 
17277
17317
  var name$1 = "@circle-fin/swap-kit";
17278
- var version$1 = "1.4.0";
17318
+ var version$1 = "1.5.0";
17279
17319
  var pkg$1 = {
17280
17320
  name: name$1,
17281
17321
  version: version$1};
@@ -18016,6 +18056,16 @@ getQuoteRequestBaseSchema.superRefine(requireCrossChainQuoteToAddress);
18016
18056
  required_error: 'estimatedAmount is required',
18017
18057
  invalid_type_error: 'estimatedAmount must be a string'
18018
18058
  }).min(1, 'estimatedAmount must be a non-empty string'),
18059
+ // Per-swap join key echoed back verbatim on success telemetry. Optional so a
18060
+ // not-yet-upgraded service (no field) still validates during rollout. A
18061
+ // malformed/non-UUID value is coerced to `undefined` (no telemetry id) rather
18062
+ // than throwing: this is a telemetry-only field (stripped from the developer
18063
+ // result, never used for control flow), so it must not be able to abort the
18064
+ // swap via `parseCreateSwapResponse().parse()`. Mirrors the best-effort,
18065
+ // never-throw contract of the rest of the telemetry stack. Implemented with
18066
+ // `preprocess` rather than Zod's `.catch()` because static analysis misreads
18067
+ // `.catch` on the schema chain as an unhandled Promise (S7785).
18068
+ correlationId: zod.z.preprocess((value)=>zod.z.string().uuid().safeParse(value).success ? value : undefined, zod.z.string().optional()),
18019
18069
  config: createSwapRequestBaseSchema.shape.config.optional(),
18020
18070
  fees: createSwapFeesSchema.optional(),
18021
18071
  transaction: createSwapTransactionSchema
@@ -19208,7 +19258,7 @@ new Set(Object.values(Blockchain));
19208
19258
  registerKit(`${pkg$1.name}/${pkg$1.version}`);
19209
19259
 
19210
19260
  var name = "@circle-fin/earn-kit";
19211
- var version = "1.3.0";
19261
+ var version = "1.4.0";
19212
19262
  var pkg = {
19213
19263
  name: name,
19214
19264
  version: version};
@@ -20672,6 +20722,8 @@ function hasCrossChainDepositQuoteShape(params) {
20672
20722
  config: earnConfigSchema.optional()
20673
20723
  });
20674
20724
 
20725
+ /** SDK name used in telemetry payloads. */ resolveKitSdkName(pkg.name);
20726
+
20675
20727
  // Auto-register this kit for user agent tracking
20676
20728
  registerKit(`${pkg.name}/${pkg.version}`);
20677
20729
 
package/bridge.d.cts CHANGED
@@ -6691,10 +6691,21 @@ interface AppKitContext {
6691
6691
  * ```
6692
6692
  */
6693
6693
  actions: Record<'bridge' | 'earn', Record<string, ((payload: unknown) => void)[]>>;
6694
+ /**
6695
+ * Disable success analytics for the underlying EarnKit, SwapKit, and
6696
+ * UnifiedBalanceKit.
6697
+ *
6698
+ * When `true`, completed earn, swap, and unified balance operations will not
6699
+ * POST analytics events. This does not disable error reporting; use
6700
+ * {@link AppKitContext.disableErrorReporting} for that. Defaults to `false`.
6701
+ *
6702
+ * @defaultValue false
6703
+ */
6704
+ disableAnalytics?: boolean;
6694
6705
  /**
6695
6706
  * Disable error telemetry for all sub-kits.
6696
6707
  *
6697
- * When `true`, none of the underlying kits (BridgeKit, SwapKit,
6708
+ * When `true`, none of the underlying kits (BridgeKit, SwapKit, EarnKit,
6698
6709
  * UnifiedBalanceKit) will POST error details to the telemetry
6699
6710
  * endpoint when operations throw. Defaults to `false` (enabled).
6700
6711
  *
package/bridge.d.mts CHANGED
@@ -6691,10 +6691,21 @@ interface AppKitContext {
6691
6691
  * ```
6692
6692
  */
6693
6693
  actions: Record<'bridge' | 'earn', Record<string, ((payload: unknown) => void)[]>>;
6694
+ /**
6695
+ * Disable success analytics for the underlying EarnKit, SwapKit, and
6696
+ * UnifiedBalanceKit.
6697
+ *
6698
+ * When `true`, completed earn, swap, and unified balance operations will not
6699
+ * POST analytics events. This does not disable error reporting; use
6700
+ * {@link AppKitContext.disableErrorReporting} for that. Defaults to `false`.
6701
+ *
6702
+ * @defaultValue false
6703
+ */
6704
+ disableAnalytics?: boolean;
6694
6705
  /**
6695
6706
  * Disable error telemetry for all sub-kits.
6696
6707
  *
6697
- * When `true`, none of the underlying kits (BridgeKit, SwapKit,
6708
+ * When `true`, none of the underlying kits (BridgeKit, SwapKit, EarnKit,
6698
6709
  * UnifiedBalanceKit) will POST error details to the telemetry
6699
6710
  * endpoint when operations throw. Defaults to `false` (enabled).
6700
6711
  *
package/bridge.d.ts CHANGED
@@ -6691,10 +6691,21 @@ interface AppKitContext {
6691
6691
  * ```
6692
6692
  */
6693
6693
  actions: Record<'bridge' | 'earn', Record<string, ((payload: unknown) => void)[]>>;
6694
+ /**
6695
+ * Disable success analytics for the underlying EarnKit, SwapKit, and
6696
+ * UnifiedBalanceKit.
6697
+ *
6698
+ * When `true`, completed earn, swap, and unified balance operations will not
6699
+ * POST analytics events. This does not disable error reporting; use
6700
+ * {@link AppKitContext.disableErrorReporting} for that. Defaults to `false`.
6701
+ *
6702
+ * @defaultValue false
6703
+ */
6704
+ disableAnalytics?: boolean;
6694
6705
  /**
6695
6706
  * Disable error telemetry for all sub-kits.
6696
6707
  *
6697
- * When `true`, none of the underlying kits (BridgeKit, SwapKit,
6708
+ * When `true`, none of the underlying kits (BridgeKit, SwapKit, EarnKit,
6698
6709
  * UnifiedBalanceKit) will POST error details to the telemetry
6699
6710
  * endpoint when operations throw. Defaults to `false` (enabled).
6700
6711
  *
package/bridge.mjs CHANGED
@@ -16,6 +16,17 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
+ // Buffer polyfill setup - executes before any other code
20
+ // Ensures globalThis.Buffer is available for Solana libraries
21
+ import { Buffer } from 'buffer';
22
+ if (typeof globalThis !== 'undefined' && typeof globalThis.Buffer === 'undefined') {
23
+ globalThis.Buffer = Buffer;
24
+ }
25
+ if (typeof window !== 'undefined' && typeof window.Buffer === 'undefined') {
26
+ window.Buffer = Buffer;
27
+ }
28
+
29
+
19
30
  import { z } from 'zod';
20
31
  import pino from 'pino';
21
32
  import { formatUnits as formatUnits$1, parseUnits as parseUnits$1 } from '@ethersproject/units';
@@ -44,6 +55,27 @@ import { keccak256 } from '@ethersproject/keccak256';
44
55
  * }
45
56
  * ```
46
57
  */ const isNodeEnvironment = ()=>typeof process !== 'undefined' && typeof process.versions === 'object' && typeof process.versions.node === 'string';
58
+ /**
59
+ * Return the SDK User-Agent request header only when running in Node.js.
60
+ *
61
+ * Browsers forbid manually setting `User-Agent`, and a custom fallback header
62
+ * can trigger CORS preflight. Non-Node server runtimes also omit this optional
63
+ * attribution header because they cannot set it reliably.
64
+ *
65
+ * @returns A User-Agent header in Node.js, or an empty object otherwise.
66
+ *
67
+ * @example
68
+ * ```typescript
69
+ * import { getNodeUserAgentHeader } from '@core/utils'
70
+ *
71
+ * const headers = {
72
+ * 'Content-Type': 'application/json',
73
+ * ...getNodeUserAgentHeader(),
74
+ * }
75
+ * ```
76
+ */ const getNodeUserAgentHeader = ()=>isNodeEnvironment() ? {
77
+ 'User-Agent': getUserAgent()
78
+ } : {};
47
79
  /**
48
80
  * Detect the runtime environment and return a shortened identifier.
49
81
  *
@@ -7470,13 +7502,12 @@ const swapTokenEnumSchema = z.enum([
7470
7502
  headers: {
7471
7503
  ...DEFAULT_CONFIG$1.headers,
7472
7504
  ...config.headers ?? {},
7473
- // In browser environments, directly setting the 'User-Agent' or similar headers is restricted and may be ignored or cause errors.
7474
- // This is why we use the 'X-User-Agent' header instead.
7475
- ...typeof window === 'undefined' ? {
7476
- 'User-Agent': getUserAgent()
7477
- } : {
7478
- 'X-User-Agent': getUserAgent()
7479
- }
7505
+ // Browsers forbid setting a user-agent request header, and the custom
7506
+ // fallback header the SDK used instead trips CORS preflight against the
7507
+ // Circle APIs (it isn't in their `Access-Control-Allow-Headers`),
7508
+ // blocking the request. So send the SDK user agent only in Node;
7509
+ // browsers omit it entirely.
7510
+ ...getNodeUserAgentHeader()
7480
7511
  }
7481
7512
  };
7482
7513
  let lastError;
@@ -9262,6 +9293,7 @@ function resolveOptions(options) {
9262
9293
  if (payload.tokenIn !== undefined) safe['tokenIn'] = payload.tokenIn;
9263
9294
  if (payload.tokenOut !== undefined) safe['tokenOut'] = payload.tokenOut;
9264
9295
  if (payload.txHash !== undefined) safe['txHash'] = payload.txHash;
9296
+ if (payload.correlationId !== undefined) safe['correlationId'] = payload.correlationId;
9265
9297
  if (payload.errorDetails !== undefined) {
9266
9298
  const errorDetails = {
9267
9299
  ...payload.errorDetails.errorCode !== undefined && {
@@ -9332,18 +9364,15 @@ function resolveOptions(options) {
9332
9364
  timeoutHandle.unref();
9333
9365
  }
9334
9366
  try {
9335
- const isNode = isNodeEnvironment();
9336
- const userAgent = getUserAgent();
9337
9367
  await fetch(getLogsUrl(), {
9338
9368
  method: 'POST',
9339
9369
  headers: {
9340
9370
  'Content-Type': 'application/json',
9341
- // Browser restricts setting User-Agent; use X-User-Agent instead.
9342
- ...isNode ? {
9343
- 'User-Agent': userAgent
9344
- } : {
9345
- 'X-User-Agent': userAgent
9346
- }
9371
+ // Browsers forbid setting a user-agent request header, and the custom
9372
+ // fallback header the SDK used instead trips CORS preflight (it isn't
9373
+ // in the telemetry endpoint's `Access-Control-Allow-Headers`), so send
9374
+ // it only in Node; browsers omit it entirely.
9375
+ ...getNodeUserAgentHeader()
9347
9376
  },
9348
9377
  body: JSON.stringify(toSafePayload(payload)),
9349
9378
  signal: controller.signal
@@ -9474,7 +9503,7 @@ function resolveOptions(options) {
9474
9503
  // discards the stack trace, nested `cause`, and any custom Error
9475
9504
  // properties — exactly the context an on-call needs when a
9476
9505
  // resolver-closure regression triggers this path.
9477
- console.warn(`[stablecoin-kits telemetry] dropped error event '${eventType}':`, cause);
9506
+ console.warn(`[stablecoin-kits telemetry] dropped event '${eventType}':`, cause);
9478
9507
  } catch {
9479
9508
  // console.warn itself throwing is the user's environment; nothing more we
9480
9509
  // can do without risking the original operation error.
@@ -9490,7 +9519,9 @@ function resolveOptions(options) {
9490
9519
  sdkVersion: config.sdkVersion,
9491
9520
  eventType,
9492
9521
  timestamp: new Date().toISOString(),
9493
- errorDetails,
9522
+ ...errorDetails !== undefined && {
9523
+ errorDetails
9524
+ },
9494
9525
  clientContext: buildClientContext(),
9495
9526
  ...context?.sourceChain != null && {
9496
9527
  sourceChain: context.sourceChain
@@ -9506,6 +9537,9 @@ function resolveOptions(options) {
9506
9537
  },
9507
9538
  ...context?.txHash != null && {
9508
9539
  txHash: context.txHash
9540
+ },
9541
+ ...context?.correlationId != null && {
9542
+ correlationId: context.correlationId
9509
9543
  }
9510
9544
  };
9511
9545
  }
@@ -9619,7 +9653,7 @@ function resolveOptions(options) {
9619
9653
  }
9620
9654
 
9621
9655
  var name$2 = "@circle-fin/bridge-kit";
9622
- var version$3 = "1.12.1";
9656
+ var version$3 = "1.12.2";
9623
9657
  var pkg$3 = {
9624
9658
  name: name$2,
9625
9659
  version: version$3};
@@ -12216,7 +12250,13 @@ const FAST_TIER_FINALITY_THRESHOLD = 1000;
12216
12250
  /**
12217
12251
  * The ASCII "cctp-forward" magic, hex-encoded (no `0x`), that a forward-friendly
12218
12252
  * hookData must start with.
12219
- */ const CCTP_FORWARD_MAGIC_HEX = Buffer.from(CCTP_FORWARD_MAGIC_PREFIX, 'ascii').toString('hex');
12253
+ *
12254
+ * Encoded with `TextEncoder` (a browser-safe Web API) rather than `Buffer.from`
12255
+ * so this module-level constant does not reference the Node `Buffer` global at
12256
+ * import time. App Kit inlines this provider into its bundle without a Buffer polyfill, and a
12257
+ * bare `Buffer` here crashes browser bundles (e.g. Vite) on load — even for apps
12258
+ * that never touch the prepaid FORWARD path. Mirrors `buildForwardingHookData`.
12259
+ */ const CCTP_FORWARD_MAGIC_HEX = Array.from(new TextEncoder().encode(CCTP_FORWARD_MAGIC_PREFIX)).map((byte)=>byte.toString(16).padStart(2, '0')).join('');
12220
12260
  /**
12221
12261
  * Determine whether a hookData blob begins with the `cctp-forward` envelope.
12222
12262
  *
@@ -14654,7 +14694,7 @@ const mockAttestationMessage = {
14654
14694
  return step;
14655
14695
  }
14656
14696
 
14657
- var version$2 = "1.10.0";
14697
+ var version$2 = "1.10.1";
14658
14698
  var pkg$2 = {
14659
14699
  version: version$2};
14660
14700
 
@@ -17268,7 +17308,7 @@ registerKit(`${pkg$3.name}/${pkg$3.version}`);
17268
17308
  };
17269
17309
 
17270
17310
  var name$1 = "@circle-fin/swap-kit";
17271
- var version$1 = "1.4.0";
17311
+ var version$1 = "1.5.0";
17272
17312
  var pkg$1 = {
17273
17313
  name: name$1,
17274
17314
  version: version$1};
@@ -18009,6 +18049,16 @@ getQuoteRequestBaseSchema.superRefine(requireCrossChainQuoteToAddress);
18009
18049
  required_error: 'estimatedAmount is required',
18010
18050
  invalid_type_error: 'estimatedAmount must be a string'
18011
18051
  }).min(1, 'estimatedAmount must be a non-empty string'),
18052
+ // Per-swap join key echoed back verbatim on success telemetry. Optional so a
18053
+ // not-yet-upgraded service (no field) still validates during rollout. A
18054
+ // malformed/non-UUID value is coerced to `undefined` (no telemetry id) rather
18055
+ // than throwing: this is a telemetry-only field (stripped from the developer
18056
+ // result, never used for control flow), so it must not be able to abort the
18057
+ // swap via `parseCreateSwapResponse().parse()`. Mirrors the best-effort,
18058
+ // never-throw contract of the rest of the telemetry stack. Implemented with
18059
+ // `preprocess` rather than Zod's `.catch()` because static analysis misreads
18060
+ // `.catch` on the schema chain as an unhandled Promise (S7785).
18061
+ correlationId: z.preprocess((value)=>z.string().uuid().safeParse(value).success ? value : undefined, z.string().optional()),
18012
18062
  config: createSwapRequestBaseSchema.shape.config.optional(),
18013
18063
  fees: createSwapFeesSchema.optional(),
18014
18064
  transaction: createSwapTransactionSchema
@@ -19201,7 +19251,7 @@ new Set(Object.values(Blockchain));
19201
19251
  registerKit(`${pkg$1.name}/${pkg$1.version}`);
19202
19252
 
19203
19253
  var name = "@circle-fin/earn-kit";
19204
- var version = "1.3.0";
19254
+ var version = "1.4.0";
19205
19255
  var pkg = {
19206
19256
  name: name,
19207
19257
  version: version};
@@ -20665,6 +20715,8 @@ function hasCrossChainDepositQuoteShape(params) {
20665
20715
  config: earnConfigSchema.optional()
20666
20716
  });
20667
20717
 
20718
+ /** SDK name used in telemetry payloads. */ resolveKitSdkName(pkg.name);
20719
+
20668
20720
  // Auto-register this kit for user agent tracking
20669
20721
  registerKit(`${pkg.name}/${pkg.version}`);
20670
20722
 
package/chains.cjs CHANGED
@@ -18,6 +18,17 @@
18
18
 
19
19
  'use strict';
20
20
 
21
+ // Buffer polyfill setup - executes before any other code
22
+ // Ensures globalThis.Buffer is available for Solana libraries
23
+ const { Buffer } = require('buffer');
24
+ if (typeof globalThis !== 'undefined' && typeof globalThis.Buffer === 'undefined') {
25
+ globalThis.Buffer = Buffer;
26
+ }
27
+ if (typeof window !== 'undefined' && typeof window.Buffer === 'undefined') {
28
+ window.Buffer = Buffer;
29
+ }
30
+
31
+
21
32
  var zod = require('zod');
22
33
 
23
34
  /**
package/chains.mjs CHANGED
@@ -16,6 +16,17 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
+ // Buffer polyfill setup - executes before any other code
20
+ // Ensures globalThis.Buffer is available for Solana libraries
21
+ import { Buffer } from 'buffer';
22
+ if (typeof globalThis !== 'undefined' && typeof globalThis.Buffer === 'undefined') {
23
+ globalThis.Buffer = Buffer;
24
+ }
25
+ if (typeof window !== 'undefined' && typeof window.Buffer === 'undefined') {
26
+ window.Buffer = Buffer;
27
+ }
28
+
29
+
19
30
  import { z } from 'zod';
20
31
 
21
32
  /**
package/context.cjs CHANGED
@@ -18,6 +18,17 @@
18
18
 
19
19
  'use strict';
20
20
 
21
+ // Buffer polyfill setup - executes before any other code
22
+ // Ensures globalThis.Buffer is available for Solana libraries
23
+ const { Buffer } = require('buffer');
24
+ if (typeof globalThis !== 'undefined' && typeof globalThis.Buffer === 'undefined') {
25
+ globalThis.Buffer = Buffer;
26
+ }
27
+ if (typeof window !== 'undefined' && typeof window.Buffer === 'undefined') {
28
+ window.Buffer = Buffer;
29
+ }
30
+
31
+
21
32
  /**
22
33
  * Creates a AppKit context.
23
34
  *
package/context.d.cts CHANGED
@@ -6505,10 +6505,21 @@ interface AppKitContext {
6505
6505
  * ```
6506
6506
  */
6507
6507
  actions: Record<'bridge' | 'earn', Record<string, ((payload: unknown) => void)[]>>;
6508
+ /**
6509
+ * Disable success analytics for the underlying EarnKit, SwapKit, and
6510
+ * UnifiedBalanceKit.
6511
+ *
6512
+ * When `true`, completed earn, swap, and unified balance operations will not
6513
+ * POST analytics events. This does not disable error reporting; use
6514
+ * {@link AppKitContext.disableErrorReporting} for that. Defaults to `false`.
6515
+ *
6516
+ * @defaultValue false
6517
+ */
6518
+ disableAnalytics?: boolean;
6508
6519
  /**
6509
6520
  * Disable error telemetry for all sub-kits.
6510
6521
  *
6511
- * When `true`, none of the underlying kits (BridgeKit, SwapKit,
6522
+ * When `true`, none of the underlying kits (BridgeKit, SwapKit, EarnKit,
6512
6523
  * UnifiedBalanceKit) will POST error details to the telemetry
6513
6524
  * endpoint when operations throw. Defaults to `false` (enabled).
6514
6525
  *
package/context.d.mts CHANGED
@@ -6505,10 +6505,21 @@ interface AppKitContext {
6505
6505
  * ```
6506
6506
  */
6507
6507
  actions: Record<'bridge' | 'earn', Record<string, ((payload: unknown) => void)[]>>;
6508
+ /**
6509
+ * Disable success analytics for the underlying EarnKit, SwapKit, and
6510
+ * UnifiedBalanceKit.
6511
+ *
6512
+ * When `true`, completed earn, swap, and unified balance operations will not
6513
+ * POST analytics events. This does not disable error reporting; use
6514
+ * {@link AppKitContext.disableErrorReporting} for that. Defaults to `false`.
6515
+ *
6516
+ * @defaultValue false
6517
+ */
6518
+ disableAnalytics?: boolean;
6508
6519
  /**
6509
6520
  * Disable error telemetry for all sub-kits.
6510
6521
  *
6511
- * When `true`, none of the underlying kits (BridgeKit, SwapKit,
6522
+ * When `true`, none of the underlying kits (BridgeKit, SwapKit, EarnKit,
6512
6523
  * UnifiedBalanceKit) will POST error details to the telemetry
6513
6524
  * endpoint when operations throw. Defaults to `false` (enabled).
6514
6525
  *
package/context.d.ts CHANGED
@@ -6505,10 +6505,21 @@ interface AppKitContext {
6505
6505
  * ```
6506
6506
  */
6507
6507
  actions: Record<'bridge' | 'earn', Record<string, ((payload: unknown) => void)[]>>;
6508
+ /**
6509
+ * Disable success analytics for the underlying EarnKit, SwapKit, and
6510
+ * UnifiedBalanceKit.
6511
+ *
6512
+ * When `true`, completed earn, swap, and unified balance operations will not
6513
+ * POST analytics events. This does not disable error reporting; use
6514
+ * {@link AppKitContext.disableErrorReporting} for that. Defaults to `false`.
6515
+ *
6516
+ * @defaultValue false
6517
+ */
6518
+ disableAnalytics?: boolean;
6508
6519
  /**
6509
6520
  * Disable error telemetry for all sub-kits.
6510
6521
  *
6511
- * When `true`, none of the underlying kits (BridgeKit, SwapKit,
6522
+ * When `true`, none of the underlying kits (BridgeKit, SwapKit, EarnKit,
6512
6523
  * UnifiedBalanceKit) will POST error details to the telemetry
6513
6524
  * endpoint when operations throw. Defaults to `false` (enabled).
6514
6525
  *
package/context.mjs CHANGED
@@ -16,6 +16,17 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
+ // Buffer polyfill setup - executes before any other code
20
+ // Ensures globalThis.Buffer is available for Solana libraries
21
+ import { Buffer } from 'buffer';
22
+ if (typeof globalThis !== 'undefined' && typeof globalThis.Buffer === 'undefined') {
23
+ globalThis.Buffer = Buffer;
24
+ }
25
+ if (typeof window !== 'undefined' && typeof window.Buffer === 'undefined') {
26
+ window.Buffer = Buffer;
27
+ }
28
+
29
+
19
30
  /**
20
31
  * Creates a AppKit context.
21
32
  *