@circle-fin/app-kit 1.12.0 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/earn.d.ts CHANGED
@@ -718,6 +718,8 @@ declare enum Blockchain {
718
718
  Optimism_Sepolia = "Optimism_Sepolia",
719
719
  Pharos = "Pharos",
720
720
  Pharos_Testnet = "Pharos_Testnet",
721
+ Plasma = "Plasma",
722
+ Plasma_Testnet = "Plasma_Testnet",
721
723
  Polkadot_Asset_Hub = "Polkadot_Asset_Hub",
722
724
  Polkadot_Westmint = "Polkadot_Westmint",
723
725
  Plume = "Plume",
@@ -946,6 +948,7 @@ declare enum BridgeChain {
946
948
  Morph = "Morph",
947
949
  Optimism = "Optimism",
948
950
  Pharos = "Pharos",
951
+ Plasma = "Plasma",
949
952
  Plume = "Plume",
950
953
  Polygon = "Polygon",
951
954
  Sei = "Sei",
@@ -971,6 +974,7 @@ declare enum BridgeChain {
971
974
  Morph_Testnet = "Morph_Testnet",
972
975
  Optimism_Sepolia = "Optimism_Sepolia",
973
976
  Pharos_Testnet = "Pharos_Testnet",
977
+ Plasma_Testnet = "Plasma_Testnet",
974
978
  Plume_Testnet = "Plume_Testnet",
975
979
  Polygon_Amoy_Testnet = "Polygon_Amoy_Testnet",
976
980
  Sei_Testnet = "Sei_Testnet",
@@ -2652,7 +2656,7 @@ interface ExecuteParams {
2652
2656
  * fromAddress: '0x...',
2653
2657
  * toAddress: '0x...',
2654
2658
  * amount: '1000000',
2655
- * apiKey: 'KIT_KEY:...',
2659
+ * apiKey: 'TEST_API_KEY:...',
2656
2660
  * })
2657
2661
  *
2658
2662
  * // Build token inputs with permit
@@ -2796,7 +2800,7 @@ interface ExecuteSwapEVMParams extends ActionParameters {
2796
2800
  * fromAddress: 'YubQzu18FDqJRyNfG8JqHmsdbxhnoQqcKUHBdUkN6tP',
2797
2801
  * toAddress: 'YubQzu18FDqJRyNfG8JqHmsdbxhnoQqcKUHBdUkN6tP',
2798
2802
  * amount: '1000000',
2799
- * apiKey: 'KIT_KEY:...',
2803
+ * apiKey: 'TEST_API_KEY:...',
2800
2804
  * })
2801
2805
  *
2802
2806
  * // Prepare action parameters
@@ -2957,6 +2961,18 @@ interface TokenActionMap {
2957
2961
  */
2958
2962
  walletAddress?: string | undefined;
2959
2963
  };
2964
+ /**
2965
+ * Get the on-chain name of the token contract.
2966
+ *
2967
+ * This is a read-only operation. For USDC the value is also the EIP-712
2968
+ * domain name, which permit and authorize signing flows need.
2969
+ */
2970
+ name: ActionParameters & {
2971
+ /**
2972
+ * The contract address of the token.
2973
+ */
2974
+ tokenAddress: string;
2975
+ };
2960
2976
  }
2961
2977
 
2962
2978
  /**
@@ -3786,6 +3802,30 @@ declare class ActionRegistry {
3786
3802
  executeAction<TActionKey extends ActionKeys>(action: TActionKey, params: ActionPayload<TActionKey>, context: ResolvedOperationContext): Promise<PreparedChainRequest>;
3787
3803
  }
3788
3804
 
3805
+ /**
3806
+ * Canonical list of actions that do not prepare or submit transactions.
3807
+ *
3808
+ * @internal
3809
+ */
3810
+ 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"];
3811
+ /**
3812
+ * Action keys that execute without preparing or submitting a transaction.
3813
+ *
3814
+ * @remarks
3815
+ * Derive this type from the canonical runtime list so compile-time and runtime
3816
+ * classification cannot drift. `gateway.v1.signBurnIntents` is included
3817
+ * because the action system models off-chain signing as a read action: it does
3818
+ * not prepare a chain request.
3819
+ *
3820
+ * @example
3821
+ * ```typescript
3822
+ * import type { ReadActionKey } from '@core/adapter'
3823
+ *
3824
+ * const action: ReadActionKey = 'token.allowance'
3825
+ * ```
3826
+ */
3827
+ type ReadActionKey = (typeof READ_ACTION_KEYS)[number];
3828
+
3789
3829
  /**
3790
3830
  * Defines the capabilities of an adapter, including address handling patterns and supported chains.
3791
3831
  *
@@ -3954,6 +3994,69 @@ declare abstract class Adapter<TAdapterCapabilities extends AdapterCapabilities
3954
3994
  * ```
3955
3995
  */
3956
3996
  prepareAction<TActionKey extends ActionKeys>(action: TActionKey, params: ActionPayload<TActionKey>, ctx: OperationContext<TAdapterCapabilities>): Promise<PreparedChainRequest>;
3997
+ /**
3998
+ * Execute a non-transaction action without routing through transaction preparation.
3999
+ *
4000
+ * @remarks
4001
+ * Use this seam for balance, allowance, contract-state, and other actions
4002
+ * classified as reads. It never calls {@link Adapter.prepareAction}, so
4003
+ * transaction authorization wrappers only observe actions that can produce a
4004
+ * signable chain request.
4005
+ *
4006
+ * @typeParam TActionKey - The read action key.
4007
+ * @param action - The read action to execute.
4008
+ * @param params - The parameters for the read action.
4009
+ * @param ctx - The operation context.
4010
+ * @returns The raw action response.
4011
+ * @throws {KitError} When the key is not a read action or no handler is registered.
4012
+ * @throws Error When the operation context or action handler fails.
4013
+ *
4014
+ * @example
4015
+ * ```typescript
4016
+ * import { Ethereum } from '@core/chains'
4017
+ *
4018
+ * const balance = await adapter.readAction(
4019
+ * 'token.balanceOf',
4020
+ * { tokenAddress, walletAddress },
4021
+ * { chain: Ethereum },
4022
+ * )
4023
+ * ```
4024
+ *
4025
+ * @internal
4026
+ */
4027
+ readAction<TActionKey extends ReadActionKey>(action: TActionKey, params: ActionPayload<TActionKey>, ctx: OperationContext<TAdapterCapabilities>): Promise<unknown>;
4028
+ /**
4029
+ * Read the current token allowance a delegate holds over an owner's tokens.
4030
+ *
4031
+ * @remarks
4032
+ * Perform a network read through {@link Adapter.readAction}. This method
4033
+ * never routes through {@link Adapter.prepareAction}. On chains without an
4034
+ * allowance model, such as Solana, return the maximum uint256 value.
4035
+ *
4036
+ * @param params - The token to query and the delegate whose allowance is being read.
4037
+ * @param ctx - Operation context with compile-time validated address requirements.
4038
+ * @returns A promise resolving to the current allowance in the token's base units.
4039
+ * @throws {KitError} When the adapter does not register a `token.allowance` handler.
4040
+ * @throws Error When the operation context or action handler fails.
4041
+ *
4042
+ * @example
4043
+ * ```typescript
4044
+ * import type { Adapter } from '@core/adapter'
4045
+ * import { Ethereum } from '@core/chains'
4046
+ *
4047
+ * declare const adapter: Adapter
4048
+ *
4049
+ * const allowance = await adapter.getTokenAllowance(
4050
+ * {
4051
+ * tokenAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
4052
+ * delegate: '0x1111111111111111111111111111111111111111',
4053
+ * },
4054
+ * { chain: Ethereum },
4055
+ * )
4056
+ * console.log(allowance) // 1000000n
4057
+ * ```
4058
+ */
4059
+ getTokenAllowance(params: ActionPayload<'token.allowance'>, ctx: OperationContext<TAdapterCapabilities>): Promise<bigint>;
3957
4060
  /**
3958
4061
  * Prepares a transaction for future gas estimation and execution.
3959
4062
  *
@@ -7496,29 +7599,37 @@ type EarnAdapterContext<TAdapterCapabilities extends AdapterCapabilities = Adapt
7496
7599
  * Configuration options for earn operations.
7497
7600
  *
7498
7601
  * EarnKit supports dual-mode authentication: operations work both with
7499
- * and without a Kit Key. When present, the Kit Key enables permissioned
7602
+ * and without an API key. When present, the API key enables permissioned
7500
7603
  * features like integrator attribution tracking.
7501
7604
  *
7502
7605
  * @example
7503
7606
  * ```typescript
7504
- * // Permissionless (no Kit Key)
7607
+ * // Permissionless (no API key)
7505
7608
  * const config: EarnConfig = {}
7506
7609
  *
7507
- * // Permissioned (with Kit Key)
7610
+ * // Permissioned (with API key)
7508
7611
  * const config: EarnConfig = {
7509
- * kitKey: 'KIT_KEY:keyId:keySecret',
7612
+ * apiKey: 'TEST_API_KEY:keyId:keySecret',
7510
7613
  * }
7511
7614
  * ```
7512
7615
  */
7513
7616
  interface EarnConfig {
7514
7617
  /**
7515
- * Optional Kit Key for permissioned access.
7618
+ * Optional Circle API key for permissioned access.
7516
7619
  *
7517
7620
  * When provided, enables integrator attribution tracking and
7518
7621
  * higher rate limits. When omitted, the SDK operates in
7519
7622
  * permissionless mode.
7520
7623
  *
7521
- * Format: `KIT_KEY:<keyId>:<keySecret>`
7624
+ * Format: `<ENV>_API_KEY:<keyId>:<keySecret>`. A legacy
7625
+ * `KIT_KEY:<keyId>:<keySecret>` value is also accepted.
7626
+ */
7627
+ readonly apiKey?: string | undefined;
7628
+ /**
7629
+ * Optional Circle API key for permissioned access.
7630
+ *
7631
+ * @deprecated Use {@link EarnConfig.apiKey} instead. Still honored when
7632
+ * `apiKey` is omitted, and `apiKey` takes precedence when both are set.
7522
7633
  */
7523
7634
  readonly kitKey?: string | undefined;
7524
7635
  /**
@@ -8165,6 +8276,30 @@ type EarnClaimRewardsQuoteInfo = Omit<ClaimRewardsQuoteInfo, 'rewards'> & {
8165
8276
  */
8166
8277
  type EarnOperationParams = AnyDepositParams | WithdrawParams | ClaimRewardsParams | GetVaultsParams | ExploreVaultsParams | ExploreVaultsIteratorParams | GetPositionParams | GetDepositQuoteParams | GetWithdrawalQuoteParams | GetClaimRewardsQuoteParams;
8167
8278
 
8279
+ /**
8280
+ * Configure how CCTP and forwarding fees are collected for a bridge.
8281
+ *
8282
+ * @remarks
8283
+ * Use `'source'` with `to.useForwarder: true` to treat `amount` as the exact
8284
+ * destination amount. Bridge Kit obtains a signed fee quote, collects the fee
8285
+ * in source-chain USDC, and leaves the destination mint unreduced. Omit the
8286
+ * option (or use `'destination'`) to preserve the existing max-fee behavior.
8287
+ *
8288
+ * @example
8289
+ * ```typescript
8290
+ * import type { BridgeExecutionConfig } from '@circle-fin/bridge-kit'
8291
+ *
8292
+ * const config: BridgeExecutionConfig = {
8293
+ * transferSpeed: 'FAST',
8294
+ * feePayment: 'source',
8295
+ * }
8296
+ * ```
8297
+ * @since 1.14.0
8298
+ */
8299
+ interface BridgeExecutionConfig extends BridgeConfig {
8300
+ /** Select source-side signed fees or the legacy destination-side fee path. */
8301
+ feePayment?: 'source' | 'destination';
8302
+ }
8168
8303
  type FeeFunction<TFromAdapterCapabilities extends AdapterCapabilities, TToAdapterCapabilities extends AdapterCapabilities> = (params: BridgeParams$1<TFromAdapterCapabilities, TToAdapterCapabilities>) => Promise<string> | string;
8169
8304
  type FeeRecipientFunction<TFromAdapterCapabilities extends AdapterCapabilities, TToAdapterCapabilities extends AdapterCapabilities> = (feePayoutChain: ChainDefinition, params: BridgeParams$1<TFromAdapterCapabilities, TToAdapterCapabilities>) => Promise<string> | string;
8170
8305
  /**
@@ -8325,7 +8460,7 @@ interface BridgeParams<TFromAdapterCapabilities extends AdapterCapabilities = Ad
8325
8460
  * Optional bridge configuration (e.g., transfer speed).
8326
8461
  * If omitted, defaults will be used
8327
8462
  */
8328
- config?: BridgeConfig;
8463
+ config?: BridgeExecutionConfig;
8329
8464
  /**
8330
8465
  * The token to transfer. Defaults to 'USDC'.
8331
8466
  * If omitted, the provider will use 'USDC' by default.
@@ -8352,6 +8487,16 @@ interface BridgeParams<TFromAdapterCapabilities extends AdapterCapabilities = Ad
8352
8487
  * ```
8353
8488
  */
8354
8489
  invocationMeta?: InvocationMeta;
8490
+ /**
8491
+ * Reuse the opaque signed quote returned by a receive-exact estimate.
8492
+ *
8493
+ * @remarks
8494
+ * Bridge Kit validates a supplied quote against the exact transfer and fails
8495
+ * when it is invalid, mismatched, expired, or too close to expiry. Omit this
8496
+ * value to let Bridge Kit fetch a fresh quote automatically. Never log or
8497
+ * decode it.
8498
+ */
8499
+ quote?: string;
8355
8500
  }
8356
8501
 
8357
8502
  /**
@@ -8467,12 +8612,21 @@ interface ServiceSwapConfig {
8467
8612
  recipientAddress?: string;
8468
8613
  };
8469
8614
  /**
8470
- * Stablecoin Service Kit Key used to authenticate service-backed swap
8471
- * requests.
8615
+ * Circle API key used to authenticate service-backed swap requests.
8616
+ *
8617
+ * Format: `<ENV>_API_KEY:<keyId>:<keySecret>`. A legacy
8618
+ * `KIT_KEY:<keyId>:<keySecret>` value is also accepted.
8472
8619
  *
8473
8620
  * Treat this value as a credential. Do not log it, embed it in client-side
8474
8621
  * source, or expose it in telemetry.
8475
8622
  */
8623
+ apiKey?: string | undefined;
8624
+ /**
8625
+ * Circle API key used to authenticate service-backed swap requests.
8626
+ *
8627
+ * @deprecated Use {@link ServiceSwapConfig.apiKey} instead. Still honored
8628
+ * when `apiKey` is omitted, and `apiKey` takes precedence when both are set.
8629
+ */
8476
8630
  kitKey?: string;
8477
8631
  /**
8478
8632
  * DEX aggregator identifier used to source the swap route.
@@ -8950,12 +9104,21 @@ interface SwapConfig {
8950
9104
  recipientAddress: string;
8951
9105
  };
8952
9106
  /**
8953
- * Stablecoin Service Kit Key used to authenticate service-backed swap
8954
- * requests.
9107
+ * Circle API key used to authenticate service-backed swap requests.
9108
+ *
9109
+ * Format: `<ENV>_API_KEY:<keyId>:<keySecret>`. A legacy
9110
+ * `KIT_KEY:<keyId>:<keySecret>` value is also accepted.
8955
9111
  *
8956
9112
  * Treat this value as a credential. Do not log it, embed it in client-side
8957
9113
  * source, or expose it in telemetry.
8958
9114
  */
9115
+ apiKey?: string | undefined;
9116
+ /**
9117
+ * Circle API key used to authenticate service-backed swap requests.
9118
+ *
9119
+ * @deprecated Use {@link SwapConfig.apiKey} instead. Still honored when
9120
+ * `apiKey` is omitted, and `apiKey` takes precedence when both are set.
9121
+ */
8959
9122
  kitKey?: string;
8960
9123
  }
8961
9124
  /**
@@ -9356,13 +9519,18 @@ interface AppKitContext {
9356
9519
  */
9357
9520
  disableErrorReporting?: boolean;
9358
9521
  /**
9359
- * Custom HTTP headers forwarded with the underlying CCTP provider's
9360
- * attestation (Iris) API requests made by bridge operations.
9522
+ * Custom HTTP headers forwarded with Circle API requests made by the
9523
+ * underlying kits: the CCTP provider's attestation (Iris) requests for
9524
+ * bridge operations, and the Gateway API requests for unified-balance
9525
+ * operations.
9361
9526
  *
9362
9527
  * @remarks
9363
9528
  * Headers are merged on top of the SDK defaults (such as `Content-Type`)
9364
- * rather than replacing them. The header is forwarded as-is to Circle's API;
9365
- * the SDK does not interpret it.
9529
+ * rather than replacing them. Each header is forwarded as-is to Circle's API;
9530
+ * the SDK does not interpret it. The same map is forwarded to every relevant
9531
+ * kit, so a header a given API ignores is simply a no-op there. A
9532
+ * `unifiedBalance.headers` value, if provided, takes precedence for the
9533
+ * unified-balance kit.
9366
9534
  */
9367
9535
  headers?: Record<string, string>;
9368
9536
  }