@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/context.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
  *
@@ -6659,7 +6735,7 @@ interface ServiceSwapConfig {
6659
6735
  *
6660
6736
  * @defaultValue true
6661
6737
  */
6662
- batchTransactions?: boolean;
6738
+ batchTransactions?: boolean | undefined;
6663
6739
  }
6664
6740
  /**
6665
6741
  * Parameters for initiating a swap operation through the Stablecoin Service.
@@ -7123,6 +7199,33 @@ interface SwapConfig {
7123
7199
  * `apiKey` is omitted, and `apiKey` takes precedence when both are set.
7124
7200
  */
7125
7201
  kitKey?: string;
7202
+ /**
7203
+ * Enable or disable atomic batched execution of the approval and swap.
7204
+ *
7205
+ * When `true` (or omitted), an EVM swap that needs an on-chain ERC-20
7206
+ * approval submits the approval and the swap as one atomic batch if the
7207
+ * connected wallet supports it (EIP-5792, or a signing strategy that
7208
+ * declares atomic batching). Set to `false` to force the sequential
7209
+ * approve-then-swap flow.
7210
+ *
7211
+ * @remarks
7212
+ * Has no effect on the gasless permit path, native-token swaps, or Solana,
7213
+ * which already execute as a single transaction. USDT input always uses the
7214
+ * sequential path because its allowance must be reset to zero first. The
7215
+ * batched path relies on the wallet's own gas estimation for the swap call;
7216
+ * set `false` if your wallet under-estimates gas for complex routes or
7217
+ * rejects batched calls.
7218
+ *
7219
+ * @defaultValue `undefined` (batching attempted when the wallet supports it)
7220
+ *
7221
+ * @example
7222
+ * ```typescript
7223
+ * const config: SwapConfig = {
7224
+ * batchTransactions: false, // force sequential approve → swap
7225
+ * }
7226
+ * ```
7227
+ */
7228
+ batchTransactions?: boolean | undefined;
7126
7229
  }
7127
7230
  /**
7128
7231
  * Resolved parameters for swap operations after validation and normalization.
@@ -8087,8 +8190,8 @@ interface AppKitContext {
8087
8190
  *
8088
8191
  * This property stores event handlers that are registered via the AppKit's
8089
8192
  * `on()` method. Handlers are grouped by operation type. The runtime buckets
8090
- * are `bridge` and `earn`; the context can add more operation buckets as
8091
- * AppKit wires action handlers for additional kits.
8193
+ * are `bridge`, `earn`, and `borrow`; the context can add more operation
8194
+ * buckets as AppKit wires action handlers for additional kits.
8092
8195
  *
8093
8196
  * Within each operation bucket, handlers are keyed by action name (for
8094
8197
  * example, `bridge.approve` or `earn.deposit`) or `*` for wildcard handlers.
@@ -8107,13 +8210,13 @@ interface AppKitContext {
8107
8210
  * // Earn handlers are registered with EarnKit when earn operations run
8108
8211
  * ```
8109
8212
  */
8110
- actions: Record<'bridge' | 'earn', Record<string, ((payload: unknown) => void)[]>>;
8213
+ actions: Record<'bridge' | 'earn' | 'borrow', Record<string, ((payload: unknown) => void)[]>>;
8111
8214
  /**
8112
- * Disable success analytics for the underlying EarnKit, SwapKit, and
8113
- * UnifiedBalanceKit.
8215
+ * Disable success analytics for the underlying EarnKit, SwapKit,
8216
+ * BorrowKit, and UnifiedBalanceKit.
8114
8217
  *
8115
- * When `true`, completed earn, swap, and unified balance operations will not
8116
- * POST analytics events. This does not disable error reporting; use
8218
+ * When `true`, completed earn, swap, borrow, and unified balance operations
8219
+ * will not POST analytics events. This does not disable error reporting; use
8117
8220
  * {@link AppKitContext.disableErrorReporting} for that. Defaults to `false`.
8118
8221
  *
8119
8222
  * @defaultValue false
@@ -8123,7 +8226,7 @@ interface AppKitContext {
8123
8226
  * Disable error telemetry for all sub-kits.
8124
8227
  *
8125
8228
  * When `true`, none of the underlying kits (BridgeKit, SwapKit, EarnKit,
8126
- * UnifiedBalanceKit) will POST error details to the telemetry
8229
+ * BorrowKit, UnifiedBalanceKit) will POST error details to the telemetry
8127
8230
  * endpoint when operations throw. Defaults to `false` (enabled).
8128
8231
  *
8129
8232
  * @defaultValue false
package/context.d.ts 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
  *
@@ -6659,7 +6735,7 @@ interface ServiceSwapConfig {
6659
6735
  *
6660
6736
  * @defaultValue true
6661
6737
  */
6662
- batchTransactions?: boolean;
6738
+ batchTransactions?: boolean | undefined;
6663
6739
  }
6664
6740
  /**
6665
6741
  * Parameters for initiating a swap operation through the Stablecoin Service.
@@ -7123,6 +7199,33 @@ interface SwapConfig {
7123
7199
  * `apiKey` is omitted, and `apiKey` takes precedence when both are set.
7124
7200
  */
7125
7201
  kitKey?: string;
7202
+ /**
7203
+ * Enable or disable atomic batched execution of the approval and swap.
7204
+ *
7205
+ * When `true` (or omitted), an EVM swap that needs an on-chain ERC-20
7206
+ * approval submits the approval and the swap as one atomic batch if the
7207
+ * connected wallet supports it (EIP-5792, or a signing strategy that
7208
+ * declares atomic batching). Set to `false` to force the sequential
7209
+ * approve-then-swap flow.
7210
+ *
7211
+ * @remarks
7212
+ * Has no effect on the gasless permit path, native-token swaps, or Solana,
7213
+ * which already execute as a single transaction. USDT input always uses the
7214
+ * sequential path because its allowance must be reset to zero first. The
7215
+ * batched path relies on the wallet's own gas estimation for the swap call;
7216
+ * set `false` if your wallet under-estimates gas for complex routes or
7217
+ * rejects batched calls.
7218
+ *
7219
+ * @defaultValue `undefined` (batching attempted when the wallet supports it)
7220
+ *
7221
+ * @example
7222
+ * ```typescript
7223
+ * const config: SwapConfig = {
7224
+ * batchTransactions: false, // force sequential approve → swap
7225
+ * }
7226
+ * ```
7227
+ */
7228
+ batchTransactions?: boolean | undefined;
7126
7229
  }
7127
7230
  /**
7128
7231
  * Resolved parameters for swap operations after validation and normalization.
@@ -8087,8 +8190,8 @@ interface AppKitContext {
8087
8190
  *
8088
8191
  * This property stores event handlers that are registered via the AppKit's
8089
8192
  * `on()` method. Handlers are grouped by operation type. The runtime buckets
8090
- * are `bridge` and `earn`; the context can add more operation buckets as
8091
- * AppKit wires action handlers for additional kits.
8193
+ * are `bridge`, `earn`, and `borrow`; the context can add more operation
8194
+ * buckets as AppKit wires action handlers for additional kits.
8092
8195
  *
8093
8196
  * Within each operation bucket, handlers are keyed by action name (for
8094
8197
  * example, `bridge.approve` or `earn.deposit`) or `*` for wildcard handlers.
@@ -8107,13 +8210,13 @@ interface AppKitContext {
8107
8210
  * // Earn handlers are registered with EarnKit when earn operations run
8108
8211
  * ```
8109
8212
  */
8110
- actions: Record<'bridge' | 'earn', Record<string, ((payload: unknown) => void)[]>>;
8213
+ actions: Record<'bridge' | 'earn' | 'borrow', Record<string, ((payload: unknown) => void)[]>>;
8111
8214
  /**
8112
- * Disable success analytics for the underlying EarnKit, SwapKit, and
8113
- * UnifiedBalanceKit.
8215
+ * Disable success analytics for the underlying EarnKit, SwapKit,
8216
+ * BorrowKit, and UnifiedBalanceKit.
8114
8217
  *
8115
- * When `true`, completed earn, swap, and unified balance operations will not
8116
- * POST analytics events. This does not disable error reporting; use
8218
+ * When `true`, completed earn, swap, borrow, and unified balance operations
8219
+ * will not POST analytics events. This does not disable error reporting; use
8117
8220
  * {@link AppKitContext.disableErrorReporting} for that. Defaults to `false`.
8118
8221
  *
8119
8222
  * @defaultValue false
@@ -8123,7 +8226,7 @@ interface AppKitContext {
8123
8226
  * Disable error telemetry for all sub-kits.
8124
8227
  *
8125
8228
  * When `true`, none of the underlying kits (BridgeKit, SwapKit, EarnKit,
8126
- * UnifiedBalanceKit) will POST error details to the telemetry
8229
+ * BorrowKit, UnifiedBalanceKit) will POST error details to the telemetry
8127
8230
  * endpoint when operations throw. Defaults to `false` (enabled).
8128
8231
  *
8129
8232
  * @defaultValue false
package/context.mjs CHANGED
@@ -60,6 +60,7 @@ if (typeof window !== 'undefined' && typeof window.Buffer === 'undefined') {
60
60
  actions: {
61
61
  bridge: {},
62
62
  earn: {},
63
+ borrow: {},
63
64
  ...params.actions
64
65
  }
65
66
  };