@circle-fin/app-kit 1.7.0 → 1.8.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 +215 -0
- package/README.md +28 -5
- package/bridge.cjs +19951 -0
- package/bridge.cjs.map +1 -0
- package/bridge.d.cts +6603 -0
- package/bridge.d.mts +6603 -0
- package/bridge.d.ts +6603 -0
- package/bridge.mjs +19944 -0
- package/bridge.mjs.map +1 -0
- package/chains.cjs +1018 -1087
- package/chains.d.cts +2060 -0
- package/chains.d.mts +2060 -0
- package/chains.d.ts +40 -37
- package/chains.mjs +1018 -1087
- package/context.cjs +59 -0
- package/context.cjs.map +1 -0
- package/context.d.cts +6428 -0
- package/context.d.mts +6428 -0
- package/context.d.ts +6428 -0
- package/context.mjs +57 -0
- package/context.mjs.map +1 -0
- package/earn.cjs +7316 -4800
- package/earn.d.cts +8340 -0
- package/earn.d.mts +8340 -0
- package/earn.d.ts +987 -85
- package/earn.mjs +7313 -4801
- package/estimateBridge.cjs +19889 -0
- package/estimateBridge.cjs.map +1 -0
- package/estimateBridge.d.cts +6483 -0
- package/estimateBridge.d.mts +6483 -0
- package/estimateBridge.d.ts +6483 -0
- package/estimateBridge.mjs +19882 -0
- package/estimateBridge.mjs.map +1 -0
- package/estimateSwap.cjs +21577 -0
- package/estimateSwap.cjs.map +1 -0
- package/estimateSwap.d.cts +6625 -0
- package/estimateSwap.d.mts +6625 -0
- package/estimateSwap.d.ts +6625 -0
- package/estimateSwap.mjs +21571 -0
- package/estimateSwap.mjs.map +1 -0
- package/index.cjs +15241 -11453
- package/index.d.cts +26657 -0
- package/index.d.mts +26657 -0
- package/index.d.ts +5230 -585
- package/index.mjs +15230 -11453
- package/package.json +66 -32
- package/swap.cjs +21577 -0
- package/swap.cjs.map +1 -0
- package/swap.d.cts +6721 -0
- package/swap.d.mts +6721 -0
- package/swap.d.ts +6721 -0
- package/swap.mjs +21571 -0
- package/swap.mjs.map +1 -0
- package/unifiedBalance.cjs +20557 -0
- package/unifiedBalance.cjs.map +1 -0
- package/unifiedBalance.d.cts +7276 -0
- package/unifiedBalance.d.mts +7276 -0
- package/unifiedBalance.d.ts +7276 -0
- package/unifiedBalance.mjs +20551 -0
- package/unifiedBalance.mjs.map +1 -0
package/earn.d.ts
CHANGED
|
@@ -1006,6 +1006,89 @@ type EarnChainDefinition = ChainDefinition & {
|
|
|
1006
1006
|
* - String literals of EarnChain values
|
|
1007
1007
|
*/
|
|
1008
1008
|
type EarnChainIdentifier = EarnChainDefinition | EarnChain | `${EarnChain}`;
|
|
1009
|
+
/**
|
|
1010
|
+
* Blockchains supported as the source chain for cross-chain Earn deposits.
|
|
1011
|
+
*
|
|
1012
|
+
* Single source of truth for the source allowlist: the Earn Service bridge
|
|
1013
|
+
* route map is `satisfies`-checked against {@link EarnBridgeSourceBlockchain},
|
|
1014
|
+
* and both the type and the runtime validation schema derive from this array.
|
|
1015
|
+
*
|
|
1016
|
+
* @example
|
|
1017
|
+
* ```typescript
|
|
1018
|
+
* import { EARN_BRIDGE_SOURCE_BLOCKCHAINS } from '@core/chains'
|
|
1019
|
+
*
|
|
1020
|
+
* console.log(EARN_BRIDGE_SOURCE_BLOCKCHAINS.join(', '))
|
|
1021
|
+
* ```
|
|
1022
|
+
*/
|
|
1023
|
+
declare const EARN_BRIDGE_SOURCE_BLOCKCHAINS: readonly [Blockchain.Arbitrum_Sepolia, Blockchain.Base_Sepolia, Blockchain.Ethereum_Sepolia];
|
|
1024
|
+
/**
|
|
1025
|
+
* Blockchains supported as the source chain for cross-chain Earn deposits.
|
|
1026
|
+
*
|
|
1027
|
+
* Cross-chain Earn deposits bridge USDC from one of these chains into a vault
|
|
1028
|
+
* on an {@link EarnBridgeDestinationBlockchain} chain.
|
|
1029
|
+
*/
|
|
1030
|
+
type EarnBridgeSourceBlockchain = (typeof EARN_BRIDGE_SOURCE_BLOCKCHAINS)[number];
|
|
1031
|
+
/**
|
|
1032
|
+
* Chain definition for a cross-chain Earn deposit source chain.
|
|
1033
|
+
*
|
|
1034
|
+
* Constrained to chains in {@link EarnBridgeSourceBlockchain}.
|
|
1035
|
+
*/
|
|
1036
|
+
type EarnBridgeSourceChainDefinition = ChainDefinition & {
|
|
1037
|
+
chain: `${EarnBridgeSourceBlockchain}`;
|
|
1038
|
+
};
|
|
1039
|
+
/**
|
|
1040
|
+
* Chain identifier accepted for the source side of a cross-chain Earn deposit.
|
|
1041
|
+
*
|
|
1042
|
+
* Constrains the source to Ethereum Sepolia, Arbitrum Sepolia, or Base Sepolia.
|
|
1043
|
+
*
|
|
1044
|
+
* @example
|
|
1045
|
+
* ```typescript
|
|
1046
|
+
* import type { EarnBridgeSourceChainIdentifier } from '@core/chains'
|
|
1047
|
+
*
|
|
1048
|
+
* const source: EarnBridgeSourceChainIdentifier = 'Ethereum_Sepolia'
|
|
1049
|
+
* ```
|
|
1050
|
+
*/
|
|
1051
|
+
type EarnBridgeSourceChainIdentifier = EarnBridgeSourceChainDefinition | EarnBridgeSourceBlockchain | `${EarnBridgeSourceBlockchain}`;
|
|
1052
|
+
/**
|
|
1053
|
+
* Blockchains supported as the destination (vault) chain for cross-chain Earn
|
|
1054
|
+
* deposits. Single source of truth for the destination allowlist.
|
|
1055
|
+
*
|
|
1056
|
+
* @example
|
|
1057
|
+
* ```typescript
|
|
1058
|
+
* import { EARN_BRIDGE_DESTINATION_BLOCKCHAINS } from '@core/chains'
|
|
1059
|
+
*
|
|
1060
|
+
* console.log(EARN_BRIDGE_DESTINATION_BLOCKCHAINS.join(', '))
|
|
1061
|
+
* ```
|
|
1062
|
+
*/
|
|
1063
|
+
declare const EARN_BRIDGE_DESTINATION_BLOCKCHAINS: readonly [Blockchain.Arc_Testnet];
|
|
1064
|
+
/**
|
|
1065
|
+
* Blockchains supported as the destination (vault) chain for cross-chain Earn
|
|
1066
|
+
* deposits.
|
|
1067
|
+
*
|
|
1068
|
+
* Intentionally narrower than {@link EarnChain}: cross-chain deposits
|
|
1069
|
+
* currently land only on Arc Testnet.
|
|
1070
|
+
*/
|
|
1071
|
+
type EarnBridgeDestinationBlockchain = (typeof EARN_BRIDGE_DESTINATION_BLOCKCHAINS)[number];
|
|
1072
|
+
/**
|
|
1073
|
+
* Chain definition for a cross-chain Earn deposit destination chain.
|
|
1074
|
+
*
|
|
1075
|
+
* Constrained to chains in {@link EarnBridgeDestinationBlockchain}.
|
|
1076
|
+
*/
|
|
1077
|
+
type EarnBridgeDestinationChainDefinition = ChainDefinition & {
|
|
1078
|
+
chain: `${EarnBridgeDestinationBlockchain}`;
|
|
1079
|
+
};
|
|
1080
|
+
/**
|
|
1081
|
+
* Chain identifier accepted for the destination (vault) side of a cross-chain
|
|
1082
|
+
* Earn deposit. Constrains the destination to Arc Testnet.
|
|
1083
|
+
*
|
|
1084
|
+
* @example
|
|
1085
|
+
* ```typescript
|
|
1086
|
+
* import type { EarnBridgeDestinationChainIdentifier } from '@core/chains'
|
|
1087
|
+
*
|
|
1088
|
+
* const destination: EarnBridgeDestinationChainIdentifier = 'Arc_Testnet'
|
|
1089
|
+
* ```
|
|
1090
|
+
*/
|
|
1091
|
+
type EarnBridgeDestinationChainIdentifier = EarnBridgeDestinationChainDefinition | EarnBridgeDestinationBlockchain | `${EarnBridgeDestinationBlockchain}`;
|
|
1009
1092
|
|
|
1010
1093
|
/**
|
|
1011
1094
|
* @packageDocumentation
|
|
@@ -3606,8 +3689,14 @@ interface AdapterCapabilities {
|
|
|
3606
3689
|
/**
|
|
3607
3690
|
* The set of blockchain networks this adapter supports.
|
|
3608
3691
|
* Used for validation, capability discovery, and to restrict operations to supported chains.
|
|
3692
|
+
*
|
|
3693
|
+
* @remarks
|
|
3694
|
+
* Typed `readonly` to match the `@core/adapter-base` `AdapterCapabilities`
|
|
3695
|
+
* shape, so the /next adapters (which preserve `readonly` capabilities per
|
|
3696
|
+
* PR #853 A1) remain structurally assignable to this legacy `Adapter`
|
|
3697
|
+
* contract. The collection is only ever read, never mutated.
|
|
3609
3698
|
*/
|
|
3610
|
-
supportedChains: ChainDefinition[];
|
|
3699
|
+
supportedChains: readonly ChainDefinition[];
|
|
3611
3700
|
}
|
|
3612
3701
|
/**
|
|
3613
3702
|
* Abstract class defining the standard interface for an adapter that interacts with a specific blockchain.
|
|
@@ -5006,6 +5095,18 @@ interface InvocationMeta {
|
|
|
5006
5095
|
* Example: [app, kit, provider]
|
|
5007
5096
|
*/
|
|
5008
5097
|
readonly callers?: readonly Caller[] | undefined;
|
|
5098
|
+
/**
|
|
5099
|
+
* Cooperative cancellation signal for the invocation.
|
|
5100
|
+
*
|
|
5101
|
+
* @remarks
|
|
5102
|
+
* When provided, the signal is threaded onto the resolved
|
|
5103
|
+
* {@link InvocationContext} so operations can forward it to
|
|
5104
|
+
* cancellable work (e.g. `fetch`, timers, adapter calls). Optional and
|
|
5105
|
+
* backwards-compatible: callers that do not support cancellation simply
|
|
5106
|
+
* omit it. Aborting the signal is the caller's responsibility; the
|
|
5107
|
+
* runtime only propagates it.
|
|
5108
|
+
*/
|
|
5109
|
+
readonly signal?: AbortSignal | undefined;
|
|
5009
5110
|
}
|
|
5010
5111
|
|
|
5011
5112
|
/**
|
|
@@ -5984,7 +6085,7 @@ declare class Amount implements AmountFields {
|
|
|
5984
6085
|
* ```typescript
|
|
5985
6086
|
* const query: VaultQuery = {
|
|
5986
6087
|
* chain: 'Arc_Testnet',
|
|
5987
|
-
* vaultAddress: '
|
|
6088
|
+
* vaultAddress: '0xAabbeF1D3971c710276ed41eC791BbE14CdB8E88',
|
|
5988
6089
|
* }
|
|
5989
6090
|
* ```
|
|
5990
6091
|
*/
|
|
@@ -6060,7 +6161,7 @@ interface VaultWarning {
|
|
|
6060
6161
|
* @example
|
|
6061
6162
|
* ```typescript
|
|
6062
6163
|
* const vault: VaultInfo = {
|
|
6063
|
-
* vaultAddress: '
|
|
6164
|
+
* vaultAddress: '0xAabbeF1D3971c710276ed41eC791BbE14CdB8E88',
|
|
6064
6165
|
* chain: 'Arc_Testnet',
|
|
6065
6166
|
* name: 'Steakhouse USDC',
|
|
6066
6167
|
* protocol: 'MORPHO',
|
|
@@ -6074,6 +6175,7 @@ interface VaultWarning {
|
|
|
6074
6175
|
* totalDeposits: Amount.fromJSON({ raw: '15000000000000', decimals: 6 }),
|
|
6075
6176
|
* liquidity: Amount.fromJSON({ raw: '5000000000000', decimals: 6 }),
|
|
6076
6177
|
* status: 'active',
|
|
6178
|
+
* circleGuarded: false,
|
|
6077
6179
|
* }
|
|
6078
6180
|
* ```
|
|
6079
6181
|
*/
|
|
@@ -6106,6 +6208,8 @@ interface VaultInfo {
|
|
|
6106
6208
|
readonly liquidity: Amount;
|
|
6107
6209
|
/** Current vault status. */
|
|
6108
6210
|
readonly status: 'active' | 'low_liquidity';
|
|
6211
|
+
/** Whether the vault is on Circle's curated Circle-guarded list. */
|
|
6212
|
+
readonly circleGuarded: boolean;
|
|
6109
6213
|
/** Morpho protocol warnings for this vault. */
|
|
6110
6214
|
readonly warnings?: readonly VaultWarning[] | undefined;
|
|
6111
6215
|
/** Circle-specific warnings (e.g., unsupported reward protocol). */
|
|
@@ -6273,6 +6377,21 @@ interface AssetAmount {
|
|
|
6273
6377
|
* the asset for the calling context.
|
|
6274
6378
|
*/
|
|
6275
6379
|
readonly address?: string | undefined;
|
|
6380
|
+
/**
|
|
6381
|
+
* Optional category tag for the amount.
|
|
6382
|
+
*
|
|
6383
|
+
* Present on fee entries to identify the kind of fee — for cross-chain
|
|
6384
|
+
* deposit quotes this is the source-fee item type (e.g. `'FORWARD'`,
|
|
6385
|
+
* `'PRE_FINALITY'`). Omitted when the amount has no meaningful category
|
|
6386
|
+
* (plain deposit/withdrawal/share/reward amounts).
|
|
6387
|
+
*/
|
|
6388
|
+
readonly type?: string | undefined;
|
|
6389
|
+
/**
|
|
6390
|
+
* Optional status qualifier for a fee entry — e.g. `'estimated'` for a
|
|
6391
|
+
* pre-sign cross-chain fee that may change at execution time. Omitted when
|
|
6392
|
+
* not applicable.
|
|
6393
|
+
*/
|
|
6394
|
+
readonly status?: string | undefined;
|
|
6276
6395
|
}
|
|
6277
6396
|
/**
|
|
6278
6397
|
* Result of a deposit operation returned by
|
|
@@ -6283,11 +6402,25 @@ interface AssetAmount {
|
|
|
6283
6402
|
*
|
|
6284
6403
|
* @example
|
|
6285
6404
|
* ```typescript
|
|
6286
|
-
* const result:
|
|
6405
|
+
* const result: EarnSameChainDepositResult = {
|
|
6406
|
+
* kind: 'same-chain',
|
|
6407
|
+
* txHash: '0x...',
|
|
6408
|
+
* explorerUrl: 'https://...',
|
|
6409
|
+
* vaultAddress: '0x...',
|
|
6410
|
+
* amount: '100.50',
|
|
6411
|
+
* }
|
|
6287
6412
|
* console.log(`Deposited ${result.amount} into ${result.vaultAddress}, tx: ${result.txHash}`)
|
|
6288
6413
|
* ```
|
|
6289
6414
|
*/
|
|
6290
|
-
interface
|
|
6415
|
+
interface EarnSameChainDepositResult {
|
|
6416
|
+
/**
|
|
6417
|
+
* Discriminator for narrowing {@link EarnDepositOutcome}.
|
|
6418
|
+
*
|
|
6419
|
+
* Always set at runtime. Optional only so the pre-cross-chain
|
|
6420
|
+
* {@link EarnDepositResult} shape — and provider implementations or mocks
|
|
6421
|
+
* written against it — remain assignable.
|
|
6422
|
+
*/
|
|
6423
|
+
readonly kind?: 'same-chain';
|
|
6291
6424
|
/** Confirmed on-chain transaction hash. */
|
|
6292
6425
|
readonly txHash: string;
|
|
6293
6426
|
/** Explorer URL for the confirmed on-chain transaction. */
|
|
@@ -6297,6 +6430,206 @@ interface EarnDepositResult {
|
|
|
6297
6430
|
/** Deposit amount in human-readable decimal format. */
|
|
6298
6431
|
readonly amount: string;
|
|
6299
6432
|
}
|
|
6433
|
+
/**
|
|
6434
|
+
* Result of a cross-chain deposit submitted through the bridge flow.
|
|
6435
|
+
*
|
|
6436
|
+
* @remarks
|
|
6437
|
+
* A `cross-chain` result means the bridge accepted the submission — a weaker
|
|
6438
|
+
* guarantee than the same-chain result's confirmed on-chain `txHash`.
|
|
6439
|
+
* `deposit()` does not poll bridge settlement or vault-position completion.
|
|
6440
|
+
*
|
|
6441
|
+
* @example
|
|
6442
|
+
* ```typescript
|
|
6443
|
+
* const result: EarnCrossChainDepositResult = {
|
|
6444
|
+
* kind: 'cross-chain',
|
|
6445
|
+
* execId: '550e8400-e29b-41d4-a716-446655440000',
|
|
6446
|
+
* status: 'PENDING',
|
|
6447
|
+
* vaultAddress: '0x...',
|
|
6448
|
+
* amount: '100.50',
|
|
6449
|
+
* sourceChain: Blockchain.Ethereum_Sepolia,
|
|
6450
|
+
* destinationChain: Blockchain.Arc_Testnet,
|
|
6451
|
+
* expiresAt: '2026-05-19T00:00:00Z',
|
|
6452
|
+
* }
|
|
6453
|
+
* console.log(`Submitted bridge deposit ${result.execId}`)
|
|
6454
|
+
* ```
|
|
6455
|
+
*/
|
|
6456
|
+
interface EarnCrossChainDepositResult {
|
|
6457
|
+
/** Discriminator for narrowing {@link EarnDepositOutcome}. */
|
|
6458
|
+
readonly kind: 'cross-chain';
|
|
6459
|
+
/** Idempotency execution ID for the cross-chain deposit. */
|
|
6460
|
+
readonly execId: string;
|
|
6461
|
+
/**
|
|
6462
|
+
* API-defined bridge lifecycle status returned by bridge submit.
|
|
6463
|
+
*
|
|
6464
|
+
* The value space is owned by the bridge API and unions two vocabularies:
|
|
6465
|
+
* a first-time submit reports the relay state (for example `'PENDING'`,
|
|
6466
|
+
* `'SENT'`, `'COMPLETE'`, `'FAILED'`), while a replayed submit for an
|
|
6467
|
+
* already-relayed execution reports the bridge lifecycle (for example
|
|
6468
|
+
* `'SOURCE_PENDING'`, `'ATTESTING'`, `'DESTINATION_PENDING'`,
|
|
6469
|
+
* `'COMPLETE'`, `'FAILED'`, `'CANCELLED'`). Neither set is exhaustive;
|
|
6470
|
+
* treat unrecognized values as in-progress rather than branching
|
|
6471
|
+
* exhaustively.
|
|
6472
|
+
*
|
|
6473
|
+
* `deposit()` returns the submit response only. It does not currently poll
|
|
6474
|
+
* bridge settlement or vault-position completion.
|
|
6475
|
+
*/
|
|
6476
|
+
readonly status: string;
|
|
6477
|
+
/** Vault contract address deposited into. */
|
|
6478
|
+
readonly vaultAddress: string;
|
|
6479
|
+
/** Deposit amount in human-readable decimal format. */
|
|
6480
|
+
readonly amount: string;
|
|
6481
|
+
/** Source chain where the ERC-3009 authorization is signed. */
|
|
6482
|
+
readonly sourceChain: Blockchain;
|
|
6483
|
+
/** Destination chain where the vault lives. */
|
|
6484
|
+
readonly destinationChain: Blockchain;
|
|
6485
|
+
/**
|
|
6486
|
+
* ISO-8601 UTC timestamp after which the prepared bundle expires.
|
|
6487
|
+
*
|
|
6488
|
+
* `retry()` resumes the same bridge execution and replays the original
|
|
6489
|
+
* prepared bundle before this timestamp. After this timestamp the expiry
|
|
6490
|
+
* error is FATAL (not retryable); call `deposit()` again, which starts a
|
|
6491
|
+
* fresh bridge execution.
|
|
6492
|
+
*
|
|
6493
|
+
* @example '2026-05-19T00:00:00Z'
|
|
6494
|
+
*/
|
|
6495
|
+
readonly expiresAt: string;
|
|
6496
|
+
}
|
|
6497
|
+
/**
|
|
6498
|
+
* Status of one hop (source relay or destination mint) of a cross-chain
|
|
6499
|
+
* bridge deposit.
|
|
6500
|
+
*
|
|
6501
|
+
* The `status` field is an API-defined lifecycle string (e.g. `'COMPLETE'`,
|
|
6502
|
+
* `'NOT_STARTED'`). Additive backend fields (chain, domain, relay/tx ids) are
|
|
6503
|
+
* preserved verbatim.
|
|
6504
|
+
*
|
|
6505
|
+
* @example
|
|
6506
|
+
* ```typescript
|
|
6507
|
+
* const source: EarnBridgeHopStatus = {
|
|
6508
|
+
* status: 'COMPLETE',
|
|
6509
|
+
* chain: 'ETH-SEPOLIA',
|
|
6510
|
+
* domainId: 0,
|
|
6511
|
+
* relayId: '84b46b27-0144-5e0e-917b-15f2ba85a49b',
|
|
6512
|
+
* txHash: '0x489b...',
|
|
6513
|
+
* }
|
|
6514
|
+
* ```
|
|
6515
|
+
*/
|
|
6516
|
+
interface EarnBridgeHopStatus {
|
|
6517
|
+
/** API-defined lifecycle status for this hop. */
|
|
6518
|
+
readonly status: string;
|
|
6519
|
+
/** API chain identifier for this hop, when returned. */
|
|
6520
|
+
readonly chain?: string | undefined;
|
|
6521
|
+
/** API CCTP domain identifier for this hop, when returned. */
|
|
6522
|
+
readonly domainId?: number | undefined;
|
|
6523
|
+
/** Source CCTP domain identifier, when returned. */
|
|
6524
|
+
readonly sourceDomainId?: number | undefined;
|
|
6525
|
+
/** Destination CCTP domain identifier, when returned. */
|
|
6526
|
+
readonly destinationDomainId?: number | undefined;
|
|
6527
|
+
/** Backend relay identifier for this hop, when returned. */
|
|
6528
|
+
readonly relayId?: string | undefined;
|
|
6529
|
+
/** On-chain transaction hash for this hop, when returned. */
|
|
6530
|
+
readonly txHash?: string | undefined;
|
|
6531
|
+
/** Additive backend fields preserved verbatim (chain, domainId, ids, ...). */
|
|
6532
|
+
readonly [key: string]: unknown;
|
|
6533
|
+
}
|
|
6534
|
+
/**
|
|
6535
|
+
* CCTP attestation status for a cross-chain bridge deposit.
|
|
6536
|
+
*
|
|
6537
|
+
* @example
|
|
6538
|
+
* ```typescript
|
|
6539
|
+
* const cctp: EarnBridgeCctpStatus = {
|
|
6540
|
+
* status: 'UNKNOWN',
|
|
6541
|
+
* sourceDomainId: 0,
|
|
6542
|
+
* destinationDomainId: 26,
|
|
6543
|
+
* attestationAvailable: false,
|
|
6544
|
+
* }
|
|
6545
|
+
* ```
|
|
6546
|
+
*/
|
|
6547
|
+
interface EarnBridgeCctpStatus {
|
|
6548
|
+
/** API-defined CCTP lifecycle status. */
|
|
6549
|
+
readonly status: string;
|
|
6550
|
+
/** API CCTP domain identifier, when returned. */
|
|
6551
|
+
readonly domainId?: number | undefined;
|
|
6552
|
+
/** Source CCTP domain identifier, when returned. */
|
|
6553
|
+
readonly sourceDomainId?: number | undefined;
|
|
6554
|
+
/** Destination CCTP domain identifier, when returned. */
|
|
6555
|
+
readonly destinationDomainId?: number | undefined;
|
|
6556
|
+
/** Whether an attestation is available to complete destination minting. */
|
|
6557
|
+
readonly attestationAvailable?: boolean | undefined;
|
|
6558
|
+
/** Additive backend fields preserved verbatim. */
|
|
6559
|
+
readonly [key: string]: unknown;
|
|
6560
|
+
}
|
|
6561
|
+
/**
|
|
6562
|
+
* Structured status of a cross-chain Earn deposit, keyed by execId.
|
|
6563
|
+
*
|
|
6564
|
+
* The top-level `status` is the overall API-defined bridge lifecycle string
|
|
6565
|
+
* (e.g. `'PENDING'`, `'ATTESTING'`, `'COMPLETE'`). The nested `source`, `cctp`,
|
|
6566
|
+
* and `destination` objects expose per-hop progress when the API returns them.
|
|
6567
|
+
*
|
|
6568
|
+
* @example
|
|
6569
|
+
* ```typescript
|
|
6570
|
+
* const status: EarnCrossChainDepositStatus = {
|
|
6571
|
+
* execId: 'e9e77922-c8a4-4158-93de-d73a78417d99',
|
|
6572
|
+
* status: 'ATTESTING',
|
|
6573
|
+
* source: { status: 'COMPLETE', chain: 'ETH-SEPOLIA', txHash: '0x489b...' },
|
|
6574
|
+
* cctp: { status: 'UNKNOWN', attestationAvailable: false },
|
|
6575
|
+
* destination: { status: 'NOT_STARTED', domainId: 26 },
|
|
6576
|
+
* }
|
|
6577
|
+
* console.log(`Bridge ${status.execId} is ${status.status}`)
|
|
6578
|
+
* ```
|
|
6579
|
+
*/
|
|
6580
|
+
interface EarnCrossChainDepositStatus {
|
|
6581
|
+
/** Idempotency execution ID for the cross-chain deposit. */
|
|
6582
|
+
readonly execId: string;
|
|
6583
|
+
/** Overall API-defined bridge lifecycle status. */
|
|
6584
|
+
readonly status: string;
|
|
6585
|
+
/** Source-chain relay (burn) hop status, when available. */
|
|
6586
|
+
readonly source?: EarnBridgeHopStatus | undefined;
|
|
6587
|
+
/** CCTP attestation status, when available. */
|
|
6588
|
+
readonly cctp?: EarnBridgeCctpStatus | undefined;
|
|
6589
|
+
/** Destination-chain mint hop status, when available. */
|
|
6590
|
+
readonly destination?: EarnBridgeHopStatus | undefined;
|
|
6591
|
+
}
|
|
6592
|
+
/**
|
|
6593
|
+
* Normalized outcome used by cross-chain deposit waiters.
|
|
6594
|
+
*
|
|
6595
|
+
* `timeout` is a waiter outcome only; it is not derived from an API status.
|
|
6596
|
+
*/
|
|
6597
|
+
type EarnCrossChainDepositWaitOutcome = 'complete' | 'failed' | 'cancelled' | 'timeout';
|
|
6598
|
+
/**
|
|
6599
|
+
* Result returned by waiters for cross-chain Earn deposits.
|
|
6600
|
+
*
|
|
6601
|
+
* The raw bridge status is preserved in `status`. `outcome` summarizes why the
|
|
6602
|
+
* wait stopped, while `terminal` and `timedOut` let callers branch without
|
|
6603
|
+
* re-deriving bridge lifecycle semantics.
|
|
6604
|
+
*/
|
|
6605
|
+
interface EarnCrossChainDepositWaitResult {
|
|
6606
|
+
/** Last observed structured cross-chain deposit status. */
|
|
6607
|
+
readonly status: EarnCrossChainDepositStatus;
|
|
6608
|
+
/** Normalized outcome that caused the waiter to stop. */
|
|
6609
|
+
readonly outcome: EarnCrossChainDepositWaitOutcome;
|
|
6610
|
+
/** Whether the observed bridge status is terminal. */
|
|
6611
|
+
readonly terminal: boolean;
|
|
6612
|
+
/** Whether the wait budget elapsed before a terminal status was observed. */
|
|
6613
|
+
readonly timedOut: boolean;
|
|
6614
|
+
}
|
|
6615
|
+
/**
|
|
6616
|
+
* Result of a deposit operation returned by
|
|
6617
|
+
* {@link EarningProvider.deposit}.
|
|
6618
|
+
*
|
|
6619
|
+
* `kind` is always set at runtime, but it is optional on the same-chain
|
|
6620
|
+
* member, so narrow against the required cross-chain discriminator.
|
|
6621
|
+
*
|
|
6622
|
+
* @example
|
|
6623
|
+
* ```typescript
|
|
6624
|
+
* const result: EarnDepositOutcome = await provider.deposit(params)
|
|
6625
|
+
* if (result.kind === 'cross-chain') {
|
|
6626
|
+
* console.log(`Submitted bridge deposit ${result.execId}`)
|
|
6627
|
+
* } else {
|
|
6628
|
+
* console.log(`Deposited ${result.amount} into ${result.vaultAddress}, tx: ${result.txHash}`)
|
|
6629
|
+
* }
|
|
6630
|
+
* ```
|
|
6631
|
+
*/
|
|
6632
|
+
type EarnDepositOutcome = EarnSameChainDepositResult | EarnCrossChainDepositResult;
|
|
6300
6633
|
/**
|
|
6301
6634
|
* Result of a withdrawal operation returned by
|
|
6302
6635
|
* {@link EarningProvider.withdraw}.
|
|
@@ -6340,6 +6673,54 @@ interface NoClaimableRewardsResult {
|
|
|
6340
6673
|
/** Empty because there were no rewards to claim. */
|
|
6341
6674
|
readonly rewards: readonly [];
|
|
6342
6675
|
}
|
|
6676
|
+
/**
|
|
6677
|
+
* Fields shared by both {@link EarnGasFeeEstimate} variants.
|
|
6678
|
+
*
|
|
6679
|
+
* @example
|
|
6680
|
+
* ```typescript
|
|
6681
|
+
* const base: EarnGasFeeEstimateBase = {
|
|
6682
|
+
* name: 'Deposit',
|
|
6683
|
+
* token: 'ETH',
|
|
6684
|
+
* blockchain: 'Arc_Testnet',
|
|
6685
|
+
* }
|
|
6686
|
+
* ```
|
|
6687
|
+
*/
|
|
6688
|
+
interface EarnGasFeeEstimateBase {
|
|
6689
|
+
/** The earn step being estimated, e.g. "Approve", "Deposit", "Withdraw". */
|
|
6690
|
+
readonly name: string;
|
|
6691
|
+
/** Native token used to pay gas fees, e.g. "ETH". */
|
|
6692
|
+
readonly token: string;
|
|
6693
|
+
/** Blockchain where this gas fee applies. */
|
|
6694
|
+
readonly blockchain: ChainDefinition['chain'];
|
|
6695
|
+
}
|
|
6696
|
+
/**
|
|
6697
|
+
* Estimated native gas fee for one transaction in an Earn quote.
|
|
6698
|
+
*
|
|
6699
|
+
* A discriminated union on `fees`: a successful estimate carries
|
|
6700
|
+
* {@link EstimatedGas} details and no `error`; a failed estimate carries
|
|
6701
|
+
* `fees: null` and a sanitized `error` message. Narrow on `fees`:
|
|
6702
|
+
*
|
|
6703
|
+
* @example
|
|
6704
|
+
* ```typescript
|
|
6705
|
+
* function describe(entry: EarnGasFeeEstimate): string {
|
|
6706
|
+
* if (entry.fees === null) {
|
|
6707
|
+
* return `${entry.name}: estimation failed (${entry.error})`
|
|
6708
|
+
* }
|
|
6709
|
+
* return `${entry.name}: ${entry.fees.fee} wei`
|
|
6710
|
+
* }
|
|
6711
|
+
* ```
|
|
6712
|
+
*/
|
|
6713
|
+
type EarnGasFeeEstimate$1 = (EarnGasFeeEstimateBase & {
|
|
6714
|
+
/** Estimated gas details. */
|
|
6715
|
+
readonly fees: EstimatedGas;
|
|
6716
|
+
/** Never present on a successful estimate. */
|
|
6717
|
+
readonly error?: never;
|
|
6718
|
+
}) | (EarnGasFeeEstimateBase & {
|
|
6719
|
+
/** Null because estimation failed. */
|
|
6720
|
+
readonly fees: null;
|
|
6721
|
+
/** Sanitized estimation error message. */
|
|
6722
|
+
readonly error: string;
|
|
6723
|
+
});
|
|
6343
6724
|
/**
|
|
6344
6725
|
* Result from a deposit quote operation.
|
|
6345
6726
|
*
|
|
@@ -6362,8 +6743,39 @@ interface DepositQuoteInfo {
|
|
|
6362
6743
|
readonly sharePrice: string;
|
|
6363
6744
|
/** Current annualized percentage yield. */
|
|
6364
6745
|
readonly currentApy: number;
|
|
6365
|
-
/**
|
|
6746
|
+
/**
|
|
6747
|
+
* Deposit fees charged in the deposit asset. For cross-chain quotes this
|
|
6748
|
+
* carries one entry per source-fee item (e.g. `'FORWARD'`, `'PRE_FINALITY'`),
|
|
6749
|
+
* each tagged with its own {@link AssetAmount.type} and
|
|
6750
|
+
* {@link AssetAmount.status} (e.g. `'estimated'`). Empty when no such fee
|
|
6751
|
+
* applies. Distinct from native gas estimates, which are reported separately
|
|
6752
|
+
* as gas-fee fields.
|
|
6753
|
+
*/
|
|
6366
6754
|
readonly fees: readonly AssetAmount[];
|
|
6755
|
+
/**
|
|
6756
|
+
* Estimated native gas fees for the transactions needed to deposit
|
|
6757
|
+
* (e.g. token approval and the deposit itself).
|
|
6758
|
+
*
|
|
6759
|
+
* Optional so that custom {@link EarningProvider} implementations are not
|
|
6760
|
+
* required to produce gas estimates. The bundled Earn Service provider
|
|
6761
|
+
* always populates this with one entry per transaction in the flow. When an
|
|
6762
|
+
* individual estimate cannot be produced, that entry is still present with
|
|
6763
|
+
* `fees` set to `null` and `error` describing why — so a non-empty array
|
|
6764
|
+
* does not imply every estimate succeeded; inspect each entry's `fees`.
|
|
6765
|
+
*
|
|
6766
|
+
* The number of entries depends on where estimation stopped: when the flow
|
|
6767
|
+
* fails before the approval step is examined, a single entry named after
|
|
6768
|
+
* the main action is returned. Look entries up by `name`, not by index.
|
|
6769
|
+
*
|
|
6770
|
+
* Each estimate simulates the transaction against current chain state.
|
|
6771
|
+
* When a token approval is still pending (typically a first-time deposit),
|
|
6772
|
+
* the deposit simulation reverts because the allowance is not yet in
|
|
6773
|
+
* place, so the deposit entry resolves with `fees: null` while the
|
|
6774
|
+
* approval entry still carries a real estimate. Render a fallback (e.g.
|
|
6775
|
+
* "available after approval") for that case rather than treating it as an
|
|
6776
|
+
* error.
|
|
6777
|
+
*/
|
|
6778
|
+
readonly gasFees?: readonly EarnGasFeeEstimate$1[] | undefined;
|
|
6367
6779
|
}
|
|
6368
6780
|
/**
|
|
6369
6781
|
* Result from a withdrawal quote operation.
|
|
@@ -6396,6 +6808,29 @@ interface WithdrawalQuoteInfo {
|
|
|
6396
6808
|
readonly maxWithdrawable: AssetAmount;
|
|
6397
6809
|
/** Fees applied to the withdrawal. */
|
|
6398
6810
|
readonly fees: readonly AssetAmount[];
|
|
6811
|
+
/**
|
|
6812
|
+
* Estimated native gas fees for the transactions needed to withdraw.
|
|
6813
|
+
*
|
|
6814
|
+
* Optional so that custom {@link EarningProvider} implementations are not
|
|
6815
|
+
* required to produce gas estimates. The bundled Earn Service provider
|
|
6816
|
+
* always populates this with one entry per transaction in the flow. When an
|
|
6817
|
+
* individual estimate cannot be produced, that entry is still present with
|
|
6818
|
+
* `fees` set to `null` and `error` describing why — so a non-empty array
|
|
6819
|
+
* does not imply every estimate succeeded; inspect each entry's `fees`.
|
|
6820
|
+
*
|
|
6821
|
+
* The number of entries depends on where estimation stopped: when the flow
|
|
6822
|
+
* fails before the approval step is examined, a single entry named after
|
|
6823
|
+
* the main action is returned. Look entries up by `name`, not by index.
|
|
6824
|
+
*
|
|
6825
|
+
* Each estimate simulates the transaction against current chain state.
|
|
6826
|
+
* When a vault-share approval is still pending (typically the first
|
|
6827
|
+
* withdrawal from a vault), the withdrawal simulation reverts because the
|
|
6828
|
+
* allowance is not yet in place, so the withdrawal entry resolves with
|
|
6829
|
+
* `fees: null` while the approval entry still carries a real estimate.
|
|
6830
|
+
* Render a fallback (e.g. "available after approval") for that case
|
|
6831
|
+
* rather than treating it as an error.
|
|
6832
|
+
*/
|
|
6833
|
+
readonly gasFees?: readonly EarnGasFeeEstimate$1[] | undefined;
|
|
6399
6834
|
/**
|
|
6400
6835
|
* Informational, plain-string warnings about the quoted withdrawal.
|
|
6401
6836
|
*
|
|
@@ -6425,6 +6860,19 @@ interface WithdrawalQuoteInfo {
|
|
|
6425
6860
|
interface ClaimRewardsQuoteInfo {
|
|
6426
6861
|
/** Reward tokens available for claiming. */
|
|
6427
6862
|
readonly rewards: readonly AssetAmount[];
|
|
6863
|
+
/**
|
|
6864
|
+
* Estimated native gas fees for claiming rewards. Empty when there are no
|
|
6865
|
+
* rewards to claim.
|
|
6866
|
+
*
|
|
6867
|
+
* Optional so that custom {@link EarningProvider} implementations are not
|
|
6868
|
+
* required to produce gas estimates. Otherwise the bundled Earn Service
|
|
6869
|
+
* provider populates this with one entry per claim transaction; when an
|
|
6870
|
+
* estimate cannot be produced, that entry is still present with `fees` set
|
|
6871
|
+
* to `null` and `error` describing why — so a non-empty array does not imply
|
|
6872
|
+
* every estimate succeeded; inspect each entry's `fees`. Look entries up by
|
|
6873
|
+
* `name`, not by index.
|
|
6874
|
+
*/
|
|
6875
|
+
readonly gasFees?: readonly EarnGasFeeEstimate$1[] | undefined;
|
|
6428
6876
|
}
|
|
6429
6877
|
/**
|
|
6430
6878
|
* Result from a batch vault lookup.
|
|
@@ -6438,13 +6886,112 @@ interface GetVaultsResult {
|
|
|
6438
6886
|
/** Per-vault errors for failed lookups. */
|
|
6439
6887
|
readonly errors: readonly VaultError[];
|
|
6440
6888
|
}
|
|
6889
|
+
/**
|
|
6890
|
+
* Sort order for a vault discovery query.
|
|
6891
|
+
*
|
|
6892
|
+
* - `apy` — highest current APY first
|
|
6893
|
+
* - `tvl` — highest total deposits first
|
|
6894
|
+
* - `name` — alphabetical by vault name
|
|
6895
|
+
*
|
|
6896
|
+
* @example
|
|
6897
|
+
* ```typescript
|
|
6898
|
+
* const sortBy: ExploreVaultsSortBy = 'apy'
|
|
6899
|
+
* ```
|
|
6900
|
+
*/
|
|
6901
|
+
type ExploreVaultsSortBy = 'apy' | 'tvl' | 'name';
|
|
6902
|
+
/**
|
|
6903
|
+
* Pagination metadata for a vault discovery result.
|
|
6904
|
+
*
|
|
6905
|
+
* @example
|
|
6906
|
+
* ```typescript
|
|
6907
|
+
* const pagination: ExploreVaultsPagination = {
|
|
6908
|
+
* page: 1,
|
|
6909
|
+
* pageSize: 100,
|
|
6910
|
+
* totalCount: 42,
|
|
6911
|
+
* totalPages: 1,
|
|
6912
|
+
* }
|
|
6913
|
+
* ```
|
|
6914
|
+
*/
|
|
6915
|
+
interface ExploreVaultsPagination {
|
|
6916
|
+
/** Current page number (1-based). */
|
|
6917
|
+
readonly page: number;
|
|
6918
|
+
/** Number of results per page. */
|
|
6919
|
+
readonly pageSize: number;
|
|
6920
|
+
/** Total number of vaults matching the query. */
|
|
6921
|
+
readonly totalCount: number;
|
|
6922
|
+
/** Total number of pages for the query. */
|
|
6923
|
+
readonly totalPages: number;
|
|
6924
|
+
}
|
|
6925
|
+
/**
|
|
6926
|
+
* Result from a vault discovery query.
|
|
6927
|
+
*
|
|
6928
|
+
* @example
|
|
6929
|
+
* ```typescript
|
|
6930
|
+
* const result: ExploreVaultsResult = await provider.exploreVaults({
|
|
6931
|
+
* chain: 'Arc_Testnet',
|
|
6932
|
+
* })
|
|
6933
|
+
* console.log(`${result.pagination.totalCount} vaults available`)
|
|
6934
|
+
* ```
|
|
6935
|
+
*/
|
|
6936
|
+
interface ExploreVaultsResult {
|
|
6937
|
+
/** Vaults matching the query, in the requested sort order. */
|
|
6938
|
+
readonly vaults: readonly VaultInfo[];
|
|
6939
|
+
/** Pagination metadata for the query. */
|
|
6940
|
+
readonly pagination: ExploreVaultsPagination;
|
|
6941
|
+
}
|
|
6441
6942
|
|
|
6943
|
+
/**
|
|
6944
|
+
* Estimated gas details for one transaction in a kit-level Earn quote, with
|
|
6945
|
+
* every amount as a decimal string so quote results stay JSON-serializable.
|
|
6946
|
+
*
|
|
6947
|
+
* @example
|
|
6948
|
+
* ```typescript
|
|
6949
|
+
* const gas: EarnEstimatedGas = { gas: '73567', gasPrice: '20003763738', fee: '1471616886913446' }
|
|
6950
|
+
* ```
|
|
6951
|
+
*/
|
|
6952
|
+
interface EarnEstimatedGas {
|
|
6953
|
+
/** Estimated gas units as a decimal string, e.g. '73567'. */
|
|
6954
|
+
readonly gas: string;
|
|
6955
|
+
/** Estimated price per gas unit as a decimal string in wei. */
|
|
6956
|
+
readonly gasPrice: string;
|
|
6957
|
+
/** Total estimated fee as a decimal string in wei. */
|
|
6958
|
+
readonly fee: string;
|
|
6959
|
+
}
|
|
6960
|
+
/**
|
|
6961
|
+
* Estimated native gas fee for one transaction in an Earn quote.
|
|
6962
|
+
*
|
|
6963
|
+
* A discriminated union on `fees`: a successful estimate carries
|
|
6964
|
+
* {@link EarnEstimatedGas} details and no `error`; a failed estimate carries
|
|
6965
|
+
* `fees: null` and a sanitized `error` message.
|
|
6966
|
+
*
|
|
6967
|
+
* @example
|
|
6968
|
+
* ```typescript
|
|
6969
|
+
* function describe(entry: EarnGasFeeEstimate): string {
|
|
6970
|
+
* if (entry.fees === null) {
|
|
6971
|
+
* return `${entry.name}: estimation failed (${entry.error})`
|
|
6972
|
+
* }
|
|
6973
|
+
* return `${entry.name}: ${entry.fees.fee} wei`
|
|
6974
|
+
* }
|
|
6975
|
+
* ```
|
|
6976
|
+
*/
|
|
6977
|
+
type EarnGasFeeEstimate = (EarnGasFeeEstimateBase & {
|
|
6978
|
+
/** Estimated gas details with amounts formatted as decimal strings. */
|
|
6979
|
+
readonly fees: EarnEstimatedGas;
|
|
6980
|
+
/** Never present on a successful estimate. */
|
|
6981
|
+
readonly error?: never;
|
|
6982
|
+
}) | (EarnGasFeeEstimateBase & {
|
|
6983
|
+
/** Null because estimation failed. */
|
|
6984
|
+
readonly fees: null;
|
|
6985
|
+
/** Sanitized estimation error message. */
|
|
6986
|
+
readonly error: string;
|
|
6987
|
+
});
|
|
6442
6988
|
/**
|
|
6443
6989
|
* Adapter context for earn operations, constrained to earn-supported chains.
|
|
6444
6990
|
*
|
|
6445
6991
|
* @typeParam TAdapterCapabilities - The adapter capabilities type
|
|
6992
|
+
* @typeParam TChainIdentifier - The chain identifier type accepted by the adapter context
|
|
6446
6993
|
*/
|
|
6447
|
-
type EarnAdapterContext<TAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities> = AdapterContext<TAdapterCapabilities,
|
|
6994
|
+
type EarnAdapterContext<TAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities, TChainIdentifier extends ChainIdentifier$1 = EarnChainIdentifier> = AdapterContext<TAdapterCapabilities, TChainIdentifier>;
|
|
6448
6995
|
/**
|
|
6449
6996
|
* Configuration options for earn operations.
|
|
6450
6997
|
*
|
|
@@ -6498,6 +7045,57 @@ interface GetVaultsParams {
|
|
|
6498
7045
|
/** Optional earn configuration. */
|
|
6499
7046
|
readonly config?: EarnConfig | undefined;
|
|
6500
7047
|
}
|
|
7048
|
+
/**
|
|
7049
|
+
* Parameters for discovering vaults available on a chain.
|
|
7050
|
+
*
|
|
7051
|
+
* Only `chain` is required. Filters narrow the result set, and results
|
|
7052
|
+
* are paginated and sorted server-side.
|
|
7053
|
+
*
|
|
7054
|
+
* @example
|
|
7055
|
+
* ```typescript
|
|
7056
|
+
* const params: ExploreVaultsParams = {
|
|
7057
|
+
* chain: 'Arc_Testnet',
|
|
7058
|
+
* minApy: '0.03',
|
|
7059
|
+
* sortBy: 'apy',
|
|
7060
|
+
* }
|
|
7061
|
+
* ```
|
|
7062
|
+
*/
|
|
7063
|
+
interface ExploreVaultsParams {
|
|
7064
|
+
/** Chain to discover vaults on (e.g., 'Arc_Testnet'). */
|
|
7065
|
+
readonly chain: EarnChainIdentifier;
|
|
7066
|
+
/** Optional protocol filter (e.g., 'morpho'). Matched case-insensitively. */
|
|
7067
|
+
readonly protocol?: string | undefined;
|
|
7068
|
+
/** Optional asset symbol filter, matched case-insensitively. Defaults to 'USDC'. */
|
|
7069
|
+
readonly asset?: string | undefined;
|
|
7070
|
+
/** Optional minimum net APY as a decimal string (e.g., '0.03' for 3%). */
|
|
7071
|
+
readonly minApy?: string | undefined;
|
|
7072
|
+
/** Optional minimum total deposits in token units (e.g., '1000000'). */
|
|
7073
|
+
readonly minTvl?: string | undefined;
|
|
7074
|
+
/** Optional sort order: 'apy', 'tvl', or 'name'. Defaults to 'tvl'. */
|
|
7075
|
+
readonly sortBy?: ExploreVaultsSortBy | undefined;
|
|
7076
|
+
/** Optional page number (1-based). Defaults to 1. */
|
|
7077
|
+
readonly page?: number | undefined;
|
|
7078
|
+
/** Optional results per page (100-500). Defaults to 100. */
|
|
7079
|
+
readonly pageSize?: number | undefined;
|
|
7080
|
+
/** Optional earn configuration. */
|
|
7081
|
+
readonly config?: EarnConfig | undefined;
|
|
7082
|
+
}
|
|
7083
|
+
/**
|
|
7084
|
+
* Parameters for lazily iterating all vaults available on a chain.
|
|
7085
|
+
*
|
|
7086
|
+
* Identical to {@link ExploreVaultsParams} minus `page`: the iterator
|
|
7087
|
+
* fetches page after page on demand. `pageSize` still controls how many
|
|
7088
|
+
* vaults each underlying request fetches.
|
|
7089
|
+
*
|
|
7090
|
+
* @example
|
|
7091
|
+
* ```typescript
|
|
7092
|
+
* const params: ExploreVaultsIteratorParams = {
|
|
7093
|
+
* chain: 'Arc_Testnet',
|
|
7094
|
+
* sortBy: 'apy',
|
|
7095
|
+
* }
|
|
7096
|
+
* ```
|
|
7097
|
+
*/
|
|
7098
|
+
type ExploreVaultsIteratorParams = Omit<ExploreVaultsParams, 'page'>;
|
|
6501
7099
|
/**
|
|
6502
7100
|
* Parameters for fetching a wallet's position in a vault.
|
|
6503
7101
|
*
|
|
@@ -6507,7 +7105,7 @@ interface GetVaultsParams {
|
|
|
6507
7105
|
* ```typescript
|
|
6508
7106
|
* const params: GetPositionParams = {
|
|
6509
7107
|
* from: { adapter, chain: 'Arc_Testnet' },
|
|
6510
|
-
* vaultAddress: '
|
|
7108
|
+
* vaultAddress: '0xAabbeF1D3971c710276ed41eC791BbE14CdB8E88',
|
|
6511
7109
|
* }
|
|
6512
7110
|
* ```
|
|
6513
7111
|
*/
|
|
@@ -6519,6 +7117,60 @@ interface GetPositionParams<TFromAdapterCapabilities extends AdapterCapabilities
|
|
|
6519
7117
|
/** Optional earn configuration. */
|
|
6520
7118
|
readonly config?: EarnConfig | undefined;
|
|
6521
7119
|
}
|
|
7120
|
+
/**
|
|
7121
|
+
* Parameters for retrieving the status of a cross-chain Earn deposit.
|
|
7122
|
+
*
|
|
7123
|
+
* The status lookup is chain-agnostic; it is keyed only by the bridge
|
|
7124
|
+
* execution ID returned from a cross-chain {@link CrossChainDepositParams}
|
|
7125
|
+
* deposit.
|
|
7126
|
+
*
|
|
7127
|
+
* @example
|
|
7128
|
+
* ```typescript
|
|
7129
|
+
* const params: GetCrossChainDepositStatusParams = {
|
|
7130
|
+
* execId: 'e9e77922-c8a4-4158-93de-d73a78417d99',
|
|
7131
|
+
* }
|
|
7132
|
+
* ```
|
|
7133
|
+
*/
|
|
7134
|
+
interface GetCrossChainDepositStatusParams {
|
|
7135
|
+
/** Idempotency execution ID returned by the cross-chain deposit. */
|
|
7136
|
+
readonly execId: string;
|
|
7137
|
+
/** Optional earn configuration. */
|
|
7138
|
+
readonly config?: EarnConfig | undefined;
|
|
7139
|
+
}
|
|
7140
|
+
/**
|
|
7141
|
+
* Parameters for waiting on a cross-chain Earn deposit to reach a terminal
|
|
7142
|
+
* bridge state.
|
|
7143
|
+
*
|
|
7144
|
+
* Polls the bridge status until the deposit settles (or fails) or the wait
|
|
7145
|
+
* budget elapses. On timeout the waiter resolves with the last observed
|
|
7146
|
+
* status and a `timeout` outcome rather than throwing, so callers can inspect
|
|
7147
|
+
* where the bridge stalled.
|
|
7148
|
+
*
|
|
7149
|
+
* @example
|
|
7150
|
+
* ```typescript
|
|
7151
|
+
* const params: WaitForCrossChainDepositParams = {
|
|
7152
|
+
* execId: 'e9e77922-c8a4-4158-93de-d73a78417d99',
|
|
7153
|
+
* pollIntervalMs: 5_000,
|
|
7154
|
+
* maxWaitMs: 1_200_000,
|
|
7155
|
+
* }
|
|
7156
|
+
* ```
|
|
7157
|
+
*/
|
|
7158
|
+
interface WaitForCrossChainDepositParams {
|
|
7159
|
+
/** Idempotency execution ID returned by the cross-chain deposit. */
|
|
7160
|
+
readonly execId: string;
|
|
7161
|
+
/** Optional earn configuration. */
|
|
7162
|
+
readonly config?: EarnConfig | undefined;
|
|
7163
|
+
/** Delay between status polls in milliseconds. Defaults to 5000. */
|
|
7164
|
+
readonly pollIntervalMs?: number | undefined;
|
|
7165
|
+
/** Maximum total wait time in milliseconds. Defaults to 1200000 (20 min). */
|
|
7166
|
+
readonly maxWaitMs?: number | undefined;
|
|
7167
|
+
/**
|
|
7168
|
+
* Optional cancellation signal. When it aborts, the wait rejects with a
|
|
7169
|
+
* `NETWORK_ABORTED` error instead of resolving. Cancellation is observed
|
|
7170
|
+
* between polls, not mid-request.
|
|
7171
|
+
*/
|
|
7172
|
+
readonly signal?: AbortSignal | undefined;
|
|
7173
|
+
}
|
|
6522
7174
|
/**
|
|
6523
7175
|
* Parameters for depositing into a DeFi lending vault.
|
|
6524
7176
|
*
|
|
@@ -6526,14 +7178,14 @@ interface GetPositionParams<TFromAdapterCapabilities extends AdapterCapabilities
|
|
|
6526
7178
|
*
|
|
6527
7179
|
* @example
|
|
6528
7180
|
* ```typescript
|
|
6529
|
-
* const params:
|
|
7181
|
+
* const params: SameChainDepositParams = {
|
|
6530
7182
|
* from: { adapter, chain: 'Arc_Testnet' },
|
|
6531
7183
|
* vaultAddress: '0x...',
|
|
6532
7184
|
* amount: '100.50',
|
|
6533
7185
|
* }
|
|
6534
7186
|
* ```
|
|
6535
7187
|
*/
|
|
6536
|
-
interface
|
|
7188
|
+
interface SameChainDepositParams<TFromAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities> {
|
|
6537
7189
|
/** Source adapter context (wallet and chain) for the deposit. */
|
|
6538
7190
|
readonly from: EarnAdapterContext<TFromAdapterCapabilities>;
|
|
6539
7191
|
/** On-chain vault contract address to deposit into. */
|
|
@@ -6547,6 +7199,114 @@ interface DepositParams<TFromAdapterCapabilities extends AdapterCapabilities = A
|
|
|
6547
7199
|
/** Optional earn configuration. */
|
|
6548
7200
|
readonly config?: EarnConfig | undefined;
|
|
6549
7201
|
}
|
|
7202
|
+
/**
|
|
7203
|
+
* Destination of a cross-chain Earn deposit.
|
|
7204
|
+
*
|
|
7205
|
+
* The destination is adapter-less: the source wallet signs a single ERC-3009
|
|
7206
|
+
* authorization on the source chain, and a relayer executes the bridge and
|
|
7207
|
+
* vault deposit on the destination chain. No destination-side signing occurs,
|
|
7208
|
+
* so only the destination chain and the wallet receiving the vault position
|
|
7209
|
+
* are required.
|
|
7210
|
+
*
|
|
7211
|
+
* @example
|
|
7212
|
+
* ```typescript
|
|
7213
|
+
* const destination: EarnCrossChainDepositDestination = {
|
|
7214
|
+
* chain: 'Arc_Testnet',
|
|
7215
|
+
* recipientAddress: '0x1234567890123456789012345678901234567890',
|
|
7216
|
+
* }
|
|
7217
|
+
* ```
|
|
7218
|
+
*/
|
|
7219
|
+
interface EarnCrossChainDepositDestination {
|
|
7220
|
+
/** Destination Earn chain where the vault is deployed. */
|
|
7221
|
+
readonly chain: EarnBridgeDestinationChainIdentifier;
|
|
7222
|
+
/** Destination wallet that receives the vault position. */
|
|
7223
|
+
readonly recipientAddress: string;
|
|
7224
|
+
}
|
|
7225
|
+
/**
|
|
7226
|
+
* Parameters for depositing into a DeFi lending vault from another chain.
|
|
7227
|
+
*
|
|
7228
|
+
* @remarks
|
|
7229
|
+
* Cross-chain Earn deposits currently support Ethereum Sepolia, Arbitrum
|
|
7230
|
+
* Sepolia, and Base Sepolia as source chains, with Arc Testnet as the Earn
|
|
7231
|
+
* destination chain.
|
|
7232
|
+
*
|
|
7233
|
+
* Cross-chain deposits require `from.adapter` to support EIP-712 typed-data
|
|
7234
|
+
* signing through `signTypedData`. Providers validate this capability at
|
|
7235
|
+
* runtime before preparing a bridge deposit.
|
|
7236
|
+
*
|
|
7237
|
+
* @typeParam TFromAdapterCapabilities - The adapter capabilities type
|
|
7238
|
+
*
|
|
7239
|
+
* @example
|
|
7240
|
+
* ```typescript
|
|
7241
|
+
* const params: CrossChainDepositParams = {
|
|
7242
|
+
* from: { adapter, chain: 'Ethereum_Sepolia' },
|
|
7243
|
+
* to: {
|
|
7244
|
+
* chain: 'Arc_Testnet',
|
|
7245
|
+
* recipientAddress: '0x1234567890123456789012345678901234567890',
|
|
7246
|
+
* },
|
|
7247
|
+
* vaultAddress: '0x...',
|
|
7248
|
+
* amount: '100.50',
|
|
7249
|
+
* maxFee: '0.028041',
|
|
7250
|
+
* }
|
|
7251
|
+
* ```
|
|
7252
|
+
*/
|
|
7253
|
+
interface CrossChainDepositParams<TFromAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities> {
|
|
7254
|
+
/** Source adapter context (wallet and source chain) for the deposit. */
|
|
7255
|
+
readonly from: EarnAdapterContext<TFromAdapterCapabilities, EarnBridgeSourceChainIdentifier>;
|
|
7256
|
+
/** Destination chain and recipient of the vault position. */
|
|
7257
|
+
readonly to: EarnCrossChainDepositDestination;
|
|
7258
|
+
/** On-chain vault contract address to deposit into. */
|
|
7259
|
+
readonly vaultAddress: string;
|
|
7260
|
+
/**
|
|
7261
|
+
* Amount to deposit in human-readable decimal format.
|
|
7262
|
+
*
|
|
7263
|
+
* @example '100.50' for 100.50 USDC
|
|
7264
|
+
*/
|
|
7265
|
+
readonly amount: string;
|
|
7266
|
+
/**
|
|
7267
|
+
* Maximum source-collected bridge fee the caller is willing to sign for, in
|
|
7268
|
+
* human-readable source token units.
|
|
7269
|
+
*
|
|
7270
|
+
* Derive this from a recent cross-chain deposit quote by summing
|
|
7271
|
+
* `quote.fees[].amount`. The prepared bridge bundle must not exceed this cap
|
|
7272
|
+
* before the source wallet signs its ERC-3009 authorization.
|
|
7273
|
+
*
|
|
7274
|
+
* @example '0.028041' for 0.028041 USDC
|
|
7275
|
+
*/
|
|
7276
|
+
readonly maxFee: string;
|
|
7277
|
+
/**
|
|
7278
|
+
* CCTP transfer speed for the source burn.
|
|
7279
|
+
*
|
|
7280
|
+
* `FAST` uses a low finality threshold for quicker settlement;
|
|
7281
|
+
* `SLOW` waits for full finality. Affects the source-collected fee.
|
|
7282
|
+
*/
|
|
7283
|
+
readonly transferSpeed?: TransferSpeed | `${TransferSpeed}` | undefined;
|
|
7284
|
+
/** Optional earn configuration. */
|
|
7285
|
+
readonly config?: EarnConfig | undefined;
|
|
7286
|
+
}
|
|
7287
|
+
/**
|
|
7288
|
+
* Parameters for depositing into a DeFi lending vault.
|
|
7289
|
+
*
|
|
7290
|
+
* @example
|
|
7291
|
+
* ```typescript
|
|
7292
|
+
* const sameChainParams: AnyDepositParams = {
|
|
7293
|
+
* from: { adapter, chain: 'Arc_Testnet' },
|
|
7294
|
+
* vaultAddress: '0x...',
|
|
7295
|
+
* amount: '100.50',
|
|
7296
|
+
* }
|
|
7297
|
+
*
|
|
7298
|
+
* const crossChainParams: AnyDepositParams = {
|
|
7299
|
+
* from: { adapter, chain: 'Ethereum_Sepolia' },
|
|
7300
|
+
* to: {
|
|
7301
|
+
* chain: 'Arc_Testnet',
|
|
7302
|
+
* recipientAddress: '0x1234567890123456789012345678901234567890',
|
|
7303
|
+
* },
|
|
7304
|
+
* vaultAddress: '0x...',
|
|
7305
|
+
* amount: '100.50',
|
|
7306
|
+
* }
|
|
7307
|
+
* ```
|
|
7308
|
+
*/
|
|
7309
|
+
type AnyDepositParams<TFromAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities> = SameChainDepositParams<TFromAdapterCapabilities> | CrossChainDepositParams<TFromAdapterCapabilities>;
|
|
6550
7310
|
/**
|
|
6551
7311
|
* Parameters for withdrawing from a DeFi lending vault.
|
|
6552
7312
|
*
|
|
@@ -6584,7 +7344,7 @@ interface WithdrawParams<TFromAdapterCapabilities extends AdapterCapabilities =
|
|
|
6584
7344
|
* ```typescript
|
|
6585
7345
|
* const params: ClaimRewardsParams = {
|
|
6586
7346
|
* from: { adapter, chain: 'Arc_Testnet' },
|
|
6587
|
-
* vaultAddress: '
|
|
7347
|
+
* vaultAddress: '0xAabbeF1D3971c710276ed41eC791BbE14CdB8E88',
|
|
6588
7348
|
* }
|
|
6589
7349
|
* ```
|
|
6590
7350
|
*/
|
|
@@ -6597,20 +7357,20 @@ interface ClaimRewardsParams<TFromAdapterCapabilities extends AdapterCapabilitie
|
|
|
6597
7357
|
readonly config?: EarnConfig | undefined;
|
|
6598
7358
|
}
|
|
6599
7359
|
/**
|
|
6600
|
-
* Parameters for getting a deposit quote.
|
|
7360
|
+
* Parameters for getting a same-chain deposit quote.
|
|
6601
7361
|
*
|
|
6602
7362
|
* @typeParam TFromAdapterCapabilities - The adapter capabilities type
|
|
6603
7363
|
*
|
|
6604
7364
|
* @example
|
|
6605
7365
|
* ```typescript
|
|
6606
|
-
* const params:
|
|
7366
|
+
* const params: SameChainGetDepositQuoteParams = {
|
|
6607
7367
|
* from: { adapter, chain: 'Arc_Testnet' },
|
|
6608
7368
|
* vaultAddress: '0x...',
|
|
6609
7369
|
* amount: '100.50',
|
|
6610
7370
|
* }
|
|
6611
7371
|
* ```
|
|
6612
7372
|
*/
|
|
6613
|
-
interface
|
|
7373
|
+
interface SameChainGetDepositQuoteParams<TFromAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities> {
|
|
6614
7374
|
/** Source adapter context (wallet and chain). */
|
|
6615
7375
|
readonly from: EarnAdapterContext<TFromAdapterCapabilities>;
|
|
6616
7376
|
/** On-chain vault contract address. */
|
|
@@ -6620,6 +7380,74 @@ interface GetDepositQuoteParams<TFromAdapterCapabilities extends AdapterCapabili
|
|
|
6620
7380
|
/** Optional earn configuration. */
|
|
6621
7381
|
readonly config?: EarnConfig | undefined;
|
|
6622
7382
|
}
|
|
7383
|
+
/**
|
|
7384
|
+
* Parameters for getting a cross-chain deposit quote.
|
|
7385
|
+
*
|
|
7386
|
+
* @remarks
|
|
7387
|
+
* Mirrors {@link CrossChainDepositParams}: previews a deposit whose funds
|
|
7388
|
+
* bridge from `from.chain` into a vault on the destination `chain`. The quote
|
|
7389
|
+
* is read-only (no `idempotencyKey`) and surfaces the bridge forwarder fee in
|
|
7390
|
+
* {@link EarnDepositQuoteInfo.fees}.
|
|
7391
|
+
*
|
|
7392
|
+
* @typeParam TFromAdapterCapabilities - The adapter capabilities type
|
|
7393
|
+
*
|
|
7394
|
+
* @example
|
|
7395
|
+
* ```typescript
|
|
7396
|
+
* const params: CrossChainGetDepositQuoteParams = {
|
|
7397
|
+
* from: { adapter, chain: 'Ethereum_Sepolia' },
|
|
7398
|
+
* chain: 'Arc_Testnet',
|
|
7399
|
+
* address: '0x1234567890123456789012345678901234567890',
|
|
7400
|
+
* vaultAddress: '0x...',
|
|
7401
|
+
* amount: '100.50',
|
|
7402
|
+
* }
|
|
7403
|
+
* ```
|
|
7404
|
+
*/
|
|
7405
|
+
interface CrossChainGetDepositQuoteParams<TFromAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities> {
|
|
7406
|
+
/** Source adapter context (wallet and source chain). */
|
|
7407
|
+
readonly from: EarnAdapterContext<TFromAdapterCapabilities, EarnBridgeSourceChainIdentifier>;
|
|
7408
|
+
/** Destination Earn chain where the vault is deployed. */
|
|
7409
|
+
readonly chain: EarnBridgeDestinationChainIdentifier;
|
|
7410
|
+
/** Destination wallet that receives the vault position. */
|
|
7411
|
+
readonly address: string;
|
|
7412
|
+
/** On-chain vault contract address. */
|
|
7413
|
+
readonly vaultAddress: string;
|
|
7414
|
+
/** Amount in human-readable decimal format. */
|
|
7415
|
+
readonly amount: string;
|
|
7416
|
+
/**
|
|
7417
|
+
* CCTP transfer speed to price the quote for.
|
|
7418
|
+
*
|
|
7419
|
+
* Should match the speed used at deposit time so the quoted forwarder fee
|
|
7420
|
+
* reflects the actual cost. `FAST` prices the low-finality path.
|
|
7421
|
+
*/
|
|
7422
|
+
readonly transferSpeed?: TransferSpeed | `${TransferSpeed}` | undefined;
|
|
7423
|
+
/** Optional earn configuration. */
|
|
7424
|
+
readonly config?: EarnConfig | undefined;
|
|
7425
|
+
}
|
|
7426
|
+
/**
|
|
7427
|
+
* Parameters for getting a deposit quote.
|
|
7428
|
+
*
|
|
7429
|
+
* Same-chain when only `from` is provided; cross-chain when a destination
|
|
7430
|
+
* `chain` (and destination `address`) are provided and differ from
|
|
7431
|
+
* `from.chain`.
|
|
7432
|
+
*
|
|
7433
|
+
* @example
|
|
7434
|
+
* ```typescript
|
|
7435
|
+
* const sameChainParams: GetDepositQuoteParams = {
|
|
7436
|
+
* from: { adapter, chain: 'Arc_Testnet' },
|
|
7437
|
+
* vaultAddress: '0x...',
|
|
7438
|
+
* amount: '100.50',
|
|
7439
|
+
* }
|
|
7440
|
+
*
|
|
7441
|
+
* const crossChainParams: GetDepositQuoteParams = {
|
|
7442
|
+
* from: { adapter, chain: 'Ethereum_Sepolia' },
|
|
7443
|
+
* chain: 'Arc_Testnet',
|
|
7444
|
+
* address: '0x1234567890123456789012345678901234567890',
|
|
7445
|
+
* vaultAddress: '0x...',
|
|
7446
|
+
* amount: '100.50',
|
|
7447
|
+
* }
|
|
7448
|
+
* ```
|
|
7449
|
+
*/
|
|
7450
|
+
type GetDepositQuoteParams<TFromAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities> = SameChainGetDepositQuoteParams<TFromAdapterCapabilities> | CrossChainGetDepositQuoteParams<TFromAdapterCapabilities>;
|
|
6623
7451
|
/**
|
|
6624
7452
|
* Parameters for getting a withdrawal quote.
|
|
6625
7453
|
*
|
|
@@ -6682,6 +7510,11 @@ type EarnGetVaultsResult = Omit<GetVaultsResult, 'vaults'> & {
|
|
|
6682
7510
|
/** Successfully resolved vault information. */
|
|
6683
7511
|
readonly vaults: readonly EarnVaultInfo[];
|
|
6684
7512
|
};
|
|
7513
|
+
/** Result of a vault discovery query. */
|
|
7514
|
+
type EarnExploreVaultsResult = Omit<ExploreVaultsResult, 'vaults'> & {
|
|
7515
|
+
/** Vaults matching the query, in the requested sort order. */
|
|
7516
|
+
readonly vaults: readonly EarnVaultInfo[];
|
|
7517
|
+
};
|
|
6685
7518
|
/** Accrued reward returned by the SDK in human-readable decimal form. */
|
|
6686
7519
|
type EarnAccruedRewardInfo = Omit<AccruedRewardInfo, 'amount'> & {
|
|
6687
7520
|
/** Accrued reward amount in human-readable decimal format. */
|
|
@@ -6742,16 +7575,18 @@ interface EarnClaimedRewardsResult {
|
|
|
6742
7575
|
*/
|
|
6743
7576
|
type EarnClaimRewardsResult = NoClaimableRewardsResult | EarnClaimedRewardsResult;
|
|
6744
7577
|
/** Result of a deposit quote operation. */
|
|
6745
|
-
type EarnDepositQuoteInfo = Omit<DepositQuoteInfo, 'deposit' | 'expectedShares' | 'fees'> & {
|
|
7578
|
+
type EarnDepositQuoteInfo = Omit<DepositQuoteInfo, 'deposit' | 'expectedShares' | 'fees' | 'gasFees'> & {
|
|
6746
7579
|
/** Deposit asset and amount in human-readable decimal format. */
|
|
6747
7580
|
readonly deposit: EarnAssetAmount;
|
|
6748
7581
|
/** Expected vault shares to receive in human-readable decimal format. */
|
|
6749
7582
|
readonly expectedShares: EarnAssetAmount;
|
|
6750
7583
|
/** Fees applied to the deposit in human-readable decimal format. */
|
|
6751
7584
|
readonly fees: readonly EarnAssetAmount[];
|
|
7585
|
+
/** Estimated native gas fees with amounts formatted as decimal strings. */
|
|
7586
|
+
readonly gasFees?: readonly EarnGasFeeEstimate[] | undefined;
|
|
6752
7587
|
};
|
|
6753
7588
|
/** Result of a withdrawal quote operation. */
|
|
6754
|
-
type EarnWithdrawalQuoteInfo = Omit<WithdrawalQuoteInfo, 'withdrawal' | 'sharesToRedeem' | 'maxWithdrawable' | 'fees'> & {
|
|
7589
|
+
type EarnWithdrawalQuoteInfo = Omit<WithdrawalQuoteInfo, 'withdrawal' | 'sharesToRedeem' | 'maxWithdrawable' | 'fees' | 'gasFees'> & {
|
|
6755
7590
|
/** The withdrawal amount being quoted in human-readable decimal format. */
|
|
6756
7591
|
readonly withdrawal: EarnAssetAmount;
|
|
6757
7592
|
/** Vault shares that would be redeemed in human-readable decimal format. */
|
|
@@ -6760,6 +7595,8 @@ type EarnWithdrawalQuoteInfo = Omit<WithdrawalQuoteInfo, 'withdrawal' | 'sharesT
|
|
|
6760
7595
|
readonly maxWithdrawable: EarnAssetAmount;
|
|
6761
7596
|
/** Fees applied to the withdrawal in human-readable decimal format. */
|
|
6762
7597
|
readonly fees: readonly EarnAssetAmount[];
|
|
7598
|
+
/** Estimated native gas fees with amounts formatted as decimal strings. */
|
|
7599
|
+
readonly gasFees?: readonly EarnGasFeeEstimate[] | undefined;
|
|
6763
7600
|
};
|
|
6764
7601
|
/** Result of a claim rewards quote operation. */
|
|
6765
7602
|
type EarnClaimRewardsQuoteInfo = Omit<ClaimRewardsQuoteInfo, 'rewards'> & {
|
|
@@ -6778,7 +7615,7 @@ type EarnClaimRewardsQuoteInfo = Omit<ClaimRewardsQuoteInfo, 'rewards'> & {
|
|
|
6778
7615
|
* }
|
|
6779
7616
|
* ```
|
|
6780
7617
|
*/
|
|
6781
|
-
type EarnOperationParams =
|
|
7618
|
+
type EarnOperationParams = AnyDepositParams | WithdrawParams | ClaimRewardsParams | GetVaultsParams | ExploreVaultsParams | ExploreVaultsIteratorParams | GetPositionParams | GetDepositQuoteParams | GetWithdrawalQuoteParams | GetClaimRewardsQuoteParams;
|
|
6782
7619
|
|
|
6783
7620
|
/**
|
|
6784
7621
|
* Parameters for initiating a cross-chain USDC bridge transfer.
|
|
@@ -6890,6 +7727,25 @@ interface BridgeParams<TFromAdapterCapabilities extends AdapterCapabilities = Ad
|
|
|
6890
7727
|
type SwapAdapterContext<TAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities> = Omit<AdapterContext<TAdapterCapabilities>, 'chain'> & {
|
|
6891
7728
|
chain: SwapChainIdentifier;
|
|
6892
7729
|
};
|
|
7730
|
+
/**
|
|
7731
|
+
* Destination details for same-chain or cross-chain swaps.
|
|
7732
|
+
*/
|
|
7733
|
+
interface SwapDestination {
|
|
7734
|
+
/**
|
|
7735
|
+
* Optional destination chain.
|
|
7736
|
+
*
|
|
7737
|
+
* Defaults to `from.chain` for same-chain swaps.
|
|
7738
|
+
*/
|
|
7739
|
+
chain?: SwapChainIdentifier;
|
|
7740
|
+
/**
|
|
7741
|
+
* Optional recipient address.
|
|
7742
|
+
*
|
|
7743
|
+
* Defaults to the source wallet address for same-chain swaps. Cross-chain
|
|
7744
|
+
* swaps require this field because the destination wallet may be on a
|
|
7745
|
+
* different chain/address format.
|
|
7746
|
+
*/
|
|
7747
|
+
recipientAddress?: string;
|
|
7748
|
+
}
|
|
6893
7749
|
/**
|
|
6894
7750
|
* Allowance strategy for token approvals during swap operations.
|
|
6895
7751
|
*
|
|
@@ -6964,10 +7820,11 @@ interface SwapConfig {
|
|
|
6964
7820
|
* callback approach via `setCustomFeePolicy()` instead.
|
|
6965
7821
|
*
|
|
6966
7822
|
* @remarks
|
|
6967
|
-
* - Service calculates fee using `estimatedAmount` for output fees
|
|
7823
|
+
* - Service calculates fee using `estimatedAmount` for same-chain output fees
|
|
7824
|
+
* - Cross-chain fees are always collected from the source-chain input token
|
|
6968
7825
|
* - Fee is sent to your configured `recipientAddress`
|
|
6969
7826
|
* - Single API call (efficient)
|
|
6970
|
-
* - Must be
|
|
7827
|
+
* - Must be greater than 0 and less than or equal to 10000 bps (100%)
|
|
6971
7828
|
*
|
|
6972
7829
|
* @example
|
|
6973
7830
|
* ```typescript
|
|
@@ -6983,8 +7840,9 @@ interface SwapConfig {
|
|
|
6983
7840
|
*
|
|
6984
7841
|
* 100 bps = 1%, 1000 bps = 10%, 10000 bps = 100%
|
|
6985
7842
|
*
|
|
6986
|
-
* Fee is calculated from `estimatedAmount` for output fees
|
|
6987
|
-
*
|
|
7843
|
+
* Fee is calculated from `estimatedAmount` for same-chain output fees and
|
|
7844
|
+
* from the input amount for cross-chain swaps.
|
|
7845
|
+
* Must be greater than 0 and less than or equal to 10000 (maximum 100%).
|
|
6988
7846
|
*
|
|
6989
7847
|
* For complex fee logic, use kit-level `setCustomFeePolicy()` instead.
|
|
6990
7848
|
*
|
|
@@ -6994,76 +7852,22 @@ interface SwapConfig {
|
|
|
6994
7852
|
/**
|
|
6995
7853
|
* Address that will receive the developer's 90% fee share.
|
|
6996
7854
|
*
|
|
6997
|
-
* Must be
|
|
7855
|
+
* Must be valid on the fee payout chain: source chain for input-side fees
|
|
7856
|
+
* and cross-chain swaps, destination chain for same-chain output-side fees.
|
|
6998
7857
|
*
|
|
6999
7858
|
* @example '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
|
|
7000
7859
|
*/
|
|
7001
7860
|
recipientAddress: string;
|
|
7002
7861
|
};
|
|
7003
7862
|
/**
|
|
7004
|
-
*
|
|
7863
|
+
* Stablecoin Service Kit Key used to authenticate service-backed swap
|
|
7864
|
+
* requests.
|
|
7005
7865
|
*
|
|
7006
|
-
*
|
|
7866
|
+
* Treat this value as a credential. Do not log it, embed it in client-side
|
|
7867
|
+
* source, or expose it in telemetry.
|
|
7007
7868
|
*/
|
|
7008
7869
|
kitKey?: string;
|
|
7009
7870
|
}
|
|
7010
|
-
/**
|
|
7011
|
-
* Parameters for initiating a single-chain stablecoin swap.
|
|
7012
|
-
*
|
|
7013
|
-
* This type is used as the primary input to swap operations, allowing users to specify
|
|
7014
|
-
* the source context, input/output tokens, swap amount, and optional configuration.
|
|
7015
|
-
*
|
|
7016
|
-
* SwapKit supports swaps between stablecoins (USDC, USDT, EURC, USDe, DAI, PYUSD),
|
|
7017
|
-
* wrapped tokens (WBTC, WETH, WSOL, WAVAX, WPOL), and native tokens
|
|
7018
|
-
* (e.g., ETH on Ethereum, SOL on Solana) via the `NATIVE` alias.
|
|
7019
|
-
*
|
|
7020
|
-
* - The `from` field specifies the source adapter context (wallet and chain).
|
|
7021
|
-
* The chain must be a {@link SwapChain} member (or its corresponding string
|
|
7022
|
-
* literal) so IDE autocomplete only surfaces swap-supported networks.
|
|
7023
|
-
* - The `tokenIn` field specifies the input token (see {@link SupportedToken}).
|
|
7024
|
-
* - The `tokenOut` field specifies the output token (see {@link SupportedToken}).
|
|
7025
|
-
* - The `amountIn` field is a human-readable decimal string (e.g., '10.5').
|
|
7026
|
-
* - The `config` field allows customization of swap behavior.
|
|
7027
|
-
*
|
|
7028
|
-
* @typeParam TFromAdapterCapabilities - The adapter capabilities type for the source adapter.
|
|
7029
|
-
*
|
|
7030
|
-
* @example
|
|
7031
|
-
* ```typescript
|
|
7032
|
-
* import { SwapParams } from '@circle-fin/swap-kit'
|
|
7033
|
-
* import { createViemAdapterFromPrivateKey } from '@circle-fin/adapter-viem-v2'
|
|
7034
|
-
*
|
|
7035
|
-
* const adapter = createViemAdapterFromPrivateKey({
|
|
7036
|
-
* privateKey: process.env.PRIVATE_KEY,
|
|
7037
|
-
* })
|
|
7038
|
-
*
|
|
7039
|
-
* // Swap 100.50 USDC for USDT
|
|
7040
|
-
* const params: SwapParams = {
|
|
7041
|
-
* from: { adapter, chain: 'Ethereum' },
|
|
7042
|
-
* tokenIn: 'USDC',
|
|
7043
|
-
* tokenOut: 'USDT',
|
|
7044
|
-
* amountIn: '100.50', // 100.50 USDC
|
|
7045
|
-
* config: {
|
|
7046
|
-
* slippageBps: 300, // 3% slippage
|
|
7047
|
-
* allowanceStrategy: 'permit'
|
|
7048
|
-
* }
|
|
7049
|
-
* }
|
|
7050
|
-
* ```
|
|
7051
|
-
*
|
|
7052
|
-
* @example
|
|
7053
|
-
* ```typescript
|
|
7054
|
-
* // Swap 0.05 ETH for USDC with explicit address and string literal chain
|
|
7055
|
-
* const paramsWithNative: SwapParams = {
|
|
7056
|
-
* from: {
|
|
7057
|
-
* adapter,
|
|
7058
|
-
* chain: 'Ethereum',
|
|
7059
|
-
* address: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
|
|
7060
|
-
* },
|
|
7061
|
-
* tokenIn: 'NATIVE',
|
|
7062
|
-
* tokenOut: 'USDC',
|
|
7063
|
-
* amountIn: '0.05' // 0.05 ETH
|
|
7064
|
-
* }
|
|
7065
|
-
* ```
|
|
7066
|
-
*/
|
|
7067
7871
|
interface SwapParams<TFromAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities> {
|
|
7068
7872
|
/**
|
|
7069
7873
|
* The source adapter context (wallet and chain) for the swap.
|
|
@@ -7092,6 +7896,13 @@ interface SwapParams<TFromAdapterCapabilities extends AdapterCapabilities = Adap
|
|
|
7092
7896
|
* (e.g., `'0.05'` for 0.05 USDC or 0.05 ETH).
|
|
7093
7897
|
*/
|
|
7094
7898
|
amountIn: string;
|
|
7899
|
+
/**
|
|
7900
|
+
* Optional destination chain/address.
|
|
7901
|
+
*
|
|
7902
|
+
* For same-chain swaps this may be omitted and the source wallet address is
|
|
7903
|
+
* used as the recipient. Cross-chain swaps require `recipientAddress`.
|
|
7904
|
+
*/
|
|
7905
|
+
to?: SwapDestination;
|
|
7095
7906
|
/**
|
|
7096
7907
|
* Optional configuration for swap behavior.
|
|
7097
7908
|
*
|
|
@@ -7147,8 +7958,8 @@ interface OperationParamsMap {
|
|
|
7147
7958
|
* ```typescript
|
|
7148
7959
|
* // Bridge operation - uses BridgeParams
|
|
7149
7960
|
* const bridgeFee = await context.getFee('bridge', {
|
|
7150
|
-
* from: {
|
|
7151
|
-
* to: {
|
|
7961
|
+
* from: { adapter: sourceAdapter, chain: 'Ethereum' },
|
|
7962
|
+
* to: { adapter: destAdapter, chain: 'Polygon' },
|
|
7152
7963
|
* amount: '100.50'
|
|
7153
7964
|
* })
|
|
7154
7965
|
* ```
|
|
@@ -7277,7 +8088,9 @@ interface AppKitContext {
|
|
|
7277
8088
|
* })
|
|
7278
8089
|
* ```
|
|
7279
8090
|
*/
|
|
7280
|
-
declare function deposit<TFromAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities>(context: AppKitContext, params:
|
|
8091
|
+
declare function deposit<TFromAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities>(context: AppKitContext, params: SameChainDepositParams<TFromAdapterCapabilities>): Promise<EarnSameChainDepositResult>;
|
|
8092
|
+
declare function deposit<TFromAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities>(context: AppKitContext, params: CrossChainDepositParams<TFromAdapterCapabilities>): Promise<EarnCrossChainDepositResult>;
|
|
8093
|
+
declare function deposit<TFromAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities>(context: AppKitContext, params: AnyDepositParams<TFromAdapterCapabilities>): Promise<EarnDepositOutcome>;
|
|
7281
8094
|
/**
|
|
7282
8095
|
* Execute an earn withdrawal operation.
|
|
7283
8096
|
*
|
|
@@ -7344,6 +8157,52 @@ declare function claimRewards<TFromAdapterCapabilities extends AdapterCapabiliti
|
|
|
7344
8157
|
* ```
|
|
7345
8158
|
*/
|
|
7346
8159
|
declare function getVaults(context: AppKitContext, params: GetVaultsParams): Promise<EarnGetVaultsResult>;
|
|
8160
|
+
/**
|
|
8161
|
+
* Discover vaults available on a chain.
|
|
8162
|
+
*
|
|
8163
|
+
* @param context - AppKit context
|
|
8164
|
+
* @param params - Discovery parameters. `chain` selects the chain; protocol, asset, APY, and TVL filters are optional
|
|
8165
|
+
* @returns Promise resolving to matching vaults with pagination metadata
|
|
8166
|
+
* @throws If EarnKit validation fails or no provider is configured
|
|
8167
|
+
*
|
|
8168
|
+
* @example
|
|
8169
|
+
* ```typescript
|
|
8170
|
+
* import { EarnChain } from '@circle-fin/app-kit'
|
|
8171
|
+
* import { createContext } from '@circle-fin/app-kit/context'
|
|
8172
|
+
* import { exploreVaults } from '@circle-fin/app-kit/earn'
|
|
8173
|
+
*
|
|
8174
|
+
* const context = createContext()
|
|
8175
|
+
* const result = await exploreVaults(context, {
|
|
8176
|
+
* chain: EarnChain.Arc_Testnet,
|
|
8177
|
+
* minApy: '0.03',
|
|
8178
|
+
* sortBy: 'apy',
|
|
8179
|
+
* })
|
|
8180
|
+
* ```
|
|
8181
|
+
*/
|
|
8182
|
+
declare function exploreVaults(context: AppKitContext, params: ExploreVaultsParams): Promise<EarnExploreVaultsResult>;
|
|
8183
|
+
/**
|
|
8184
|
+
* Lazily iterate every vault available on a chain.
|
|
8185
|
+
*
|
|
8186
|
+
* @param context - AppKit context
|
|
8187
|
+
* @param params - Discovery parameters (no `page`; the iterator manages it)
|
|
8188
|
+
* @returns An async generator yielding each matching vault
|
|
8189
|
+
* @throws If EarnKit validation fails or no provider is configured
|
|
8190
|
+
*
|
|
8191
|
+
* @example
|
|
8192
|
+
* ```typescript
|
|
8193
|
+
* import { EarnChain } from '@circle-fin/app-kit'
|
|
8194
|
+
* import { createContext } from '@circle-fin/app-kit/context'
|
|
8195
|
+
* import { exploreVaultsIterator } from '@circle-fin/app-kit/earn'
|
|
8196
|
+
*
|
|
8197
|
+
* const context = createContext()
|
|
8198
|
+
* for await (const vault of exploreVaultsIterator(context, {
|
|
8199
|
+
* chain: EarnChain.Arc_Testnet,
|
|
8200
|
+
* })) {
|
|
8201
|
+
* console.log(vault.name)
|
|
8202
|
+
* }
|
|
8203
|
+
* ```
|
|
8204
|
+
*/
|
|
8205
|
+
declare function exploreVaultsIterator(context: AppKitContext, params: ExploreVaultsIteratorParams): AsyncGenerator<EarnVaultInfo, void, undefined>;
|
|
7347
8206
|
/**
|
|
7348
8207
|
* Fetch a wallet position in a vault.
|
|
7349
8208
|
*
|
|
@@ -7366,6 +8225,49 @@ declare function getVaults(context: AppKitContext, params: GetVaultsParams): Pro
|
|
|
7366
8225
|
* ```
|
|
7367
8226
|
*/
|
|
7368
8227
|
declare function getPosition<TFromAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities>(context: AppKitContext, params: GetPositionParams<TFromAdapterCapabilities>): Promise<EarnPositionInfo>;
|
|
8228
|
+
/**
|
|
8229
|
+
* Fetch the current status of a cross-chain Earn deposit.
|
|
8230
|
+
*
|
|
8231
|
+
* @param context - AppKit context
|
|
8232
|
+
* @param params - Status query parameters identifying the deposit by execId
|
|
8233
|
+
* @returns Promise resolving to the structured cross-chain deposit status
|
|
8234
|
+
* @throws If EarnKit validation fails, no provider is configured, or the status request fails
|
|
8235
|
+
*
|
|
8236
|
+
* @example
|
|
8237
|
+
* ```typescript
|
|
8238
|
+
* import { createContext } from '@circle-fin/app-kit/context'
|
|
8239
|
+
* import { getCrossChainDepositStatus } from '@circle-fin/app-kit/earn'
|
|
8240
|
+
*
|
|
8241
|
+
* const context = createContext()
|
|
8242
|
+
* const status = await getCrossChainDepositStatus(context, {
|
|
8243
|
+
* execId: '550e8400-e29b-41d4-a716-446655440000',
|
|
8244
|
+
* })
|
|
8245
|
+
* console.log(status.status)
|
|
8246
|
+
* ```
|
|
8247
|
+
*/
|
|
8248
|
+
declare function getCrossChainDepositStatus(context: AppKitContext, params: GetCrossChainDepositStatusParams): Promise<EarnCrossChainDepositStatus>;
|
|
8249
|
+
/**
|
|
8250
|
+
* Poll a cross-chain Earn deposit until it reaches a terminal bridge state.
|
|
8251
|
+
*
|
|
8252
|
+
* @param context - AppKit context
|
|
8253
|
+
* @param params - Wait parameters including execId and optional polling knobs
|
|
8254
|
+
* @returns Promise resolving to the wait result and last observed bridge status
|
|
8255
|
+
* @throws If EarnKit validation fails, no provider is configured, or a status request fails
|
|
8256
|
+
*
|
|
8257
|
+
* @example
|
|
8258
|
+
* ```typescript
|
|
8259
|
+
* import { createContext } from '@circle-fin/app-kit/context'
|
|
8260
|
+
* import { waitForCrossChainDeposit } from '@circle-fin/app-kit/earn'
|
|
8261
|
+
*
|
|
8262
|
+
* const context = createContext()
|
|
8263
|
+
* const result = await waitForCrossChainDeposit(context, {
|
|
8264
|
+
* execId: '550e8400-e29b-41d4-a716-446655440000',
|
|
8265
|
+
* pollIntervalMs: 5_000,
|
|
8266
|
+
* })
|
|
8267
|
+
* console.log(result.outcome)
|
|
8268
|
+
* ```
|
|
8269
|
+
*/
|
|
8270
|
+
declare function waitForCrossChainDeposit(context: AppKitContext, params: WaitForCrossChainDepositParams): Promise<EarnCrossChainDepositWaitResult>;
|
|
7369
8271
|
/**
|
|
7370
8272
|
* Fetch a deposit quote.
|
|
7371
8273
|
*
|
|
@@ -7435,4 +8337,4 @@ declare function getWithdrawalQuote<TFromAdapterCapabilities extends AdapterCapa
|
|
|
7435
8337
|
*/
|
|
7436
8338
|
declare function getClaimRewardsQuote<TFromAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities>(context: AppKitContext, params: GetClaimRewardsQuoteParams<TFromAdapterCapabilities>): Promise<EarnClaimRewardsQuoteInfo>;
|
|
7437
8339
|
|
|
7438
|
-
export { claimRewards, deposit, getClaimRewardsQuote, getDepositQuote, getPosition, getVaults, getWithdrawalQuote, withdraw };
|
|
8340
|
+
export { claimRewards, deposit, exploreVaults, exploreVaultsIterator, getClaimRewardsQuote, getCrossChainDepositStatus, getDepositQuote, getPosition, getVaults, getWithdrawalQuote, waitForCrossChainDeposit, withdraw };
|