@defisaver/positions-sdk 2.1.151-midnight-2-dev → 2.1.151

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.
Files changed (42) hide show
  1. package/cjs/claiming/compV3.js +1 -0
  2. package/cjs/config/contracts.d.ts +0 -4
  3. package/cjs/config/contracts.js +0 -4
  4. package/cjs/helpers/morphoMidnightHelpers/tenor.d.ts +2 -6
  5. package/cjs/helpers/morphoMidnightHelpers/tenor.js +1 -5
  6. package/cjs/markets/aaveV4/index.d.ts +2 -0
  7. package/cjs/markets/aaveV4/index.js +13 -1
  8. package/cjs/markets/index.d.ts +1 -1
  9. package/cjs/markets/index.js +1 -2
  10. package/cjs/markets/morphoMidnight/index.d.ts +10 -92
  11. package/cjs/markets/morphoMidnight/index.js +60 -519
  12. package/cjs/morphoMidnight/index.js +1 -11
  13. package/cjs/types/aaveV4.d.ts +1 -0
  14. package/cjs/types/aaveV4.js +1 -0
  15. package/cjs/types/morphoMidnight.d.ts +4 -57
  16. package/cjs/types/morphoMidnight.js +0 -45
  17. package/esm/claiming/compV3.js +1 -0
  18. package/esm/config/contracts.d.ts +0 -4
  19. package/esm/config/contracts.js +0 -4
  20. package/esm/helpers/morphoMidnightHelpers/tenor.d.ts +2 -6
  21. package/esm/helpers/morphoMidnightHelpers/tenor.js +2 -6
  22. package/esm/markets/aaveV4/index.d.ts +2 -0
  23. package/esm/markets/aaveV4/index.js +11 -0
  24. package/esm/markets/index.d.ts +1 -1
  25. package/esm/markets/index.js +1 -1
  26. package/esm/markets/morphoMidnight/index.d.ts +10 -92
  27. package/esm/markets/morphoMidnight/index.js +59 -473
  28. package/esm/morphoMidnight/index.js +1 -11
  29. package/esm/types/aaveV4.d.ts +1 -0
  30. package/esm/types/aaveV4.js +1 -0
  31. package/esm/types/morphoMidnight.d.ts +4 -57
  32. package/esm/types/morphoMidnight.js +0 -45
  33. package/package.json +2 -2
  34. package/src/claiming/compV3.ts +1 -0
  35. package/src/config/contracts.ts +0 -4
  36. package/src/helpers/morphoMidnightHelpers/tenor.ts +2 -6
  37. package/src/markets/aaveV4/index.ts +12 -0
  38. package/src/markets/index.ts +0 -1
  39. package/src/markets/morphoMidnight/index.ts +61 -724
  40. package/src/morphoMidnight/index.ts +1 -8
  41. package/src/types/aaveV4.ts +1 -0
  42. package/src/types/morphoMidnight.ts +3 -59
@@ -71,12 +71,8 @@ export async function _getMorphoMidnightMarketData(provider: Client, network: Ne
71
71
  borrowIncentives: [],
72
72
  };
73
73
 
74
- // `collaterals` is the full on-chain set, so `i` is the index `prices` is keyed by. Hidden entries
75
- // (curator vaults, the loan token itself) are skipped rather than filtered out beforehand, which would
76
- // shift every later collateral onto the wrong price.
77
74
  const collateralSymbols: string[] = [];
78
75
  collaterals.forEach((coll, i) => {
79
- if (coll.hidden) return;
80
76
  const collInfo = getAssetInfoByAddress(coll.token, network);
81
77
  const collSym = wethToEth(collInfo.symbol);
82
78
  collateralSymbols.push(collSym);
@@ -142,10 +138,8 @@ export async function _getMorphoMidnightAccountData(provider: Client, network: N
142
138
  borrowedUsd: new Dec(debt).mul(loanTokenData.price).toString(),
143
139
  };
144
140
 
145
- // positionInfo.collateral is index-aligned with the market's full on-chain collateral set (0 where
146
- // unused), so hidden entries are skipped in place rather than filtered out first.
141
+ // positionInfo.collateral is index-aligned with the market's collateral set (0 where unused).
147
142
  collaterals.forEach((coll, i) => {
148
- if (coll.hidden) return;
149
143
  const collInfo = getAssetInfoByAddress(coll.token, network);
150
144
  const collSym = wethToEth(collInfo.symbol);
151
145
  const rawAmount = positionInfo.collateral[i] ? positionInfo.collateral[i].toString() : '0';
@@ -234,7 +228,6 @@ export const _getMorphoMidnightAccountBalances = async (provider: Client, networ
234
228
 
235
229
  const collateral: Record<string, string> = {};
236
230
  collaterals.forEach((coll, i) => {
237
- if (coll.hidden) return;
238
231
  const collInfo = getAssetInfoByAddress(coll.token, network);
239
232
  const rawAmount = positionInfo.collateral[i] ? positionInfo.collateral[i].toString() : '0';
240
233
  collateral[addressMapping ? collInfo.address.toLowerCase() : wethToEth(collInfo.symbol)] = assetAmountInEth(rawAmount, wethToEth(collInfo.symbol));
@@ -20,6 +20,7 @@ export enum AaveV4SpokesType {
20
20
  AaveV4LidoSpoke = 'aave_v4_lido_spoke',
21
21
  AaveV4LombardBtcSpoke = 'aave_v4_lombard_btc_spoke',
22
22
  AaveV4MainSpoke = 'aave_v4_main_spoke',
23
+ AaveV4PaxgGoldSpoke = 'aave_v4_paxg_gold_spoke',
23
24
  AaveV4USDGPendleSpoke = 'aave_v4_usdg_pendle_spoke',
24
25
  AaveV4USDGMapleSpoke = 'aave_v4_usdg_maple_spoke',
25
26
  }
@@ -39,51 +39,6 @@ export enum MorphoMidnightVersions {
39
39
  MorphoMidnightTenorCbETHWETH_20261127_Base = 'morphomidnighttenorcbethweth_20261127_base',
40
40
  MorphoMidnightTenorCbETHWETH_20261225_Base = 'morphomidnighttenorcbethweth_20261225_base',
41
41
  MorphoMidnightTenorCbETHWETH_20270129_Base = 'morphomidnighttenorcbethweth_20270129_base',
42
- // ETHEREUM
43
- // Sourced from the official listing at https://markets.morpho.org/fixed?chains=1
44
- MorphoMidnightWBTCUSDC_860_20260925_Eth = 'morphomidnightwbtcusdc_860_20260925_eth',
45
- MorphoMidnightWBTCUSDC_860_20261030_Eth = 'morphomidnightwbtcusdc_860_20261030_eth',
46
- MorphoMidnightWBTCUSDC_860_20261127_Eth = 'morphomidnightwbtcusdc_860_20261127_eth',
47
- MorphoMidnightWBTCUSDC_860_20261225_Eth = 'morphomidnightwbtcusdc_860_20261225_eth',
48
- MorphoMidnightWBTCUSDC_860_20270129_Eth = 'morphomidnightwbtcusdc_860_20270129_eth',
49
- MorphoMidnightWBTCUSDC_860_20270226_Eth = 'morphomidnightwbtcusdc_860_20270226_eth',
50
- MorphoMidnightWBTCUSDC_860_20270326_Eth = 'morphomidnightwbtcusdc_860_20270326_eth',
51
- MorphoMidnightCbBTCUSDC_860_20260925_Eth = 'morphomidnightcbbtcusdc_860_20260925_eth',
52
- MorphoMidnightCbBTCUSDC_860_20261030_Eth = 'morphomidnightcbbtcusdc_860_20261030_eth',
53
- MorphoMidnightCbBTCUSDC_860_20261127_Eth = 'morphomidnightcbbtcusdc_860_20261127_eth',
54
- MorphoMidnightCbBTCUSDC_860_20261225_Eth = 'morphomidnightcbbtcusdc_860_20261225_eth',
55
- MorphoMidnightCbBTCUSDC_860_20270129_Eth = 'morphomidnightcbbtcusdc_860_20270129_eth',
56
- MorphoMidnightCbBTCUSDC_860_20270226_Eth = 'morphomidnightcbbtcusdc_860_20270226_eth',
57
- MorphoMidnightCbBTCUSDC_860_20270326_Eth = 'morphomidnightcbbtcusdc_860_20270326_eth',
58
- // Tenor-hosted Midnight markets (same core, different order book)
59
- MorphoMidnightTenorReUSDUSDC_20260925_Eth = 'morphomidnighttenorreusdusdc_20260925_eth',
60
- MorphoMidnightTenorReUSDUSDC_20261030_Eth = 'morphomidnighttenorreusdusdc_20261030_eth',
61
- MorphoMidnightTenorReUSDUSDC_20261127_Eth = 'morphomidnighttenorreusdusdc_20261127_eth',
62
- MorphoMidnightTenorReUSDUSDC_20261225_Eth = 'morphomidnighttenorreusdusdc_20261225_eth',
63
- MorphoMidnightTenorSiUSDUSDC_20260925_Eth = 'morphomidnighttenorsiusdusdc_20260925_eth',
64
- MorphoMidnightTenorSiUSDUSDC_20261030_Eth = 'morphomidnighttenorsiusdusdc_20261030_eth',
65
- MorphoMidnightTenorSiUSDUSDC_20261127_Eth = 'morphomidnighttenorsiusdusdc_20261127_eth',
66
- MorphoMidnightTenorSiUSDUSDC_20261225_Eth = 'morphomidnighttenorsiusdusdc_20261225_eth',
67
- MorphoMidnightTenorStrUSDUSDC_20260925_Eth = 'morphomidnighttenorstrusdusdc_20260925_eth',
68
- MorphoMidnightTenorStrUSDUSDC_20261030_Eth = 'morphomidnighttenorstrusdusdc_20261030_eth',
69
- MorphoMidnightTenorStrUSDUSDC_20261127_Eth = 'morphomidnighttenorstrusdusdc_20261127_eth',
70
- MorphoMidnightTenorStrUSDUSDC_20261225_Eth = 'morphomidnighttenorstrusdusdc_20261225_eth',
71
- MorphoMidnightTenorUSD3USDC_20260925_Eth = 'morphomidnighttenorusd3usdc_20260925_eth',
72
- MorphoMidnightTenorUSD3USDC_20261030_Eth = 'morphomidnighttenorusd3usdc_20261030_eth',
73
- MorphoMidnightTenorUSD3USDC_20261127_Eth = 'morphomidnighttenorusd3usdc_20261127_eth',
74
- MorphoMidnightTenorUSD3USDC_20261225_Eth = 'morphomidnighttenorusd3usdc_20261225_eth',
75
- MorphoMidnightTenorWETHUSDC_20260925_Eth = 'morphomidnighttenorwethusdc_20260925_eth',
76
- MorphoMidnightTenorWETHUSDC_20261030_Eth = 'morphomidnighttenorwethusdc_20261030_eth',
77
- MorphoMidnightTenorWETHUSDC_20261127_Eth = 'morphomidnighttenorwethusdc_20261127_eth',
78
- MorphoMidnightTenorWETHUSDC_20261225_Eth = 'morphomidnighttenorwethusdc_20261225_eth',
79
- MorphoMidnightTenorWsrUSDUSDC_20260925_Eth = 'morphomidnighttenorwsrusdusdc_20260925_eth',
80
- MorphoMidnightTenorWsrUSDUSDC_20261030_Eth = 'morphomidnighttenorwsrusdusdc_20261030_eth',
81
- MorphoMidnightTenorWsrUSDUSDC_20261127_Eth = 'morphomidnighttenorwsrusdusdc_20261127_eth',
82
- MorphoMidnightTenorWsrUSDUSDC_20261225_Eth = 'morphomidnighttenorwsrusdusdc_20261225_eth',
83
- MorphoMidnightTenorWstETHWETH_20260925_Eth = 'morphomidnighttenorwstethweth_20260925_eth',
84
- MorphoMidnightTenorWstETHWETH_20261030_Eth = 'morphomidnighttenorwstethweth_20261030_eth',
85
- MorphoMidnightTenorWstETHWETH_20261127_Eth = 'morphomidnighttenorwstethweth_20261127_eth',
86
- MorphoMidnightTenorWstETHWETH_20261225_Eth = 'morphomidnighttenorwstethweth_20261225_eth',
87
42
  }
88
43
 
89
44
  export type MorphoMidnightCurator = 'Morpho' | 'Tenor';
@@ -93,13 +48,6 @@ export interface MorphoMidnightCollateralParams {
93
48
  lltv: number | string,
94
49
  liquidationCursor: number | string,
95
50
  oracle: EthAddress,
96
- /**
97
- * A collateral the market carries on-chain but the app never surfaces: a curator's own vault share
98
- * token (Tenor's collateral vaults) or the loan token itself (Morpho's mainnet ladders list USDC at
99
- * 98% next to the real collateral). It is not an asset the app deals in — nothing renders, prices or
100
- * supplies it — but it stays in `collaterals` because the market id is the hash of the full set.
101
- */
102
- hidden?: boolean,
103
51
  }
104
52
 
105
53
  export interface MorphoMidnightMarketData {
@@ -110,15 +58,11 @@ export interface MorphoMidnightMarketData {
110
58
  value: MorphoMidnightVersions,
111
59
  midnight: EthAddress,
112
60
  loanToken: EthAddress,
61
+ collaterals: MorphoMidnightCollateralParams[],
113
62
  /**
114
- * Every collateral the market carries on-chain, in the chain's own order which is what the id is
115
- * hashed from, so neither the set nor the order may be rearranged. Entries the app does not deal in
116
- * are flagged `hidden` rather than kept in a second list: their on-chain position varies per market
117
- * (Morpho's mainnet cbBTC ladder lists USDC first, its WBTC ladder second), so a separate list can
118
- * only be re-joined by guessing, and every positional read — `MarketInfo.prices[i]`,
119
- * `PositionInfo.collateral[i]`, the collateral index a supply call takes — indexes into *this* array.
63
+ * Tenor's curated markets list the curator's own vault share token next to the real collateral.
120
64
  */
121
- collaterals: MorphoMidnightCollateralParams[],
65
+ hiddenCollaterals?: MorphoMidnightCollateralParams[],
122
66
  maturity: number, // unix timestamp (seconds)
123
67
  rcfThreshold: number | string,
124
68
  enterGate: EthAddress,