@stablechain/sdk 0.1.1 → 1.0.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/dist/index.cjs +545 -26
- package/dist/index.d.cts +187 -2
- package/dist/index.d.ts +187 -2
- package/dist/index.js +571 -52
- package/package.json +5 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { Account, Transport, WalletClient, Address, BaseError } from 'viem';
|
|
2
2
|
|
|
3
|
+
interface EarnConfig {
|
|
4
|
+
/** MetaMorpho V2 vault address */
|
|
5
|
+
vault: string;
|
|
6
|
+
}
|
|
3
7
|
interface StableConfig {
|
|
4
8
|
/** Target network — defaults to Network.Mainnet */
|
|
5
9
|
network?: Network;
|
|
@@ -11,6 +15,8 @@ interface StableConfig {
|
|
|
11
15
|
transport?: Transport;
|
|
12
16
|
/** Pre-configured viem WalletClient — takes precedence over account/transport. */
|
|
13
17
|
walletClient?: WalletClient;
|
|
18
|
+
/** Earn (Morpho V2 vault) configuration — required to use stable.earn.* methods. */
|
|
19
|
+
earn?: EarnConfig;
|
|
14
20
|
}
|
|
15
21
|
/**
|
|
16
22
|
* Unified result for transfer, bridge, and swap.
|
|
@@ -98,6 +104,146 @@ interface BridgeParams {
|
|
|
98
104
|
/** Pre-fetched quote from quoteBridge() — skips the quote fetch when passed to bridge() */
|
|
99
105
|
quote?: BridgeQuote;
|
|
100
106
|
}
|
|
107
|
+
interface EarnDepositParams {
|
|
108
|
+
/** Amount of underlying assets to deposit (human-readable) */
|
|
109
|
+
amount: number;
|
|
110
|
+
/** Vault address — overrides the vault set in StableConfig. Required when using bulkDeposit across multiple vaults. */
|
|
111
|
+
vault?: string;
|
|
112
|
+
/** Underlying asset decimals — fetched on-chain if omitted */
|
|
113
|
+
tokenDecimals?: number;
|
|
114
|
+
/**
|
|
115
|
+
* Slippage tolerance as a decimal (e.g. 0.003 = 0.3%).
|
|
116
|
+
* Defaults to Morpho's built-in default (0.03%).
|
|
117
|
+
*/
|
|
118
|
+
slippageTolerance?: number;
|
|
119
|
+
/** Deduplication key: if an operation with this key is already in flight, the same Promise is returned. */
|
|
120
|
+
idempotencyKey?: string;
|
|
121
|
+
}
|
|
122
|
+
interface EarnWithdrawParams {
|
|
123
|
+
/** Amount of underlying assets to withdraw (human-readable) */
|
|
124
|
+
amount: number;
|
|
125
|
+
/** Underlying asset decimals — fetched on-chain if omitted */
|
|
126
|
+
tokenDecimals?: number;
|
|
127
|
+
/** Deduplication key */
|
|
128
|
+
idempotencyKey?: string;
|
|
129
|
+
}
|
|
130
|
+
interface EarnRedeemParams {
|
|
131
|
+
/** Number of vault shares to redeem (human-readable, uses vault's share decimals) */
|
|
132
|
+
shares: number;
|
|
133
|
+
/** Vault share decimals — fetched on-chain if omitted */
|
|
134
|
+
shareDecimals?: number;
|
|
135
|
+
/** Deduplication key */
|
|
136
|
+
idempotencyKey?: string;
|
|
137
|
+
}
|
|
138
|
+
interface EarnResult {
|
|
139
|
+
txHash: string;
|
|
140
|
+
idempotencyKey?: string;
|
|
141
|
+
}
|
|
142
|
+
type BulkEarnResultItem = {
|
|
143
|
+
status: "fulfilled";
|
|
144
|
+
txHash: string;
|
|
145
|
+
vault?: string;
|
|
146
|
+
idempotencyKey?: string;
|
|
147
|
+
} | {
|
|
148
|
+
status: "rejected";
|
|
149
|
+
error: string;
|
|
150
|
+
vault?: string;
|
|
151
|
+
idempotencyKey?: string;
|
|
152
|
+
};
|
|
153
|
+
interface BulkEarnResult {
|
|
154
|
+
results: BulkEarnResultItem[];
|
|
155
|
+
/** Number of deposits that succeeded */
|
|
156
|
+
succeeded: number;
|
|
157
|
+
/** Number of deposits that failed */
|
|
158
|
+
failed: number;
|
|
159
|
+
idempotencyKey?: string;
|
|
160
|
+
}
|
|
161
|
+
interface BulkDepositOptions {
|
|
162
|
+
/** Batch-level deduplication key — if this batch is already in flight, the same Promise is returned. */
|
|
163
|
+
idempotencyKey?: string;
|
|
164
|
+
/**
|
|
165
|
+
* When true, the batch halts on the first failure and rejects.
|
|
166
|
+
* When false (default), all deposits are attempted and partial results are returned.
|
|
167
|
+
*/
|
|
168
|
+
stopOnError?: boolean;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* A single adapter position to forcibly deallocate before a force withdraw/redeem.
|
|
172
|
+
* `amount` is in underlying asset units (human-readable).
|
|
173
|
+
* `marketParams` is required only for Morpho Blue market adapters; omit for vault adapters.
|
|
174
|
+
*/
|
|
175
|
+
interface ForceDeallocation {
|
|
176
|
+
adapter: string;
|
|
177
|
+
amount: number;
|
|
178
|
+
marketParams?: {
|
|
179
|
+
loanToken: string;
|
|
180
|
+
collateralToken: string;
|
|
181
|
+
oracle: string;
|
|
182
|
+
irm: string;
|
|
183
|
+
/** LLTV scaled by WAD (1e18) */
|
|
184
|
+
lltv: bigint;
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
interface ForceWithdrawParams {
|
|
188
|
+
/** Amount of underlying assets to withdraw (human-readable) */
|
|
189
|
+
amount: number;
|
|
190
|
+
/** Underlying asset decimals — fetched on-chain if omitted */
|
|
191
|
+
tokenDecimals?: number;
|
|
192
|
+
/** Adapter positions to deallocate before the withdrawal */
|
|
193
|
+
deallocations: ForceDeallocation[];
|
|
194
|
+
/** Deduplication key */
|
|
195
|
+
idempotencyKey?: string;
|
|
196
|
+
}
|
|
197
|
+
interface ForceRedeemParams {
|
|
198
|
+
/** Number of vault shares to redeem (human-readable) */
|
|
199
|
+
shares: number;
|
|
200
|
+
/** Vault share decimals — fetched on-chain if omitted */
|
|
201
|
+
shareDecimals?: number;
|
|
202
|
+
/** Underlying asset decimals for deallocation amounts — fetched on-chain if omitted */
|
|
203
|
+
tokenDecimals?: number;
|
|
204
|
+
/** Adapter positions to deallocate before the redemption */
|
|
205
|
+
deallocations: ForceDeallocation[];
|
|
206
|
+
/** Deduplication key */
|
|
207
|
+
idempotencyKey?: string;
|
|
208
|
+
}
|
|
209
|
+
interface VaultPosition {
|
|
210
|
+
/** Raw vault share balance */
|
|
211
|
+
shares: bigint;
|
|
212
|
+
/** Human-readable share balance (shares formatted by shareDecimals) */
|
|
213
|
+
sharesFormatted: number;
|
|
214
|
+
/** Vault share token decimals */
|
|
215
|
+
shareDecimals: number;
|
|
216
|
+
/** Asset value of shares (human-readable) */
|
|
217
|
+
assets: number;
|
|
218
|
+
/** Underlying asset decimals */
|
|
219
|
+
tokenDecimals: number;
|
|
220
|
+
/** Underlying asset contract address */
|
|
221
|
+
assetAddress: string;
|
|
222
|
+
}
|
|
223
|
+
interface YieldPreview {
|
|
224
|
+
/** Expected yield over the period, in asset units (human-readable) */
|
|
225
|
+
projectedYield: number;
|
|
226
|
+
/** Annual percentage yield as a decimal (e.g. 0.05 = 5%) */
|
|
227
|
+
apy: number;
|
|
228
|
+
horizonDays: number;
|
|
229
|
+
}
|
|
230
|
+
interface WithdrawStatus {
|
|
231
|
+
/** True when the full amount can be withdrawn from idle vault liquidity immediately */
|
|
232
|
+
isInstant: boolean;
|
|
233
|
+
/** Instantly available liquidity in asset units (human-readable) */
|
|
234
|
+
availableLiquidity: number;
|
|
235
|
+
tokenDecimals: number;
|
|
236
|
+
}
|
|
237
|
+
interface StableReaderConfig {
|
|
238
|
+
/** Target network — defaults to Network.Mainnet */
|
|
239
|
+
network?: Network;
|
|
240
|
+
/** Optional RPC override */
|
|
241
|
+
rpc?: string;
|
|
242
|
+
/** Earn configuration — required for reader.earn.* methods */
|
|
243
|
+
earn?: EarnConfig;
|
|
244
|
+
/** Address of the user whose position to read */
|
|
245
|
+
address: string;
|
|
246
|
+
}
|
|
101
247
|
|
|
102
248
|
interface StableClient {
|
|
103
249
|
transfer(params: TransferParams): Promise<OperationResult>;
|
|
@@ -105,8 +251,33 @@ interface StableClient {
|
|
|
105
251
|
bridge(params: BridgeParams): Promise<OperationResult>;
|
|
106
252
|
quoteSwap(params: SwapParams): Promise<SwapQuote>;
|
|
107
253
|
swap(params: SwapParams): Promise<OperationResult>;
|
|
254
|
+
earn: {
|
|
255
|
+
deposit(params: EarnDepositParams): Promise<EarnResult>;
|
|
256
|
+
bulkDeposit(items: EarnDepositParams[], options?: BulkDepositOptions): Promise<BulkEarnResult>;
|
|
257
|
+
withdraw(params: EarnWithdrawParams): Promise<EarnResult>;
|
|
258
|
+
redeem(params: EarnRedeemParams): Promise<EarnResult>;
|
|
259
|
+
forceWithdraw(params: ForceWithdrawParams): Promise<EarnResult>;
|
|
260
|
+
forceRedeem(params: ForceRedeemParams): Promise<EarnResult>;
|
|
261
|
+
};
|
|
108
262
|
}
|
|
109
|
-
|
|
263
|
+
interface StableReader {
|
|
264
|
+
earn: {
|
|
265
|
+
/** Current vault position (shares + asset value) for the configured user address. */
|
|
266
|
+
position(): Promise<VaultPosition>;
|
|
267
|
+
/** Projected yield over a given horizon, using Morpho's live net APY. */
|
|
268
|
+
preview(params: {
|
|
269
|
+
amount: number;
|
|
270
|
+
horizonDays: number;
|
|
271
|
+
}): Promise<YieldPreview>;
|
|
272
|
+
/** Whether a given withdrawal amount can be fulfilled instantly from idle liquidity. */
|
|
273
|
+
withdrawability(params: {
|
|
274
|
+
amount: number;
|
|
275
|
+
tokenDecimals?: number;
|
|
276
|
+
}): Promise<WithdrawStatus>;
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
declare function createStable({ network, rpc: rpcOverride, account, transport, walletClient, earn: earnConfig, }: StableConfig): StableClient;
|
|
280
|
+
declare function createStableReader(config: StableReaderConfig): StableReader;
|
|
110
281
|
|
|
111
282
|
interface ChainConfig {
|
|
112
283
|
id: number;
|
|
@@ -117,6 +288,9 @@ interface ChainConfig {
|
|
|
117
288
|
}
|
|
118
289
|
declare const CHAIN_CONFIGS: Partial<Record<Chain, ChainConfig>>;
|
|
119
290
|
|
|
291
|
+
declare const STABLE_USDT_ADDRESS: Address;
|
|
292
|
+
declare const STABLE_VAULT_ADDRESS: Address;
|
|
293
|
+
|
|
120
294
|
declare class StableError extends BaseError {
|
|
121
295
|
}
|
|
122
296
|
declare class StableValidationError extends StableError {
|
|
@@ -162,5 +336,16 @@ declare class StableNetworkError extends StableError {
|
|
|
162
336
|
cause?: Error;
|
|
163
337
|
});
|
|
164
338
|
}
|
|
339
|
+
declare class StableBulkError extends StableError {
|
|
340
|
+
results: BulkEarnResultItem[];
|
|
341
|
+
succeeded: number;
|
|
342
|
+
failed: number;
|
|
343
|
+
constructor(args: {
|
|
344
|
+
shortMessage: string;
|
|
345
|
+
results: BulkEarnResultItem[];
|
|
346
|
+
succeeded: number;
|
|
347
|
+
failed: number;
|
|
348
|
+
});
|
|
349
|
+
}
|
|
165
350
|
|
|
166
|
-
export { type BridgeParams, type BridgeQuote, CHAIN_CONFIGS, Chain, type ChainConfig, Network, type OperationResult, type StableClient, type StableConfig, StableError, StableNetworkError, StableQuoteError, StableTransactionError, StableValidationError, type SwapParams, type SwapQuote, type TransferParams, createStable };
|
|
351
|
+
export { type BridgeParams, type BridgeQuote, type BulkDepositOptions, type BulkEarnResult, type BulkEarnResultItem, CHAIN_CONFIGS, Chain, type ChainConfig, type EarnConfig, type EarnDepositParams, type EarnRedeemParams, type EarnResult, type EarnWithdrawParams, type ForceDeallocation, type ForceRedeemParams, type ForceWithdrawParams, Network, type OperationResult, STABLE_USDT_ADDRESS, STABLE_VAULT_ADDRESS, StableBulkError, type StableClient, type StableConfig, StableError, StableNetworkError, StableQuoteError, type StableReader, type StableReaderConfig, StableTransactionError, StableValidationError, type SwapParams, type SwapQuote, type TransferParams, type VaultPosition, type WithdrawStatus, type YieldPreview, createStable, createStableReader };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { Account, Transport, WalletClient, Address, BaseError } from 'viem';
|
|
2
2
|
|
|
3
|
+
interface EarnConfig {
|
|
4
|
+
/** MetaMorpho V2 vault address */
|
|
5
|
+
vault: string;
|
|
6
|
+
}
|
|
3
7
|
interface StableConfig {
|
|
4
8
|
/** Target network — defaults to Network.Mainnet */
|
|
5
9
|
network?: Network;
|
|
@@ -11,6 +15,8 @@ interface StableConfig {
|
|
|
11
15
|
transport?: Transport;
|
|
12
16
|
/** Pre-configured viem WalletClient — takes precedence over account/transport. */
|
|
13
17
|
walletClient?: WalletClient;
|
|
18
|
+
/** Earn (Morpho V2 vault) configuration — required to use stable.earn.* methods. */
|
|
19
|
+
earn?: EarnConfig;
|
|
14
20
|
}
|
|
15
21
|
/**
|
|
16
22
|
* Unified result for transfer, bridge, and swap.
|
|
@@ -98,6 +104,146 @@ interface BridgeParams {
|
|
|
98
104
|
/** Pre-fetched quote from quoteBridge() — skips the quote fetch when passed to bridge() */
|
|
99
105
|
quote?: BridgeQuote;
|
|
100
106
|
}
|
|
107
|
+
interface EarnDepositParams {
|
|
108
|
+
/** Amount of underlying assets to deposit (human-readable) */
|
|
109
|
+
amount: number;
|
|
110
|
+
/** Vault address — overrides the vault set in StableConfig. Required when using bulkDeposit across multiple vaults. */
|
|
111
|
+
vault?: string;
|
|
112
|
+
/** Underlying asset decimals — fetched on-chain if omitted */
|
|
113
|
+
tokenDecimals?: number;
|
|
114
|
+
/**
|
|
115
|
+
* Slippage tolerance as a decimal (e.g. 0.003 = 0.3%).
|
|
116
|
+
* Defaults to Morpho's built-in default (0.03%).
|
|
117
|
+
*/
|
|
118
|
+
slippageTolerance?: number;
|
|
119
|
+
/** Deduplication key: if an operation with this key is already in flight, the same Promise is returned. */
|
|
120
|
+
idempotencyKey?: string;
|
|
121
|
+
}
|
|
122
|
+
interface EarnWithdrawParams {
|
|
123
|
+
/** Amount of underlying assets to withdraw (human-readable) */
|
|
124
|
+
amount: number;
|
|
125
|
+
/** Underlying asset decimals — fetched on-chain if omitted */
|
|
126
|
+
tokenDecimals?: number;
|
|
127
|
+
/** Deduplication key */
|
|
128
|
+
idempotencyKey?: string;
|
|
129
|
+
}
|
|
130
|
+
interface EarnRedeemParams {
|
|
131
|
+
/** Number of vault shares to redeem (human-readable, uses vault's share decimals) */
|
|
132
|
+
shares: number;
|
|
133
|
+
/** Vault share decimals — fetched on-chain if omitted */
|
|
134
|
+
shareDecimals?: number;
|
|
135
|
+
/** Deduplication key */
|
|
136
|
+
idempotencyKey?: string;
|
|
137
|
+
}
|
|
138
|
+
interface EarnResult {
|
|
139
|
+
txHash: string;
|
|
140
|
+
idempotencyKey?: string;
|
|
141
|
+
}
|
|
142
|
+
type BulkEarnResultItem = {
|
|
143
|
+
status: "fulfilled";
|
|
144
|
+
txHash: string;
|
|
145
|
+
vault?: string;
|
|
146
|
+
idempotencyKey?: string;
|
|
147
|
+
} | {
|
|
148
|
+
status: "rejected";
|
|
149
|
+
error: string;
|
|
150
|
+
vault?: string;
|
|
151
|
+
idempotencyKey?: string;
|
|
152
|
+
};
|
|
153
|
+
interface BulkEarnResult {
|
|
154
|
+
results: BulkEarnResultItem[];
|
|
155
|
+
/** Number of deposits that succeeded */
|
|
156
|
+
succeeded: number;
|
|
157
|
+
/** Number of deposits that failed */
|
|
158
|
+
failed: number;
|
|
159
|
+
idempotencyKey?: string;
|
|
160
|
+
}
|
|
161
|
+
interface BulkDepositOptions {
|
|
162
|
+
/** Batch-level deduplication key — if this batch is already in flight, the same Promise is returned. */
|
|
163
|
+
idempotencyKey?: string;
|
|
164
|
+
/**
|
|
165
|
+
* When true, the batch halts on the first failure and rejects.
|
|
166
|
+
* When false (default), all deposits are attempted and partial results are returned.
|
|
167
|
+
*/
|
|
168
|
+
stopOnError?: boolean;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* A single adapter position to forcibly deallocate before a force withdraw/redeem.
|
|
172
|
+
* `amount` is in underlying asset units (human-readable).
|
|
173
|
+
* `marketParams` is required only for Morpho Blue market adapters; omit for vault adapters.
|
|
174
|
+
*/
|
|
175
|
+
interface ForceDeallocation {
|
|
176
|
+
adapter: string;
|
|
177
|
+
amount: number;
|
|
178
|
+
marketParams?: {
|
|
179
|
+
loanToken: string;
|
|
180
|
+
collateralToken: string;
|
|
181
|
+
oracle: string;
|
|
182
|
+
irm: string;
|
|
183
|
+
/** LLTV scaled by WAD (1e18) */
|
|
184
|
+
lltv: bigint;
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
interface ForceWithdrawParams {
|
|
188
|
+
/** Amount of underlying assets to withdraw (human-readable) */
|
|
189
|
+
amount: number;
|
|
190
|
+
/** Underlying asset decimals — fetched on-chain if omitted */
|
|
191
|
+
tokenDecimals?: number;
|
|
192
|
+
/** Adapter positions to deallocate before the withdrawal */
|
|
193
|
+
deallocations: ForceDeallocation[];
|
|
194
|
+
/** Deduplication key */
|
|
195
|
+
idempotencyKey?: string;
|
|
196
|
+
}
|
|
197
|
+
interface ForceRedeemParams {
|
|
198
|
+
/** Number of vault shares to redeem (human-readable) */
|
|
199
|
+
shares: number;
|
|
200
|
+
/** Vault share decimals — fetched on-chain if omitted */
|
|
201
|
+
shareDecimals?: number;
|
|
202
|
+
/** Underlying asset decimals for deallocation amounts — fetched on-chain if omitted */
|
|
203
|
+
tokenDecimals?: number;
|
|
204
|
+
/** Adapter positions to deallocate before the redemption */
|
|
205
|
+
deallocations: ForceDeallocation[];
|
|
206
|
+
/** Deduplication key */
|
|
207
|
+
idempotencyKey?: string;
|
|
208
|
+
}
|
|
209
|
+
interface VaultPosition {
|
|
210
|
+
/** Raw vault share balance */
|
|
211
|
+
shares: bigint;
|
|
212
|
+
/** Human-readable share balance (shares formatted by shareDecimals) */
|
|
213
|
+
sharesFormatted: number;
|
|
214
|
+
/** Vault share token decimals */
|
|
215
|
+
shareDecimals: number;
|
|
216
|
+
/** Asset value of shares (human-readable) */
|
|
217
|
+
assets: number;
|
|
218
|
+
/** Underlying asset decimals */
|
|
219
|
+
tokenDecimals: number;
|
|
220
|
+
/** Underlying asset contract address */
|
|
221
|
+
assetAddress: string;
|
|
222
|
+
}
|
|
223
|
+
interface YieldPreview {
|
|
224
|
+
/** Expected yield over the period, in asset units (human-readable) */
|
|
225
|
+
projectedYield: number;
|
|
226
|
+
/** Annual percentage yield as a decimal (e.g. 0.05 = 5%) */
|
|
227
|
+
apy: number;
|
|
228
|
+
horizonDays: number;
|
|
229
|
+
}
|
|
230
|
+
interface WithdrawStatus {
|
|
231
|
+
/** True when the full amount can be withdrawn from idle vault liquidity immediately */
|
|
232
|
+
isInstant: boolean;
|
|
233
|
+
/** Instantly available liquidity in asset units (human-readable) */
|
|
234
|
+
availableLiquidity: number;
|
|
235
|
+
tokenDecimals: number;
|
|
236
|
+
}
|
|
237
|
+
interface StableReaderConfig {
|
|
238
|
+
/** Target network — defaults to Network.Mainnet */
|
|
239
|
+
network?: Network;
|
|
240
|
+
/** Optional RPC override */
|
|
241
|
+
rpc?: string;
|
|
242
|
+
/** Earn configuration — required for reader.earn.* methods */
|
|
243
|
+
earn?: EarnConfig;
|
|
244
|
+
/** Address of the user whose position to read */
|
|
245
|
+
address: string;
|
|
246
|
+
}
|
|
101
247
|
|
|
102
248
|
interface StableClient {
|
|
103
249
|
transfer(params: TransferParams): Promise<OperationResult>;
|
|
@@ -105,8 +251,33 @@ interface StableClient {
|
|
|
105
251
|
bridge(params: BridgeParams): Promise<OperationResult>;
|
|
106
252
|
quoteSwap(params: SwapParams): Promise<SwapQuote>;
|
|
107
253
|
swap(params: SwapParams): Promise<OperationResult>;
|
|
254
|
+
earn: {
|
|
255
|
+
deposit(params: EarnDepositParams): Promise<EarnResult>;
|
|
256
|
+
bulkDeposit(items: EarnDepositParams[], options?: BulkDepositOptions): Promise<BulkEarnResult>;
|
|
257
|
+
withdraw(params: EarnWithdrawParams): Promise<EarnResult>;
|
|
258
|
+
redeem(params: EarnRedeemParams): Promise<EarnResult>;
|
|
259
|
+
forceWithdraw(params: ForceWithdrawParams): Promise<EarnResult>;
|
|
260
|
+
forceRedeem(params: ForceRedeemParams): Promise<EarnResult>;
|
|
261
|
+
};
|
|
108
262
|
}
|
|
109
|
-
|
|
263
|
+
interface StableReader {
|
|
264
|
+
earn: {
|
|
265
|
+
/** Current vault position (shares + asset value) for the configured user address. */
|
|
266
|
+
position(): Promise<VaultPosition>;
|
|
267
|
+
/** Projected yield over a given horizon, using Morpho's live net APY. */
|
|
268
|
+
preview(params: {
|
|
269
|
+
amount: number;
|
|
270
|
+
horizonDays: number;
|
|
271
|
+
}): Promise<YieldPreview>;
|
|
272
|
+
/** Whether a given withdrawal amount can be fulfilled instantly from idle liquidity. */
|
|
273
|
+
withdrawability(params: {
|
|
274
|
+
amount: number;
|
|
275
|
+
tokenDecimals?: number;
|
|
276
|
+
}): Promise<WithdrawStatus>;
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
declare function createStable({ network, rpc: rpcOverride, account, transport, walletClient, earn: earnConfig, }: StableConfig): StableClient;
|
|
280
|
+
declare function createStableReader(config: StableReaderConfig): StableReader;
|
|
110
281
|
|
|
111
282
|
interface ChainConfig {
|
|
112
283
|
id: number;
|
|
@@ -117,6 +288,9 @@ interface ChainConfig {
|
|
|
117
288
|
}
|
|
118
289
|
declare const CHAIN_CONFIGS: Partial<Record<Chain, ChainConfig>>;
|
|
119
290
|
|
|
291
|
+
declare const STABLE_USDT_ADDRESS: Address;
|
|
292
|
+
declare const STABLE_VAULT_ADDRESS: Address;
|
|
293
|
+
|
|
120
294
|
declare class StableError extends BaseError {
|
|
121
295
|
}
|
|
122
296
|
declare class StableValidationError extends StableError {
|
|
@@ -162,5 +336,16 @@ declare class StableNetworkError extends StableError {
|
|
|
162
336
|
cause?: Error;
|
|
163
337
|
});
|
|
164
338
|
}
|
|
339
|
+
declare class StableBulkError extends StableError {
|
|
340
|
+
results: BulkEarnResultItem[];
|
|
341
|
+
succeeded: number;
|
|
342
|
+
failed: number;
|
|
343
|
+
constructor(args: {
|
|
344
|
+
shortMessage: string;
|
|
345
|
+
results: BulkEarnResultItem[];
|
|
346
|
+
succeeded: number;
|
|
347
|
+
failed: number;
|
|
348
|
+
});
|
|
349
|
+
}
|
|
165
350
|
|
|
166
|
-
export { type BridgeParams, type BridgeQuote, CHAIN_CONFIGS, Chain, type ChainConfig, Network, type OperationResult, type StableClient, type StableConfig, StableError, StableNetworkError, StableQuoteError, StableTransactionError, StableValidationError, type SwapParams, type SwapQuote, type TransferParams, createStable };
|
|
351
|
+
export { type BridgeParams, type BridgeQuote, type BulkDepositOptions, type BulkEarnResult, type BulkEarnResultItem, CHAIN_CONFIGS, Chain, type ChainConfig, type EarnConfig, type EarnDepositParams, type EarnRedeemParams, type EarnResult, type EarnWithdrawParams, type ForceDeallocation, type ForceRedeemParams, type ForceWithdrawParams, Network, type OperationResult, STABLE_USDT_ADDRESS, STABLE_VAULT_ADDRESS, StableBulkError, type StableClient, type StableConfig, StableError, StableNetworkError, StableQuoteError, type StableReader, type StableReaderConfig, StableTransactionError, StableValidationError, type SwapParams, type SwapQuote, type TransferParams, type VaultPosition, type WithdrawStatus, type YieldPreview, createStable, createStableReader };
|