@circle-fin/app-kit 1.15.3 → 1.17.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 (60) hide show
  1. package/CHANGELOG.md +91 -0
  2. package/README.md +5 -2
  3. package/borrow.cjs +28146 -0
  4. package/borrow.cjs.map +1 -0
  5. package/borrow.d.cts +10752 -0
  6. package/borrow.d.mts +10752 -0
  7. package/borrow.d.ts +10752 -0
  8. package/borrow.mjs +28118 -0
  9. package/borrow.mjs.map +1 -0
  10. package/bridge.cjs +2084 -328
  11. package/bridge.d.cts +121 -18
  12. package/bridge.d.mts +121 -18
  13. package/bridge.d.ts +121 -18
  14. package/bridge.mjs +2084 -328
  15. package/chains.cjs +78 -7
  16. package/chains.d.cts +2 -0
  17. package/chains.d.mts +2 -0
  18. package/chains.d.ts +2 -0
  19. package/chains.mjs +78 -7
  20. package/context.cjs +1 -0
  21. package/context.d.cts +121 -18
  22. package/context.d.mts +121 -18
  23. package/context.d.ts +121 -18
  24. package/context.mjs +1 -0
  25. package/earn.cjs +5322 -3219
  26. package/earn.d.cts +1149 -984
  27. package/earn.d.mts +1149 -984
  28. package/earn.d.ts +1149 -984
  29. package/earn.mjs +5322 -3219
  30. package/estimateBridge.cjs +2082 -326
  31. package/estimateBridge.d.cts +121 -18
  32. package/estimateBridge.d.mts +121 -18
  33. package/estimateBridge.d.ts +121 -18
  34. package/estimateBridge.mjs +2082 -326
  35. package/estimateSwap.cjs +8817 -6974
  36. package/estimateSwap.d.cts +169 -18
  37. package/estimateSwap.d.mts +169 -18
  38. package/estimateSwap.d.ts +169 -18
  39. package/estimateSwap.mjs +8822 -6979
  40. package/index.cjs +33149 -20719
  41. package/index.d.cts +23174 -2736
  42. package/index.d.mts +23174 -2736
  43. package/index.d.ts +23174 -2736
  44. package/index.mjs +33090 -20713
  45. package/package.json +17 -7
  46. package/server.cjs +133 -12
  47. package/server.d.cts +29 -10
  48. package/server.d.mts +29 -10
  49. package/server.d.ts +29 -10
  50. package/server.mjs +133 -12
  51. package/swap.cjs +8817 -6974
  52. package/swap.d.cts +169 -18
  53. package/swap.d.mts +169 -18
  54. package/swap.d.ts +169 -18
  55. package/swap.mjs +8822 -6979
  56. package/unifiedBalance.cjs +528 -138
  57. package/unifiedBalance.d.cts +108 -11
  58. package/unifiedBalance.d.mts +108 -11
  59. package/unifiedBalance.d.ts +108 -11
  60. package/unifiedBalance.mjs +528 -138
package/swap.d.cts CHANGED
@@ -551,8 +551,23 @@ interface CCTPXChainConfig {
551
551
  * const contractType: KitContractType = 'bridge' // Valid
552
552
  * const invalidType: KitContractType = 'invalid' // TypeScript error
553
553
  * ```
554
- */
555
- type KitContractType = 'bridge' | 'adapter';
554
+ *
555
+ * @remarks
556
+ * `'senderPreservingBatcher'` carries a stricter requirement than the others,
557
+ * because setting it wrong fails silently rather than loudly. It must name a
558
+ * batching contract that preserves the calling EOA as `msg.sender` in every
559
+ * subcall — on Arc, the `Multicall3From` predeploy, which achieves that
560
+ * through the `CallFrom` precompile. The name is deliberately more specific
561
+ * than "batcher": the ubiquitous Multicall3 at
562
+ * `0xcA11bde05977b3631167028862bE2a173976CA11` has the same ABI and the same
563
+ * selectors but does **not** qualify, since each subcall would arrive as the
564
+ * Multicall3 contract, so a batched `approve` would grant an allowance from
565
+ * the batcher's own balance rather than from the user's — a field named just
566
+ * `batcher` would make that misconfiguration look valid. Leave
567
+ * `senderPreservingBatcher` unset on any chain lacking one; an unset field
568
+ * simply means callers fall back to submitting calls one at a time.
569
+ */
570
+ type KitContractType = 'bridge' | 'adapter' | 'senderPreservingBatcher';
556
571
  /**
557
572
  * Configuration for Gateway v1 contracts.
558
573
  *
@@ -884,10 +899,10 @@ declare enum Blockchain {
884
899
  *
885
900
  * Unlike the full {@link Blockchain} enum, SwapChain includes mainnet
886
901
  * networks and explicitly whitelisted testnets (e.g., {@link Arc_Testnet})
887
- * where adapter contracts are deployed (CCTPv2 support).
902
+ * where Adapter contracts are deployed.
888
903
  *
889
904
  * Dynamic validation via {@link isSwapSupportedChain} ensures chains
890
- * automatically work when adapter contracts and supported tokens are deployed.
905
+ * automatically work when Adapter contracts and supported tokens are deployed.
891
906
  *
892
907
  * @example
893
908
  * ```typescript
@@ -927,20 +942,22 @@ declare enum SwapChain {
927
942
  HyperEVM = "HyperEVM",
928
943
  Monad = "Monad",
929
944
  Arc = "Arc",
945
+ Cronos = "Cronos",
946
+ Morph = "Morph",
930
947
  Arc_Testnet = "Arc_Testnet"
931
948
  }
932
949
  /**
933
950
  * Chain definition that supports swap operations.
934
951
  *
935
952
  * @remarks
936
- * Expanded from 4 to ~18 supported chains based on:
937
- * - CCTPv2 support (adapter contract deployed)
953
+ * Expanded from 4 to supported mainnets and whitelisted testnets based on:
954
+ * - A deployed Adapter contract, configured directly or through CCTP v2
938
955
  * - Mainnet chains plus whitelisted testnets (e.g., Arc Testnet)
939
956
  *
940
957
  * Use `isSwapSupportedChain()` for runtime validation.
941
958
  */
942
959
  type SwapChainDefinition = ChainDefinition & {
943
- chain: Blockchain.Ethereum | Blockchain.Base | Blockchain.Polygon | Blockchain.Solana | Blockchain.Arbitrum | Blockchain.Optimism | Blockchain.Avalanche | Blockchain.Linea | Blockchain.Ink | Blockchain.World_Chain | Blockchain.Unichain | Blockchain.Plume | Blockchain.Sei | Blockchain.Sonic | Blockchain.XDC | Blockchain.HyperEVM | Blockchain.Monad | Blockchain.Arc | Blockchain.Arc_Testnet;
960
+ chain: Blockchain.Ethereum | Blockchain.Base | Blockchain.Polygon | Blockchain.Solana | Blockchain.Arbitrum | Blockchain.Optimism | Blockchain.Avalanche | Blockchain.Linea | Blockchain.Ink | Blockchain.World_Chain | Blockchain.Unichain | Blockchain.Plume | Blockchain.Sei | Blockchain.Sonic | Blockchain.XDC | Blockchain.HyperEVM | Blockchain.Monad | Blockchain.Arc | Blockchain.Cronos | Blockchain.Morph | Blockchain.Arc_Testnet;
944
961
  };
945
962
  /**
946
963
  * Chain identifier accepted by swap operations.
@@ -1436,8 +1453,13 @@ type PreparedChainRequest = EvmPreparedChainRequest | SolanaPreparedChainRequest
1436
1453
  * Parameters for preparing an EVM contract execution.
1437
1454
  */
1438
1455
  type EvmPreparedChainRequestParams = {
1439
- /** The type of the prepared execution. */
1440
- type: 'evm';
1456
+ /**
1457
+ * The type of the prepared execution. Optional here because EVM is the
1458
+ * only chain type `Adapter.prepare()` implementations narrow their param
1459
+ * type to in practice — callers that only ever prepare EVM requests can
1460
+ * omit it rather than repeat a discriminator that never varies for them.
1461
+ */
1462
+ type?: 'evm';
1441
1463
  /** The ABI of the contract. */
1442
1464
  abi: Abi | string[];
1443
1465
  /** The address of the contract. */
@@ -2716,6 +2738,57 @@ interface EarnActionMap {
2716
2738
  readonly claimRewards: ExecuteEarnParams;
2717
2739
  }
2718
2740
 
2741
+ /** Permit standards accepted by Borrow Adapter executions. */
2742
+ declare enum BorrowPermitType {
2743
+ /** Tokens must be approved separately. */
2744
+ NONE = 0,
2745
+ /** EIP-2612 permit calldata accompanies the token input. */
2746
+ EIP2612 = 1
2747
+ }
2748
+ /** Token input forwarded by Borrow Kit to the Adapter Contract. */
2749
+ interface BorrowTokenInput {
2750
+ readonly permitType: BorrowPermitType;
2751
+ readonly token: `0x${string}`;
2752
+ readonly amount: bigint;
2753
+ readonly permitCalldata: `0x${string}`;
2754
+ }
2755
+ /** A single instruction in a Circle-signed Borrow execution. */
2756
+ interface BorrowInstruction {
2757
+ readonly target: `0x${string}`;
2758
+ readonly data: `0x${string}`;
2759
+ readonly value: string | bigint;
2760
+ readonly tokenIn: `0x${string}`;
2761
+ readonly amountToApprove: string | bigint;
2762
+ readonly tokenOut: `0x${string}`;
2763
+ readonly minTokenOut: string | bigint;
2764
+ }
2765
+ /** A token recipient in a Circle-signed Borrow execution. */
2766
+ interface BorrowTokenRecipient {
2767
+ readonly token: `0x${string}`;
2768
+ readonly beneficiary: `0x${string}`;
2769
+ }
2770
+ /** Circle-signed Borrow parameters forwarded to the Adapter Contract. */
2771
+ interface BorrowExecutionParams {
2772
+ readonly instructions: readonly BorrowInstruction[];
2773
+ readonly tokens: readonly BorrowTokenRecipient[];
2774
+ readonly execId: string | bigint;
2775
+ readonly deadline: string | bigint;
2776
+ readonly metadata: `0x${string}`;
2777
+ }
2778
+ /** Parameters for a service-signed Borrow Adapter execution. */
2779
+ interface ExecuteBorrowParams extends ActionParameters {
2780
+ readonly executeParams: BorrowExecutionParams;
2781
+ readonly tokenInputs: BorrowTokenInput[];
2782
+ readonly signature: `0x${string}`;
2783
+ }
2784
+ /** Borrow actions supported by EVM adapters. */
2785
+ interface BorrowActionMap {
2786
+ /** Execute a Circle-signed partial loan repayment. */
2787
+ readonly repay: ExecuteBorrowParams;
2788
+ /** Execute a Circle-signed borrow. */
2789
+ readonly execute: ExecuteBorrowParams;
2790
+ }
2791
+
2719
2792
  /**
2720
2793
  * Single instruction to execute within the Adapter Contract.
2721
2794
  *
@@ -3672,6 +3745,8 @@ interface NativeActionMap {
3672
3745
  * @see {@link ActionPayload} for extracting payload types
3673
3746
  */
3674
3747
  interface ActionMap {
3748
+ /** Borrow operations that execute service-signed payloads. */
3749
+ readonly borrow: BorrowActionMap;
3675
3750
  /** CCTP-specific operations with automatic address resolution. */
3676
3751
  readonly cctp: CCTPActionMap;
3677
3752
  /** CCTPx operations (CrossChainTokenService) for cross-chain transfers of registered tokens (Circle-issued or otherwise). */
@@ -3691,6 +3766,7 @@ interface ActionMap {
3691
3766
  /** Earn operations that execute service-signed payloads via the adapter contract. */
3692
3767
  readonly earn: EarnActionMap;
3693
3768
  }
3769
+
3694
3770
  /**
3695
3771
  * Determine if a type represents an action parameter object (leaf node).
3696
3772
  *
@@ -6133,6 +6209,44 @@ type BridgeDestination<TAdapterCapabilities extends AdapterCapabilities = Adapte
6133
6209
  useForwarder?: boolean;
6134
6210
  }) | ForwarderDestination<TChainIdentifier>;
6135
6211
 
6212
+ /** Token metadata for one side of a swap route step. */
6213
+ interface SwapRouteToken {
6214
+ readonly symbol: string;
6215
+ readonly address: string;
6216
+ readonly decimals: number;
6217
+ }
6218
+ /** Amount estimates for a swap route step, expressed in base units. */
6219
+ interface SwapRouteStepEstimate {
6220
+ readonly fromAmount: string;
6221
+ readonly toAmount: string;
6222
+ readonly gasCostUSD?: string;
6223
+ }
6224
+ /** A single swap or bridge hop selected by the route provider. */
6225
+ interface SwapRouteStep {
6226
+ /** Hop kind, for example `swap` or `bridge`. */
6227
+ readonly type: string;
6228
+ /** Protocol identifier, for example `cctp-v2`. */
6229
+ readonly tool: string;
6230
+ /** Display name for {@link SwapRouteStep.tool}. */
6231
+ readonly toolName: string;
6232
+ readonly fromToken: SwapRouteToken;
6233
+ readonly toToken: SwapRouteToken;
6234
+ readonly estimate: SwapRouteStepEstimate;
6235
+ /** Provider-specific details that are not part of the stable step shape. */
6236
+ readonly metadata?: Readonly<Record<string, unknown>>;
6237
+ }
6238
+ /** Provider and executable hops selected for a swap. */
6239
+ interface SwapRoute {
6240
+ /**
6241
+ * Provider that routed the swap, for example `lifi` or `circle`. Treat as
6242
+ * an opaque identifier; new providers can appear without an SDK release.
6243
+ */
6244
+ readonly provider: string;
6245
+ readonly steps: readonly SwapRouteStep[];
6246
+ /** Provider-specific details that are not part of the stable route shape. */
6247
+ readonly metadata?: Readonly<Record<string, unknown>>;
6248
+ }
6249
+
6136
6250
  /**
6137
6251
  * Allowance strategy for token approvals during swap operations.
6138
6252
  *
@@ -6290,7 +6404,7 @@ interface ServiceSwapConfig {
6290
6404
  *
6291
6405
  * @defaultValue true
6292
6406
  */
6293
- batchTransactions?: boolean;
6407
+ batchTransactions?: boolean | undefined;
6294
6408
  }
6295
6409
  /**
6296
6410
  * Parameters for initiating a swap operation through the Stablecoin Service.
@@ -6443,6 +6557,14 @@ interface ServiceSwapFee {
6443
6557
  * addresses are not available from the proxy response.
6444
6558
  */
6445
6559
  readonly recipientAddress?: string;
6560
+ /** Provider-defined fee component (for example `FORWARD`). */
6561
+ readonly component?: string;
6562
+ /**
6563
+ * Chain on which the fee is charged, as reported by the service
6564
+ * (a `Blockchain` value such as `'Ethereum'`). Not validated
6565
+ * against the `Blockchain` enum.
6566
+ */
6567
+ readonly chain?: string;
6446
6568
  }
6447
6569
 
6448
6570
  /**
@@ -6807,6 +6929,33 @@ interface SwapConfig {
6807
6929
  * `apiKey` is omitted, and `apiKey` takes precedence when both are set.
6808
6930
  */
6809
6931
  kitKey?: string;
6932
+ /**
6933
+ * Enable or disable atomic batched execution of the approval and swap.
6934
+ *
6935
+ * When `true` (or omitted), an EVM swap that needs an on-chain ERC-20
6936
+ * approval submits the approval and the swap as one atomic batch if the
6937
+ * connected wallet supports it (EIP-5792, or a signing strategy that
6938
+ * declares atomic batching). Set to `false` to force the sequential
6939
+ * approve-then-swap flow.
6940
+ *
6941
+ * @remarks
6942
+ * Has no effect on the gasless permit path, native-token swaps, or Solana,
6943
+ * which already execute as a single transaction. USDT input always uses the
6944
+ * sequential path because its allowance must be reset to zero first. The
6945
+ * batched path relies on the wallet's own gas estimation for the swap call;
6946
+ * set `false` if your wallet under-estimates gas for complex routes or
6947
+ * rejects batched calls.
6948
+ *
6949
+ * @defaultValue `undefined` (batching attempted when the wallet supports it)
6950
+ *
6951
+ * @example
6952
+ * ```typescript
6953
+ * const config: SwapConfig = {
6954
+ * batchTransactions: false, // force sequential approve → swap
6955
+ * }
6956
+ * ```
6957
+ */
6958
+ batchTransactions?: boolean | undefined;
6810
6959
  }
6811
6960
  /**
6812
6961
  * Configuration for swap results.
@@ -6947,6 +7096,8 @@ interface SwapResult {
6947
7096
  * fees (charged by the DEX aggregator/protocol) and kit fees.
6948
7097
  */
6949
7098
  fees?: readonly ServiceSwapFee[];
7099
+ /** Provider and executable hops selected for the swap. */
7100
+ readonly route?: SwapRoute;
6950
7101
  /**
6951
7102
  * Lifecycle snapshot: `status`, `substatus`, and `substatusMessage`.
6952
7103
  *
@@ -8395,8 +8546,8 @@ interface AppKitContext {
8395
8546
  *
8396
8547
  * This property stores event handlers that are registered via the AppKit's
8397
8548
  * `on()` method. Handlers are grouped by operation type. The runtime buckets
8398
- * are `bridge` and `earn`; the context can add more operation buckets as
8399
- * AppKit wires action handlers for additional kits.
8549
+ * are `bridge`, `earn`, and `borrow`; the context can add more operation
8550
+ * buckets as AppKit wires action handlers for additional kits.
8400
8551
  *
8401
8552
  * Within each operation bucket, handlers are keyed by action name (for
8402
8553
  * example, `bridge.approve` or `earn.deposit`) or `*` for wildcard handlers.
@@ -8415,13 +8566,13 @@ interface AppKitContext {
8415
8566
  * // Earn handlers are registered with EarnKit when earn operations run
8416
8567
  * ```
8417
8568
  */
8418
- actions: Record<'bridge' | 'earn', Record<string, ((payload: unknown) => void)[]>>;
8569
+ actions: Record<'bridge' | 'earn' | 'borrow', Record<string, ((payload: unknown) => void)[]>>;
8419
8570
  /**
8420
- * Disable success analytics for the underlying EarnKit, SwapKit, and
8421
- * UnifiedBalanceKit.
8571
+ * Disable success analytics for the underlying EarnKit, SwapKit,
8572
+ * BorrowKit, and UnifiedBalanceKit.
8422
8573
  *
8423
- * When `true`, completed earn, swap, and unified balance operations will not
8424
- * POST analytics events. This does not disable error reporting; use
8574
+ * When `true`, completed earn, swap, borrow, and unified balance operations
8575
+ * will not POST analytics events. This does not disable error reporting; use
8425
8576
  * {@link AppKitContext.disableErrorReporting} for that. Defaults to `false`.
8426
8577
  *
8427
8578
  * @defaultValue false
@@ -8431,7 +8582,7 @@ interface AppKitContext {
8431
8582
  * Disable error telemetry for all sub-kits.
8432
8583
  *
8433
8584
  * When `true`, none of the underlying kits (BridgeKit, SwapKit, EarnKit,
8434
- * UnifiedBalanceKit) will POST error details to the telemetry
8585
+ * BorrowKit, UnifiedBalanceKit) will POST error details to the telemetry
8435
8586
  * endpoint when operations throw. Defaults to `false` (enabled).
8436
8587
  *
8437
8588
  * @defaultValue false
package/swap.d.mts CHANGED
@@ -551,8 +551,23 @@ interface CCTPXChainConfig {
551
551
  * const contractType: KitContractType = 'bridge' // Valid
552
552
  * const invalidType: KitContractType = 'invalid' // TypeScript error
553
553
  * ```
554
- */
555
- type KitContractType = 'bridge' | 'adapter';
554
+ *
555
+ * @remarks
556
+ * `'senderPreservingBatcher'` carries a stricter requirement than the others,
557
+ * because setting it wrong fails silently rather than loudly. It must name a
558
+ * batching contract that preserves the calling EOA as `msg.sender` in every
559
+ * subcall — on Arc, the `Multicall3From` predeploy, which achieves that
560
+ * through the `CallFrom` precompile. The name is deliberately more specific
561
+ * than "batcher": the ubiquitous Multicall3 at
562
+ * `0xcA11bde05977b3631167028862bE2a173976CA11` has the same ABI and the same
563
+ * selectors but does **not** qualify, since each subcall would arrive as the
564
+ * Multicall3 contract, so a batched `approve` would grant an allowance from
565
+ * the batcher's own balance rather than from the user's — a field named just
566
+ * `batcher` would make that misconfiguration look valid. Leave
567
+ * `senderPreservingBatcher` unset on any chain lacking one; an unset field
568
+ * simply means callers fall back to submitting calls one at a time.
569
+ */
570
+ type KitContractType = 'bridge' | 'adapter' | 'senderPreservingBatcher';
556
571
  /**
557
572
  * Configuration for Gateway v1 contracts.
558
573
  *
@@ -884,10 +899,10 @@ declare enum Blockchain {
884
899
  *
885
900
  * Unlike the full {@link Blockchain} enum, SwapChain includes mainnet
886
901
  * networks and explicitly whitelisted testnets (e.g., {@link Arc_Testnet})
887
- * where adapter contracts are deployed (CCTPv2 support).
902
+ * where Adapter contracts are deployed.
888
903
  *
889
904
  * Dynamic validation via {@link isSwapSupportedChain} ensures chains
890
- * automatically work when adapter contracts and supported tokens are deployed.
905
+ * automatically work when Adapter contracts and supported tokens are deployed.
891
906
  *
892
907
  * @example
893
908
  * ```typescript
@@ -927,20 +942,22 @@ declare enum SwapChain {
927
942
  HyperEVM = "HyperEVM",
928
943
  Monad = "Monad",
929
944
  Arc = "Arc",
945
+ Cronos = "Cronos",
946
+ Morph = "Morph",
930
947
  Arc_Testnet = "Arc_Testnet"
931
948
  }
932
949
  /**
933
950
  * Chain definition that supports swap operations.
934
951
  *
935
952
  * @remarks
936
- * Expanded from 4 to ~18 supported chains based on:
937
- * - CCTPv2 support (adapter contract deployed)
953
+ * Expanded from 4 to supported mainnets and whitelisted testnets based on:
954
+ * - A deployed Adapter contract, configured directly or through CCTP v2
938
955
  * - Mainnet chains plus whitelisted testnets (e.g., Arc Testnet)
939
956
  *
940
957
  * Use `isSwapSupportedChain()` for runtime validation.
941
958
  */
942
959
  type SwapChainDefinition = ChainDefinition & {
943
- chain: Blockchain.Ethereum | Blockchain.Base | Blockchain.Polygon | Blockchain.Solana | Blockchain.Arbitrum | Blockchain.Optimism | Blockchain.Avalanche | Blockchain.Linea | Blockchain.Ink | Blockchain.World_Chain | Blockchain.Unichain | Blockchain.Plume | Blockchain.Sei | Blockchain.Sonic | Blockchain.XDC | Blockchain.HyperEVM | Blockchain.Monad | Blockchain.Arc | Blockchain.Arc_Testnet;
960
+ chain: Blockchain.Ethereum | Blockchain.Base | Blockchain.Polygon | Blockchain.Solana | Blockchain.Arbitrum | Blockchain.Optimism | Blockchain.Avalanche | Blockchain.Linea | Blockchain.Ink | Blockchain.World_Chain | Blockchain.Unichain | Blockchain.Plume | Blockchain.Sei | Blockchain.Sonic | Blockchain.XDC | Blockchain.HyperEVM | Blockchain.Monad | Blockchain.Arc | Blockchain.Cronos | Blockchain.Morph | Blockchain.Arc_Testnet;
944
961
  };
945
962
  /**
946
963
  * Chain identifier accepted by swap operations.
@@ -1436,8 +1453,13 @@ type PreparedChainRequest = EvmPreparedChainRequest | SolanaPreparedChainRequest
1436
1453
  * Parameters for preparing an EVM contract execution.
1437
1454
  */
1438
1455
  type EvmPreparedChainRequestParams = {
1439
- /** The type of the prepared execution. */
1440
- type: 'evm';
1456
+ /**
1457
+ * The type of the prepared execution. Optional here because EVM is the
1458
+ * only chain type `Adapter.prepare()` implementations narrow their param
1459
+ * type to in practice — callers that only ever prepare EVM requests can
1460
+ * omit it rather than repeat a discriminator that never varies for them.
1461
+ */
1462
+ type?: 'evm';
1441
1463
  /** The ABI of the contract. */
1442
1464
  abi: Abi | string[];
1443
1465
  /** The address of the contract. */
@@ -2716,6 +2738,57 @@ interface EarnActionMap {
2716
2738
  readonly claimRewards: ExecuteEarnParams;
2717
2739
  }
2718
2740
 
2741
+ /** Permit standards accepted by Borrow Adapter executions. */
2742
+ declare enum BorrowPermitType {
2743
+ /** Tokens must be approved separately. */
2744
+ NONE = 0,
2745
+ /** EIP-2612 permit calldata accompanies the token input. */
2746
+ EIP2612 = 1
2747
+ }
2748
+ /** Token input forwarded by Borrow Kit to the Adapter Contract. */
2749
+ interface BorrowTokenInput {
2750
+ readonly permitType: BorrowPermitType;
2751
+ readonly token: `0x${string}`;
2752
+ readonly amount: bigint;
2753
+ readonly permitCalldata: `0x${string}`;
2754
+ }
2755
+ /** A single instruction in a Circle-signed Borrow execution. */
2756
+ interface BorrowInstruction {
2757
+ readonly target: `0x${string}`;
2758
+ readonly data: `0x${string}`;
2759
+ readonly value: string | bigint;
2760
+ readonly tokenIn: `0x${string}`;
2761
+ readonly amountToApprove: string | bigint;
2762
+ readonly tokenOut: `0x${string}`;
2763
+ readonly minTokenOut: string | bigint;
2764
+ }
2765
+ /** A token recipient in a Circle-signed Borrow execution. */
2766
+ interface BorrowTokenRecipient {
2767
+ readonly token: `0x${string}`;
2768
+ readonly beneficiary: `0x${string}`;
2769
+ }
2770
+ /** Circle-signed Borrow parameters forwarded to the Adapter Contract. */
2771
+ interface BorrowExecutionParams {
2772
+ readonly instructions: readonly BorrowInstruction[];
2773
+ readonly tokens: readonly BorrowTokenRecipient[];
2774
+ readonly execId: string | bigint;
2775
+ readonly deadline: string | bigint;
2776
+ readonly metadata: `0x${string}`;
2777
+ }
2778
+ /** Parameters for a service-signed Borrow Adapter execution. */
2779
+ interface ExecuteBorrowParams extends ActionParameters {
2780
+ readonly executeParams: BorrowExecutionParams;
2781
+ readonly tokenInputs: BorrowTokenInput[];
2782
+ readonly signature: `0x${string}`;
2783
+ }
2784
+ /** Borrow actions supported by EVM adapters. */
2785
+ interface BorrowActionMap {
2786
+ /** Execute a Circle-signed partial loan repayment. */
2787
+ readonly repay: ExecuteBorrowParams;
2788
+ /** Execute a Circle-signed borrow. */
2789
+ readonly execute: ExecuteBorrowParams;
2790
+ }
2791
+
2719
2792
  /**
2720
2793
  * Single instruction to execute within the Adapter Contract.
2721
2794
  *
@@ -3672,6 +3745,8 @@ interface NativeActionMap {
3672
3745
  * @see {@link ActionPayload} for extracting payload types
3673
3746
  */
3674
3747
  interface ActionMap {
3748
+ /** Borrow operations that execute service-signed payloads. */
3749
+ readonly borrow: BorrowActionMap;
3675
3750
  /** CCTP-specific operations with automatic address resolution. */
3676
3751
  readonly cctp: CCTPActionMap;
3677
3752
  /** CCTPx operations (CrossChainTokenService) for cross-chain transfers of registered tokens (Circle-issued or otherwise). */
@@ -3691,6 +3766,7 @@ interface ActionMap {
3691
3766
  /** Earn operations that execute service-signed payloads via the adapter contract. */
3692
3767
  readonly earn: EarnActionMap;
3693
3768
  }
3769
+
3694
3770
  /**
3695
3771
  * Determine if a type represents an action parameter object (leaf node).
3696
3772
  *
@@ -6133,6 +6209,44 @@ type BridgeDestination<TAdapterCapabilities extends AdapterCapabilities = Adapte
6133
6209
  useForwarder?: boolean;
6134
6210
  }) | ForwarderDestination<TChainIdentifier>;
6135
6211
 
6212
+ /** Token metadata for one side of a swap route step. */
6213
+ interface SwapRouteToken {
6214
+ readonly symbol: string;
6215
+ readonly address: string;
6216
+ readonly decimals: number;
6217
+ }
6218
+ /** Amount estimates for a swap route step, expressed in base units. */
6219
+ interface SwapRouteStepEstimate {
6220
+ readonly fromAmount: string;
6221
+ readonly toAmount: string;
6222
+ readonly gasCostUSD?: string;
6223
+ }
6224
+ /** A single swap or bridge hop selected by the route provider. */
6225
+ interface SwapRouteStep {
6226
+ /** Hop kind, for example `swap` or `bridge`. */
6227
+ readonly type: string;
6228
+ /** Protocol identifier, for example `cctp-v2`. */
6229
+ readonly tool: string;
6230
+ /** Display name for {@link SwapRouteStep.tool}. */
6231
+ readonly toolName: string;
6232
+ readonly fromToken: SwapRouteToken;
6233
+ readonly toToken: SwapRouteToken;
6234
+ readonly estimate: SwapRouteStepEstimate;
6235
+ /** Provider-specific details that are not part of the stable step shape. */
6236
+ readonly metadata?: Readonly<Record<string, unknown>>;
6237
+ }
6238
+ /** Provider and executable hops selected for a swap. */
6239
+ interface SwapRoute {
6240
+ /**
6241
+ * Provider that routed the swap, for example `lifi` or `circle`. Treat as
6242
+ * an opaque identifier; new providers can appear without an SDK release.
6243
+ */
6244
+ readonly provider: string;
6245
+ readonly steps: readonly SwapRouteStep[];
6246
+ /** Provider-specific details that are not part of the stable route shape. */
6247
+ readonly metadata?: Readonly<Record<string, unknown>>;
6248
+ }
6249
+
6136
6250
  /**
6137
6251
  * Allowance strategy for token approvals during swap operations.
6138
6252
  *
@@ -6290,7 +6404,7 @@ interface ServiceSwapConfig {
6290
6404
  *
6291
6405
  * @defaultValue true
6292
6406
  */
6293
- batchTransactions?: boolean;
6407
+ batchTransactions?: boolean | undefined;
6294
6408
  }
6295
6409
  /**
6296
6410
  * Parameters for initiating a swap operation through the Stablecoin Service.
@@ -6443,6 +6557,14 @@ interface ServiceSwapFee {
6443
6557
  * addresses are not available from the proxy response.
6444
6558
  */
6445
6559
  readonly recipientAddress?: string;
6560
+ /** Provider-defined fee component (for example `FORWARD`). */
6561
+ readonly component?: string;
6562
+ /**
6563
+ * Chain on which the fee is charged, as reported by the service
6564
+ * (a `Blockchain` value such as `'Ethereum'`). Not validated
6565
+ * against the `Blockchain` enum.
6566
+ */
6567
+ readonly chain?: string;
6446
6568
  }
6447
6569
 
6448
6570
  /**
@@ -6807,6 +6929,33 @@ interface SwapConfig {
6807
6929
  * `apiKey` is omitted, and `apiKey` takes precedence when both are set.
6808
6930
  */
6809
6931
  kitKey?: string;
6932
+ /**
6933
+ * Enable or disable atomic batched execution of the approval and swap.
6934
+ *
6935
+ * When `true` (or omitted), an EVM swap that needs an on-chain ERC-20
6936
+ * approval submits the approval and the swap as one atomic batch if the
6937
+ * connected wallet supports it (EIP-5792, or a signing strategy that
6938
+ * declares atomic batching). Set to `false` to force the sequential
6939
+ * approve-then-swap flow.
6940
+ *
6941
+ * @remarks
6942
+ * Has no effect on the gasless permit path, native-token swaps, or Solana,
6943
+ * which already execute as a single transaction. USDT input always uses the
6944
+ * sequential path because its allowance must be reset to zero first. The
6945
+ * batched path relies on the wallet's own gas estimation for the swap call;
6946
+ * set `false` if your wallet under-estimates gas for complex routes or
6947
+ * rejects batched calls.
6948
+ *
6949
+ * @defaultValue `undefined` (batching attempted when the wallet supports it)
6950
+ *
6951
+ * @example
6952
+ * ```typescript
6953
+ * const config: SwapConfig = {
6954
+ * batchTransactions: false, // force sequential approve → swap
6955
+ * }
6956
+ * ```
6957
+ */
6958
+ batchTransactions?: boolean | undefined;
6810
6959
  }
6811
6960
  /**
6812
6961
  * Configuration for swap results.
@@ -6947,6 +7096,8 @@ interface SwapResult {
6947
7096
  * fees (charged by the DEX aggregator/protocol) and kit fees.
6948
7097
  */
6949
7098
  fees?: readonly ServiceSwapFee[];
7099
+ /** Provider and executable hops selected for the swap. */
7100
+ readonly route?: SwapRoute;
6950
7101
  /**
6951
7102
  * Lifecycle snapshot: `status`, `substatus`, and `substatusMessage`.
6952
7103
  *
@@ -8395,8 +8546,8 @@ interface AppKitContext {
8395
8546
  *
8396
8547
  * This property stores event handlers that are registered via the AppKit's
8397
8548
  * `on()` method. Handlers are grouped by operation type. The runtime buckets
8398
- * are `bridge` and `earn`; the context can add more operation buckets as
8399
- * AppKit wires action handlers for additional kits.
8549
+ * are `bridge`, `earn`, and `borrow`; the context can add more operation
8550
+ * buckets as AppKit wires action handlers for additional kits.
8400
8551
  *
8401
8552
  * Within each operation bucket, handlers are keyed by action name (for
8402
8553
  * example, `bridge.approve` or `earn.deposit`) or `*` for wildcard handlers.
@@ -8415,13 +8566,13 @@ interface AppKitContext {
8415
8566
  * // Earn handlers are registered with EarnKit when earn operations run
8416
8567
  * ```
8417
8568
  */
8418
- actions: Record<'bridge' | 'earn', Record<string, ((payload: unknown) => void)[]>>;
8569
+ actions: Record<'bridge' | 'earn' | 'borrow', Record<string, ((payload: unknown) => void)[]>>;
8419
8570
  /**
8420
- * Disable success analytics for the underlying EarnKit, SwapKit, and
8421
- * UnifiedBalanceKit.
8571
+ * Disable success analytics for the underlying EarnKit, SwapKit,
8572
+ * BorrowKit, and UnifiedBalanceKit.
8422
8573
  *
8423
- * When `true`, completed earn, swap, and unified balance operations will not
8424
- * POST analytics events. This does not disable error reporting; use
8574
+ * When `true`, completed earn, swap, borrow, and unified balance operations
8575
+ * will not POST analytics events. This does not disable error reporting; use
8425
8576
  * {@link AppKitContext.disableErrorReporting} for that. Defaults to `false`.
8426
8577
  *
8427
8578
  * @defaultValue false
@@ -8431,7 +8582,7 @@ interface AppKitContext {
8431
8582
  * Disable error telemetry for all sub-kits.
8432
8583
  *
8433
8584
  * When `true`, none of the underlying kits (BridgeKit, SwapKit, EarnKit,
8434
- * UnifiedBalanceKit) will POST error details to the telemetry
8585
+ * BorrowKit, UnifiedBalanceKit) will POST error details to the telemetry
8435
8586
  * endpoint when operations throw. Defaults to `false` (enabled).
8436
8587
  *
8437
8588
  * @defaultValue false