@stablechain/sdk 1.0.0 → 1.0.2

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.d.cts CHANGED
@@ -118,6 +118,12 @@ interface EarnDepositParams {
118
118
  slippageTolerance?: number;
119
119
  /** Deduplication key: if an operation with this key is already in flight, the same Promise is returned. */
120
120
  idempotencyKey?: string;
121
+ /**
122
+ * Maximum fraction of the vault's idle liquidity that this deposit may consume (e.g. 0.8 = 80%).
123
+ * The SDK throws StableValidationError before sending the transaction if the amount exceeds the cap.
124
+ * Must be > 0 and ≤ 1. Omit to disable the check.
125
+ */
126
+ depositBuffer?: number;
121
127
  }
122
128
  interface EarnWithdrawParams {
123
129
  /** Amount of underlying assets to withdraw (human-readable) */
@@ -167,6 +173,15 @@ interface BulkDepositOptions {
167
173
  */
168
174
  stopOnError?: boolean;
169
175
  }
176
+ interface BulkWithdrawOptions {
177
+ /** Batch-level deduplication key — if this batch is already in flight, the same Promise is returned. */
178
+ idempotencyKey?: string;
179
+ /**
180
+ * When true, the batch halts on the first failure and rejects.
181
+ * When false (default), all withdrawals are attempted and partial results are returned.
182
+ */
183
+ stopOnError?: boolean;
184
+ }
170
185
  /**
171
186
  * A single adapter position to forcibly deallocate before a force withdraw/redeem.
172
187
  * `amount` is in underlying asset units (human-readable).
@@ -206,6 +221,26 @@ interface ForceRedeemParams {
206
221
  /** Deduplication key */
207
222
  idempotencyKey?: string;
208
223
  }
224
+ interface VaultYieldReward {
225
+ /** Reward token symbol (e.g. "MORPHO") */
226
+ symbol: string;
227
+ /** Reward token contract address */
228
+ address: string;
229
+ /** APR contribution from this reward token as a decimal (e.g. 0.02 = 2%) */
230
+ apr: number;
231
+ }
232
+ interface VaultYield {
233
+ /** Total net APY after all fees, including rewards, as a decimal (e.g. 0.05 = 5%) */
234
+ apy: number;
235
+ /** Native yield component — underlying market rates after fees, excluding reward boosts */
236
+ native: number;
237
+ /** Per-token reward boosts */
238
+ rewards: VaultYieldReward[];
239
+ /** Performance fee as a decimal (e.g. 0.1 = 10%) */
240
+ performanceFee: number;
241
+ /** Management fee as a decimal */
242
+ managementFee: number;
243
+ }
209
244
  interface VaultPosition {
210
245
  /** Raw vault share balance */
211
246
  shares: bigint;
@@ -255,6 +290,7 @@ interface StableClient {
255
290
  deposit(params: EarnDepositParams): Promise<EarnResult>;
256
291
  bulkDeposit(items: EarnDepositParams[], options?: BulkDepositOptions): Promise<BulkEarnResult>;
257
292
  withdraw(params: EarnWithdrawParams): Promise<EarnResult>;
293
+ bulkWithdraw(items: EarnWithdrawParams[], options?: BulkWithdrawOptions): Promise<BulkEarnResult>;
258
294
  redeem(params: EarnRedeemParams): Promise<EarnResult>;
259
295
  forceWithdraw(params: ForceWithdrawParams): Promise<EarnResult>;
260
296
  forceRedeem(params: ForceRedeemParams): Promise<EarnResult>;
@@ -262,6 +298,8 @@ interface StableClient {
262
298
  }
263
299
  interface StableReader {
264
300
  earn: {
301
+ /** Current net APY for the configured vault. */
302
+ getYield(): Promise<VaultYield>;
265
303
  /** Current vault position (shares + asset value) for the configured user address. */
266
304
  position(): Promise<VaultPosition>;
267
305
  /** Projected yield over a given horizon, using Morpho's live net APY. */
@@ -348,4 +386,4 @@ declare class StableBulkError extends StableError {
348
386
  });
349
387
  }
350
388
 
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 };
389
+ export { type BridgeParams, type BridgeQuote, type BulkDepositOptions, type BulkEarnResult, type BulkEarnResultItem, type BulkWithdrawOptions, 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 VaultYield, type VaultYieldReward, type WithdrawStatus, type YieldPreview, createStable, createStableReader };
package/dist/index.d.ts CHANGED
@@ -118,6 +118,12 @@ interface EarnDepositParams {
118
118
  slippageTolerance?: number;
119
119
  /** Deduplication key: if an operation with this key is already in flight, the same Promise is returned. */
120
120
  idempotencyKey?: string;
121
+ /**
122
+ * Maximum fraction of the vault's idle liquidity that this deposit may consume (e.g. 0.8 = 80%).
123
+ * The SDK throws StableValidationError before sending the transaction if the amount exceeds the cap.
124
+ * Must be > 0 and ≤ 1. Omit to disable the check.
125
+ */
126
+ depositBuffer?: number;
121
127
  }
122
128
  interface EarnWithdrawParams {
123
129
  /** Amount of underlying assets to withdraw (human-readable) */
@@ -167,6 +173,15 @@ interface BulkDepositOptions {
167
173
  */
168
174
  stopOnError?: boolean;
169
175
  }
176
+ interface BulkWithdrawOptions {
177
+ /** Batch-level deduplication key — if this batch is already in flight, the same Promise is returned. */
178
+ idempotencyKey?: string;
179
+ /**
180
+ * When true, the batch halts on the first failure and rejects.
181
+ * When false (default), all withdrawals are attempted and partial results are returned.
182
+ */
183
+ stopOnError?: boolean;
184
+ }
170
185
  /**
171
186
  * A single adapter position to forcibly deallocate before a force withdraw/redeem.
172
187
  * `amount` is in underlying asset units (human-readable).
@@ -206,6 +221,26 @@ interface ForceRedeemParams {
206
221
  /** Deduplication key */
207
222
  idempotencyKey?: string;
208
223
  }
224
+ interface VaultYieldReward {
225
+ /** Reward token symbol (e.g. "MORPHO") */
226
+ symbol: string;
227
+ /** Reward token contract address */
228
+ address: string;
229
+ /** APR contribution from this reward token as a decimal (e.g. 0.02 = 2%) */
230
+ apr: number;
231
+ }
232
+ interface VaultYield {
233
+ /** Total net APY after all fees, including rewards, as a decimal (e.g. 0.05 = 5%) */
234
+ apy: number;
235
+ /** Native yield component — underlying market rates after fees, excluding reward boosts */
236
+ native: number;
237
+ /** Per-token reward boosts */
238
+ rewards: VaultYieldReward[];
239
+ /** Performance fee as a decimal (e.g. 0.1 = 10%) */
240
+ performanceFee: number;
241
+ /** Management fee as a decimal */
242
+ managementFee: number;
243
+ }
209
244
  interface VaultPosition {
210
245
  /** Raw vault share balance */
211
246
  shares: bigint;
@@ -255,6 +290,7 @@ interface StableClient {
255
290
  deposit(params: EarnDepositParams): Promise<EarnResult>;
256
291
  bulkDeposit(items: EarnDepositParams[], options?: BulkDepositOptions): Promise<BulkEarnResult>;
257
292
  withdraw(params: EarnWithdrawParams): Promise<EarnResult>;
293
+ bulkWithdraw(items: EarnWithdrawParams[], options?: BulkWithdrawOptions): Promise<BulkEarnResult>;
258
294
  redeem(params: EarnRedeemParams): Promise<EarnResult>;
259
295
  forceWithdraw(params: ForceWithdrawParams): Promise<EarnResult>;
260
296
  forceRedeem(params: ForceRedeemParams): Promise<EarnResult>;
@@ -262,6 +298,8 @@ interface StableClient {
262
298
  }
263
299
  interface StableReader {
264
300
  earn: {
301
+ /** Current net APY for the configured vault. */
302
+ getYield(): Promise<VaultYield>;
265
303
  /** Current vault position (shares + asset value) for the configured user address. */
266
304
  position(): Promise<VaultPosition>;
267
305
  /** Projected yield over a given horizon, using Morpho's live net APY. */
@@ -348,4 +386,4 @@ declare class StableBulkError extends StableError {
348
386
  });
349
387
  }
350
388
 
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 };
389
+ export { type BridgeParams, type BridgeQuote, type BulkDepositOptions, type BulkEarnResult, type BulkEarnResultItem, type BulkWithdrawOptions, 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 VaultYield, type VaultYieldReward, type WithdrawStatus, type YieldPreview, createStable, createStableReader };