@defisaver/positions-sdk 2.1.20 → 2.1.21-dev-ethena
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/claiming/ethena.d.ts +3 -0
- package/cjs/claiming/ethena.js +65 -0
- package/cjs/portfolio/index.js +23 -0
- package/cjs/types/claiming.d.ts +6 -2
- package/cjs/types/claiming.js +1 -0
- package/esm/claiming/ethena.d.ts +3 -0
- package/esm/claiming/ethena.js +57 -0
- package/esm/portfolio/index.js +23 -0
- package/esm/types/claiming.d.ts +6 -2
- package/esm/types/claiming.js +1 -0
- package/package.json +1 -1
- package/src/claiming/ethena.ts +58 -0
- package/src/portfolio/index.ts +22 -0
- package/src/types/claiming.ts +6 -1
- package/CLAUDE.md +0 -32
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.fetchEthenaAirdropRewards = exports.fetchEthenaAirdropReward = void 0;
|
|
16
|
+
const tokens_1 = require("@defisaver/tokens");
|
|
17
|
+
const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
18
|
+
const claiming_1 = require("../types/claiming");
|
|
19
|
+
const fetchEthenaAirdropReward = (address) => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
+
try {
|
|
21
|
+
const response = yield fetch(`https://airdrop-data-ethena-s4.s3.us-west-2.amazonaws.com/${address}/0x3d99219fbd49ace3f48d6ca1340e505ec1bdf27d1f8d0e15ec9f286cc9215fcd-${address}.json`);
|
|
22
|
+
console.log(response);
|
|
23
|
+
if (!response.ok) {
|
|
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
|
+
return '0';
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
exports.fetchEthenaAirdropReward = fetchEthenaAirdropReward;
|
|
34
|
+
const fetchEthenaAirdropRewards = (walletAddresses) => __awaiter(void 0, void 0, void 0, function* () {
|
|
35
|
+
console.log('FETCHING ETHENA');
|
|
36
|
+
const apiDataPromises = walletAddresses.map(address => (0, exports.fetchEthenaAirdropReward)(address));
|
|
37
|
+
const apiDataArray = yield Promise.all(apiDataPromises);
|
|
38
|
+
console.log(apiDataArray);
|
|
39
|
+
const results = {};
|
|
40
|
+
for (let i = 0; i < walletAddresses.length; i++) {
|
|
41
|
+
const walletAddress = walletAddresses[i];
|
|
42
|
+
const data = apiDataArray[i];
|
|
43
|
+
if (data.length === 0) {
|
|
44
|
+
results[walletAddress.toLowerCase()] = [];
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
const processedRewards = [];
|
|
48
|
+
const amount = data.events[0].awardAmount;
|
|
49
|
+
const assetInfo = (0, tokens_1.getAssetInfo)('sENA');
|
|
50
|
+
if (new decimal_js_1.default(amount).gt('0')) {
|
|
51
|
+
processedRewards.push({
|
|
52
|
+
symbol: assetInfo.symbol,
|
|
53
|
+
underlyingSymbol: assetInfo.symbol,
|
|
54
|
+
amount,
|
|
55
|
+
claimType: claiming_1.ClaimType.SPARK_AIRDROP,
|
|
56
|
+
tokenAddress: assetInfo.address,
|
|
57
|
+
walletAddress,
|
|
58
|
+
label: 'Ethena Airdrop',
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
results[walletAddress.toLowerCase()] = processedRewards;
|
|
62
|
+
}
|
|
63
|
+
return results;
|
|
64
|
+
});
|
|
65
|
+
exports.fetchEthenaAirdropRewards = fetchEthenaAirdropRewards;
|
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,27 @@ function getPortfolioData(provider, network, defaultProvider, addresses, summerF
|
|
|
395
397
|
}
|
|
396
398
|
}
|
|
397
399
|
}))(),
|
|
400
|
+
(() => __awaiter(this, void 0, void 0, function* () {
|
|
401
|
+
try {
|
|
402
|
+
const ethenaAirdropRewards = yield (0, ethena_1.fetchEthenaAirdropRewards)(addresses);
|
|
403
|
+
for (const address of addresses) {
|
|
404
|
+
const lowerAddress = address.toLowerCase();
|
|
405
|
+
rewardsData[lowerAddress].spk = {
|
|
406
|
+
error: '',
|
|
407
|
+
data: ethenaAirdropRewards[lowerAddress] || [],
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
catch (error) {
|
|
412
|
+
console.error('Error fetching Ethena Airdrop rewards data:', error);
|
|
413
|
+
for (const address of addresses) {
|
|
414
|
+
rewardsData[address.toLowerCase()].ethena = {
|
|
415
|
+
error: 'Error fetching Ethena Airdrop rewards data in batch',
|
|
416
|
+
data: null,
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
}))(),
|
|
398
421
|
]);
|
|
399
422
|
yield Promise.all([
|
|
400
423
|
...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) {
|
|
@@ -0,0 +1,57 @@
|
|
|
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 { ClaimType } from '../types/claiming';
|
|
13
|
+
export const fetchEthenaAirdropReward = (address) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
+
try {
|
|
15
|
+
const response = yield fetch(`https://airdrop-data-ethena-s4.s3.us-west-2.amazonaws.com/${address}/0x3d99219fbd49ace3f48d6ca1340e505ec1bdf27d1f8d0e15ec9f286cc9215fcd-${address}.json`);
|
|
16
|
+
console.log(response);
|
|
17
|
+
if (!response.ok) {
|
|
18
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
19
|
+
}
|
|
20
|
+
return yield response.json();
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
console.error('Error fetching Ethena airdrop rewards:', error);
|
|
24
|
+
return '0';
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
export const fetchEthenaAirdropRewards = (walletAddresses) => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
|
+
console.log('FETCHING ETHENA');
|
|
29
|
+
const apiDataPromises = walletAddresses.map(address => fetchEthenaAirdropReward(address));
|
|
30
|
+
const apiDataArray = yield Promise.all(apiDataPromises);
|
|
31
|
+
console.log(apiDataArray);
|
|
32
|
+
const results = {};
|
|
33
|
+
for (let i = 0; i < walletAddresses.length; i++) {
|
|
34
|
+
const walletAddress = walletAddresses[i];
|
|
35
|
+
const data = apiDataArray[i];
|
|
36
|
+
if (data.length === 0) {
|
|
37
|
+
results[walletAddress.toLowerCase()] = [];
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
const processedRewards = [];
|
|
41
|
+
const amount = data.events[0].awardAmount;
|
|
42
|
+
const assetInfo = getAssetInfo('sENA');
|
|
43
|
+
if (new Dec(amount).gt('0')) {
|
|
44
|
+
processedRewards.push({
|
|
45
|
+
symbol: assetInfo.symbol,
|
|
46
|
+
underlyingSymbol: assetInfo.symbol,
|
|
47
|
+
amount,
|
|
48
|
+
claimType: ClaimType.SPARK_AIRDROP,
|
|
49
|
+
tokenAddress: assetInfo.address,
|
|
50
|
+
walletAddress,
|
|
51
|
+
label: 'Ethena Airdrop',
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
results[walletAddress.toLowerCase()] = processedRewards;
|
|
55
|
+
}
|
|
56
|
+
return results;
|
|
57
|
+
});
|
package/esm/portfolio/index.js
CHANGED
|
@@ -33,6 +33,7 @@ import { getCompoundV3Rewards } from '../claiming/compV3';
|
|
|
33
33
|
import { fetchSparkAirdropRewards, fetchSparkRewards } from '../claiming/spark';
|
|
34
34
|
import { fetchMorphoBlueRewards } from '../claiming/morphoBlue';
|
|
35
35
|
import { getKingRewards } from '../claiming/king';
|
|
36
|
+
import { fetchEthenaAirdropRewards } from '../claiming/ethena';
|
|
36
37
|
export function getPortfolioData(provider, network, defaultProvider, addresses, summerFiAddresses) {
|
|
37
38
|
return __awaiter(this, void 0, void 0, function* () {
|
|
38
39
|
const isMainnet = network === NetworkNumber.Eth;
|
|
@@ -133,6 +134,7 @@ export function getPortfolioData(provider, network, defaultProvider, addresses,
|
|
|
133
134
|
spk: {},
|
|
134
135
|
king: {},
|
|
135
136
|
morpho: {},
|
|
137
|
+
ethena: {},
|
|
136
138
|
};
|
|
137
139
|
}
|
|
138
140
|
yield Promise.allSettled([
|
|
@@ -389,6 +391,27 @@ export function getPortfolioData(provider, network, defaultProvider, addresses,
|
|
|
389
391
|
}
|
|
390
392
|
}
|
|
391
393
|
}))(),
|
|
394
|
+
(() => __awaiter(this, void 0, void 0, function* () {
|
|
395
|
+
try {
|
|
396
|
+
const ethenaAirdropRewards = yield fetchEthenaAirdropRewards(addresses);
|
|
397
|
+
for (const address of addresses) {
|
|
398
|
+
const lowerAddress = address.toLowerCase();
|
|
399
|
+
rewardsData[lowerAddress].spk = {
|
|
400
|
+
error: '',
|
|
401
|
+
data: ethenaAirdropRewards[lowerAddress] || [],
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
catch (error) {
|
|
406
|
+
console.error('Error fetching Ethena Airdrop rewards data:', error);
|
|
407
|
+
for (const address of addresses) {
|
|
408
|
+
rewardsData[address.toLowerCase()].ethena = {
|
|
409
|
+
error: 'Error fetching Ethena Airdrop rewards data in batch',
|
|
410
|
+
data: null,
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
}))(),
|
|
392
415
|
]);
|
|
393
416
|
yield Promise.all([
|
|
394
417
|
...aaveV3Markets.map((market) => allAddresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
package/esm/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/esm/types/claiming.js
CHANGED
|
@@ -16,6 +16,7 @@ export var ClaimType;
|
|
|
16
16
|
ClaimType["SPARK_AIRDROP"] = "SPARK_AIRDROP";
|
|
17
17
|
/** Spark Airdrop */
|
|
18
18
|
ClaimType["SPARK_WST_ETH_REWARDS"] = "SPARK_WST_ETH_REWARDS";
|
|
19
|
+
ClaimType["ETHENA_AIRDROP"] = "ETHENA_AIRDROP";
|
|
19
20
|
})(ClaimType || (ClaimType = {}));
|
|
20
21
|
export var SparkAirdropType;
|
|
21
22
|
(function (SparkAirdropType) {
|
package/package.json
CHANGED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { getAssetInfo } from '@defisaver/tokens';
|
|
2
|
+
import Dec from 'decimal.js';
|
|
3
|
+
import { EthAddress } from '../types/common';
|
|
4
|
+
import { ClaimType } from '../types/claiming';
|
|
5
|
+
|
|
6
|
+
export const fetchEthenaAirdropReward = async (address: EthAddress) => {
|
|
7
|
+
try {
|
|
8
|
+
const response = await fetch(`https://airdrop-data-ethena-s4.s3.us-west-2.amazonaws.com/${address}/0x3d99219fbd49ace3f48d6ca1340e505ec1bdf27d1f8d0e15ec9f286cc9215fcd-${address}.json`);
|
|
9
|
+
|
|
10
|
+
console.log(response);
|
|
11
|
+
if (!response.ok) {
|
|
12
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return await response.json();
|
|
16
|
+
} catch (error) {
|
|
17
|
+
console.error('Error fetching Ethena airdrop rewards:', error);
|
|
18
|
+
return '0';
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const fetchEthenaAirdropRewards = async (walletAddresses: EthAddress[]): Promise<Record<string, any[]>> => {
|
|
23
|
+
console.log('FETCHING ETHENA');
|
|
24
|
+
const apiDataPromises = walletAddresses.map(address => fetchEthenaAirdropReward(address));
|
|
25
|
+
const apiDataArray = await Promise.all(apiDataPromises);
|
|
26
|
+
|
|
27
|
+
console.log(apiDataArray);
|
|
28
|
+
const results: Record<string, any[]> = {};
|
|
29
|
+
for (let i = 0; i < walletAddresses.length; i++) {
|
|
30
|
+
const walletAddress = walletAddresses[i];
|
|
31
|
+
const data = apiDataArray[i];
|
|
32
|
+
|
|
33
|
+
if (data.length === 0) {
|
|
34
|
+
results[walletAddress.toLowerCase() as EthAddress] = [];
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const processedRewards = [];
|
|
39
|
+
const amount = data.events[0].awardAmount;
|
|
40
|
+
const assetInfo = getAssetInfo('sENA');
|
|
41
|
+
|
|
42
|
+
if (new Dec(amount).gt('0')) {
|
|
43
|
+
processedRewards.push({
|
|
44
|
+
symbol: assetInfo.symbol,
|
|
45
|
+
underlyingSymbol: assetInfo.symbol,
|
|
46
|
+
amount,
|
|
47
|
+
claimType: ClaimType.SPARK_AIRDROP,
|
|
48
|
+
tokenAddress: assetInfo.address,
|
|
49
|
+
walletAddress,
|
|
50
|
+
label: 'Ethena Airdrop',
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
results[walletAddress.toLowerCase() as EthAddress] = processedRewards;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return results;
|
|
58
|
+
};
|
package/src/portfolio/index.ts
CHANGED
|
@@ -48,6 +48,7 @@ import { getCompoundV3Rewards } from '../claiming/compV3';
|
|
|
48
48
|
import { fetchSparkAirdropRewards, fetchSparkRewards } from '../claiming/spark';
|
|
49
49
|
import { fetchMorphoBlueRewards } from '../claiming/morphoBlue';
|
|
50
50
|
import { getKingRewards } from '../claiming/king';
|
|
51
|
+
import { fetchEthenaAirdropRewards } from '../claiming/ethena';
|
|
51
52
|
|
|
52
53
|
export async function getPortfolioData(provider: EthereumProvider, network: NetworkNumber, defaultProvider: EthereumProvider, addresses: EthAddress[], summerFiAddresses: EthAddress[]): Promise<{
|
|
53
54
|
positions: PortfolioPositionsData;
|
|
@@ -161,6 +162,7 @@ export async function getPortfolioData(provider: EthereumProvider, network: Netw
|
|
|
161
162
|
spk: {},
|
|
162
163
|
king: {},
|
|
163
164
|
morpho: {},
|
|
165
|
+
ethena: {},
|
|
164
166
|
};
|
|
165
167
|
}
|
|
166
168
|
|
|
@@ -402,6 +404,26 @@ export async function getPortfolioData(provider: EthereumProvider, network: Netw
|
|
|
402
404
|
}
|
|
403
405
|
}
|
|
404
406
|
})(),
|
|
407
|
+
(async () => {
|
|
408
|
+
try {
|
|
409
|
+
const ethenaAirdropRewards = await fetchEthenaAirdropRewards(addresses);
|
|
410
|
+
for (const address of addresses) {
|
|
411
|
+
const lowerAddress = address.toLowerCase() as EthAddress;
|
|
412
|
+
rewardsData[lowerAddress].spk = {
|
|
413
|
+
error: '',
|
|
414
|
+
data: ethenaAirdropRewards[lowerAddress] || [],
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
} catch (error) {
|
|
418
|
+
console.error('Error fetching Ethena Airdrop rewards data:', error);
|
|
419
|
+
for (const address of addresses) {
|
|
420
|
+
rewardsData[address.toLowerCase() as EthAddress].ethena = {
|
|
421
|
+
error: 'Error fetching Ethena Airdrop rewards data in batch',
|
|
422
|
+
data: null,
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
})(),
|
|
405
427
|
]);
|
|
406
428
|
|
|
407
429
|
|
package/src/types/claiming.ts
CHANGED
|
@@ -17,6 +17,8 @@ export enum ClaimType {
|
|
|
17
17
|
SPARK_AIRDROP = 'SPARK_AIRDROP',
|
|
18
18
|
/** Spark Airdrop */
|
|
19
19
|
SPARK_WST_ETH_REWARDS = 'SPARK_WST_ETH_REWARDS', // TODO: This will be removed once we fully refactor spark rewards
|
|
20
|
+
|
|
21
|
+
ETHENA_AIRDROP = 'ETHENA_AIRDROP',
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
type _ClaimableTokenPartial = {
|
|
@@ -98,6 +100,8 @@ export type SparkAirdropClaimableToken = _ClaimableTokenPartial & {
|
|
|
98
100
|
|
|
99
101
|
export type SparkWstEthRewardsClaimableToken = _ClaimableTokenPartial & { claimType: ClaimType.SPARK_WST_ETH_REWARDS };
|
|
100
102
|
|
|
103
|
+
export type EthenaAirdropClaimableToken = _ClaimableTokenPartial & { claimType: ClaimType.ETHENA_AIRDROP };
|
|
104
|
+
|
|
101
105
|
export type ClaimableToken =
|
|
102
106
|
AaveRewardsClaimableToken
|
|
103
107
|
| AaveMeritRewardsClaimableToken
|
|
@@ -106,4 +110,5 @@ export type ClaimableToken =
|
|
|
106
110
|
| SparkRewardsClaimableToken
|
|
107
111
|
| KingRewardsClaimableToken
|
|
108
112
|
| SparkAirdropClaimableToken
|
|
109
|
-
| SparkWstEthRewardsClaimableToken
|
|
113
|
+
| SparkWstEthRewardsClaimableToken
|
|
114
|
+
| EthenaAirdropClaimableToken;
|
package/CLAUDE.md
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# DeFiSaver Positions SDK
|
|
2
|
-
|
|
3
|
-
TypeScript SDK for DeFi positions tracking and management.
|
|
4
|
-
|
|
5
|
-
## Commands
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
# Development
|
|
9
|
-
npm run dev # Watch mode compilation
|
|
10
|
-
npm run build # Lint and build both CJS and ESM
|
|
11
|
-
npm run build:cjs # Build CommonJS
|
|
12
|
-
npm run build:esm # Build ES modules
|
|
13
|
-
|
|
14
|
-
# Linting
|
|
15
|
-
npm run lint # Lint and fix
|
|
16
|
-
npm run lint-check # Lint without fixing
|
|
17
|
-
|
|
18
|
-
# Testing
|
|
19
|
-
npm run test # Run all tests
|
|
20
|
-
npm run test-single # Run single test (use --name=filename)
|
|
21
|
-
npm run test:debugger # Run tests with debugger
|
|
22
|
-
|
|
23
|
-
# Versioning
|
|
24
|
-
npm run version-bump # Commit and bump patch version
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## Project Structure
|
|
28
|
-
|
|
29
|
-
- `src/` - TypeScript source code
|
|
30
|
-
- `tests/` - Test files
|
|
31
|
-
- `esm/` - ES module build output
|
|
32
|
-
- `cjs/` - CommonJS build output
|