@circle-fin/app-kit 1.12.1 → 1.14.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.
@@ -559,6 +559,19 @@ interface GatewayV1Contracts {
559
559
  * @example "0xD05E7D2E7d30b92c5F17d7d0fC575fce231F1A48"
560
560
  */
561
561
  depositForHandler?: string;
562
+ /**
563
+ * The address of the `GenericExecutor` contract.
564
+ *
565
+ * @description Optional. The contract that acts as `mintRecipient` and
566
+ * `destinationCaller` for the CCTP v2 prepaid FORWARD path. It receives the
567
+ * CCTP mint and calls {@link GatewayV1Contracts.depositForHandler} to
568
+ * complete the fast deposit into the {@link GatewayV1Contracts.wallet}.
569
+ * Present only on chains that are fast-deposit destinations; other Gateway
570
+ * chains omit it.
571
+ *
572
+ * @example "0xFa7be2f04F3Ad4ca969260729c6d45B5625984A7"
573
+ */
574
+ genericExecutor?: string;
562
575
  }
563
576
  /**
564
577
  * Versioned map of Gateway contract configurations.
@@ -718,6 +731,8 @@ declare enum Blockchain {
718
731
  Optimism_Sepolia = "Optimism_Sepolia",
719
732
  Pharos = "Pharos",
720
733
  Pharos_Testnet = "Pharos_Testnet",
734
+ Plasma = "Plasma",
735
+ Plasma_Testnet = "Plasma_Testnet",
721
736
  Polkadot_Asset_Hub = "Polkadot_Asset_Hub",
722
737
  Polkadot_Westmint = "Polkadot_Westmint",
723
738
  Plume = "Plume",
@@ -946,6 +961,7 @@ declare enum BridgeChain {
946
961
  Morph = "Morph",
947
962
  Optimism = "Optimism",
948
963
  Pharos = "Pharos",
964
+ Plasma = "Plasma",
949
965
  Plume = "Plume",
950
966
  Polygon = "Polygon",
951
967
  Sei = "Sei",
@@ -971,6 +987,7 @@ declare enum BridgeChain {
971
987
  Morph_Testnet = "Morph_Testnet",
972
988
  Optimism_Sepolia = "Optimism_Sepolia",
973
989
  Pharos_Testnet = "Pharos_Testnet",
990
+ Plasma_Testnet = "Plasma_Testnet",
974
991
  Plume_Testnet = "Plume_Testnet",
975
992
  Polygon_Amoy_Testnet = "Polygon_Amoy_Testnet",
976
993
  Sei_Testnet = "Sei_Testnet",
@@ -2652,7 +2669,7 @@ interface ExecuteParams {
2652
2669
  * fromAddress: '0x...',
2653
2670
  * toAddress: '0x...',
2654
2671
  * amount: '1000000',
2655
- * apiKey: 'KIT_KEY:...',
2672
+ * apiKey: 'TEST_API_KEY:...',
2656
2673
  * })
2657
2674
  *
2658
2675
  * // Build token inputs with permit
@@ -2796,7 +2813,7 @@ interface ExecuteSwapEVMParams extends ActionParameters {
2796
2813
  * fromAddress: 'YubQzu18FDqJRyNfG8JqHmsdbxhnoQqcKUHBdUkN6tP',
2797
2814
  * toAddress: 'YubQzu18FDqJRyNfG8JqHmsdbxhnoQqcKUHBdUkN6tP',
2798
2815
  * amount: '1000000',
2799
- * apiKey: 'KIT_KEY:...',
2816
+ * apiKey: 'TEST_API_KEY:...',
2800
2817
  * })
2801
2818
  *
2802
2819
  * // Prepare action parameters
@@ -5459,6 +5476,48 @@ TChainDefinition extends ChainDefinition = ChainDefinition> extends WalletContex
5459
5476
  * Must be a valid address format for the specified blockchain.
5460
5477
  */
5461
5478
  recipientAddress?: string;
5479
+ /**
5480
+ * Optional destination dApp deposit action for a fast cross-chain transfer.
5481
+ *
5482
+ * When set, the burned USDC is minted to Circle's GenericExecutor on the
5483
+ * destination chain, which calls the registered dApp (for example, a Gateway
5484
+ * `depositFor`) in the same relayed flow. Consumed by the CCTP v2 provider's
5485
+ * executor-deposit path; requires `useForwarder: true`.
5486
+ *
5487
+ * @see {@link BridgeDepositAction}
5488
+ */
5489
+ deposit?: BridgeDepositAction;
5490
+ }
5491
+ /**
5492
+ * Destination dApp deposit action for a fast cross-chain transfer.
5493
+ *
5494
+ * When present on a bridge destination, the CCTP v2 provider routes the
5495
+ * transfer through Circle's GenericExecutor: the burned USDC is minted to the
5496
+ * executor on the destination chain, which then calls the registered dApp (for
5497
+ * example, a Gateway `depositFor`) in the same relayed flow. Encoded into
5498
+ * executor hookData via `buildDepositForGenericExecutorPayload`.
5499
+ *
5500
+ * @example
5501
+ * ```typescript
5502
+ * import type { BridgeDepositAction } from '@core/provider'
5503
+ *
5504
+ * const deposit: BridgeDepositAction = {
5505
+ * dappId: 'gateway_deposit',
5506
+ * params: ['0xTokenMessengerWithFees', '0xDepositAccount', 0n],
5507
+ * }
5508
+ * ```
5509
+ */
5510
+ interface BridgeDepositAction {
5511
+ /**
5512
+ * Registered dApp identifier the GenericExecutor invokes on the destination
5513
+ * chain (for example, `'gateway_deposit'`).
5514
+ */
5515
+ dappId: string;
5516
+ /**
5517
+ * Positional arguments for the dApp function, in ABI order. Dynamic amount
5518
+ * slots are filled in by the executor from the minted amount.
5519
+ */
5520
+ params: readonly unknown[];
5462
5521
  }
5463
5522
  /**
5464
5523
  * Parameters for executing a cross-chain bridge operation.
@@ -5859,6 +5918,145 @@ type BridgeDestination<TAdapterCapabilities extends AdapterCapabilities = Adapte
5859
5918
  useForwarder?: boolean;
5860
5919
  }) | ForwarderDestination<TChainIdentifier>;
5861
5920
 
5921
+ /**
5922
+ * The expiry window of a signed quote.
5923
+ *
5924
+ * A signed quote is short-lived; refresh it immediately before submitting
5925
+ * on-chain rather than caching it.
5926
+ *
5927
+ * The API uses different field names depending on `mode`:
5928
+ * - `TIMESTAMP` → `expiresAt` (unix seconds)
5929
+ * - `BLOCK_NUMBER` → `expiresAtBlock` (source-chain block number)
5930
+ *
5931
+ * @internal
5932
+ */
5933
+ type FeeQuoteExpiry = {
5934
+ /** Identify an exact Unix timestamp expiry. */
5935
+ readonly mode: 'TIMESTAMP';
5936
+ /** Unix timestamp in seconds at which the quote expires. */
5937
+ readonly expiresAt: number;
5938
+ } | {
5939
+ /** Identify a source-chain block-number expiry. */
5940
+ readonly mode: 'BLOCK_NUMBER';
5941
+ /** Authoritative source-chain block at which the quote expires. */
5942
+ readonly expiresAtBlock: number;
5943
+ /** Optional advisory Unix timestamp estimate for the expiry block. */
5944
+ readonly blockEstimatedAt?: number;
5945
+ };
5946
+
5947
+ /**
5948
+ * Configure how CCTP and forwarding fees are collected for a bridge.
5949
+ *
5950
+ * @remarks
5951
+ * Use `'source'` with `to.useForwarder: true` to treat `amount` as the exact
5952
+ * destination amount. Bridge Kit obtains a signed fee quote, collects the fee
5953
+ * in source-chain USDC, and leaves the destination mint unreduced. Omit the
5954
+ * option (or use `'destination'`) to preserve the existing max-fee behavior.
5955
+ *
5956
+ * @example
5957
+ * ```typescript
5958
+ * import type { BridgeExecutionConfig } from '@circle-fin/bridge-kit'
5959
+ *
5960
+ * const config: BridgeExecutionConfig = {
5961
+ * transferSpeed: 'FAST',
5962
+ * feePayment: 'source',
5963
+ * }
5964
+ * ```
5965
+ * @since 1.14.0
5966
+ */
5967
+ interface BridgeExecutionConfig extends BridgeConfig {
5968
+ /** Select source-side signed fees or the legacy destination-side fee path. */
5969
+ feePayment?: 'source' | 'destination';
5970
+ }
5971
+ /**
5972
+ * Describe one signed Fee Service line item in human-readable USDC.
5973
+ *
5974
+ * @example
5975
+ * ```typescript
5976
+ * import type { ReceiveExactFeeItem } from '@circle-fin/bridge-kit'
5977
+ *
5978
+ * const item: ReceiveExactFeeItem = {
5979
+ * type: 'FORWARD',
5980
+ * amount: '0.25',
5981
+ * args: [],
5982
+ * argsHash: `0x${'00'.repeat(32)}`,
5983
+ * }
5984
+ * ```
5985
+ * @since 1.14.0
5986
+ */
5987
+ interface ReceiveExactFeeItem {
5988
+ /** The Fee Service item type, such as `FORWARD` or `PRE_FINALITY`. */
5989
+ readonly type: string;
5990
+ /** The fee amount in human-readable USDC. */
5991
+ readonly amount: string;
5992
+ /** The ABI arguments covered by the signed quote. */
5993
+ readonly args: readonly string[];
5994
+ /** The hash of the ABI arguments covered by the signed quote. */
5995
+ readonly argsHash: string;
5996
+ }
5997
+ /**
5998
+ * Return a receive-exact bridge estimate backed by a short-lived signed quote.
5999
+ *
6000
+ * @remarks
6001
+ * Treat `quote` as opaque and sensitive. Pass it back to
6002
+ * {@link BridgeKit.bridge}; do not log or decode it. Bridge Kit validates a
6003
+ * supplied quote against the exact transfer parameters and rejects it when it
6004
+ * is invalid, mismatched, expired, or too close to expiry.
6005
+ *
6006
+ * @example
6007
+ * ```typescript
6008
+ * import { BridgeKit, type BridgeParams } from '@circle-fin/bridge-kit'
6009
+ *
6010
+ * declare const adapter: BridgeParams['from']['adapter']
6011
+ * const kit = new BridgeKit()
6012
+ *
6013
+ * const estimate = await kit.estimate({
6014
+ * from: { adapter, chain: 'Ethereum' },
6015
+ * to: {
6016
+ * chain: 'Base',
6017
+ * recipientAddress: '0x1234567890123456789012345678901234567890',
6018
+ * useForwarder: true,
6019
+ * },
6020
+ * amount: '100',
6021
+ * config: { feePayment: 'source' },
6022
+ * })
6023
+ * console.log(estimate.amountReceived, estimate.totalDebit)
6024
+ * ```
6025
+ * @since 1.14.0
6026
+ */
6027
+ interface ReceiveExactEstimateResult extends EstimateResult {
6028
+ /** The exact amount the destination recipient receives, in USDC. */
6029
+ readonly amountReceived: string;
6030
+ /** The total signed fee collected on the source chain, in USDC. */
6031
+ readonly feeTotal: string;
6032
+ /** The itemized signed fee quote, with amounts in human-readable USDC. */
6033
+ readonly feeItems: readonly ReceiveExactFeeItem[];
6034
+ /** The total source-wallet debit (`amountReceived + feeTotal`), in USDC. */
6035
+ readonly totalDebit: string;
6036
+ /** The authoritative expiry returned by the Fee Service. */
6037
+ readonly quoteExpiry: FeeQuoteExpiry;
6038
+ /** Opaque signed quote bytes to pass to {@link BridgeKit.bridge}. */
6039
+ readonly quote: string;
6040
+ }
6041
+ /**
6042
+ * Result returned by {@link BridgeKit.estimate} for legacy and source-fee modes.
6043
+ *
6044
+ * @example
6045
+ * ```typescript
6046
+ * import {
6047
+ * BridgeKit,
6048
+ * type BridgeEstimateResult,
6049
+ * type BridgeParams,
6050
+ * } from '@circle-fin/bridge-kit'
6051
+ *
6052
+ * declare const params: BridgeParams
6053
+ * const kit = new BridgeKit()
6054
+ * const result: BridgeEstimateResult = await kit.estimate(params)
6055
+ * if ('amountReceived' in result) console.log(result.totalDebit)
6056
+ * ```
6057
+ * @since 1.14.0
6058
+ */
6059
+ type BridgeEstimateResult = EstimateResult | ReceiveExactEstimateResult;
5862
6060
  type FeeFunction<TFromAdapterCapabilities extends AdapterCapabilities, TToAdapterCapabilities extends AdapterCapabilities> = (params: BridgeParams$1<TFromAdapterCapabilities, TToAdapterCapabilities>) => Promise<string> | string;
5863
6061
  type FeeRecipientFunction<TFromAdapterCapabilities extends AdapterCapabilities, TToAdapterCapabilities extends AdapterCapabilities> = (feePayoutChain: ChainDefinition, params: BridgeParams$1<TFromAdapterCapabilities, TToAdapterCapabilities>) => Promise<string> | string;
5864
6062
  /**
@@ -6019,7 +6217,7 @@ interface BridgeParams<TFromAdapterCapabilities extends AdapterCapabilities = Ad
6019
6217
  * Optional bridge configuration (e.g., transfer speed).
6020
6218
  * If omitted, defaults will be used
6021
6219
  */
6022
- config?: BridgeConfig;
6220
+ config?: BridgeExecutionConfig;
6023
6221
  /**
6024
6222
  * The token to transfer. Defaults to 'USDC'.
6025
6223
  * If omitted, the provider will use 'USDC' by default.
@@ -6046,6 +6244,16 @@ interface BridgeParams<TFromAdapterCapabilities extends AdapterCapabilities = Ad
6046
6244
  * ```
6047
6245
  */
6048
6246
  invocationMeta?: InvocationMeta;
6247
+ /**
6248
+ * Reuse the opaque signed quote returned by a receive-exact estimate.
6249
+ *
6250
+ * @remarks
6251
+ * Bridge Kit validates a supplied quote against the exact transfer and fails
6252
+ * when it is invalid, mismatched, expired, or too close to expiry. Omit this
6253
+ * value to let Bridge Kit fetch a fresh quote automatically. Never log or
6254
+ * decode it.
6255
+ */
6256
+ quote?: string;
6049
6257
  }
6050
6258
 
6051
6259
  /**
@@ -6161,12 +6369,21 @@ interface ServiceSwapConfig {
6161
6369
  recipientAddress?: string;
6162
6370
  };
6163
6371
  /**
6164
- * Stablecoin Service Kit Key used to authenticate service-backed swap
6165
- * requests.
6372
+ * Circle API key used to authenticate service-backed swap requests.
6373
+ *
6374
+ * Format: `<ENV>_API_KEY:<keyId>:<keySecret>`. A legacy
6375
+ * `KIT_KEY:<keyId>:<keySecret>` value is also accepted.
6166
6376
  *
6167
6377
  * Treat this value as a credential. Do not log it, embed it in client-side
6168
6378
  * source, or expose it in telemetry.
6169
6379
  */
6380
+ apiKey?: string | undefined;
6381
+ /**
6382
+ * Circle API key used to authenticate service-backed swap requests.
6383
+ *
6384
+ * @deprecated Use {@link ServiceSwapConfig.apiKey} instead. Still honored
6385
+ * when `apiKey` is omitted, and `apiKey` takes precedence when both are set.
6386
+ */
6170
6387
  kitKey?: string;
6171
6388
  /**
6172
6389
  * DEX aggregator identifier used to source the swap route.
@@ -6644,12 +6861,21 @@ interface SwapConfig {
6644
6861
  recipientAddress: string;
6645
6862
  };
6646
6863
  /**
6647
- * Stablecoin Service Kit Key used to authenticate service-backed swap
6648
- * requests.
6864
+ * Circle API key used to authenticate service-backed swap requests.
6865
+ *
6866
+ * Format: `<ENV>_API_KEY:<keyId>:<keySecret>`. A legacy
6867
+ * `KIT_KEY:<keyId>:<keySecret>` value is also accepted.
6649
6868
  *
6650
6869
  * Treat this value as a credential. Do not log it, embed it in client-side
6651
6870
  * source, or expose it in telemetry.
6652
6871
  */
6872
+ apiKey?: string | undefined;
6873
+ /**
6874
+ * Circle API key used to authenticate service-backed swap requests.
6875
+ *
6876
+ * @deprecated Use {@link SwapConfig.apiKey} instead. Still honored when
6877
+ * `apiKey` is omitted, and `apiKey` takes precedence when both are set.
6878
+ */
6653
6879
  kitKey?: string;
6654
6880
  }
6655
6881
  /**
@@ -6778,29 +7004,37 @@ type EarnAdapterContext<TAdapterCapabilities extends AdapterCapabilities = Adapt
6778
7004
  * Configuration options for earn operations.
6779
7005
  *
6780
7006
  * EarnKit supports dual-mode authentication: operations work both with
6781
- * and without a Kit Key. When present, the Kit Key enables permissioned
7007
+ * and without an API key. When present, the API key enables permissioned
6782
7008
  * features like integrator attribution tracking.
6783
7009
  *
6784
7010
  * @example
6785
7011
  * ```typescript
6786
- * // Permissionless (no Kit Key)
7012
+ * // Permissionless (no API key)
6787
7013
  * const config: EarnConfig = {}
6788
7014
  *
6789
- * // Permissioned (with Kit Key)
7015
+ * // Permissioned (with API key)
6790
7016
  * const config: EarnConfig = {
6791
- * kitKey: 'KIT_KEY:keyId:keySecret',
7017
+ * apiKey: 'TEST_API_KEY:keyId:keySecret',
6792
7018
  * }
6793
7019
  * ```
6794
7020
  */
6795
7021
  interface EarnConfig {
6796
7022
  /**
6797
- * Optional Kit Key for permissioned access.
7023
+ * Optional Circle API key for permissioned access.
6798
7024
  *
6799
7025
  * When provided, enables integrator attribution tracking and
6800
7026
  * higher rate limits. When omitted, the SDK operates in
6801
7027
  * permissionless mode.
6802
7028
  *
6803
- * Format: `KIT_KEY:<keyId>:<keySecret>`
7029
+ * Format: `<ENV>_API_KEY:<keyId>:<keySecret>`. A legacy
7030
+ * `KIT_KEY:<keyId>:<keySecret>` value is also accepted.
7031
+ */
7032
+ readonly apiKey?: string | undefined;
7033
+ /**
7034
+ * Optional Circle API key for permissioned access.
7035
+ *
7036
+ * @deprecated Use {@link EarnConfig.apiKey} instead. Still honored when
7037
+ * `apiKey` is omitted, and `apiKey` takes precedence when both are set.
6804
7038
  */
6805
7039
  readonly kitKey?: string | undefined;
6806
7040
  /**
@@ -7567,13 +7801,18 @@ interface AppKitContext {
7567
7801
  */
7568
7802
  disableErrorReporting?: boolean;
7569
7803
  /**
7570
- * Custom HTTP headers forwarded with the underlying CCTP provider's
7571
- * attestation (Iris) API requests made by bridge operations.
7804
+ * Custom HTTP headers forwarded with Circle API requests made by the
7805
+ * underlying kits: the CCTP provider's attestation (Iris) requests for
7806
+ * bridge operations, and the Gateway API requests for unified-balance
7807
+ * operations.
7572
7808
  *
7573
7809
  * @remarks
7574
7810
  * Headers are merged on top of the SDK defaults (such as `Content-Type`)
7575
- * rather than replacing them. The header is forwarded as-is to Circle's API;
7576
- * the SDK does not interpret it.
7811
+ * rather than replacing them. Each header is forwarded as-is to Circle's API;
7812
+ * the SDK does not interpret it. The same map is forwarded to every relevant
7813
+ * kit, so a header a given API ignores is simply a no-op there. A
7814
+ * `unifiedBalance.headers` value, if provided, takes precedence for the
7815
+ * unified-balance kit.
7577
7816
  */
7578
7817
  headers?: Record<string, string>;
7579
7818
  }
@@ -7617,6 +7856,6 @@ interface AppKitContext {
7617
7856
  * console.log('Estimated gas fees:', estimate.gasFees)
7618
7857
  * ```
7619
7858
  */
7620
- declare const estimateBridge: (context: AppKitContext, params: BridgeParams) => Promise<EstimateResult>;
7859
+ declare const estimateBridge: (context: AppKitContext, params: BridgeParams) => Promise<BridgeEstimateResult>;
7621
7860
 
7622
7861
  export { estimateBridge };