@circle-fin/app-kit 1.12.1 → 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.
@@ -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
@@ -5859,6 +5863,139 @@ type BridgeDestination<TAdapterCapabilities extends AdapterCapabilities = Adapte
5859
5863
  useForwarder?: boolean;
5860
5864
  }) | ForwarderDestination<TChainIdentifier>;
5861
5865
 
5866
+ /**
5867
+ * The expiry window of a signed quote.
5868
+ *
5869
+ * A signed quote is short-lived; refresh it immediately before submitting
5870
+ * on-chain rather than caching it.
5871
+ */
5872
+ type FeeQuoteExpiry = {
5873
+ /** Identify an exact Unix timestamp expiry. */
5874
+ readonly mode: 'TIMESTAMP';
5875
+ /** Unix timestamp in seconds at which the quote expires. */
5876
+ readonly expiresAt: number;
5877
+ } | {
5878
+ /** Identify a source-chain block-number expiry. */
5879
+ readonly mode: 'BLOCK_NUMBER';
5880
+ /** Authoritative source-chain block at which the quote expires. */
5881
+ readonly expiresAtBlock: number;
5882
+ /** Optional advisory Unix timestamp estimate for the expiry block. */
5883
+ readonly blockEstimatedAt?: number;
5884
+ };
5885
+
5886
+ /**
5887
+ * Configure how CCTP and forwarding fees are collected for a bridge.
5888
+ *
5889
+ * @remarks
5890
+ * Use `'source'` with `to.useForwarder: true` to treat `amount` as the exact
5891
+ * destination amount. Bridge Kit obtains a signed fee quote, collects the fee
5892
+ * in source-chain USDC, and leaves the destination mint unreduced. Omit the
5893
+ * option (or use `'destination'`) to preserve the existing max-fee behavior.
5894
+ *
5895
+ * @example
5896
+ * ```typescript
5897
+ * import type { BridgeExecutionConfig } from '@circle-fin/bridge-kit'
5898
+ *
5899
+ * const config: BridgeExecutionConfig = {
5900
+ * transferSpeed: 'FAST',
5901
+ * feePayment: 'source',
5902
+ * }
5903
+ * ```
5904
+ * @since 1.14.0
5905
+ */
5906
+ interface BridgeExecutionConfig extends BridgeConfig {
5907
+ /** Select source-side signed fees or the legacy destination-side fee path. */
5908
+ feePayment?: 'source' | 'destination';
5909
+ }
5910
+ /**
5911
+ * Describe one signed Fee Service line item in human-readable USDC.
5912
+ *
5913
+ * @example
5914
+ * ```typescript
5915
+ * import type { ReceiveExactFeeItem } from '@circle-fin/bridge-kit'
5916
+ *
5917
+ * const item: ReceiveExactFeeItem = {
5918
+ * type: 'FORWARD',
5919
+ * amount: '0.25',
5920
+ * args: [],
5921
+ * argsHash: `0x${'00'.repeat(32)}`,
5922
+ * }
5923
+ * ```
5924
+ * @since 1.14.0
5925
+ */
5926
+ interface ReceiveExactFeeItem {
5927
+ /** The Fee Service item type, such as `FORWARD` or `PRE_FINALITY`. */
5928
+ readonly type: string;
5929
+ /** The fee amount in human-readable USDC. */
5930
+ readonly amount: string;
5931
+ /** The ABI arguments covered by the signed quote. */
5932
+ readonly args: readonly string[];
5933
+ /** The hash of the ABI arguments covered by the signed quote. */
5934
+ readonly argsHash: string;
5935
+ }
5936
+ /**
5937
+ * Return a receive-exact bridge estimate backed by a short-lived signed quote.
5938
+ *
5939
+ * @remarks
5940
+ * Treat `quote` as opaque and sensitive. Pass it back to
5941
+ * {@link BridgeKit.bridge}; do not log or decode it. Bridge Kit validates a
5942
+ * supplied quote against the exact transfer parameters and rejects it when it
5943
+ * is invalid, mismatched, expired, or too close to expiry.
5944
+ *
5945
+ * @example
5946
+ * ```typescript
5947
+ * import { BridgeKit, type BridgeParams } from '@circle-fin/bridge-kit'
5948
+ *
5949
+ * declare const adapter: BridgeParams['from']['adapter']
5950
+ * const kit = new BridgeKit()
5951
+ *
5952
+ * const estimate = await kit.estimate({
5953
+ * from: { adapter, chain: 'Ethereum' },
5954
+ * to: {
5955
+ * chain: 'Base',
5956
+ * recipientAddress: '0x1234567890123456789012345678901234567890',
5957
+ * useForwarder: true,
5958
+ * },
5959
+ * amount: '100',
5960
+ * config: { feePayment: 'source' },
5961
+ * })
5962
+ * console.log(estimate.amountReceived, estimate.totalDebit)
5963
+ * ```
5964
+ * @since 1.14.0
5965
+ */
5966
+ interface ReceiveExactEstimateResult extends EstimateResult {
5967
+ /** The exact amount the destination recipient receives, in USDC. */
5968
+ readonly amountReceived: string;
5969
+ /** The total signed fee collected on the source chain, in USDC. */
5970
+ readonly feeTotal: string;
5971
+ /** The itemized signed fee quote, with amounts in human-readable USDC. */
5972
+ readonly feeItems: readonly ReceiveExactFeeItem[];
5973
+ /** The total source-wallet debit (`amountReceived + feeTotal`), in USDC. */
5974
+ readonly totalDebit: string;
5975
+ /** The authoritative expiry returned by the Fee Service. */
5976
+ readonly quoteExpiry: FeeQuoteExpiry;
5977
+ /** Opaque signed quote bytes to pass to {@link BridgeKit.bridge}. */
5978
+ readonly quote: string;
5979
+ }
5980
+ /**
5981
+ * Result returned by {@link BridgeKit.estimate} for legacy and source-fee modes.
5982
+ *
5983
+ * @example
5984
+ * ```typescript
5985
+ * import {
5986
+ * BridgeKit,
5987
+ * type BridgeEstimateResult,
5988
+ * type BridgeParams,
5989
+ * } from '@circle-fin/bridge-kit'
5990
+ *
5991
+ * declare const params: BridgeParams
5992
+ * const kit = new BridgeKit()
5993
+ * const result: BridgeEstimateResult = await kit.estimate(params)
5994
+ * if ('amountReceived' in result) console.log(result.totalDebit)
5995
+ * ```
5996
+ * @since 1.14.0
5997
+ */
5998
+ type BridgeEstimateResult = EstimateResult | ReceiveExactEstimateResult;
5862
5999
  type FeeFunction<TFromAdapterCapabilities extends AdapterCapabilities, TToAdapterCapabilities extends AdapterCapabilities> = (params: BridgeParams$1<TFromAdapterCapabilities, TToAdapterCapabilities>) => Promise<string> | string;
5863
6000
  type FeeRecipientFunction<TFromAdapterCapabilities extends AdapterCapabilities, TToAdapterCapabilities extends AdapterCapabilities> = (feePayoutChain: ChainDefinition, params: BridgeParams$1<TFromAdapterCapabilities, TToAdapterCapabilities>) => Promise<string> | string;
5864
6001
  /**
@@ -6019,7 +6156,7 @@ interface BridgeParams<TFromAdapterCapabilities extends AdapterCapabilities = Ad
6019
6156
  * Optional bridge configuration (e.g., transfer speed).
6020
6157
  * If omitted, defaults will be used
6021
6158
  */
6022
- config?: BridgeConfig;
6159
+ config?: BridgeExecutionConfig;
6023
6160
  /**
6024
6161
  * The token to transfer. Defaults to 'USDC'.
6025
6162
  * If omitted, the provider will use 'USDC' by default.
@@ -6046,6 +6183,16 @@ interface BridgeParams<TFromAdapterCapabilities extends AdapterCapabilities = Ad
6046
6183
  * ```
6047
6184
  */
6048
6185
  invocationMeta?: InvocationMeta;
6186
+ /**
6187
+ * Reuse the opaque signed quote returned by a receive-exact estimate.
6188
+ *
6189
+ * @remarks
6190
+ * Bridge Kit validates a supplied quote against the exact transfer and fails
6191
+ * when it is invalid, mismatched, expired, or too close to expiry. Omit this
6192
+ * value to let Bridge Kit fetch a fresh quote automatically. Never log or
6193
+ * decode it.
6194
+ */
6195
+ quote?: string;
6049
6196
  }
6050
6197
 
6051
6198
  /**
@@ -6161,12 +6308,21 @@ interface ServiceSwapConfig {
6161
6308
  recipientAddress?: string;
6162
6309
  };
6163
6310
  /**
6164
- * Stablecoin Service Kit Key used to authenticate service-backed swap
6165
- * requests.
6311
+ * Circle API key used to authenticate service-backed swap requests.
6312
+ *
6313
+ * Format: `<ENV>_API_KEY:<keyId>:<keySecret>`. A legacy
6314
+ * `KIT_KEY:<keyId>:<keySecret>` value is also accepted.
6166
6315
  *
6167
6316
  * Treat this value as a credential. Do not log it, embed it in client-side
6168
6317
  * source, or expose it in telemetry.
6169
6318
  */
6319
+ apiKey?: string | undefined;
6320
+ /**
6321
+ * Circle API key used to authenticate service-backed swap requests.
6322
+ *
6323
+ * @deprecated Use {@link ServiceSwapConfig.apiKey} instead. Still honored
6324
+ * when `apiKey` is omitted, and `apiKey` takes precedence when both are set.
6325
+ */
6170
6326
  kitKey?: string;
6171
6327
  /**
6172
6328
  * DEX aggregator identifier used to source the swap route.
@@ -6644,12 +6800,21 @@ interface SwapConfig {
6644
6800
  recipientAddress: string;
6645
6801
  };
6646
6802
  /**
6647
- * Stablecoin Service Kit Key used to authenticate service-backed swap
6648
- * requests.
6803
+ * Circle API key used to authenticate service-backed swap requests.
6804
+ *
6805
+ * Format: `<ENV>_API_KEY:<keyId>:<keySecret>`. A legacy
6806
+ * `KIT_KEY:<keyId>:<keySecret>` value is also accepted.
6649
6807
  *
6650
6808
  * Treat this value as a credential. Do not log it, embed it in client-side
6651
6809
  * source, or expose it in telemetry.
6652
6810
  */
6811
+ apiKey?: string | undefined;
6812
+ /**
6813
+ * Circle API key used to authenticate service-backed swap requests.
6814
+ *
6815
+ * @deprecated Use {@link SwapConfig.apiKey} instead. Still honored when
6816
+ * `apiKey` is omitted, and `apiKey` takes precedence when both are set.
6817
+ */
6653
6818
  kitKey?: string;
6654
6819
  }
6655
6820
  /**
@@ -6778,29 +6943,37 @@ type EarnAdapterContext<TAdapterCapabilities extends AdapterCapabilities = Adapt
6778
6943
  * Configuration options for earn operations.
6779
6944
  *
6780
6945
  * EarnKit supports dual-mode authentication: operations work both with
6781
- * and without a Kit Key. When present, the Kit Key enables permissioned
6946
+ * and without an API key. When present, the API key enables permissioned
6782
6947
  * features like integrator attribution tracking.
6783
6948
  *
6784
6949
  * @example
6785
6950
  * ```typescript
6786
- * // Permissionless (no Kit Key)
6951
+ * // Permissionless (no API key)
6787
6952
  * const config: EarnConfig = {}
6788
6953
  *
6789
- * // Permissioned (with Kit Key)
6954
+ * // Permissioned (with API key)
6790
6955
  * const config: EarnConfig = {
6791
- * kitKey: 'KIT_KEY:keyId:keySecret',
6956
+ * apiKey: 'TEST_API_KEY:keyId:keySecret',
6792
6957
  * }
6793
6958
  * ```
6794
6959
  */
6795
6960
  interface EarnConfig {
6796
6961
  /**
6797
- * Optional Kit Key for permissioned access.
6962
+ * Optional Circle API key for permissioned access.
6798
6963
  *
6799
6964
  * When provided, enables integrator attribution tracking and
6800
6965
  * higher rate limits. When omitted, the SDK operates in
6801
6966
  * permissionless mode.
6802
6967
  *
6803
- * Format: `KIT_KEY:<keyId>:<keySecret>`
6968
+ * Format: `<ENV>_API_KEY:<keyId>:<keySecret>`. A legacy
6969
+ * `KIT_KEY:<keyId>:<keySecret>` value is also accepted.
6970
+ */
6971
+ readonly apiKey?: string | undefined;
6972
+ /**
6973
+ * Optional Circle API key for permissioned access.
6974
+ *
6975
+ * @deprecated Use {@link EarnConfig.apiKey} instead. Still honored when
6976
+ * `apiKey` is omitted, and `apiKey` takes precedence when both are set.
6804
6977
  */
6805
6978
  readonly kitKey?: string | undefined;
6806
6979
  /**
@@ -7567,13 +7740,18 @@ interface AppKitContext {
7567
7740
  */
7568
7741
  disableErrorReporting?: boolean;
7569
7742
  /**
7570
- * Custom HTTP headers forwarded with the underlying CCTP provider's
7571
- * attestation (Iris) API requests made by bridge operations.
7743
+ * Custom HTTP headers forwarded with Circle API requests made by the
7744
+ * underlying kits: the CCTP provider's attestation (Iris) requests for
7745
+ * bridge operations, and the Gateway API requests for unified-balance
7746
+ * operations.
7572
7747
  *
7573
7748
  * @remarks
7574
7749
  * 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.
7750
+ * rather than replacing them. Each header is forwarded as-is to Circle's API;
7751
+ * the SDK does not interpret it. The same map is forwarded to every relevant
7752
+ * kit, so a header a given API ignores is simply a no-op there. A
7753
+ * `unifiedBalance.headers` value, if provided, takes precedence for the
7754
+ * unified-balance kit.
7577
7755
  */
7578
7756
  headers?: Record<string, string>;
7579
7757
  }
@@ -7617,6 +7795,6 @@ interface AppKitContext {
7617
7795
  * console.log('Estimated gas fees:', estimate.gasFees)
7618
7796
  * ```
7619
7797
  */
7620
- declare const estimateBridge: (context: AppKitContext, params: BridgeParams) => Promise<EstimateResult>;
7798
+ declare const estimateBridge: (context: AppKitContext, params: BridgeParams) => Promise<BridgeEstimateResult>;
7621
7799
 
7622
7800
  export { estimateBridge };