@defisaver/positions-sdk 2.1.7 → 2.1.9-dev-spark-1
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/.mocharc.json +4 -4
- package/.nvmrc +1 -1
- package/README.md +64 -64
- package/cjs/aaveV3/index.js +3 -3
- package/cjs/aaveV3/merit.js +3 -0
- package/cjs/aaveV3/merkl.d.ts +1 -1
- package/cjs/config/contracts.d.ts +20 -0
- package/cjs/config/contracts.js +20 -0
- package/cjs/fluid/index.js +40 -12
- package/cjs/helpers/aaveHelpers/index.d.ts +1 -1
- package/cjs/helpers/aaveHelpers/index.js +6 -4
- package/cjs/helpers/morphoBlueHelpers/index.d.ts +1 -1
- package/cjs/helpers/morphoBlueHelpers/index.js +66 -66
- package/cjs/helpers/sparkHelpers/index.d.ts +4 -4
- package/cjs/helpers/sparkHelpers/index.js +12 -12
- 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/fluid/index.d.ts +4 -0
- package/cjs/markets/fluid/index.js +4 -0
- package/cjs/markets/spark/marketAssets.d.ts +1 -0
- package/cjs/markets/spark/marketAssets.js +1 -0
- package/cjs/portfolio/index.js +1 -1
- package/cjs/services/utils.d.ts +8 -4
- package/cjs/services/utils.js +30 -10
- package/cjs/services/viem.d.ts +54 -15
- package/cjs/services/viem.js +2 -0
- package/cjs/spark/index.d.ts +3 -1
- package/cjs/spark/index.js +24 -14
- package/cjs/staking/eligibility.js +1 -6
- package/cjs/types/common.d.ts +4 -2
- package/cjs/types/common.js +2 -0
- package/cjs/types/fluid.d.ts +7 -3
- package/cjs/types/fluid.js +4 -0
- package/cjs/types/spark.d.ts +3 -1
- package/esm/aaveV3/index.js +4 -4
- package/esm/aaveV3/merit.js +3 -0
- package/esm/aaveV3/merkl.d.ts +1 -1
- package/esm/config/contracts.d.ts +20 -0
- package/esm/config/contracts.js +20 -0
- package/esm/fluid/index.js +40 -12
- package/esm/helpers/aaveHelpers/index.d.ts +1 -1
- package/esm/helpers/aaveHelpers/index.js +7 -5
- package/esm/helpers/morphoBlueHelpers/index.d.ts +1 -1
- package/esm/helpers/morphoBlueHelpers/index.js +66 -66
- package/esm/helpers/sparkHelpers/index.d.ts +4 -4
- package/esm/helpers/sparkHelpers/index.js +13 -13
- 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/fluid/index.d.ts +4 -0
- package/esm/markets/fluid/index.js +4 -0
- package/esm/markets/spark/marketAssets.d.ts +1 -0
- package/esm/markets/spark/marketAssets.js +1 -0
- package/esm/portfolio/index.js +1 -1
- package/esm/services/utils.d.ts +8 -4
- package/esm/services/utils.js +21 -5
- package/esm/services/viem.d.ts +54 -15
- package/esm/services/viem.js +3 -1
- package/esm/spark/index.d.ts +3 -1
- package/esm/spark/index.js +25 -15
- package/esm/staking/eligibility.js +1 -6
- package/esm/types/common.d.ts +4 -2
- package/esm/types/common.js +2 -0
- package/esm/types/fluid.d.ts +7 -3
- package/esm/types/fluid.js +4 -0
- package/esm/types/spark.d.ts +3 -1
- package/package.json +47 -47
- package/src/aaveV2/index.ts +240 -240
- package/src/aaveV3/index.ts +614 -614
- package/src/aaveV3/merit.ts +97 -94
- package/src/aaveV3/merkl.ts +74 -74
- package/src/claiming/aaveV3.ts +154 -154
- package/src/claiming/compV3.ts +22 -22
- package/src/claiming/index.ts +12 -12
- package/src/claiming/king.ts +66 -66
- package/src/claiming/morphoBlue.ts +118 -118
- package/src/claiming/spark.ts +225 -225
- package/src/compoundV2/index.ts +244 -244
- package/src/compoundV3/index.ts +274 -274
- package/src/config/contracts.ts +1251 -1231
- package/src/constants/index.ts +10 -10
- package/src/contracts.ts +120 -120
- package/src/curveUsd/index.ts +254 -254
- package/src/eulerV2/index.ts +324 -324
- package/src/exchange/index.ts +25 -25
- package/src/fluid/index.ts +1668 -1638
- package/src/helpers/aaveHelpers/index.ts +187 -185
- package/src/helpers/compoundHelpers/index.ts +283 -283
- package/src/helpers/curveUsdHelpers/index.ts +40 -40
- package/src/helpers/eulerHelpers/index.ts +222 -222
- package/src/helpers/fluidHelpers/index.ts +326 -326
- package/src/helpers/index.ts +10 -10
- package/src/helpers/liquityV2Helpers/index.ts +82 -82
- package/src/helpers/llamaLendHelpers/index.ts +53 -53
- package/src/helpers/makerHelpers/index.ts +52 -52
- package/src/helpers/morphoBlueHelpers/index.ts +396 -396
- package/src/helpers/sparkHelpers/index.ts +158 -155
- package/src/index.ts +47 -47
- package/src/liquity/index.ts +159 -159
- package/src/liquityV2/index.ts +657 -657
- package/src/llamaLend/index.ts +305 -305
- package/src/maker/index.ts +223 -223
- package/src/markets/aave/index.ts +116 -116
- package/src/markets/aave/marketAssets.ts +54 -49
- package/src/markets/compound/index.ts +238 -227
- package/src/markets/compound/marketsAssets.ts +97 -90
- package/src/markets/curveUsd/index.ts +69 -69
- package/src/markets/euler/index.ts +26 -26
- package/src/markets/fluid/index.ts +2460 -2456
- package/src/markets/index.ts +25 -25
- package/src/markets/liquityV2/index.ts +102 -102
- package/src/markets/llamaLend/contractAddresses.ts +141 -141
- package/src/markets/llamaLend/index.ts +235 -235
- package/src/markets/morphoBlue/index.ts +895 -895
- package/src/markets/spark/index.ts +29 -29
- package/src/markets/spark/marketAssets.ts +12 -11
- package/src/moneymarket/moneymarketCommonService.ts +80 -80
- package/src/morphoBlue/index.ts +274 -274
- package/src/portfolio/index.ts +570 -570
- package/src/services/priceService.ts +159 -159
- package/src/services/utils.ts +115 -99
- package/src/services/viem.ts +34 -32
- package/src/setup.ts +8 -8
- package/src/spark/index.ts +465 -445
- package/src/staking/eligibility.ts +53 -59
- package/src/staking/index.ts +1 -1
- package/src/staking/staking.ts +170 -170
- package/src/types/aave.ts +189 -189
- package/src/types/claiming.ts +109 -109
- package/src/types/common.ts +107 -105
- package/src/types/compound.ts +136 -136
- package/src/types/curveUsd.ts +123 -123
- package/src/types/euler.ts +175 -175
- package/src/types/fluid.ts +452 -448
- package/src/types/index.ts +13 -13
- package/src/types/liquity.ts +30 -30
- package/src/types/liquityV2.ts +126 -126
- package/src/types/llamaLend.ts +159 -159
- package/src/types/maker.ts +63 -63
- package/src/types/merit.ts +1 -1
- package/src/types/merkl.ts +70 -70
- package/src/types/morphoBlue.ts +194 -194
- package/src/types/portfolio.ts +60 -60
- package/src/types/spark.ts +136 -135
- package/src/umbrella/index.ts +69 -69
- package/src/umbrella/umbrellaUtils.ts +29 -29
- package/CLAUDE.md +0 -32
|
@@ -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
|
|
@@ -7,19 +7,19 @@ export declare const sparkIsInIsolationMode: ({ usedAssets, assetsData }: {
|
|
|
7
7
|
export declare const sparkGetCollSuppliedAssets: ({ usedAssets }: {
|
|
8
8
|
usedAssets: SparkUsedAssets;
|
|
9
9
|
}) => import("../../types").SparkUsedAsset[];
|
|
10
|
-
export declare const sparkGetSuppliableAssets: ({ usedAssets, eModeCategory,
|
|
10
|
+
export declare const sparkGetSuppliableAssets: ({ usedAssets, eModeCategory, assetsData, selectedMarket, network, ...rest }: SparkHelperCommon) => {
|
|
11
11
|
symbol: string;
|
|
12
12
|
canBeCollateral: boolean;
|
|
13
13
|
}[];
|
|
14
|
-
export declare const sparkGetSuppliableAsCollAssets: ({ usedAssets, eModeCategory,
|
|
14
|
+
export declare const sparkGetSuppliableAsCollAssets: ({ usedAssets, eModeCategory, assetsData, selectedMarket, network, ...rest }: SparkHelperCommon) => {
|
|
15
15
|
symbol: string;
|
|
16
16
|
canBeCollateral: boolean;
|
|
17
17
|
}[];
|
|
18
|
-
export declare const sparkGetEmodeMutableProps: ({ eModeCategory, assetsData, }: SparkHelperCommon, _asset: string) => {
|
|
18
|
+
export declare const sparkGetEmodeMutableProps: ({ eModeCategory, eModeCategoriesData, assetsData, }: SparkHelperCommon, _asset: string) => {
|
|
19
19
|
liquidationRatio: string;
|
|
20
20
|
collateralFactor: string;
|
|
21
21
|
};
|
|
22
|
-
export declare const sparkGetAggregatedPositionData: ({ usedAssets, eModeCategory,
|
|
22
|
+
export declare const sparkGetAggregatedPositionData: ({ usedAssets, eModeCategory, eModeCategoriesData, assetsData, selectedMarket, network, ...rest }: SparkHelperCommon) => SparkAggregatedPositionData;
|
|
23
23
|
export declare const getApyAfterValuesEstimation: (selectedMarket: SparkMarketData, actions: [{
|
|
24
24
|
action: string;
|
|
25
25
|
amount: string;
|
|
@@ -22,7 +22,7 @@ import Dec from 'decimal.js';
|
|
|
22
22
|
import { assetAmountInWei, getAssetInfo, getAssetInfoByAddress } from '@defisaver/tokens';
|
|
23
23
|
import { aprToApy, calcLeverageLiqPrice, getAssetsTotal, isLeveragedPos, } from '../../moneymarket';
|
|
24
24
|
import { calculateNetApy } from '../../staking';
|
|
25
|
-
import { ethToWeth, wethToEth } from '../../services/utils';
|
|
25
|
+
import { ethToWeth, getNativeAssetFromWrapped, wethToEth } from '../../services/utils';
|
|
26
26
|
import { SparkViewContractViem } from '../../contracts';
|
|
27
27
|
import { NetworkNumber } from '../../types/common';
|
|
28
28
|
import { borrowOperations } from '../../constants';
|
|
@@ -30,8 +30,8 @@ import { getViemProvider } from '../../services/viem';
|
|
|
30
30
|
export const sparkIsInIsolationMode = ({ usedAssets, assetsData }) => Object.values(usedAssets).some(({ symbol, collateral }) => collateral && assetsData[symbol].isIsolated);
|
|
31
31
|
export const sparkGetCollSuppliedAssets = ({ usedAssets }) => Object.values(usedAssets).filter(({ isSupplied, collateral }) => isSupplied && collateral);
|
|
32
32
|
export const sparkGetSuppliableAssets = (_a) => {
|
|
33
|
-
var { usedAssets, eModeCategory,
|
|
34
|
-
const data = Object.assign({ usedAssets, eModeCategory,
|
|
33
|
+
var { usedAssets, eModeCategory, assetsData, selectedMarket, network } = _a, rest = __rest(_a, ["usedAssets", "eModeCategory", "assetsData", "selectedMarket", "network"]);
|
|
34
|
+
const data = Object.assign({ usedAssets, eModeCategory, assetsData, selectedMarket, network }, rest);
|
|
35
35
|
const collAccountAssets = sparkGetCollSuppliedAssets(data);
|
|
36
36
|
const marketAssets = Object.values(assetsData);
|
|
37
37
|
if (sparkIsInIsolationMode(data)) {
|
|
@@ -41,25 +41,25 @@ export const sparkGetSuppliableAssets = (_a) => {
|
|
|
41
41
|
return marketAssets.filter(d => d.canBeSupplied).map(({ symbol, isIsolated }) => ({ symbol, canBeCollateral: !isIsolated }));
|
|
42
42
|
};
|
|
43
43
|
export const sparkGetSuppliableAsCollAssets = (_a) => {
|
|
44
|
-
var { usedAssets, eModeCategory,
|
|
45
|
-
return sparkGetSuppliableAssets(Object.assign({ usedAssets, eModeCategory,
|
|
44
|
+
var { usedAssets, eModeCategory, assetsData, selectedMarket, network } = _a, rest = __rest(_a, ["usedAssets", "eModeCategory", "assetsData", "selectedMarket", "network"]);
|
|
45
|
+
return sparkGetSuppliableAssets(Object.assign({ usedAssets, eModeCategory, assetsData, selectedMarket, network }, rest)).filter(({ canBeCollateral }) => canBeCollateral);
|
|
46
46
|
};
|
|
47
|
-
export const sparkGetEmodeMutableProps = ({ eModeCategory, assetsData, }, _asset) => {
|
|
48
|
-
|
|
49
|
-
const asset = wethToEth(_asset);
|
|
47
|
+
export const sparkGetEmodeMutableProps = ({ eModeCategory, eModeCategoriesData, assetsData, }, _asset) => {
|
|
48
|
+
const asset = getNativeAssetFromWrapped(_asset);
|
|
50
49
|
const assetData = assetsData[asset];
|
|
50
|
+
const eModeCategoryData = (eModeCategoriesData === null || eModeCategoriesData === void 0 ? void 0 : eModeCategoriesData[eModeCategory]) || { collateralAssets: [], collateralFactor: '0', liquidationRatio: '0' };
|
|
51
51
|
if (eModeCategory === 0
|
|
52
|
-
||
|
|
53
|
-
|| new Dec(
|
|
52
|
+
|| !eModeCategoryData.collateralAssets.includes(asset)
|
|
53
|
+
|| new Dec(eModeCategoryData.collateralFactor || 0).eq(0)) {
|
|
54
54
|
const { liquidationRatio, collateralFactor } = assetData;
|
|
55
55
|
return ({ liquidationRatio, collateralFactor });
|
|
56
56
|
}
|
|
57
|
-
const { liquidationRatio, collateralFactor } =
|
|
57
|
+
const { liquidationRatio, collateralFactor } = eModeCategoryData;
|
|
58
58
|
return ({ liquidationRatio, collateralFactor });
|
|
59
59
|
};
|
|
60
60
|
export const sparkGetAggregatedPositionData = (_a) => {
|
|
61
|
-
var { usedAssets, eModeCategory,
|
|
62
|
-
const data = Object.assign({ usedAssets, eModeCategory,
|
|
61
|
+
var { usedAssets, eModeCategory, eModeCategoriesData, assetsData, selectedMarket, network } = _a, rest = __rest(_a, ["usedAssets", "eModeCategory", "eModeCategoriesData", "assetsData", "selectedMarket", "network"]);
|
|
62
|
+
const data = Object.assign({ usedAssets, eModeCategory, eModeCategoriesData, assetsData, selectedMarket, network }, rest);
|
|
63
63
|
const payload = {};
|
|
64
64
|
payload.suppliedUsd = getAssetsTotal(usedAssets, ({ isSupplied }) => isSupplied, ({ suppliedUsd }) => suppliedUsd);
|
|
65
65
|
payload.suppliedCollateralUsd = getAssetsTotal(usedAssets, ({ isSupplied, collateral }) => isSupplied && collateral, ({ suppliedUsd }) => suppliedUsd);
|
|
@@ -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
|
};
|
|
@@ -244,17 +244,21 @@ export declare const FluidFTokens: (networkId: NetworkNumber) => {
|
|
|
244
244
|
wstETH: string;
|
|
245
245
|
GHO: string;
|
|
246
246
|
sUSDS: string;
|
|
247
|
+
USDtb: string;
|
|
247
248
|
} | {
|
|
248
249
|
ETH: string;
|
|
249
250
|
USDC: string;
|
|
250
251
|
USDT: string;
|
|
251
252
|
wstETH: string;
|
|
252
253
|
ARB: string;
|
|
254
|
+
GHO: string;
|
|
255
|
+
sUSDS: string;
|
|
253
256
|
} | {
|
|
254
257
|
ETH: string;
|
|
255
258
|
USDC: string;
|
|
256
259
|
EURC: string;
|
|
257
260
|
wstETH: string;
|
|
258
261
|
sUSDS: string;
|
|
262
|
+
GHO: string;
|
|
259
263
|
};
|
|
260
264
|
export declare const getFTokenAddress: (token: string, networkId: NetworkNumber) => any;
|
|
@@ -2290,6 +2290,7 @@ const FluidMainnetFTokenAddresses = {
|
|
|
2290
2290
|
[FluidMainnetDepositToken.wstETH]: '0x2411802D8BEA09be0aF8fD8D08314a63e706b29C',
|
|
2291
2291
|
[FluidMainnetDepositToken.GHO]: '0x6A29A46E21C730DcA1d8b23d637c101cec605C5B',
|
|
2292
2292
|
[FluidMainnetDepositToken.sUSDS]: '0x2BBE31d63E6813E3AC858C04dae43FB2a72B0D11',
|
|
2293
|
+
[FluidMainnetDepositToken.USDtb]: '0x15e8c742614b5D8Db4083A41Df1A14F5D2bFB400',
|
|
2293
2294
|
};
|
|
2294
2295
|
const FluidArbitrumFTokenAddresses = {
|
|
2295
2296
|
[FluidArbitrumDepositToken.ETH]: '0x45Df0656F8aDf017590009d2f1898eeca4F0a205',
|
|
@@ -2297,6 +2298,8 @@ const FluidArbitrumFTokenAddresses = {
|
|
|
2297
2298
|
[FluidArbitrumDepositToken.USDT]: '0x4A03F37e7d3fC243e3f99341d36f4b829BEe5E03',
|
|
2298
2299
|
[FluidArbitrumDepositToken.wstETH]: '0x66C25Cd75EBdAA7E04816F643d8E46cecd3183c9',
|
|
2299
2300
|
[FluidArbitrumDepositToken.ARB]: '0xbE3860FD4c3facDf8ad57Aa8c1A36D6dc4390a49',
|
|
2301
|
+
[FluidArbitrumDepositToken.GHO]: '0x037dFf1C12805707d7c29F163E0F09fC9102657A',
|
|
2302
|
+
[FluidArbitrumDepositToken.sUSDS]: '0x3459fcc94390C3372c0F7B4cD3F8795F0E5aFE96',
|
|
2300
2303
|
};
|
|
2301
2304
|
const FluidBaseFTokenAddresses = {
|
|
2302
2305
|
[FluidBaseDepositToken.ETH]: '0x9272D6153133175175Bc276512B2336BE3931CE9',
|
|
@@ -2304,6 +2307,7 @@ const FluidBaseFTokenAddresses = {
|
|
|
2304
2307
|
[FluidBaseDepositToken.EURC]: '0x1943FA26360f038230442525Cf1B9125b5DCB401',
|
|
2305
2308
|
[FluidBaseDepositToken.wstETH]: '0x896E39f0E9af61ECA9dD2938E14543506ef2c2b5',
|
|
2306
2309
|
[FluidBaseDepositToken.sUSDS]: '0xf62e339f21d8018940f188F6987Bcdf02A849619',
|
|
2310
|
+
[FluidBaseDepositToken.GHO]: '0x8DdbfFA3CFda2355a23d6B11105AC624BDbE3631',
|
|
2307
2311
|
};
|
|
2308
2312
|
export const FluidFTokens = (networkId) => {
|
|
2309
2313
|
switch (networkId) {
|
package/esm/portfolio/index.js
CHANGED
|
@@ -446,7 +446,7 @@ export function getPortfolioData(provider, network, defaultProvider, addresses,
|
|
|
446
446
|
}))).flat(),
|
|
447
447
|
...sparkMarkets.map((market) => allAddresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
448
448
|
try {
|
|
449
|
-
const accData = yield _getSparkAccountData(client, network, address, { selectedMarket: market, assetsData: sparkMarketsData[market.value].assetsData });
|
|
449
|
+
const accData = yield _getSparkAccountData(client, network, address, { selectedMarket: market, assetsData: sparkMarketsData[market.value].assetsData, eModeCategoriesData: sparkMarketsData[market.value].eModeCategoriesData });
|
|
450
450
|
if (new Dec(accData.suppliedUsd).gt(0))
|
|
451
451
|
positions[address.toLowerCase()].spark[market.value] = { error: '', data: accData };
|
|
452
452
|
}
|
package/esm/services/utils.d.ts
CHANGED
|
@@ -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;
|
package/esm/services/utils.js
CHANGED
|
@@ -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
|
+
};
|