@defisaver/positions-sdk 2.1.22-dev-savings-4 → 2.1.23-dev-sena
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/claiming/ethena.d.ts +3 -0
- package/cjs/claiming/ethena.js +73 -0
- package/cjs/config/contracts.d.ts +0 -149
- package/cjs/config/contracts.js +1 -15
- package/cjs/contracts.d.ts +0 -1344
- package/cjs/contracts.js +1 -20
- package/cjs/helpers/morphoBlueHelpers/index.js +66 -66
- package/cjs/index.d.ts +1 -2
- package/cjs/index.js +1 -3
- package/cjs/portfolio/index.js +26 -0
- package/cjs/types/claiming.d.ts +6 -2
- package/cjs/types/claiming.js +1 -0
- package/cjs/types/index.d.ts +0 -1
- package/cjs/types/index.js +0 -1
- package/esm/claiming/ethena.d.ts +3 -0
- package/esm/claiming/ethena.js +65 -0
- package/esm/config/contracts.d.ts +0 -149
- package/esm/config/contracts.js +0 -14
- package/esm/contracts.d.ts +0 -1344
- package/esm/contracts.js +0 -17
- package/esm/helpers/morphoBlueHelpers/index.js +66 -66
- package/esm/index.d.ts +1 -2
- package/esm/index.js +1 -2
- package/esm/portfolio/index.js +26 -0
- package/esm/types/claiming.d.ts +6 -2
- package/esm/types/claiming.js +1 -0
- package/esm/types/index.d.ts +0 -1
- package/esm/types/index.js +0 -1
- package/package.json +47 -48
- package/src/aaveV2/index.ts +240 -240
- package/src/aaveV3/index.ts +614 -614
- package/src/aaveV3/merit.ts +97 -97
- package/src/aaveV3/merkl.ts +74 -74
- package/src/claiming/aaveV3.ts +154 -154
- package/src/claiming/compV3.ts +22 -22
- package/src/claiming/ethena.ts +67 -0
- 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 +1259 -1273
- package/src/constants/index.ts +10 -10
- package/src/contracts.ts +121 -141
- 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 +1774 -1774
- package/src/helpers/aaveHelpers/index.ts +187 -187
- 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 -158
- package/src/index.ts +47 -49
- package/src/liquity/index.ts +159 -159
- package/src/liquityV2/index.ts +703 -703
- 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 -54
- package/src/markets/compound/index.ts +238 -238
- package/src/markets/compound/marketsAssets.ts +97 -97
- package/src/markets/curveUsd/index.ts +69 -69
- package/src/markets/euler/index.ts +26 -26
- package/src/markets/fluid/index.ts +2900 -2900
- 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 +971 -971
- package/src/markets/spark/index.ts +29 -29
- package/src/markets/spark/marketAssets.ts +12 -12
- package/src/moneymarket/moneymarketCommonService.ts +84 -84
- package/src/morphoBlue/index.ts +274 -274
- package/src/portfolio/index.ts +598 -572
- package/src/services/priceService.ts +278 -278
- package/src/services/utils.ts +115 -115
- package/src/services/viem.ts +34 -34
- package/src/setup.ts +8 -8
- package/src/spark/index.ts +456 -456
- package/src/staking/eligibility.ts +53 -53
- package/src/staking/index.ts +1 -1
- package/src/staking/staking.ts +183 -183
- package/src/types/aave.ts +189 -189
- package/src/types/claiming.ts +114 -109
- package/src/types/common.ts +107 -107
- 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 +483 -483
- package/src/types/index.ts +14 -15
- 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 +200 -200
- package/src/types/portfolio.ts +60 -60
- package/src/types/spark.ts +133 -133
- package/src/umbrella/index.ts +69 -69
- package/src/umbrella/umbrellaUtils.ts +29 -29
- package/cjs/savings/index.d.ts +0 -6
- package/cjs/savings/index.js +0 -68
- package/cjs/savings/morphoVaults/index.d.ts +0 -7
- package/cjs/savings/morphoVaults/index.js +0 -118
- package/cjs/savings/morphoVaults/options.d.ts +0 -16
- package/cjs/savings/morphoVaults/options.js +0 -99
- package/cjs/savings/yearnVaults/index.d.ts +0 -7
- package/cjs/savings/yearnVaults/index.js +0 -97
- package/cjs/savings/yearnVaults/options.d.ts +0 -6
- package/cjs/savings/yearnVaults/options.js +0 -26
- package/cjs/types/savings/index.d.ts +0 -13
- package/cjs/types/savings/index.js +0 -18
- package/cjs/types/savings/morphoVaults.d.ts +0 -22
- package/cjs/types/savings/morphoVaults.js +0 -19
- package/cjs/types/savings/yearnVaults.d.ts +0 -11
- package/cjs/types/savings/yearnVaults.js +0 -9
- package/esm/savings/index.d.ts +0 -6
- package/esm/savings/index.js +0 -30
- package/esm/savings/morphoVaults/index.d.ts +0 -7
- package/esm/savings/morphoVaults/index.js +0 -77
- package/esm/savings/morphoVaults/options.d.ts +0 -16
- package/esm/savings/morphoVaults/options.js +0 -95
- package/esm/savings/yearnVaults/index.d.ts +0 -7
- package/esm/savings/yearnVaults/index.js +0 -56
- package/esm/savings/yearnVaults/options.d.ts +0 -6
- package/esm/savings/yearnVaults/options.js +0 -22
- package/esm/types/savings/index.d.ts +0 -13
- package/esm/types/savings/index.js +0 -2
- package/esm/types/savings/morphoVaults.d.ts +0 -22
- package/esm/types/savings/morphoVaults.js +0 -16
- package/esm/types/savings/yearnVaults.d.ts +0 -11
- package/esm/types/savings/yearnVaults.js +0 -6
- package/src/savings/index.ts +0 -35
- package/src/savings/morphoVaults/index.ts +0 -81
- package/src/savings/morphoVaults/options.ts +0 -110
- package/src/savings/yearnVaults/index.ts +0 -58
- package/src/savings/yearnVaults/options.ts +0 -27
- package/src/types/savings/index.ts +0 -16
- package/src/types/savings/morphoVaults.ts +0 -24
- package/src/types/savings/yearnVaults.ts +0 -13
package/cjs/contracts.js
CHANGED
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.
|
|
36
|
+
exports.StkAAVEViem = exports.LiquityV2sBoldVaultViem = exports.AaveRewardsControllerViem = exports.SparkRewardsControllerViem = exports.UUPSViem = exports.LiquityStabilityPoolViem = exports.LiquityLQTYStakingViem = exports.AaveUmbrellaViewViem = exports.AaveIncentivesControllerViem = exports.FluidViewContractViem = exports.LiquityV2LegacyViewContractViem = exports.LiquityV2ViewContractViem = exports.LiquityActivePoolContractViem = exports.LiquityPriceFeedContractViem = exports.LiquityTroveManagerContractViem = exports.LiquityCollSurplusPoolContractViem = exports.LiquityViewContractViem = exports.BTCPriceFeedContractViem = exports.WeETHPriceFeedContractViem = exports.ComptrollerContractViem = exports.CompoundLoanInfoContractViem = exports.McdJugContractViem = exports.McdDogContractViem = exports.McdSpotterContractViem = exports.McdVatContractViem = exports.McdViewContractViem = exports.McdGetCdpsContractViem = exports.LlamaLendViewContractViem = exports.CrvUSDFactoryContractViem = exports.CrvUSDViewContractViem = exports.EulerV2ViewContractViem = exports.SparkIncentiveDataProviderContractViem = exports.SparkViewContractViem = exports.CompV3ViewContractViem = exports.WstETHPriceFeedContractViem = exports.USDCPriceFeedContractViem = exports.ETHPriceFeedContractViem = exports.COMPPriceFeedContractViem = exports.DFSFeedRegistryContractViem = exports.FeedRegistryContractViem = exports.AaveIncentiveDataProviderV3ContractViem = exports.AaveV3ViewContractViem = exports.AaveLoanInfoV2ContractViem = exports.MorphoBlueViewContractViem = exports.createViemContractFromConfigFunc = exports.getConfigContractAbi = exports.getConfigContractAddress = void 0;
|
|
37
37
|
const viem_1 = require("viem");
|
|
38
38
|
const configRaw = __importStar(require("./config/contracts"));
|
|
39
39
|
// @ts-ignore
|
|
@@ -84,24 +84,6 @@ const createViemContractFromConfigFunc = (name, _address) => (client, network, b
|
|
|
84
84
|
});
|
|
85
85
|
};
|
|
86
86
|
exports.createViemContractFromConfigFunc = createViemContractFromConfigFunc;
|
|
87
|
-
const getMorphoVaultContractViem = (client, address) => {
|
|
88
|
-
const abi = (0, exports.getConfigContractAbi)('MorphoVault');
|
|
89
|
-
return (0, viem_1.getContract)({
|
|
90
|
-
address,
|
|
91
|
-
abi,
|
|
92
|
-
client,
|
|
93
|
-
});
|
|
94
|
-
};
|
|
95
|
-
exports.getMorphoVaultContractViem = getMorphoVaultContractViem;
|
|
96
|
-
const getYearnVaultContractViem = (client, address) => {
|
|
97
|
-
const abi = (0, exports.getConfigContractAbi)('YearnVault');
|
|
98
|
-
return (0, viem_1.getContract)({
|
|
99
|
-
address,
|
|
100
|
-
abi,
|
|
101
|
-
client,
|
|
102
|
-
});
|
|
103
|
-
};
|
|
104
|
-
exports.getYearnVaultContractViem = getYearnVaultContractViem;
|
|
105
87
|
exports.MorphoBlueViewContractViem = (0, exports.createViemContractFromConfigFunc)('MorphoBlueView');
|
|
106
88
|
exports.AaveLoanInfoV2ContractViem = (0, exports.createViemContractFromConfigFunc)('AaveLoanInfoV2');
|
|
107
89
|
exports.AaveV3ViewContractViem = (0, exports.createViemContractFromConfigFunc)('AaveV3View');
|
|
@@ -146,4 +128,3 @@ exports.SparkRewardsControllerViem = (0, exports.createViemContractFromConfigFun
|
|
|
146
128
|
exports.AaveRewardsControllerViem = (0, exports.createViemContractFromConfigFunc)('AaveRewardsController');
|
|
147
129
|
exports.LiquityV2sBoldVaultViem = (0, exports.createViemContractFromConfigFunc)('LiquityV2sBoldVault');
|
|
148
130
|
exports.StkAAVEViem = (0, exports.createViemContractFromConfigFunc)('StkAAVE');
|
|
149
|
-
exports.YearnViewContractViem = (0, exports.createViemContractFromConfigFunc)('YearnView');
|
|
@@ -128,73 +128,73 @@ const getApyAfterValuesEstimation = (selectedMarket, actions, provider, network)
|
|
|
128
128
|
});
|
|
129
129
|
exports.getApyAfterValuesEstimation = getApyAfterValuesEstimation;
|
|
130
130
|
const API_URL = 'https://blue-api.morpho.org/graphql';
|
|
131
|
-
const MARKET_QUERY = `
|
|
132
|
-
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
133
|
-
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
134
|
-
reallocatableLiquidityAssets
|
|
135
|
-
targetBorrowUtilization
|
|
136
|
-
loanAsset {
|
|
137
|
-
address
|
|
138
|
-
decimals
|
|
139
|
-
priceUsd
|
|
140
|
-
}
|
|
141
|
-
state {
|
|
142
|
-
liquidityAssets
|
|
143
|
-
borrowAssets
|
|
144
|
-
supplyAssets
|
|
145
|
-
}
|
|
146
|
-
publicAllocatorSharedLiquidity {
|
|
147
|
-
assets
|
|
148
|
-
vault {
|
|
149
|
-
address
|
|
150
|
-
name
|
|
151
|
-
}
|
|
152
|
-
allocationMarket {
|
|
153
|
-
uniqueKey
|
|
154
|
-
loanAsset {
|
|
155
|
-
address
|
|
156
|
-
}
|
|
157
|
-
collateralAsset {
|
|
158
|
-
address
|
|
159
|
-
}
|
|
160
|
-
irmAddress
|
|
161
|
-
oracle {
|
|
162
|
-
address
|
|
163
|
-
}
|
|
164
|
-
lltv
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
loanAsset {
|
|
168
|
-
address
|
|
169
|
-
}
|
|
170
|
-
collateralAsset {
|
|
171
|
-
address
|
|
172
|
-
}
|
|
173
|
-
oracle {
|
|
174
|
-
address
|
|
175
|
-
}
|
|
176
|
-
irmAddress
|
|
177
|
-
lltv
|
|
178
|
-
}
|
|
179
|
-
}
|
|
131
|
+
const MARKET_QUERY = `
|
|
132
|
+
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
133
|
+
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
134
|
+
reallocatableLiquidityAssets
|
|
135
|
+
targetBorrowUtilization
|
|
136
|
+
loanAsset {
|
|
137
|
+
address
|
|
138
|
+
decimals
|
|
139
|
+
priceUsd
|
|
140
|
+
}
|
|
141
|
+
state {
|
|
142
|
+
liquidityAssets
|
|
143
|
+
borrowAssets
|
|
144
|
+
supplyAssets
|
|
145
|
+
}
|
|
146
|
+
publicAllocatorSharedLiquidity {
|
|
147
|
+
assets
|
|
148
|
+
vault {
|
|
149
|
+
address
|
|
150
|
+
name
|
|
151
|
+
}
|
|
152
|
+
allocationMarket {
|
|
153
|
+
uniqueKey
|
|
154
|
+
loanAsset {
|
|
155
|
+
address
|
|
156
|
+
}
|
|
157
|
+
collateralAsset {
|
|
158
|
+
address
|
|
159
|
+
}
|
|
160
|
+
irmAddress
|
|
161
|
+
oracle {
|
|
162
|
+
address
|
|
163
|
+
}
|
|
164
|
+
lltv
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
loanAsset {
|
|
168
|
+
address
|
|
169
|
+
}
|
|
170
|
+
collateralAsset {
|
|
171
|
+
address
|
|
172
|
+
}
|
|
173
|
+
oracle {
|
|
174
|
+
address
|
|
175
|
+
}
|
|
176
|
+
irmAddress
|
|
177
|
+
lltv
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
180
|
`;
|
|
181
|
-
const REWARDS_QUERY = `
|
|
182
|
-
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
183
|
-
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
184
|
-
uniqueKey
|
|
185
|
-
state {
|
|
186
|
-
rewards {
|
|
187
|
-
amountPerSuppliedToken
|
|
188
|
-
supplyApr
|
|
189
|
-
amountPerBorrowedToken
|
|
190
|
-
borrowApr
|
|
191
|
-
asset {
|
|
192
|
-
address
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
181
|
+
const REWARDS_QUERY = `
|
|
182
|
+
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
183
|
+
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
184
|
+
uniqueKey
|
|
185
|
+
state {
|
|
186
|
+
rewards {
|
|
187
|
+
amountPerSuppliedToken
|
|
188
|
+
supplyApr
|
|
189
|
+
amountPerBorrowedToken
|
|
190
|
+
borrowApr
|
|
191
|
+
asset {
|
|
192
|
+
address
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
198
|
`;
|
|
199
199
|
/**
|
|
200
200
|
* Get reallocatable liquidity to a given market and target borrow utilization
|
package/cjs/index.d.ts
CHANGED
|
@@ -19,6 +19,5 @@ import * as llamaLend from './llamaLend';
|
|
|
19
19
|
import * as eulerV2 from './eulerV2';
|
|
20
20
|
import * as portfolio from './portfolio';
|
|
21
21
|
import * as claiming from './claiming';
|
|
22
|
-
import * as savings from './savings';
|
|
23
22
|
export * from './types';
|
|
24
|
-
export { aaveV2, aaveV3, compoundV2, compoundV3, spark, curveUsd, liquity, liquityV2, maker, exchange, staking, moneymarket, markets, helpers, morphoBlue, llamaLend, eulerV2, fluid, portfolio, claiming,
|
|
23
|
+
export { aaveV2, aaveV3, compoundV2, compoundV3, spark, curveUsd, liquity, liquityV2, maker, exchange, staking, moneymarket, markets, helpers, morphoBlue, llamaLend, eulerV2, fluid, portfolio, claiming, };
|
package/cjs/index.js
CHANGED
|
@@ -36,7 +36,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
36
36
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
39
|
+
exports.claiming = exports.portfolio = exports.fluid = exports.eulerV2 = exports.llamaLend = exports.morphoBlue = exports.helpers = exports.markets = exports.moneymarket = exports.staking = exports.exchange = exports.maker = exports.liquityV2 = exports.liquity = exports.curveUsd = exports.spark = exports.compoundV3 = exports.compoundV2 = exports.aaveV3 = exports.aaveV2 = void 0;
|
|
40
40
|
require("./setup");
|
|
41
41
|
const fluid = __importStar(require("./fluid"));
|
|
42
42
|
exports.fluid = fluid;
|
|
@@ -78,6 +78,4 @@ const portfolio = __importStar(require("./portfolio"));
|
|
|
78
78
|
exports.portfolio = portfolio;
|
|
79
79
|
const claiming = __importStar(require("./claiming"));
|
|
80
80
|
exports.claiming = claiming;
|
|
81
|
-
const savings = __importStar(require("./savings"));
|
|
82
|
-
exports.savings = savings;
|
|
83
81
|
__exportStar(require("./types"), exports);
|
package/cjs/portfolio/index.js
CHANGED
|
@@ -39,6 +39,7 @@ const compV3_1 = require("../claiming/compV3");
|
|
|
39
39
|
const spark_2 = require("../claiming/spark");
|
|
40
40
|
const morphoBlue_2 = require("../claiming/morphoBlue");
|
|
41
41
|
const king_1 = require("../claiming/king");
|
|
42
|
+
const ethena_1 = require("../claiming/ethena");
|
|
42
43
|
function getPortfolioData(provider, network, defaultProvider, addresses, summerFiAddresses) {
|
|
43
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
45
|
const isMainnet = network === common_1.NetworkNumber.Eth;
|
|
@@ -139,6 +140,7 @@ function getPortfolioData(provider, network, defaultProvider, addresses, summerF
|
|
|
139
140
|
spk: {},
|
|
140
141
|
king: {},
|
|
141
142
|
morpho: {},
|
|
143
|
+
ethena: {},
|
|
142
144
|
};
|
|
143
145
|
}
|
|
144
146
|
yield Promise.allSettled([
|
|
@@ -395,6 +397,30 @@ function getPortfolioData(provider, network, defaultProvider, addresses, summerF
|
|
|
395
397
|
}
|
|
396
398
|
}
|
|
397
399
|
}))(),
|
|
400
|
+
(() => __awaiter(this, void 0, void 0, function* () {
|
|
401
|
+
try {
|
|
402
|
+
if (!isMainnet) {
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
const ethenaAirdropRewards = yield (0, ethena_1.fetchEthenaAirdropRewards)(addresses);
|
|
406
|
+
for (const address of addresses) {
|
|
407
|
+
const lowerAddress = address.toLowerCase();
|
|
408
|
+
rewardsData[lowerAddress].ethena = {
|
|
409
|
+
error: '',
|
|
410
|
+
data: ethenaAirdropRewards[lowerAddress] || [],
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
catch (error) {
|
|
415
|
+
console.error('Error fetching Ethena Airdrop rewards data:', error);
|
|
416
|
+
for (const address of addresses) {
|
|
417
|
+
rewardsData[address.toLowerCase()].ethena = {
|
|
418
|
+
error: 'Error fetching Ethena Airdrop rewards data in batch',
|
|
419
|
+
data: null,
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
}))(),
|
|
398
424
|
]);
|
|
399
425
|
yield Promise.all([
|
|
400
426
|
...aaveV3Markets.map((market) => allAddresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
package/cjs/types/claiming.d.ts
CHANGED
|
@@ -15,7 +15,8 @@ export declare enum ClaimType {
|
|
|
15
15
|
/** Spark Airdrop */
|
|
16
16
|
SPARK_AIRDROP = "SPARK_AIRDROP",
|
|
17
17
|
/** Spark Airdrop */
|
|
18
|
-
SPARK_WST_ETH_REWARDS = "SPARK_WST_ETH_REWARDS"
|
|
18
|
+
SPARK_WST_ETH_REWARDS = "SPARK_WST_ETH_REWARDS",// TODO: This will be removed once we fully refactor spark rewards
|
|
19
|
+
ETHENA_AIRDROP = "ETHENA_AIRDROP"
|
|
19
20
|
}
|
|
20
21
|
type _ClaimableTokenPartial = {
|
|
21
22
|
symbol: string;
|
|
@@ -89,5 +90,8 @@ export type SparkAirdropClaimableToken = _ClaimableTokenPartial & {
|
|
|
89
90
|
export type SparkWstEthRewardsClaimableToken = _ClaimableTokenPartial & {
|
|
90
91
|
claimType: ClaimType.SPARK_WST_ETH_REWARDS;
|
|
91
92
|
};
|
|
92
|
-
export type
|
|
93
|
+
export type EthenaAirdropClaimableToken = _ClaimableTokenPartial & {
|
|
94
|
+
claimType: ClaimType.ETHENA_AIRDROP;
|
|
95
|
+
};
|
|
96
|
+
export type ClaimableToken = AaveRewardsClaimableToken | AaveMeritRewardsClaimableToken | CompoundV3CompClaimableToken | MorphoClaimableToken | SparkRewardsClaimableToken | KingRewardsClaimableToken | SparkAirdropClaimableToken | SparkWstEthRewardsClaimableToken | EthenaAirdropClaimableToken;
|
|
93
97
|
export {};
|
package/cjs/types/claiming.js
CHANGED
|
@@ -19,6 +19,7 @@ var ClaimType;
|
|
|
19
19
|
ClaimType["SPARK_AIRDROP"] = "SPARK_AIRDROP";
|
|
20
20
|
/** Spark Airdrop */
|
|
21
21
|
ClaimType["SPARK_WST_ETH_REWARDS"] = "SPARK_WST_ETH_REWARDS";
|
|
22
|
+
ClaimType["ETHENA_AIRDROP"] = "ETHENA_AIRDROP";
|
|
22
23
|
})(ClaimType || (exports.ClaimType = ClaimType = {}));
|
|
23
24
|
var SparkAirdropType;
|
|
24
25
|
(function (SparkAirdropType) {
|
package/cjs/types/index.d.ts
CHANGED
package/cjs/types/index.js
CHANGED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { getAssetInfo } from '@defisaver/tokens';
|
|
11
|
+
import Dec from 'decimal.js';
|
|
12
|
+
import { getAddress } from 'viem';
|
|
13
|
+
import { ClaimType } from '../types/claiming';
|
|
14
|
+
import { getEthAmountForDecimals } from '../services/utils';
|
|
15
|
+
export const fetchEthenaAirdropReward = (address) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
try {
|
|
17
|
+
const checksumAddress = getAddress(address);
|
|
18
|
+
const response = yield fetch(`https://airdrop-data-ethena-s4.s3.us-west-2.amazonaws.com/${checksumAddress}/0x3d99219fbd49ace3f48d6ca1340e505ec1bdf27d1f8d0e15ec9f286cc9215fcd-${checksumAddress}.json`);
|
|
19
|
+
if (!response.ok) {
|
|
20
|
+
if (response.status === 403) {
|
|
21
|
+
// This is also okay, means that there are no rewards for the address
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
25
|
+
}
|
|
26
|
+
return yield response.json();
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
console.error('Error fetching Ethena airdrop rewards:', error);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
export const fetchEthenaAirdropRewards = (walletAddresses) => __awaiter(void 0, void 0, void 0, function* () {
|
|
33
|
+
const apiDataPromises = walletAddresses.map(address => fetchEthenaAirdropReward(address));
|
|
34
|
+
const apiDataArray = yield Promise.all(apiDataPromises);
|
|
35
|
+
console.log(apiDataArray);
|
|
36
|
+
const results = {};
|
|
37
|
+
for (let i = 0; i < walletAddresses.length; i++) {
|
|
38
|
+
const walletAddress = walletAddresses[i];
|
|
39
|
+
const data = apiDataArray[i];
|
|
40
|
+
if (!data || data.claimed) {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
if (data.length === 0) {
|
|
44
|
+
results[walletAddress.toLowerCase()] = [];
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
const processedRewards = [];
|
|
48
|
+
const assetInfo = getAssetInfo('sENA');
|
|
49
|
+
console.log(assetInfo);
|
|
50
|
+
const amount = getEthAmountForDecimals(data.events[0].awardAmount, assetInfo.decimals);
|
|
51
|
+
if (new Dec(amount).gt('0')) {
|
|
52
|
+
processedRewards.push({
|
|
53
|
+
symbol: assetInfo.symbol,
|
|
54
|
+
underlyingSymbol: assetInfo.symbol,
|
|
55
|
+
amount,
|
|
56
|
+
claimType: ClaimType.ETHENA_AIRDROP,
|
|
57
|
+
tokenAddress: assetInfo.address,
|
|
58
|
+
walletAddress,
|
|
59
|
+
label: 'Ethena Airdrop',
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
results[walletAddress.toLowerCase()] = processedRewards;
|
|
63
|
+
}
|
|
64
|
+
return results;
|
|
65
|
+
});
|
|
@@ -85162,152 +85162,3 @@ export declare const StkAAVE: {
|
|
|
85162
85162
|
};
|
|
85163
85163
|
};
|
|
85164
85164
|
};
|
|
85165
|
-
export declare const MorphoVault: {
|
|
85166
|
-
readonly abi: readonly [{
|
|
85167
|
-
readonly inputs: readonly [];
|
|
85168
|
-
readonly name: "acceptTimelock";
|
|
85169
|
-
readonly outputs: readonly [];
|
|
85170
|
-
readonly stateMutability: "nonpayable";
|
|
85171
|
-
readonly type: "function";
|
|
85172
|
-
}, {
|
|
85173
|
-
readonly inputs: readonly [{
|
|
85174
|
-
readonly internalType: "address";
|
|
85175
|
-
readonly name: "account";
|
|
85176
|
-
readonly type: "address";
|
|
85177
|
-
}];
|
|
85178
|
-
readonly name: "balanceOf";
|
|
85179
|
-
readonly outputs: readonly [{
|
|
85180
|
-
readonly internalType: "uint256";
|
|
85181
|
-
readonly name: "";
|
|
85182
|
-
readonly type: "uint256";
|
|
85183
|
-
}];
|
|
85184
|
-
readonly stateMutability: "view";
|
|
85185
|
-
readonly type: "function";
|
|
85186
|
-
}, {
|
|
85187
|
-
readonly inputs: readonly [{
|
|
85188
|
-
readonly internalType: "uint256";
|
|
85189
|
-
readonly name: "shares";
|
|
85190
|
-
readonly type: "uint256";
|
|
85191
|
-
}];
|
|
85192
|
-
readonly name: "convertToAssets";
|
|
85193
|
-
readonly outputs: readonly [{
|
|
85194
|
-
readonly internalType: "uint256";
|
|
85195
|
-
readonly name: "";
|
|
85196
|
-
readonly type: "uint256";
|
|
85197
|
-
}];
|
|
85198
|
-
readonly stateMutability: "view";
|
|
85199
|
-
readonly type: "function";
|
|
85200
|
-
}, {
|
|
85201
|
-
readonly inputs: readonly [];
|
|
85202
|
-
readonly name: "decimals";
|
|
85203
|
-
readonly outputs: readonly [{
|
|
85204
|
-
readonly internalType: "uint8";
|
|
85205
|
-
readonly name: "";
|
|
85206
|
-
readonly type: "uint8";
|
|
85207
|
-
}];
|
|
85208
|
-
readonly stateMutability: "view";
|
|
85209
|
-
readonly type: "function";
|
|
85210
|
-
}, {
|
|
85211
|
-
readonly inputs: readonly [];
|
|
85212
|
-
readonly name: "DECIMALS_OFFSET";
|
|
85213
|
-
readonly outputs: readonly [{
|
|
85214
|
-
readonly internalType: "uint8";
|
|
85215
|
-
readonly name: "";
|
|
85216
|
-
readonly type: "uint8";
|
|
85217
|
-
}];
|
|
85218
|
-
readonly stateMutability: "view";
|
|
85219
|
-
readonly type: "function";
|
|
85220
|
-
}, {
|
|
85221
|
-
readonly inputs: readonly [{
|
|
85222
|
-
readonly internalType: "uint256";
|
|
85223
|
-
readonly name: "shares";
|
|
85224
|
-
readonly type: "uint256";
|
|
85225
|
-
}];
|
|
85226
|
-
readonly name: "previewRedeem";
|
|
85227
|
-
readonly outputs: readonly [{
|
|
85228
|
-
readonly internalType: "uint256";
|
|
85229
|
-
readonly name: "";
|
|
85230
|
-
readonly type: "uint256";
|
|
85231
|
-
}];
|
|
85232
|
-
readonly stateMutability: "view";
|
|
85233
|
-
readonly type: "function";
|
|
85234
|
-
}, {
|
|
85235
|
-
readonly inputs: readonly [];
|
|
85236
|
-
readonly name: "totalAssets";
|
|
85237
|
-
readonly outputs: readonly [{
|
|
85238
|
-
readonly internalType: "uint256";
|
|
85239
|
-
readonly name: "";
|
|
85240
|
-
readonly type: "uint256";
|
|
85241
|
-
}];
|
|
85242
|
-
readonly stateMutability: "view";
|
|
85243
|
-
readonly type: "function";
|
|
85244
|
-
}, {
|
|
85245
|
-
readonly inputs: readonly [];
|
|
85246
|
-
readonly name: "totalSupply";
|
|
85247
|
-
readonly outputs: readonly [{
|
|
85248
|
-
readonly internalType: "uint256";
|
|
85249
|
-
readonly name: "";
|
|
85250
|
-
readonly type: "uint256";
|
|
85251
|
-
}];
|
|
85252
|
-
readonly stateMutability: "view";
|
|
85253
|
-
readonly type: "function";
|
|
85254
|
-
}];
|
|
85255
|
-
};
|
|
85256
|
-
export declare const YearnVault: {
|
|
85257
|
-
readonly abi: readonly [{
|
|
85258
|
-
readonly stateMutability: "view";
|
|
85259
|
-
readonly type: "function";
|
|
85260
|
-
readonly name: "balanceOf";
|
|
85261
|
-
readonly inputs: readonly [{
|
|
85262
|
-
readonly name: "arg0";
|
|
85263
|
-
readonly type: "address";
|
|
85264
|
-
}];
|
|
85265
|
-
readonly outputs: readonly [{
|
|
85266
|
-
readonly name: "";
|
|
85267
|
-
readonly type: "uint256";
|
|
85268
|
-
}];
|
|
85269
|
-
readonly gas: 3923;
|
|
85270
|
-
}, {
|
|
85271
|
-
readonly stateMutability: "view";
|
|
85272
|
-
readonly type: "function";
|
|
85273
|
-
readonly name: "totalAssets";
|
|
85274
|
-
readonly inputs: readonly [];
|
|
85275
|
-
readonly outputs: readonly [{
|
|
85276
|
-
readonly name: "";
|
|
85277
|
-
readonly type: "uint256";
|
|
85278
|
-
}];
|
|
85279
|
-
readonly gas: 8698;
|
|
85280
|
-
}, {
|
|
85281
|
-
readonly stateMutability: "view";
|
|
85282
|
-
readonly type: "function";
|
|
85283
|
-
readonly name: "totalSupply";
|
|
85284
|
-
readonly inputs: readonly [];
|
|
85285
|
-
readonly outputs: readonly [{
|
|
85286
|
-
readonly name: "";
|
|
85287
|
-
readonly type: "uint256";
|
|
85288
|
-
}];
|
|
85289
|
-
readonly gas: 3768;
|
|
85290
|
-
}];
|
|
85291
|
-
};
|
|
85292
|
-
export declare const YearnView: {
|
|
85293
|
-
readonly abi: readonly [{
|
|
85294
|
-
readonly inputs: readonly [{
|
|
85295
|
-
readonly internalType: "address";
|
|
85296
|
-
readonly name: "_vault";
|
|
85297
|
-
readonly type: "address";
|
|
85298
|
-
}];
|
|
85299
|
-
readonly name: "getPoolLiquidity";
|
|
85300
|
-
readonly outputs: readonly [{
|
|
85301
|
-
readonly internalType: "uint256";
|
|
85302
|
-
readonly name: "";
|
|
85303
|
-
readonly type: "uint256";
|
|
85304
|
-
}];
|
|
85305
|
-
readonly stateMutability: "view";
|
|
85306
|
-
readonly type: "function";
|
|
85307
|
-
}];
|
|
85308
|
-
readonly networks: {
|
|
85309
|
-
readonly "1": {
|
|
85310
|
-
readonly address: "0x36314D468E1da48Fb637fFB7c7DBDF222eC3FFe7";
|
|
85311
|
-
};
|
|
85312
|
-
};
|
|
85313
|
-
};
|
package/esm/config/contracts.js
CHANGED
|
@@ -1256,17 +1256,3 @@ export const StkAAVE = {
|
|
|
1256
1256
|
}
|
|
1257
1257
|
}
|
|
1258
1258
|
};
|
|
1259
|
-
export const MorphoVault = {
|
|
1260
|
-
"abi": [{ "inputs": [], "name": "acceptTimelock", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], "name": "balanceOf", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "shares", "type": "uint256" }], "name": "convertToAssets", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "decimals", "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "DECIMALS_OFFSET", "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "shares", "type": "uint256" }], "name": "previewRedeem", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "totalAssets", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "totalSupply", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }],
|
|
1261
|
-
};
|
|
1262
|
-
export const YearnVault = {
|
|
1263
|
-
"abi": [{ "stateMutability": "view", "type": "function", "name": "balanceOf", "inputs": [{ "name": "arg0", "type": "address" }], "outputs": [{ "name": "", "type": "uint256" }], "gas": 3923 }, { "stateMutability": "view", "type": "function", "name": "totalAssets", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "gas": 8698 }, { "stateMutability": "view", "type": "function", "name": "totalSupply", "inputs": [], "outputs": [{ "name": "", "type": "uint256" }], "gas": 3768 }]
|
|
1264
|
-
};
|
|
1265
|
-
export const YearnView = {
|
|
1266
|
-
"abi": [{ "inputs": [{ "internalType": "address", "name": "_vault", "type": "address" }], "name": "getPoolLiquidity", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }],
|
|
1267
|
-
"networks": {
|
|
1268
|
-
"1": {
|
|
1269
|
-
"address": "0x36314D468E1da48Fb637fFB7c7DBDF222eC3FFe7",
|
|
1270
|
-
}
|
|
1271
|
-
}
|
|
1272
|
-
};
|