@1delta/margin-fetcher 5.0.119 → 5.0.121
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 +130 -27
- package/dist/index.js +1935 -521
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -6012,6 +6012,42 @@ interface OraclePriceEntry {
|
|
|
6012
6012
|
* not any lender lists it.
|
|
6013
6013
|
*/
|
|
6014
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;
|
|
6015
6051
|
}
|
|
6016
6052
|
/**
|
|
6017
6053
|
* Quality class of a USD price, in descending order of trust.
|
|
@@ -6647,12 +6683,23 @@ interface SelectPricesOptions {
|
|
|
6647
6683
|
* require re-deriving the whole pipeline.
|
|
6648
6684
|
*/
|
|
6649
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;
|
|
6650
6694
|
}
|
|
6651
6695
|
/**
|
|
6652
6696
|
* Flattens structured oracle prices to a simple USD price map.
|
|
6653
6697
|
*
|
|
6654
6698
|
* Ranking, in order:
|
|
6655
|
-
* 0.
|
|
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
|
|
6656
6703
|
* 1. freshness — past this feed's own learned cadence loses
|
|
6657
6704
|
* 2. reliability — a feed that habitually disagrees with the market loses
|
|
6658
6705
|
* 3. derivation — a direct oracle read beats a price derived from one
|
|
@@ -10078,9 +10125,10 @@ type AaveEarnVaults = {
|
|
|
10078
10125
|
/**
|
|
10079
10126
|
* Parsed Upshift vault entry.
|
|
10080
10127
|
*
|
|
10081
|
-
* Upshift vaults are curator-run ERC-4626-style yield vaults
|
|
10082
|
-
*
|
|
10083
|
-
*
|
|
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
|
|
10084
10132
|
* token a depositor actually holds (`address`) can differ on the newer
|
|
10085
10133
|
* `evm-2` vaults, so we key the vault by the **receipt** token — that's
|
|
10086
10134
|
* what shows up in a user's wallet and what the user-balance lookup
|
|
@@ -10150,20 +10198,43 @@ interface UpshiftVault extends VaultClassificationFields {
|
|
|
10150
10198
|
* scaled (`totalAssets * 10**shareDecimals / totalSupply`). `'0'` for
|
|
10151
10199
|
* an empty vault. */
|
|
10152
10200
|
pricePerShare: string;
|
|
10153
|
-
/**
|
|
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
|
+
*/
|
|
10154
10211
|
supplyRate: number;
|
|
10155
|
-
/**
|
|
10156
|
-
|
|
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. */
|
|
10157
10225
|
rewardsRate: number;
|
|
10158
10226
|
/** `supplyRate + rewardsRate` — total APR a depositor earns. */
|
|
10159
10227
|
depositRate: number;
|
|
10160
|
-
/** 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`. */
|
|
10161
10230
|
apy: {
|
|
10162
10231
|
base: number | null;
|
|
10163
10232
|
campaign: number | null;
|
|
10164
10233
|
points: number | null;
|
|
10165
10234
|
underlying: number | null;
|
|
10166
10235
|
};
|
|
10236
|
+
/** Underlying per share, human units (`totalAssets / totalSupply`). */
|
|
10237
|
+
sharePrice: number;
|
|
10167
10238
|
/**
|
|
10168
10239
|
* EFFECTIVE performance fee in percent — `0` when the curator has waived it.
|
|
10169
10240
|
* Read by the term-sheet builder as `input.fee`.
|
|
@@ -10253,34 +10324,42 @@ type UpshiftVaults = {
|
|
|
10253
10324
|
* One-shot fetcher for the Upshift vaults on a chain (see
|
|
10254
10325
|
* {@link isServable} for which of them we serve).
|
|
10255
10326
|
*
|
|
10256
|
-
* HTTP
|
|
10257
|
-
*
|
|
10258
|
-
*
|
|
10259
|
-
* 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".
|
|
10260
10332
|
*
|
|
10261
|
-
* @param chainId
|
|
10262
|
-
* @param prices
|
|
10263
|
-
* @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)
|
|
10264
10338
|
*
|
|
10265
10339
|
* @returns `UpshiftVaults` — map keyed by lowercased receipt-token address.
|
|
10266
10340
|
*/
|
|
10267
10341
|
declare const fetchUpshiftVaults: (chainId: string, prices?: {
|
|
10268
10342
|
[asset: string]: number;
|
|
10269
|
-
}, tokenList?: GenericTokenList) => Promise<UpshiftVaults>;
|
|
10343
|
+
}, tokenList?: GenericTokenList, multicallRetry?: MulticallRetryFunction) => Promise<UpshiftVaults>;
|
|
10270
10344
|
|
|
10271
10345
|
/**
|
|
10272
10346
|
* Upshift public vault listing.
|
|
10273
10347
|
*
|
|
10274
|
-
*
|
|
10275
|
-
*
|
|
10276
|
-
*
|
|
10277
|
-
*
|
|
10278
|
-
*
|
|
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.
|
|
10279
10356
|
*
|
|
10280
|
-
*
|
|
10281
|
-
*
|
|
10357
|
+
* Neither path ever returns an empty listing silently: both failing throws an
|
|
10358
|
+
* error naming both causes.
|
|
10282
10359
|
*/
|
|
10360
|
+
/** The app's legacy server-side proxy — DEAD since 2026-10-16 (HTTP 307 → itself). */
|
|
10283
10361
|
declare const UPSHIFT_VAULTS_URL = "https://app.upshift.finance/api/proxy/vaults";
|
|
10362
|
+
|
|
10284
10363
|
/**
|
|
10285
10364
|
* EVM chains where Upshift has visible vaults. Numeric chain ids as
|
|
10286
10365
|
* strings. The endpoint is global (returns every chain regardless), so
|
|
@@ -10370,12 +10449,32 @@ interface UpshiftApiVault {
|
|
|
10370
10449
|
isVisible: boolean | null;
|
|
10371
10450
|
isDepositPaused: boolean | null;
|
|
10372
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
|
+
*/
|
|
10373
10458
|
apy: {
|
|
10374
10459
|
apy: number | null;
|
|
10375
10460
|
campaignApy: number | null;
|
|
10376
10461
|
pointsApy: number | null;
|
|
10377
10462
|
underlyingApy: number | null;
|
|
10378
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';
|
|
10379
10478
|
depositAssets: (UpshiftApiAsset | null)[] | null;
|
|
10380
10479
|
totalAssets: UpshiftApiAmount | null;
|
|
10381
10480
|
totalSupply: UpshiftApiAmount | null;
|
|
@@ -10422,11 +10521,15 @@ interface UpshiftApiVault {
|
|
|
10422
10521
|
description: string | null;
|
|
10423
10522
|
}
|
|
10424
10523
|
/**
|
|
10425
|
-
*
|
|
10426
|
-
*
|
|
10427
|
-
*
|
|
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.
|
|
10428
10531
|
*/
|
|
10429
|
-
declare function fetchUpshiftApiVaults(): Promise<UpshiftApiVault[]>;
|
|
10532
|
+
declare function fetchUpshiftApiVaults(chainId?: string, multicallRetry?: MulticallRetryFunction): Promise<UpshiftApiVault[]>;
|
|
10430
10533
|
|
|
10431
10534
|
/**
|
|
10432
10535
|
* Yearn V3 vault kind, as reported by yDaemon.
|