@1delta/margin-fetcher 0.0.400 → 0.0.402
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.ts +101 -16
- package/dist/index.js +2101 -228
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -4541,7 +4541,7 @@ declare const resolveStCeloDepositGroup: (user: Address, requestedGroup?: string
|
|
|
4541
4541
|
* kept separate so the two providers can evolve independently without
|
|
4542
4542
|
* one provider's withdrawal taxonomy creep affecting the other.
|
|
4543
4543
|
*/
|
|
4544
|
-
type SavingsWithdrawalMode = 'instant' | 'fixed-cooldown' | 'queued' | 'request-based' | 'fee-or-queued';
|
|
4544
|
+
type SavingsWithdrawalMode = 'instant' | 'instant-capped' | 'fixed-cooldown' | 'queued' | 'request-based' | 'fee-or-queued';
|
|
4545
4545
|
/**
|
|
4546
4546
|
* Parsed savings-vault entry.
|
|
4547
4547
|
*
|
|
@@ -4603,9 +4603,13 @@ interface SavingsVault extends VaultClassificationFields {
|
|
|
4603
4603
|
/** Sum of `supplyRate + rewardsRate` — what a depositor actually
|
|
4604
4604
|
* earns. */
|
|
4605
4605
|
depositRate: number;
|
|
4606
|
-
/**
|
|
4607
|
-
*
|
|
4608
|
-
|
|
4606
|
+
/** Whether the share token implements ERC-4626. True for every entry
|
|
4607
|
+
* except Native's wNLP, which is a bespoke wrapper (`asset()`,
|
|
4608
|
+
* `totalAssets()` and `convertToAssets()` all revert) — the
|
|
4609
|
+
* `convertTo*` / `exchangeRate` fields below are still populated for
|
|
4610
|
+
* it, derived from its own rate getter. Parity with
|
|
4611
|
+
* `LstShareToken.isErc4626`. */
|
|
4612
|
+
isErc4626: boolean;
|
|
4609
4613
|
/** Whether the share token itself rebases. False for nearly every
|
|
4610
4614
|
* savings vault (they're the non-rebasing wrapper); rebasing
|
|
4611
4615
|
* surfaces sit on the underlying (e.g. USDe inside sUSDe). */
|
|
@@ -4619,12 +4623,51 @@ interface SavingsVault extends VaultClassificationFields {
|
|
|
4619
4623
|
mintContract?: string;
|
|
4620
4624
|
/** Withdrawal mechanism. */
|
|
4621
4625
|
withdrawalMode: SavingsWithdrawalMode;
|
|
4622
|
-
/**
|
|
4623
|
-
*
|
|
4624
|
-
*
|
|
4625
|
-
*
|
|
4626
|
-
*
|
|
4626
|
+
/** Waiting period in seconds before a requested redemption can be
|
|
4627
|
+
* claimed. For `fixed-cooldown` entries (Ethena, Avant) this is the
|
|
4628
|
+
* registry-pinned value. For `fee-or-queued` entries it is the
|
|
4629
|
+
* **live** on-chain queue window, which varies per asset (Native
|
|
4630
|
+
* runs 8 h on some pools and 3 days on most). */
|
|
4627
4631
|
withdrawalCooldownSeconds?: number;
|
|
4632
|
+
/**
|
|
4633
|
+
* Exit fee in basis points (`10` = 0.10 %) — same units and name as
|
|
4634
|
+
* `GearboxV3Pool.withdrawFeeBps`, so consumers read one field across
|
|
4635
|
+
* providers.
|
|
4636
|
+
*
|
|
4637
|
+
* **How it is charged** (Native): it is *not* a deposit fee, a
|
|
4638
|
+
* management fee, or a skim on yield — `exchangeRate` and `supplyRate`
|
|
4639
|
+
* are already net of everything Native takes on the way in. It is a
|
|
4640
|
+
* one-off haircut on the **instant** exit only, taken out of the
|
|
4641
|
+
* underlying paid to the receiver:
|
|
4642
|
+
*
|
|
4643
|
+
* received = shares × exchangeRate × (1 − withdrawFeeBps/10_000)
|
|
4644
|
+
*
|
|
4645
|
+
* so redeeming 9,867.98 wNLP-USDC worth 10,000 USDC returns 9,900 USDC
|
|
4646
|
+
* at 100 bps. The shares burn in full — the fee is deducted from the
|
|
4647
|
+
* payout, never charged as a separate transfer, so a caller does not
|
|
4648
|
+
* need to fund it or approve anything extra.
|
|
4649
|
+
*
|
|
4650
|
+
* The **queued** leg (`withdrawQueue`, after
|
|
4651
|
+
* `withdrawalCooldownSeconds`) pays out at par and does not touch this
|
|
4652
|
+
* field. Its cost is implicit instead: the payout is snapshotted when
|
|
4653
|
+
* the request is made, so yield accruing during the wait goes to the
|
|
4654
|
+
* protocol rather than the requester.
|
|
4655
|
+
*
|
|
4656
|
+
* `0` means the instant leg is free. Absent when the vault has no
|
|
4657
|
+
* instant leg at all.
|
|
4658
|
+
*/
|
|
4659
|
+
withdrawFeeBps?: number;
|
|
4660
|
+
/** Whether the instant leg is enabled at all — some assets are
|
|
4661
|
+
* queue-only. When `false`, `liquidity` is `0` regardless of the
|
|
4662
|
+
* protocol's inventory and `withdrawFeeBps` is unreachable. */
|
|
4663
|
+
instantRedeemEnabled?: boolean;
|
|
4664
|
+
/** Contract the instant leg draws from — Native's per-chain
|
|
4665
|
+
* `CreditVault`. Its underlying balance is what `liquidity`
|
|
4666
|
+
* measures. */
|
|
4667
|
+
inventoryContract?: string;
|
|
4668
|
+
/** Contract a delayed redemption is requested from and claimed
|
|
4669
|
+
* against, when it is not the share token itself. */
|
|
4670
|
+
withdrawQueue?: string;
|
|
4628
4671
|
/** Hydrated asset metadata from the provided token list, if any. */
|
|
4629
4672
|
asset?: GenericCurrency;
|
|
4630
4673
|
/** USD price of one underlying unit, if prices were supplied. */
|
|
@@ -4633,18 +4676,60 @@ interface SavingsVault extends VaultClassificationFields {
|
|
|
4633
4676
|
totalAssetsFormatted: number;
|
|
4634
4677
|
/** Human-formatted total assets in USD. */
|
|
4635
4678
|
totalAssetsUsd: number;
|
|
4636
|
-
/**
|
|
4637
|
-
*
|
|
4638
|
-
*
|
|
4639
|
-
*
|
|
4640
|
-
*
|
|
4641
|
-
*
|
|
4642
|
-
*
|
|
4679
|
+
/** Withdrawable underlying **right now**, raw integer string, per
|
|
4680
|
+
* `withdrawalMode`:
|
|
4681
|
+
* - `instant` — fully liquid (`= totalAssets`).
|
|
4682
|
+
* - `instant-capped` — settles in the same transaction, but only up
|
|
4683
|
+
* to a live inventory that is smaller than the vault: Spark
|
|
4684
|
+
* Savings V1 is capped by the PSM3 pocket's underlying balance
|
|
4685
|
+
* (6–29 % of TVL on the L2 deployments) and Spark Vaults V2 by the
|
|
4686
|
+
* vault's own idle balance (the rest is lent out through the Spark
|
|
4687
|
+
* Liquidity Layer). No fee and no cooldown on this leg — the
|
|
4688
|
+
* difference from `instant` is purely the size cap, and the
|
|
4689
|
+
* difference from `fee-or-queued` is that exceeding it costs
|
|
4690
|
+
* nothing extra, it simply cannot be done this block.
|
|
4691
|
+
* - `fee-or-queued` — the protocol's live instant-exit inventory,
|
|
4692
|
+
* clamped to `totalAssets`; `0` when the instant leg is disabled.
|
|
4693
|
+
* This is a **gross** figure: pulling it out instantly nets
|
|
4694
|
+
* `withdrawFeeBps` less (see that field). The queued leg is not
|
|
4695
|
+
* inventory-capped and pays at par, so `liquidity` is not a cap on
|
|
4696
|
+
* what the vault can ultimately return.
|
|
4697
|
+
* - `fixed-cooldown` / `queued` / `request-based` — `0`; these
|
|
4698
|
+
* require a waiting period.
|
|
4699
|
+
* A cooldown vault's underlying may still be redeemable after the
|
|
4700
|
+
* wait — this field is the *right now* figure, matching the
|
|
4701
|
+
* cross-provider `liquidity` semantic. */
|
|
4643
4702
|
liquidity: string;
|
|
4644
4703
|
/** Human-formatted withdrawable liquidity. */
|
|
4645
4704
|
liquidityFormatted: number;
|
|
4646
4705
|
/** Withdrawable liquidity in USD. */
|
|
4647
4706
|
liquidityUsd: number;
|
|
4707
|
+
/**
|
|
4708
|
+
* `liquidity / totalAssets`, clamped to `0…1` — the share of the vault a
|
|
4709
|
+
* holder could exit **this block**. `1 − instantLiquidityRatio` is the
|
|
4710
|
+
* share that must wait, so this is the vault's **lockup indicator**.
|
|
4711
|
+
*
|
|
4712
|
+
* Deliberately *not* called `utilization`. For a lending vault
|
|
4713
|
+
* utilization is `borrowed / supplied`, read from a debt accumulator;
|
|
4714
|
+
* none of these protocols expose one (Native's CreditVault and NTLP have
|
|
4715
|
+
* no debt getter at all, and the CreditVault commingles market-maker
|
|
4716
|
+
* collateral with pool inventory, so its balance can exceed the pool).
|
|
4717
|
+
* What this measures is exit **coverage**, which is the quantity that
|
|
4718
|
+
* actually predicts lockup — and unlike utilization it stays meaningful
|
|
4719
|
+
* for cooldown vaults that have no borrow side whatsoever.
|
|
4720
|
+
*
|
|
4721
|
+
* Reads per mode:
|
|
4722
|
+
* - `instant` → always `1` (fully liquid by construction).
|
|
4723
|
+
* - `fee-or-queued` → the live CreditVault coverage; the observed spread
|
|
4724
|
+
* across Native pools is the full `0…1` range, so it carries real
|
|
4725
|
+
* information (BNB `wNLP-T4B` sits near `0`, Ethereum `wNLP-USDC` at
|
|
4726
|
+
* `1`). Below `1` the remainder is not lost, just queued.
|
|
4727
|
+
* - `fixed-cooldown` / `queued` / `request-based` → always `0`; nothing
|
|
4728
|
+
* is redeemable without waiting.
|
|
4729
|
+
*
|
|
4730
|
+
* An empty vault reports `1` — there is nothing to be locked up.
|
|
4731
|
+
*/
|
|
4732
|
+
instantLiquidityRatio: number;
|
|
4648
4733
|
}
|
|
4649
4734
|
/**
|
|
4650
4735
|
* Full parsed payload: per-share-token-address map.
|