@1delta/margin-fetcher 5.0.106 → 5.0.108
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.js +143 -39
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -47989,26 +47989,39 @@ var wstusrFetcher = {
|
|
|
47989
47989
|
// src/yields/intrinsic/fetchers/hastra.ts
|
|
47990
47990
|
var HASTRA_POR_URL = "https://www.hastra.io/hastra-pulse/public/api/v1/por";
|
|
47991
47991
|
var HASTRA_PRIME_KEY = "Hastra PRIME::PRIME";
|
|
47992
|
-
var
|
|
47992
|
+
var HASTRA_AUTO_KEY = "Hastra AUTO::AUTO";
|
|
47993
|
+
var HASTRA_TOKEN_KEYS = {
|
|
47994
|
+
prime: HASTRA_PRIME_KEY,
|
|
47995
|
+
auto: HASTRA_AUTO_KEY
|
|
47996
|
+
};
|
|
47997
|
+
var MAX_PLAUSIBLE_APR = 50;
|
|
47998
|
+
function parseHastraPor(res) {
|
|
47999
|
+
const tokens = res?.demo_prime_card?.tokens;
|
|
48000
|
+
const out = {};
|
|
48001
|
+
if (!Array.isArray(tokens)) return out;
|
|
48002
|
+
for (const t of tokens) {
|
|
48003
|
+
const key3 = HASTRA_TOKEN_KEYS[String(t?.token ?? "").toLowerCase()];
|
|
48004
|
+
if (!key3) continue;
|
|
48005
|
+
const apr = Number(t?.effective_rate);
|
|
48006
|
+
if (Number.isFinite(apr) && apr > 0 && apr < MAX_PLAUSIBLE_APR)
|
|
48007
|
+
out[key3] = apr;
|
|
48008
|
+
}
|
|
48009
|
+
return out;
|
|
48010
|
+
}
|
|
48011
|
+
var hastraFetcher = {
|
|
47993
48012
|
label: "Hastra",
|
|
47994
48013
|
fetch: async () => {
|
|
47995
48014
|
const res = await fetch(HASTRA_POR_URL, {
|
|
47996
48015
|
method: "GET",
|
|
47997
48016
|
headers: { Accept: "application/json" }
|
|
47998
|
-
}).then((r) =>
|
|
47999
|
-
|
|
48000
|
-
|
|
48001
|
-
|
|
48002
|
-
const
|
|
48003
|
-
|
|
48004
|
-
|
|
48005
|
-
|
|
48006
|
-
} else if (Number.isFinite(lifetimePct)) {
|
|
48007
|
-
apr = lifetimePct;
|
|
48008
|
-
} else {
|
|
48009
|
-
apr = 0;
|
|
48010
|
-
}
|
|
48011
|
-
return { [HASTRA_PRIME_KEY]: Math.max(0, apr) };
|
|
48017
|
+
}).then((r) => {
|
|
48018
|
+
if (!r.ok) throw new Error(`Hastra PoR answered HTTP ${r.status}`);
|
|
48019
|
+
return r.json();
|
|
48020
|
+
});
|
|
48021
|
+
const out = parseHastraPor(res);
|
|
48022
|
+
if (Object.keys(out).length === 0)
|
|
48023
|
+
console.warn("[hastra] PoR feed carried no usable effective_rate");
|
|
48024
|
+
return out;
|
|
48012
48025
|
}
|
|
48013
48026
|
};
|
|
48014
48027
|
var RAY8 = 10n ** 27n;
|
|
@@ -52978,29 +52991,51 @@ var SINGLE_CHAIN_ENTRIES = {
|
|
|
52978
52991
|
yieldKey: "SYRUPUSDG"
|
|
52979
52992
|
},
|
|
52980
52993
|
{
|
|
52981
|
-
// Hastra
|
|
52982
|
-
// USDC),
|
|
52983
|
-
//
|
|
52984
|
-
//
|
|
52985
|
-
//
|
|
52986
|
-
//
|
|
52987
|
-
//
|
|
52988
|
-
//
|
|
52994
|
+
// Hastra (Figure / Provenance) PRIME — ERC-4626 over wYLDS (itself a
|
|
52995
|
+
// 4626 over USDC, held 1:1), the same product as the Solana
|
|
52996
|
+
// `vault-stake` pool and priced at the same rate. FORK-PROVEN
|
|
52997
|
+
// 2026-10-06: `deposit` from an arbitrary EOA and an immediate
|
|
52998
|
+
// `redeem` both settle at `convertToAssets` (`maxDeposit` is
|
|
52999
|
+
// uint.max; the only gate is `freezeAccount`). The previous row said
|
|
53000
|
+
// whitelist-gated + request-based, which described an older surface.
|
|
53001
|
+
// The exit pays wYLDS; wYLDS → USDC is Hastra's own queued redemption.
|
|
53002
|
+
// APR = the PoR feed's `effective_rate` (`hastraFetcher`).
|
|
52989
53003
|
address: "0x19ebb35279a16207ec4ba82799cc64715065f7f6",
|
|
52990
53004
|
underlying: "0x6ad038ca6c04e885630851278ca0a856ad9a66cc",
|
|
52991
53005
|
// wYLDS
|
|
52992
53006
|
symbol: "PRIME",
|
|
52993
53007
|
solvency: "nav-attested",
|
|
52994
53008
|
brand: "Hastra",
|
|
52995
|
-
description: "Hastra's
|
|
53009
|
+
description: "Hastra's PRIME: wYLDS (Figure's USDC-backed YLDS, 1:1 with USDC) lent into home-equity (HELOC) loans through Figure's Democratized Prime marketplace, paid as a rising share price. Deposit and redeem are instant against wYLDS at the published rate; turning wYLDS back into USDC is a separate queued redemption with Hastra. The price is an operator-attested NAV of off-chain loans.",
|
|
52996
53010
|
decimals: 6,
|
|
52997
53011
|
underlyingDecimals: 6,
|
|
52998
53012
|
isRebasing: false,
|
|
52999
|
-
isMintable:
|
|
53000
|
-
withdrawalMode: "
|
|
53001
|
-
yieldFetcher:
|
|
53013
|
+
isMintable: true,
|
|
53014
|
+
withdrawalMode: "instant",
|
|
53015
|
+
yieldFetcher: hastraFetcher,
|
|
53002
53016
|
yieldKey: "Hastra PRIME::PRIME"
|
|
53003
53017
|
},
|
|
53018
|
+
{
|
|
53019
|
+
// Hastra AUTO — PRIME's sibling over the same wYLDS, lending into
|
|
53020
|
+
// consumer auto loans on Figure's Democratized Prime. Same contract family (4626, fork-proven the
|
|
53021
|
+
// same way 2026-10-06), same exit into wYLDS. ~$1M on Ethereum against
|
|
53022
|
+
// ~$70M on Solana, so the Solana row is the one that matters; this one
|
|
53023
|
+
// exists so the EVM share has a rate and an exit.
|
|
53024
|
+
address: "0x997e2efbce91d170b00ea402e35a66c887ee1da9",
|
|
53025
|
+
underlying: "0x6ad038ca6c04e885630851278ca0a856ad9a66cc",
|
|
53026
|
+
// wYLDS
|
|
53027
|
+
symbol: "AUTO",
|
|
53028
|
+
solvency: "nav-attested",
|
|
53029
|
+
brand: "Hastra",
|
|
53030
|
+
description: "Hastra's AUTO: wYLDS (Figure's USDC-backed YLDS, 1:1 with USDC) lent into a pool of consumer auto loans (originated and serviced by a third-party auto lender, offered through Figure's Democratized Prime marketplace), paid as a rising share price. Deposit and redeem are instant against wYLDS at the published rate; turning wYLDS back into USDC is a separate queued redemption with Hastra. The price is an operator-attested NAV of off-chain loans.",
|
|
53031
|
+
decimals: 6,
|
|
53032
|
+
underlyingDecimals: 6,
|
|
53033
|
+
isRebasing: false,
|
|
53034
|
+
isMintable: true,
|
|
53035
|
+
withdrawalMode: "instant",
|
|
53036
|
+
yieldFetcher: hastraFetcher,
|
|
53037
|
+
yieldKey: "Hastra AUTO::AUTO"
|
|
53038
|
+
},
|
|
53004
53039
|
{
|
|
53005
53040
|
// 3Jane USD3 — senior tranche of the credit-based money market
|
|
53006
53041
|
// (docs.3jane.xyz): USDC funds unsecured fintech/crypto credit
|
|
@@ -55564,6 +55599,69 @@ var jitoSolFetcher = {
|
|
|
55564
55599
|
}
|
|
55565
55600
|
};
|
|
55566
55601
|
|
|
55602
|
+
// src/yields/intrinsic/fetchers/onre.ts
|
|
55603
|
+
var ONRE_API = "https://core.api.onre.finance/data";
|
|
55604
|
+
var ONYC_KEY = "OnRe Tokenized Reinsurance::ONyc";
|
|
55605
|
+
var ONYC_WINDOW_DAYS = 30;
|
|
55606
|
+
var MIN_WINDOW_DAYS = 7;
|
|
55607
|
+
var MAX_STALENESS_DAYS = 7;
|
|
55608
|
+
var DAY_MS2 = 864e5;
|
|
55609
|
+
var parseNavDate = (s) => {
|
|
55610
|
+
const m = typeof s === "string" ? /^(\d{2})\/(\d{2})\/(\d{4})$/.exec(s) : null;
|
|
55611
|
+
if (!m) return void 0;
|
|
55612
|
+
const t = Date.UTC(Number(m[3]), Number(m[1]) - 1, Number(m[2]));
|
|
55613
|
+
return Number.isFinite(t) ? t : void 0;
|
|
55614
|
+
};
|
|
55615
|
+
var parseNavHistory = (raw) => {
|
|
55616
|
+
const rows = raw?.data;
|
|
55617
|
+
if (!Array.isArray(rows)) return [];
|
|
55618
|
+
const out = [];
|
|
55619
|
+
for (const r of rows) {
|
|
55620
|
+
const t = parseNavDate(r?.net_asset_value_date);
|
|
55621
|
+
const nav = Number(r?.net_asset_value);
|
|
55622
|
+
if (t !== void 0 && Number.isFinite(nav) && nav > 0) out.push({ t, nav });
|
|
55623
|
+
}
|
|
55624
|
+
return out.sort((a, b) => a.t - b.t);
|
|
55625
|
+
};
|
|
55626
|
+
var windowAprFromNav = (points, nowMs, windowDays = ONYC_WINDOW_DAYS) => {
|
|
55627
|
+
const latest = points[points.length - 1];
|
|
55628
|
+
if (!latest) throw new Error("ONyc: no NAV history");
|
|
55629
|
+
if (nowMs - latest.t > MAX_STALENESS_DAYS * DAY_MS2) {
|
|
55630
|
+
throw new Error(`ONyc: NAV stale since ${new Date(latest.t).toISOString()}`);
|
|
55631
|
+
}
|
|
55632
|
+
const cutoff = latest.t - windowDays * DAY_MS2;
|
|
55633
|
+
const older = points.filter((p) => p.t < latest.t);
|
|
55634
|
+
if (older.length === 0) throw new Error("ONyc: no historical NAV");
|
|
55635
|
+
const start = [...older].reverse().find((p) => p.t <= cutoff) ?? older[0];
|
|
55636
|
+
const days = (latest.t - start.t) / DAY_MS2;
|
|
55637
|
+
if (days < MIN_WINDOW_DAYS) throw new Error(`ONyc: window too short (${days}d)`);
|
|
55638
|
+
const apr = (latest.nav / start.nav - 1) * 365 * 100 / days;
|
|
55639
|
+
if (!Number.isFinite(apr) || Math.abs(apr) > 100) {
|
|
55640
|
+
throw new Error(`ONyc: implausible rate ${apr}`);
|
|
55641
|
+
}
|
|
55642
|
+
return apr;
|
|
55643
|
+
};
|
|
55644
|
+
var getJson2 = (path) => fetch(`${ONRE_API}/${path}`, { headers: { Accept: "application/json" } }).then(
|
|
55645
|
+
(r) => {
|
|
55646
|
+
if (!r.ok) throw new Error(`OnRe ${path}: HTTP ${r.status}`);
|
|
55647
|
+
return r.json();
|
|
55648
|
+
}
|
|
55649
|
+
);
|
|
55650
|
+
var onycFetcher = {
|
|
55651
|
+
label: "ONRE_ONYC",
|
|
55652
|
+
fetch: async () => {
|
|
55653
|
+
let apr;
|
|
55654
|
+
try {
|
|
55655
|
+
apr = windowAprFromNav(parseNavHistory(await getJson2("nav")), Date.now());
|
|
55656
|
+
} catch (e) {
|
|
55657
|
+
const apy = Number(await getJson2("live-apy"));
|
|
55658
|
+
if (!Number.isFinite(apy) || apy < 0 || apy > 1) throw e;
|
|
55659
|
+
apr = apyToAprPercent(apy * 100);
|
|
55660
|
+
}
|
|
55661
|
+
return { [ONYC_KEY]: apr };
|
|
55662
|
+
}
|
|
55663
|
+
};
|
|
55664
|
+
|
|
55567
55665
|
// src/yields/intrinsic/fetchers/superreturn.ts
|
|
55568
55666
|
var SSUPERUSD_URL = "https://www.superreturn.ai/api/trpc/cmc.getUSDCPrice,rewardBackend.getYield,rewardBackend.getTvlChange?batch=1&input=%7B%220%22%3A%7B%22json%22%3Anull%2C%22meta%22%3A%7B%22values%22%3A%5B%22undefined%22%5D%7D%7D%2C%221%22%3A%7B%22json%22%3Anull%2C%22meta%22%3A%7B%22values%22%3A%5B%22undefined%22%5D%7D%7D%2C%222%22%3A%7B%22json%22%3Anull%2C%22meta%22%3A%7B%22values%22%3A%5B%22undefined%22%5D%7D%7D%7D";
|
|
55569
55667
|
var ssuperusd = "SuperReturn sSuperUSD::SSUPERUSD";
|
|
@@ -55679,7 +55777,7 @@ var getGmxApiHost = (chainId) => GMX_API_HOSTS[chainId];
|
|
|
55679
55777
|
|
|
55680
55778
|
// src/vaults/gmx/api.ts
|
|
55681
55779
|
var GMX_DEFAULT_APY_PERIOD = "1d";
|
|
55682
|
-
var
|
|
55780
|
+
var getJson3 = async (url) => {
|
|
55683
55781
|
const res = await fetch(url, {
|
|
55684
55782
|
method: "GET",
|
|
55685
55783
|
headers: { Accept: "application/json" }
|
|
@@ -55691,12 +55789,12 @@ var fetchGmxRawData = async (chainId, period, apiUrlOverride) => {
|
|
|
55691
55789
|
const host = apiUrlOverride ?? getGmxApiHost(chainId);
|
|
55692
55790
|
if (!host) throw new Error(`GMX not supported on chain ${chainId}`);
|
|
55693
55791
|
const [apy, marketsRes, glvsRes, tokensRes] = await Promise.all([
|
|
55694
|
-
|
|
55695
|
-
|
|
55792
|
+
getJson3(`${host}/apy?period=${encodeURIComponent(period)}`),
|
|
55793
|
+
getJson3(`${host}/markets`).catch(() => ({
|
|
55696
55794
|
markets: []
|
|
55697
55795
|
})),
|
|
55698
|
-
|
|
55699
|
-
|
|
55796
|
+
getJson3(`${host}/glvs`).catch(() => ({ glvs: [] })),
|
|
55797
|
+
getJson3(`${host}/tokens`).catch(() => ({
|
|
55700
55798
|
tokens: []
|
|
55701
55799
|
}))
|
|
55702
55800
|
]);
|
|
@@ -56315,6 +56413,9 @@ var LENDING_ONLY_FETCHERS = [
|
|
|
56315
56413
|
usdZeroPlusFetcher,
|
|
56316
56414
|
ethZeroFetcher,
|
|
56317
56415
|
jitoSolFetcher,
|
|
56416
|
+
// ONyc (OnRe reinsurance, Solana): NAV-accruing collateral on Loopscale /
|
|
56417
|
+
// Kamino / Jupiter Lend, no vault row.
|
|
56418
|
+
onycFetcher,
|
|
56318
56419
|
thbillFetcher,
|
|
56319
56420
|
// sthusdFetcher / scrvusdFetcher are NOT here (and deliberately not
|
|
56320
56421
|
// imported): both are vault-wired by their savings rows, so they reach
|
|
@@ -64970,7 +65071,7 @@ function rescaleExchangeRate(exchangeRate, shareDecimals) {
|
|
|
64970
65071
|
const dec2 = Math.max(0, Math.round(Number(shareDecimals) || 0));
|
|
64971
65072
|
return (r * 10n ** BigInt(dec2) / 10n ** 18n).toString();
|
|
64972
65073
|
}
|
|
64973
|
-
async function
|
|
65074
|
+
async function getJson4(url) {
|
|
64974
65075
|
const controller = new AbortController();
|
|
64975
65076
|
const timer = setTimeout(() => controller.abort(), API_TIMEOUT_MS2);
|
|
64976
65077
|
try {
|
|
@@ -65062,7 +65163,7 @@ async function mapWithConcurrency(items, limit, fn) {
|
|
|
65062
65163
|
return out;
|
|
65063
65164
|
}
|
|
65064
65165
|
async function fetchEulerEarnVaultsFromApi(chainId, prices = {}, tokenList = {}, multicallRetry) {
|
|
65065
|
-
const list = await
|
|
65166
|
+
const list = await getJson4(
|
|
65066
65167
|
`${EULER_DATA_API_BASE2}/earn/vaults?chainId=${chainId}&limit=200&visibility=${VISIBILITY_ALL}`
|
|
65067
65168
|
);
|
|
65068
65169
|
if (!list) return void 0;
|
|
@@ -65079,7 +65180,7 @@ async function fetchEulerEarnVaultsFromApi(chainId, prices = {}, tokenList = {},
|
|
|
65079
65180
|
mapWithConcurrency(
|
|
65080
65181
|
rows,
|
|
65081
65182
|
DETAIL_CONCURRENCY,
|
|
65082
|
-
(row) =>
|
|
65183
|
+
(row) => getJson4(
|
|
65083
65184
|
`${EULER_DATA_API_BASE2}/earn/vaults/${chainId}/${row.address}?include=strategies`
|
|
65084
65185
|
).then((d) => d?.data)
|
|
65085
65186
|
),
|
|
@@ -75509,7 +75610,7 @@ function clearPendleMarketsCache() {
|
|
|
75509
75610
|
marketsCache = void 0;
|
|
75510
75611
|
assetsCache = void 0;
|
|
75511
75612
|
}
|
|
75512
|
-
async function
|
|
75613
|
+
async function getJson5(url, label) {
|
|
75513
75614
|
const response = await fetch(url, { headers: { Accept: "application/json" } });
|
|
75514
75615
|
if (!response.ok) {
|
|
75515
75616
|
throw new Error(
|
|
@@ -75530,7 +75631,7 @@ function cache5(slot, build6, store) {
|
|
|
75530
75631
|
function fetchPendleApiMarkets() {
|
|
75531
75632
|
return cache5(
|
|
75532
75633
|
marketsCache,
|
|
75533
|
-
async () => (await
|
|
75634
|
+
async () => (await getJson5(PENDLE_MARKETS_URL, "markets"))?.markets ?? [],
|
|
75534
75635
|
(c) => {
|
|
75535
75636
|
marketsCache = c;
|
|
75536
75637
|
}
|
|
@@ -75541,7 +75642,7 @@ function fetchPendleApiAssets() {
|
|
|
75541
75642
|
return cache5(
|
|
75542
75643
|
assetsCache,
|
|
75543
75644
|
async () => {
|
|
75544
|
-
const json = await
|
|
75645
|
+
const json = await getJson5(PENDLE_ASSETS_URL, "assets");
|
|
75545
75646
|
const map = /* @__PURE__ */ new Map();
|
|
75546
75647
|
for (const a of json?.assets ?? []) {
|
|
75547
75648
|
if (a?.chainId == null || !a?.address) continue;
|
|
@@ -84094,7 +84195,10 @@ var SVM_EARN_VAULT_BUILDERS = {
|
|
|
84094
84195
|
nativeWithdraw: true
|
|
84095
84196
|
},
|
|
84096
84197
|
// USDC in over CCTP, a request out — settled by Nest, nothing to claim
|
|
84097
|
-
"savings:Nest": { verbs: ["deposit", "request-withdraw"] }
|
|
84198
|
+
"savings:Nest": { verbs: ["deposit", "request-withdraw"] },
|
|
84199
|
+
// PRIME / AUTO: the vault-stake pool's own stake / redeem, same
|
|
84200
|
+
// transaction; wYLDS in (or USDC, minted 1:1 first), wYLDS out
|
|
84201
|
+
"savings:Hastra": { verbs: ["deposit", "withdraw"], payAsset: true }
|
|
84098
84202
|
};
|
|
84099
84203
|
var UNBUILT_REASONS = {
|
|
84100
84204
|
exponent: "Exponent PTs are not tradable through this API yet",
|