@circle-fin/app-kit 1.15.2 → 1.16.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.
- package/CHANGELOG.md +59 -0
- package/README.md +5 -2
- package/borrow.cjs +28028 -0
- package/borrow.cjs.map +1 -0
- package/borrow.d.cts +10723 -0
- package/borrow.d.mts +10723 -0
- package/borrow.d.ts +10723 -0
- package/borrow.mjs +28000 -0
- package/borrow.mjs.map +1 -0
- package/bridge.cjs +1942 -290
- package/bridge.d.cts +157 -12
- package/bridge.d.mts +157 -12
- package/bridge.d.ts +157 -12
- package/bridge.mjs +1942 -290
- package/chains.cjs +70 -3
- package/chains.d.cts +2 -0
- package/chains.d.mts +2 -0
- package/chains.d.ts +2 -0
- package/chains.mjs +70 -3
- package/context.cjs +1 -0
- package/context.d.cts +157 -12
- package/context.d.mts +157 -12
- package/context.d.ts +157 -12
- package/context.mjs +1 -0
- package/earn.cjs +5466 -3459
- package/earn.d.cts +1112 -983
- package/earn.d.mts +1112 -983
- package/earn.d.ts +1112 -983
- package/earn.mjs +5466 -3459
- package/estimateBridge.cjs +1940 -288
- package/estimateBridge.d.cts +157 -12
- package/estimateBridge.d.mts +157 -12
- package/estimateBridge.d.ts +157 -12
- package/estimateBridge.mjs +1940 -288
- package/estimateSwap.cjs +8497 -6831
- package/estimateSwap.d.cts +157 -12
- package/estimateSwap.d.mts +157 -12
- package/estimateSwap.d.ts +157 -12
- package/estimateSwap.mjs +8498 -6832
- package/index.cjs +30741 -18498
- package/index.d.cts +22724 -2322
- package/index.d.mts +22724 -2322
- package/index.d.ts +22724 -2322
- package/index.mjs +30682 -18492
- package/package.json +17 -7
- package/server.cjs +113 -22
- package/server.d.cts +10 -9
- package/server.d.mts +10 -9
- package/server.d.ts +10 -9
- package/server.mjs +113 -22
- package/swap.cjs +8497 -6831
- package/swap.d.cts +157 -12
- package/swap.d.mts +157 -12
- package/swap.d.ts +157 -12
- package/swap.mjs +8498 -6832
- package/unifiedBalance.cjs +457 -128
- package/unifiedBalance.d.cts +108 -11
- package/unifiedBalance.d.mts +108 -11
- package/unifiedBalance.d.ts +108 -11
- package/unifiedBalance.mjs +457 -128
package/estimateSwap.d.cts
CHANGED
|
@@ -551,8 +551,23 @@ interface CCTPXChainConfig {
|
|
|
551
551
|
* const contractType: KitContractType = 'bridge' // Valid
|
|
552
552
|
* const invalidType: KitContractType = 'invalid' // TypeScript error
|
|
553
553
|
* ```
|
|
554
|
-
|
|
555
|
-
|
|
554
|
+
*
|
|
555
|
+
* @remarks
|
|
556
|
+
* `'senderPreservingBatcher'` carries a stricter requirement than the others,
|
|
557
|
+
* because setting it wrong fails silently rather than loudly. It must name a
|
|
558
|
+
* batching contract that preserves the calling EOA as `msg.sender` in every
|
|
559
|
+
* subcall — on Arc, the `Multicall3From` predeploy, which achieves that
|
|
560
|
+
* through the `CallFrom` precompile. The name is deliberately more specific
|
|
561
|
+
* than "batcher": the ubiquitous Multicall3 at
|
|
562
|
+
* `0xcA11bde05977b3631167028862bE2a173976CA11` has the same ABI and the same
|
|
563
|
+
* selectors but does **not** qualify, since each subcall would arrive as the
|
|
564
|
+
* Multicall3 contract, so a batched `approve` would grant an allowance from
|
|
565
|
+
* the batcher's own balance rather than from the user's — a field named just
|
|
566
|
+
* `batcher` would make that misconfiguration look valid. Leave
|
|
567
|
+
* `senderPreservingBatcher` unset on any chain lacking one; an unset field
|
|
568
|
+
* simply means callers fall back to submitting calls one at a time.
|
|
569
|
+
*/
|
|
570
|
+
type KitContractType = 'bridge' | 'adapter' | 'senderPreservingBatcher';
|
|
556
571
|
/**
|
|
557
572
|
* Configuration for Gateway v1 contracts.
|
|
558
573
|
*
|
|
@@ -1436,8 +1451,13 @@ type PreparedChainRequest = EvmPreparedChainRequest | SolanaPreparedChainRequest
|
|
|
1436
1451
|
* Parameters for preparing an EVM contract execution.
|
|
1437
1452
|
*/
|
|
1438
1453
|
type EvmPreparedChainRequestParams = {
|
|
1439
|
-
/**
|
|
1440
|
-
|
|
1454
|
+
/**
|
|
1455
|
+
* The type of the prepared execution. Optional here because EVM is the
|
|
1456
|
+
* only chain type `Adapter.prepare()` implementations narrow their param
|
|
1457
|
+
* type to in practice — callers that only ever prepare EVM requests can
|
|
1458
|
+
* omit it rather than repeat a discriminator that never varies for them.
|
|
1459
|
+
*/
|
|
1460
|
+
type?: 'evm';
|
|
1441
1461
|
/** The ABI of the contract. */
|
|
1442
1462
|
abi: Abi | string[];
|
|
1443
1463
|
/** The address of the contract. */
|
|
@@ -2716,6 +2736,57 @@ interface EarnActionMap {
|
|
|
2716
2736
|
readonly claimRewards: ExecuteEarnParams;
|
|
2717
2737
|
}
|
|
2718
2738
|
|
|
2739
|
+
/** Permit standards accepted by Borrow Adapter executions. */
|
|
2740
|
+
declare enum BorrowPermitType {
|
|
2741
|
+
/** Tokens must be approved separately. */
|
|
2742
|
+
NONE = 0,
|
|
2743
|
+
/** EIP-2612 permit calldata accompanies the token input. */
|
|
2744
|
+
EIP2612 = 1
|
|
2745
|
+
}
|
|
2746
|
+
/** Token input forwarded by Borrow Kit to the Adapter Contract. */
|
|
2747
|
+
interface BorrowTokenInput {
|
|
2748
|
+
readonly permitType: BorrowPermitType;
|
|
2749
|
+
readonly token: `0x${string}`;
|
|
2750
|
+
readonly amount: bigint;
|
|
2751
|
+
readonly permitCalldata: `0x${string}`;
|
|
2752
|
+
}
|
|
2753
|
+
/** A single instruction in a Circle-signed Borrow execution. */
|
|
2754
|
+
interface BorrowInstruction {
|
|
2755
|
+
readonly target: `0x${string}`;
|
|
2756
|
+
readonly data: `0x${string}`;
|
|
2757
|
+
readonly value: string | bigint;
|
|
2758
|
+
readonly tokenIn: `0x${string}`;
|
|
2759
|
+
readonly amountToApprove: string | bigint;
|
|
2760
|
+
readonly tokenOut: `0x${string}`;
|
|
2761
|
+
readonly minTokenOut: string | bigint;
|
|
2762
|
+
}
|
|
2763
|
+
/** A token recipient in a Circle-signed Borrow execution. */
|
|
2764
|
+
interface BorrowTokenRecipient {
|
|
2765
|
+
readonly token: `0x${string}`;
|
|
2766
|
+
readonly beneficiary: `0x${string}`;
|
|
2767
|
+
}
|
|
2768
|
+
/** Circle-signed Borrow parameters forwarded to the Adapter Contract. */
|
|
2769
|
+
interface BorrowExecutionParams {
|
|
2770
|
+
readonly instructions: readonly BorrowInstruction[];
|
|
2771
|
+
readonly tokens: readonly BorrowTokenRecipient[];
|
|
2772
|
+
readonly execId: string | bigint;
|
|
2773
|
+
readonly deadline: string | bigint;
|
|
2774
|
+
readonly metadata: `0x${string}`;
|
|
2775
|
+
}
|
|
2776
|
+
/** Parameters for a service-signed Borrow Adapter execution. */
|
|
2777
|
+
interface ExecuteBorrowParams extends ActionParameters {
|
|
2778
|
+
readonly executeParams: BorrowExecutionParams;
|
|
2779
|
+
readonly tokenInputs: BorrowTokenInput[];
|
|
2780
|
+
readonly signature: `0x${string}`;
|
|
2781
|
+
}
|
|
2782
|
+
/** Borrow actions supported by EVM adapters. */
|
|
2783
|
+
interface BorrowActionMap {
|
|
2784
|
+
/** Execute a Circle-signed partial loan repayment. */
|
|
2785
|
+
readonly repay: ExecuteBorrowParams;
|
|
2786
|
+
/** Execute a Circle-signed borrow. */
|
|
2787
|
+
readonly execute: ExecuteBorrowParams;
|
|
2788
|
+
}
|
|
2789
|
+
|
|
2719
2790
|
/**
|
|
2720
2791
|
* Single instruction to execute within the Adapter Contract.
|
|
2721
2792
|
*
|
|
@@ -3672,6 +3743,8 @@ interface NativeActionMap {
|
|
|
3672
3743
|
* @see {@link ActionPayload} for extracting payload types
|
|
3673
3744
|
*/
|
|
3674
3745
|
interface ActionMap {
|
|
3746
|
+
/** Borrow operations that execute service-signed payloads. */
|
|
3747
|
+
readonly borrow: BorrowActionMap;
|
|
3675
3748
|
/** CCTP-specific operations with automatic address resolution. */
|
|
3676
3749
|
readonly cctp: CCTPActionMap;
|
|
3677
3750
|
/** CCTPx operations (CrossChainTokenService) for cross-chain transfers of registered tokens (Circle-issued or otherwise). */
|
|
@@ -3691,6 +3764,7 @@ interface ActionMap {
|
|
|
3691
3764
|
/** Earn operations that execute service-signed payloads via the adapter contract. */
|
|
3692
3765
|
readonly earn: EarnActionMap;
|
|
3693
3766
|
}
|
|
3767
|
+
|
|
3694
3768
|
/**
|
|
3695
3769
|
* Determine if a type represents an action parameter object (leaf node).
|
|
3696
3770
|
*
|
|
@@ -7431,6 +7505,26 @@ interface VaultQuery {
|
|
|
7431
7505
|
/** On-chain vault contract address. */
|
|
7432
7506
|
readonly vaultAddress: string;
|
|
7433
7507
|
}
|
|
7508
|
+
/**
|
|
7509
|
+
* Fields shared by both {@link EarnGasFeeEstimate} variants.
|
|
7510
|
+
*
|
|
7511
|
+
* @example
|
|
7512
|
+
* ```typescript
|
|
7513
|
+
* const base: EarnGasFeeEstimateBase = {
|
|
7514
|
+
* name: 'Deposit',
|
|
7515
|
+
* token: 'ETH',
|
|
7516
|
+
* blockchain: 'Arc_Testnet',
|
|
7517
|
+
* }
|
|
7518
|
+
* ```
|
|
7519
|
+
*/
|
|
7520
|
+
interface EarnGasFeeEstimateBase {
|
|
7521
|
+
/** The earn step being estimated, e.g. "Approve", "Deposit", "Withdraw". */
|
|
7522
|
+
readonly name: string;
|
|
7523
|
+
/** Native token used to pay gas fees, e.g. "ETH". */
|
|
7524
|
+
readonly token: string;
|
|
7525
|
+
/** Blockchain where this gas fee applies. */
|
|
7526
|
+
readonly blockchain: ChainDefinition['chain'];
|
|
7527
|
+
}
|
|
7434
7528
|
/**
|
|
7435
7529
|
* Sort order for a vault discovery query.
|
|
7436
7530
|
*
|
|
@@ -7445,6 +7539,51 @@ interface VaultQuery {
|
|
|
7445
7539
|
*/
|
|
7446
7540
|
type ExploreVaultsSortBy = 'apy' | 'tvl' | 'name';
|
|
7447
7541
|
|
|
7542
|
+
/**
|
|
7543
|
+
* Estimated gas details for one transaction in a kit-level Earn quote, with
|
|
7544
|
+
* every amount as a decimal string so quote results stay JSON-serializable.
|
|
7545
|
+
*
|
|
7546
|
+
* @example
|
|
7547
|
+
* ```typescript
|
|
7548
|
+
* const gas: EarnEstimatedGas = { gas: '73567', gasPrice: '20003763738', fee: '1471616886913446' }
|
|
7549
|
+
* ```
|
|
7550
|
+
*/
|
|
7551
|
+
interface EarnEstimatedGas {
|
|
7552
|
+
/** Estimated gas units as a decimal string, e.g. '73567'. */
|
|
7553
|
+
readonly gas: string;
|
|
7554
|
+
/** Estimated price per gas unit as a decimal string in wei. */
|
|
7555
|
+
readonly gasPrice: string;
|
|
7556
|
+
/** Total estimated fee as a decimal string in wei. */
|
|
7557
|
+
readonly fee: string;
|
|
7558
|
+
}
|
|
7559
|
+
/**
|
|
7560
|
+
* Estimated native gas fee for one transaction in an Earn quote.
|
|
7561
|
+
*
|
|
7562
|
+
* A discriminated union on `fees`: a successful estimate carries
|
|
7563
|
+
* {@link EarnEstimatedGas} details and no `error`; a failed estimate carries
|
|
7564
|
+
* `fees: null` and a sanitized `error` message.
|
|
7565
|
+
*
|
|
7566
|
+
* @example
|
|
7567
|
+
* ```typescript
|
|
7568
|
+
* function describe(entry: EarnGasFeeEstimate): string {
|
|
7569
|
+
* if (entry.fees === null) {
|
|
7570
|
+
* return `${entry.name}: estimation failed (${entry.error})`
|
|
7571
|
+
* }
|
|
7572
|
+
* return `${entry.name}: ${entry.fees.fee} wei`
|
|
7573
|
+
* }
|
|
7574
|
+
* ```
|
|
7575
|
+
*/
|
|
7576
|
+
type EarnGasFeeEstimate = (EarnGasFeeEstimateBase & {
|
|
7577
|
+
/** Estimated gas details with amounts formatted as decimal strings. */
|
|
7578
|
+
readonly fees: EarnEstimatedGas;
|
|
7579
|
+
/** Never present on a successful estimate. */
|
|
7580
|
+
readonly error?: never;
|
|
7581
|
+
}) | (EarnGasFeeEstimateBase & {
|
|
7582
|
+
/** Null because estimation failed. */
|
|
7583
|
+
readonly fees: null;
|
|
7584
|
+
/** Sanitized estimation error message. */
|
|
7585
|
+
readonly error: string;
|
|
7586
|
+
});
|
|
7448
7587
|
/**
|
|
7449
7588
|
* Adapter context for earn operations, constrained to earn-supported chains.
|
|
7450
7589
|
*
|
|
@@ -7628,6 +7767,12 @@ interface SameChainDepositParams<TFromAdapterCapabilities extends AdapterCapabil
|
|
|
7628
7767
|
* @example '100.50' for 100.50 USDC
|
|
7629
7768
|
*/
|
|
7630
7769
|
readonly amount: string;
|
|
7770
|
+
/**
|
|
7771
|
+
* Gas fee estimates from a prior {@link getDepositQuote} call. When provided,
|
|
7772
|
+
* the pre-broadcast gas reserve check uses the actual estimated cost instead
|
|
7773
|
+
* of the conservative fallback reserve.
|
|
7774
|
+
*/
|
|
7775
|
+
readonly gasFees?: readonly EarnGasFeeEstimate[] | undefined;
|
|
7631
7776
|
/** Optional earn configuration. */
|
|
7632
7777
|
readonly config?: EarnConfig | undefined;
|
|
7633
7778
|
}
|
|
@@ -8222,8 +8367,8 @@ interface AppKitContext {
|
|
|
8222
8367
|
*
|
|
8223
8368
|
* This property stores event handlers that are registered via the AppKit's
|
|
8224
8369
|
* `on()` method. Handlers are grouped by operation type. The runtime buckets
|
|
8225
|
-
* are `bridge` and `
|
|
8226
|
-
* AppKit wires action handlers for additional kits.
|
|
8370
|
+
* are `bridge`, `earn`, and `borrow`; the context can add more operation
|
|
8371
|
+
* buckets as AppKit wires action handlers for additional kits.
|
|
8227
8372
|
*
|
|
8228
8373
|
* Within each operation bucket, handlers are keyed by action name (for
|
|
8229
8374
|
* example, `bridge.approve` or `earn.deposit`) or `*` for wildcard handlers.
|
|
@@ -8242,13 +8387,13 @@ interface AppKitContext {
|
|
|
8242
8387
|
* // Earn handlers are registered with EarnKit when earn operations run
|
|
8243
8388
|
* ```
|
|
8244
8389
|
*/
|
|
8245
|
-
actions: Record<'bridge' | 'earn', Record<string, ((payload: unknown) => void)[]>>;
|
|
8390
|
+
actions: Record<'bridge' | 'earn' | 'borrow', Record<string, ((payload: unknown) => void)[]>>;
|
|
8246
8391
|
/**
|
|
8247
|
-
* Disable success analytics for the underlying EarnKit, SwapKit,
|
|
8248
|
-
* UnifiedBalanceKit.
|
|
8392
|
+
* Disable success analytics for the underlying EarnKit, SwapKit,
|
|
8393
|
+
* BorrowKit, and UnifiedBalanceKit.
|
|
8249
8394
|
*
|
|
8250
|
-
* When `true`, completed earn, swap, and unified balance operations
|
|
8251
|
-
* POST analytics events. This does not disable error reporting; use
|
|
8395
|
+
* When `true`, completed earn, swap, borrow, and unified balance operations
|
|
8396
|
+
* will not POST analytics events. This does not disable error reporting; use
|
|
8252
8397
|
* {@link AppKitContext.disableErrorReporting} for that. Defaults to `false`.
|
|
8253
8398
|
*
|
|
8254
8399
|
* @defaultValue false
|
|
@@ -8258,7 +8403,7 @@ interface AppKitContext {
|
|
|
8258
8403
|
* Disable error telemetry for all sub-kits.
|
|
8259
8404
|
*
|
|
8260
8405
|
* When `true`, none of the underlying kits (BridgeKit, SwapKit, EarnKit,
|
|
8261
|
-
* UnifiedBalanceKit) will POST error details to the telemetry
|
|
8406
|
+
* BorrowKit, UnifiedBalanceKit) will POST error details to the telemetry
|
|
8262
8407
|
* endpoint when operations throw. Defaults to `false` (enabled).
|
|
8263
8408
|
*
|
|
8264
8409
|
* @defaultValue false
|
package/estimateSwap.d.mts
CHANGED
|
@@ -551,8 +551,23 @@ interface CCTPXChainConfig {
|
|
|
551
551
|
* const contractType: KitContractType = 'bridge' // Valid
|
|
552
552
|
* const invalidType: KitContractType = 'invalid' // TypeScript error
|
|
553
553
|
* ```
|
|
554
|
-
|
|
555
|
-
|
|
554
|
+
*
|
|
555
|
+
* @remarks
|
|
556
|
+
* `'senderPreservingBatcher'` carries a stricter requirement than the others,
|
|
557
|
+
* because setting it wrong fails silently rather than loudly. It must name a
|
|
558
|
+
* batching contract that preserves the calling EOA as `msg.sender` in every
|
|
559
|
+
* subcall — on Arc, the `Multicall3From` predeploy, which achieves that
|
|
560
|
+
* through the `CallFrom` precompile. The name is deliberately more specific
|
|
561
|
+
* than "batcher": the ubiquitous Multicall3 at
|
|
562
|
+
* `0xcA11bde05977b3631167028862bE2a173976CA11` has the same ABI and the same
|
|
563
|
+
* selectors but does **not** qualify, since each subcall would arrive as the
|
|
564
|
+
* Multicall3 contract, so a batched `approve` would grant an allowance from
|
|
565
|
+
* the batcher's own balance rather than from the user's — a field named just
|
|
566
|
+
* `batcher` would make that misconfiguration look valid. Leave
|
|
567
|
+
* `senderPreservingBatcher` unset on any chain lacking one; an unset field
|
|
568
|
+
* simply means callers fall back to submitting calls one at a time.
|
|
569
|
+
*/
|
|
570
|
+
type KitContractType = 'bridge' | 'adapter' | 'senderPreservingBatcher';
|
|
556
571
|
/**
|
|
557
572
|
* Configuration for Gateway v1 contracts.
|
|
558
573
|
*
|
|
@@ -1436,8 +1451,13 @@ type PreparedChainRequest = EvmPreparedChainRequest | SolanaPreparedChainRequest
|
|
|
1436
1451
|
* Parameters for preparing an EVM contract execution.
|
|
1437
1452
|
*/
|
|
1438
1453
|
type EvmPreparedChainRequestParams = {
|
|
1439
|
-
/**
|
|
1440
|
-
|
|
1454
|
+
/**
|
|
1455
|
+
* The type of the prepared execution. Optional here because EVM is the
|
|
1456
|
+
* only chain type `Adapter.prepare()` implementations narrow their param
|
|
1457
|
+
* type to in practice — callers that only ever prepare EVM requests can
|
|
1458
|
+
* omit it rather than repeat a discriminator that never varies for them.
|
|
1459
|
+
*/
|
|
1460
|
+
type?: 'evm';
|
|
1441
1461
|
/** The ABI of the contract. */
|
|
1442
1462
|
abi: Abi | string[];
|
|
1443
1463
|
/** The address of the contract. */
|
|
@@ -2716,6 +2736,57 @@ interface EarnActionMap {
|
|
|
2716
2736
|
readonly claimRewards: ExecuteEarnParams;
|
|
2717
2737
|
}
|
|
2718
2738
|
|
|
2739
|
+
/** Permit standards accepted by Borrow Adapter executions. */
|
|
2740
|
+
declare enum BorrowPermitType {
|
|
2741
|
+
/** Tokens must be approved separately. */
|
|
2742
|
+
NONE = 0,
|
|
2743
|
+
/** EIP-2612 permit calldata accompanies the token input. */
|
|
2744
|
+
EIP2612 = 1
|
|
2745
|
+
}
|
|
2746
|
+
/** Token input forwarded by Borrow Kit to the Adapter Contract. */
|
|
2747
|
+
interface BorrowTokenInput {
|
|
2748
|
+
readonly permitType: BorrowPermitType;
|
|
2749
|
+
readonly token: `0x${string}`;
|
|
2750
|
+
readonly amount: bigint;
|
|
2751
|
+
readonly permitCalldata: `0x${string}`;
|
|
2752
|
+
}
|
|
2753
|
+
/** A single instruction in a Circle-signed Borrow execution. */
|
|
2754
|
+
interface BorrowInstruction {
|
|
2755
|
+
readonly target: `0x${string}`;
|
|
2756
|
+
readonly data: `0x${string}`;
|
|
2757
|
+
readonly value: string | bigint;
|
|
2758
|
+
readonly tokenIn: `0x${string}`;
|
|
2759
|
+
readonly amountToApprove: string | bigint;
|
|
2760
|
+
readonly tokenOut: `0x${string}`;
|
|
2761
|
+
readonly minTokenOut: string | bigint;
|
|
2762
|
+
}
|
|
2763
|
+
/** A token recipient in a Circle-signed Borrow execution. */
|
|
2764
|
+
interface BorrowTokenRecipient {
|
|
2765
|
+
readonly token: `0x${string}`;
|
|
2766
|
+
readonly beneficiary: `0x${string}`;
|
|
2767
|
+
}
|
|
2768
|
+
/** Circle-signed Borrow parameters forwarded to the Adapter Contract. */
|
|
2769
|
+
interface BorrowExecutionParams {
|
|
2770
|
+
readonly instructions: readonly BorrowInstruction[];
|
|
2771
|
+
readonly tokens: readonly BorrowTokenRecipient[];
|
|
2772
|
+
readonly execId: string | bigint;
|
|
2773
|
+
readonly deadline: string | bigint;
|
|
2774
|
+
readonly metadata: `0x${string}`;
|
|
2775
|
+
}
|
|
2776
|
+
/** Parameters for a service-signed Borrow Adapter execution. */
|
|
2777
|
+
interface ExecuteBorrowParams extends ActionParameters {
|
|
2778
|
+
readonly executeParams: BorrowExecutionParams;
|
|
2779
|
+
readonly tokenInputs: BorrowTokenInput[];
|
|
2780
|
+
readonly signature: `0x${string}`;
|
|
2781
|
+
}
|
|
2782
|
+
/** Borrow actions supported by EVM adapters. */
|
|
2783
|
+
interface BorrowActionMap {
|
|
2784
|
+
/** Execute a Circle-signed partial loan repayment. */
|
|
2785
|
+
readonly repay: ExecuteBorrowParams;
|
|
2786
|
+
/** Execute a Circle-signed borrow. */
|
|
2787
|
+
readonly execute: ExecuteBorrowParams;
|
|
2788
|
+
}
|
|
2789
|
+
|
|
2719
2790
|
/**
|
|
2720
2791
|
* Single instruction to execute within the Adapter Contract.
|
|
2721
2792
|
*
|
|
@@ -3672,6 +3743,8 @@ interface NativeActionMap {
|
|
|
3672
3743
|
* @see {@link ActionPayload} for extracting payload types
|
|
3673
3744
|
*/
|
|
3674
3745
|
interface ActionMap {
|
|
3746
|
+
/** Borrow operations that execute service-signed payloads. */
|
|
3747
|
+
readonly borrow: BorrowActionMap;
|
|
3675
3748
|
/** CCTP-specific operations with automatic address resolution. */
|
|
3676
3749
|
readonly cctp: CCTPActionMap;
|
|
3677
3750
|
/** CCTPx operations (CrossChainTokenService) for cross-chain transfers of registered tokens (Circle-issued or otherwise). */
|
|
@@ -3691,6 +3764,7 @@ interface ActionMap {
|
|
|
3691
3764
|
/** Earn operations that execute service-signed payloads via the adapter contract. */
|
|
3692
3765
|
readonly earn: EarnActionMap;
|
|
3693
3766
|
}
|
|
3767
|
+
|
|
3694
3768
|
/**
|
|
3695
3769
|
* Determine if a type represents an action parameter object (leaf node).
|
|
3696
3770
|
*
|
|
@@ -7431,6 +7505,26 @@ interface VaultQuery {
|
|
|
7431
7505
|
/** On-chain vault contract address. */
|
|
7432
7506
|
readonly vaultAddress: string;
|
|
7433
7507
|
}
|
|
7508
|
+
/**
|
|
7509
|
+
* Fields shared by both {@link EarnGasFeeEstimate} variants.
|
|
7510
|
+
*
|
|
7511
|
+
* @example
|
|
7512
|
+
* ```typescript
|
|
7513
|
+
* const base: EarnGasFeeEstimateBase = {
|
|
7514
|
+
* name: 'Deposit',
|
|
7515
|
+
* token: 'ETH',
|
|
7516
|
+
* blockchain: 'Arc_Testnet',
|
|
7517
|
+
* }
|
|
7518
|
+
* ```
|
|
7519
|
+
*/
|
|
7520
|
+
interface EarnGasFeeEstimateBase {
|
|
7521
|
+
/** The earn step being estimated, e.g. "Approve", "Deposit", "Withdraw". */
|
|
7522
|
+
readonly name: string;
|
|
7523
|
+
/** Native token used to pay gas fees, e.g. "ETH". */
|
|
7524
|
+
readonly token: string;
|
|
7525
|
+
/** Blockchain where this gas fee applies. */
|
|
7526
|
+
readonly blockchain: ChainDefinition['chain'];
|
|
7527
|
+
}
|
|
7434
7528
|
/**
|
|
7435
7529
|
* Sort order for a vault discovery query.
|
|
7436
7530
|
*
|
|
@@ -7445,6 +7539,51 @@ interface VaultQuery {
|
|
|
7445
7539
|
*/
|
|
7446
7540
|
type ExploreVaultsSortBy = 'apy' | 'tvl' | 'name';
|
|
7447
7541
|
|
|
7542
|
+
/**
|
|
7543
|
+
* Estimated gas details for one transaction in a kit-level Earn quote, with
|
|
7544
|
+
* every amount as a decimal string so quote results stay JSON-serializable.
|
|
7545
|
+
*
|
|
7546
|
+
* @example
|
|
7547
|
+
* ```typescript
|
|
7548
|
+
* const gas: EarnEstimatedGas = { gas: '73567', gasPrice: '20003763738', fee: '1471616886913446' }
|
|
7549
|
+
* ```
|
|
7550
|
+
*/
|
|
7551
|
+
interface EarnEstimatedGas {
|
|
7552
|
+
/** Estimated gas units as a decimal string, e.g. '73567'. */
|
|
7553
|
+
readonly gas: string;
|
|
7554
|
+
/** Estimated price per gas unit as a decimal string in wei. */
|
|
7555
|
+
readonly gasPrice: string;
|
|
7556
|
+
/** Total estimated fee as a decimal string in wei. */
|
|
7557
|
+
readonly fee: string;
|
|
7558
|
+
}
|
|
7559
|
+
/**
|
|
7560
|
+
* Estimated native gas fee for one transaction in an Earn quote.
|
|
7561
|
+
*
|
|
7562
|
+
* A discriminated union on `fees`: a successful estimate carries
|
|
7563
|
+
* {@link EarnEstimatedGas} details and no `error`; a failed estimate carries
|
|
7564
|
+
* `fees: null` and a sanitized `error` message.
|
|
7565
|
+
*
|
|
7566
|
+
* @example
|
|
7567
|
+
* ```typescript
|
|
7568
|
+
* function describe(entry: EarnGasFeeEstimate): string {
|
|
7569
|
+
* if (entry.fees === null) {
|
|
7570
|
+
* return `${entry.name}: estimation failed (${entry.error})`
|
|
7571
|
+
* }
|
|
7572
|
+
* return `${entry.name}: ${entry.fees.fee} wei`
|
|
7573
|
+
* }
|
|
7574
|
+
* ```
|
|
7575
|
+
*/
|
|
7576
|
+
type EarnGasFeeEstimate = (EarnGasFeeEstimateBase & {
|
|
7577
|
+
/** Estimated gas details with amounts formatted as decimal strings. */
|
|
7578
|
+
readonly fees: EarnEstimatedGas;
|
|
7579
|
+
/** Never present on a successful estimate. */
|
|
7580
|
+
readonly error?: never;
|
|
7581
|
+
}) | (EarnGasFeeEstimateBase & {
|
|
7582
|
+
/** Null because estimation failed. */
|
|
7583
|
+
readonly fees: null;
|
|
7584
|
+
/** Sanitized estimation error message. */
|
|
7585
|
+
readonly error: string;
|
|
7586
|
+
});
|
|
7448
7587
|
/**
|
|
7449
7588
|
* Adapter context for earn operations, constrained to earn-supported chains.
|
|
7450
7589
|
*
|
|
@@ -7628,6 +7767,12 @@ interface SameChainDepositParams<TFromAdapterCapabilities extends AdapterCapabil
|
|
|
7628
7767
|
* @example '100.50' for 100.50 USDC
|
|
7629
7768
|
*/
|
|
7630
7769
|
readonly amount: string;
|
|
7770
|
+
/**
|
|
7771
|
+
* Gas fee estimates from a prior {@link getDepositQuote} call. When provided,
|
|
7772
|
+
* the pre-broadcast gas reserve check uses the actual estimated cost instead
|
|
7773
|
+
* of the conservative fallback reserve.
|
|
7774
|
+
*/
|
|
7775
|
+
readonly gasFees?: readonly EarnGasFeeEstimate[] | undefined;
|
|
7631
7776
|
/** Optional earn configuration. */
|
|
7632
7777
|
readonly config?: EarnConfig | undefined;
|
|
7633
7778
|
}
|
|
@@ -8222,8 +8367,8 @@ interface AppKitContext {
|
|
|
8222
8367
|
*
|
|
8223
8368
|
* This property stores event handlers that are registered via the AppKit's
|
|
8224
8369
|
* `on()` method. Handlers are grouped by operation type. The runtime buckets
|
|
8225
|
-
* are `bridge` and `
|
|
8226
|
-
* AppKit wires action handlers for additional kits.
|
|
8370
|
+
* are `bridge`, `earn`, and `borrow`; the context can add more operation
|
|
8371
|
+
* buckets as AppKit wires action handlers for additional kits.
|
|
8227
8372
|
*
|
|
8228
8373
|
* Within each operation bucket, handlers are keyed by action name (for
|
|
8229
8374
|
* example, `bridge.approve` or `earn.deposit`) or `*` for wildcard handlers.
|
|
@@ -8242,13 +8387,13 @@ interface AppKitContext {
|
|
|
8242
8387
|
* // Earn handlers are registered with EarnKit when earn operations run
|
|
8243
8388
|
* ```
|
|
8244
8389
|
*/
|
|
8245
|
-
actions: Record<'bridge' | 'earn', Record<string, ((payload: unknown) => void)[]>>;
|
|
8390
|
+
actions: Record<'bridge' | 'earn' | 'borrow', Record<string, ((payload: unknown) => void)[]>>;
|
|
8246
8391
|
/**
|
|
8247
|
-
* Disable success analytics for the underlying EarnKit, SwapKit,
|
|
8248
|
-
* UnifiedBalanceKit.
|
|
8392
|
+
* Disable success analytics for the underlying EarnKit, SwapKit,
|
|
8393
|
+
* BorrowKit, and UnifiedBalanceKit.
|
|
8249
8394
|
*
|
|
8250
|
-
* When `true`, completed earn, swap, and unified balance operations
|
|
8251
|
-
* POST analytics events. This does not disable error reporting; use
|
|
8395
|
+
* When `true`, completed earn, swap, borrow, and unified balance operations
|
|
8396
|
+
* will not POST analytics events. This does not disable error reporting; use
|
|
8252
8397
|
* {@link AppKitContext.disableErrorReporting} for that. Defaults to `false`.
|
|
8253
8398
|
*
|
|
8254
8399
|
* @defaultValue false
|
|
@@ -8258,7 +8403,7 @@ interface AppKitContext {
|
|
|
8258
8403
|
* Disable error telemetry for all sub-kits.
|
|
8259
8404
|
*
|
|
8260
8405
|
* When `true`, none of the underlying kits (BridgeKit, SwapKit, EarnKit,
|
|
8261
|
-
* UnifiedBalanceKit) will POST error details to the telemetry
|
|
8406
|
+
* BorrowKit, UnifiedBalanceKit) will POST error details to the telemetry
|
|
8262
8407
|
* endpoint when operations throw. Defaults to `false` (enabled).
|
|
8263
8408
|
*
|
|
8264
8409
|
* @defaultValue false
|