@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.
@@ -717,6 +717,8 @@ declare enum Blockchain {
717
717
  Optimism_Sepolia = "Optimism_Sepolia",
718
718
  Pharos = "Pharos",
719
719
  Pharos_Testnet = "Pharos_Testnet",
720
+ Plasma = "Plasma",
721
+ Plasma_Testnet = "Plasma_Testnet",
720
722
  Polkadot_Asset_Hub = "Polkadot_Asset_Hub",
721
723
  Polkadot_Westmint = "Polkadot_Westmint",
722
724
  Plume = "Plume",
@@ -2299,7 +2301,7 @@ interface ExecuteParams {
2299
2301
  * fromAddress: '0x...',
2300
2302
  * toAddress: '0x...',
2301
2303
  * amount: '1000000',
2302
- * apiKey: 'KIT_KEY:...',
2304
+ * apiKey: 'TEST_API_KEY:...',
2303
2305
  * })
2304
2306
  *
2305
2307
  * // Build token inputs with permit
@@ -2443,7 +2445,7 @@ interface ExecuteSwapEVMParams extends ActionParameters {
2443
2445
  * fromAddress: 'YubQzu18FDqJRyNfG8JqHmsdbxhnoQqcKUHBdUkN6tP',
2444
2446
  * toAddress: 'YubQzu18FDqJRyNfG8JqHmsdbxhnoQqcKUHBdUkN6tP',
2445
2447
  * amount: '1000000',
2446
- * apiKey: 'KIT_KEY:...',
2448
+ * apiKey: 'TEST_API_KEY:...',
2447
2449
  * })
2448
2450
  *
2449
2451
  * // Prepare action parameters
@@ -3917,6 +3919,49 @@ interface ErrorInfo {
3917
3919
  type?: string;
3918
3920
  }
3919
3921
 
3922
+ /**
3923
+ * Configuration options for the API polling utility.
3924
+ *
3925
+ * @remarks
3926
+ * These settings control the behavior of the API polling process:
3927
+ * - timeout: Maximum time (ms) to wait for each request before aborting
3928
+ * - maxRetries: Maximum number of retry attempts for failed requests
3929
+ * - retryDelay: Base delay (ms); constant wait for `'fixed'` or exponential seed for `'exponential'`
3930
+ * - backoff: Retry-delay strategy, `'fixed'` (default) or `'exponential'`
3931
+ * - maxRetryDelayMs: Optional ceiling (ms) for a single backoff wait
3932
+ * - headers: Optional HTTP headers to include with each request
3933
+ */
3934
+ interface ApiPollingConfig {
3935
+ /** Maximum time in milliseconds to wait for each request */
3936
+ timeout: number;
3937
+ /** Maximum number of retry attempts for failed requests */
3938
+ maxRetries: number;
3939
+ /**
3940
+ * Delay in milliseconds between retry attempts. With the default
3941
+ * `backoff: 'fixed'` strategy this is the constant wait; with
3942
+ * `backoff: 'exponential'` it is the base the exponential backoff grows
3943
+ * from (see {@link pollApiWithValidation}).
3944
+ */
3945
+ retryDelay: number;
3946
+ /**
3947
+ * Retry-delay strategy. `'fixed'` (the default when omitted) waits a
3948
+ * constant `retryDelay` between attempts; `'exponential'` grows the wait
3949
+ * exponentially off `retryDelay` and randomizes it with full jitter, which
3950
+ * spreads out retries so rate-limited (429) bursts do not retry in
3951
+ * lockstep. Opt in per caller; existing callers keep the fixed delay.
3952
+ */
3953
+ backoff?: 'fixed' | 'exponential' | undefined;
3954
+ /**
3955
+ * Optional ceiling, in milliseconds, for a single backoff wait. Only
3956
+ * applies when `backoff` is `'exponential'`: the exponential delay is
3957
+ * capped at this value before jitter is applied. Defaults to
3958
+ * {@link DEFAULT_MAX_RETRY_DELAY_MS} when omitted.
3959
+ */
3960
+ maxRetryDelayMs?: number | undefined;
3961
+ /** Optional HTTP headers to include with requests */
3962
+ headers?: Record<string, string> | undefined;
3963
+ }
3964
+
3920
3965
  /**
3921
3966
  * A type-safe event emitter for managing action-based event subscriptions.
3922
3967
  *
@@ -4663,6 +4708,15 @@ interface SpendOptions {
4663
4708
  * @internal
4664
4709
  */
4665
4710
  onBroadcast?: (txHash: string) => void;
4711
+ /**
4712
+ * Partial polling config forwarded to every Gateway API request the spend
4713
+ * makes (estimate, transfer, forwarder status, and the balance lookups on
4714
+ * the auto-allocation path). The provider factory populates this from its
4715
+ * `headers` config so a configured header reaches all spend-path calls.
4716
+ *
4717
+ * @internal
4718
+ */
4719
+ requestConfig?: Partial<ApiPollingConfig>;
4666
4720
  }
4667
4721
  /**
4668
4722
  * Result returned after a successful spend (mint) operation.
@@ -6494,6 +6548,26 @@ interface UnifiedBalanceKitConfig<TExtraProviders extends FlexibleGatewayProvide
6494
6548
  * @defaultValue false
6495
6549
  */
6496
6550
  excludeDefaultProviders?: boolean;
6551
+ /**
6552
+ * Custom HTTP headers forwarded with every Circle Gateway API request the
6553
+ * default Gateway v1 provider makes (balances, deposits, spend estimate,
6554
+ * transfer, forwarder status, and `/v1/info`).
6555
+ *
6556
+ * @remarks
6557
+ * Headers are merged on top of the SDK defaults (such as `Content-Type`)
6558
+ * rather than replacing them. Each header is forwarded as-is to Circle's
6559
+ * API; the SDK does not interpret it. Only applies to the default provider —
6560
+ * has no effect when `excludeDefaultProviders` is `true` or on custom
6561
+ * providers supplied via `providers`.
6562
+ *
6563
+ * @example
6564
+ * ```typescript
6565
+ * const kit = new UnifiedBalanceKit({
6566
+ * headers: { 'X-Access-Key': process.env.GATEWAY_ACCESS_KEY! },
6567
+ * })
6568
+ * ```
6569
+ */
6570
+ headers?: Record<string, string>;
6497
6571
  }
6498
6572
 
6499
6573
  /**
@@ -717,6 +717,8 @@ declare enum Blockchain {
717
717
  Optimism_Sepolia = "Optimism_Sepolia",
718
718
  Pharos = "Pharos",
719
719
  Pharos_Testnet = "Pharos_Testnet",
720
+ Plasma = "Plasma",
721
+ Plasma_Testnet = "Plasma_Testnet",
720
722
  Polkadot_Asset_Hub = "Polkadot_Asset_Hub",
721
723
  Polkadot_Westmint = "Polkadot_Westmint",
722
724
  Plume = "Plume",
@@ -2299,7 +2301,7 @@ interface ExecuteParams {
2299
2301
  * fromAddress: '0x...',
2300
2302
  * toAddress: '0x...',
2301
2303
  * amount: '1000000',
2302
- * apiKey: 'KIT_KEY:...',
2304
+ * apiKey: 'TEST_API_KEY:...',
2303
2305
  * })
2304
2306
  *
2305
2307
  * // Build token inputs with permit
@@ -2443,7 +2445,7 @@ interface ExecuteSwapEVMParams extends ActionParameters {
2443
2445
  * fromAddress: 'YubQzu18FDqJRyNfG8JqHmsdbxhnoQqcKUHBdUkN6tP',
2444
2446
  * toAddress: 'YubQzu18FDqJRyNfG8JqHmsdbxhnoQqcKUHBdUkN6tP',
2445
2447
  * amount: '1000000',
2446
- * apiKey: 'KIT_KEY:...',
2448
+ * apiKey: 'TEST_API_KEY:...',
2447
2449
  * })
2448
2450
  *
2449
2451
  * // Prepare action parameters
@@ -3917,6 +3919,49 @@ interface ErrorInfo {
3917
3919
  type?: string;
3918
3920
  }
3919
3921
 
3922
+ /**
3923
+ * Configuration options for the API polling utility.
3924
+ *
3925
+ * @remarks
3926
+ * These settings control the behavior of the API polling process:
3927
+ * - timeout: Maximum time (ms) to wait for each request before aborting
3928
+ * - maxRetries: Maximum number of retry attempts for failed requests
3929
+ * - retryDelay: Base delay (ms); constant wait for `'fixed'` or exponential seed for `'exponential'`
3930
+ * - backoff: Retry-delay strategy, `'fixed'` (default) or `'exponential'`
3931
+ * - maxRetryDelayMs: Optional ceiling (ms) for a single backoff wait
3932
+ * - headers: Optional HTTP headers to include with each request
3933
+ */
3934
+ interface ApiPollingConfig {
3935
+ /** Maximum time in milliseconds to wait for each request */
3936
+ timeout: number;
3937
+ /** Maximum number of retry attempts for failed requests */
3938
+ maxRetries: number;
3939
+ /**
3940
+ * Delay in milliseconds between retry attempts. With the default
3941
+ * `backoff: 'fixed'` strategy this is the constant wait; with
3942
+ * `backoff: 'exponential'` it is the base the exponential backoff grows
3943
+ * from (see {@link pollApiWithValidation}).
3944
+ */
3945
+ retryDelay: number;
3946
+ /**
3947
+ * Retry-delay strategy. `'fixed'` (the default when omitted) waits a
3948
+ * constant `retryDelay` between attempts; `'exponential'` grows the wait
3949
+ * exponentially off `retryDelay` and randomizes it with full jitter, which
3950
+ * spreads out retries so rate-limited (429) bursts do not retry in
3951
+ * lockstep. Opt in per caller; existing callers keep the fixed delay.
3952
+ */
3953
+ backoff?: 'fixed' | 'exponential' | undefined;
3954
+ /**
3955
+ * Optional ceiling, in milliseconds, for a single backoff wait. Only
3956
+ * applies when `backoff` is `'exponential'`: the exponential delay is
3957
+ * capped at this value before jitter is applied. Defaults to
3958
+ * {@link DEFAULT_MAX_RETRY_DELAY_MS} when omitted.
3959
+ */
3960
+ maxRetryDelayMs?: number | undefined;
3961
+ /** Optional HTTP headers to include with requests */
3962
+ headers?: Record<string, string> | undefined;
3963
+ }
3964
+
3920
3965
  /**
3921
3966
  * A type-safe event emitter for managing action-based event subscriptions.
3922
3967
  *
@@ -4663,6 +4708,15 @@ interface SpendOptions {
4663
4708
  * @internal
4664
4709
  */
4665
4710
  onBroadcast?: (txHash: string) => void;
4711
+ /**
4712
+ * Partial polling config forwarded to every Gateway API request the spend
4713
+ * makes (estimate, transfer, forwarder status, and the balance lookups on
4714
+ * the auto-allocation path). The provider factory populates this from its
4715
+ * `headers` config so a configured header reaches all spend-path calls.
4716
+ *
4717
+ * @internal
4718
+ */
4719
+ requestConfig?: Partial<ApiPollingConfig>;
4666
4720
  }
4667
4721
  /**
4668
4722
  * Result returned after a successful spend (mint) operation.
@@ -6494,6 +6548,26 @@ interface UnifiedBalanceKitConfig<TExtraProviders extends FlexibleGatewayProvide
6494
6548
  * @defaultValue false
6495
6549
  */
6496
6550
  excludeDefaultProviders?: boolean;
6551
+ /**
6552
+ * Custom HTTP headers forwarded with every Circle Gateway API request the
6553
+ * default Gateway v1 provider makes (balances, deposits, spend estimate,
6554
+ * transfer, forwarder status, and `/v1/info`).
6555
+ *
6556
+ * @remarks
6557
+ * Headers are merged on top of the SDK defaults (such as `Content-Type`)
6558
+ * rather than replacing them. Each header is forwarded as-is to Circle's
6559
+ * API; the SDK does not interpret it. Only applies to the default provider —
6560
+ * has no effect when `excludeDefaultProviders` is `true` or on custom
6561
+ * providers supplied via `providers`.
6562
+ *
6563
+ * @example
6564
+ * ```typescript
6565
+ * const kit = new UnifiedBalanceKit({
6566
+ * headers: { 'X-Access-Key': process.env.GATEWAY_ACCESS_KEY! },
6567
+ * })
6568
+ * ```
6569
+ */
6570
+ headers?: Record<string, string>;
6497
6571
  }
6498
6572
 
6499
6573
  /**
@@ -717,6 +717,8 @@ declare enum Blockchain {
717
717
  Optimism_Sepolia = "Optimism_Sepolia",
718
718
  Pharos = "Pharos",
719
719
  Pharos_Testnet = "Pharos_Testnet",
720
+ Plasma = "Plasma",
721
+ Plasma_Testnet = "Plasma_Testnet",
720
722
  Polkadot_Asset_Hub = "Polkadot_Asset_Hub",
721
723
  Polkadot_Westmint = "Polkadot_Westmint",
722
724
  Plume = "Plume",
@@ -2299,7 +2301,7 @@ interface ExecuteParams {
2299
2301
  * fromAddress: '0x...',
2300
2302
  * toAddress: '0x...',
2301
2303
  * amount: '1000000',
2302
- * apiKey: 'KIT_KEY:...',
2304
+ * apiKey: 'TEST_API_KEY:...',
2303
2305
  * })
2304
2306
  *
2305
2307
  * // Build token inputs with permit
@@ -2443,7 +2445,7 @@ interface ExecuteSwapEVMParams extends ActionParameters {
2443
2445
  * fromAddress: 'YubQzu18FDqJRyNfG8JqHmsdbxhnoQqcKUHBdUkN6tP',
2444
2446
  * toAddress: 'YubQzu18FDqJRyNfG8JqHmsdbxhnoQqcKUHBdUkN6tP',
2445
2447
  * amount: '1000000',
2446
- * apiKey: 'KIT_KEY:...',
2448
+ * apiKey: 'TEST_API_KEY:...',
2447
2449
  * })
2448
2450
  *
2449
2451
  * // Prepare action parameters
@@ -3917,6 +3919,49 @@ interface ErrorInfo {
3917
3919
  type?: string;
3918
3920
  }
3919
3921
 
3922
+ /**
3923
+ * Configuration options for the API polling utility.
3924
+ *
3925
+ * @remarks
3926
+ * These settings control the behavior of the API polling process:
3927
+ * - timeout: Maximum time (ms) to wait for each request before aborting
3928
+ * - maxRetries: Maximum number of retry attempts for failed requests
3929
+ * - retryDelay: Base delay (ms); constant wait for `'fixed'` or exponential seed for `'exponential'`
3930
+ * - backoff: Retry-delay strategy, `'fixed'` (default) or `'exponential'`
3931
+ * - maxRetryDelayMs: Optional ceiling (ms) for a single backoff wait
3932
+ * - headers: Optional HTTP headers to include with each request
3933
+ */
3934
+ interface ApiPollingConfig {
3935
+ /** Maximum time in milliseconds to wait for each request */
3936
+ timeout: number;
3937
+ /** Maximum number of retry attempts for failed requests */
3938
+ maxRetries: number;
3939
+ /**
3940
+ * Delay in milliseconds between retry attempts. With the default
3941
+ * `backoff: 'fixed'` strategy this is the constant wait; with
3942
+ * `backoff: 'exponential'` it is the base the exponential backoff grows
3943
+ * from (see {@link pollApiWithValidation}).
3944
+ */
3945
+ retryDelay: number;
3946
+ /**
3947
+ * Retry-delay strategy. `'fixed'` (the default when omitted) waits a
3948
+ * constant `retryDelay` between attempts; `'exponential'` grows the wait
3949
+ * exponentially off `retryDelay` and randomizes it with full jitter, which
3950
+ * spreads out retries so rate-limited (429) bursts do not retry in
3951
+ * lockstep. Opt in per caller; existing callers keep the fixed delay.
3952
+ */
3953
+ backoff?: 'fixed' | 'exponential' | undefined;
3954
+ /**
3955
+ * Optional ceiling, in milliseconds, for a single backoff wait. Only
3956
+ * applies when `backoff` is `'exponential'`: the exponential delay is
3957
+ * capped at this value before jitter is applied. Defaults to
3958
+ * {@link DEFAULT_MAX_RETRY_DELAY_MS} when omitted.
3959
+ */
3960
+ maxRetryDelayMs?: number | undefined;
3961
+ /** Optional HTTP headers to include with requests */
3962
+ headers?: Record<string, string> | undefined;
3963
+ }
3964
+
3920
3965
  /**
3921
3966
  * A type-safe event emitter for managing action-based event subscriptions.
3922
3967
  *
@@ -4663,6 +4708,15 @@ interface SpendOptions {
4663
4708
  * @internal
4664
4709
  */
4665
4710
  onBroadcast?: (txHash: string) => void;
4711
+ /**
4712
+ * Partial polling config forwarded to every Gateway API request the spend
4713
+ * makes (estimate, transfer, forwarder status, and the balance lookups on
4714
+ * the auto-allocation path). The provider factory populates this from its
4715
+ * `headers` config so a configured header reaches all spend-path calls.
4716
+ *
4717
+ * @internal
4718
+ */
4719
+ requestConfig?: Partial<ApiPollingConfig>;
4666
4720
  }
4667
4721
  /**
4668
4722
  * Result returned after a successful spend (mint) operation.
@@ -6494,6 +6548,26 @@ interface UnifiedBalanceKitConfig<TExtraProviders extends FlexibleGatewayProvide
6494
6548
  * @defaultValue false
6495
6549
  */
6496
6550
  excludeDefaultProviders?: boolean;
6551
+ /**
6552
+ * Custom HTTP headers forwarded with every Circle Gateway API request the
6553
+ * default Gateway v1 provider makes (balances, deposits, spend estimate,
6554
+ * transfer, forwarder status, and `/v1/info`).
6555
+ *
6556
+ * @remarks
6557
+ * Headers are merged on top of the SDK defaults (such as `Content-Type`)
6558
+ * rather than replacing them. Each header is forwarded as-is to Circle's
6559
+ * API; the SDK does not interpret it. Only applies to the default provider —
6560
+ * has no effect when `excludeDefaultProviders` is `true` or on custom
6561
+ * providers supplied via `providers`.
6562
+ *
6563
+ * @example
6564
+ * ```typescript
6565
+ * const kit = new UnifiedBalanceKit({
6566
+ * headers: { 'X-Access-Key': process.env.GATEWAY_ACCESS_KEY! },
6567
+ * })
6568
+ * ```
6569
+ */
6570
+ headers?: Record<string, string>;
6497
6571
  }
6498
6572
 
6499
6573
  /**