@circle-fin/app-kit 1.11.0 → 1.12.1

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.
@@ -740,6 +740,8 @@ declare enum Blockchain {
740
740
  World_Chain_Sepolia = "World_Chain_Sepolia",
741
741
  XDC = "XDC",
742
742
  XDC_Apothem = "XDC_Apothem",
743
+ X_Layer = "X_Layer",
744
+ X_Layer_Testnet = "X_Layer_Testnet",
743
745
  ZKSync_Era = "ZKSync_Era",
744
746
  ZKSync_Sepolia = "ZKSync_Sepolia"
745
747
  }
@@ -952,6 +954,7 @@ declare enum BridgeChain {
952
954
  Unichain = "Unichain",
953
955
  World_Chain = "World_Chain",
954
956
  XDC = "XDC",
957
+ X_Layer = "X_Layer",
955
958
  Arc_Testnet = "Arc_Testnet",
956
959
  Arbitrum_Sepolia = "Arbitrum_Sepolia",
957
960
  Avalanche_Fuji = "Avalanche_Fuji",
@@ -975,7 +978,8 @@ declare enum BridgeChain {
975
978
  Sonic_Testnet = "Sonic_Testnet",
976
979
  Unichain_Sepolia = "Unichain_Sepolia",
977
980
  World_Chain_Sepolia = "World_Chain_Sepolia",
978
- XDC_Apothem = "XDC_Apothem"
981
+ XDC_Apothem = "XDC_Apothem",
982
+ X_Layer_Testnet = "X_Layer_Testnet"
979
983
  }
980
984
  /**
981
985
  * Type representing valid bridge chain identifiers.
@@ -2953,6 +2957,18 @@ interface TokenActionMap {
2953
2957
  */
2954
2958
  walletAddress?: string | undefined;
2955
2959
  };
2960
+ /**
2961
+ * Get the on-chain name of the token contract.
2962
+ *
2963
+ * This is a read-only operation. For USDC the value is also the EIP-712
2964
+ * domain name, which permit and authorize signing flows need.
2965
+ */
2966
+ name: ActionParameters & {
2967
+ /**
2968
+ * The contract address of the token.
2969
+ */
2970
+ tokenAddress: string;
2971
+ };
2956
2972
  }
2957
2973
 
2958
2974
  /**
@@ -3782,6 +3798,30 @@ declare class ActionRegistry {
3782
3798
  executeAction<TActionKey extends ActionKeys>(action: TActionKey, params: ActionPayload<TActionKey>, context: ResolvedOperationContext): Promise<PreparedChainRequest>;
3783
3799
  }
3784
3800
 
3801
+ /**
3802
+ * Canonical list of actions that do not prepare or submit transactions.
3803
+ *
3804
+ * @internal
3805
+ */
3806
+ declare const READ_ACTION_KEYS: readonly ["token.allowance", "token.balanceOf", "token.name", "native.balanceOf", "usdc.allowance", "usdc.balanceOf", "usdc.name", "gateway.v1.isDelegate", "gateway.v1.withdrawingBalance", "gateway.v1.withdrawalBlock", "gateway.v1.signBurnIntents"];
3807
+ /**
3808
+ * Action keys that execute without preparing or submitting a transaction.
3809
+ *
3810
+ * @remarks
3811
+ * Derive this type from the canonical runtime list so compile-time and runtime
3812
+ * classification cannot drift. `gateway.v1.signBurnIntents` is included
3813
+ * because the action system models off-chain signing as a read action: it does
3814
+ * not prepare a chain request.
3815
+ *
3816
+ * @example
3817
+ * ```typescript
3818
+ * import type { ReadActionKey } from '@core/adapter'
3819
+ *
3820
+ * const action: ReadActionKey = 'token.allowance'
3821
+ * ```
3822
+ */
3823
+ type ReadActionKey = (typeof READ_ACTION_KEYS)[number];
3824
+
3785
3825
  /**
3786
3826
  * Defines the capabilities of an adapter, including address handling patterns and supported chains.
3787
3827
  *
@@ -3950,6 +3990,69 @@ declare abstract class Adapter<TAdapterCapabilities extends AdapterCapabilities
3950
3990
  * ```
3951
3991
  */
3952
3992
  prepareAction<TActionKey extends ActionKeys>(action: TActionKey, params: ActionPayload<TActionKey>, ctx: OperationContext<TAdapterCapabilities>): Promise<PreparedChainRequest>;
3993
+ /**
3994
+ * Execute a non-transaction action without routing through transaction preparation.
3995
+ *
3996
+ * @remarks
3997
+ * Use this seam for balance, allowance, contract-state, and other actions
3998
+ * classified as reads. It never calls {@link Adapter.prepareAction}, so
3999
+ * transaction authorization wrappers only observe actions that can produce a
4000
+ * signable chain request.
4001
+ *
4002
+ * @typeParam TActionKey - The read action key.
4003
+ * @param action - The read action to execute.
4004
+ * @param params - The parameters for the read action.
4005
+ * @param ctx - The operation context.
4006
+ * @returns The raw action response.
4007
+ * @throws {KitError} When the key is not a read action or no handler is registered.
4008
+ * @throws Error When the operation context or action handler fails.
4009
+ *
4010
+ * @example
4011
+ * ```typescript
4012
+ * import { Ethereum } from '@core/chains'
4013
+ *
4014
+ * const balance = await adapter.readAction(
4015
+ * 'token.balanceOf',
4016
+ * { tokenAddress, walletAddress },
4017
+ * { chain: Ethereum },
4018
+ * )
4019
+ * ```
4020
+ *
4021
+ * @internal
4022
+ */
4023
+ readAction<TActionKey extends ReadActionKey>(action: TActionKey, params: ActionPayload<TActionKey>, ctx: OperationContext<TAdapterCapabilities>): Promise<unknown>;
4024
+ /**
4025
+ * Read the current token allowance a delegate holds over an owner's tokens.
4026
+ *
4027
+ * @remarks
4028
+ * Perform a network read through {@link Adapter.readAction}. This method
4029
+ * never routes through {@link Adapter.prepareAction}. On chains without an
4030
+ * allowance model, such as Solana, return the maximum uint256 value.
4031
+ *
4032
+ * @param params - The token to query and the delegate whose allowance is being read.
4033
+ * @param ctx - Operation context with compile-time validated address requirements.
4034
+ * @returns A promise resolving to the current allowance in the token's base units.
4035
+ * @throws {KitError} When the adapter does not register a `token.allowance` handler.
4036
+ * @throws Error When the operation context or action handler fails.
4037
+ *
4038
+ * @example
4039
+ * ```typescript
4040
+ * import type { Adapter } from '@core/adapter'
4041
+ * import { Ethereum } from '@core/chains'
4042
+ *
4043
+ * declare const adapter: Adapter
4044
+ *
4045
+ * const allowance = await adapter.getTokenAllowance(
4046
+ * {
4047
+ * tokenAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
4048
+ * delegate: '0x1111111111111111111111111111111111111111',
4049
+ * },
4050
+ * { chain: Ethereum },
4051
+ * )
4052
+ * console.log(allowance) // 1000000n
4053
+ * ```
4054
+ */
4055
+ getTokenAllowance(params: ActionPayload<'token.allowance'>, ctx: OperationContext<TAdapterCapabilities>): Promise<bigint>;
3953
4056
  /**
3954
4057
  * Prepares a transaction for future gas estimation and execution.
3955
4058
  *
@@ -5260,6 +5363,132 @@ declare enum TransferSpeed {
5260
5363
  /** Standard burn mode - normal transfer time with standard fees */
5261
5364
  SLOW = "SLOW"
5262
5365
  }
5366
+ /**
5367
+ * Context object representing a wallet and signing authority on a specific blockchain network.
5368
+ *
5369
+ * Combines a wallet or contract address, the blockchain it resides on, and the adapter (signer)
5370
+ * responsible for authorizing transactions. Used to specify the source or destination in cross-chain
5371
+ * transfer operations.
5372
+ *
5373
+ * @remarks
5374
+ * The `adapter` (signer) and `address` do not always have to belong to the same entity. For example,
5375
+ * in minting or withdrawal scenarios, the signing adapter may authorize a transaction that credits
5376
+ * funds to a different recipient address. This context is essential for cross-chain operations,
5377
+ * ensuring that both the address and the associated adapter are correctly paired with the intended
5378
+ * blockchain, but not necessarily with each other.
5379
+ *
5380
+ * @example
5381
+ * ```typescript
5382
+ * import type { WalletContext } from '@core/provider'
5383
+ * import { adapter, blockchain } from './setup'
5384
+ *
5385
+ * const wallet: WalletContext = {
5386
+ * adapter,
5387
+ * address: '0x1234...abcd',
5388
+ * chain: blockchain,
5389
+ * }
5390
+ * ```
5391
+ */
5392
+ interface WalletContext<TAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities,
5393
+ /**
5394
+ * The chain definition type to use for the wallet context.
5395
+ *
5396
+ * @defaultValue ChainDefinition
5397
+ */
5398
+ TChainDefinition extends ChainDefinition = ChainDefinition> {
5399
+ /**
5400
+ * The adapter (signer) for the wallet on the specified chain.
5401
+ *
5402
+ * Responsible for authorizing transactions and signing messages on behalf of the wallet or
5403
+ * for a different recipient, depending on the use case.
5404
+ */
5405
+ adapter: Adapter<TAdapterCapabilities>;
5406
+ /**
5407
+ * The wallet or contract address.
5408
+ *
5409
+ * Must be a valid address format for the specified blockchain. May differ from the adapter's
5410
+ * own address in scenarios such as relayed transactions or third-party minting.
5411
+ */
5412
+ address: string;
5413
+ /**
5414
+ * The blockchain network where the wallet or contract address resides.
5415
+ *
5416
+ * Determines the context and format for the address and adapter.
5417
+ */
5418
+ chain: TChainDefinition;
5419
+ }
5420
+ /**
5421
+ * Wallet context for bridge destinations with optional custom recipient.
5422
+ *
5423
+ * Extends WalletContext to support scenarios where the recipient address
5424
+ * differs from the signer address (e.g., bridging to a third-party wallet).
5425
+ * The signer address is used for transaction authorization, while the
5426
+ * recipient address specifies where the minted funds should be sent.
5427
+ *
5428
+ * @typeParam TAdapterCapabilities - The adapter capabilities type to use for the wallet context.
5429
+ * @typeParam TChainDefinition - The chain definition type to use for the wallet context.
5430
+ *
5431
+ * @example
5432
+ * ```typescript
5433
+ * import type { DestinationWalletContext } from '@core/provider'
5434
+ * import { adapter, blockchain } from './setup'
5435
+ *
5436
+ * // Bridge to a custom recipient address
5437
+ * const destination: DestinationWalletContext = {
5438
+ * adapter,
5439
+ * address: '0x1234...abcd', // Signer address
5440
+ * chain: blockchain,
5441
+ * recipientAddress: '0x9876...fedc' // Custom recipient
5442
+ * }
5443
+ * ```
5444
+ */
5445
+ interface DestinationWalletContext<TAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities,
5446
+ /**
5447
+ * The chain definition type to use for the wallet context.
5448
+ *
5449
+ * @defaultValue ChainDefinition
5450
+ */
5451
+ TChainDefinition extends ChainDefinition = ChainDefinition> extends WalletContext<TAdapterCapabilities, TChainDefinition> {
5452
+ /**
5453
+ * Optional custom recipient address for minted funds.
5454
+ *
5455
+ * When provided, minted tokens will be sent to this address instead of
5456
+ * the address specified in the wallet context. The wallet context address
5457
+ * is still used for transaction signing and authorization.
5458
+ *
5459
+ * Must be a valid address format for the specified blockchain.
5460
+ */
5461
+ recipientAddress?: string;
5462
+ }
5463
+ /**
5464
+ * Parameters for executing a cross-chain bridge operation.
5465
+ */
5466
+ interface BridgeParams$1<TFromCapabilities extends AdapterCapabilities = AdapterCapabilities, TToCapabilities extends AdapterCapabilities = AdapterCapabilities,
5467
+ /**
5468
+ * The chain definition type to use for the wallet context.
5469
+ *
5470
+ * @defaultValue ChainDefinition
5471
+ */
5472
+ TChainDefinition extends ChainDefinition = ChainDefinition> {
5473
+ /** The source adapter containing wallet and chain information */
5474
+ source: WalletContext<TFromCapabilities, TChainDefinition>;
5475
+ /** The destination adapter containing wallet and chain information */
5476
+ destination: DestinationWalletContext<TToCapabilities, TChainDefinition>;
5477
+ /** The amount to transfer (as a string to avoid precision issues) */
5478
+ amount: string;
5479
+ /** The token to transfer (currently only USDC is supported) */
5480
+ token: 'USDC';
5481
+ /** Bridge configuration (e.g., fast burn settings) */
5482
+ config: BridgeConfig;
5483
+ /**
5484
+ * Optional invocation metadata for tracing and correlation.
5485
+ *
5486
+ * When provided, the `traceId` is used to correlate all events emitted during
5487
+ * the bridge operation. If not provided, an OpenTelemetry-compatible traceId
5488
+ * will be auto-generated.
5489
+ */
5490
+ invocationMeta?: InvocationMeta;
5491
+ }
5263
5492
  /**
5264
5493
  * Cost estimation result for a cross-chain transfer operation.
5265
5494
  *
@@ -5630,6 +5859,91 @@ type BridgeDestination<TAdapterCapabilities extends AdapterCapabilities = Adapte
5630
5859
  useForwarder?: boolean;
5631
5860
  }) | ForwarderDestination<TChainIdentifier>;
5632
5861
 
5862
+ type FeeFunction<TFromAdapterCapabilities extends AdapterCapabilities, TToAdapterCapabilities extends AdapterCapabilities> = (params: BridgeParams$1<TFromAdapterCapabilities, TToAdapterCapabilities>) => Promise<string> | string;
5863
+ type FeeRecipientFunction<TFromAdapterCapabilities extends AdapterCapabilities, TToAdapterCapabilities extends AdapterCapabilities> = (feePayoutChain: ChainDefinition, params: BridgeParams$1<TFromAdapterCapabilities, TToAdapterCapabilities>) => Promise<string> | string;
5864
+ /**
5865
+ * Custom fee policy for BridgeKit.
5866
+ *
5867
+ * Provides hooks to calculate an absolute custom fee and resolve the fee recipient address
5868
+ * on the source chain. The returned fee is **added on top of the transfer amount** (the wallet signs for
5869
+ * `amount + customFee`). Once collected, the custom fee is split:
5870
+ *
5871
+ * - **10%** automatically routes to Circle.
5872
+ * - **90%** routes to your supplied `recipientAddress`.
5873
+ *
5874
+ * The entire transfer amount still flows through CCTPv2, which then charges its own protocol fee.
5875
+ *
5876
+ * Use `computeFee` (recommended) for human-readable amounts, or `calculateFee` (deprecated)
5877
+ * for smallest-unit amounts. Only one should be provided.
5878
+ *
5879
+ * @example
5880
+ * ```typescript
5881
+ * import type { CustomFeePolicy, BridgeParams } from '@circle-fin/bridge-kit'
5882
+ *
5883
+ * const policy: CustomFeePolicy = {
5884
+ * // computeFee receives human-readable amounts (e.g., '100' for 100 USDC)
5885
+ * computeFee: (params: BridgeParams) => {
5886
+ * const amount = parseFloat(params.amount)
5887
+ *
5888
+ * // 1% fee, capped between 5-50 USDC
5889
+ * const fee = Math.min(Math.max(amount * 0.01, 5), 50)
5890
+ * return fee.toFixed(6)
5891
+ * },
5892
+ * resolveFeeRecipientAddress: (feePayoutChain) =>
5893
+ * feePayoutChain.type === 'solana'
5894
+ * ? 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'
5895
+ * : '0x1234567890123456789012345678901234567890',
5896
+ * }
5897
+ * ```
5898
+ */
5899
+ type CustomFeePolicy$2 = {
5900
+ /**
5901
+ * A function that returns the fee to charge for the bridge transfer.
5902
+ * The value returned from the function represents an absolute fee.
5903
+ * The returned fee is **added on top of the transfer amount**. For example, returning
5904
+ * `'5'` (5 USDC) for a 100 USDC transfer causes the wallet to debit 105 USDC total.
5905
+ * CCTPv2 still processes the full 100 USDC transfer amount, while the custom fee is split
5906
+ * 10%/90% between Circle and your fee recipient.
5907
+ *
5908
+ * @example
5909
+ * ```typescript
5910
+ * computeFee: (params) => {
5911
+ * const amount = parseFloat(params.amount)
5912
+ * return (amount * 0.01).toString() // 1% fee
5913
+ * }
5914
+ * ```
5915
+ */
5916
+ computeFee: FeeFunction<AdapterCapabilities, AdapterCapabilities>;
5917
+ calculateFee?: never;
5918
+ /**
5919
+ * A function that returns the fee recipient for a bridge transfer.
5920
+ * The value returned from the function represents the address that will receive the fee on the source chain of the bridge transfer.
5921
+ * The fee recipient address **must be a valid address for the source chain** of the bridge transfer.
5922
+ *
5923
+ * For example: if you are bridging from Ethereum to Solana you would return `'0x1234567890123456789012345678901234567890'`,
5924
+ * because the source chain of the bridge transfer is Ethereum.
5925
+ */
5926
+ resolveFeeRecipientAddress: FeeRecipientFunction<AdapterCapabilities, AdapterCapabilities>;
5927
+ } | {
5928
+ computeFee?: never;
5929
+ /**
5930
+ * Calculate the fee to charge for the bridge transfer using smallest-unit amounts.
5931
+ *
5932
+ * @deprecated Use `computeFee` instead, which receives human-readable amounts.
5933
+ *
5934
+ * The `params.amount` is in smallest units (e.g., `'100000000'` for 100 USDC).
5935
+ */
5936
+ calculateFee: FeeFunction<AdapterCapabilities, AdapterCapabilities>;
5937
+ /**
5938
+ * A function that returns the fee recipient for a bridge transfer.
5939
+ * The value returned from the function represents the address that will receive the fee on the source chain of the bridge transfer.
5940
+ * The fee recipient address **must be a valid address for the source chain** of the bridge transfer.
5941
+ *
5942
+ * For example: if you are bridging from Ethereum to Solana you would return `'0x1234567890123456789012345678901234567890'`,
5943
+ * because the source chain of the bridge transfer is Ethereum.
5944
+ */
5945
+ resolveFeeRecipientAddress: FeeRecipientFunction<AdapterCapabilities, AdapterCapabilities>;
5946
+ };
5633
5947
  /**
5634
5948
  * Parameters for initiating a cross-chain USDC bridge transfer.
5635
5949
  *
@@ -5734,6 +6048,463 @@ interface BridgeParams<TFromAdapterCapabilities extends AdapterCapabilities = Ad
5734
6048
  invocationMeta?: InvocationMeta;
5735
6049
  }
5736
6050
 
6051
+ /**
6052
+ * Allowance strategy for token approvals during swap operations.
6053
+ *
6054
+ * Defines how token allowances should be granted to the swap contract:
6055
+ * - `permit`: Use EIP-2612 permit signature (gas-efficient, no approval transaction)
6056
+ * - `approve`: Traditional approval transaction
6057
+ *
6058
+ * The default strategy is `permit` with fallback to `approve` if permit is not supported.
6059
+ */
6060
+ type AllowanceStrategy$1 = 'permit' | 'approve';
6061
+ /**
6062
+ * Configuration options for swap operations.
6063
+ *
6064
+ * Controls swap behavior including allowance strategy, slippage tolerance,
6065
+ * minimum output amounts, custom fees, and kit identification.
6066
+ *
6067
+ * @example
6068
+ * ```typescript
6069
+ * import type { ServiceSwapConfig } from '@circle-fin/provider-stablecoin-service-swap'
6070
+ *
6071
+ * // Percentage-based fee
6072
+ * const config: ServiceSwapConfig = {
6073
+ * allowanceStrategy: 'permit',
6074
+ * slippageBps: 300, // 3%
6075
+ * stopLimit: '950000', // Minimum 0.95 USDC output
6076
+ * customFee: {
6077
+ * percentageBps: 1000, // 10% fee
6078
+ * recipientAddress: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
6079
+ * }
6080
+ * }
6081
+ * ```
6082
+ *
6083
+ * @example
6084
+ * ```typescript
6085
+ * // Absolute amount fee (from callback)
6086
+ * const config: ServiceSwapConfig = {
6087
+ * allowanceStrategy: 'permit',
6088
+ * customFee: {
6089
+ * amount: '10000', // 0.01 USDC fee (absolute)
6090
+ * recipientAddress: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
6091
+ * }
6092
+ * }
6093
+ * ```
6094
+ */
6095
+ interface ServiceSwapConfig {
6096
+ /**
6097
+ * Strategy for granting token allowances to the swap contract.
6098
+ *
6099
+ * Defaults to 'permit' with fallback to 'approve'.
6100
+ */
6101
+ allowanceStrategy?: AllowanceStrategy$1;
6102
+ /**
6103
+ * Maximum acceptable slippage in basis points (BPS).
6104
+ *
6105
+ * 1 BPS = 0.01%, so 300 BPS = 3% slippage.
6106
+ * Defaults to 300 BPS (3%).
6107
+ */
6108
+ slippageBps?: number;
6109
+ /**
6110
+ * Minimum acceptable output amount in smallest units (stop-limit).
6111
+ *
6112
+ * If the estimated output falls below this value, the swap will fail.
6113
+ * Expressed as a string to avoid precision issues.
6114
+ */
6115
+ stopLimit?: string;
6116
+ /**
6117
+ * Custom fee configuration for this swap.
6118
+ *
6119
+ * Supports two mutually exclusive approaches:
6120
+ * 1. Percentage-based: Use `percentageBps` field (simple)
6121
+ * 2. Absolute amount: Use `amount` field (from callback)
6122
+ *
6123
+ * If both are set, validation will fail. Transaction-level percentage
6124
+ * takes precedence over kit-level callback policy.
6125
+ */
6126
+ customFee?: {
6127
+ /**
6128
+ * Fee percentage in basis points (NEW).
6129
+ *
6130
+ * 100 bps = 1%, 1000 bps = 10%, 10000 bps = 100%
6131
+ *
6132
+ * Service calculates fee using `estimatedAmount` for same-chain output fees
6133
+ * and the input amount for cross-chain swaps.
6134
+ * Must be greater than 0 and less than or equal to 10000 (maximum 100%).
6135
+ * Mutually exclusive with `amount`.
6136
+ *
6137
+ * @example 1000 // 10% fee
6138
+ */
6139
+ percentageBps?: number;
6140
+ /**
6141
+ * Fee amount in smallest units (for callback results).
6142
+ *
6143
+ * Absolute fee amount calculated by callback function.
6144
+ * Mutually exclusive with `percentageBps`.
6145
+ *
6146
+ * @example '10000' // 0.01 USDC (6 decimals)
6147
+ */
6148
+ amount?: string;
6149
+ /**
6150
+ * Address that will receive the developer's 90% fee share.
6151
+ *
6152
+ * Required whenever a custom fee is submitted to the provider. Optional at
6153
+ * the type level so SDK callback flows can represent partial fee state
6154
+ * before final validation.
6155
+ *
6156
+ * Must be valid on the fee payout chain: source chain for input-side fees
6157
+ * and cross-chain swaps, destination chain for same-chain output-side fees.
6158
+ *
6159
+ * @example '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
6160
+ */
6161
+ recipientAddress?: string;
6162
+ };
6163
+ /**
6164
+ * Stablecoin Service Kit Key used to authenticate service-backed swap
6165
+ * requests.
6166
+ *
6167
+ * Treat this value as a credential. Do not log it, embed it in client-side
6168
+ * source, or expose it in telemetry.
6169
+ */
6170
+ kitKey?: string;
6171
+ /**
6172
+ * DEX aggregator identifier used to source the swap route.
6173
+ *
6174
+ * @example 'lifi', 'paraswap'
6175
+ */
6176
+ provider?: string;
6177
+ /**
6178
+ * Whether to fuse the ERC-20 approval and the swap into a single atomic
6179
+ * batch when the adapter supports it (EIP-5792, or a signing strategy that
6180
+ * declares atomic batching).
6181
+ *
6182
+ * @remarks
6183
+ * Defaults to `true`. When batching is available this collapses the two
6184
+ * sequential transactions of the on-chain approval path into one atomic
6185
+ * submission — a single signing challenge for a smart-contract wallet. Set
6186
+ * to `false` to force the sequential approve-then-swap path. Has no effect on
6187
+ * the gasless permit path (already a single transaction) or on native-token
6188
+ * swaps (no approval needed).
6189
+ *
6190
+ * The batch path relies on the wallet's own gas estimation for the swap call:
6191
+ * the service-provided gas floor and pre-flight simulation that the sequential
6192
+ * path applies are not conveyed through the batch. For a complex/multi-hop
6193
+ * swap whose wallet-side estimate under-shoots, this can out-of-gas-revert the
6194
+ * atomic batch where the sequential path would succeed — set `false` to fall
6195
+ * back to the service-floored sequential path if you hit this.
6196
+ *
6197
+ * @defaultValue true
6198
+ */
6199
+ batchTransactions?: boolean;
6200
+ }
6201
+ /**
6202
+ * Parameters for initiating a swap operation through the Stablecoin Service.
6203
+ *
6204
+ * This type is used as the primary input to provider swap operations, allowing users to specify
6205
+ * the source context, input/output tokens, swap amount, destination address, and optional configuration.
6206
+ *
6207
+ * @typeParam TFromAdapterCapabilities - The adapter capabilities type for the source adapter.
6208
+ *
6209
+ * @example
6210
+ * ```typescript
6211
+ * import type { ServiceSwapParams } from '@circle-fin/provider-stablecoin-service-swap'
6212
+ * import { createAdapterFromPrivateKey } from '@circle-fin/adapter-viem-v2'
6213
+ * import { Ethereum } from '@core/chains'
6214
+ *
6215
+ * const adapter = createAdapterFromPrivateKey({
6216
+ * privateKey: process.env.PRIVATE_KEY,
6217
+ * })
6218
+ *
6219
+ * const params: ServiceSwapParams = {
6220
+ * from: { adapter, chain: Ethereum },
6221
+ * tokenIn: 'USDC', // Alias resolves to chain-specific address
6222
+ * tokenOut: 'USDT', // Alias resolves to chain-specific address
6223
+ * amountIn: '100500000', // 100.50 USDC in base units
6224
+ * to: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e',
6225
+ * config: {
6226
+ * slippageBps: 300, // 3% slippage
6227
+ * allowanceStrategy: 'permit'
6228
+ * }
6229
+ * }
6230
+ * ```
6231
+ */
6232
+ interface ServiceSwapParams<TFromAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities,
6233
+ /**
6234
+ * The chain definition type to use for the wallet context.
6235
+ *
6236
+ * @defaultValue ChainDefinition
6237
+ */
6238
+ TChainDefinition extends ChainDefinition = ChainDefinition> {
6239
+ /**
6240
+ * The source adapter context (wallet and chain) for the swap.
6241
+ */
6242
+ from: WalletContext<TFromAdapterCapabilities, TChainDefinition>;
6243
+ /**
6244
+ * The input token address or alias to swap from.
6245
+ *
6246
+ * **Supported formats:**
6247
+ * - Token alias: `"USDC"`, `"USDT"`, `"NATIVE"` (case-insensitive)
6248
+ * - EVM address: `'0x'` prefixed hex (e.g., `'0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'`)
6249
+ * - Solana address: Base58-encoded (e.g., `'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'`)
6250
+ *
6251
+ * Token aliases are automatically resolved to the chain-specific contract address.
6252
+ *
6253
+ * @example 'USDC' // Recommended: use alias
6254
+ * @example '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' // Or full address
6255
+ */
6256
+ tokenIn: string;
6257
+ /**
6258
+ * The output token address or alias to swap to.
6259
+ *
6260
+ * **Supported formats:**
6261
+ * - Token alias: `"USDC"`, `"USDT"`, `"NATIVE"` (case-insensitive)
6262
+ * - EVM address: `'0x'` prefixed hex (e.g., `'0xdAC17F958D2ee523a2206206994597C13D831ec7'`)
6263
+ * - Solana address: Base58-encoded (e.g., `'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB'`)
6264
+ *
6265
+ * Token aliases are automatically resolved to the chain-specific contract address.
6266
+ *
6267
+ * @example 'USDT' // Recommended: use alias
6268
+ * @example '0xdAC17F958D2ee523a2206206994597C13D831ec7' // Or full address
6269
+ */
6270
+ tokenOut: string;
6271
+ /**
6272
+ * The amount of input token to swap in base units.
6273
+ *
6274
+ * SwapKit converts human-readable amounts to base units before passing to the provider.
6275
+ *
6276
+ * @example '100500000' for 100.50 USDC (6 decimals)
6277
+ */
6278
+ amountIn: string;
6279
+ /**
6280
+ * The destination address where the swapped tokens will be sent.
6281
+ *
6282
+ * @example '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
6283
+ */
6284
+ to: string;
6285
+ /**
6286
+ * Optional destination chain for cross-chain swaps.
6287
+ *
6288
+ * Defaults to `from.chain` for same-chain swaps.
6289
+ */
6290
+ toChain?: TChainDefinition;
6291
+ /**
6292
+ * Optional configuration for swap behavior.
6293
+ *
6294
+ * If omitted, defaults will be used:
6295
+ * - allowanceStrategy: 'permit' (fallback to 'approve')
6296
+ * - slippageBps: 300 (3%)
6297
+ */
6298
+ config?: ServiceSwapConfig;
6299
+ }
6300
+
6301
+ /**
6302
+ * Fee context when fee is taken from INPUT token.
6303
+ *
6304
+ * Used for swaps where the fee is collected from the input token, including
6305
+ * all cross-chain swaps.
6306
+ * Extends the resolved swap parameters with a discriminator to indicate input fee scenario.
6307
+ *
6308
+ * @typeParam TFromAdapterCapabilities - The adapter capabilities type for the source adapter
6309
+ *
6310
+ * @example
6311
+ * ```typescript
6312
+ * // USDC → RandomToken swap (fee from input)
6313
+ * const context: SwapInputFeeContext = {
6314
+ * type: 'input',
6315
+ * from: {
6316
+ * adapter: viemAdapter,
6317
+ * chain: Ethereum,
6318
+ * address: '0x...'
6319
+ * },
6320
+ * tokenIn: 'USDC',
6321
+ * tokenOut: 'RandomToken',
6322
+ * amountIn: '100000000', // 100 USDC in base units
6323
+ * to: '0x...'
6324
+ * }
6325
+ * ```
6326
+ */
6327
+ interface SwapInputFeeContext<TFromAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities> extends ResolvedSwapParams<TFromAdapterCapabilities> {
6328
+ /**
6329
+ * Fee source discriminator - input token.
6330
+ */
6331
+ type: 'input';
6332
+ }
6333
+ /**
6334
+ * Fee context when fee is taken from OUTPUT token.
6335
+ *
6336
+ * Used for swaps where the output token is supported for fee collection.
6337
+ * Extends the resolved swap parameters with output amounts and discriminator.
6338
+ *
6339
+ * @typeParam TFromAdapterCapabilities - The adapter capabilities type for the source adapter
6340
+ *
6341
+ * @remarks
6342
+ * If using `estimatedAmount` in callback and quote cache expires,
6343
+ * calculated fee may not match fresh quote. Use `minAmount` for
6344
+ * predictability at the cost of potentially lower fees.
6345
+ *
6346
+ * @example
6347
+ * ```typescript
6348
+ * // RandomToken → USDC swap (fee from output)
6349
+ * const context: SwapOutputFeeContext = {
6350
+ * type: 'output',
6351
+ * from: {
6352
+ * adapter: viemAdapter,
6353
+ * chain: Ethereum,
6354
+ * address: '0x...'
6355
+ * },
6356
+ * tokenIn: 'RandomToken',
6357
+ * tokenOut: 'USDC',
6358
+ * amountIn: '100000000',
6359
+ * to: '0x...',
6360
+ * minAmount: '50000000', // 50 USDC guaranteed minimum
6361
+ * estimatedAmount: '55000000' // 55 USDC expected output
6362
+ * }
6363
+ * ```
6364
+ */
6365
+ interface SwapOutputFeeContext<TFromAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities> extends ResolvedSwapParams<TFromAdapterCapabilities> {
6366
+ /**
6367
+ * Fee source discriminator - output token.
6368
+ */
6369
+ type: 'output';
6370
+ /**
6371
+ * Guaranteed minimum output amount in base units.
6372
+ *
6373
+ * More stable but lower than estimatedAmount. Use this for
6374
+ * predictable fee calculations.
6375
+ */
6376
+ minAmount: string;
6377
+ /**
6378
+ * Estimated output amount in base units.
6379
+ *
6380
+ * Expected output based on current market conditions. May be
6381
+ * higher than minAmount. Subject to change if quote expires.
6382
+ */
6383
+ estimatedAmount: string;
6384
+ }
6385
+ /**
6386
+ * Discriminated union for swap fee contexts.
6387
+ *
6388
+ * Provides different context based on whether fee is from input or output token.
6389
+ * Discriminated by the `type` field: 'input' for fees from input token, 'output' for output token.
6390
+ *
6391
+ * Includes full swap parameters (adapter, chain, tokens, amounts) for maximum flexibility
6392
+ * in fee calculation logic.
6393
+ *
6394
+ * @typeParam TFromAdapterCapabilities - The adapter capabilities type for the source adapter
6395
+ */
6396
+ type SwapFeeContext<TFromAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities> = SwapInputFeeContext<TFromAdapterCapabilities> | SwapOutputFeeContext<TFromAdapterCapabilities>;
6397
+ /**
6398
+ * Custom fee policy for SwapKit (callback-based approach).
6399
+ *
6400
+ * Provides hooks to calculate an absolute fee amount and resolve the fee
6401
+ * recipient address. The callback receives a discriminated context with
6402
+ * different fields based on operation type (bridge vs swap) and fee source
6403
+ * (input vs output).
6404
+ *
6405
+ * @remarks
6406
+ * This is mutually exclusive with transaction-level percentage fees.
6407
+ * If both are set, the transaction-level percentage takes precedence.
6408
+ *
6409
+ * The callback approach makes two API calls for same-chain output fees:
6410
+ * 1. GET /quote - retrieve fee context and quote
6411
+ * 2. POST /swap - execute with calculated fee
6412
+ *
6413
+ * Cross-chain swaps always use input fees on the source chain, so callbacks
6414
+ * receive `type: 'input'` for those routes.
6415
+ *
6416
+ * @example
6417
+ * ```typescript
6418
+ * import type { CustomFeePolicy } from '@circle-fin/swap-kit'
6419
+ *
6420
+ * const policy: CustomFeePolicy = {
6421
+ * computeFee: async (ctx) => {
6422
+ * // Discriminate by fee source (input vs output)
6423
+ * if (ctx.type === 'input') {
6424
+ * // Simple percentage for input fees
6425
+ * return (parseFloat(ctx.amountIn) * 0.1).toString()
6426
+ * } else {
6427
+ * // Complex logic for output fees (VIP tiers, etc.)
6428
+ * const user = await database.getUser(...)
6429
+ * if (user.isVIP) {
6430
+ * return (parseFloat(ctx.minAmount) * 0.05).toString()
6431
+ * }
6432
+ * return (parseFloat(ctx.estimatedAmount) * 0.1).toString()
6433
+ * }
6434
+ * },
6435
+ * resolveFeeRecipientAddress: (chain) => {
6436
+ * return chain.type === 'solana'
6437
+ * ? 'SolanaAddress...'
6438
+ * : '0xEVMAddress...'
6439
+ * },
6440
+ * }
6441
+ * ```
6442
+ */
6443
+ interface CustomFeePolicy$1 {
6444
+ /**
6445
+ * Calculate custom fee amount based on swap context.
6446
+ *
6447
+ * Receives full swap parameters including adapter, chain, tokens, and amounts.
6448
+ * Context is discriminated by `type` field:
6449
+ * - 'input': Fee from input token (OK → Any swaps and all cross-chain swaps)
6450
+ * - 'output': Fee from output token (same-chain Any → OK swaps), includes minAmount and estimatedAmount
6451
+ *
6452
+ * The wrapper automatically converts amounts to/from base units, so your
6453
+ * callback works with human-readable numbers (e.g., '0.1' for 0.1 USDC).
6454
+ *
6455
+ * @typeParam TFromAdapterCapabilities - The adapter capabilities type for the source adapter
6456
+ * @param context - Discriminated swap fee context with full swap parameters
6457
+ * @returns Absolute fee amount as string in human-readable format
6458
+ *
6459
+ * @example
6460
+ * ```typescript
6461
+ * computeFee: async (ctx) => {
6462
+ * if (ctx.type === 'output') {
6463
+ * // Output fee scenario
6464
+ * // Use estimatedAmount or minAmount for calculation
6465
+ * return (parseFloat(ctx.estimatedAmount) * 0.01).toString()
6466
+ * }
6467
+ * // Input fee scenario
6468
+ * return (parseFloat(ctx.amountIn) * 0.01).toString()
6469
+ * }
6470
+ * ```
6471
+ *
6472
+ * @example
6473
+ * ```typescript
6474
+ * computeFee: async (ctx) => {
6475
+ * if (ctx.type === 'output') {
6476
+ * // Use minAmount for predictable fees
6477
+ * return (parseFloat(ctx.minAmount) * 0.01).toString()
6478
+ * }
6479
+ * return (parseFloat(ctx.amountIn) * 0.01).toString()
6480
+ * }
6481
+ * ```
6482
+ */
6483
+ computeFee: <TFromAdapterCapabilities extends AdapterCapabilities>(context: SwapFeeContext<TFromAdapterCapabilities>) => Promise<string> | string;
6484
+ /**
6485
+ * Resolve fee recipient address for the chain where fee is collected.
6486
+ *
6487
+ * Called with the chain where fee will be paid. For cross-chain swaps this
6488
+ * is always the source chain. Must return a valid address format for that
6489
+ * chain type (EVM or Solana).
6490
+ *
6491
+ * @param feePayoutChain - Chain definition where fee is collected
6492
+ * @param context - The swap fee context with full parameters
6493
+ * @returns Fee recipient address for the chain
6494
+ *
6495
+ * @example
6496
+ * ```typescript
6497
+ * resolveFeeRecipientAddress: (chain, ctx) => {
6498
+ * // Chain-based routing
6499
+ * if (chain.type === 'solana') {
6500
+ * return 'SolanaAddress...'
6501
+ * }
6502
+ * return '0xEVMAddress...'
6503
+ * }
6504
+ * ```
6505
+ */
6506
+ resolveFeeRecipientAddress: <TFromAdapterCapabilities extends AdapterCapabilities>(feePayoutChain: ChainDefinition, context: SwapFeeContext<TFromAdapterCapabilities>) => Promise<string> | string;
6507
+ }
5737
6508
  /**
5738
6509
  * Adapter context constrained to swap-supported chains.
5739
6510
  */
@@ -5881,6 +6652,45 @@ interface SwapConfig {
5881
6652
  */
5882
6653
  kitKey?: string;
5883
6654
  }
6655
+ /**
6656
+ * Resolved parameters for swap operations after validation and normalization.
6657
+ *
6658
+ * Internal type used by SwapKit operations after `resolveSwapParams()` has:
6659
+ * - Validated the input parameters
6660
+ * - Resolved chain identifiers to full ChainDefinition objects
6661
+ * - Extracted and validated wallet addresses
6662
+ *
6663
+ * Note: Raw user input is validated first, then `tokenIn` and `tokenOut` may
6664
+ * be canonicalized for downstream routing (for example, Arc Testnet
6665
+ * `NATIVE` → `USDC`). Address resolution is handled by the provider layer.
6666
+ *
6667
+ * This type is consumed by swap providers and internal operations but is not
6668
+ * exposed to end users. It extends ServiceSwapParams which is the format expected
6669
+ * by the StablecoinServiceSwapProvider.
6670
+ *
6671
+ * @typeParam TFromAdapterCapabilities - The adapter capabilities type for the source adapter.
6672
+ *
6673
+ * @example
6674
+ * ```typescript
6675
+ * // After resolution, SwapParams becomes ResolvedSwapParams:
6676
+ * const resolved: ResolvedSwapParams = {
6677
+ * from: {
6678
+ * adapter: viemAdapter,
6679
+ * chain: Ethereum, // Full chain definition
6680
+ * address: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
6681
+ * },
6682
+ * tokenIn: 'USDC', // Canonicalized for provider routing
6683
+ * tokenOut: 'USDT', // Canonicalized for provider routing
6684
+ * amountIn: '100500000', // Converted to base units (100.5 USDC with 6 decimals)
6685
+ * to: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e',
6686
+ * config: {
6687
+ * slippageBps: 300,
6688
+ * allowanceStrategy: 'permit'
6689
+ * }
6690
+ * }
6691
+ * ```
6692
+ */
6693
+ type ResolvedSwapParams<TFromAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities> = ServiceSwapParams<TFromAdapterCapabilities>;
5884
6694
  interface SwapParams<TFromAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities> {
5885
6695
  /**
5886
6696
  * The source adapter context (wallet and chain) for the swap.
@@ -5993,6 +6803,24 @@ interface EarnConfig {
5993
6803
  * Format: `KIT_KEY:<keyId>:<keySecret>`
5994
6804
  */
5995
6805
  readonly kitKey?: string | undefined;
6806
+ /**
6807
+ * Optional base URL override for the Earn Service API.
6808
+ *
6809
+ * Defaults to `https://api.circle.com` when omitted. Override for testing
6810
+ * against staging or local environments.
6811
+ */
6812
+ readonly baseUrl?: string | undefined;
6813
+ /**
6814
+ * Enable or disable atomic batched transaction execution.
6815
+ *
6816
+ * When `true` (or `undefined` / omitted), same-chain deposit and withdraw
6817
+ * bundle the approve and execute calls into one adapter-native atomic batch
6818
+ * when the connected wallet supports it. Set to `false` to force the
6819
+ * sequential approve → execute flow.
6820
+ *
6821
+ * @defaultValue `undefined` (batching attempted when the wallet supports it)
6822
+ */
6823
+ readonly batchTransactions?: boolean | undefined;
5996
6824
  }
5997
6825
  /**
5998
6826
  * Parameters for fetching vault information.
@@ -6425,6 +7253,122 @@ interface GetClaimRewardsQuoteParams<TFromAdapterCapabilities extends AdapterCap
6425
7253
  */
6426
7254
  type EarnOperationParams = AnyDepositParams | WithdrawParams | ClaimRewardsParams | GetVaultsParams | ExploreVaultsParams | ExploreVaultsIteratorParams | GetPositionParams | GetDepositQuoteParams | GetWithdrawalQuoteParams | GetClaimRewardsQuoteParams;
6427
7255
 
7256
+ interface CustomFeeConfig {
7257
+ recipientAddress: string;
7258
+ value: string;
7259
+ }
7260
+ /**
7261
+ * Data needed to retry a mint that failed after the transfer was
7262
+ * already committed (funds locked).
7263
+ *
7264
+ * Obtain these values from the KitError (TRANSACTION_REVERTED) thrown when
7265
+ * the on-chain mint step fails. The attestation and signature are available
7266
+ * in `error.cause.trace`.
7267
+ */
7268
+ interface RetryMintConfig {
7269
+ /** The attestation hex string returned by the Gateway `/v1/transfer` API. */
7270
+ attestation: string;
7271
+ /** The attestation signature hex string returned by `/v1/transfer`. */
7272
+ signature: string;
7273
+ }
7274
+ interface SpendConfig {
7275
+ customFee?: CustomFeeConfig;
7276
+ /**
7277
+ * When provided, skips the estimate/sign/transfer steps and proceeds
7278
+ * directly to the on-chain mint using a previously obtained attestation.
7279
+ *
7280
+ * Use this to retry a mint that failed due to an RPC or network issue
7281
+ * after the transfer was already committed.
7282
+ *
7283
+ * @remarks
7284
+ * The `useForwarder` flag on the destination is ignored during retry
7285
+ * because the attestation was already issued — the Forwarding Service
7286
+ * is only involved in the initial transfer, not re-mints.
7287
+ */
7288
+ retry?: RetryMintConfig;
7289
+ }
7290
+ interface ResolvedAllocation {
7291
+ amount: string;
7292
+ chain: ChainDefinition;
7293
+ }
7294
+ interface ResolvedSpendSource<TAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities> {
7295
+ adapter: Adapter<TAdapterCapabilities>;
7296
+ allocations: ResolvedAllocation[];
7297
+ address?: string;
7298
+ sourceAccount?: string;
7299
+ }
7300
+ interface ResolvedSpendDestination<TAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities> {
7301
+ adapter?: Adapter<TAdapterCapabilities>;
7302
+ chain: ChainDefinition;
7303
+ recipientAddress?: string;
7304
+ address?: string;
7305
+ useForwarder?: boolean;
7306
+ }
7307
+ interface ResolvedSpendParams<TFromAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities, TToAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities> {
7308
+ from: ResolvedSpendSource<TFromAdapterCapabilities>[];
7309
+ to: ResolvedSpendDestination<TToAdapterCapabilities>;
7310
+ token: SupportedToken;
7311
+ config?: SpendConfig;
7312
+ }
7313
+ /**
7314
+ * Function that computes the fee amount (in human-readable units, e.g. "10.5")
7315
+ * given the resolved spend parameters.
7316
+ */
7317
+ type SpendFeeFunction = (params: ResolvedSpendParams) => Promise<string> | string;
7318
+ /**
7319
+ * Function that resolves the fee recipient address for a spend.
7320
+ * Called once per spend, against the resolved **destination** chain —
7321
+ * every fee burn intent in a spend mints to that single chain
7322
+ * regardless of which source chain(s) funded it, so only one
7323
+ * recipient address (valid on the destination chain) is ever needed.
7324
+ */
7325
+ type SpendFeeRecipientFunction = (destinationChain: ChainDefinition, params: ResolvedSpendParams) => Promise<string> | string;
7326
+ /**
7327
+ * Policy for computing and routing custom developer fees.
7328
+ *
7329
+ * **Important:** When the kit invokes `computeFee` and
7330
+ * `resolveFeeRecipientAddress`, the `params` argument may be the
7331
+ * **raw, unresolved** `SpendParams` (cast to `ResolvedSpendParams`).
7332
+ * Fields that only exist after resolution (e.g. per-source allocations)
7333
+ * may be `undefined`. Implementations should only rely on top-level
7334
+ * fields such as `to`, `token`, and `amount`.
7335
+ *
7336
+ * @remarks
7337
+ * `resolveFeeRecipientAddress` is optional when you configure
7338
+ * {@link UnifiedBalanceKit.setFeeRecipients} instead — the declarative
7339
+ * map takes priority over this callback when both are present. Provide
7340
+ * exactly one of the two; a policy with neither throws at spend time.
7341
+ */
7342
+ interface CustomFeePolicy {
7343
+ computeFee: SpendFeeFunction;
7344
+ resolveFeeRecipientAddress?: SpendFeeRecipientFunction;
7345
+ }
7346
+
7347
+ /**
7348
+ * Runtime array of token identifiers supported by the unified-balance-kit.
7349
+ *
7350
+ * @example
7351
+ * ```typescript
7352
+ * import { SUPPORTED_TOKENS } from '@circle-fin/unified-balance-kit'
7353
+ *
7354
+ * if (SUPPORTED_TOKENS.includes('USDC')) {
7355
+ * console.log('USDC is supported')
7356
+ * }
7357
+ * ```
7358
+ */
7359
+ declare const SUPPORTED_TOKENS: readonly ["USDC"];
7360
+ /**
7361
+ * Token identifiers supported by the unified-balance-kit.
7362
+ *
7363
+ * @example
7364
+ * ```typescript
7365
+ * import type { SupportedToken } from '@circle-fin/unified-balance-kit'
7366
+ *
7367
+ * const token: SupportedToken = 'USDC'
7368
+ * ```
7369
+ */
7370
+ type SupportedToken = (typeof SUPPORTED_TOKENS)[number];
7371
+
6428
7372
  /**
6429
7373
  * Operation types that support the `getFee`/`getFeeRecipient` hooks.
6430
7374
  */
@@ -6455,6 +7399,31 @@ interface OperationParamsMap {
6455
7399
  swap: SwapParams;
6456
7400
  earn: EarnOperationParams;
6457
7401
  }
7402
+ /**
7403
+ * Operation-scoped custom fee policies configured at the AppKit level.
7404
+ *
7405
+ * Each property is optional so consumers can enable custom fees only for the
7406
+ * operation they use. AppKit forwards the supplied policy to the matching
7407
+ * underlying kit when that operation runs.
7408
+ *
7409
+ * @example
7410
+ * ```typescript
7411
+ * const policy: AppKitCustomFeePolicy = {
7412
+ * bridge: {
7413
+ * computeFee: () => '1.00',
7414
+ * resolveFeeRecipientAddress: () => '0x1234567890123456789012345678901234567890',
7415
+ * },
7416
+ * }
7417
+ * ```
7418
+ */
7419
+ interface AppKitCustomFeePolicy {
7420
+ /** Custom fee policy forwarded to BridgeKit bridge operations. */
7421
+ bridge?: CustomFeePolicy$2;
7422
+ /** Custom fee policy forwarded to SwapKit swap operations. */
7423
+ swap?: CustomFeePolicy$1;
7424
+ /** Custom fee policy forwarded to UnifiedBalanceKit spend operations. */
7425
+ unifiedBalance?: CustomFeePolicy;
7426
+ }
6458
7427
  /**
6459
7428
  * Context interface for the AppKit with strongly typed getFee method.
6460
7429
  *
@@ -6542,6 +7511,14 @@ interface AppKitContext {
6542
7511
  chain: ChainDefinition;
6543
7512
  params: OperationParamsMap[T];
6544
7513
  }): Promise<string>;
7514
+ /**
7515
+ * Operation-scoped custom fee policies.
7516
+ *
7517
+ * Prefer {@link AppKit.setCustomFeePolicy} for runtime configuration. This
7518
+ * context property is read by the internal kit factories when AppKit creates
7519
+ * BridgeKit and SwapKit instances for each operation.
7520
+ */
7521
+ customFeePolicy?: AppKitCustomFeePolicy;
6545
7522
  /**
6546
7523
  * Event handlers registered for AppKit operations.
6547
7524
  *