@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.
- package/CHANGELOG.md +6 -0
- package/bridge.cjs +58 -15
- package/bridge.d.cts +71 -0
- package/bridge.d.mts +71 -0
- package/bridge.d.ts +71 -0
- package/bridge.mjs +58 -15
- package/context.d.cts +71 -0
- package/context.d.mts +71 -0
- package/context.d.ts +71 -0
- package/earn.cjs +382 -42
- package/earn.d.cts +19 -26
- package/earn.d.mts +19 -26
- package/earn.d.ts +19 -26
- package/earn.mjs +382 -42
- package/estimateBridge.cjs +58 -15
- package/estimateBridge.d.cts +71 -0
- package/estimateBridge.d.mts +71 -0
- package/estimateBridge.d.ts +71 -0
- package/estimateBridge.mjs +58 -15
- package/estimateSwap.cjs +58 -15
- package/estimateSwap.d.cts +71 -0
- package/estimateSwap.d.mts +71 -0
- package/estimateSwap.d.ts +71 -0
- package/estimateSwap.mjs +58 -15
- package/index.cjs +288 -60
- package/index.d.cts +184 -91
- package/index.d.mts +184 -91
- package/index.d.ts +184 -91
- package/index.mjs +288 -60
- package/package.json +3 -3
- package/server.cjs +13 -17
- package/server.d.cts +10 -9
- package/server.d.mts +10 -9
- package/server.d.ts +10 -9
- package/server.mjs +13 -17
- package/swap.cjs +58 -15
- package/swap.d.cts +71 -0
- package/swap.d.mts +71 -0
- package/swap.d.ts +71 -0
- package/swap.mjs +58 -15
package/estimateSwap.d.ts
CHANGED
|
@@ -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
|
}
|
package/estimateSwap.mjs
CHANGED
|
@@ -22569,7 +22569,7 @@ registerKit(`${pkg$1.name}/${pkg$1.version}`);
|
|
|
22569
22569
|
};
|
|
22570
22570
|
|
|
22571
22571
|
var name = "@circle-fin/earn-kit";
|
|
22572
|
-
var version = "1.
|
|
22572
|
+
var version = "1.8.0";
|
|
22573
22573
|
var pkg = {
|
|
22574
22574
|
name: name,
|
|
22575
22575
|
version: version};
|
|
@@ -22711,10 +22711,8 @@ const bridgeFeeTokenSchema = hexAddressSchema;
|
|
|
22711
22711
|
assetAddress: z.string(),
|
|
22712
22712
|
lltv: z.number(),
|
|
22713
22713
|
supplyUsd: z.number(),
|
|
22714
|
-
//
|
|
22715
|
-
|
|
22716
|
-
// schema; `null` when the product exposes no per-market allocation (V2).
|
|
22717
|
-
allocationPct: z.number().nullable().optional()
|
|
22714
|
+
// `null` when the product exposes no per-market allocation (V2).
|
|
22715
|
+
allocationPct: z.number().nullable()
|
|
22718
22716
|
});
|
|
22719
22717
|
/**
|
|
22720
22718
|
* Zod schema for a Morpho vault warning in the API response.
|
|
@@ -22821,19 +22819,20 @@ const bridgeFeeTokenSchema = hexAddressSchema;
|
|
|
22821
22819
|
earnKitWarnings: z.array(z.string()).optional()
|
|
22822
22820
|
});
|
|
22823
22821
|
/**
|
|
22824
|
-
* Shared base schema: existing flat fields (kept
|
|
22825
|
-
* facets
|
|
22826
|
-
*
|
|
22822
|
+
* Shared base schema: existing flat fields (kept as deprecated aliases) plus
|
|
22823
|
+
* the nested facets. Zenith emits all facets on every response; required here
|
|
22824
|
+
* so a partial emission is caught at parse time rather than surfacing as a
|
|
22825
|
+
* runtime `undefined` access.
|
|
22827
22826
|
*
|
|
22828
22827
|
* @internal
|
|
22829
22828
|
*/ const earnBaseSchema = vaultInfoResponseSchema.extend({
|
|
22830
|
-
address: z.string()
|
|
22831
|
-
asOf: z.string()
|
|
22832
|
-
manager: managerSchema.nullable()
|
|
22833
|
-
apyProfile: apyProfileSchema
|
|
22834
|
-
fee: feeInfoSchema
|
|
22835
|
-
liquidityProfile: liquidityProfileSchema
|
|
22836
|
-
riskSignals: riskSignalsSchema
|
|
22829
|
+
address: z.string(),
|
|
22830
|
+
asOf: z.string(),
|
|
22831
|
+
manager: managerSchema.nullable(),
|
|
22832
|
+
apyProfile: apyProfileSchema,
|
|
22833
|
+
fee: feeInfoSchema,
|
|
22834
|
+
liquidityProfile: liquidityProfileSchema,
|
|
22835
|
+
riskSignals: riskSignalsSchema
|
|
22837
22836
|
});
|
|
22838
22837
|
/**
|
|
22839
22838
|
* Zod schema for the `vault` opportunity variant.
|
|
@@ -23803,6 +23802,49 @@ const sourceAdapterContextSchema = z.object({
|
|
|
23803
23802
|
vaultAddress: vaultAddressSchema,
|
|
23804
23803
|
config: earnConfigSchema.optional()
|
|
23805
23804
|
});
|
|
23805
|
+
/**
|
|
23806
|
+
* Schema for a successful gas fee entry (fees is non-null).
|
|
23807
|
+
*
|
|
23808
|
+
* Validates the kit shape — {@link EarnEstimatedGas} uses decimal strings for
|
|
23809
|
+
* `gas`, `gasPrice`, and `fee`. Only digits are accepted so that the deposit
|
|
23810
|
+
* operation can safely convert them to `bigint` before passing them to the
|
|
23811
|
+
* provider's `computeGasReserve`.
|
|
23812
|
+
*
|
|
23813
|
+
* @internal
|
|
23814
|
+
*/ const earnGasFeeEstimateSuccessSchema = z.object({
|
|
23815
|
+
name: z.string(),
|
|
23816
|
+
token: z.string(),
|
|
23817
|
+
blockchain: z.string(),
|
|
23818
|
+
fees: z.object({
|
|
23819
|
+
gas: z.string().regex(/^\d+$/, 'gas must be a non-negative integer string'),
|
|
23820
|
+
gasPrice: z.string().regex(/^\d+$/, 'gasPrice must be a non-negative integer string'),
|
|
23821
|
+
fee: z.string().regex(/^\d+$/, 'fee must be a non-negative integer string')
|
|
23822
|
+
}),
|
|
23823
|
+
error: z.undefined().optional()
|
|
23824
|
+
}).strict();
|
|
23825
|
+
/**
|
|
23826
|
+
* Schema for a failed gas fee entry (fees is null, error is a string).
|
|
23827
|
+
*
|
|
23828
|
+
* @internal
|
|
23829
|
+
*/ const earnGasFeeEstimateFailureSchema = z.object({
|
|
23830
|
+
name: z.string(),
|
|
23831
|
+
token: z.string(),
|
|
23832
|
+
blockchain: z.string(),
|
|
23833
|
+
fees: z.null(),
|
|
23834
|
+
error: z.string()
|
|
23835
|
+
}).strict();
|
|
23836
|
+
/**
|
|
23837
|
+
* Schema for a single kit-level gas fee estimate entry.
|
|
23838
|
+
*
|
|
23839
|
+
* Rejects arbitrary inputs (null, numbers, empty objects, non-numeric fee
|
|
23840
|
+
* strings) so callers receive a descriptive validation error instead of a
|
|
23841
|
+
* raw `BigInt` conversion error inside `computeGasReserve`.
|
|
23842
|
+
*
|
|
23843
|
+
* @internal
|
|
23844
|
+
*/ const earnGasFeeEstimateSchema = z.union([
|
|
23845
|
+
earnGasFeeEstimateSuccessSchema,
|
|
23846
|
+
earnGasFeeEstimateFailureSchema
|
|
23847
|
+
]);
|
|
23806
23848
|
/**
|
|
23807
23849
|
* Validation schema for the same-chain variant of DepositParams.
|
|
23808
23850
|
*
|
|
@@ -23815,6 +23857,7 @@ const sourceAdapterContextSchema = z.object({
|
|
|
23815
23857
|
to: z.undefined().optional(),
|
|
23816
23858
|
vaultAddress: vaultAddressSchema,
|
|
23817
23859
|
amount: amountSchema,
|
|
23860
|
+
gasFees: z.array(earnGasFeeEstimateSchema).optional(),
|
|
23818
23861
|
config: earnConfigSchema.optional()
|
|
23819
23862
|
}).strict();
|
|
23820
23863
|
const crossChainDepositDestinationSchema = z.object({
|