@defisaver/positions-sdk 2.1.3 → 2.1.4-dev-plasma-2
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/cjs/aaveV3/index.js +1 -1
- package/cjs/aaveV3/merit.js +3 -0
- package/cjs/config/contracts.d.ts +17 -0
- package/cjs/config/contracts.js +17 -0
- package/cjs/markets/aave/index.js +1 -1
- package/cjs/markets/aave/marketAssets.d.ts +4 -0
- package/cjs/markets/aave/marketAssets.js +5 -1
- package/cjs/markets/compound/index.js +11 -0
- package/cjs/markets/compound/marketsAssets.d.ts +7 -0
- package/cjs/markets/compound/marketsAssets.js +7 -0
- package/cjs/markets/spark/marketAssets.d.ts +1 -0
- package/cjs/markets/spark/marketAssets.js +1 -0
- package/cjs/services/utils.js +1 -1
- package/cjs/services/viem.d.ts +54 -15
- package/cjs/services/viem.js +2 -0
- package/cjs/staking/staking.js +2 -1
- package/cjs/types/common.d.ts +2 -1
- package/cjs/types/common.js +1 -0
- package/esm/aaveV3/index.js +1 -1
- package/esm/aaveV3/merit.js +3 -0
- package/esm/config/contracts.d.ts +17 -0
- package/esm/config/contracts.js +17 -0
- package/esm/markets/aave/index.js +1 -1
- package/esm/markets/aave/marketAssets.d.ts +4 -0
- package/esm/markets/aave/marketAssets.js +4 -0
- package/esm/markets/compound/index.js +11 -0
- package/esm/markets/compound/marketsAssets.d.ts +7 -0
- package/esm/markets/compound/marketsAssets.js +7 -0
- package/esm/markets/spark/marketAssets.d.ts +1 -0
- package/esm/markets/spark/marketAssets.js +1 -0
- package/esm/services/utils.js +1 -1
- package/esm/services/viem.d.ts +54 -15
- package/esm/services/viem.js +3 -1
- package/esm/staking/staking.js +2 -1
- package/esm/types/common.d.ts +2 -1
- package/esm/types/common.js +1 -0
- package/package.json +4 -4
- package/src/aaveV3/index.ts +1 -1
- package/src/aaveV3/merit.ts +3 -0
- package/src/config/contracts.ts +17 -0
- package/src/markets/aave/index.ts +1 -1
- package/src/markets/aave/marketAssets.ts +5 -0
- package/src/markets/compound/index.ts +11 -0
- package/src/markets/compound/marketsAssets.ts +7 -0
- package/src/markets/spark/marketAssets.ts +1 -0
- package/src/services/utils.ts +1 -1
- package/src/services/viem.ts +3 -1
- package/src/staking/staking.ts +1 -1
- package/src/types/common.ts +1 -0
package/esm/config/contracts.js
CHANGED
|
@@ -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
|
};
|
|
@@ -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
|
};
|
package/esm/services/utils.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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
7
|
export const ethToWeth = (maybeEth) => maybeEth === null || maybeEth === void 0 ? void 0 : maybeEth.replace(/^ETH$/, 'WETH');
|
package/esm/services/viem.d.ts
CHANGED
|
@@ -7,14 +7,11 @@ export declare const getViemChain: (network: NetworkNumber) => {
|
|
|
7
7
|
readonly apiUrl: "https://api.etherscan.io/api";
|
|
8
8
|
};
|
|
9
9
|
};
|
|
10
|
-
blockTime
|
|
10
|
+
blockTime: 12000;
|
|
11
11
|
contracts: {
|
|
12
|
-
readonly ensRegistry: {
|
|
13
|
-
readonly address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";
|
|
14
|
-
};
|
|
15
12
|
readonly ensUniversalResolver: {
|
|
16
|
-
readonly address: "
|
|
17
|
-
readonly blockCreated:
|
|
13
|
+
readonly address: "0xeeeeeeee14d718c2b47d9923deab1335e144eeee";
|
|
14
|
+
readonly blockCreated: 23085558;
|
|
18
15
|
};
|
|
19
16
|
readonly multicall3: {
|
|
20
17
|
readonly address: "0xca11bde05977b3631167028862be2a173976ca11";
|
|
@@ -29,6 +26,7 @@ export declare const getViemChain: (network: NetworkNumber) => {
|
|
|
29
26
|
readonly symbol: "ETH";
|
|
30
27
|
readonly decimals: 18;
|
|
31
28
|
};
|
|
29
|
+
experimental_preconfirmationTime?: number | undefined | undefined;
|
|
32
30
|
rpcUrls: {
|
|
33
31
|
readonly default: {
|
|
34
32
|
readonly http: readonly ["https://eth.merkle.io"];
|
|
@@ -101,6 +99,7 @@ export declare const getViemChain: (network: NetworkNumber) => {
|
|
|
101
99
|
readonly symbol: "ETH";
|
|
102
100
|
readonly decimals: 18;
|
|
103
101
|
};
|
|
102
|
+
experimental_preconfirmationTime?: number | undefined | undefined;
|
|
104
103
|
rpcUrls: {
|
|
105
104
|
readonly default: {
|
|
106
105
|
readonly http: readonly ["https://mainnet.optimism.io"];
|
|
@@ -174,16 +173,16 @@ export declare const getViemChain: (network: NetworkNumber) => {
|
|
|
174
173
|
r: import("viem").Hex;
|
|
175
174
|
s: import("viem").Hex;
|
|
176
175
|
v: bigint;
|
|
176
|
+
value: bigint;
|
|
177
|
+
gas: bigint;
|
|
177
178
|
to: import("viem").Address | null;
|
|
178
179
|
from: import("viem").Address;
|
|
179
|
-
gas: bigint;
|
|
180
180
|
nonce: number;
|
|
181
|
-
value: bigint;
|
|
182
181
|
blockHash: `0x${string}` | null;
|
|
183
182
|
blockNumber: bigint | null;
|
|
183
|
+
transactionIndex: number | null;
|
|
184
184
|
hash: import("viem").Hash;
|
|
185
185
|
input: import("viem").Hex;
|
|
186
|
-
transactionIndex: number | null;
|
|
187
186
|
typeHex: import("viem").Hex | null;
|
|
188
187
|
accessList?: undefined | undefined;
|
|
189
188
|
authorizationList?: undefined | undefined;
|
|
@@ -352,7 +351,7 @@ export declare const getViemChain: (network: NetworkNumber) => {
|
|
|
352
351
|
readonly apiUrl: "https://api.arbiscan.io/api";
|
|
353
352
|
};
|
|
354
353
|
};
|
|
355
|
-
blockTime
|
|
354
|
+
blockTime: 250;
|
|
356
355
|
contracts: {
|
|
357
356
|
readonly multicall3: {
|
|
358
357
|
readonly address: "0xca11bde05977b3631167028862be2a173976ca11";
|
|
@@ -367,6 +366,7 @@ export declare const getViemChain: (network: NetworkNumber) => {
|
|
|
367
366
|
readonly symbol: "ETH";
|
|
368
367
|
readonly decimals: 18;
|
|
369
368
|
};
|
|
369
|
+
experimental_preconfirmationTime?: number | undefined | undefined;
|
|
370
370
|
rpcUrls: {
|
|
371
371
|
readonly default: {
|
|
372
372
|
readonly http: readonly ["https://arb1.arbitrum.io/rpc"];
|
|
@@ -441,6 +441,7 @@ export declare const getViemChain: (network: NetworkNumber) => {
|
|
|
441
441
|
readonly symbol: "ETH";
|
|
442
442
|
readonly decimals: 18;
|
|
443
443
|
};
|
|
444
|
+
experimental_preconfirmationTime?: number | undefined | undefined;
|
|
444
445
|
rpcUrls: {
|
|
445
446
|
readonly default: {
|
|
446
447
|
readonly http: readonly ["https://mainnet.base.org"];
|
|
@@ -514,16 +515,16 @@ export declare const getViemChain: (network: NetworkNumber) => {
|
|
|
514
515
|
r: import("viem").Hex;
|
|
515
516
|
s: import("viem").Hex;
|
|
516
517
|
v: bigint;
|
|
518
|
+
value: bigint;
|
|
519
|
+
gas: bigint;
|
|
517
520
|
to: import("viem").Address | null;
|
|
518
521
|
from: import("viem").Address;
|
|
519
|
-
gas: bigint;
|
|
520
522
|
nonce: number;
|
|
521
|
-
value: bigint;
|
|
522
523
|
blockHash: `0x${string}` | null;
|
|
523
524
|
blockNumber: bigint | null;
|
|
525
|
+
transactionIndex: number | null;
|
|
524
526
|
hash: import("viem").Hash;
|
|
525
527
|
input: import("viem").Hex;
|
|
526
|
-
transactionIndex: number | null;
|
|
527
528
|
typeHex: import("viem").Hex | null;
|
|
528
529
|
accessList?: undefined | undefined;
|
|
529
530
|
authorizationList?: undefined | undefined;
|
|
@@ -703,8 +704,8 @@ export declare const getViemChain: (network: NetworkNumber) => {
|
|
|
703
704
|
readonly blockCreated: 6682888;
|
|
704
705
|
};
|
|
705
706
|
readonly ensUniversalResolver: {
|
|
706
|
-
readonly address: "
|
|
707
|
-
readonly blockCreated:
|
|
707
|
+
readonly address: "0x4D41762915F83c76EcaF6776d9b08076aA32b492";
|
|
708
|
+
readonly blockCreated: 22222151;
|
|
708
709
|
};
|
|
709
710
|
};
|
|
710
711
|
ensTlds: readonly [".linea.eth"];
|
|
@@ -715,6 +716,7 @@ export declare const getViemChain: (network: NetworkNumber) => {
|
|
|
715
716
|
readonly symbol: "ETH";
|
|
716
717
|
readonly decimals: 18;
|
|
717
718
|
};
|
|
719
|
+
experimental_preconfirmationTime?: number | undefined | undefined;
|
|
718
720
|
rpcUrls: {
|
|
719
721
|
readonly default: {
|
|
720
722
|
readonly http: readonly ["https://rpc.linea.build"];
|
|
@@ -730,6 +732,40 @@ export declare const getViemChain: (network: NetworkNumber) => {
|
|
|
730
732
|
};
|
|
731
733
|
formatters?: undefined;
|
|
732
734
|
serializers?: import("viem").ChainSerializers<undefined, import("viem").TransactionSerializable> | undefined;
|
|
735
|
+
} | {
|
|
736
|
+
blockExplorers: {
|
|
737
|
+
readonly default: {
|
|
738
|
+
readonly name: "PlasmaScan";
|
|
739
|
+
readonly url: "https://plasmascan.to";
|
|
740
|
+
};
|
|
741
|
+
};
|
|
742
|
+
blockTime?: number | undefined | undefined;
|
|
743
|
+
contracts: {
|
|
744
|
+
readonly multicall3: {
|
|
745
|
+
readonly address: "0xcA11bde05977b3631167028862bE2a173976CA11";
|
|
746
|
+
readonly blockCreated: 0;
|
|
747
|
+
};
|
|
748
|
+
};
|
|
749
|
+
ensTlds?: readonly string[] | undefined;
|
|
750
|
+
id: 9745;
|
|
751
|
+
name: "Plasma";
|
|
752
|
+
nativeCurrency: {
|
|
753
|
+
readonly name: "Plasma";
|
|
754
|
+
readonly symbol: "XPL";
|
|
755
|
+
readonly decimals: 18;
|
|
756
|
+
};
|
|
757
|
+
experimental_preconfirmationTime?: number | undefined | undefined;
|
|
758
|
+
rpcUrls: {
|
|
759
|
+
readonly default: {
|
|
760
|
+
readonly http: readonly ["https://rpc.plasma.to"];
|
|
761
|
+
};
|
|
762
|
+
};
|
|
763
|
+
sourceId?: number | undefined | undefined;
|
|
764
|
+
testnet?: boolean | undefined | undefined;
|
|
765
|
+
custom?: Record<string, unknown> | undefined;
|
|
766
|
+
fees?: import("viem").ChainFees<undefined> | undefined;
|
|
767
|
+
formatters?: undefined;
|
|
768
|
+
serializers?: import("viem").ChainSerializers<undefined, import("viem").TransactionSerializable> | undefined;
|
|
733
769
|
};
|
|
734
770
|
export declare const getViemProvider: (provider: EthereumProvider, network: NetworkNumber, options?: any) => {
|
|
735
771
|
account: undefined;
|
|
@@ -741,6 +777,7 @@ export declare const getViemProvider: (provider: EthereumProvider, network: Netw
|
|
|
741
777
|
request?: (parameters: import("viem").CcipRequestParameters) => Promise<import("viem/_types/utils/ccip").CcipRequestReturnType>;
|
|
742
778
|
} | undefined;
|
|
743
779
|
chain: undefined;
|
|
780
|
+
experimental_blockTag?: import("viem").BlockTag | undefined;
|
|
744
781
|
key: string;
|
|
745
782
|
name: string;
|
|
746
783
|
pollingInterval: number;
|
|
@@ -7579,6 +7616,7 @@ export declare const getViemProvider: (provider: EthereumProvider, network: Netw
|
|
|
7579
7616
|
simulateBlocks: <const calls extends readonly unknown[]>(args: import("viem").SimulateBlocksParameters<calls>) => Promise<import("viem").SimulateBlocksReturnType<calls>>;
|
|
7580
7617
|
simulateCalls: <const calls extends readonly unknown[]>(args: import("viem").SimulateCallsParameters<calls>) => Promise<import("viem").SimulateCallsReturnType<calls>>;
|
|
7581
7618
|
simulateContract: <const abi extends import("viem").Abi | readonly unknown[], functionName extends import("viem").ContractFunctionName<abi, "nonpayable" | "payable">, const args_1 extends import("viem").ContractFunctionArgs<abi, "nonpayable" | "payable", functionName>, chainOverride extends import("viem").Chain | undefined, accountOverride extends import("viem").Account | import("viem").Address | undefined = undefined>(args: import("viem").SimulateContractParameters<abi, functionName, args_1, undefined, chainOverride, accountOverride>) => Promise<import("viem").SimulateContractReturnType<abi, functionName, args_1, undefined, import("viem").Account | undefined, chainOverride, accountOverride>>;
|
|
7619
|
+
verifyHash: (args: import("viem").VerifyHashActionParameters) => Promise<import("viem").VerifyHashActionReturnType>;
|
|
7582
7620
|
verifyMessage: (args: import("viem").VerifyMessageActionParameters) => Promise<import("viem").VerifyMessageActionReturnType>;
|
|
7583
7621
|
verifySiweMessage: (args: import("viem/_types/actions/siwe/verifySiweMessage").VerifySiweMessageParameters) => Promise<import("viem/_types/actions/siwe/verifySiweMessage").VerifySiweMessageReturnType>;
|
|
7584
7622
|
verifyTypedData: (args: import("viem").VerifyTypedDataActionParameters) => Promise<import("viem").VerifyTypedDataActionReturnType>;
|
|
@@ -7596,6 +7634,7 @@ export declare const getViemProvider: (provider: EthereumProvider, network: Netw
|
|
|
7596
7634
|
cacheTime?: undefined;
|
|
7597
7635
|
ccipRead?: undefined;
|
|
7598
7636
|
chain?: undefined;
|
|
7637
|
+
experimental_blockTag?: undefined;
|
|
7599
7638
|
key?: undefined;
|
|
7600
7639
|
name?: undefined;
|
|
7601
7640
|
pollingInterval?: undefined;
|
package/esm/services/viem.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createPublicClient, custom } from 'viem';
|
|
2
|
-
import { arbitrum, base, mainnet, optimism, linea, } from 'viem/chains';
|
|
2
|
+
import { arbitrum, base, mainnet, optimism, linea, plasma, } from 'viem/chains';
|
|
3
3
|
import { NetworkNumber } from '../types/common';
|
|
4
4
|
export const getViemChain = (network) => {
|
|
5
5
|
switch (network) {
|
|
@@ -13,6 +13,8 @@ export const getViemChain = (network) => {
|
|
|
13
13
|
return base;
|
|
14
14
|
case NetworkNumber.Linea:
|
|
15
15
|
return linea;
|
|
16
|
+
case NetworkNumber.Plasma:
|
|
17
|
+
return plasma;
|
|
16
18
|
default:
|
|
17
19
|
throw new Error(`Unsupported network: ${network}`);
|
|
18
20
|
}
|
package/esm/staking/staking.js
CHANGED
|
@@ -48,12 +48,13 @@ const getSuperOETHApy = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
50
|
const getApyFromDfsApi = (asset) => __awaiter(void 0, void 0, void 0, function* () {
|
|
51
|
+
var _a;
|
|
51
52
|
try {
|
|
52
53
|
const res = yield fetch(`https://fe.defisaver.com/api/staking/apy?asset=${asset}`, { signal: AbortSignal.timeout(DEFAULT_TIMEOUT) });
|
|
53
54
|
if (!res.ok)
|
|
54
55
|
throw new Error(`Failed to fetch APY for ${asset}`);
|
|
55
56
|
const data = yield res.json();
|
|
56
|
-
return String(data.apy);
|
|
57
|
+
return String((_a = data.apy) !== null && _a !== void 0 ? _a : '0');
|
|
57
58
|
}
|
|
58
59
|
catch (e) {
|
|
59
60
|
console.error(`External API Failure: Failed to fetch APY for ${asset} from DFS API`, e);
|
package/esm/types/common.d.ts
CHANGED
package/esm/types/common.js
CHANGED
|
@@ -16,4 +16,5 @@ export var NetworkNumber;
|
|
|
16
16
|
NetworkNumber[NetworkNumber["Arb"] = 42161] = "Arb";
|
|
17
17
|
NetworkNumber[NetworkNumber["Base"] = 8453] = "Base";
|
|
18
18
|
NetworkNumber[NetworkNumber["Linea"] = 59144] = "Linea";
|
|
19
|
+
NetworkNumber[NetworkNumber["Plasma"] = 9745] = "Plasma";
|
|
19
20
|
})(NetworkNumber || (NetworkNumber = {}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defisaver/positions-sdk",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.4-dev-plasma-2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"dev": "tsc -p tsconfig.json --watch",
|
|
13
13
|
"lint": "eslint src/ --fix",
|
|
14
14
|
"lint-check": "eslint src/",
|
|
15
|
-
"test": "mocha tests
|
|
15
|
+
"test": "mocha tests/portfolio.ts",
|
|
16
16
|
"test-single": "mocha ./tests/$npm_config_name.ts",
|
|
17
17
|
"test:debugger": "mocha --inspect-brk tests/*",
|
|
18
18
|
"version-bump": "git commit -am \"Version bump to $(npm version patch | cut -c 2-)\""
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
"author": "",
|
|
22
22
|
"license": "ISC",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@defisaver/tokens": "^1.7.
|
|
24
|
+
"@defisaver/tokens": "^1.7.3",
|
|
25
25
|
"@types/lodash": "^4.17.15",
|
|
26
26
|
"@types/memoizee": "^0.4.12",
|
|
27
27
|
"decimal.js": "^10.6.0",
|
|
28
28
|
"lodash": "^4.17.21",
|
|
29
29
|
"memoizee": "^0.4.17",
|
|
30
|
-
"viem": "^2.
|
|
30
|
+
"viem": "^2.37.9"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@defisaver/eslint-config": "^1.0.1",
|
package/src/aaveV3/index.ts
CHANGED
|
@@ -72,7 +72,7 @@ export async function _getAaveV3MarketData(provider: Client, network: NetworkNum
|
|
|
72
72
|
const loanInfoContract = AaveV3ViewContractViem(provider, network);
|
|
73
73
|
const aaveIncentivesContract = AaveIncentiveDataProviderV3ContractViem(provider, network);
|
|
74
74
|
const marketAddress = market.providerAddress;
|
|
75
|
-
const networksWithIncentives = [NetworkNumber.Eth, NetworkNumber.Arb, NetworkNumber.Opt, NetworkNumber.Linea];
|
|
75
|
+
const networksWithIncentives = [NetworkNumber.Eth, NetworkNumber.Arb, NetworkNumber.Opt, NetworkNumber.Linea, NetworkNumber.Plasma];
|
|
76
76
|
|
|
77
77
|
// eslint-disable-next-line prefer-const
|
|
78
78
|
let [loanInfo, eModesInfo, isBorrowAllowed, rewardInfo, merkleRewardsMap, meritRewardsMap] = await Promise.all([
|
package/src/aaveV3/merit.ts
CHANGED
package/src/config/contracts.ts
CHANGED
|
@@ -229,6 +229,11 @@ export const AaveV3View = {
|
|
|
229
229
|
"address": "0xc9D6EfA6e08B66a5Cdc516Bcd5807c2fa69E0f2A"
|
|
230
230
|
}
|
|
231
231
|
},
|
|
232
|
+
},
|
|
233
|
+
"9745": {
|
|
234
|
+
"address": "0xD8E67968d8a0df4beCf2D50daE1e34d4d80C701C",
|
|
235
|
+
"createdBlock": 1880799,
|
|
236
|
+
"oldVersions": {},
|
|
232
237
|
}
|
|
233
238
|
}
|
|
234
239
|
} as const;
|
|
@@ -249,6 +254,9 @@ export const AaveV3PoolAddressesProvider = {
|
|
|
249
254
|
},
|
|
250
255
|
"59144": {
|
|
251
256
|
"address": "0x89502c3731F69DDC95B65753708A07F8Cd0373F4"
|
|
257
|
+
},
|
|
258
|
+
"9745": {
|
|
259
|
+
"address": "0x061D8e131F26512348ee5FA42e2DF1bA9d6505E9"
|
|
252
260
|
}
|
|
253
261
|
}
|
|
254
262
|
} as const;
|
|
@@ -285,6 +293,9 @@ export const AaveV3LendingPool = {
|
|
|
285
293
|
},
|
|
286
294
|
"59144": {
|
|
287
295
|
"address": "0xc47b8C00b0f69a36fa203Ffeac0334874574a8Ac"
|
|
296
|
+
},
|
|
297
|
+
"9745": {
|
|
298
|
+
"address": "0x925a2A7214Ed92428B5b1B090F80b25700095e12"
|
|
288
299
|
}
|
|
289
300
|
}
|
|
290
301
|
} as const;
|
|
@@ -321,6 +332,9 @@ export const AaveV3ProtocolDataProvider = {
|
|
|
321
332
|
},
|
|
322
333
|
"59144": {
|
|
323
334
|
"address": "0x47cd4b507B81cB831669c71c7077f4daF6762FF4"
|
|
335
|
+
},
|
|
336
|
+
"9745": {
|
|
337
|
+
"address": "0xf2D6E38B407e31E7E7e4a16E6769728b76c7419F"
|
|
324
338
|
}
|
|
325
339
|
}
|
|
326
340
|
} as const;
|
|
@@ -357,6 +371,9 @@ export const AaveUiIncentiveDataProviderV3 = {
|
|
|
357
371
|
},
|
|
358
372
|
"59144": {
|
|
359
373
|
"address": "0x117684358D990E42Eb1649E7e8C4691951dc1E71"
|
|
374
|
+
},
|
|
375
|
+
"9745": {
|
|
376
|
+
"address": "0xcb85C501B3A5e9851850d66648d69B26A4c90942"
|
|
360
377
|
}
|
|
361
378
|
}
|
|
362
379
|
} as const;
|
|
@@ -52,7 +52,7 @@ export const AAVE_V2: AaveMarketInfo = {
|
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
export const AAVE_V3 = (networkId: NetworkNumber): AaveMarketInfo => ({
|
|
55
|
-
chainIds: [NetworkNumber.Eth, NetworkNumber.Opt, NetworkNumber.Arb, NetworkNumber.Base, NetworkNumber.Linea],
|
|
55
|
+
chainIds: [NetworkNumber.Eth, NetworkNumber.Opt, NetworkNumber.Arb, NetworkNumber.Base, NetworkNumber.Linea, NetworkNumber.Plasma],
|
|
56
56
|
label: networkId === NetworkNumber.Eth ? 'Aave v3 Core' : 'Aave v3',
|
|
57
57
|
shortLabel: 'v3',
|
|
58
58
|
value: AaveVersions.AaveV3,
|
|
@@ -20,6 +20,8 @@ export const aaveV3AssetsDefaultMarketBase = ['ETH', 'cbETH', 'USDbC', 'wstETH',
|
|
|
20
20
|
|
|
21
21
|
export const aaveV3AssetsDefaultMarketLinea = ['ETH', 'USDC', 'weETH', 'ezETH', 'USDT', 'wstETH', 'wrsETH', 'WBTC'];
|
|
22
22
|
|
|
23
|
+
export const aaveV3AssetsDefaultMarketPlasma = ['ETH', 'USDT', 'sUSDe', 'USDe', 'weETH', 'XAUt'];
|
|
24
|
+
|
|
23
25
|
// @dev Keep assets in array, do not assign directly, so we can parse it and edit it programmatically with `scripts/updateMarkets`
|
|
24
26
|
export const aaveV3AssetsDefaultMarket = {
|
|
25
27
|
[NetworkNumber.Eth]: aaveV3AssetsDefaultMarketEth,
|
|
@@ -27,6 +29,7 @@ export const aaveV3AssetsDefaultMarket = {
|
|
|
27
29
|
[NetworkNumber.Arb]: aaveV3AssetsDefaultMarketArb,
|
|
28
30
|
[NetworkNumber.Base]: aaveV3AssetsDefaultMarketBase,
|
|
29
31
|
[NetworkNumber.Linea]: aaveV3AssetsDefaultMarketLinea,
|
|
32
|
+
[NetworkNumber.Plasma]: aaveV3AssetsDefaultMarketPlasma,
|
|
30
33
|
} as const;
|
|
31
34
|
|
|
32
35
|
export const aaveV3AssetsLidoMarketEth = ['ETH', 'wstETH', 'USDS', 'USDC', 'ezETH', 'sUSDe', 'GHO', 'rsETH', 'tETH'];
|
|
@@ -37,6 +40,7 @@ export const aaveV3AssetsLidoMarket = {
|
|
|
37
40
|
[NetworkNumber.Arb]: [],
|
|
38
41
|
[NetworkNumber.Base]: [],
|
|
39
42
|
[NetworkNumber.Linea]: [],
|
|
43
|
+
[NetworkNumber.Plasma]: [],
|
|
40
44
|
} as const;
|
|
41
45
|
|
|
42
46
|
export const aaveV3AssetsEtherfiMarketEth = ['weETH', 'USDC', 'PYUSD', 'FRAX'];
|
|
@@ -47,4 +51,5 @@ export const aaveV3AssetsEtherfiMarket = {
|
|
|
47
51
|
[NetworkNumber.Arb]: [],
|
|
48
52
|
[NetworkNumber.Base]: [],
|
|
49
53
|
[NetworkNumber.Linea]: [],
|
|
54
|
+
[NetworkNumber.Plasma]: [],
|
|
50
55
|
} as const;
|