@circle-fin/app-kit 1.15.2 → 1.15.3

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.
@@ -7490,6 +7490,26 @@ interface VaultQuery {
7490
7490
  /** On-chain vault contract address. */
7491
7491
  readonly vaultAddress: string;
7492
7492
  }
7493
+ /**
7494
+ * Fields shared by both {@link EarnGasFeeEstimate} variants.
7495
+ *
7496
+ * @example
7497
+ * ```typescript
7498
+ * const base: EarnGasFeeEstimateBase = {
7499
+ * name: 'Deposit',
7500
+ * token: 'ETH',
7501
+ * blockchain: 'Arc_Testnet',
7502
+ * }
7503
+ * ```
7504
+ */
7505
+ interface EarnGasFeeEstimateBase {
7506
+ /** The earn step being estimated, e.g. "Approve", "Deposit", "Withdraw". */
7507
+ readonly name: string;
7508
+ /** Native token used to pay gas fees, e.g. "ETH". */
7509
+ readonly token: string;
7510
+ /** Blockchain where this gas fee applies. */
7511
+ readonly blockchain: ChainDefinition['chain'];
7512
+ }
7493
7513
  /**
7494
7514
  * Sort order for a vault discovery query.
7495
7515
  *
@@ -7504,6 +7524,51 @@ interface VaultQuery {
7504
7524
  */
7505
7525
  type ExploreVaultsSortBy = 'apy' | 'tvl' | 'name';
7506
7526
 
7527
+ /**
7528
+ * Estimated gas details for one transaction in a kit-level Earn quote, with
7529
+ * every amount as a decimal string so quote results stay JSON-serializable.
7530
+ *
7531
+ * @example
7532
+ * ```typescript
7533
+ * const gas: EarnEstimatedGas = { gas: '73567', gasPrice: '20003763738', fee: '1471616886913446' }
7534
+ * ```
7535
+ */
7536
+ interface EarnEstimatedGas {
7537
+ /** Estimated gas units as a decimal string, e.g. '73567'. */
7538
+ readonly gas: string;
7539
+ /** Estimated price per gas unit as a decimal string in wei. */
7540
+ readonly gasPrice: string;
7541
+ /** Total estimated fee as a decimal string in wei. */
7542
+ readonly fee: string;
7543
+ }
7544
+ /**
7545
+ * Estimated native gas fee for one transaction in an Earn quote.
7546
+ *
7547
+ * A discriminated union on `fees`: a successful estimate carries
7548
+ * {@link EarnEstimatedGas} details and no `error`; a failed estimate carries
7549
+ * `fees: null` and a sanitized `error` message.
7550
+ *
7551
+ * @example
7552
+ * ```typescript
7553
+ * function describe(entry: EarnGasFeeEstimate): string {
7554
+ * if (entry.fees === null) {
7555
+ * return `${entry.name}: estimation failed (${entry.error})`
7556
+ * }
7557
+ * return `${entry.name}: ${entry.fees.fee} wei`
7558
+ * }
7559
+ * ```
7560
+ */
7561
+ type EarnGasFeeEstimate = (EarnGasFeeEstimateBase & {
7562
+ /** Estimated gas details with amounts formatted as decimal strings. */
7563
+ readonly fees: EarnEstimatedGas;
7564
+ /** Never present on a successful estimate. */
7565
+ readonly error?: never;
7566
+ }) | (EarnGasFeeEstimateBase & {
7567
+ /** Null because estimation failed. */
7568
+ readonly fees: null;
7569
+ /** Sanitized estimation error message. */
7570
+ readonly error: string;
7571
+ });
7507
7572
  /**
7508
7573
  * Adapter context for earn operations, constrained to earn-supported chains.
7509
7574
  *
@@ -7687,6 +7752,12 @@ interface SameChainDepositParams<TFromAdapterCapabilities extends AdapterCapabil
7687
7752
  * @example '100.50' for 100.50 USDC
7688
7753
  */
7689
7754
  readonly amount: string;
7755
+ /**
7756
+ * Gas fee estimates from a prior {@link getDepositQuote} call. When provided,
7757
+ * the pre-broadcast gas reserve check uses the actual estimated cost instead
7758
+ * of the conservative fallback reserve.
7759
+ */
7760
+ readonly gasFees?: readonly EarnGasFeeEstimate[] | undefined;
7690
7761
  /** Optional earn configuration. */
7691
7762
  readonly config?: EarnConfig | undefined;
7692
7763
  }
@@ -7490,6 +7490,26 @@ interface VaultQuery {
7490
7490
  /** On-chain vault contract address. */
7491
7491
  readonly vaultAddress: string;
7492
7492
  }
7493
+ /**
7494
+ * Fields shared by both {@link EarnGasFeeEstimate} variants.
7495
+ *
7496
+ * @example
7497
+ * ```typescript
7498
+ * const base: EarnGasFeeEstimateBase = {
7499
+ * name: 'Deposit',
7500
+ * token: 'ETH',
7501
+ * blockchain: 'Arc_Testnet',
7502
+ * }
7503
+ * ```
7504
+ */
7505
+ interface EarnGasFeeEstimateBase {
7506
+ /** The earn step being estimated, e.g. "Approve", "Deposit", "Withdraw". */
7507
+ readonly name: string;
7508
+ /** Native token used to pay gas fees, e.g. "ETH". */
7509
+ readonly token: string;
7510
+ /** Blockchain where this gas fee applies. */
7511
+ readonly blockchain: ChainDefinition['chain'];
7512
+ }
7493
7513
  /**
7494
7514
  * Sort order for a vault discovery query.
7495
7515
  *
@@ -7504,6 +7524,51 @@ interface VaultQuery {
7504
7524
  */
7505
7525
  type ExploreVaultsSortBy = 'apy' | 'tvl' | 'name';
7506
7526
 
7527
+ /**
7528
+ * Estimated gas details for one transaction in a kit-level Earn quote, with
7529
+ * every amount as a decimal string so quote results stay JSON-serializable.
7530
+ *
7531
+ * @example
7532
+ * ```typescript
7533
+ * const gas: EarnEstimatedGas = { gas: '73567', gasPrice: '20003763738', fee: '1471616886913446' }
7534
+ * ```
7535
+ */
7536
+ interface EarnEstimatedGas {
7537
+ /** Estimated gas units as a decimal string, e.g. '73567'. */
7538
+ readonly gas: string;
7539
+ /** Estimated price per gas unit as a decimal string in wei. */
7540
+ readonly gasPrice: string;
7541
+ /** Total estimated fee as a decimal string in wei. */
7542
+ readonly fee: string;
7543
+ }
7544
+ /**
7545
+ * Estimated native gas fee for one transaction in an Earn quote.
7546
+ *
7547
+ * A discriminated union on `fees`: a successful estimate carries
7548
+ * {@link EarnEstimatedGas} details and no `error`; a failed estimate carries
7549
+ * `fees: null` and a sanitized `error` message.
7550
+ *
7551
+ * @example
7552
+ * ```typescript
7553
+ * function describe(entry: EarnGasFeeEstimate): string {
7554
+ * if (entry.fees === null) {
7555
+ * return `${entry.name}: estimation failed (${entry.error})`
7556
+ * }
7557
+ * return `${entry.name}: ${entry.fees.fee} wei`
7558
+ * }
7559
+ * ```
7560
+ */
7561
+ type EarnGasFeeEstimate = (EarnGasFeeEstimateBase & {
7562
+ /** Estimated gas details with amounts formatted as decimal strings. */
7563
+ readonly fees: EarnEstimatedGas;
7564
+ /** Never present on a successful estimate. */
7565
+ readonly error?: never;
7566
+ }) | (EarnGasFeeEstimateBase & {
7567
+ /** Null because estimation failed. */
7568
+ readonly fees: null;
7569
+ /** Sanitized estimation error message. */
7570
+ readonly error: string;
7571
+ });
7507
7572
  /**
7508
7573
  * Adapter context for earn operations, constrained to earn-supported chains.
7509
7574
  *
@@ -7687,6 +7752,12 @@ interface SameChainDepositParams<TFromAdapterCapabilities extends AdapterCapabil
7687
7752
  * @example '100.50' for 100.50 USDC
7688
7753
  */
7689
7754
  readonly amount: string;
7755
+ /**
7756
+ * Gas fee estimates from a prior {@link getDepositQuote} call. When provided,
7757
+ * the pre-broadcast gas reserve check uses the actual estimated cost instead
7758
+ * of the conservative fallback reserve.
7759
+ */
7760
+ readonly gasFees?: readonly EarnGasFeeEstimate[] | undefined;
7690
7761
  /** Optional earn configuration. */
7691
7762
  readonly config?: EarnConfig | undefined;
7692
7763
  }
@@ -7490,6 +7490,26 @@ interface VaultQuery {
7490
7490
  /** On-chain vault contract address. */
7491
7491
  readonly vaultAddress: string;
7492
7492
  }
7493
+ /**
7494
+ * Fields shared by both {@link EarnGasFeeEstimate} variants.
7495
+ *
7496
+ * @example
7497
+ * ```typescript
7498
+ * const base: EarnGasFeeEstimateBase = {
7499
+ * name: 'Deposit',
7500
+ * token: 'ETH',
7501
+ * blockchain: 'Arc_Testnet',
7502
+ * }
7503
+ * ```
7504
+ */
7505
+ interface EarnGasFeeEstimateBase {
7506
+ /** The earn step being estimated, e.g. "Approve", "Deposit", "Withdraw". */
7507
+ readonly name: string;
7508
+ /** Native token used to pay gas fees, e.g. "ETH". */
7509
+ readonly token: string;
7510
+ /** Blockchain where this gas fee applies. */
7511
+ readonly blockchain: ChainDefinition['chain'];
7512
+ }
7493
7513
  /**
7494
7514
  * Sort order for a vault discovery query.
7495
7515
  *
@@ -7504,6 +7524,51 @@ interface VaultQuery {
7504
7524
  */
7505
7525
  type ExploreVaultsSortBy = 'apy' | 'tvl' | 'name';
7506
7526
 
7527
+ /**
7528
+ * Estimated gas details for one transaction in a kit-level Earn quote, with
7529
+ * every amount as a decimal string so quote results stay JSON-serializable.
7530
+ *
7531
+ * @example
7532
+ * ```typescript
7533
+ * const gas: EarnEstimatedGas = { gas: '73567', gasPrice: '20003763738', fee: '1471616886913446' }
7534
+ * ```
7535
+ */
7536
+ interface EarnEstimatedGas {
7537
+ /** Estimated gas units as a decimal string, e.g. '73567'. */
7538
+ readonly gas: string;
7539
+ /** Estimated price per gas unit as a decimal string in wei. */
7540
+ readonly gasPrice: string;
7541
+ /** Total estimated fee as a decimal string in wei. */
7542
+ readonly fee: string;
7543
+ }
7544
+ /**
7545
+ * Estimated native gas fee for one transaction in an Earn quote.
7546
+ *
7547
+ * A discriminated union on `fees`: a successful estimate carries
7548
+ * {@link EarnEstimatedGas} details and no `error`; a failed estimate carries
7549
+ * `fees: null` and a sanitized `error` message.
7550
+ *
7551
+ * @example
7552
+ * ```typescript
7553
+ * function describe(entry: EarnGasFeeEstimate): string {
7554
+ * if (entry.fees === null) {
7555
+ * return `${entry.name}: estimation failed (${entry.error})`
7556
+ * }
7557
+ * return `${entry.name}: ${entry.fees.fee} wei`
7558
+ * }
7559
+ * ```
7560
+ */
7561
+ type EarnGasFeeEstimate = (EarnGasFeeEstimateBase & {
7562
+ /** Estimated gas details with amounts formatted as decimal strings. */
7563
+ readonly fees: EarnEstimatedGas;
7564
+ /** Never present on a successful estimate. */
7565
+ readonly error?: never;
7566
+ }) | (EarnGasFeeEstimateBase & {
7567
+ /** Null because estimation failed. */
7568
+ readonly fees: null;
7569
+ /** Sanitized estimation error message. */
7570
+ readonly error: string;
7571
+ });
7507
7572
  /**
7508
7573
  * Adapter context for earn operations, constrained to earn-supported chains.
7509
7574
  *
@@ -7687,6 +7752,12 @@ interface SameChainDepositParams<TFromAdapterCapabilities extends AdapterCapabil
7687
7752
  * @example '100.50' for 100.50 USDC
7688
7753
  */
7689
7754
  readonly amount: string;
7755
+ /**
7756
+ * Gas fee estimates from a prior {@link getDepositQuote} call. When provided,
7757
+ * the pre-broadcast gas reserve check uses the actual estimated cost instead
7758
+ * of the conservative fallback reserve.
7759
+ */
7760
+ readonly gasFees?: readonly EarnGasFeeEstimate[] | undefined;
7690
7761
  /** Optional earn configuration. */
7691
7762
  readonly config?: EarnConfig | undefined;
7692
7763
  }
@@ -29499,7 +29499,7 @@ new Set(Object.values(Blockchain));
29499
29499
  registerKit(`${pkg$1.name}/${pkg$1.version}`);
29500
29500
 
29501
29501
  var name = "@circle-fin/earn-kit";
29502
- var version = "1.7.0";
29502
+ var version = "1.8.0";
29503
29503
  var pkg = {
29504
29504
  name: name,
29505
29505
  version: version};
@@ -29641,10 +29641,8 @@ const bridgeFeeTokenSchema = hexAddressSchema;
29641
29641
  assetAddress: z.string(),
29642
29642
  lltv: z.number(),
29643
29643
  supplyUsd: z.number(),
29644
- // Optional during the expand/contract window (a backend that predates the
29645
- // field omits the key), mirroring the `.optional()` facets on the base
29646
- // schema; `null` when the product exposes no per-market allocation (V2).
29647
- allocationPct: z.number().nullable().optional()
29644
+ // `null` when the product exposes no per-market allocation (V2).
29645
+ allocationPct: z.number().nullable()
29648
29646
  });
29649
29647
  /**
29650
29648
  * Zod schema for a Morpho vault warning in the API response.
@@ -29751,19 +29749,20 @@ const bridgeFeeTokenSchema = hexAddressSchema;
29751
29749
  earnKitWarnings: z.array(z.string()).optional()
29752
29750
  });
29753
29751
  /**
29754
- * Shared base schema: existing flat fields (kept) plus the new nested
29755
- * facets and neutral identity. Facets are `.optional()` during the
29756
- * transition; flip to required once the backend is confirmed emitting.
29752
+ * Shared base schema: existing flat fields (kept as deprecated aliases) plus
29753
+ * the nested facets. Zenith emits all facets on every response; required here
29754
+ * so a partial emission is caught at parse time rather than surfacing as a
29755
+ * runtime `undefined` access.
29757
29756
  *
29758
29757
  * @internal
29759
29758
  */ const earnBaseSchema = vaultInfoResponseSchema.extend({
29760
- address: z.string().optional(),
29761
- asOf: z.string().optional(),
29762
- manager: managerSchema.nullable().optional(),
29763
- apyProfile: apyProfileSchema.optional(),
29764
- fee: feeInfoSchema.optional(),
29765
- liquidityProfile: liquidityProfileSchema.optional(),
29766
- riskSignals: riskSignalsSchema.optional()
29759
+ address: z.string(),
29760
+ asOf: z.string(),
29761
+ manager: managerSchema.nullable(),
29762
+ apyProfile: apyProfileSchema,
29763
+ fee: feeInfoSchema,
29764
+ liquidityProfile: liquidityProfileSchema,
29765
+ riskSignals: riskSignalsSchema
29767
29766
  });
29768
29767
  /**
29769
29768
  * Zod schema for the `vault` opportunity variant.
@@ -30733,6 +30732,49 @@ const sourceAdapterContextSchema = z.object({
30733
30732
  vaultAddress: vaultAddressSchema,
30734
30733
  config: earnConfigSchema.optional()
30735
30734
  });
30735
+ /**
30736
+ * Schema for a successful gas fee entry (fees is non-null).
30737
+ *
30738
+ * Validates the kit shape — {@link EarnEstimatedGas} uses decimal strings for
30739
+ * `gas`, `gasPrice`, and `fee`. Only digits are accepted so that the deposit
30740
+ * operation can safely convert them to `bigint` before passing them to the
30741
+ * provider's `computeGasReserve`.
30742
+ *
30743
+ * @internal
30744
+ */ const earnGasFeeEstimateSuccessSchema = z.object({
30745
+ name: z.string(),
30746
+ token: z.string(),
30747
+ blockchain: z.string(),
30748
+ fees: z.object({
30749
+ gas: z.string().regex(/^\d+$/, 'gas must be a non-negative integer string'),
30750
+ gasPrice: z.string().regex(/^\d+$/, 'gasPrice must be a non-negative integer string'),
30751
+ fee: z.string().regex(/^\d+$/, 'fee must be a non-negative integer string')
30752
+ }),
30753
+ error: z.undefined().optional()
30754
+ }).strict();
30755
+ /**
30756
+ * Schema for a failed gas fee entry (fees is null, error is a string).
30757
+ *
30758
+ * @internal
30759
+ */ const earnGasFeeEstimateFailureSchema = z.object({
30760
+ name: z.string(),
30761
+ token: z.string(),
30762
+ blockchain: z.string(),
30763
+ fees: z.null(),
30764
+ error: z.string()
30765
+ }).strict();
30766
+ /**
30767
+ * Schema for a single kit-level gas fee estimate entry.
30768
+ *
30769
+ * Rejects arbitrary inputs (null, numbers, empty objects, non-numeric fee
30770
+ * strings) so callers receive a descriptive validation error instead of a
30771
+ * raw `BigInt` conversion error inside `computeGasReserve`.
30772
+ *
30773
+ * @internal
30774
+ */ const earnGasFeeEstimateSchema = z.union([
30775
+ earnGasFeeEstimateSuccessSchema,
30776
+ earnGasFeeEstimateFailureSchema
30777
+ ]);
30736
30778
  /**
30737
30779
  * Validation schema for the same-chain variant of DepositParams.
30738
30780
  *
@@ -30745,6 +30787,7 @@ const sourceAdapterContextSchema = z.object({
30745
30787
  to: z.undefined().optional(),
30746
30788
  vaultAddress: vaultAddressSchema,
30747
30789
  amount: amountSchema,
30790
+ gasFees: z.array(earnGasFeeEstimateSchema).optional(),
30748
30791
  config: earnConfigSchema.optional()
30749
30792
  }).strict();
30750
30793
  const crossChainDepositDestinationSchema = z.object({
package/estimateSwap.cjs CHANGED
@@ -22576,7 +22576,7 @@ registerKit(`${pkg$1.name}/${pkg$1.version}`);
22576
22576
  };
22577
22577
 
22578
22578
  var name = "@circle-fin/earn-kit";
22579
- var version = "1.7.0";
22579
+ var version = "1.8.0";
22580
22580
  var pkg = {
22581
22581
  name: name,
22582
22582
  version: version};
@@ -22718,10 +22718,8 @@ const bridgeFeeTokenSchema = hexAddressSchema;
22718
22718
  assetAddress: zod.z.string(),
22719
22719
  lltv: zod.z.number(),
22720
22720
  supplyUsd: zod.z.number(),
22721
- // Optional during the expand/contract window (a backend that predates the
22722
- // field omits the key), mirroring the `.optional()` facets on the base
22723
- // schema; `null` when the product exposes no per-market allocation (V2).
22724
- allocationPct: zod.z.number().nullable().optional()
22721
+ // `null` when the product exposes no per-market allocation (V2).
22722
+ allocationPct: zod.z.number().nullable()
22725
22723
  });
22726
22724
  /**
22727
22725
  * Zod schema for a Morpho vault warning in the API response.
@@ -22828,19 +22826,20 @@ const bridgeFeeTokenSchema = hexAddressSchema;
22828
22826
  earnKitWarnings: zod.z.array(zod.z.string()).optional()
22829
22827
  });
22830
22828
  /**
22831
- * Shared base schema: existing flat fields (kept) plus the new nested
22832
- * facets and neutral identity. Facets are `.optional()` during the
22833
- * transition; flip to required once the backend is confirmed emitting.
22829
+ * Shared base schema: existing flat fields (kept as deprecated aliases) plus
22830
+ * the nested facets. Zenith emits all facets on every response; required here
22831
+ * so a partial emission is caught at parse time rather than surfacing as a
22832
+ * runtime `undefined` access.
22834
22833
  *
22835
22834
  * @internal
22836
22835
  */ const earnBaseSchema = vaultInfoResponseSchema.extend({
22837
- address: zod.z.string().optional(),
22838
- asOf: zod.z.string().optional(),
22839
- manager: managerSchema.nullable().optional(),
22840
- apyProfile: apyProfileSchema.optional(),
22841
- fee: feeInfoSchema.optional(),
22842
- liquidityProfile: liquidityProfileSchema.optional(),
22843
- riskSignals: riskSignalsSchema.optional()
22836
+ address: zod.z.string(),
22837
+ asOf: zod.z.string(),
22838
+ manager: managerSchema.nullable(),
22839
+ apyProfile: apyProfileSchema,
22840
+ fee: feeInfoSchema,
22841
+ liquidityProfile: liquidityProfileSchema,
22842
+ riskSignals: riskSignalsSchema
22844
22843
  });
22845
22844
  /**
22846
22845
  * Zod schema for the `vault` opportunity variant.
@@ -23810,6 +23809,49 @@ const sourceAdapterContextSchema = zod.z.object({
23810
23809
  vaultAddress: vaultAddressSchema,
23811
23810
  config: earnConfigSchema.optional()
23812
23811
  });
23812
+ /**
23813
+ * Schema for a successful gas fee entry (fees is non-null).
23814
+ *
23815
+ * Validates the kit shape — {@link EarnEstimatedGas} uses decimal strings for
23816
+ * `gas`, `gasPrice`, and `fee`. Only digits are accepted so that the deposit
23817
+ * operation can safely convert them to `bigint` before passing them to the
23818
+ * provider's `computeGasReserve`.
23819
+ *
23820
+ * @internal
23821
+ */ const earnGasFeeEstimateSuccessSchema = zod.z.object({
23822
+ name: zod.z.string(),
23823
+ token: zod.z.string(),
23824
+ blockchain: zod.z.string(),
23825
+ fees: zod.z.object({
23826
+ gas: zod.z.string().regex(/^\d+$/, 'gas must be a non-negative integer string'),
23827
+ gasPrice: zod.z.string().regex(/^\d+$/, 'gasPrice must be a non-negative integer string'),
23828
+ fee: zod.z.string().regex(/^\d+$/, 'fee must be a non-negative integer string')
23829
+ }),
23830
+ error: zod.z.undefined().optional()
23831
+ }).strict();
23832
+ /**
23833
+ * Schema for a failed gas fee entry (fees is null, error is a string).
23834
+ *
23835
+ * @internal
23836
+ */ const earnGasFeeEstimateFailureSchema = zod.z.object({
23837
+ name: zod.z.string(),
23838
+ token: zod.z.string(),
23839
+ blockchain: zod.z.string(),
23840
+ fees: zod.z.null(),
23841
+ error: zod.z.string()
23842
+ }).strict();
23843
+ /**
23844
+ * Schema for a single kit-level gas fee estimate entry.
23845
+ *
23846
+ * Rejects arbitrary inputs (null, numbers, empty objects, non-numeric fee
23847
+ * strings) so callers receive a descriptive validation error instead of a
23848
+ * raw `BigInt` conversion error inside `computeGasReserve`.
23849
+ *
23850
+ * @internal
23851
+ */ const earnGasFeeEstimateSchema = zod.z.union([
23852
+ earnGasFeeEstimateSuccessSchema,
23853
+ earnGasFeeEstimateFailureSchema
23854
+ ]);
23813
23855
  /**
23814
23856
  * Validation schema for the same-chain variant of DepositParams.
23815
23857
  *
@@ -23822,6 +23864,7 @@ const sourceAdapterContextSchema = zod.z.object({
23822
23864
  to: zod.z.undefined().optional(),
23823
23865
  vaultAddress: vaultAddressSchema,
23824
23866
  amount: amountSchema,
23867
+ gasFees: zod.z.array(earnGasFeeEstimateSchema).optional(),
23825
23868
  config: earnConfigSchema.optional()
23826
23869
  }).strict();
23827
23870
  const crossChainDepositDestinationSchema = zod.z.object({
@@ -7431,6 +7431,26 @@ interface VaultQuery {
7431
7431
  /** On-chain vault contract address. */
7432
7432
  readonly vaultAddress: string;
7433
7433
  }
7434
+ /**
7435
+ * Fields shared by both {@link EarnGasFeeEstimate} variants.
7436
+ *
7437
+ * @example
7438
+ * ```typescript
7439
+ * const base: EarnGasFeeEstimateBase = {
7440
+ * name: 'Deposit',
7441
+ * token: 'ETH',
7442
+ * blockchain: 'Arc_Testnet',
7443
+ * }
7444
+ * ```
7445
+ */
7446
+ interface EarnGasFeeEstimateBase {
7447
+ /** The earn step being estimated, e.g. "Approve", "Deposit", "Withdraw". */
7448
+ readonly name: string;
7449
+ /** Native token used to pay gas fees, e.g. "ETH". */
7450
+ readonly token: string;
7451
+ /** Blockchain where this gas fee applies. */
7452
+ readonly blockchain: ChainDefinition['chain'];
7453
+ }
7434
7454
  /**
7435
7455
  * Sort order for a vault discovery query.
7436
7456
  *
@@ -7445,6 +7465,51 @@ interface VaultQuery {
7445
7465
  */
7446
7466
  type ExploreVaultsSortBy = 'apy' | 'tvl' | 'name';
7447
7467
 
7468
+ /**
7469
+ * Estimated gas details for one transaction in a kit-level Earn quote, with
7470
+ * every amount as a decimal string so quote results stay JSON-serializable.
7471
+ *
7472
+ * @example
7473
+ * ```typescript
7474
+ * const gas: EarnEstimatedGas = { gas: '73567', gasPrice: '20003763738', fee: '1471616886913446' }
7475
+ * ```
7476
+ */
7477
+ interface EarnEstimatedGas {
7478
+ /** Estimated gas units as a decimal string, e.g. '73567'. */
7479
+ readonly gas: string;
7480
+ /** Estimated price per gas unit as a decimal string in wei. */
7481
+ readonly gasPrice: string;
7482
+ /** Total estimated fee as a decimal string in wei. */
7483
+ readonly fee: string;
7484
+ }
7485
+ /**
7486
+ * Estimated native gas fee for one transaction in an Earn quote.
7487
+ *
7488
+ * A discriminated union on `fees`: a successful estimate carries
7489
+ * {@link EarnEstimatedGas} details and no `error`; a failed estimate carries
7490
+ * `fees: null` and a sanitized `error` message.
7491
+ *
7492
+ * @example
7493
+ * ```typescript
7494
+ * function describe(entry: EarnGasFeeEstimate): string {
7495
+ * if (entry.fees === null) {
7496
+ * return `${entry.name}: estimation failed (${entry.error})`
7497
+ * }
7498
+ * return `${entry.name}: ${entry.fees.fee} wei`
7499
+ * }
7500
+ * ```
7501
+ */
7502
+ type EarnGasFeeEstimate = (EarnGasFeeEstimateBase & {
7503
+ /** Estimated gas details with amounts formatted as decimal strings. */
7504
+ readonly fees: EarnEstimatedGas;
7505
+ /** Never present on a successful estimate. */
7506
+ readonly error?: never;
7507
+ }) | (EarnGasFeeEstimateBase & {
7508
+ /** Null because estimation failed. */
7509
+ readonly fees: null;
7510
+ /** Sanitized estimation error message. */
7511
+ readonly error: string;
7512
+ });
7448
7513
  /**
7449
7514
  * Adapter context for earn operations, constrained to earn-supported chains.
7450
7515
  *
@@ -7628,6 +7693,12 @@ interface SameChainDepositParams<TFromAdapterCapabilities extends AdapterCapabil
7628
7693
  * @example '100.50' for 100.50 USDC
7629
7694
  */
7630
7695
  readonly amount: string;
7696
+ /**
7697
+ * Gas fee estimates from a prior {@link getDepositQuote} call. When provided,
7698
+ * the pre-broadcast gas reserve check uses the actual estimated cost instead
7699
+ * of the conservative fallback reserve.
7700
+ */
7701
+ readonly gasFees?: readonly EarnGasFeeEstimate[] | undefined;
7631
7702
  /** Optional earn configuration. */
7632
7703
  readonly config?: EarnConfig | undefined;
7633
7704
  }
@@ -7431,6 +7431,26 @@ interface VaultQuery {
7431
7431
  /** On-chain vault contract address. */
7432
7432
  readonly vaultAddress: string;
7433
7433
  }
7434
+ /**
7435
+ * Fields shared by both {@link EarnGasFeeEstimate} variants.
7436
+ *
7437
+ * @example
7438
+ * ```typescript
7439
+ * const base: EarnGasFeeEstimateBase = {
7440
+ * name: 'Deposit',
7441
+ * token: 'ETH',
7442
+ * blockchain: 'Arc_Testnet',
7443
+ * }
7444
+ * ```
7445
+ */
7446
+ interface EarnGasFeeEstimateBase {
7447
+ /** The earn step being estimated, e.g. "Approve", "Deposit", "Withdraw". */
7448
+ readonly name: string;
7449
+ /** Native token used to pay gas fees, e.g. "ETH". */
7450
+ readonly token: string;
7451
+ /** Blockchain where this gas fee applies. */
7452
+ readonly blockchain: ChainDefinition['chain'];
7453
+ }
7434
7454
  /**
7435
7455
  * Sort order for a vault discovery query.
7436
7456
  *
@@ -7445,6 +7465,51 @@ interface VaultQuery {
7445
7465
  */
7446
7466
  type ExploreVaultsSortBy = 'apy' | 'tvl' | 'name';
7447
7467
 
7468
+ /**
7469
+ * Estimated gas details for one transaction in a kit-level Earn quote, with
7470
+ * every amount as a decimal string so quote results stay JSON-serializable.
7471
+ *
7472
+ * @example
7473
+ * ```typescript
7474
+ * const gas: EarnEstimatedGas = { gas: '73567', gasPrice: '20003763738', fee: '1471616886913446' }
7475
+ * ```
7476
+ */
7477
+ interface EarnEstimatedGas {
7478
+ /** Estimated gas units as a decimal string, e.g. '73567'. */
7479
+ readonly gas: string;
7480
+ /** Estimated price per gas unit as a decimal string in wei. */
7481
+ readonly gasPrice: string;
7482
+ /** Total estimated fee as a decimal string in wei. */
7483
+ readonly fee: string;
7484
+ }
7485
+ /**
7486
+ * Estimated native gas fee for one transaction in an Earn quote.
7487
+ *
7488
+ * A discriminated union on `fees`: a successful estimate carries
7489
+ * {@link EarnEstimatedGas} details and no `error`; a failed estimate carries
7490
+ * `fees: null` and a sanitized `error` message.
7491
+ *
7492
+ * @example
7493
+ * ```typescript
7494
+ * function describe(entry: EarnGasFeeEstimate): string {
7495
+ * if (entry.fees === null) {
7496
+ * return `${entry.name}: estimation failed (${entry.error})`
7497
+ * }
7498
+ * return `${entry.name}: ${entry.fees.fee} wei`
7499
+ * }
7500
+ * ```
7501
+ */
7502
+ type EarnGasFeeEstimate = (EarnGasFeeEstimateBase & {
7503
+ /** Estimated gas details with amounts formatted as decimal strings. */
7504
+ readonly fees: EarnEstimatedGas;
7505
+ /** Never present on a successful estimate. */
7506
+ readonly error?: never;
7507
+ }) | (EarnGasFeeEstimateBase & {
7508
+ /** Null because estimation failed. */
7509
+ readonly fees: null;
7510
+ /** Sanitized estimation error message. */
7511
+ readonly error: string;
7512
+ });
7448
7513
  /**
7449
7514
  * Adapter context for earn operations, constrained to earn-supported chains.
7450
7515
  *
@@ -7628,6 +7693,12 @@ interface SameChainDepositParams<TFromAdapterCapabilities extends AdapterCapabil
7628
7693
  * @example '100.50' for 100.50 USDC
7629
7694
  */
7630
7695
  readonly amount: string;
7696
+ /**
7697
+ * Gas fee estimates from a prior {@link getDepositQuote} call. When provided,
7698
+ * the pre-broadcast gas reserve check uses the actual estimated cost instead
7699
+ * of the conservative fallback reserve.
7700
+ */
7701
+ readonly gasFees?: readonly EarnGasFeeEstimate[] | undefined;
7631
7702
  /** Optional earn configuration. */
7632
7703
  readonly config?: EarnConfig | undefined;
7633
7704
  }