@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/context.d.mts
CHANGED
|
@@ -7225,6 +7225,26 @@ interface VaultQuery {
|
|
|
7225
7225
|
/** On-chain vault contract address. */
|
|
7226
7226
|
readonly vaultAddress: string;
|
|
7227
7227
|
}
|
|
7228
|
+
/**
|
|
7229
|
+
* Fields shared by both {@link EarnGasFeeEstimate} variants.
|
|
7230
|
+
*
|
|
7231
|
+
* @example
|
|
7232
|
+
* ```typescript
|
|
7233
|
+
* const base: EarnGasFeeEstimateBase = {
|
|
7234
|
+
* name: 'Deposit',
|
|
7235
|
+
* token: 'ETH',
|
|
7236
|
+
* blockchain: 'Arc_Testnet',
|
|
7237
|
+
* }
|
|
7238
|
+
* ```
|
|
7239
|
+
*/
|
|
7240
|
+
interface EarnGasFeeEstimateBase {
|
|
7241
|
+
/** The earn step being estimated, e.g. "Approve", "Deposit", "Withdraw". */
|
|
7242
|
+
readonly name: string;
|
|
7243
|
+
/** Native token used to pay gas fees, e.g. "ETH". */
|
|
7244
|
+
readonly token: string;
|
|
7245
|
+
/** Blockchain where this gas fee applies. */
|
|
7246
|
+
readonly blockchain: ChainDefinition['chain'];
|
|
7247
|
+
}
|
|
7228
7248
|
/**
|
|
7229
7249
|
* Sort order for a vault discovery query.
|
|
7230
7250
|
*
|
|
@@ -7239,6 +7259,51 @@ interface VaultQuery {
|
|
|
7239
7259
|
*/
|
|
7240
7260
|
type ExploreVaultsSortBy = 'apy' | 'tvl' | 'name';
|
|
7241
7261
|
|
|
7262
|
+
/**
|
|
7263
|
+
* Estimated gas details for one transaction in a kit-level Earn quote, with
|
|
7264
|
+
* every amount as a decimal string so quote results stay JSON-serializable.
|
|
7265
|
+
*
|
|
7266
|
+
* @example
|
|
7267
|
+
* ```typescript
|
|
7268
|
+
* const gas: EarnEstimatedGas = { gas: '73567', gasPrice: '20003763738', fee: '1471616886913446' }
|
|
7269
|
+
* ```
|
|
7270
|
+
*/
|
|
7271
|
+
interface EarnEstimatedGas {
|
|
7272
|
+
/** Estimated gas units as a decimal string, e.g. '73567'. */
|
|
7273
|
+
readonly gas: string;
|
|
7274
|
+
/** Estimated price per gas unit as a decimal string in wei. */
|
|
7275
|
+
readonly gasPrice: string;
|
|
7276
|
+
/** Total estimated fee as a decimal string in wei. */
|
|
7277
|
+
readonly fee: string;
|
|
7278
|
+
}
|
|
7279
|
+
/**
|
|
7280
|
+
* Estimated native gas fee for one transaction in an Earn quote.
|
|
7281
|
+
*
|
|
7282
|
+
* A discriminated union on `fees`: a successful estimate carries
|
|
7283
|
+
* {@link EarnEstimatedGas} details and no `error`; a failed estimate carries
|
|
7284
|
+
* `fees: null` and a sanitized `error` message.
|
|
7285
|
+
*
|
|
7286
|
+
* @example
|
|
7287
|
+
* ```typescript
|
|
7288
|
+
* function describe(entry: EarnGasFeeEstimate): string {
|
|
7289
|
+
* if (entry.fees === null) {
|
|
7290
|
+
* return `${entry.name}: estimation failed (${entry.error})`
|
|
7291
|
+
* }
|
|
7292
|
+
* return `${entry.name}: ${entry.fees.fee} wei`
|
|
7293
|
+
* }
|
|
7294
|
+
* ```
|
|
7295
|
+
*/
|
|
7296
|
+
type EarnGasFeeEstimate = (EarnGasFeeEstimateBase & {
|
|
7297
|
+
/** Estimated gas details with amounts formatted as decimal strings. */
|
|
7298
|
+
readonly fees: EarnEstimatedGas;
|
|
7299
|
+
/** Never present on a successful estimate. */
|
|
7300
|
+
readonly error?: never;
|
|
7301
|
+
}) | (EarnGasFeeEstimateBase & {
|
|
7302
|
+
/** Null because estimation failed. */
|
|
7303
|
+
readonly fees: null;
|
|
7304
|
+
/** Sanitized estimation error message. */
|
|
7305
|
+
readonly error: string;
|
|
7306
|
+
});
|
|
7242
7307
|
/**
|
|
7243
7308
|
* Adapter context for earn operations, constrained to earn-supported chains.
|
|
7244
7309
|
*
|
|
@@ -7422,6 +7487,12 @@ interface SameChainDepositParams<TFromAdapterCapabilities extends AdapterCapabil
|
|
|
7422
7487
|
* @example '100.50' for 100.50 USDC
|
|
7423
7488
|
*/
|
|
7424
7489
|
readonly amount: string;
|
|
7490
|
+
/**
|
|
7491
|
+
* Gas fee estimates from a prior {@link getDepositQuote} call. When provided,
|
|
7492
|
+
* the pre-broadcast gas reserve check uses the actual estimated cost instead
|
|
7493
|
+
* of the conservative fallback reserve.
|
|
7494
|
+
*/
|
|
7495
|
+
readonly gasFees?: readonly EarnGasFeeEstimate[] | undefined;
|
|
7425
7496
|
/** Optional earn configuration. */
|
|
7426
7497
|
readonly config?: EarnConfig | undefined;
|
|
7427
7498
|
}
|
package/context.d.ts
CHANGED
|
@@ -7225,6 +7225,26 @@ interface VaultQuery {
|
|
|
7225
7225
|
/** On-chain vault contract address. */
|
|
7226
7226
|
readonly vaultAddress: string;
|
|
7227
7227
|
}
|
|
7228
|
+
/**
|
|
7229
|
+
* Fields shared by both {@link EarnGasFeeEstimate} variants.
|
|
7230
|
+
*
|
|
7231
|
+
* @example
|
|
7232
|
+
* ```typescript
|
|
7233
|
+
* const base: EarnGasFeeEstimateBase = {
|
|
7234
|
+
* name: 'Deposit',
|
|
7235
|
+
* token: 'ETH',
|
|
7236
|
+
* blockchain: 'Arc_Testnet',
|
|
7237
|
+
* }
|
|
7238
|
+
* ```
|
|
7239
|
+
*/
|
|
7240
|
+
interface EarnGasFeeEstimateBase {
|
|
7241
|
+
/** The earn step being estimated, e.g. "Approve", "Deposit", "Withdraw". */
|
|
7242
|
+
readonly name: string;
|
|
7243
|
+
/** Native token used to pay gas fees, e.g. "ETH". */
|
|
7244
|
+
readonly token: string;
|
|
7245
|
+
/** Blockchain where this gas fee applies. */
|
|
7246
|
+
readonly blockchain: ChainDefinition['chain'];
|
|
7247
|
+
}
|
|
7228
7248
|
/**
|
|
7229
7249
|
* Sort order for a vault discovery query.
|
|
7230
7250
|
*
|
|
@@ -7239,6 +7259,51 @@ interface VaultQuery {
|
|
|
7239
7259
|
*/
|
|
7240
7260
|
type ExploreVaultsSortBy = 'apy' | 'tvl' | 'name';
|
|
7241
7261
|
|
|
7262
|
+
/**
|
|
7263
|
+
* Estimated gas details for one transaction in a kit-level Earn quote, with
|
|
7264
|
+
* every amount as a decimal string so quote results stay JSON-serializable.
|
|
7265
|
+
*
|
|
7266
|
+
* @example
|
|
7267
|
+
* ```typescript
|
|
7268
|
+
* const gas: EarnEstimatedGas = { gas: '73567', gasPrice: '20003763738', fee: '1471616886913446' }
|
|
7269
|
+
* ```
|
|
7270
|
+
*/
|
|
7271
|
+
interface EarnEstimatedGas {
|
|
7272
|
+
/** Estimated gas units as a decimal string, e.g. '73567'. */
|
|
7273
|
+
readonly gas: string;
|
|
7274
|
+
/** Estimated price per gas unit as a decimal string in wei. */
|
|
7275
|
+
readonly gasPrice: string;
|
|
7276
|
+
/** Total estimated fee as a decimal string in wei. */
|
|
7277
|
+
readonly fee: string;
|
|
7278
|
+
}
|
|
7279
|
+
/**
|
|
7280
|
+
* Estimated native gas fee for one transaction in an Earn quote.
|
|
7281
|
+
*
|
|
7282
|
+
* A discriminated union on `fees`: a successful estimate carries
|
|
7283
|
+
* {@link EarnEstimatedGas} details and no `error`; a failed estimate carries
|
|
7284
|
+
* `fees: null` and a sanitized `error` message.
|
|
7285
|
+
*
|
|
7286
|
+
* @example
|
|
7287
|
+
* ```typescript
|
|
7288
|
+
* function describe(entry: EarnGasFeeEstimate): string {
|
|
7289
|
+
* if (entry.fees === null) {
|
|
7290
|
+
* return `${entry.name}: estimation failed (${entry.error})`
|
|
7291
|
+
* }
|
|
7292
|
+
* return `${entry.name}: ${entry.fees.fee} wei`
|
|
7293
|
+
* }
|
|
7294
|
+
* ```
|
|
7295
|
+
*/
|
|
7296
|
+
type EarnGasFeeEstimate = (EarnGasFeeEstimateBase & {
|
|
7297
|
+
/** Estimated gas details with amounts formatted as decimal strings. */
|
|
7298
|
+
readonly fees: EarnEstimatedGas;
|
|
7299
|
+
/** Never present on a successful estimate. */
|
|
7300
|
+
readonly error?: never;
|
|
7301
|
+
}) | (EarnGasFeeEstimateBase & {
|
|
7302
|
+
/** Null because estimation failed. */
|
|
7303
|
+
readonly fees: null;
|
|
7304
|
+
/** Sanitized estimation error message. */
|
|
7305
|
+
readonly error: string;
|
|
7306
|
+
});
|
|
7242
7307
|
/**
|
|
7243
7308
|
* Adapter context for earn operations, constrained to earn-supported chains.
|
|
7244
7309
|
*
|
|
@@ -7422,6 +7487,12 @@ interface SameChainDepositParams<TFromAdapterCapabilities extends AdapterCapabil
|
|
|
7422
7487
|
* @example '100.50' for 100.50 USDC
|
|
7423
7488
|
*/
|
|
7424
7489
|
readonly amount: string;
|
|
7490
|
+
/**
|
|
7491
|
+
* Gas fee estimates from a prior {@link getDepositQuote} call. When provided,
|
|
7492
|
+
* the pre-broadcast gas reserve check uses the actual estimated cost instead
|
|
7493
|
+
* of the conservative fallback reserve.
|
|
7494
|
+
*/
|
|
7495
|
+
readonly gasFees?: readonly EarnGasFeeEstimate[] | undefined;
|
|
7425
7496
|
/** Optional earn configuration. */
|
|
7426
7497
|
readonly config?: EarnConfig | undefined;
|
|
7427
7498
|
}
|