@circle-fin/app-kit 1.15.3 → 1.16.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 (57) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/README.md +5 -2
  3. package/borrow.cjs +28028 -0
  4. package/borrow.cjs.map +1 -0
  5. package/borrow.d.cts +10723 -0
  6. package/borrow.d.mts +10723 -0
  7. package/borrow.d.ts +10723 -0
  8. package/borrow.mjs +28000 -0
  9. package/borrow.mjs.map +1 -0
  10. package/bridge.cjs +1885 -276
  11. package/bridge.d.cts +86 -12
  12. package/bridge.d.mts +86 -12
  13. package/bridge.d.ts +86 -12
  14. package/bridge.mjs +1885 -276
  15. package/chains.cjs +70 -3
  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 +70 -3
  20. package/context.cjs +1 -0
  21. package/context.d.cts +86 -12
  22. package/context.d.mts +86 -12
  23. package/context.d.ts +86 -12
  24. package/context.mjs +1 -0
  25. package/earn.cjs +4981 -3314
  26. package/earn.d.cts +1117 -981
  27. package/earn.d.mts +1117 -981
  28. package/earn.d.ts +1117 -981
  29. package/earn.mjs +4981 -3314
  30. package/estimateBridge.cjs +1883 -274
  31. package/estimateBridge.d.cts +86 -12
  32. package/estimateBridge.d.mts +86 -12
  33. package/estimateBridge.d.ts +86 -12
  34. package/estimateBridge.mjs +1883 -274
  35. package/estimateSwap.cjs +8554 -6931
  36. package/estimateSwap.d.cts +86 -12
  37. package/estimateSwap.d.mts +86 -12
  38. package/estimateSwap.d.ts +86 -12
  39. package/estimateSwap.mjs +8503 -6880
  40. package/index.cjs +30943 -18928
  41. package/index.d.cts +23051 -2742
  42. package/index.d.mts +23051 -2742
  43. package/index.d.ts +23051 -2742
  44. package/index.mjs +30884 -18922
  45. package/package.json +17 -7
  46. package/server.cjs +101 -6
  47. package/server.mjs +101 -6
  48. package/swap.cjs +8554 -6931
  49. package/swap.d.cts +86 -12
  50. package/swap.d.mts +86 -12
  51. package/swap.d.ts +86 -12
  52. package/swap.mjs +8503 -6880
  53. package/unifiedBalance.cjs +457 -128
  54. package/unifiedBalance.d.cts +108 -11
  55. package/unifiedBalance.d.mts +108 -11
  56. package/unifiedBalance.d.ts +108 -11
  57. package/unifiedBalance.mjs +457 -128
@@ -550,8 +550,23 @@ interface CCTPXChainConfig {
550
550
  * const contractType: KitContractType = 'bridge' // Valid
551
551
  * const invalidType: KitContractType = 'invalid' // TypeScript error
552
552
  * ```
553
- */
554
- type KitContractType = 'bridge' | 'adapter';
553
+ *
554
+ * @remarks
555
+ * `'senderPreservingBatcher'` carries a stricter requirement than the others,
556
+ * because setting it wrong fails silently rather than loudly. It must name a
557
+ * batching contract that preserves the calling EOA as `msg.sender` in every
558
+ * subcall — on Arc, the `Multicall3From` predeploy, which achieves that
559
+ * through the `CallFrom` precompile. The name is deliberately more specific
560
+ * than "batcher": the ubiquitous Multicall3 at
561
+ * `0xcA11bde05977b3631167028862bE2a173976CA11` has the same ABI and the same
562
+ * selectors but does **not** qualify, since each subcall would arrive as the
563
+ * Multicall3 contract, so a batched `approve` would grant an allowance from
564
+ * the batcher's own balance rather than from the user's — a field named just
565
+ * `batcher` would make that misconfiguration look valid. Leave
566
+ * `senderPreservingBatcher` unset on any chain lacking one; an unset field
567
+ * simply means callers fall back to submitting calls one at a time.
568
+ */
569
+ type KitContractType = 'bridge' | 'adapter' | 'senderPreservingBatcher';
555
570
  /**
556
571
  * Configuration for Gateway v1 contracts.
557
572
  *
@@ -1208,8 +1223,13 @@ type PreparedChainRequest = EvmPreparedChainRequest | SolanaPreparedChainRequest
1208
1223
  * Parameters for preparing an EVM contract execution.
1209
1224
  */
1210
1225
  type EvmPreparedChainRequestParams = {
1211
- /** The type of the prepared execution. */
1212
- type: 'evm';
1226
+ /**
1227
+ * The type of the prepared execution. Optional here because EVM is the
1228
+ * only chain type `Adapter.prepare()` implementations narrow their param
1229
+ * type to in practice — callers that only ever prepare EVM requests can
1230
+ * omit it rather than repeat a discriminator that never varies for them.
1231
+ */
1232
+ type?: 'evm';
1213
1233
  /** The ABI of the contract. */
1214
1234
  abi: Abi | string[];
1215
1235
  /** The address of the contract. */
@@ -2488,6 +2508,57 @@ interface EarnActionMap {
2488
2508
  readonly claimRewards: ExecuteEarnParams;
2489
2509
  }
2490
2510
 
2511
+ /** Permit standards accepted by Borrow Adapter executions. */
2512
+ declare enum BorrowPermitType {
2513
+ /** Tokens must be approved separately. */
2514
+ NONE = 0,
2515
+ /** EIP-2612 permit calldata accompanies the token input. */
2516
+ EIP2612 = 1
2517
+ }
2518
+ /** Token input forwarded by Borrow Kit to the Adapter Contract. */
2519
+ interface BorrowTokenInput {
2520
+ readonly permitType: BorrowPermitType;
2521
+ readonly token: `0x${string}`;
2522
+ readonly amount: bigint;
2523
+ readonly permitCalldata: `0x${string}`;
2524
+ }
2525
+ /** A single instruction in a Circle-signed Borrow execution. */
2526
+ interface BorrowInstruction {
2527
+ readonly target: `0x${string}`;
2528
+ readonly data: `0x${string}`;
2529
+ readonly value: string | bigint;
2530
+ readonly tokenIn: `0x${string}`;
2531
+ readonly amountToApprove: string | bigint;
2532
+ readonly tokenOut: `0x${string}`;
2533
+ readonly minTokenOut: string | bigint;
2534
+ }
2535
+ /** A token recipient in a Circle-signed Borrow execution. */
2536
+ interface BorrowTokenRecipient {
2537
+ readonly token: `0x${string}`;
2538
+ readonly beneficiary: `0x${string}`;
2539
+ }
2540
+ /** Circle-signed Borrow parameters forwarded to the Adapter Contract. */
2541
+ interface BorrowExecutionParams {
2542
+ readonly instructions: readonly BorrowInstruction[];
2543
+ readonly tokens: readonly BorrowTokenRecipient[];
2544
+ readonly execId: string | bigint;
2545
+ readonly deadline: string | bigint;
2546
+ readonly metadata: `0x${string}`;
2547
+ }
2548
+ /** Parameters for a service-signed Borrow Adapter execution. */
2549
+ interface ExecuteBorrowParams extends ActionParameters {
2550
+ readonly executeParams: BorrowExecutionParams;
2551
+ readonly tokenInputs: BorrowTokenInput[];
2552
+ readonly signature: `0x${string}`;
2553
+ }
2554
+ /** Borrow actions supported by EVM adapters. */
2555
+ interface BorrowActionMap {
2556
+ /** Execute a Circle-signed partial loan repayment. */
2557
+ readonly repay: ExecuteBorrowParams;
2558
+ /** Execute a Circle-signed borrow. */
2559
+ readonly execute: ExecuteBorrowParams;
2560
+ }
2561
+
2491
2562
  /**
2492
2563
  * Single instruction to execute within the Adapter Contract.
2493
2564
  *
@@ -3444,6 +3515,8 @@ interface NativeActionMap {
3444
3515
  * @see {@link ActionPayload} for extracting payload types
3445
3516
  */
3446
3517
  interface ActionMap {
3518
+ /** Borrow operations that execute service-signed payloads. */
3519
+ readonly borrow: BorrowActionMap;
3447
3520
  /** CCTP-specific operations with automatic address resolution. */
3448
3521
  readonly cctp: CCTPActionMap;
3449
3522
  /** CCTPx operations (CrossChainTokenService) for cross-chain transfers of registered tokens (Circle-issued or otherwise). */
@@ -3463,6 +3536,7 @@ interface ActionMap {
3463
3536
  /** Earn operations that execute service-signed payloads via the adapter contract. */
3464
3537
  readonly earn: EarnActionMap;
3465
3538
  }
3539
+
3466
3540
  /**
3467
3541
  * Determine if a type represents an action parameter object (leaf node).
3468
3542
  *
@@ -4292,6 +4366,7 @@ interface ErrorInfo {
4292
4366
  * - retryDelay: Base delay (ms); constant wait for `'fixed'` or exponential seed for `'exponential'`
4293
4367
  * - backoff: Retry-delay strategy, `'fixed'` (default) or `'exponential'`
4294
4368
  * - maxRetryDelayMs: Optional ceiling (ms) for a single backoff wait
4369
+ * - isTerminalError: Optional predicate marking an error non-retryable
4295
4370
  * - headers: Optional HTTP headers to include with each request
4296
4371
  */
4297
4372
  interface ApiPollingConfig {
@@ -4321,6 +4396,18 @@ interface ApiPollingConfig {
4321
4396
  * {@link DEFAULT_MAX_RETRY_DELAY_MS} when omitted.
4322
4397
  */
4323
4398
  maxRetryDelayMs?: number | undefined;
4399
+ /**
4400
+ * Optional predicate that marks a failed attempt as terminal so the poller
4401
+ * throws it immediately instead of spending the remaining retry budget.
4402
+ *
4403
+ * It is consulted before the built-in retry rules, so it can short-circuit an
4404
+ * error those rules would otherwise retry — for example a `404` that a given
4405
+ * route knows is deterministic (the resource does not exist) rather than
4406
+ * transient. The predicate receives the attempt's `Error`, including any
4407
+ * `responseBody` the request attached, and returning `true` skips all
4408
+ * remaining retries. Omit it to keep the default retry policy.
4409
+ */
4410
+ isTerminalError?: ((error: Error) => boolean) | undefined;
4324
4411
  /** Optional HTTP headers to include with requests */
4325
4412
  headers?: Record<string, string> | undefined;
4326
4413
  }
@@ -6939,8 +7026,8 @@ interface DepositParams<TAdapterCapabilities extends AdapterCapabilities = Adapt
6939
7026
  * The token allowance strategy to authorize the deposit.
6940
7027
  *
6941
7028
  * Only valid for same-chain (STANDARD) deposits. Must not be set when
6942
- * `to` is provided (FAST cross-chain deposits do not use an allowance
6943
- * strategy).
7029
+ * `config.transferSpeed` is `'FAST'` (FAST cross-chain deposits do not use
7030
+ * an allowance strategy).
6944
7031
  *
6945
7032
  * @defaultValue 'authorize'
6946
7033
  */
@@ -6953,6 +7040,10 @@ interface DepositParams<TAdapterCapabilities extends AdapterCapabilities = Adapt
6953
7040
  * chain, which then calls Gateway `deposit` in a single relayed flow.
6954
7041
  *
6955
7042
  * Must not be set when `config.transferSpeed` is `'STANDARD'`.
7043
+ *
7044
+ * @defaultValue `{ chain: 'Arc' }` for mainnet sources and
7045
+ * `{ chain: 'Arc_Testnet' }` for testnet sources when
7046
+ * `config.transferSpeed` is `'FAST'`.
6956
7047
  */
6957
7048
  to?: {
6958
7049
  chain: UnifiedBalanceChainIdentifier;
@@ -6961,7 +7052,7 @@ interface DepositParams<TAdapterCapabilities extends AdapterCapabilities = Adapt
6961
7052
  * Transfer configuration for the deposit.
6962
7053
  *
6963
7054
  * @defaultValue `{ transferSpeed: 'STANDARD' }`. Set `transferSpeed: 'FAST'`
6964
- * explicitly for cross-chain deposits (when `to` is provided).
7055
+ * explicitly for cross-chain deposits; `to` defaults to Arc when omitted.
6965
7056
  */
6966
7057
  config?: DepositConfig;
6967
7058
  /**
@@ -7096,13 +7187,15 @@ interface DepositResult {
7096
7187
  /**
7097
7188
  * Source chain of the cross-chain deposit (FAST path only).
7098
7189
  *
7099
- * Present when `to` was specified in the deposit params.
7190
+ * Present for every FAST deposit, including those where `to` was omitted
7191
+ * and defaulted to Arc.
7100
7192
  */
7101
7193
  sourceChain?: Blockchain;
7102
7194
  /**
7103
7195
  * Destination chain of the cross-chain deposit (FAST path only).
7104
7196
  *
7105
- * Present when `to` was specified in the deposit params.
7197
+ * Present for every FAST deposit. When `to` was omitted this is the
7198
+ * default destination (`Arc` or `Arc_Testnet`).
7106
7199
  */
7107
7200
  destinationChain?: Blockchain;
7108
7201
  /**
@@ -7188,8 +7281,11 @@ interface EstimateDepositParams<TAdapterCapabilities extends AdapterCapabilities
7188
7281
  /**
7189
7282
  * Destination chain for a FAST cross-chain deposit.
7190
7283
  *
7191
- * Required when `config.transferSpeed` is `'FAST'`.
7192
7284
  * Must not be set when `config.transferSpeed` is `'STANDARD'` (the default).
7285
+ *
7286
+ * @defaultValue `{ chain: 'Arc' }` for mainnet sources and
7287
+ * `{ chain: 'Arc_Testnet' }` for testnet sources when
7288
+ * `config.transferSpeed` is `'FAST'`.
7193
7289
  */
7194
7290
  to?: {
7195
7291
  chain: UnifiedBalanceChainIdentifier;
@@ -8045,7 +8141,8 @@ declare class AppKitUnifiedBalance {
8045
8141
  * {@link AppKitUnifiedBalance.depositFor}.
8046
8142
  *
8047
8143
  * @param params - Estimate details including the depositor context, amount,
8048
- * destination chain, and optional transfer speed.
8144
+ * destination chain (defaults to Arc / Arc_Testnet for FAST), and optional
8145
+ * transfer speed.
8049
8146
  * @returns Promise resolving to the itemised fee estimate.
8050
8147
  * @throws {KitError} If the estimate parameters are invalid or the route is
8051
8148
  * unsupported.
@@ -550,8 +550,23 @@ interface CCTPXChainConfig {
550
550
  * const contractType: KitContractType = 'bridge' // Valid
551
551
  * const invalidType: KitContractType = 'invalid' // TypeScript error
552
552
  * ```
553
- */
554
- type KitContractType = 'bridge' | 'adapter';
553
+ *
554
+ * @remarks
555
+ * `'senderPreservingBatcher'` carries a stricter requirement than the others,
556
+ * because setting it wrong fails silently rather than loudly. It must name a
557
+ * batching contract that preserves the calling EOA as `msg.sender` in every
558
+ * subcall — on Arc, the `Multicall3From` predeploy, which achieves that
559
+ * through the `CallFrom` precompile. The name is deliberately more specific
560
+ * than "batcher": the ubiquitous Multicall3 at
561
+ * `0xcA11bde05977b3631167028862bE2a173976CA11` has the same ABI and the same
562
+ * selectors but does **not** qualify, since each subcall would arrive as the
563
+ * Multicall3 contract, so a batched `approve` would grant an allowance from
564
+ * the batcher's own balance rather than from the user's — a field named just
565
+ * `batcher` would make that misconfiguration look valid. Leave
566
+ * `senderPreservingBatcher` unset on any chain lacking one; an unset field
567
+ * simply means callers fall back to submitting calls one at a time.
568
+ */
569
+ type KitContractType = 'bridge' | 'adapter' | 'senderPreservingBatcher';
555
570
  /**
556
571
  * Configuration for Gateway v1 contracts.
557
572
  *
@@ -1208,8 +1223,13 @@ type PreparedChainRequest = EvmPreparedChainRequest | SolanaPreparedChainRequest
1208
1223
  * Parameters for preparing an EVM contract execution.
1209
1224
  */
1210
1225
  type EvmPreparedChainRequestParams = {
1211
- /** The type of the prepared execution. */
1212
- type: 'evm';
1226
+ /**
1227
+ * The type of the prepared execution. Optional here because EVM is the
1228
+ * only chain type `Adapter.prepare()` implementations narrow their param
1229
+ * type to in practice — callers that only ever prepare EVM requests can
1230
+ * omit it rather than repeat a discriminator that never varies for them.
1231
+ */
1232
+ type?: 'evm';
1213
1233
  /** The ABI of the contract. */
1214
1234
  abi: Abi | string[];
1215
1235
  /** The address of the contract. */
@@ -2488,6 +2508,57 @@ interface EarnActionMap {
2488
2508
  readonly claimRewards: ExecuteEarnParams;
2489
2509
  }
2490
2510
 
2511
+ /** Permit standards accepted by Borrow Adapter executions. */
2512
+ declare enum BorrowPermitType {
2513
+ /** Tokens must be approved separately. */
2514
+ NONE = 0,
2515
+ /** EIP-2612 permit calldata accompanies the token input. */
2516
+ EIP2612 = 1
2517
+ }
2518
+ /** Token input forwarded by Borrow Kit to the Adapter Contract. */
2519
+ interface BorrowTokenInput {
2520
+ readonly permitType: BorrowPermitType;
2521
+ readonly token: `0x${string}`;
2522
+ readonly amount: bigint;
2523
+ readonly permitCalldata: `0x${string}`;
2524
+ }
2525
+ /** A single instruction in a Circle-signed Borrow execution. */
2526
+ interface BorrowInstruction {
2527
+ readonly target: `0x${string}`;
2528
+ readonly data: `0x${string}`;
2529
+ readonly value: string | bigint;
2530
+ readonly tokenIn: `0x${string}`;
2531
+ readonly amountToApprove: string | bigint;
2532
+ readonly tokenOut: `0x${string}`;
2533
+ readonly minTokenOut: string | bigint;
2534
+ }
2535
+ /** A token recipient in a Circle-signed Borrow execution. */
2536
+ interface BorrowTokenRecipient {
2537
+ readonly token: `0x${string}`;
2538
+ readonly beneficiary: `0x${string}`;
2539
+ }
2540
+ /** Circle-signed Borrow parameters forwarded to the Adapter Contract. */
2541
+ interface BorrowExecutionParams {
2542
+ readonly instructions: readonly BorrowInstruction[];
2543
+ readonly tokens: readonly BorrowTokenRecipient[];
2544
+ readonly execId: string | bigint;
2545
+ readonly deadline: string | bigint;
2546
+ readonly metadata: `0x${string}`;
2547
+ }
2548
+ /** Parameters for a service-signed Borrow Adapter execution. */
2549
+ interface ExecuteBorrowParams extends ActionParameters {
2550
+ readonly executeParams: BorrowExecutionParams;
2551
+ readonly tokenInputs: BorrowTokenInput[];
2552
+ readonly signature: `0x${string}`;
2553
+ }
2554
+ /** Borrow actions supported by EVM adapters. */
2555
+ interface BorrowActionMap {
2556
+ /** Execute a Circle-signed partial loan repayment. */
2557
+ readonly repay: ExecuteBorrowParams;
2558
+ /** Execute a Circle-signed borrow. */
2559
+ readonly execute: ExecuteBorrowParams;
2560
+ }
2561
+
2491
2562
  /**
2492
2563
  * Single instruction to execute within the Adapter Contract.
2493
2564
  *
@@ -3444,6 +3515,8 @@ interface NativeActionMap {
3444
3515
  * @see {@link ActionPayload} for extracting payload types
3445
3516
  */
3446
3517
  interface ActionMap {
3518
+ /** Borrow operations that execute service-signed payloads. */
3519
+ readonly borrow: BorrowActionMap;
3447
3520
  /** CCTP-specific operations with automatic address resolution. */
3448
3521
  readonly cctp: CCTPActionMap;
3449
3522
  /** CCTPx operations (CrossChainTokenService) for cross-chain transfers of registered tokens (Circle-issued or otherwise). */
@@ -3463,6 +3536,7 @@ interface ActionMap {
3463
3536
  /** Earn operations that execute service-signed payloads via the adapter contract. */
3464
3537
  readonly earn: EarnActionMap;
3465
3538
  }
3539
+
3466
3540
  /**
3467
3541
  * Determine if a type represents an action parameter object (leaf node).
3468
3542
  *
@@ -4292,6 +4366,7 @@ interface ErrorInfo {
4292
4366
  * - retryDelay: Base delay (ms); constant wait for `'fixed'` or exponential seed for `'exponential'`
4293
4367
  * - backoff: Retry-delay strategy, `'fixed'` (default) or `'exponential'`
4294
4368
  * - maxRetryDelayMs: Optional ceiling (ms) for a single backoff wait
4369
+ * - isTerminalError: Optional predicate marking an error non-retryable
4295
4370
  * - headers: Optional HTTP headers to include with each request
4296
4371
  */
4297
4372
  interface ApiPollingConfig {
@@ -4321,6 +4396,18 @@ interface ApiPollingConfig {
4321
4396
  * {@link DEFAULT_MAX_RETRY_DELAY_MS} when omitted.
4322
4397
  */
4323
4398
  maxRetryDelayMs?: number | undefined;
4399
+ /**
4400
+ * Optional predicate that marks a failed attempt as terminal so the poller
4401
+ * throws it immediately instead of spending the remaining retry budget.
4402
+ *
4403
+ * It is consulted before the built-in retry rules, so it can short-circuit an
4404
+ * error those rules would otherwise retry — for example a `404` that a given
4405
+ * route knows is deterministic (the resource does not exist) rather than
4406
+ * transient. The predicate receives the attempt's `Error`, including any
4407
+ * `responseBody` the request attached, and returning `true` skips all
4408
+ * remaining retries. Omit it to keep the default retry policy.
4409
+ */
4410
+ isTerminalError?: ((error: Error) => boolean) | undefined;
4324
4411
  /** Optional HTTP headers to include with requests */
4325
4412
  headers?: Record<string, string> | undefined;
4326
4413
  }
@@ -6939,8 +7026,8 @@ interface DepositParams<TAdapterCapabilities extends AdapterCapabilities = Adapt
6939
7026
  * The token allowance strategy to authorize the deposit.
6940
7027
  *
6941
7028
  * Only valid for same-chain (STANDARD) deposits. Must not be set when
6942
- * `to` is provided (FAST cross-chain deposits do not use an allowance
6943
- * strategy).
7029
+ * `config.transferSpeed` is `'FAST'` (FAST cross-chain deposits do not use
7030
+ * an allowance strategy).
6944
7031
  *
6945
7032
  * @defaultValue 'authorize'
6946
7033
  */
@@ -6953,6 +7040,10 @@ interface DepositParams<TAdapterCapabilities extends AdapterCapabilities = Adapt
6953
7040
  * chain, which then calls Gateway `deposit` in a single relayed flow.
6954
7041
  *
6955
7042
  * Must not be set when `config.transferSpeed` is `'STANDARD'`.
7043
+ *
7044
+ * @defaultValue `{ chain: 'Arc' }` for mainnet sources and
7045
+ * `{ chain: 'Arc_Testnet' }` for testnet sources when
7046
+ * `config.transferSpeed` is `'FAST'`.
6956
7047
  */
6957
7048
  to?: {
6958
7049
  chain: UnifiedBalanceChainIdentifier;
@@ -6961,7 +7052,7 @@ interface DepositParams<TAdapterCapabilities extends AdapterCapabilities = Adapt
6961
7052
  * Transfer configuration for the deposit.
6962
7053
  *
6963
7054
  * @defaultValue `{ transferSpeed: 'STANDARD' }`. Set `transferSpeed: 'FAST'`
6964
- * explicitly for cross-chain deposits (when `to` is provided).
7055
+ * explicitly for cross-chain deposits; `to` defaults to Arc when omitted.
6965
7056
  */
6966
7057
  config?: DepositConfig;
6967
7058
  /**
@@ -7096,13 +7187,15 @@ interface DepositResult {
7096
7187
  /**
7097
7188
  * Source chain of the cross-chain deposit (FAST path only).
7098
7189
  *
7099
- * Present when `to` was specified in the deposit params.
7190
+ * Present for every FAST deposit, including those where `to` was omitted
7191
+ * and defaulted to Arc.
7100
7192
  */
7101
7193
  sourceChain?: Blockchain;
7102
7194
  /**
7103
7195
  * Destination chain of the cross-chain deposit (FAST path only).
7104
7196
  *
7105
- * Present when `to` was specified in the deposit params.
7197
+ * Present for every FAST deposit. When `to` was omitted this is the
7198
+ * default destination (`Arc` or `Arc_Testnet`).
7106
7199
  */
7107
7200
  destinationChain?: Blockchain;
7108
7201
  /**
@@ -7188,8 +7281,11 @@ interface EstimateDepositParams<TAdapterCapabilities extends AdapterCapabilities
7188
7281
  /**
7189
7282
  * Destination chain for a FAST cross-chain deposit.
7190
7283
  *
7191
- * Required when `config.transferSpeed` is `'FAST'`.
7192
7284
  * Must not be set when `config.transferSpeed` is `'STANDARD'` (the default).
7285
+ *
7286
+ * @defaultValue `{ chain: 'Arc' }` for mainnet sources and
7287
+ * `{ chain: 'Arc_Testnet' }` for testnet sources when
7288
+ * `config.transferSpeed` is `'FAST'`.
7193
7289
  */
7194
7290
  to?: {
7195
7291
  chain: UnifiedBalanceChainIdentifier;
@@ -8045,7 +8141,8 @@ declare class AppKitUnifiedBalance {
8045
8141
  * {@link AppKitUnifiedBalance.depositFor}.
8046
8142
  *
8047
8143
  * @param params - Estimate details including the depositor context, amount,
8048
- * destination chain, and optional transfer speed.
8144
+ * destination chain (defaults to Arc / Arc_Testnet for FAST), and optional
8145
+ * transfer speed.
8049
8146
  * @returns Promise resolving to the itemised fee estimate.
8050
8147
  * @throws {KitError} If the estimate parameters are invalid or the route is
8051
8148
  * unsupported.
@@ -550,8 +550,23 @@ interface CCTPXChainConfig {
550
550
  * const contractType: KitContractType = 'bridge' // Valid
551
551
  * const invalidType: KitContractType = 'invalid' // TypeScript error
552
552
  * ```
553
- */
554
- type KitContractType = 'bridge' | 'adapter';
553
+ *
554
+ * @remarks
555
+ * `'senderPreservingBatcher'` carries a stricter requirement than the others,
556
+ * because setting it wrong fails silently rather than loudly. It must name a
557
+ * batching contract that preserves the calling EOA as `msg.sender` in every
558
+ * subcall — on Arc, the `Multicall3From` predeploy, which achieves that
559
+ * through the `CallFrom` precompile. The name is deliberately more specific
560
+ * than "batcher": the ubiquitous Multicall3 at
561
+ * `0xcA11bde05977b3631167028862bE2a173976CA11` has the same ABI and the same
562
+ * selectors but does **not** qualify, since each subcall would arrive as the
563
+ * Multicall3 contract, so a batched `approve` would grant an allowance from
564
+ * the batcher's own balance rather than from the user's — a field named just
565
+ * `batcher` would make that misconfiguration look valid. Leave
566
+ * `senderPreservingBatcher` unset on any chain lacking one; an unset field
567
+ * simply means callers fall back to submitting calls one at a time.
568
+ */
569
+ type KitContractType = 'bridge' | 'adapter' | 'senderPreservingBatcher';
555
570
  /**
556
571
  * Configuration for Gateway v1 contracts.
557
572
  *
@@ -1208,8 +1223,13 @@ type PreparedChainRequest = EvmPreparedChainRequest | SolanaPreparedChainRequest
1208
1223
  * Parameters for preparing an EVM contract execution.
1209
1224
  */
1210
1225
  type EvmPreparedChainRequestParams = {
1211
- /** The type of the prepared execution. */
1212
- type: 'evm';
1226
+ /**
1227
+ * The type of the prepared execution. Optional here because EVM is the
1228
+ * only chain type `Adapter.prepare()` implementations narrow their param
1229
+ * type to in practice — callers that only ever prepare EVM requests can
1230
+ * omit it rather than repeat a discriminator that never varies for them.
1231
+ */
1232
+ type?: 'evm';
1213
1233
  /** The ABI of the contract. */
1214
1234
  abi: Abi | string[];
1215
1235
  /** The address of the contract. */
@@ -2488,6 +2508,57 @@ interface EarnActionMap {
2488
2508
  readonly claimRewards: ExecuteEarnParams;
2489
2509
  }
2490
2510
 
2511
+ /** Permit standards accepted by Borrow Adapter executions. */
2512
+ declare enum BorrowPermitType {
2513
+ /** Tokens must be approved separately. */
2514
+ NONE = 0,
2515
+ /** EIP-2612 permit calldata accompanies the token input. */
2516
+ EIP2612 = 1
2517
+ }
2518
+ /** Token input forwarded by Borrow Kit to the Adapter Contract. */
2519
+ interface BorrowTokenInput {
2520
+ readonly permitType: BorrowPermitType;
2521
+ readonly token: `0x${string}`;
2522
+ readonly amount: bigint;
2523
+ readonly permitCalldata: `0x${string}`;
2524
+ }
2525
+ /** A single instruction in a Circle-signed Borrow execution. */
2526
+ interface BorrowInstruction {
2527
+ readonly target: `0x${string}`;
2528
+ readonly data: `0x${string}`;
2529
+ readonly value: string | bigint;
2530
+ readonly tokenIn: `0x${string}`;
2531
+ readonly amountToApprove: string | bigint;
2532
+ readonly tokenOut: `0x${string}`;
2533
+ readonly minTokenOut: string | bigint;
2534
+ }
2535
+ /** A token recipient in a Circle-signed Borrow execution. */
2536
+ interface BorrowTokenRecipient {
2537
+ readonly token: `0x${string}`;
2538
+ readonly beneficiary: `0x${string}`;
2539
+ }
2540
+ /** Circle-signed Borrow parameters forwarded to the Adapter Contract. */
2541
+ interface BorrowExecutionParams {
2542
+ readonly instructions: readonly BorrowInstruction[];
2543
+ readonly tokens: readonly BorrowTokenRecipient[];
2544
+ readonly execId: string | bigint;
2545
+ readonly deadline: string | bigint;
2546
+ readonly metadata: `0x${string}`;
2547
+ }
2548
+ /** Parameters for a service-signed Borrow Adapter execution. */
2549
+ interface ExecuteBorrowParams extends ActionParameters {
2550
+ readonly executeParams: BorrowExecutionParams;
2551
+ readonly tokenInputs: BorrowTokenInput[];
2552
+ readonly signature: `0x${string}`;
2553
+ }
2554
+ /** Borrow actions supported by EVM adapters. */
2555
+ interface BorrowActionMap {
2556
+ /** Execute a Circle-signed partial loan repayment. */
2557
+ readonly repay: ExecuteBorrowParams;
2558
+ /** Execute a Circle-signed borrow. */
2559
+ readonly execute: ExecuteBorrowParams;
2560
+ }
2561
+
2491
2562
  /**
2492
2563
  * Single instruction to execute within the Adapter Contract.
2493
2564
  *
@@ -3444,6 +3515,8 @@ interface NativeActionMap {
3444
3515
  * @see {@link ActionPayload} for extracting payload types
3445
3516
  */
3446
3517
  interface ActionMap {
3518
+ /** Borrow operations that execute service-signed payloads. */
3519
+ readonly borrow: BorrowActionMap;
3447
3520
  /** CCTP-specific operations with automatic address resolution. */
3448
3521
  readonly cctp: CCTPActionMap;
3449
3522
  /** CCTPx operations (CrossChainTokenService) for cross-chain transfers of registered tokens (Circle-issued or otherwise). */
@@ -3463,6 +3536,7 @@ interface ActionMap {
3463
3536
  /** Earn operations that execute service-signed payloads via the adapter contract. */
3464
3537
  readonly earn: EarnActionMap;
3465
3538
  }
3539
+
3466
3540
  /**
3467
3541
  * Determine if a type represents an action parameter object (leaf node).
3468
3542
  *
@@ -4292,6 +4366,7 @@ interface ErrorInfo {
4292
4366
  * - retryDelay: Base delay (ms); constant wait for `'fixed'` or exponential seed for `'exponential'`
4293
4367
  * - backoff: Retry-delay strategy, `'fixed'` (default) or `'exponential'`
4294
4368
  * - maxRetryDelayMs: Optional ceiling (ms) for a single backoff wait
4369
+ * - isTerminalError: Optional predicate marking an error non-retryable
4295
4370
  * - headers: Optional HTTP headers to include with each request
4296
4371
  */
4297
4372
  interface ApiPollingConfig {
@@ -4321,6 +4396,18 @@ interface ApiPollingConfig {
4321
4396
  * {@link DEFAULT_MAX_RETRY_DELAY_MS} when omitted.
4322
4397
  */
4323
4398
  maxRetryDelayMs?: number | undefined;
4399
+ /**
4400
+ * Optional predicate that marks a failed attempt as terminal so the poller
4401
+ * throws it immediately instead of spending the remaining retry budget.
4402
+ *
4403
+ * It is consulted before the built-in retry rules, so it can short-circuit an
4404
+ * error those rules would otherwise retry — for example a `404` that a given
4405
+ * route knows is deterministic (the resource does not exist) rather than
4406
+ * transient. The predicate receives the attempt's `Error`, including any
4407
+ * `responseBody` the request attached, and returning `true` skips all
4408
+ * remaining retries. Omit it to keep the default retry policy.
4409
+ */
4410
+ isTerminalError?: ((error: Error) => boolean) | undefined;
4324
4411
  /** Optional HTTP headers to include with requests */
4325
4412
  headers?: Record<string, string> | undefined;
4326
4413
  }
@@ -6939,8 +7026,8 @@ interface DepositParams<TAdapterCapabilities extends AdapterCapabilities = Adapt
6939
7026
  * The token allowance strategy to authorize the deposit.
6940
7027
  *
6941
7028
  * Only valid for same-chain (STANDARD) deposits. Must not be set when
6942
- * `to` is provided (FAST cross-chain deposits do not use an allowance
6943
- * strategy).
7029
+ * `config.transferSpeed` is `'FAST'` (FAST cross-chain deposits do not use
7030
+ * an allowance strategy).
6944
7031
  *
6945
7032
  * @defaultValue 'authorize'
6946
7033
  */
@@ -6953,6 +7040,10 @@ interface DepositParams<TAdapterCapabilities extends AdapterCapabilities = Adapt
6953
7040
  * chain, which then calls Gateway `deposit` in a single relayed flow.
6954
7041
  *
6955
7042
  * Must not be set when `config.transferSpeed` is `'STANDARD'`.
7043
+ *
7044
+ * @defaultValue `{ chain: 'Arc' }` for mainnet sources and
7045
+ * `{ chain: 'Arc_Testnet' }` for testnet sources when
7046
+ * `config.transferSpeed` is `'FAST'`.
6956
7047
  */
6957
7048
  to?: {
6958
7049
  chain: UnifiedBalanceChainIdentifier;
@@ -6961,7 +7052,7 @@ interface DepositParams<TAdapterCapabilities extends AdapterCapabilities = Adapt
6961
7052
  * Transfer configuration for the deposit.
6962
7053
  *
6963
7054
  * @defaultValue `{ transferSpeed: 'STANDARD' }`. Set `transferSpeed: 'FAST'`
6964
- * explicitly for cross-chain deposits (when `to` is provided).
7055
+ * explicitly for cross-chain deposits; `to` defaults to Arc when omitted.
6965
7056
  */
6966
7057
  config?: DepositConfig;
6967
7058
  /**
@@ -7096,13 +7187,15 @@ interface DepositResult {
7096
7187
  /**
7097
7188
  * Source chain of the cross-chain deposit (FAST path only).
7098
7189
  *
7099
- * Present when `to` was specified in the deposit params.
7190
+ * Present for every FAST deposit, including those where `to` was omitted
7191
+ * and defaulted to Arc.
7100
7192
  */
7101
7193
  sourceChain?: Blockchain;
7102
7194
  /**
7103
7195
  * Destination chain of the cross-chain deposit (FAST path only).
7104
7196
  *
7105
- * Present when `to` was specified in the deposit params.
7197
+ * Present for every FAST deposit. When `to` was omitted this is the
7198
+ * default destination (`Arc` or `Arc_Testnet`).
7106
7199
  */
7107
7200
  destinationChain?: Blockchain;
7108
7201
  /**
@@ -7188,8 +7281,11 @@ interface EstimateDepositParams<TAdapterCapabilities extends AdapterCapabilities
7188
7281
  /**
7189
7282
  * Destination chain for a FAST cross-chain deposit.
7190
7283
  *
7191
- * Required when `config.transferSpeed` is `'FAST'`.
7192
7284
  * Must not be set when `config.transferSpeed` is `'STANDARD'` (the default).
7285
+ *
7286
+ * @defaultValue `{ chain: 'Arc' }` for mainnet sources and
7287
+ * `{ chain: 'Arc_Testnet' }` for testnet sources when
7288
+ * `config.transferSpeed` is `'FAST'`.
7193
7289
  */
7194
7290
  to?: {
7195
7291
  chain: UnifiedBalanceChainIdentifier;
@@ -8045,7 +8141,8 @@ declare class AppKitUnifiedBalance {
8045
8141
  * {@link AppKitUnifiedBalance.depositFor}.
8046
8142
  *
8047
8143
  * @param params - Estimate details including the depositor context, amount,
8048
- * destination chain, and optional transfer speed.
8144
+ * destination chain (defaults to Arc / Arc_Testnet for FAST), and optional
8145
+ * transfer speed.
8049
8146
  * @returns Promise resolving to the itemised fee estimate.
8050
8147
  * @throws {KitError} If the estimate parameters are invalid or the route is
8051
8148
  * unsupported.