@circle-fin/app-kit 1.15.1 → 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 +12 -0
- package/bridge.cjs +61 -18
- package/bridge.d.cts +71 -0
- package/bridge.d.mts +71 -0
- package/bridge.d.ts +71 -0
- package/bridge.mjs +61 -18
- package/context.d.cts +71 -0
- package/context.d.mts +71 -0
- package/context.d.ts +71 -0
- package/earn.cjs +383 -43
- package/earn.d.cts +19 -26
- package/earn.d.mts +19 -26
- package/earn.d.ts +19 -26
- package/earn.mjs +383 -43
- package/estimateBridge.cjs +61 -18
- package/estimateBridge.d.cts +71 -0
- package/estimateBridge.d.mts +71 -0
- package/estimateBridge.d.ts +71 -0
- package/estimateBridge.mjs +61 -18
- package/estimateSwap.cjs +59 -16
- package/estimateSwap.d.cts +71 -0
- package/estimateSwap.d.mts +71 -0
- package/estimateSwap.d.ts +71 -0
- package/estimateSwap.mjs +59 -16
- package/index.cjs +291 -63
- package/index.d.cts +184 -91
- package/index.d.mts +184 -91
- package/index.d.ts +184 -91
- package/index.mjs +291 -63
- package/package.json +4 -4
- 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 +59 -16
- package/swap.d.cts +71 -0
- package/swap.d.mts +71 -0
- package/swap.d.ts +71 -0
- package/swap.mjs +59 -16
package/estimateBridge.cjs
CHANGED
|
@@ -12063,7 +12063,7 @@ function resolveOptions(options) {
|
|
|
12063
12063
|
}
|
|
12064
12064
|
|
|
12065
12065
|
var name$2 = "@circle-fin/bridge-kit";
|
|
12066
|
-
var version$3 = "1.15.
|
|
12066
|
+
var version$3 = "1.15.1";
|
|
12067
12067
|
var pkg$3 = {
|
|
12068
12068
|
name: name$2,
|
|
12069
12069
|
version: version$3};
|
|
@@ -13186,7 +13186,7 @@ function createBridgeParamsSchema(tokenSchema, config) {
|
|
|
13186
13186
|
/**
|
|
13187
13187
|
* `POST` — returns a server-signed fee quote for a CCTPx transfer of the
|
|
13188
13188
|
* given `tokenId` between the named source and destination domains.
|
|
13189
|
-
*/ const CCTPX_FEE_QUOTE_PATH = '/
|
|
13189
|
+
*/ const CCTPX_FEE_QUOTE_PATH = '/v2/quote/cctpx/{tokenId}/{sourceDomain}/{destinationDomain}';
|
|
13190
13190
|
/**
|
|
13191
13191
|
* `GET` — returns the remaining fast-burn allowance for the given
|
|
13192
13192
|
* `tokenIds` (a comma-separated query param of bytes32 token ids). Backs
|
|
@@ -14678,7 +14678,7 @@ function createNoopLogger() {
|
|
|
14678
14678
|
})
|
|
14679
14679
|
]);
|
|
14680
14680
|
/**
|
|
14681
|
-
* Schema for `POST /
|
|
14681
|
+
* Schema for `POST /v2/quote/cctpx/{tokenId}/{src}/{dst}`.
|
|
14682
14682
|
*
|
|
14683
14683
|
* Use {@link parseOrThrow} from `@core/utils` to validate payloads
|
|
14684
14684
|
* against this schema.
|
|
@@ -29506,7 +29506,7 @@ new Set(Object.values(Blockchain));
|
|
|
29506
29506
|
registerKit(`${pkg$1.name}/${pkg$1.version}`);
|
|
29507
29507
|
|
|
29508
29508
|
var name = "@circle-fin/earn-kit";
|
|
29509
|
-
var version = "1.
|
|
29509
|
+
var version = "1.8.0";
|
|
29510
29510
|
var pkg = {
|
|
29511
29511
|
name: name,
|
|
29512
29512
|
version: version};
|
|
@@ -29648,10 +29648,8 @@ const bridgeFeeTokenSchema = hexAddressSchema;
|
|
|
29648
29648
|
assetAddress: zod.z.string(),
|
|
29649
29649
|
lltv: zod.z.number(),
|
|
29650
29650
|
supplyUsd: zod.z.number(),
|
|
29651
|
-
//
|
|
29652
|
-
|
|
29653
|
-
// schema; `null` when the product exposes no per-market allocation (V2).
|
|
29654
|
-
allocationPct: zod.z.number().nullable().optional()
|
|
29651
|
+
// `null` when the product exposes no per-market allocation (V2).
|
|
29652
|
+
allocationPct: zod.z.number().nullable()
|
|
29655
29653
|
});
|
|
29656
29654
|
/**
|
|
29657
29655
|
* Zod schema for a Morpho vault warning in the API response.
|
|
@@ -29758,19 +29756,20 @@ const bridgeFeeTokenSchema = hexAddressSchema;
|
|
|
29758
29756
|
earnKitWarnings: zod.z.array(zod.z.string()).optional()
|
|
29759
29757
|
});
|
|
29760
29758
|
/**
|
|
29761
|
-
* Shared base schema: existing flat fields (kept
|
|
29762
|
-
* facets
|
|
29763
|
-
*
|
|
29759
|
+
* Shared base schema: existing flat fields (kept as deprecated aliases) plus
|
|
29760
|
+
* the nested facets. Zenith emits all facets on every response; required here
|
|
29761
|
+
* so a partial emission is caught at parse time rather than surfacing as a
|
|
29762
|
+
* runtime `undefined` access.
|
|
29764
29763
|
*
|
|
29765
29764
|
* @internal
|
|
29766
29765
|
*/ const earnBaseSchema = vaultInfoResponseSchema.extend({
|
|
29767
|
-
address: zod.z.string()
|
|
29768
|
-
asOf: zod.z.string()
|
|
29769
|
-
manager: managerSchema.nullable()
|
|
29770
|
-
apyProfile: apyProfileSchema
|
|
29771
|
-
fee: feeInfoSchema
|
|
29772
|
-
liquidityProfile: liquidityProfileSchema
|
|
29773
|
-
riskSignals: riskSignalsSchema
|
|
29766
|
+
address: zod.z.string(),
|
|
29767
|
+
asOf: zod.z.string(),
|
|
29768
|
+
manager: managerSchema.nullable(),
|
|
29769
|
+
apyProfile: apyProfileSchema,
|
|
29770
|
+
fee: feeInfoSchema,
|
|
29771
|
+
liquidityProfile: liquidityProfileSchema,
|
|
29772
|
+
riskSignals: riskSignalsSchema
|
|
29774
29773
|
});
|
|
29775
29774
|
/**
|
|
29776
29775
|
* Zod schema for the `vault` opportunity variant.
|
|
@@ -30740,6 +30739,49 @@ const sourceAdapterContextSchema = zod.z.object({
|
|
|
30740
30739
|
vaultAddress: vaultAddressSchema,
|
|
30741
30740
|
config: earnConfigSchema.optional()
|
|
30742
30741
|
});
|
|
30742
|
+
/**
|
|
30743
|
+
* Schema for a successful gas fee entry (fees is non-null).
|
|
30744
|
+
*
|
|
30745
|
+
* Validates the kit shape — {@link EarnEstimatedGas} uses decimal strings for
|
|
30746
|
+
* `gas`, `gasPrice`, and `fee`. Only digits are accepted so that the deposit
|
|
30747
|
+
* operation can safely convert them to `bigint` before passing them to the
|
|
30748
|
+
* provider's `computeGasReserve`.
|
|
30749
|
+
*
|
|
30750
|
+
* @internal
|
|
30751
|
+
*/ const earnGasFeeEstimateSuccessSchema = zod.z.object({
|
|
30752
|
+
name: zod.z.string(),
|
|
30753
|
+
token: zod.z.string(),
|
|
30754
|
+
blockchain: zod.z.string(),
|
|
30755
|
+
fees: zod.z.object({
|
|
30756
|
+
gas: zod.z.string().regex(/^\d+$/, 'gas must be a non-negative integer string'),
|
|
30757
|
+
gasPrice: zod.z.string().regex(/^\d+$/, 'gasPrice must be a non-negative integer string'),
|
|
30758
|
+
fee: zod.z.string().regex(/^\d+$/, 'fee must be a non-negative integer string')
|
|
30759
|
+
}),
|
|
30760
|
+
error: zod.z.undefined().optional()
|
|
30761
|
+
}).strict();
|
|
30762
|
+
/**
|
|
30763
|
+
* Schema for a failed gas fee entry (fees is null, error is a string).
|
|
30764
|
+
*
|
|
30765
|
+
* @internal
|
|
30766
|
+
*/ const earnGasFeeEstimateFailureSchema = zod.z.object({
|
|
30767
|
+
name: zod.z.string(),
|
|
30768
|
+
token: zod.z.string(),
|
|
30769
|
+
blockchain: zod.z.string(),
|
|
30770
|
+
fees: zod.z.null(),
|
|
30771
|
+
error: zod.z.string()
|
|
30772
|
+
}).strict();
|
|
30773
|
+
/**
|
|
30774
|
+
* Schema for a single kit-level gas fee estimate entry.
|
|
30775
|
+
*
|
|
30776
|
+
* Rejects arbitrary inputs (null, numbers, empty objects, non-numeric fee
|
|
30777
|
+
* strings) so callers receive a descriptive validation error instead of a
|
|
30778
|
+
* raw `BigInt` conversion error inside `computeGasReserve`.
|
|
30779
|
+
*
|
|
30780
|
+
* @internal
|
|
30781
|
+
*/ const earnGasFeeEstimateSchema = zod.z.union([
|
|
30782
|
+
earnGasFeeEstimateSuccessSchema,
|
|
30783
|
+
earnGasFeeEstimateFailureSchema
|
|
30784
|
+
]);
|
|
30743
30785
|
/**
|
|
30744
30786
|
* Validation schema for the same-chain variant of DepositParams.
|
|
30745
30787
|
*
|
|
@@ -30752,6 +30794,7 @@ const sourceAdapterContextSchema = zod.z.object({
|
|
|
30752
30794
|
to: zod.z.undefined().optional(),
|
|
30753
30795
|
vaultAddress: vaultAddressSchema,
|
|
30754
30796
|
amount: amountSchema,
|
|
30797
|
+
gasFees: zod.z.array(earnGasFeeEstimateSchema).optional(),
|
|
30755
30798
|
config: earnConfigSchema.optional()
|
|
30756
30799
|
}).strict();
|
|
30757
30800
|
const crossChainDepositDestinationSchema = zod.z.object({
|
package/estimateBridge.d.cts
CHANGED
|
@@ -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
|
}
|
package/estimateBridge.d.mts
CHANGED
|
@@ -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
|
}
|
package/estimateBridge.d.ts
CHANGED
|
@@ -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
|
}
|
package/estimateBridge.mjs
CHANGED
|
@@ -12056,7 +12056,7 @@ function resolveOptions(options) {
|
|
|
12056
12056
|
}
|
|
12057
12057
|
|
|
12058
12058
|
var name$2 = "@circle-fin/bridge-kit";
|
|
12059
|
-
var version$3 = "1.15.
|
|
12059
|
+
var version$3 = "1.15.1";
|
|
12060
12060
|
var pkg$3 = {
|
|
12061
12061
|
name: name$2,
|
|
12062
12062
|
version: version$3};
|
|
@@ -13179,7 +13179,7 @@ function createBridgeParamsSchema(tokenSchema, config) {
|
|
|
13179
13179
|
/**
|
|
13180
13180
|
* `POST` — returns a server-signed fee quote for a CCTPx transfer of the
|
|
13181
13181
|
* given `tokenId` between the named source and destination domains.
|
|
13182
|
-
*/ const CCTPX_FEE_QUOTE_PATH = '/
|
|
13182
|
+
*/ const CCTPX_FEE_QUOTE_PATH = '/v2/quote/cctpx/{tokenId}/{sourceDomain}/{destinationDomain}';
|
|
13183
13183
|
/**
|
|
13184
13184
|
* `GET` — returns the remaining fast-burn allowance for the given
|
|
13185
13185
|
* `tokenIds` (a comma-separated query param of bytes32 token ids). Backs
|
|
@@ -14671,7 +14671,7 @@ function createNoopLogger() {
|
|
|
14671
14671
|
})
|
|
14672
14672
|
]);
|
|
14673
14673
|
/**
|
|
14674
|
-
* Schema for `POST /
|
|
14674
|
+
* Schema for `POST /v2/quote/cctpx/{tokenId}/{src}/{dst}`.
|
|
14675
14675
|
*
|
|
14676
14676
|
* Use {@link parseOrThrow} from `@core/utils` to validate payloads
|
|
14677
14677
|
* against this schema.
|
|
@@ -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.
|
|
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
|
-
//
|
|
29645
|
-
|
|
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
|
|
29755
|
-
* facets
|
|
29756
|
-
*
|
|
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()
|
|
29761
|
-
asOf: z.string()
|
|
29762
|
-
manager: managerSchema.nullable()
|
|
29763
|
-
apyProfile: apyProfileSchema
|
|
29764
|
-
fee: feeInfoSchema
|
|
29765
|
-
liquidityProfile: liquidityProfileSchema
|
|
29766
|
-
riskSignals: riskSignalsSchema
|
|
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
|
@@ -10564,7 +10564,7 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
10564
10564
|
}
|
|
10565
10565
|
|
|
10566
10566
|
var name$2 = "@circle-fin/bridge-kit";
|
|
10567
|
-
var version$2 = "1.15.
|
|
10567
|
+
var version$2 = "1.15.1";
|
|
10568
10568
|
var pkg$2 = {
|
|
10569
10569
|
name: name$2,
|
|
10570
10570
|
version: version$2};
|
|
@@ -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.
|
|
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
|
-
//
|
|
22722
|
-
|
|
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
|
|
22832
|
-
* facets
|
|
22833
|
-
*
|
|
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()
|
|
22838
|
-
asOf: zod.z.string()
|
|
22839
|
-
manager: managerSchema.nullable()
|
|
22840
|
-
apyProfile: apyProfileSchema
|
|
22841
|
-
fee: feeInfoSchema
|
|
22842
|
-
liquidityProfile: liquidityProfileSchema
|
|
22843
|
-
riskSignals: riskSignalsSchema
|
|
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({
|