@defisaver/positions-sdk 2.1.6 → 2.1.8

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 (132) hide show
  1. package/.mocharc.json +4 -4
  2. package/.nvmrc +1 -1
  3. package/README.md +64 -64
  4. package/cjs/aaveV3/index.js +3 -3
  5. package/cjs/aaveV3/merit.js +5 -3
  6. package/cjs/aaveV3/merkl.d.ts +1 -1
  7. package/cjs/config/contracts.d.ts +23 -0
  8. package/cjs/config/contracts.js +23 -0
  9. package/cjs/helpers/aaveHelpers/index.d.ts +1 -1
  10. package/cjs/helpers/aaveHelpers/index.js +6 -4
  11. package/cjs/helpers/morphoBlueHelpers/index.d.ts +1 -1
  12. package/cjs/helpers/morphoBlueHelpers/index.js +66 -66
  13. package/cjs/markets/aave/index.js +1 -1
  14. package/cjs/markets/aave/marketAssets.d.ts +4 -0
  15. package/cjs/markets/aave/marketAssets.js +5 -1
  16. package/cjs/markets/compound/index.js +11 -0
  17. package/cjs/markets/compound/marketsAssets.d.ts +7 -0
  18. package/cjs/markets/compound/marketsAssets.js +7 -0
  19. package/cjs/markets/spark/marketAssets.d.ts +1 -0
  20. package/cjs/markets/spark/marketAssets.js +1 -0
  21. package/cjs/services/utils.d.ts +8 -4
  22. package/cjs/services/utils.js +30 -10
  23. package/cjs/services/viem.d.ts +54 -15
  24. package/cjs/services/viem.js +2 -0
  25. package/cjs/staking/eligibility.js +1 -6
  26. package/cjs/types/common.d.ts +4 -2
  27. package/cjs/types/common.js +2 -0
  28. package/esm/aaveV3/index.js +4 -4
  29. package/esm/aaveV3/merit.js +5 -3
  30. package/esm/aaveV3/merkl.d.ts +1 -1
  31. package/esm/config/contracts.d.ts +23 -0
  32. package/esm/config/contracts.js +23 -0
  33. package/esm/helpers/aaveHelpers/index.d.ts +1 -1
  34. package/esm/helpers/aaveHelpers/index.js +7 -5
  35. package/esm/helpers/morphoBlueHelpers/index.d.ts +1 -1
  36. package/esm/helpers/morphoBlueHelpers/index.js +66 -66
  37. package/esm/markets/aave/index.js +1 -1
  38. package/esm/markets/aave/marketAssets.d.ts +4 -0
  39. package/esm/markets/aave/marketAssets.js +4 -0
  40. package/esm/markets/compound/index.js +11 -0
  41. package/esm/markets/compound/marketsAssets.d.ts +7 -0
  42. package/esm/markets/compound/marketsAssets.js +7 -0
  43. package/esm/markets/spark/marketAssets.d.ts +1 -0
  44. package/esm/markets/spark/marketAssets.js +1 -0
  45. package/esm/services/utils.d.ts +8 -4
  46. package/esm/services/utils.js +21 -5
  47. package/esm/services/viem.d.ts +54 -15
  48. package/esm/services/viem.js +3 -1
  49. package/esm/staking/eligibility.js +1 -6
  50. package/esm/types/common.d.ts +4 -2
  51. package/esm/types/common.js +2 -0
  52. package/package.json +47 -47
  53. package/src/aaveV2/index.ts +240 -240
  54. package/src/aaveV3/index.ts +614 -614
  55. package/src/aaveV3/merit.ts +97 -94
  56. package/src/aaveV3/merkl.ts +74 -74
  57. package/src/claiming/aaveV3.ts +154 -154
  58. package/src/claiming/compV3.ts +22 -22
  59. package/src/claiming/index.ts +12 -12
  60. package/src/claiming/king.ts +66 -66
  61. package/src/claiming/morphoBlue.ts +118 -118
  62. package/src/claiming/spark.ts +225 -225
  63. package/src/compoundV2/index.ts +244 -244
  64. package/src/compoundV3/index.ts +274 -274
  65. package/src/config/contracts.ts +1251 -1228
  66. package/src/constants/index.ts +10 -10
  67. package/src/contracts.ts +120 -120
  68. package/src/curveUsd/index.ts +254 -254
  69. package/src/eulerV2/index.ts +324 -324
  70. package/src/exchange/index.ts +25 -25
  71. package/src/fluid/index.ts +1638 -1638
  72. package/src/helpers/aaveHelpers/index.ts +187 -185
  73. package/src/helpers/compoundHelpers/index.ts +283 -283
  74. package/src/helpers/curveUsdHelpers/index.ts +40 -40
  75. package/src/helpers/eulerHelpers/index.ts +222 -222
  76. package/src/helpers/fluidHelpers/index.ts +326 -326
  77. package/src/helpers/index.ts +10 -10
  78. package/src/helpers/liquityV2Helpers/index.ts +82 -82
  79. package/src/helpers/llamaLendHelpers/index.ts +53 -53
  80. package/src/helpers/makerHelpers/index.ts +52 -52
  81. package/src/helpers/morphoBlueHelpers/index.ts +396 -396
  82. package/src/helpers/sparkHelpers/index.ts +155 -155
  83. package/src/index.ts +47 -47
  84. package/src/liquity/index.ts +159 -159
  85. package/src/liquityV2/index.ts +657 -657
  86. package/src/llamaLend/index.ts +305 -305
  87. package/src/maker/index.ts +223 -223
  88. package/src/markets/aave/index.ts +116 -116
  89. package/src/markets/aave/marketAssets.ts +54 -49
  90. package/src/markets/compound/index.ts +238 -227
  91. package/src/markets/compound/marketsAssets.ts +97 -90
  92. package/src/markets/curveUsd/index.ts +69 -69
  93. package/src/markets/euler/index.ts +26 -26
  94. package/src/markets/fluid/index.ts +2456 -2456
  95. package/src/markets/index.ts +25 -25
  96. package/src/markets/liquityV2/index.ts +102 -102
  97. package/src/markets/llamaLend/contractAddresses.ts +141 -141
  98. package/src/markets/llamaLend/index.ts +235 -235
  99. package/src/markets/morphoBlue/index.ts +895 -895
  100. package/src/markets/spark/index.ts +29 -29
  101. package/src/markets/spark/marketAssets.ts +12 -11
  102. package/src/moneymarket/moneymarketCommonService.ts +80 -80
  103. package/src/morphoBlue/index.ts +274 -274
  104. package/src/portfolio/index.ts +570 -570
  105. package/src/services/priceService.ts +159 -159
  106. package/src/services/utils.ts +115 -99
  107. package/src/services/viem.ts +34 -32
  108. package/src/setup.ts +8 -8
  109. package/src/spark/index.ts +445 -445
  110. package/src/staking/eligibility.ts +53 -59
  111. package/src/staking/index.ts +1 -1
  112. package/src/staking/staking.ts +170 -170
  113. package/src/types/aave.ts +189 -189
  114. package/src/types/claiming.ts +109 -109
  115. package/src/types/common.ts +107 -105
  116. package/src/types/compound.ts +136 -136
  117. package/src/types/curveUsd.ts +123 -123
  118. package/src/types/euler.ts +175 -175
  119. package/src/types/fluid.ts +448 -448
  120. package/src/types/index.ts +13 -13
  121. package/src/types/liquity.ts +30 -30
  122. package/src/types/liquityV2.ts +126 -126
  123. package/src/types/llamaLend.ts +159 -159
  124. package/src/types/maker.ts +63 -63
  125. package/src/types/merit.ts +1 -1
  126. package/src/types/merkl.ts +70 -70
  127. package/src/types/morphoBlue.ts +194 -194
  128. package/src/types/portfolio.ts +60 -60
  129. package/src/types/spark.ts +135 -135
  130. package/src/umbrella/index.ts +69 -69
  131. package/src/umbrella/umbrellaUtils.ts +29 -29
  132. package/CLAUDE.md +0 -32
@@ -227,6 +227,11 @@ export const AaveV3View = {
227
227
  "address": "0xc9D6EfA6e08B66a5Cdc516Bcd5807c2fa69E0f2A"
228
228
  }
229
229
  },
230
+ },
231
+ "9745": {
232
+ "address": "0xD8E67968d8a0df4beCf2D50daE1e34d4d80C701C",
233
+ "createdBlock": 1880799,
234
+ "oldVersions": {},
230
235
  }
231
236
  }
232
237
  };
@@ -247,6 +252,9 @@ export const AaveV3PoolAddressesProvider = {
247
252
  },
248
253
  "59144": {
249
254
  "address": "0x89502c3731F69DDC95B65753708A07F8Cd0373F4"
255
+ },
256
+ "9745": {
257
+ "address": "0x061D8e131F26512348ee5FA42e2DF1bA9d6505E9"
250
258
  }
251
259
  }
252
260
  };
@@ -283,6 +291,9 @@ export const AaveV3LendingPool = {
283
291
  },
284
292
  "59144": {
285
293
  "address": "0xc47b8C00b0f69a36fa203Ffeac0334874574a8Ac"
294
+ },
295
+ "9745": {
296
+ "address": "0x925a2A7214Ed92428B5b1B090F80b25700095e12"
286
297
  }
287
298
  }
288
299
  };
@@ -319,6 +330,9 @@ export const AaveV3ProtocolDataProvider = {
319
330
  },
320
331
  "59144": {
321
332
  "address": "0x47cd4b507B81cB831669c71c7077f4daF6762FF4"
333
+ },
334
+ "9745": {
335
+ "address": "0xf2D6E38B407e31E7E7e4a16E6769728b76c7419F"
322
336
  }
323
337
  }
324
338
  };
@@ -355,6 +369,9 @@ export const AaveUiIncentiveDataProviderV3 = {
355
369
  },
356
370
  "59144": {
357
371
  "address": "0x117684358D990E42Eb1649E7e8C4691951dc1E71"
372
+ },
373
+ "9745": {
374
+ "address": "0xcb85C501B3A5e9851850d66648d69B26A4c90942"
358
375
  }
359
376
  }
360
377
  };
@@ -1202,6 +1219,12 @@ export const AaveRewardsController = {
1202
1219
  },
1203
1220
  "42161": {
1204
1221
  "address": "0x929EC64c34a17401F460460D4B9390518E5B473e"
1222
+ },
1223
+ "59144": {
1224
+ "address": "0xc67bb8F2314fA0df50cBa314c6509A7bdAD500C0"
1225
+ },
1226
+ "9745": {
1227
+ "address": "0x3A57eAa3Ca3794D66977326af7991eB3F6dD5a5A"
1205
1228
  }
1206
1229
  }
1207
1230
  };
@@ -44,4 +44,4 @@ export declare const getApyAfterValuesEstimation: (selectedMarket: AaveMarketInf
44
44
  /**
45
45
  * won't cover all cases
46
46
  */
47
- export declare const getAaveUnderlyingSymbol: (_symbol?: string) => any;
47
+ export declare const getAaveUnderlyingSymbol: (_symbol?: string) => string;
@@ -21,7 +21,7 @@ var __rest = (this && this.__rest) || function (s, e) {
21
21
  import Dec from 'decimal.js';
22
22
  import { assetAmountInWei, getAssetInfo, getAssetInfoByAddress } from '@defisaver/tokens';
23
23
  import { AaveVersions, } from '../../types';
24
- import { ethToWeth, wethToEth } from '../../services/utils';
24
+ import { getNativeAssetFromWrapped, getWrappedNativeAssetFromUnwrapped } from '../../services/utils';
25
25
  import { aprToApy, calcLeverageLiqPrice, getAssetsTotal, isLeveragedPos, } from '../../moneymarket';
26
26
  import { calculateNetApy } from '../../staking';
27
27
  import { borrowOperations } from '../../constants';
@@ -52,7 +52,7 @@ export const aaveAnyGetSuppliableAsCollAssets = (_a) => {
52
52
  return aaveAnyGetSuppliableAssets(Object.assign({ usedAssets, eModeCategory, assetsData, selectedMarket, network }, rest)).filter(({ canBeCollateral }) => canBeCollateral);
53
53
  };
54
54
  export const aaveAnyGetEmodeMutableProps = ({ eModeCategory, eModeCategoriesData, assetsData, }, _asset) => {
55
- const asset = wethToEth(_asset);
55
+ const asset = getNativeAssetFromWrapped(_asset);
56
56
  const assetData = assetsData[asset];
57
57
  const eModeCategoryData = (eModeCategoriesData === null || eModeCategoriesData === void 0 ? void 0 : eModeCategoriesData[eModeCategory]) || { collateralAssets: [], collateralFactor: '0', liquidationRatio: '0' };
58
58
  if (eModeCategory === 0
@@ -110,7 +110,7 @@ const getApyAfterValuesEstimationInner = (selectedMarket, actions, client, netwo
110
110
  const params = actions.map(({ action, asset, amount }) => {
111
111
  const isDebtAsset = borrowOperations.includes(action);
112
112
  const amountInWei = assetAmountInWei(amount, asset);
113
- const assetInfo = getAssetInfo(ethToWeth(asset), network);
113
+ const assetInfo = getAssetInfo(getWrappedNativeAssetFromUnwrapped(asset), network);
114
114
  let liquidityAdded;
115
115
  let liquidityTaken;
116
116
  if (isDebtAsset) {
@@ -132,7 +132,7 @@ const getApyAfterValuesEstimationInner = (selectedMarket, actions, client, netwo
132
132
  const data = yield viewContract.read.getApyAfterValuesEstimation([selectedMarket.providerAddress, params]);
133
133
  const rates = {};
134
134
  data.forEach((d) => {
135
- const asset = wethToEth(getAssetInfoByAddress(d.reserveAddress, network).symbol);
135
+ const asset = getNativeAssetFromWrapped(getAssetInfoByAddress(d.reserveAddress, network).symbol);
136
136
  rates[asset] = {
137
137
  supplyRate: aprToApy(new Dec(d.supplyRate.toString()).div(1e25).toString()),
138
138
  borrowRate: aprToApy(new Dec(d.variableBorrowRate.toString()).div(1e25).toString()),
@@ -151,8 +151,10 @@ export const getAaveUnderlyingSymbol = (_symbol = '') => {
151
151
  .replace(/^aEth/, '')
152
152
  .replace(/^aArb/, '')
153
153
  .replace(/^aOpt/, '')
154
+ .replace(/^aLin/, '')
155
+ .replace(/^aPla/, '')
154
156
  .replace(/^aBas/, '');
155
157
  if (symbol.startsWith('a'))
156
158
  symbol = symbol.slice(1);
157
- return wethToEth(symbol);
159
+ return getNativeAssetFromWrapped(symbol);
158
160
  };
@@ -56,4 +56,4 @@ export declare const getRewardsForMarket: (marketId: string, network?: NetworkNu
56
56
  supplyApy: string;
57
57
  borrowApy: string;
58
58
  }>;
59
- export declare const getMorphoUnderlyingSymbol: (_symbol: string) => any;
59
+ export declare const getMorphoUnderlyingSymbol: (_symbol: string) => string;
@@ -118,73 +118,73 @@ export const getApyAfterValuesEstimation = (selectedMarket, actions, provider, n
118
118
  return { borrowRate, supplyRate };
119
119
  });
120
120
  const API_URL = 'https://blue-api.morpho.org/graphql';
121
- const MARKET_QUERY = `
122
- query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
123
- marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
124
- reallocatableLiquidityAssets
125
- targetBorrowUtilization
126
- loanAsset {
127
- address
128
- decimals
129
- priceUsd
130
- }
131
- state {
132
- liquidityAssets
133
- borrowAssets
134
- supplyAssets
135
- }
136
- publicAllocatorSharedLiquidity {
137
- assets
138
- vault {
139
- address
140
- name
141
- }
142
- allocationMarket {
143
- uniqueKey
144
- loanAsset {
145
- address
146
- }
147
- collateralAsset {
148
- address
149
- }
150
- irmAddress
151
- oracle {
152
- address
153
- }
154
- lltv
155
- }
156
- }
157
- loanAsset {
158
- address
159
- }
160
- collateralAsset {
161
- address
162
- }
163
- oracle {
164
- address
165
- }
166
- irmAddress
167
- lltv
168
- }
169
- }
121
+ const MARKET_QUERY = `
122
+ query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
123
+ marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
124
+ reallocatableLiquidityAssets
125
+ targetBorrowUtilization
126
+ loanAsset {
127
+ address
128
+ decimals
129
+ priceUsd
130
+ }
131
+ state {
132
+ liquidityAssets
133
+ borrowAssets
134
+ supplyAssets
135
+ }
136
+ publicAllocatorSharedLiquidity {
137
+ assets
138
+ vault {
139
+ address
140
+ name
141
+ }
142
+ allocationMarket {
143
+ uniqueKey
144
+ loanAsset {
145
+ address
146
+ }
147
+ collateralAsset {
148
+ address
149
+ }
150
+ irmAddress
151
+ oracle {
152
+ address
153
+ }
154
+ lltv
155
+ }
156
+ }
157
+ loanAsset {
158
+ address
159
+ }
160
+ collateralAsset {
161
+ address
162
+ }
163
+ oracle {
164
+ address
165
+ }
166
+ irmAddress
167
+ lltv
168
+ }
169
+ }
170
170
  `;
171
- const REWARDS_QUERY = `
172
- query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
173
- marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
174
- uniqueKey
175
- state {
176
- rewards {
177
- amountPerSuppliedToken
178
- supplyApr
179
- amountPerBorrowedToken
180
- borrowApr
181
- asset {
182
- address
183
- }
184
- }
185
- }
186
- }
187
- }
171
+ const REWARDS_QUERY = `
172
+ query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
173
+ marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
174
+ uniqueKey
175
+ state {
176
+ rewards {
177
+ amountPerSuppliedToken
178
+ supplyApr
179
+ amountPerBorrowedToken
180
+ borrowApr
181
+ asset {
182
+ address
183
+ }
184
+ }
185
+ }
186
+ }
187
+ }
188
188
  `;
189
189
  /**
190
190
  * Get reallocatable liquidity to a given market and target borrow utilization
@@ -39,7 +39,7 @@ export const AAVE_V2 = {
39
39
  protocolName: 'aave',
40
40
  };
41
41
  export const AAVE_V3 = (networkId) => ({
42
- chainIds: [NetworkNumber.Eth, NetworkNumber.Opt, NetworkNumber.Arb, NetworkNumber.Base, NetworkNumber.Linea],
42
+ chainIds: [NetworkNumber.Eth, NetworkNumber.Opt, NetworkNumber.Arb, NetworkNumber.Base, NetworkNumber.Linea, NetworkNumber.Plasma],
43
43
  label: networkId === NetworkNumber.Eth ? 'Aave v3 Core' : 'Aave v3',
44
44
  shortLabel: 'v3',
45
45
  value: AaveVersions.AaveV3,
@@ -6,12 +6,14 @@ export declare const aaveV3AssetsDefaultMarketOpt: string[];
6
6
  export declare const aaveV3AssetsDefaultMarketArb: string[];
7
7
  export declare const aaveV3AssetsDefaultMarketBase: string[];
8
8
  export declare const aaveV3AssetsDefaultMarketLinea: string[];
9
+ export declare const aaveV3AssetsDefaultMarketPlasma: string[];
9
10
  export declare const aaveV3AssetsDefaultMarket: {
10
11
  readonly 1: string[];
11
12
  readonly 10: string[];
12
13
  readonly 42161: string[];
13
14
  readonly 8453: string[];
14
15
  readonly 59144: string[];
16
+ readonly 9745: string[];
15
17
  };
16
18
  export declare const aaveV3AssetsLidoMarketEth: string[];
17
19
  export declare const aaveV3AssetsLidoMarket: {
@@ -20,6 +22,7 @@ export declare const aaveV3AssetsLidoMarket: {
20
22
  readonly 42161: readonly [];
21
23
  readonly 8453: readonly [];
22
24
  readonly 59144: readonly [];
25
+ readonly 9745: readonly [];
23
26
  };
24
27
  export declare const aaveV3AssetsEtherfiMarketEth: string[];
25
28
  export declare const aaveV3AssetsEtherfiMarket: {
@@ -28,4 +31,5 @@ export declare const aaveV3AssetsEtherfiMarket: {
28
31
  readonly 42161: readonly [];
29
32
  readonly 8453: readonly [];
30
33
  readonly 59144: readonly [];
34
+ readonly 9745: readonly [];
31
35
  };
@@ -15,6 +15,7 @@ export const aaveV3AssetsDefaultMarketOpt = [
15
15
  export const aaveV3AssetsDefaultMarketArb = ['DAI', 'LINK', 'USDC.e', 'WBTC', 'ETH', 'USDT', 'AAVE', 'EURS', 'wstETH', 'MAI', 'rETH', 'LUSD', 'USDC', 'FRAX', 'ARB', 'weETH', 'GHO', 'ezETH', 'rsETH', 'tBTC'];
16
16
  export const aaveV3AssetsDefaultMarketBase = ['ETH', 'cbETH', 'USDbC', 'wstETH', 'USDC', 'weETH', 'cbBTC', 'ezETH', 'GHO', 'wrsETH', 'LBTC', 'EURC', 'AAVE', 'tBTC'];
17
17
  export const aaveV3AssetsDefaultMarketLinea = ['ETH', 'USDC', 'weETH', 'ezETH', 'USDT', 'wstETH', 'wrsETH', 'WBTC'];
18
+ export const aaveV3AssetsDefaultMarketPlasma = ['ETH', 'USDT', 'sUSDe', 'USDe', 'weETH', 'XAUt'];
18
19
  // @dev Keep assets in array, do not assign directly, so we can parse it and edit it programmatically with `scripts/updateMarkets`
19
20
  export const aaveV3AssetsDefaultMarket = {
20
21
  [NetworkNumber.Eth]: aaveV3AssetsDefaultMarketEth,
@@ -22,6 +23,7 @@ export const aaveV3AssetsDefaultMarket = {
22
23
  [NetworkNumber.Arb]: aaveV3AssetsDefaultMarketArb,
23
24
  [NetworkNumber.Base]: aaveV3AssetsDefaultMarketBase,
24
25
  [NetworkNumber.Linea]: aaveV3AssetsDefaultMarketLinea,
26
+ [NetworkNumber.Plasma]: aaveV3AssetsDefaultMarketPlasma,
25
27
  };
26
28
  export const aaveV3AssetsLidoMarketEth = ['ETH', 'wstETH', 'USDS', 'USDC', 'ezETH', 'sUSDe', 'GHO', 'rsETH', 'tETH'];
27
29
  export const aaveV3AssetsLidoMarket = {
@@ -30,6 +32,7 @@ export const aaveV3AssetsLidoMarket = {
30
32
  [NetworkNumber.Arb]: [],
31
33
  [NetworkNumber.Base]: [],
32
34
  [NetworkNumber.Linea]: [],
35
+ [NetworkNumber.Plasma]: [],
33
36
  };
34
37
  export const aaveV3AssetsEtherfiMarketEth = ['weETH', 'USDC', 'PYUSD', 'FRAX'];
35
38
  export const aaveV3AssetsEtherfiMarket = {
@@ -38,4 +41,5 @@ export const aaveV3AssetsEtherfiMarket = {
38
41
  [NetworkNumber.Arb]: [],
39
42
  [NetworkNumber.Base]: [],
40
43
  [NetworkNumber.Linea]: [],
44
+ [NetworkNumber.Plasma]: [],
41
45
  };
@@ -65,6 +65,17 @@ const BULKER_OPTIONS = {
65
65
  [CompoundVersions.CompoundV3wstETH]: EMPTY_BULKER_OPTIONS,
66
66
  [CompoundVersions.CompoundV3USDS]: EMPTY_BULKER_OPTIONS,
67
67
  },
68
+ [NetworkNumber.Plasma]: {
69
+ // Non-existing markets, keeping it because of typescript
70
+ [CompoundVersions.CompoundV3USDC]: EMPTY_BULKER_OPTIONS,
71
+ [CompoundVersions.CompoundV3USDT]: EMPTY_BULKER_OPTIONS,
72
+ [CompoundVersions.CompoundV3ETH]: EMPTY_BULKER_OPTIONS,
73
+ [CompoundVersions.CompoundV3USDbC]: EMPTY_BULKER_OPTIONS,
74
+ [CompoundVersions.CompoundV2]: EMPTY_BULKER_OPTIONS,
75
+ [CompoundVersions.CompoundV3USDCe]: EMPTY_BULKER_OPTIONS,
76
+ [CompoundVersions.CompoundV3wstETH]: EMPTY_BULKER_OPTIONS,
77
+ [CompoundVersions.CompoundV3USDS]: EMPTY_BULKER_OPTIONS,
78
+ },
68
79
  };
69
80
  export const COMPOUND_V2 = {
70
81
  chainIds: [NetworkNumber.Eth],
@@ -10,6 +10,7 @@ export declare const v3USDCCollAssets: {
10
10
  readonly 42161: string[];
11
11
  readonly 8453: string[];
12
12
  readonly 59144: readonly [];
13
+ readonly 9745: readonly [];
13
14
  };
14
15
  export declare const v3USDCeCollAssetsArb: string[];
15
16
  export declare const v3USDCeCollAssets: {
@@ -18,6 +19,7 @@ export declare const v3USDCeCollAssets: {
18
19
  readonly 42161: string[];
19
20
  readonly 8453: readonly [];
20
21
  readonly 59144: readonly [];
22
+ readonly 9745: readonly [];
21
23
  };
22
24
  export declare const v3ETHCollAssetsEth: string[];
23
25
  export declare const v3ETHCollAssetsBase: string[];
@@ -29,6 +31,7 @@ export declare const v3ETHCollAssets: {
29
31
  readonly 42161: string[];
30
32
  readonly 8453: string[];
31
33
  readonly 59144: readonly [];
34
+ readonly 9745: readonly [];
32
35
  };
33
36
  export declare const v3USDbCCollAssetsBase: string[];
34
37
  export declare const v3USDbCCollAssets: {
@@ -37,6 +40,7 @@ export declare const v3USDbCCollAssets: {
37
40
  42161: never[];
38
41
  8453: string[];
39
42
  59144: never[];
43
+ 9745: never[];
40
44
  };
41
45
  export declare const v3USDTCollAssetsEth: string[];
42
46
  export declare const v3USDTCollAssetsArb: string[];
@@ -47,6 +51,7 @@ export declare const v3USDTCollAssets: {
47
51
  42161: string[];
48
52
  8453: never[];
49
53
  59144: never[];
54
+ 9745: never[];
50
55
  };
51
56
  export declare const v3USDSCollAssetsEth: string[];
52
57
  export declare const v3USDSCollAssetsBase: string[];
@@ -56,6 +61,7 @@ export declare const v3USDSCollAssets: {
56
61
  42161: never[];
57
62
  8453: string[];
58
63
  59144: never[];
64
+ 9745: never[];
59
65
  };
60
66
  export declare const v3wstETHCollAssetsEth: string[];
61
67
  export declare const v3wstETHCollAssets: {
@@ -64,4 +70,5 @@ export declare const v3wstETHCollAssets: {
64
70
  42161: never[];
65
71
  8453: never[];
66
72
  59144: never[];
73
+ 9745: never[];
67
74
  };
@@ -15,6 +15,7 @@ export const v3USDCCollAssets = {
15
15
  [NetworkNumber.Arb]: v3USDCCollAssetsArb,
16
16
  [NetworkNumber.Base]: v3USDCCollAssetsBase,
17
17
  [NetworkNumber.Linea]: [],
18
+ [NetworkNumber.Plasma]: [],
18
19
  };
19
20
  export const v3USDCeCollAssetsArb = ['ARB', 'ETH', 'GMX', 'WBTC'];
20
21
  // @dev Keep assets in array, do not assign directly, so we can parse it and edit it programmatically with `scripts/updateMarkets`
@@ -24,6 +25,7 @@ export const v3USDCeCollAssets = {
24
25
  [NetworkNumber.Arb]: v3USDCeCollAssetsArb,
25
26
  [NetworkNumber.Base]: [],
26
27
  [NetworkNumber.Linea]: [],
28
+ [NetworkNumber.Plasma]: [],
27
29
  };
28
30
  export const v3ETHCollAssetsEth = ['cbETH', 'wstETH', 'rETH', 'rsETH', 'weETH', 'osETH', 'WBTC', 'ezETH', 'cbBTC', 'rswETH', 'tBTC', 'ETHx', 'tETH', 'pufETH', 'wOETH'];
29
31
  export const v3ETHCollAssetsBase = ['cbETH', 'ezETH', 'wstETH', 'USDC', 'weETH', 'wrsETH', 'cbBTC', 'wsuperOETHb'];
@@ -36,6 +38,7 @@ export const v3ETHCollAssets = {
36
38
  [NetworkNumber.Arb]: v3ETHCollAssetsArb,
37
39
  [NetworkNumber.Base]: v3ETHCollAssetsBase,
38
40
  [NetworkNumber.Linea]: [],
41
+ [NetworkNumber.Plasma]: [],
39
42
  };
40
43
  export const v3USDbCCollAssetsBase = ['ETH', 'cbETH'];
41
44
  // @dev Keep assets in array, do not assign directly, so we can parse it and edit it programmatically with `scripts/updateMarkets`
@@ -45,6 +48,7 @@ export const v3USDbCCollAssets = {
45
48
  [NetworkNumber.Arb]: [],
46
49
  [NetworkNumber.Base]: v3USDbCCollAssetsBase,
47
50
  [NetworkNumber.Linea]: [],
51
+ [NetworkNumber.Plasma]: [],
48
52
  };
49
53
  export const v3USDTCollAssetsEth = ['COMP', 'ETH', 'WBTC', 'UNI', 'LINK', 'wstETH', 'cbBTC', 'tBTC', 'wUSDM', 'sFRAX', 'mETH', 'weETH', 'sdeUSD', 'deUSD'];
50
54
  export const v3USDTCollAssetsArb = ['ETH', 'WBTC', 'wstETH', 'ARB', 'GMX'];
@@ -56,6 +60,7 @@ export const v3USDTCollAssets = {
56
60
  [NetworkNumber.Arb]: v3USDTCollAssetsArb,
57
61
  [NetworkNumber.Base]: [],
58
62
  [NetworkNumber.Linea]: [],
63
+ [NetworkNumber.Plasma]: [],
59
64
  };
60
65
  export const v3USDSCollAssetsEth = ['wstETH', 'ETH', 'sUSDS', 'cbETH', 'tBTC', 'USDe'];
61
66
  export const v3USDSCollAssetsBase = ['sUSDS', 'cbBTC'];
@@ -65,6 +70,7 @@ export const v3USDSCollAssets = {
65
70
  [NetworkNumber.Arb]: [],
66
71
  [NetworkNumber.Base]: v3USDSCollAssetsBase,
67
72
  [NetworkNumber.Linea]: [],
73
+ [NetworkNumber.Plasma]: [],
68
74
  };
69
75
  export const v3wstETHCollAssetsEth = ['rsETH', 'ezETH'];
70
76
  export const v3wstETHCollAssets = {
@@ -73,4 +79,5 @@ export const v3wstETHCollAssets = {
73
79
  [NetworkNumber.Arb]: [],
74
80
  [NetworkNumber.Base]: [],
75
81
  [NetworkNumber.Linea]: [],
82
+ [NetworkNumber.Plasma]: [],
76
83
  };
@@ -5,4 +5,5 @@ export declare const sparkAssetsDefaultMarket: {
5
5
  readonly 8453: readonly [];
6
6
  readonly 42161: readonly [];
7
7
  readonly 59144: readonly [];
8
+ readonly 9745: readonly [];
8
9
  };
@@ -7,4 +7,5 @@ export const sparkAssetsDefaultMarket = {
7
7
  [NetworkNumber.Base]: [],
8
8
  [NetworkNumber.Arb]: [],
9
9
  [NetworkNumber.Linea]: [],
10
+ [NetworkNumber.Plasma]: [],
10
11
  };
@@ -2,8 +2,6 @@ import { NetworkNumber } from '../types/common';
2
2
  export declare const isLayer2Network: (networkId: NetworkNumber) => boolean;
3
3
  export declare const addToObjectIf: (condition: any, item: any) => any;
4
4
  export declare const addToArrayIf: (condition: any, ...items: any[]) => any[];
5
- export declare const ethToWeth: (maybeEth: any) => any;
6
- export declare const wethToEth: (maybeWeth: any) => any;
7
5
  export declare const stEthToWstEth: (maybeStEth: any) => any;
8
6
  export declare const wstEthToStEth: (maybeStEth: any) => any;
9
7
  export declare const getAbiItem: (abi: any, methodName: string) => any;
@@ -13,8 +11,6 @@ export declare const compareAddresses: (addr1?: string, addr2?: string) => boole
13
11
  export declare const getWeiAmountForDecimals: (amount: string | number, decimals: number) => string;
14
12
  export declare const getEthAmountForDecimals: (amount: string | number, decimals: string | number) => string;
15
13
  export declare const handleWbtcLegacy: (asset: string) => string;
16
- export declare const wethToEthByAddress: (maybeWethAddr: string, chainId?: NetworkNumber) => string;
17
- export declare const ethToWethByAddress: (maybeEthAddr: string, chainId?: NetworkNumber) => string;
18
14
  export declare const bytesToString: (hex: string) => string;
19
15
  /**
20
16
  * Map an input value from one range (minInput, maxInput) to a value in another range (minOutput, maxOutput)
@@ -30,3 +26,11 @@ export declare const DEFAULT_TIMEOUT = 2000;
30
26
  * @param value
31
27
  */
32
28
  export declare const convertHybridArraysToObjects: (value: any) => any;
29
+ export declare const ethToWeth: (maybeEth: string) => string;
30
+ export declare const wethToEth: (maybeWeth: string) => string;
31
+ export declare const wethToEthByAddress: (maybeWethAddr: string, chainId?: NetworkNumber) => string;
32
+ export declare const ethToWethByAddress: (maybeEthAddr: string, chainId?: NetworkNumber) => string;
33
+ export declare const xplToWxpl: (maybeXpl: string) => string;
34
+ export declare const wxplToXpl: (maybeWxpl: string) => string;
35
+ export declare const getWrappedNativeAssetFromUnwrapped: (symbol: string) => string;
36
+ export declare const getNativeAssetFromWrapped: (symbol: string) => string;
@@ -1,11 +1,9 @@
1
1
  import Dec from 'decimal.js';
2
2
  import { getAssetInfo, getAssetInfoByAddress } from '@defisaver/tokens';
3
3
  import { NetworkNumber } from '../types/common';
4
- export const isLayer2Network = (networkId) => [NetworkNumber.Opt, NetworkNumber.Arb, NetworkNumber.Base, NetworkNumber.Linea].includes(+networkId);
4
+ export const isLayer2Network = (networkId) => [NetworkNumber.Opt, NetworkNumber.Arb, NetworkNumber.Base, NetworkNumber.Linea, NetworkNumber.Plasma].includes(+networkId);
5
5
  export const addToObjectIf = (condition, item) => (condition ? item : {});
6
6
  export const addToArrayIf = (condition, ...items) => (condition ? items : []);
7
- export const ethToWeth = (maybeEth) => maybeEth === null || maybeEth === void 0 ? void 0 : maybeEth.replace(/^ETH$/, 'WETH');
8
- export const wethToEth = (maybeWeth) => maybeWeth === null || maybeWeth === void 0 ? void 0 : maybeWeth.replace(/^WETH$/, 'ETH');
9
7
  export const stEthToWstEth = (maybeStEth) => maybeStEth === null || maybeStEth === void 0 ? void 0 : maybeStEth.replace(/^stETH$/, 'wstETH');
10
8
  export const wstEthToStEth = (maybeStEth) => maybeStEth === null || maybeStEth === void 0 ? void 0 : maybeStEth.replace(/^wstETH$/, 'stETH');
11
9
  export const getAbiItem = (abi, methodName) => abi.find((i) => i.name === methodName);
@@ -15,8 +13,6 @@ export const compareAddresses = (addr1 = '', addr2 = '') => addr1.toLowerCase()
15
13
  export const getWeiAmountForDecimals = (amount, decimals) => new Dec(amount).mul(Math.pow(10, decimals)).floor().toString();
16
14
  export const getEthAmountForDecimals = (amount, decimals) => new Dec(amount).div(Math.pow(10, +decimals)).toString();
17
15
  export const handleWbtcLegacy = (asset) => (asset === 'WBTC Legacy' ? 'WBTC' : asset);
18
- export const wethToEthByAddress = (maybeWethAddr, chainId = NetworkNumber.Eth) => getAssetInfo(wethToEth(getAssetInfoByAddress(maybeWethAddr, chainId).symbol), chainId).address;
19
- export const ethToWethByAddress = (maybeEthAddr, chainId = NetworkNumber.Eth) => getAssetInfo(ethToWeth(getAssetInfoByAddress(maybeEthAddr, chainId).symbol), chainId).address;
20
16
  export const bytesToString = (hex) => Buffer.from(hex.replace(/^0x/, ''), 'hex')
21
17
  .toString()
22
18
  // eslint-disable-next-line no-control-regex
@@ -69,3 +65,23 @@ export const convertHybridArraysToObjects = (value) => {
69
65
  }
70
66
  return value;
71
67
  };
68
+ export const ethToWeth = (maybeEth) => maybeEth === null || maybeEth === void 0 ? void 0 : maybeEth.replace(/^ETH$/, 'WETH');
69
+ export const wethToEth = (maybeWeth) => maybeWeth === null || maybeWeth === void 0 ? void 0 : maybeWeth.replace(/^WETH$/, 'ETH');
70
+ export const wethToEthByAddress = (maybeWethAddr, chainId = NetworkNumber.Eth) => getAssetInfo(wethToEth(getAssetInfoByAddress(maybeWethAddr, chainId).symbol), chainId).address;
71
+ export const ethToWethByAddress = (maybeEthAddr, chainId = NetworkNumber.Eth) => getAssetInfo(ethToWeth(getAssetInfoByAddress(maybeEthAddr, chainId).symbol), chainId).address;
72
+ export const xplToWxpl = (maybeXpl) => maybeXpl === null || maybeXpl === void 0 ? void 0 : maybeXpl.replace(/^XPL$/, 'WXPL');
73
+ export const wxplToXpl = (maybeWxpl) => maybeWxpl === null || maybeWxpl === void 0 ? void 0 : maybeWxpl.replace(/^WXPL$/, 'XPL');
74
+ export const getWrappedNativeAssetFromUnwrapped = (symbol) => {
75
+ if (symbol === 'ETH')
76
+ return 'WETH';
77
+ if (symbol === 'XPL')
78
+ return 'WXPL';
79
+ return symbol;
80
+ };
81
+ export const getNativeAssetFromWrapped = (symbol) => {
82
+ if (symbol === 'WETH')
83
+ return 'ETH';
84
+ if (symbol === 'WXPL')
85
+ return 'XPL';
86
+ return symbol;
87
+ };