@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.
package/bridge.d.ts CHANGED
@@ -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
  * Machine-readable classification of a {@link BridgeStep} error.
5265
5494
  *
@@ -5753,6 +5982,91 @@ type BridgeDestination<TAdapterCapabilities extends AdapterCapabilities = Adapte
5753
5982
  useForwarder?: boolean;
5754
5983
  }) | ForwarderDestination<TChainIdentifier>;
5755
5984
 
5985
+ type FeeFunction<TFromAdapterCapabilities extends AdapterCapabilities, TToAdapterCapabilities extends AdapterCapabilities> = (params: BridgeParams$1<TFromAdapterCapabilities, TToAdapterCapabilities>) => Promise<string> | string;
5986
+ type FeeRecipientFunction<TFromAdapterCapabilities extends AdapterCapabilities, TToAdapterCapabilities extends AdapterCapabilities> = (feePayoutChain: ChainDefinition, params: BridgeParams$1<TFromAdapterCapabilities, TToAdapterCapabilities>) => Promise<string> | string;
5987
+ /**
5988
+ * Custom fee policy for BridgeKit.
5989
+ *
5990
+ * Provides hooks to calculate an absolute custom fee and resolve the fee recipient address
5991
+ * on the source chain. The returned fee is **added on top of the transfer amount** (the wallet signs for
5992
+ * `amount + customFee`). Once collected, the custom fee is split:
5993
+ *
5994
+ * - **10%** automatically routes to Circle.
5995
+ * - **90%** routes to your supplied `recipientAddress`.
5996
+ *
5997
+ * The entire transfer amount still flows through CCTPv2, which then charges its own protocol fee.
5998
+ *
5999
+ * Use `computeFee` (recommended) for human-readable amounts, or `calculateFee` (deprecated)
6000
+ * for smallest-unit amounts. Only one should be provided.
6001
+ *
6002
+ * @example
6003
+ * ```typescript
6004
+ * import type { CustomFeePolicy, BridgeParams } from '@circle-fin/bridge-kit'
6005
+ *
6006
+ * const policy: CustomFeePolicy = {
6007
+ * // computeFee receives human-readable amounts (e.g., '100' for 100 USDC)
6008
+ * computeFee: (params: BridgeParams) => {
6009
+ * const amount = parseFloat(params.amount)
6010
+ *
6011
+ * // 1% fee, capped between 5-50 USDC
6012
+ * const fee = Math.min(Math.max(amount * 0.01, 5), 50)
6013
+ * return fee.toFixed(6)
6014
+ * },
6015
+ * resolveFeeRecipientAddress: (feePayoutChain) =>
6016
+ * feePayoutChain.type === 'solana'
6017
+ * ? 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'
6018
+ * : '0x1234567890123456789012345678901234567890',
6019
+ * }
6020
+ * ```
6021
+ */
6022
+ type CustomFeePolicy$2 = {
6023
+ /**
6024
+ * A function that returns the fee to charge for the bridge transfer.
6025
+ * The value returned from the function represents an absolute fee.
6026
+ * The returned fee is **added on top of the transfer amount**. For example, returning
6027
+ * `'5'` (5 USDC) for a 100 USDC transfer causes the wallet to debit 105 USDC total.
6028
+ * CCTPv2 still processes the full 100 USDC transfer amount, while the custom fee is split
6029
+ * 10%/90% between Circle and your fee recipient.
6030
+ *
6031
+ * @example
6032
+ * ```typescript
6033
+ * computeFee: (params) => {
6034
+ * const amount = parseFloat(params.amount)
6035
+ * return (amount * 0.01).toString() // 1% fee
6036
+ * }
6037
+ * ```
6038
+ */
6039
+ computeFee: FeeFunction<AdapterCapabilities, AdapterCapabilities>;
6040
+ calculateFee?: never;
6041
+ /**
6042
+ * A function that returns the fee recipient for a bridge transfer.
6043
+ * The value returned from the function represents the address that will receive the fee on the source chain of the bridge transfer.
6044
+ * The fee recipient address **must be a valid address for the source chain** of the bridge transfer.
6045
+ *
6046
+ * For example: if you are bridging from Ethereum to Solana you would return `'0x1234567890123456789012345678901234567890'`,
6047
+ * because the source chain of the bridge transfer is Ethereum.
6048
+ */
6049
+ resolveFeeRecipientAddress: FeeRecipientFunction<AdapterCapabilities, AdapterCapabilities>;
6050
+ } | {
6051
+ computeFee?: never;
6052
+ /**
6053
+ * Calculate the fee to charge for the bridge transfer using smallest-unit amounts.
6054
+ *
6055
+ * @deprecated Use `computeFee` instead, which receives human-readable amounts.
6056
+ *
6057
+ * The `params.amount` is in smallest units (e.g., `'100000000'` for 100 USDC).
6058
+ */
6059
+ calculateFee: FeeFunction<AdapterCapabilities, AdapterCapabilities>;
6060
+ /**
6061
+ * A function that returns the fee recipient for a bridge transfer.
6062
+ * The value returned from the function represents the address that will receive the fee on the source chain of the bridge transfer.
6063
+ * The fee recipient address **must be a valid address for the source chain** of the bridge transfer.
6064
+ *
6065
+ * For example: if you are bridging from Ethereum to Solana you would return `'0x1234567890123456789012345678901234567890'`,
6066
+ * because the source chain of the bridge transfer is Ethereum.
6067
+ */
6068
+ resolveFeeRecipientAddress: FeeRecipientFunction<AdapterCapabilities, AdapterCapabilities>;
6069
+ };
5756
6070
  /**
5757
6071
  * Parameters for initiating a cross-chain USDC bridge transfer.
5758
6072
  *
@@ -5857,6 +6171,463 @@ interface BridgeParams<TFromAdapterCapabilities extends AdapterCapabilities = Ad
5857
6171
  invocationMeta?: InvocationMeta;
5858
6172
  }
5859
6173
 
6174
+ /**
6175
+ * Allowance strategy for token approvals during swap operations.
6176
+ *
6177
+ * Defines how token allowances should be granted to the swap contract:
6178
+ * - `permit`: Use EIP-2612 permit signature (gas-efficient, no approval transaction)
6179
+ * - `approve`: Traditional approval transaction
6180
+ *
6181
+ * The default strategy is `permit` with fallback to `approve` if permit is not supported.
6182
+ */
6183
+ type AllowanceStrategy$1 = 'permit' | 'approve';
6184
+ /**
6185
+ * Configuration options for swap operations.
6186
+ *
6187
+ * Controls swap behavior including allowance strategy, slippage tolerance,
6188
+ * minimum output amounts, custom fees, and kit identification.
6189
+ *
6190
+ * @example
6191
+ * ```typescript
6192
+ * import type { ServiceSwapConfig } from '@circle-fin/provider-stablecoin-service-swap'
6193
+ *
6194
+ * // Percentage-based fee
6195
+ * const config: ServiceSwapConfig = {
6196
+ * allowanceStrategy: 'permit',
6197
+ * slippageBps: 300, // 3%
6198
+ * stopLimit: '950000', // Minimum 0.95 USDC output
6199
+ * customFee: {
6200
+ * percentageBps: 1000, // 10% fee
6201
+ * recipientAddress: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
6202
+ * }
6203
+ * }
6204
+ * ```
6205
+ *
6206
+ * @example
6207
+ * ```typescript
6208
+ * // Absolute amount fee (from callback)
6209
+ * const config: ServiceSwapConfig = {
6210
+ * allowanceStrategy: 'permit',
6211
+ * customFee: {
6212
+ * amount: '10000', // 0.01 USDC fee (absolute)
6213
+ * recipientAddress: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
6214
+ * }
6215
+ * }
6216
+ * ```
6217
+ */
6218
+ interface ServiceSwapConfig {
6219
+ /**
6220
+ * Strategy for granting token allowances to the swap contract.
6221
+ *
6222
+ * Defaults to 'permit' with fallback to 'approve'.
6223
+ */
6224
+ allowanceStrategy?: AllowanceStrategy$1;
6225
+ /**
6226
+ * Maximum acceptable slippage in basis points (BPS).
6227
+ *
6228
+ * 1 BPS = 0.01%, so 300 BPS = 3% slippage.
6229
+ * Defaults to 300 BPS (3%).
6230
+ */
6231
+ slippageBps?: number;
6232
+ /**
6233
+ * Minimum acceptable output amount in smallest units (stop-limit).
6234
+ *
6235
+ * If the estimated output falls below this value, the swap will fail.
6236
+ * Expressed as a string to avoid precision issues.
6237
+ */
6238
+ stopLimit?: string;
6239
+ /**
6240
+ * Custom fee configuration for this swap.
6241
+ *
6242
+ * Supports two mutually exclusive approaches:
6243
+ * 1. Percentage-based: Use `percentageBps` field (simple)
6244
+ * 2. Absolute amount: Use `amount` field (from callback)
6245
+ *
6246
+ * If both are set, validation will fail. Transaction-level percentage
6247
+ * takes precedence over kit-level callback policy.
6248
+ */
6249
+ customFee?: {
6250
+ /**
6251
+ * Fee percentage in basis points (NEW).
6252
+ *
6253
+ * 100 bps = 1%, 1000 bps = 10%, 10000 bps = 100%
6254
+ *
6255
+ * Service calculates fee using `estimatedAmount` for same-chain output fees
6256
+ * and the input amount for cross-chain swaps.
6257
+ * Must be greater than 0 and less than or equal to 10000 (maximum 100%).
6258
+ * Mutually exclusive with `amount`.
6259
+ *
6260
+ * @example 1000 // 10% fee
6261
+ */
6262
+ percentageBps?: number;
6263
+ /**
6264
+ * Fee amount in smallest units (for callback results).
6265
+ *
6266
+ * Absolute fee amount calculated by callback function.
6267
+ * Mutually exclusive with `percentageBps`.
6268
+ *
6269
+ * @example '10000' // 0.01 USDC (6 decimals)
6270
+ */
6271
+ amount?: string;
6272
+ /**
6273
+ * Address that will receive the developer's 90% fee share.
6274
+ *
6275
+ * Required whenever a custom fee is submitted to the provider. Optional at
6276
+ * the type level so SDK callback flows can represent partial fee state
6277
+ * before final validation.
6278
+ *
6279
+ * Must be valid on the fee payout chain: source chain for input-side fees
6280
+ * and cross-chain swaps, destination chain for same-chain output-side fees.
6281
+ *
6282
+ * @example '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
6283
+ */
6284
+ recipientAddress?: string;
6285
+ };
6286
+ /**
6287
+ * Stablecoin Service Kit Key used to authenticate service-backed swap
6288
+ * requests.
6289
+ *
6290
+ * Treat this value as a credential. Do not log it, embed it in client-side
6291
+ * source, or expose it in telemetry.
6292
+ */
6293
+ kitKey?: string;
6294
+ /**
6295
+ * DEX aggregator identifier used to source the swap route.
6296
+ *
6297
+ * @example 'lifi', 'paraswap'
6298
+ */
6299
+ provider?: string;
6300
+ /**
6301
+ * Whether to fuse the ERC-20 approval and the swap into a single atomic
6302
+ * batch when the adapter supports it (EIP-5792, or a signing strategy that
6303
+ * declares atomic batching).
6304
+ *
6305
+ * @remarks
6306
+ * Defaults to `true`. When batching is available this collapses the two
6307
+ * sequential transactions of the on-chain approval path into one atomic
6308
+ * submission — a single signing challenge for a smart-contract wallet. Set
6309
+ * to `false` to force the sequential approve-then-swap path. Has no effect on
6310
+ * the gasless permit path (already a single transaction) or on native-token
6311
+ * swaps (no approval needed).
6312
+ *
6313
+ * The batch path relies on the wallet's own gas estimation for the swap call:
6314
+ * the service-provided gas floor and pre-flight simulation that the sequential
6315
+ * path applies are not conveyed through the batch. For a complex/multi-hop
6316
+ * swap whose wallet-side estimate under-shoots, this can out-of-gas-revert the
6317
+ * atomic batch where the sequential path would succeed — set `false` to fall
6318
+ * back to the service-floored sequential path if you hit this.
6319
+ *
6320
+ * @defaultValue true
6321
+ */
6322
+ batchTransactions?: boolean;
6323
+ }
6324
+ /**
6325
+ * Parameters for initiating a swap operation through the Stablecoin Service.
6326
+ *
6327
+ * This type is used as the primary input to provider swap operations, allowing users to specify
6328
+ * the source context, input/output tokens, swap amount, destination address, and optional configuration.
6329
+ *
6330
+ * @typeParam TFromAdapterCapabilities - The adapter capabilities type for the source adapter.
6331
+ *
6332
+ * @example
6333
+ * ```typescript
6334
+ * import type { ServiceSwapParams } from '@circle-fin/provider-stablecoin-service-swap'
6335
+ * import { createAdapterFromPrivateKey } from '@circle-fin/adapter-viem-v2'
6336
+ * import { Ethereum } from '@core/chains'
6337
+ *
6338
+ * const adapter = createAdapterFromPrivateKey({
6339
+ * privateKey: process.env.PRIVATE_KEY,
6340
+ * })
6341
+ *
6342
+ * const params: ServiceSwapParams = {
6343
+ * from: { adapter, chain: Ethereum },
6344
+ * tokenIn: 'USDC', // Alias resolves to chain-specific address
6345
+ * tokenOut: 'USDT', // Alias resolves to chain-specific address
6346
+ * amountIn: '100500000', // 100.50 USDC in base units
6347
+ * to: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e',
6348
+ * config: {
6349
+ * slippageBps: 300, // 3% slippage
6350
+ * allowanceStrategy: 'permit'
6351
+ * }
6352
+ * }
6353
+ * ```
6354
+ */
6355
+ interface ServiceSwapParams<TFromAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities,
6356
+ /**
6357
+ * The chain definition type to use for the wallet context.
6358
+ *
6359
+ * @defaultValue ChainDefinition
6360
+ */
6361
+ TChainDefinition extends ChainDefinition = ChainDefinition> {
6362
+ /**
6363
+ * The source adapter context (wallet and chain) for the swap.
6364
+ */
6365
+ from: WalletContext<TFromAdapterCapabilities, TChainDefinition>;
6366
+ /**
6367
+ * The input token address or alias to swap from.
6368
+ *
6369
+ * **Supported formats:**
6370
+ * - Token alias: `"USDC"`, `"USDT"`, `"NATIVE"` (case-insensitive)
6371
+ * - EVM address: `'0x'` prefixed hex (e.g., `'0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'`)
6372
+ * - Solana address: Base58-encoded (e.g., `'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'`)
6373
+ *
6374
+ * Token aliases are automatically resolved to the chain-specific contract address.
6375
+ *
6376
+ * @example 'USDC' // Recommended: use alias
6377
+ * @example '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' // Or full address
6378
+ */
6379
+ tokenIn: string;
6380
+ /**
6381
+ * The output token address or alias to swap to.
6382
+ *
6383
+ * **Supported formats:**
6384
+ * - Token alias: `"USDC"`, `"USDT"`, `"NATIVE"` (case-insensitive)
6385
+ * - EVM address: `'0x'` prefixed hex (e.g., `'0xdAC17F958D2ee523a2206206994597C13D831ec7'`)
6386
+ * - Solana address: Base58-encoded (e.g., `'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB'`)
6387
+ *
6388
+ * Token aliases are automatically resolved to the chain-specific contract address.
6389
+ *
6390
+ * @example 'USDT' // Recommended: use alias
6391
+ * @example '0xdAC17F958D2ee523a2206206994597C13D831ec7' // Or full address
6392
+ */
6393
+ tokenOut: string;
6394
+ /**
6395
+ * The amount of input token to swap in base units.
6396
+ *
6397
+ * SwapKit converts human-readable amounts to base units before passing to the provider.
6398
+ *
6399
+ * @example '100500000' for 100.50 USDC (6 decimals)
6400
+ */
6401
+ amountIn: string;
6402
+ /**
6403
+ * The destination address where the swapped tokens will be sent.
6404
+ *
6405
+ * @example '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
6406
+ */
6407
+ to: string;
6408
+ /**
6409
+ * Optional destination chain for cross-chain swaps.
6410
+ *
6411
+ * Defaults to `from.chain` for same-chain swaps.
6412
+ */
6413
+ toChain?: TChainDefinition;
6414
+ /**
6415
+ * Optional configuration for swap behavior.
6416
+ *
6417
+ * If omitted, defaults will be used:
6418
+ * - allowanceStrategy: 'permit' (fallback to 'approve')
6419
+ * - slippageBps: 300 (3%)
6420
+ */
6421
+ config?: ServiceSwapConfig;
6422
+ }
6423
+
6424
+ /**
6425
+ * Fee context when fee is taken from INPUT token.
6426
+ *
6427
+ * Used for swaps where the fee is collected from the input token, including
6428
+ * all cross-chain swaps.
6429
+ * Extends the resolved swap parameters with a discriminator to indicate input fee scenario.
6430
+ *
6431
+ * @typeParam TFromAdapterCapabilities - The adapter capabilities type for the source adapter
6432
+ *
6433
+ * @example
6434
+ * ```typescript
6435
+ * // USDC → RandomToken swap (fee from input)
6436
+ * const context: SwapInputFeeContext = {
6437
+ * type: 'input',
6438
+ * from: {
6439
+ * adapter: viemAdapter,
6440
+ * chain: Ethereum,
6441
+ * address: '0x...'
6442
+ * },
6443
+ * tokenIn: 'USDC',
6444
+ * tokenOut: 'RandomToken',
6445
+ * amountIn: '100000000', // 100 USDC in base units
6446
+ * to: '0x...'
6447
+ * }
6448
+ * ```
6449
+ */
6450
+ interface SwapInputFeeContext<TFromAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities> extends ResolvedSwapParams<TFromAdapterCapabilities> {
6451
+ /**
6452
+ * Fee source discriminator - input token.
6453
+ */
6454
+ type: 'input';
6455
+ }
6456
+ /**
6457
+ * Fee context when fee is taken from OUTPUT token.
6458
+ *
6459
+ * Used for swaps where the output token is supported for fee collection.
6460
+ * Extends the resolved swap parameters with output amounts and discriminator.
6461
+ *
6462
+ * @typeParam TFromAdapterCapabilities - The adapter capabilities type for the source adapter
6463
+ *
6464
+ * @remarks
6465
+ * If using `estimatedAmount` in callback and quote cache expires,
6466
+ * calculated fee may not match fresh quote. Use `minAmount` for
6467
+ * predictability at the cost of potentially lower fees.
6468
+ *
6469
+ * @example
6470
+ * ```typescript
6471
+ * // RandomToken → USDC swap (fee from output)
6472
+ * const context: SwapOutputFeeContext = {
6473
+ * type: 'output',
6474
+ * from: {
6475
+ * adapter: viemAdapter,
6476
+ * chain: Ethereum,
6477
+ * address: '0x...'
6478
+ * },
6479
+ * tokenIn: 'RandomToken',
6480
+ * tokenOut: 'USDC',
6481
+ * amountIn: '100000000',
6482
+ * to: '0x...',
6483
+ * minAmount: '50000000', // 50 USDC guaranteed minimum
6484
+ * estimatedAmount: '55000000' // 55 USDC expected output
6485
+ * }
6486
+ * ```
6487
+ */
6488
+ interface SwapOutputFeeContext<TFromAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities> extends ResolvedSwapParams<TFromAdapterCapabilities> {
6489
+ /**
6490
+ * Fee source discriminator - output token.
6491
+ */
6492
+ type: 'output';
6493
+ /**
6494
+ * Guaranteed minimum output amount in base units.
6495
+ *
6496
+ * More stable but lower than estimatedAmount. Use this for
6497
+ * predictable fee calculations.
6498
+ */
6499
+ minAmount: string;
6500
+ /**
6501
+ * Estimated output amount in base units.
6502
+ *
6503
+ * Expected output based on current market conditions. May be
6504
+ * higher than minAmount. Subject to change if quote expires.
6505
+ */
6506
+ estimatedAmount: string;
6507
+ }
6508
+ /**
6509
+ * Discriminated union for swap fee contexts.
6510
+ *
6511
+ * Provides different context based on whether fee is from input or output token.
6512
+ * Discriminated by the `type` field: 'input' for fees from input token, 'output' for output token.
6513
+ *
6514
+ * Includes full swap parameters (adapter, chain, tokens, amounts) for maximum flexibility
6515
+ * in fee calculation logic.
6516
+ *
6517
+ * @typeParam TFromAdapterCapabilities - The adapter capabilities type for the source adapter
6518
+ */
6519
+ type SwapFeeContext<TFromAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities> = SwapInputFeeContext<TFromAdapterCapabilities> | SwapOutputFeeContext<TFromAdapterCapabilities>;
6520
+ /**
6521
+ * Custom fee policy for SwapKit (callback-based approach).
6522
+ *
6523
+ * Provides hooks to calculate an absolute fee amount and resolve the fee
6524
+ * recipient address. The callback receives a discriminated context with
6525
+ * different fields based on operation type (bridge vs swap) and fee source
6526
+ * (input vs output).
6527
+ *
6528
+ * @remarks
6529
+ * This is mutually exclusive with transaction-level percentage fees.
6530
+ * If both are set, the transaction-level percentage takes precedence.
6531
+ *
6532
+ * The callback approach makes two API calls for same-chain output fees:
6533
+ * 1. GET /quote - retrieve fee context and quote
6534
+ * 2. POST /swap - execute with calculated fee
6535
+ *
6536
+ * Cross-chain swaps always use input fees on the source chain, so callbacks
6537
+ * receive `type: 'input'` for those routes.
6538
+ *
6539
+ * @example
6540
+ * ```typescript
6541
+ * import type { CustomFeePolicy } from '@circle-fin/swap-kit'
6542
+ *
6543
+ * const policy: CustomFeePolicy = {
6544
+ * computeFee: async (ctx) => {
6545
+ * // Discriminate by fee source (input vs output)
6546
+ * if (ctx.type === 'input') {
6547
+ * // Simple percentage for input fees
6548
+ * return (parseFloat(ctx.amountIn) * 0.1).toString()
6549
+ * } else {
6550
+ * // Complex logic for output fees (VIP tiers, etc.)
6551
+ * const user = await database.getUser(...)
6552
+ * if (user.isVIP) {
6553
+ * return (parseFloat(ctx.minAmount) * 0.05).toString()
6554
+ * }
6555
+ * return (parseFloat(ctx.estimatedAmount) * 0.1).toString()
6556
+ * }
6557
+ * },
6558
+ * resolveFeeRecipientAddress: (chain) => {
6559
+ * return chain.type === 'solana'
6560
+ * ? 'SolanaAddress...'
6561
+ * : '0xEVMAddress...'
6562
+ * },
6563
+ * }
6564
+ * ```
6565
+ */
6566
+ interface CustomFeePolicy$1 {
6567
+ /**
6568
+ * Calculate custom fee amount based on swap context.
6569
+ *
6570
+ * Receives full swap parameters including adapter, chain, tokens, and amounts.
6571
+ * Context is discriminated by `type` field:
6572
+ * - 'input': Fee from input token (OK → Any swaps and all cross-chain swaps)
6573
+ * - 'output': Fee from output token (same-chain Any → OK swaps), includes minAmount and estimatedAmount
6574
+ *
6575
+ * The wrapper automatically converts amounts to/from base units, so your
6576
+ * callback works with human-readable numbers (e.g., '0.1' for 0.1 USDC).
6577
+ *
6578
+ * @typeParam TFromAdapterCapabilities - The adapter capabilities type for the source adapter
6579
+ * @param context - Discriminated swap fee context with full swap parameters
6580
+ * @returns Absolute fee amount as string in human-readable format
6581
+ *
6582
+ * @example
6583
+ * ```typescript
6584
+ * computeFee: async (ctx) => {
6585
+ * if (ctx.type === 'output') {
6586
+ * // Output fee scenario
6587
+ * // Use estimatedAmount or minAmount for calculation
6588
+ * return (parseFloat(ctx.estimatedAmount) * 0.01).toString()
6589
+ * }
6590
+ * // Input fee scenario
6591
+ * return (parseFloat(ctx.amountIn) * 0.01).toString()
6592
+ * }
6593
+ * ```
6594
+ *
6595
+ * @example
6596
+ * ```typescript
6597
+ * computeFee: async (ctx) => {
6598
+ * if (ctx.type === 'output') {
6599
+ * // Use minAmount for predictable fees
6600
+ * return (parseFloat(ctx.minAmount) * 0.01).toString()
6601
+ * }
6602
+ * return (parseFloat(ctx.amountIn) * 0.01).toString()
6603
+ * }
6604
+ * ```
6605
+ */
6606
+ computeFee: <TFromAdapterCapabilities extends AdapterCapabilities>(context: SwapFeeContext<TFromAdapterCapabilities>) => Promise<string> | string;
6607
+ /**
6608
+ * Resolve fee recipient address for the chain where fee is collected.
6609
+ *
6610
+ * Called with the chain where fee will be paid. For cross-chain swaps this
6611
+ * is always the source chain. Must return a valid address format for that
6612
+ * chain type (EVM or Solana).
6613
+ *
6614
+ * @param feePayoutChain - Chain definition where fee is collected
6615
+ * @param context - The swap fee context with full parameters
6616
+ * @returns Fee recipient address for the chain
6617
+ *
6618
+ * @example
6619
+ * ```typescript
6620
+ * resolveFeeRecipientAddress: (chain, ctx) => {
6621
+ * // Chain-based routing
6622
+ * if (chain.type === 'solana') {
6623
+ * return 'SolanaAddress...'
6624
+ * }
6625
+ * return '0xEVMAddress...'
6626
+ * }
6627
+ * ```
6628
+ */
6629
+ resolveFeeRecipientAddress: <TFromAdapterCapabilities extends AdapterCapabilities>(feePayoutChain: ChainDefinition, context: SwapFeeContext<TFromAdapterCapabilities>) => Promise<string> | string;
6630
+ }
5860
6631
  /**
5861
6632
  * Adapter context constrained to swap-supported chains.
5862
6633
  */
@@ -6004,6 +6775,45 @@ interface SwapConfig {
6004
6775
  */
6005
6776
  kitKey?: string;
6006
6777
  }
6778
+ /**
6779
+ * Resolved parameters for swap operations after validation and normalization.
6780
+ *
6781
+ * Internal type used by SwapKit operations after `resolveSwapParams()` has:
6782
+ * - Validated the input parameters
6783
+ * - Resolved chain identifiers to full ChainDefinition objects
6784
+ * - Extracted and validated wallet addresses
6785
+ *
6786
+ * Note: Raw user input is validated first, then `tokenIn` and `tokenOut` may
6787
+ * be canonicalized for downstream routing (for example, Arc Testnet
6788
+ * `NATIVE` → `USDC`). Address resolution is handled by the provider layer.
6789
+ *
6790
+ * This type is consumed by swap providers and internal operations but is not
6791
+ * exposed to end users. It extends ServiceSwapParams which is the format expected
6792
+ * by the StablecoinServiceSwapProvider.
6793
+ *
6794
+ * @typeParam TFromAdapterCapabilities - The adapter capabilities type for the source adapter.
6795
+ *
6796
+ * @example
6797
+ * ```typescript
6798
+ * // After resolution, SwapParams becomes ResolvedSwapParams:
6799
+ * const resolved: ResolvedSwapParams = {
6800
+ * from: {
6801
+ * adapter: viemAdapter,
6802
+ * chain: Ethereum, // Full chain definition
6803
+ * address: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
6804
+ * },
6805
+ * tokenIn: 'USDC', // Canonicalized for provider routing
6806
+ * tokenOut: 'USDT', // Canonicalized for provider routing
6807
+ * amountIn: '100500000', // Converted to base units (100.5 USDC with 6 decimals)
6808
+ * to: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e',
6809
+ * config: {
6810
+ * slippageBps: 300,
6811
+ * allowanceStrategy: 'permit'
6812
+ * }
6813
+ * }
6814
+ * ```
6815
+ */
6816
+ type ResolvedSwapParams<TFromAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities> = ServiceSwapParams<TFromAdapterCapabilities>;
6007
6817
  interface SwapParams<TFromAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities> {
6008
6818
  /**
6009
6819
  * The source adapter context (wallet and chain) for the swap.
@@ -6116,6 +6926,24 @@ interface EarnConfig {
6116
6926
  * Format: `KIT_KEY:<keyId>:<keySecret>`
6117
6927
  */
6118
6928
  readonly kitKey?: string | undefined;
6929
+ /**
6930
+ * Optional base URL override for the Earn Service API.
6931
+ *
6932
+ * Defaults to `https://api.circle.com` when omitted. Override for testing
6933
+ * against staging or local environments.
6934
+ */
6935
+ readonly baseUrl?: string | undefined;
6936
+ /**
6937
+ * Enable or disable atomic batched transaction execution.
6938
+ *
6939
+ * When `true` (or `undefined` / omitted), same-chain deposit and withdraw
6940
+ * bundle the approve and execute calls into one adapter-native atomic batch
6941
+ * when the connected wallet supports it. Set to `false` to force the
6942
+ * sequential approve → execute flow.
6943
+ *
6944
+ * @defaultValue `undefined` (batching attempted when the wallet supports it)
6945
+ */
6946
+ readonly batchTransactions?: boolean | undefined;
6119
6947
  }
6120
6948
  /**
6121
6949
  * Parameters for fetching vault information.
@@ -6548,6 +7376,122 @@ interface GetClaimRewardsQuoteParams<TFromAdapterCapabilities extends AdapterCap
6548
7376
  */
6549
7377
  type EarnOperationParams = AnyDepositParams | WithdrawParams | ClaimRewardsParams | GetVaultsParams | ExploreVaultsParams | ExploreVaultsIteratorParams | GetPositionParams | GetDepositQuoteParams | GetWithdrawalQuoteParams | GetClaimRewardsQuoteParams;
6550
7378
 
7379
+ interface CustomFeeConfig {
7380
+ recipientAddress: string;
7381
+ value: string;
7382
+ }
7383
+ /**
7384
+ * Data needed to retry a mint that failed after the transfer was
7385
+ * already committed (funds locked).
7386
+ *
7387
+ * Obtain these values from the KitError (TRANSACTION_REVERTED) thrown when
7388
+ * the on-chain mint step fails. The attestation and signature are available
7389
+ * in `error.cause.trace`.
7390
+ */
7391
+ interface RetryMintConfig {
7392
+ /** The attestation hex string returned by the Gateway `/v1/transfer` API. */
7393
+ attestation: string;
7394
+ /** The attestation signature hex string returned by `/v1/transfer`. */
7395
+ signature: string;
7396
+ }
7397
+ interface SpendConfig {
7398
+ customFee?: CustomFeeConfig;
7399
+ /**
7400
+ * When provided, skips the estimate/sign/transfer steps and proceeds
7401
+ * directly to the on-chain mint using a previously obtained attestation.
7402
+ *
7403
+ * Use this to retry a mint that failed due to an RPC or network issue
7404
+ * after the transfer was already committed.
7405
+ *
7406
+ * @remarks
7407
+ * The `useForwarder` flag on the destination is ignored during retry
7408
+ * because the attestation was already issued — the Forwarding Service
7409
+ * is only involved in the initial transfer, not re-mints.
7410
+ */
7411
+ retry?: RetryMintConfig;
7412
+ }
7413
+ interface ResolvedAllocation {
7414
+ amount: string;
7415
+ chain: ChainDefinition;
7416
+ }
7417
+ interface ResolvedSpendSource<TAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities> {
7418
+ adapter: Adapter<TAdapterCapabilities>;
7419
+ allocations: ResolvedAllocation[];
7420
+ address?: string;
7421
+ sourceAccount?: string;
7422
+ }
7423
+ interface ResolvedSpendDestination<TAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities> {
7424
+ adapter?: Adapter<TAdapterCapabilities>;
7425
+ chain: ChainDefinition;
7426
+ recipientAddress?: string;
7427
+ address?: string;
7428
+ useForwarder?: boolean;
7429
+ }
7430
+ interface ResolvedSpendParams<TFromAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities, TToAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities> {
7431
+ from: ResolvedSpendSource<TFromAdapterCapabilities>[];
7432
+ to: ResolvedSpendDestination<TToAdapterCapabilities>;
7433
+ token: SupportedToken;
7434
+ config?: SpendConfig;
7435
+ }
7436
+ /**
7437
+ * Function that computes the fee amount (in human-readable units, e.g. "10.5")
7438
+ * given the resolved spend parameters.
7439
+ */
7440
+ type SpendFeeFunction = (params: ResolvedSpendParams) => Promise<string> | string;
7441
+ /**
7442
+ * Function that resolves the fee recipient address for a spend.
7443
+ * Called once per spend, against the resolved **destination** chain —
7444
+ * every fee burn intent in a spend mints to that single chain
7445
+ * regardless of which source chain(s) funded it, so only one
7446
+ * recipient address (valid on the destination chain) is ever needed.
7447
+ */
7448
+ type SpendFeeRecipientFunction = (destinationChain: ChainDefinition, params: ResolvedSpendParams) => Promise<string> | string;
7449
+ /**
7450
+ * Policy for computing and routing custom developer fees.
7451
+ *
7452
+ * **Important:** When the kit invokes `computeFee` and
7453
+ * `resolveFeeRecipientAddress`, the `params` argument may be the
7454
+ * **raw, unresolved** `SpendParams` (cast to `ResolvedSpendParams`).
7455
+ * Fields that only exist after resolution (e.g. per-source allocations)
7456
+ * may be `undefined`. Implementations should only rely on top-level
7457
+ * fields such as `to`, `token`, and `amount`.
7458
+ *
7459
+ * @remarks
7460
+ * `resolveFeeRecipientAddress` is optional when you configure
7461
+ * {@link UnifiedBalanceKit.setFeeRecipients} instead — the declarative
7462
+ * map takes priority over this callback when both are present. Provide
7463
+ * exactly one of the two; a policy with neither throws at spend time.
7464
+ */
7465
+ interface CustomFeePolicy {
7466
+ computeFee: SpendFeeFunction;
7467
+ resolveFeeRecipientAddress?: SpendFeeRecipientFunction;
7468
+ }
7469
+
7470
+ /**
7471
+ * Runtime array of token identifiers supported by the unified-balance-kit.
7472
+ *
7473
+ * @example
7474
+ * ```typescript
7475
+ * import { SUPPORTED_TOKENS } from '@circle-fin/unified-balance-kit'
7476
+ *
7477
+ * if (SUPPORTED_TOKENS.includes('USDC')) {
7478
+ * console.log('USDC is supported')
7479
+ * }
7480
+ * ```
7481
+ */
7482
+ declare const SUPPORTED_TOKENS: readonly ["USDC"];
7483
+ /**
7484
+ * Token identifiers supported by the unified-balance-kit.
7485
+ *
7486
+ * @example
7487
+ * ```typescript
7488
+ * import type { SupportedToken } from '@circle-fin/unified-balance-kit'
7489
+ *
7490
+ * const token: SupportedToken = 'USDC'
7491
+ * ```
7492
+ */
7493
+ type SupportedToken = (typeof SUPPORTED_TOKENS)[number];
7494
+
6551
7495
  /**
6552
7496
  * Operation types that support the `getFee`/`getFeeRecipient` hooks.
6553
7497
  */
@@ -6578,6 +7522,31 @@ interface OperationParamsMap {
6578
7522
  swap: SwapParams;
6579
7523
  earn: EarnOperationParams;
6580
7524
  }
7525
+ /**
7526
+ * Operation-scoped custom fee policies configured at the AppKit level.
7527
+ *
7528
+ * Each property is optional so consumers can enable custom fees only for the
7529
+ * operation they use. AppKit forwards the supplied policy to the matching
7530
+ * underlying kit when that operation runs.
7531
+ *
7532
+ * @example
7533
+ * ```typescript
7534
+ * const policy: AppKitCustomFeePolicy = {
7535
+ * bridge: {
7536
+ * computeFee: () => '1.00',
7537
+ * resolveFeeRecipientAddress: () => '0x1234567890123456789012345678901234567890',
7538
+ * },
7539
+ * }
7540
+ * ```
7541
+ */
7542
+ interface AppKitCustomFeePolicy {
7543
+ /** Custom fee policy forwarded to BridgeKit bridge operations. */
7544
+ bridge?: CustomFeePolicy$2;
7545
+ /** Custom fee policy forwarded to SwapKit swap operations. */
7546
+ swap?: CustomFeePolicy$1;
7547
+ /** Custom fee policy forwarded to UnifiedBalanceKit spend operations. */
7548
+ unifiedBalance?: CustomFeePolicy;
7549
+ }
6581
7550
  /**
6582
7551
  * Context interface for the AppKit with strongly typed getFee method.
6583
7552
  *
@@ -6665,6 +7634,14 @@ interface AppKitContext {
6665
7634
  chain: ChainDefinition;
6666
7635
  params: OperationParamsMap[T];
6667
7636
  }): Promise<string>;
7637
+ /**
7638
+ * Operation-scoped custom fee policies.
7639
+ *
7640
+ * Prefer {@link AppKit.setCustomFeePolicy} for runtime configuration. This
7641
+ * context property is read by the internal kit factories when AppKit creates
7642
+ * BridgeKit and SwapKit instances for each operation.
7643
+ */
7644
+ customFeePolicy?: AppKitCustomFeePolicy;
6668
7645
  /**
6669
7646
  * Event handlers registered for AppKit operations.
6670
7647
  *
@@ -6757,7 +7734,7 @@ interface AppKitContext {
6757
7734
  * token: 'USDC'
6758
7735
  * })
6759
7736
  *
6760
- * console.log('Bridge completed:', result.hash)
7737
+ * console.log(`Bridged ${result.amount} ${result.token} (${result.state})`)
6761
7738
  * ```
6762
7739
  */
6763
7740
  declare const bridge: (context: AppKitContext, params: BridgeParams) => Promise<BridgeResult>;