@1delta/data-sdk 0.0.41 → 0.0.43

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.
@@ -0,0 +1,129 @@
1
+ export type SiloHalfStatic = {
2
+ /** silo (vault) address */
3
+ silo: string;
4
+ /** underlying borrowable asset for this side */
5
+ token: string;
6
+ /** ERC-20 decimals for `token`, cached to avoid an extra RPC */
7
+ decimals: number;
8
+ /** Optional symbol cache for UI; not consumed by the fetcher */
9
+ symbol?: string;
10
+ /** Share-token addresses (for user-data fetchers / liquidations) */
11
+ protectedShareToken: string;
12
+ collateralShareToken: string;
13
+ debtShareToken: string;
14
+ /** Per-side oracles (1e18-scaled price quoting) */
15
+ solvencyOracle: string;
16
+ maxLtvOracle: string;
17
+ /** Interest rate model contract */
18
+ interestRateModel: string;
19
+ /** LTV at 1e18 scale */
20
+ maxLtv: string;
21
+ /** Liquidation threshold (LLTV) at 1e18 scale */
22
+ lt: string;
23
+ /** Target LTV after liquidation (1e18) */
24
+ liquidationTargetLtv: string;
25
+ /** Fee parameters (1e18) */
26
+ liquidationFee: string;
27
+ flashloanFee: string;
28
+ daoFee: string;
29
+ deployerFee: string;
30
+ /** Optional hook receiver / quote-before flag */
31
+ hookReceiver?: string;
32
+ callBeforeQuote?: boolean;
33
+ };
34
+ export type SiloMarketEntry = {
35
+ /** Shared SiloConfig address (one per pair) */
36
+ siloConfig: string;
37
+ /** Optional human-readable name from the factory event / curated list */
38
+ name?: string;
39
+ silo0: SiloHalfStatic;
40
+ silo1: SiloHalfStatic;
41
+ };
42
+ /**
43
+ * chainId → list of (silo0, silo1) pairs.
44
+ *
45
+ * Stored as an array to match the on-disk `silo-v2-markets.json` shape.
46
+ * Per-chain pair counts are small (~100 max), so the linear lookup in
47
+ * `getSiloV2MarketEntry` is fine. If that ever changes, build an index
48
+ * lazily here.
49
+ */
50
+ export type SiloMarketsType = {
51
+ [chainId: string]: SiloMarketEntry[];
52
+ };
53
+ /**
54
+ * Per-chain Silo v2 peripheral / singleton addresses.
55
+ *
56
+ * Both `lens` and `factory` are deployed once per chain and shared by every
57
+ * Silo v2 market on that chain, so they live together in one map instead of
58
+ * being split across `siloLens` / `siloFactory`. Add new chain-wide
59
+ * singletons (e.g. `siloRouter`, `siloIncentivesController`) here.
60
+ */
61
+ export type SiloPeripheralsEntry = {
62
+ /** SiloLens (v2) — exposes getDepositAPR / getBorrowAPR / getUtilization */
63
+ lens: string;
64
+ /** SiloFactory — used by the initializer to discover deployed silo pairs */
65
+ factory: string;
66
+ /** Optional: router / wrapped-native gateway, populated when needed */
67
+ router?: string;
68
+ /** Optional: incentives controller for reward APR */
69
+ incentivesController?: string;
70
+ };
71
+ /** chainId → Silo v2 peripheral addresses */
72
+ export type SiloPeripheralsType = {
73
+ [chainId: string]: SiloPeripheralsEntry;
74
+ };
75
+ export declare const siloMarkets: () => SiloMarketsType;
76
+ export declare const siloPeripherals: () => SiloPeripheralsType;
77
+ export declare const siloMarketsV3: () => SiloMarketsType;
78
+ export declare const siloPeripheralsV3: () => SiloPeripheralsType;
79
+ /**
80
+ * Synthesize the per-pair lender key for a Silo v2 market.
81
+ *
82
+ * Mirrors `aaveV4SpokeLenderKey` and the Morpho `MORPHO_BLUE_<HEX>`
83
+ * convention so each Silo pair shows up as its own isolated lender —
84
+ * exactly like an Aave V4 spoke or a Morpho Blue market — without any
85
+ * Silo-specific routing logic in the rest of the codebase.
86
+ *
87
+ * Format: `SILO_V2_${siloConfigAddr.slice(2).toUpperCase()}`
88
+ *
89
+ * Keyed by `SiloConfig` rather than either silo because the config is the
90
+ * stable, shared identity of the pair (silo0/silo1 are derived from it).
91
+ *
92
+ * `isSiloV2Type()` works on this because it matches `startsWith('SILO_V2')`.
93
+ */
94
+ export declare function siloV2LenderKey(siloConfig: string): string;
95
+ /**
96
+ * Inverse of `siloV2LenderKey`: given a per-pair lender key, return
97
+ * `{ siloConfigAddrLower }`. Returns `undefined` if the key isn't a per-pair
98
+ * Silo v2 key (e.g. someone passed the bare prefix `SILO_V2`).
99
+ */
100
+ export declare function parseSiloV2LenderKey(lenderKey: string): {
101
+ siloConfigAddrLower: string;
102
+ } | undefined;
103
+ /**
104
+ * Look up a Silo v2 market entry by per-pair lender key.
105
+ * Returns `undefined` if no entry exists for that chain/config.
106
+ */
107
+ export declare function getSiloV2MarketEntry(chainId: string, lenderKey: string): SiloMarketEntry | undefined;
108
+ /**
109
+ * Silo v3 per-pair lender key helpers.
110
+ *
111
+ * Silo v3 uses the exact same on-chain data model and metadata shape as v2
112
+ * (`SiloMarketEntry`/`SiloHalfStatic`) — only the deployment set, factory
113
+ * and indexer protocol tag differ — so v3 pairs get their own isolated
114
+ * lender token namespace (`SILO_V3_<HEX>`) and live in a separate
115
+ * `siloMarketsV3` registry slot. Keeping the two separate means a v2 and
116
+ * v3 pair with the same `SiloConfig` address could in principle coexist
117
+ * without clashing, and downstream consumers can filter by prefix.
118
+ *
119
+ * Format: `SILO_V3_${siloConfigAddr.slice(2).toUpperCase()}`
120
+ */
121
+ export declare function siloV3LenderKey(siloConfig: string): string;
122
+ export declare function parseSiloV3LenderKey(lenderKey: string): {
123
+ siloConfigAddrLower: string;
124
+ } | undefined;
125
+ /**
126
+ * Look up a Silo v3 market entry by per-pair lender key.
127
+ * Returns `undefined` if no entry exists for that chain/config.
128
+ */
129
+ export declare function getSiloV3MarketEntry(chainId: string, lenderKey: string): SiloMarketEntry | undefined;
@@ -0,0 +1,68 @@
1
+ /** Per-chain, protocol-level (evergreen) Teller addresses. */
2
+ export type TellerConfigChain = {
3
+ /** TellerV2 — loan lifecycle: bid reads, repayLoanFull, approveMarketForwarder. */
4
+ tellerV2: string;
5
+ /** MarketRegistry — market owners / default windows / attestation rules. */
6
+ marketRegistry: string;
7
+ /** CollateralManager — per-bid collateral escrow (approve target on open). */
8
+ collateralManager: string;
9
+ /** LenderManager — tokenizes the lender side of an accepted loan (ERC-721). */
10
+ lenderManager?: string | null;
11
+ /** LenderCommitmentForwarder — legacy commitment forwarder (optional). */
12
+ lenderCommitmentForwarder?: string | null;
13
+ /** SmartCommitmentForwarder — borrower entrypoint for pool-backed loans. */
14
+ smartCommitmentForwarder: string;
15
+ /** LenderCommitmentGroup pool factory V1 (Smart pools) — for pool discovery. */
16
+ lenderCommitmentGroupFactory?: string | null;
17
+ /** LenderCommitmentGroup pool factory V2 (ERC-4626 pools; bulk of liquidity). */
18
+ lenderCommitmentGroupFactoryV2?: string | null;
19
+ /** LenderCommitmentGroup pool factory V3 (ERC-4626 pools). */
20
+ lenderCommitmentGroupFactoryV3?: string | null;
21
+ };
22
+ export type TellerConfigType = {
23
+ [chainId: string]: TellerConfigChain;
24
+ };
25
+ /** A Teller LenderCommitmentGroup pool: one fixed principal↔collateral pair. */
26
+ export type TellerPoolConfig = {
27
+ /** Pool (LenderCommitmentGroup) address — also the per-market lender-key body. */
28
+ pool: string;
29
+ /** MarketRegistry market id this pool lends into. Immutable; OPTIONAL —
30
+ * read on-chain via `getMarketId()` when absent (the curated list from the
31
+ * Teller API doesn't carry it). */
32
+ marketId?: string;
33
+ /** Principal (loan / debt) token address. */
34
+ principal: string;
35
+ /** Principal token symbol, e.g. "USDC". */
36
+ principalSymbol: string;
37
+ /** Principal token decimals. */
38
+ principalDecimals: number;
39
+ /** Collateral token address. */
40
+ collateral: string;
41
+ /** Collateral token symbol, e.g. "WETH". */
42
+ collateralSymbol: string;
43
+ /** Collateral token decimals. */
44
+ collateralDecimals: number;
45
+ /** Max loan duration (seconds) the pool allows (borrower picks ≤ this).
46
+ * Immutable; OPTIONAL — read on-chain via `getMaxLoanDuration()` when absent. */
47
+ maxLoanDuration?: number;
48
+ /** Pool generation hint (2 = ERC-4626 `_Pool_V2/V3`, 1 = `_Smart`), from the
49
+ * Teller API `isV2` flag. Borrow path is identical; only supply-side differs. */
50
+ isV2?: boolean;
51
+ /** WAD/bps interest-rate lower bound (informational; enforced on-chain). */
52
+ interestRateLowerBound?: string | number | null;
53
+ /** WAD/bps interest-rate upper bound (informational; enforced on-chain). */
54
+ interestRateUpperBound?: string | number | null;
55
+ /** Optional display label, e.g. "Teller USDC / WETH". */
56
+ name?: string;
57
+ };
58
+ export type TellerPoolsType = {
59
+ [chainId: string]: TellerPoolConfig[];
60
+ };
61
+ export declare const tellerConfig: () => TellerConfigType;
62
+ export declare const tellerPools: () => TellerPoolsType;
63
+ /** Per-chain evergreen Teller addresses (undefined if none/unloaded). */
64
+ export declare const tellerConfigByChain: (chainId: string | number) => TellerConfigChain | undefined;
65
+ /** All Teller pool configs on a chain (empty array if none/unloaded). */
66
+ export declare const tellerPoolsByChain: (chainId: string | number) => TellerPoolConfig[];
67
+ /** Look up one Teller pool config by its LenderCommitmentGroup address (case-insensitive). */
68
+ export declare const tellerPoolByAddress: (chainId: string | number, pool: string) => TellerPoolConfig | undefined;
@@ -0,0 +1,82 @@
1
+ /** Per-chain, protocol-level (evergreen) Term Finance addresses + data endpoint. */
2
+ export type TermConfigChain = {
3
+ /** TermController — validates deployed repos (`isTermDeployed`). */
4
+ termController: string;
5
+ /** RepoTokenLinkedList — the shared secondary-market repo-token order book. */
6
+ repoTokenLinkedList?: string | null;
7
+ /** RepoTokenLinkedListEventEmitter — the listing event source the subgraph indexes. */
8
+ repoTokenListEventEmitter?: string | null;
9
+ /** DiscountRateAdapter — helper used to price secondary listings. */
10
+ discountRateAdapter?: string | null;
11
+ /** TermPriceConsumerV3 — Term's own on-chain price oracle (singleton per
12
+ * chain). `usdValueOfTokens(token, 10^dec)` → per-token USD price (1e18).
13
+ * The same oracle Term liquidates against, so it drives liquidation risk. */
14
+ priceOracle?: string | null;
15
+ /** Term data endpoint base (subgraph/HTTP) for listings + auction state. */
16
+ apiBaseUrl?: string | null;
17
+ };
18
+ export type TermConfigType = {
19
+ [chainId: string]: TermConfigChain;
20
+ };
21
+ /** One collateral leg of a Term repo (mirrors TermRepoCollateralManager state). */
22
+ export type TermCollateralParam = {
23
+ token: string;
24
+ /** WAD-scaled maintenance collateral ratio (as string). */
25
+ maintenanceRatio: string;
26
+ /** WAD-scaled initial collateral ratio (as string). */
27
+ initialRatio?: string;
28
+ /** WAD-scaled liquidated-damages factor (liquidation penalty, as string). */
29
+ liquidatedDamages?: string;
30
+ decimals: number;
31
+ };
32
+ /** A Term Finance repo/market: the serial contract addresses + fixed terms. */
33
+ export type TermMarketConfig = {
34
+ /** bytes32/string term repo id (`termRepoId`). */
35
+ termRepoId: string;
36
+ /** TermRepoServicer — timing + repurchase ledger + redeem/repay. */
37
+ servicer: string;
38
+ /** TermRepoToken — ERC-20 lender claim (balanceOf → lent principal). */
39
+ repoToken: string;
40
+ /** TermRepoCollateralManager — collateral lock/unlock + balances. */
41
+ collateralManager: string;
42
+ /** TermAuction — clears the current/latest auction for this repo (optional). */
43
+ auction?: string;
44
+ /** TermAuctionOfferLocker — lend-side offer submission for the active auction. */
45
+ offerLocker?: string;
46
+ /** TermAuctionBidLocker — borrow-side bid submission for the active auction. */
47
+ bidLocker?: string;
48
+ /** The loan/lend token borrowers receive and lenders supply (== `purchaseToken`). */
49
+ purchaseToken: string;
50
+ loanDecimals: number;
51
+ /** Ordered collateral legs; index = the on-chain collateral index. */
52
+ collateralParams: TermCollateralParam[];
53
+ /** Maturity, unix seconds (as string). */
54
+ maturity: string;
55
+ /** Redemption timestamp, unix seconds (as string). */
56
+ redemptionTimestamp?: string;
57
+ /** End of the repurchase window, unix seconds (as string). */
58
+ endOfRepurchaseWindow?: string;
59
+ /** Fixed redemption value per repo token at maturity (WAD, as string). */
60
+ redemptionValue?: string;
61
+ /** WAD-scaled servicing fee (as string). */
62
+ servicingFee?: string;
63
+ /** Optional display label, e.g. "USDC / WETH — 2026-09-18". */
64
+ name?: string;
65
+ };
66
+ export type TermMarketsType = {
67
+ [chainId: string]: TermMarketConfig[];
68
+ };
69
+ export declare const termConfig: () => TermConfigType;
70
+ export declare const setTermApiBase: (url: string | undefined | null) => void;
71
+ export declare const termApiBaseOverride: () => string | undefined;
72
+ /**
73
+ * Resolve the Term data endpoint base for a chain: override → config → ''.
74
+ * Term has no public hosted endpoint, so an empty string means "no live data
75
+ * source configured" and callers fall back to static config / on-chain reads.
76
+ */
77
+ export declare const resolveTermApiBase: (chainId: string) => string;
78
+ export declare const termMarkets: () => TermMarketsType;
79
+ /** All Term Finance market configs on a chain (empty array if none/unloaded). */
80
+ export declare const termMarketsByChain: (chainId: string | number) => TermMarketConfig[];
81
+ /** Look up one Term repo config by its term repo id (case-insensitive). */
82
+ export declare const termMarketById: (chainId: string | number, termRepoId: string) => TermMarketConfig | undefined;
@@ -0,0 +1,65 @@
1
+ /** Per-chain, protocol-level (evergreen) TermMax addresses. */
2
+ export type TermMaxConfigChain = {
3
+ /** TermMaxRouterV2 — the native atomic write surface (borrow, repay, …). */
4
+ routerV2: string;
5
+ /** OracleAggregatorV2 — `getPrice(asset) → (price, decimals)`; the feed LTV
6
+ * and liquidation are computed against. */
7
+ oracleAggregatorV2: string;
8
+ /** TermMaxViewer — batch position/order reads (the user-data multicall target). */
9
+ viewer: string;
10
+ /** WhitelistManager — gates which markets/adapters the ROUTER will touch.
11
+ * Does NOT gate the market/order/GT primitives (those are permissionless). */
12
+ whitelistManager?: string | null;
13
+ /** TermMaxSwapAdapter — the router swap adapter that executes ORDER swaps
14
+ * inside a `SwapPath`. Required to build `borrowTokenFromCollateral`; the
15
+ * order swaps themselves can be called directly without it. */
16
+ termMaxSwapAdapter?: string | null;
17
+ /** Market factories, newest last. Used for event-based discovery when the
18
+ * API is unavailable; not needed on the happy path. */
19
+ marketFactories?: string[] | null;
20
+ /** Legacy V1 router — retired, kept only so a stale key can be recognised
21
+ * and rejected rather than silently encoded against. */
22
+ routerV1?: string | null;
23
+ /** TermMax data API base, e.g. `https://api.termmax.ts.finance`. Overridable
24
+ * per chain so a self-hosted indexer can be swapped in. */
25
+ apiBaseUrl?: string | null;
26
+ };
27
+ export type TermMaxConfigType = {
28
+ [chainId: string]: TermMaxConfigChain;
29
+ };
30
+ /** TermMax per-chain config map (undefined if unloaded). */
31
+ export declare const termMaxConfig: () => TermMaxConfigType;
32
+ /** TermMax deployment addresses for one chain (undefined if unloaded). */
33
+ export declare const termMaxConfigByChain: (chainId: string | number) => TermMaxConfigChain | undefined;
34
+ /** Chains with a TermMax deployment loaded. */
35
+ export declare const termMaxChainIds: () => string[];
36
+ /**
37
+ * TermMax data API base for a chain. Read through the getter (not a module
38
+ * constant) for the same reason as Midnight/Term: the per-request metadata
39
+ * re-init rewrites `termMaxConfig`, so a captured value goes stale.
40
+ */
41
+ export declare const termMaxApiBaseUrl: (chainId: string | number) => string;
42
+ /**
43
+ * Synthesize the per-market lender key for a TermMax market.
44
+ *
45
+ * Mirrors `EXACTLY_<MARKET_ADDRESS_HEX>` / `TELLER_<POOL_ADDRESS_HEX>`. One key
46
+ * per TermMax market, i.e. per (debtToken, collateral, maturity) tuple — the
47
+ * maturity is baked into the market contract, so unlike Exactly there is NO
48
+ * `terms[]` menu underneath a key.
49
+ *
50
+ * Format: `TERMMAX_${marketAddr.slice(2).toUpperCase()}`
51
+ *
52
+ * chainId is intentionally NOT in the token (chain scoping happens at the
53
+ * marketUid level), matching every other per-market key in this package.
54
+ *
55
+ * `isTermMax()` works on this because it matches `startsWith('TERMMAX')`.
56
+ */
57
+ export declare function termMaxLenderKey(market: string): string;
58
+ /**
59
+ * Inverse of `termMaxLenderKey`: given a per-market lender key, return
60
+ * `{ marketAddrLower }`. Returns `undefined` if the key isn't a per-market
61
+ * TermMax key (e.g. someone passed the bare prefix `TERMMAX`).
62
+ */
63
+ export declare function parseTermMaxLenderKey(lenderKey: string): {
64
+ marketAddrLower: string;
65
+ } | undefined;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.0.41",
7
+ "version": "0.0.43",
8
8
  "description": "Hold and initialize lending protocol data across a stack",
9
9
  "files": [
10
10
  "dist"