@1delta/margin-fetcher 5.0.118 → 5.0.120
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/ccip-SBJNLXE4.js +5 -0
- package/dist/{ccip-UXZECBO3.js.map → ccip-SBJNLXE4.js.map} +1 -1
- package/dist/{chunk-JUYF2XLF.js → chunk-GZR3D6YQ.js} +39 -4
- package/dist/chunk-GZR3D6YQ.js.map +1 -0
- package/dist/index.d.ts +139 -26
- package/dist/index.js +5641 -827
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/dist/ccip-UXZECBO3.js +0 -5
- package/dist/chunk-JUYF2XLF.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -6003,6 +6003,51 @@ interface OraclePriceEntry {
|
|
|
6003
6003
|
* third-party entries still classify sensibly from `baseAsset`/`staticBase`.
|
|
6004
6004
|
*/
|
|
6005
6005
|
derivation?: PriceDerivation;
|
|
6006
|
+
/**
|
|
6007
|
+
* A last-resort price: it is selected for an asset group only when NO other
|
|
6008
|
+
* candidate prices it, and it never takes part in the outlier consensus of a
|
|
6009
|
+
* group that has one. For sources that know a price but are not an oracle
|
|
6010
|
+
* for the asset — Pendle's quote of a market's underlying
|
|
6011
|
+
* (`fetchers/pendle.ts`), which exists for every PT underlying whether or
|
|
6012
|
+
* not any lender lists it.
|
|
6013
|
+
*/
|
|
6014
|
+
fallbackOnly?: boolean;
|
|
6015
|
+
/**
|
|
6016
|
+
* The opposite of `fallbackOnly`: when ANY entry for an asset group carries
|
|
6017
|
+
* it, the group's flat price is chosen among those entries ALONE — every
|
|
6018
|
+
* oracle candidate is ignored for the flat map (it keeps its own per-market
|
|
6019
|
+
* entry, so `depositsUSDOracle` is unaffected). For a distressed asset whose
|
|
6020
|
+
* lending oracles still read par (`fetchers/distressed.ts`): NUSD, msUSD,
|
|
6021
|
+
* AVLT. Use only with a measured, on-chain realizable value.
|
|
6022
|
+
*/
|
|
6023
|
+
authoritative?: boolean;
|
|
6024
|
+
/**
|
|
6025
|
+
* The asset's ISSUER exchange rate: it is a vault share / LST / wrapper
|
|
6026
|
+
* worth `rate` units of `underlying`, as the contract (or program) that
|
|
6027
|
+
* issues it states — ERC-4626 `convertToAssets`, a stake pool's
|
|
6028
|
+
* `totalLamports / poolTokenSupply`, a fund's NAV (`fetchers/shareRate.ts`,
|
|
6029
|
+
* margin-fetcher-sol's twin). `selectAssetGroupPrices` prices the entry at
|
|
6030
|
+
* `rate × the SELECTED price of the underlying's group` (falling back to
|
|
6031
|
+
* `SelectPricesOptions.referencePrices`, then to this entry's own
|
|
6032
|
+
* `priceUSD`, which is only the fetch-time estimate and may be 0) and
|
|
6033
|
+
* ranks it ahead of every lender oracle — for a share, every lender oracle
|
|
6034
|
+
* is a valuation the lender chose (a hardcoded 1, the underlying's feed
|
|
6035
|
+
* 1:1), not its value.
|
|
6036
|
+
*/
|
|
6037
|
+
shareRate?: ShareRate;
|
|
6038
|
+
}
|
|
6039
|
+
/** An issuer exchange rate — see `OraclePriceEntry.shareRate`. */
|
|
6040
|
+
interface ShareRate {
|
|
6041
|
+
/** Units of `underlying` per ONE whole unit of the asset (decimals applied). */
|
|
6042
|
+
rate: number;
|
|
6043
|
+
/**
|
|
6044
|
+
* The underlying's address on the entry's chain (lower-case hex on EVM,
|
|
6045
|
+
* verbatim base58 on Solana); its token-list `assetGroup` is what the rate
|
|
6046
|
+
* is resolved against.
|
|
6047
|
+
*/
|
|
6048
|
+
underlying: string;
|
|
6049
|
+
/** What was read (`'convertToAssets'`, `'mellow:getReport'`) — diagnostics. */
|
|
6050
|
+
source?: string;
|
|
6006
6051
|
}
|
|
6007
6052
|
/**
|
|
6008
6053
|
* Quality class of a USD price, in descending order of trust.
|
|
@@ -6638,11 +6683,23 @@ interface SelectPricesOptions {
|
|
|
6638
6683
|
* require re-deriving the whole pipeline.
|
|
6639
6684
|
*/
|
|
6640
6685
|
onSelection?: (selection: PriceSelection) => void;
|
|
6686
|
+
/**
|
|
6687
|
+
* Group prices to resolve a share rate's UNDERLYING against when this run
|
|
6688
|
+
* selected no price for it — the last published map, so a share whose
|
|
6689
|
+
* underlying is priced on another writer's chains still resolves (sUSDa's
|
|
6690
|
+
* USDa is priced on Sonic, its vault rate is read on Ethereum). This run's
|
|
6691
|
+
* own selection wins over it.
|
|
6692
|
+
*/
|
|
6693
|
+
referencePrices?: USDPriceMap;
|
|
6641
6694
|
}
|
|
6642
6695
|
/**
|
|
6643
6696
|
* Flattens structured oracle prices to a simple USD price map.
|
|
6644
6697
|
*
|
|
6645
6698
|
* Ranking, in order:
|
|
6699
|
+
* 0. source — an issuer share rate (`entry.shareRate`, priced at
|
|
6700
|
+
* rate × the SELECTED price of its underlying's group)
|
|
6701
|
+
* beats every lender oracle; a `fallbackOnly` price only
|
|
6702
|
+
* counts where nothing else prices the group
|
|
6646
6703
|
* 1. freshness — past this feed's own learned cadence loses
|
|
6647
6704
|
* 2. reliability — a feed that habitually disagrees with the market loses
|
|
6648
6705
|
* 3. derivation — a direct oracle read beats a price derived from one
|
|
@@ -10068,9 +10125,10 @@ type AaveEarnVaults = {
|
|
|
10068
10125
|
/**
|
|
10069
10126
|
* Parsed Upshift vault entry.
|
|
10070
10127
|
*
|
|
10071
|
-
* Upshift vaults are curator-run ERC-4626-style yield vaults
|
|
10072
|
-
*
|
|
10073
|
-
*
|
|
10128
|
+
* Upshift vaults are curator-run ERC-4626-style yield vaults, listed by
|
|
10129
|
+
* August Digital's catalogue (`api.augustdigital.io/api/v1/tokenized_vault`)
|
|
10130
|
+
* and read on-chain for everything a transaction depends on (see `api.ts`).
|
|
10131
|
+
* The deposit contract (`vaultAddress`) and the receipt/share
|
|
10074
10132
|
* token a depositor actually holds (`address`) can differ on the newer
|
|
10075
10133
|
* `evm-2` vaults, so we key the vault by the **receipt** token — that's
|
|
10076
10134
|
* what shows up in a user's wallet and what the user-balance lookup
|
|
@@ -10140,20 +10198,43 @@ interface UpshiftVault extends VaultClassificationFields {
|
|
|
10140
10198
|
* scaled (`totalAssets * 10**shareDecimals / totalSupply`). `'0'` for
|
|
10141
10199
|
* an empty vault. */
|
|
10142
10200
|
pricePerShare: string;
|
|
10143
|
-
/**
|
|
10201
|
+
/**
|
|
10202
|
+
* Base rate, nominal APR in percent: the vault's REALIZED share-price
|
|
10203
|
+
* return over its published horizon (`historical_apy`, simple-annualised —
|
|
10204
|
+
* see `augustRealizedRate`). Negative when the vault lost value over the
|
|
10205
|
+
* window. `0` with `rateSource: 'unavailable'` when no window is published.
|
|
10206
|
+
*
|
|
10207
|
+
* Until 2026-10-17 this was the curator's TARGET (`apy.apy`), which put a
|
|
10208
|
+
* 9.53 % rate on upNUSD while its share price had fallen 23 % and an
|
|
10209
|
+
* 18.2 % rate on Upshift Gamma USDC over a −0.1 % realized month.
|
|
10210
|
+
*/
|
|
10144
10211
|
supplyRate: number;
|
|
10145
|
-
/**
|
|
10146
|
-
|
|
10212
|
+
/** Where `supplyRate` came from. */
|
|
10213
|
+
rateSource: 'realized-7d' | 'realized-30d' | 'unavailable';
|
|
10214
|
+
/**
|
|
10215
|
+
* The measurement window, in the vocabulary the term-sheet builder reads
|
|
10216
|
+
* (`weekly` | `monthly`, as on Lagoon rows), so the sheet states the window
|
|
10217
|
+
* the rate was measured over instead of an undated "trailing".
|
|
10218
|
+
*/
|
|
10219
|
+
aprWindow?: 'weekly' | 'monthly';
|
|
10220
|
+
/** The curator's stated APY in percent (override or target) — what the
|
|
10221
|
+
* Upshift app headlines on some vaults. Informational, never the rate. */
|
|
10222
|
+
targetApy?: number;
|
|
10223
|
+
/** Incentive / campaign APR in percent (`campaign_apy`, which Upshift
|
|
10224
|
+
* publishes as a percent APY). Kept separate from the base rate. */
|
|
10147
10225
|
rewardsRate: number;
|
|
10148
10226
|
/** `supplyRate + rewardsRate` — total APR a depositor earns. */
|
|
10149
10227
|
depositRate: number;
|
|
10150
|
-
/** All APY components reported by the API (percent), for transparency.
|
|
10228
|
+
/** All APY components reported by the API (percent), for transparency.
|
|
10229
|
+
* `base` is the curator's stated APY, the same number as `targetApy`. */
|
|
10151
10230
|
apy: {
|
|
10152
10231
|
base: number | null;
|
|
10153
10232
|
campaign: number | null;
|
|
10154
10233
|
points: number | null;
|
|
10155
10234
|
underlying: number | null;
|
|
10156
10235
|
};
|
|
10236
|
+
/** Underlying per share, human units (`totalAssets / totalSupply`). */
|
|
10237
|
+
sharePrice: number;
|
|
10157
10238
|
/**
|
|
10158
10239
|
* EFFECTIVE performance fee in percent — `0` when the curator has waived it.
|
|
10159
10240
|
* Read by the term-sheet builder as `input.fee`.
|
|
@@ -10243,34 +10324,42 @@ type UpshiftVaults = {
|
|
|
10243
10324
|
* One-shot fetcher for the Upshift vaults on a chain (see
|
|
10244
10325
|
* {@link isServable} for which of them we serve).
|
|
10245
10326
|
*
|
|
10246
|
-
* HTTP
|
|
10247
|
-
*
|
|
10248
|
-
*
|
|
10249
|
-
* deployment
|
|
10327
|
+
* The catalogue is HTTP (August's API); totals, receipt, accepted assets,
|
|
10328
|
+
* pause flags, redemption delay and caps are read on-chain through
|
|
10329
|
+
* `multicallRetry` (see `api.ts`). Returns an empty map for chains without
|
|
10330
|
+
* an Upshift deployment; THROWS when the listing cannot be produced, so an
|
|
10331
|
+
* outage is never served as "no vaults".
|
|
10250
10332
|
*
|
|
10251
|
-
* @param chainId
|
|
10252
|
-
* @param prices
|
|
10253
|
-
* @param tokenList
|
|
10333
|
+
* @param chainId target chain
|
|
10334
|
+
* @param prices optional price map keyed by oracle key / underlying
|
|
10335
|
+
* @param tokenList optional token list for hydrating `asset` metadata
|
|
10336
|
+
* @param multicallRetry multicall executor for the contract reads
|
|
10337
|
+
* (defaults to the providers package's ladder)
|
|
10254
10338
|
*
|
|
10255
10339
|
* @returns `UpshiftVaults` — map keyed by lowercased receipt-token address.
|
|
10256
10340
|
*/
|
|
10257
10341
|
declare const fetchUpshiftVaults: (chainId: string, prices?: {
|
|
10258
10342
|
[asset: string]: number;
|
|
10259
|
-
}, tokenList?: GenericTokenList) => Promise<UpshiftVaults>;
|
|
10343
|
+
}, tokenList?: GenericTokenList, multicallRetry?: MulticallRetryFunction) => Promise<UpshiftVaults>;
|
|
10260
10344
|
|
|
10261
10345
|
/**
|
|
10262
10346
|
* Upshift public vault listing.
|
|
10263
10347
|
*
|
|
10264
|
-
*
|
|
10265
|
-
*
|
|
10266
|
-
*
|
|
10267
|
-
*
|
|
10268
|
-
*
|
|
10348
|
+
* PRIMARY: August Digital's catalogue (`UPSHIFT_AUGUST_VAULTS_URL`, see
|
|
10349
|
+
* `august.ts`) joined with the contract state we read ourselves
|
|
10350
|
+
* (`onchain.ts`) — the same two halves August's SDK assembles.
|
|
10351
|
+
*
|
|
10352
|
+
* FALLBACK: the app's legacy proxy (`UPSHIFT_VAULTS_URL`), which served that
|
|
10353
|
+
* assembled object until 2026-10-16 and has answered a 307 to itself since.
|
|
10354
|
+
* Kept only so the listing survives an August outage if the route ever comes
|
|
10355
|
+
* back; its known unit quirks (campaign APY ×100) are normalised on the way in.
|
|
10269
10356
|
*
|
|
10270
|
-
*
|
|
10271
|
-
*
|
|
10357
|
+
* Neither path ever returns an empty listing silently: both failing throws an
|
|
10358
|
+
* error naming both causes.
|
|
10272
10359
|
*/
|
|
10360
|
+
/** The app's legacy server-side proxy — DEAD since 2026-10-16 (HTTP 307 → itself). */
|
|
10273
10361
|
declare const UPSHIFT_VAULTS_URL = "https://app.upshift.finance/api/proxy/vaults";
|
|
10362
|
+
|
|
10274
10363
|
/**
|
|
10275
10364
|
* EVM chains where Upshift has visible vaults. Numeric chain ids as
|
|
10276
10365
|
* strings. The endpoint is global (returns every chain regardless), so
|
|
@@ -10360,12 +10449,32 @@ interface UpshiftApiVault {
|
|
|
10360
10449
|
isVisible: boolean | null;
|
|
10361
10450
|
isDepositPaused: boolean | null;
|
|
10362
10451
|
isWithdrawalPaused: boolean | null;
|
|
10452
|
+
/**
|
|
10453
|
+
* Rates as PERCENT. `apy` is the curator's stated APY (hardcoded override,
|
|
10454
|
+
* else target) — informational, NOT the row's rate; `campaignApy` is the
|
|
10455
|
+
* incentive leg (percent upstream, normalised from the proxy's ×100);
|
|
10456
|
+
* `underlyingApy` is the underlying token's own yield (percent upstream).
|
|
10457
|
+
*/
|
|
10363
10458
|
apy: {
|
|
10364
10459
|
apy: number | null;
|
|
10365
10460
|
campaignApy: number | null;
|
|
10366
10461
|
pointsApy: number | null;
|
|
10367
10462
|
underlyingApy: number | null;
|
|
10368
10463
|
} | null;
|
|
10464
|
+
/**
|
|
10465
|
+
* Realized share-price return by window in days (`'1' | '7' | '30'`),
|
|
10466
|
+
* simple-annualised FRACTION — the measurement the row's base rate is read
|
|
10467
|
+
* from (see `augustRealizedRate`). Absent on proxy-fallback rows.
|
|
10468
|
+
*/
|
|
10469
|
+
historicalApy?: {
|
|
10470
|
+
[days: string]: number | null;
|
|
10471
|
+
} | null;
|
|
10472
|
+
/** The window (days) the vault publishes as its headline horizon. */
|
|
10473
|
+
defaultApyHorizon?: number | null;
|
|
10474
|
+
/** ISO-8601 UTC start of the vault. */
|
|
10475
|
+
startDatetime?: string | null;
|
|
10476
|
+
/** Which path produced the row: the August catalogue + chain, or the legacy proxy. */
|
|
10477
|
+
source?: 'august' | 'proxy';
|
|
10369
10478
|
depositAssets: (UpshiftApiAsset | null)[] | null;
|
|
10370
10479
|
totalAssets: UpshiftApiAmount | null;
|
|
10371
10480
|
totalSupply: UpshiftApiAmount | null;
|
|
@@ -10412,11 +10521,15 @@ interface UpshiftApiVault {
|
|
|
10412
10521
|
description: string | null;
|
|
10413
10522
|
}
|
|
10414
10523
|
/**
|
|
10415
|
-
*
|
|
10416
|
-
*
|
|
10417
|
-
*
|
|
10524
|
+
* The Upshift EVM listing for one chain (or every chain in
|
|
10525
|
+
* {@link UPSHIFT_CHAIN_IDS} when none is given), in the shape `fetchPublic`
|
|
10526
|
+
* parses.
|
|
10527
|
+
*
|
|
10528
|
+
* August catalogue + chain reads first; the legacy proxy if that path throws;
|
|
10529
|
+
* an error naming BOTH causes if the proxy fails too. Never an empty listing
|
|
10530
|
+
* standing in for an outage.
|
|
10418
10531
|
*/
|
|
10419
|
-
declare function fetchUpshiftApiVaults(): Promise<UpshiftApiVault[]>;
|
|
10532
|
+
declare function fetchUpshiftApiVaults(chainId?: string, multicallRetry?: MulticallRetryFunction): Promise<UpshiftApiVault[]>;
|
|
10420
10533
|
|
|
10421
10534
|
/**
|
|
10422
10535
|
* Yearn V3 vault kind, as reported by yDaemon.
|