@defisaver/positions-sdk 2.1.114 → 2.1.116
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/merkl.d.ts +1 -2
- package/cjs/aaveV3/merkl.js +2 -2
- package/cjs/aaveV4/lend.d.ts +1 -1
- package/cjs/aaveV4/lend.js +6 -0
- package/cjs/aaveV4/merkl.d.ts +1 -2
- package/cjs/aaveV4/merkl.js +2 -2
- package/cjs/claiming/aaveV3.d.ts +1 -1
- package/cjs/claiming/aaveV3.js +5 -1
- package/cjs/helpers/morphoBlueHelpers/index.js +0 -2
- package/cjs/markets/aaveV4/index.d.ts +4 -0
- package/cjs/markets/aaveV4/index.js +22 -1
- package/cjs/moneymarket/moneymarketCommonService.js +1 -1
- package/cjs/staking/staking.js +3 -1
- package/cjs/types/aaveV4.d.ts +4 -2
- package/cjs/types/aaveV4.js +2 -0
- package/esm/aaveV3/merkl.d.ts +1 -2
- package/esm/aaveV3/merkl.js +3 -3
- package/esm/aaveV4/lend.d.ts +1 -1
- package/esm/aaveV4/lend.js +6 -0
- package/esm/aaveV4/merkl.d.ts +1 -2
- package/esm/aaveV4/merkl.js +3 -3
- package/esm/claiming/aaveV3.d.ts +1 -1
- package/esm/claiming/aaveV3.js +6 -2
- package/esm/helpers/morphoBlueHelpers/index.js +0 -2
- package/esm/markets/aaveV4/index.d.ts +4 -0
- package/esm/markets/aaveV4/index.js +19 -0
- package/esm/moneymarket/moneymarketCommonService.js +1 -1
- package/esm/staking/staking.js +3 -1
- package/esm/types/aaveV4.d.ts +4 -2
- package/esm/types/aaveV4.js +2 -0
- package/package.json +2 -2
- package/src/aaveV3/merkl.ts +4 -4
- package/src/aaveV4/lend.ts +6 -1
- package/src/aaveV4/merkl.ts +4 -4
- package/src/claiming/aaveV3.ts +8 -4
- package/src/helpers/morphoBlueHelpers/index.ts +0 -2
- package/src/markets/aaveV4/index.ts +21 -0
- package/src/moneymarket/moneymarketCommonService.ts +1 -1
- package/src/staking/staking.ts +2 -1
- package/src/types/aaveV4.ts +2 -0
package/cjs/aaveV3/merkl.d.ts
CHANGED
package/cjs/aaveV3/merkl.js
CHANGED
|
@@ -40,8 +40,8 @@ const formatAaveAsset = (_symbol) => {
|
|
|
40
40
|
exports.formatAaveAsset = formatAaveAsset;
|
|
41
41
|
const getMerkleCampaigns = (chainId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
42
42
|
try {
|
|
43
|
-
const res = yield fetch('https://
|
|
44
|
-
signal: AbortSignal.timeout(utils_1.
|
|
43
|
+
const res = yield fetch('https://fe.defisaver.com/api/merkl/opportunities?mainProtocolId=aave', {
|
|
44
|
+
signal: AbortSignal.timeout(utils_1.LONGER_TIMEOUT),
|
|
45
45
|
});
|
|
46
46
|
if (!res.ok)
|
|
47
47
|
throw new Error('Failed to fetch Merkle campaigns');
|
package/cjs/aaveV4/lend.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export interface AaveV4TokenizationSpokeData {
|
|
|
20
20
|
}
|
|
21
21
|
export declare const AAVE_V4_TOKENIZED_SPOKES: Record<string, EthAddress>;
|
|
22
22
|
export declare const AAVE_V4_TOKENIZED_SPOKE_ADDRESSES: Partial<Record<NetworkNumber, EthAddress[]>>;
|
|
23
|
-
export type AaveV4TokenizedHubKey = 'CORE' | 'PLUS' | 'PRIME';
|
|
23
|
+
export type AaveV4TokenizedHubKey = 'CORE' | 'PLUS' | 'PRIME' | 'PAXOS';
|
|
24
24
|
export declare const aaveV4GetTokenizedHubKey: (hubNameOrKey?: string | null) => AaveV4TokenizedHubKey | null;
|
|
25
25
|
export declare const aaveV4GetTokenizedVaultKey: (symbol: string, hubNameOrKey?: string | null) => string | null;
|
|
26
26
|
export declare const aaveV4GetTokenizedVaultAddress: (network: NetworkNumber, symbol: string, hubNameOrKey?: string | null) => EthAddress | undefined;
|
package/cjs/aaveV4/lend.js
CHANGED
|
@@ -34,6 +34,8 @@ exports.AAVE_V4_TOKENIZED_SPOKES = {
|
|
|
34
34
|
GHO_PRIME: '0x900fD46d565d1ac8995928c0179052ec02a6D0E1',
|
|
35
35
|
USDC_PRIME: '0x486415fb1F8b062c89ED548f871cf64304AACb31',
|
|
36
36
|
USDT_PRIME: '0x46c588DD8453aC259c1f6a54b4C9A93C2aC3762D',
|
|
37
|
+
// USDC_PAXOS: '0x0',
|
|
38
|
+
// USDT_PAXOS: '0x0',
|
|
37
39
|
};
|
|
38
40
|
exports.AAVE_V4_TOKENIZED_SPOKE_ADDRESSES = {
|
|
39
41
|
[common_1.NetworkNumber.Eth]: Object.values(exports.AAVE_V4_TOKENIZED_SPOKES),
|
|
@@ -48,12 +50,16 @@ const aaveV4GetTokenizedHubKey = (hubNameOrKey) => {
|
|
|
48
50
|
return 'PLUS';
|
|
49
51
|
if (normalized === 'PRIME' || normalized === 'PRIME HUB')
|
|
50
52
|
return 'PRIME';
|
|
53
|
+
if (normalized === 'PAXOS' || normalized === 'PAXOS HUB')
|
|
54
|
+
return 'PAXOS';
|
|
51
55
|
if (normalized.includes('CORE'))
|
|
52
56
|
return 'CORE';
|
|
53
57
|
if (normalized.includes('PLUS'))
|
|
54
58
|
return 'PLUS';
|
|
55
59
|
if (normalized.includes('PRIME'))
|
|
56
60
|
return 'PRIME';
|
|
61
|
+
if (normalized.includes('PAXOS'))
|
|
62
|
+
return 'PAXOS';
|
|
57
63
|
return null;
|
|
58
64
|
};
|
|
59
65
|
exports.aaveV4GetTokenizedHubKey = aaveV4GetTokenizedHubKey;
|
package/cjs/aaveV4/merkl.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { AaveV4MerklRewardMap, AaveV4ReserveAssetData } from '../types';
|
|
2
|
-
import { NetworkNumber } from '../types/common';
|
|
1
|
+
import { AaveV4MerklRewardMap, AaveV4ReserveAssetData, NetworkNumber } from '../types';
|
|
3
2
|
export declare const getAaveV4MerkleCampaigns: (chainId: NetworkNumber) => Promise<AaveV4MerklRewardMap>;
|
|
4
3
|
/**
|
|
5
4
|
* Returns a copy of the asset with scope-specific incentive arrays pre-combined with the asset's
|
package/cjs/aaveV4/merkl.js
CHANGED
|
@@ -34,8 +34,8 @@ const buildIncentive = (opportunity) => {
|
|
|
34
34
|
const getAaveV4MerkleCampaigns = (chainId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
35
35
|
const result = { hub: {}, spoke: {} };
|
|
36
36
|
try {
|
|
37
|
-
const res = yield fetch('https://
|
|
38
|
-
signal: AbortSignal.timeout(utils_1.
|
|
37
|
+
const res = yield fetch('https://fe.defisaver.com/api/merkl/opportunities?mainProtocolId=aave', {
|
|
38
|
+
signal: AbortSignal.timeout(utils_1.LONGER_TIMEOUT),
|
|
39
39
|
});
|
|
40
40
|
if (!res.ok)
|
|
41
41
|
throw new Error('Failed to fetch Aave V4 Merkle campaigns');
|
package/cjs/claiming/aaveV3.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Client } from 'viem';
|
|
2
|
-
import { EthAddress, NetworkNumber } from '../types
|
|
2
|
+
import { EthAddress, NetworkNumber } from '../types';
|
|
3
3
|
import { ClaimableToken } from '../types/claiming';
|
|
4
4
|
export declare function getUnclaimedRewardsForAllMarkets(provider: Client, network: NetworkNumber, walletAddress: EthAddress, marketAddress: EthAddress): Promise<ClaimableToken[]>;
|
|
5
5
|
export declare function getMeritUnclaimedRewards(account: EthAddress, network: NetworkNumber): Promise<ClaimableToken[]>;
|
package/cjs/claiming/aaveV3.js
CHANGED
|
@@ -99,7 +99,7 @@ function getMeritUnclaimedRewards(account, network) {
|
|
|
99
99
|
return __awaiter(this, void 0, void 0, function* () {
|
|
100
100
|
let data;
|
|
101
101
|
try {
|
|
102
|
-
const res = yield fetch(`https://
|
|
102
|
+
const res = yield fetch(`https://fe.defisaver.com/api/merkl/get-user-rewards/${account}?chainId=${network}`, { signal: AbortSignal.timeout(utils_1.LONGER_TIMEOUT) });
|
|
103
103
|
data = yield res.json();
|
|
104
104
|
}
|
|
105
105
|
catch (error) {
|
|
@@ -107,6 +107,10 @@ function getMeritUnclaimedRewards(account, network) {
|
|
|
107
107
|
data = [];
|
|
108
108
|
}
|
|
109
109
|
const claimableTokens = [];
|
|
110
|
+
// Merkl (or our proxy, on a non-2xx) can return a non-array error body; `fetch` doesn't throw on
|
|
111
|
+
// HTTP errors, so guard before iterating. Mirrors the app-side getMeritUnclaimedRewards.
|
|
112
|
+
if (!Array.isArray(data))
|
|
113
|
+
return claimableTokens;
|
|
110
114
|
data.forEach((item) => {
|
|
111
115
|
item.rewards.forEach(reward => {
|
|
112
116
|
const { token, amount, claimed, proofs, } = reward;
|
|
@@ -2,10 +2,12 @@ import { AaveV4HubInfo, AaveV4HubsType, AaveV4SpokeInfo, AaveV4SpokesType, Netwo
|
|
|
2
2
|
export declare const AAVE_V4_CORE_HUB: (networkId: NetworkNumber) => AaveV4HubInfo;
|
|
3
3
|
export declare const AAVE_V4_PLUS_HUB: (networkId: NetworkNumber) => AaveV4HubInfo;
|
|
4
4
|
export declare const AAVE_V4_PRIME_HUB: (networkId: NetworkNumber) => AaveV4HubInfo;
|
|
5
|
+
export declare const AAVE_V4_PAXOS_HUB: (networkId: NetworkNumber) => AaveV4HubInfo;
|
|
5
6
|
export declare const AaveV4Hubs: (networkId: NetworkNumber) => {
|
|
6
7
|
readonly aave_v4_core_hub: AaveV4HubInfo;
|
|
7
8
|
readonly aave_v4_plus_hub: AaveV4HubInfo;
|
|
8
9
|
readonly aave_v4_prime_hub: AaveV4HubInfo;
|
|
10
|
+
readonly aave_v4_paxos_hub: AaveV4HubInfo;
|
|
9
11
|
};
|
|
10
12
|
export declare const getAaveV4HubTypeInfo: (type: AaveV4HubsType, network?: NetworkNumber) => AaveV4HubInfo;
|
|
11
13
|
export declare const getAaveV4HubByAddress: (networkId: NetworkNumber, address: string) => AaveV4HubInfo | undefined;
|
|
@@ -19,6 +21,7 @@ export declare const AAVE_V4_KELP_SPOKE: (networkId: NetworkNumber) => AaveV4Spo
|
|
|
19
21
|
export declare const AAVE_V4_LIDO_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
20
22
|
export declare const AAVE_V4_LOMBARD_BTC_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
21
23
|
export declare const AAVE_V4_MAIN_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
24
|
+
export declare const AAVE_V4_USDG_PENDLE_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
22
25
|
export declare const AaveV4Spokes: (networkId: NetworkNumber) => {
|
|
23
26
|
readonly aave_v4_bluechip_spoke: AaveV4SpokeInfo;
|
|
24
27
|
readonly aave_v4_ethena_correlated_spoke: AaveV4SpokeInfo;
|
|
@@ -30,6 +33,7 @@ export declare const AaveV4Spokes: (networkId: NetworkNumber) => {
|
|
|
30
33
|
readonly aave_v4_lido_spoke: AaveV4SpokeInfo;
|
|
31
34
|
readonly aave_v4_lombard_btc_spoke: AaveV4SpokeInfo;
|
|
32
35
|
readonly aave_v4_main_spoke: AaveV4SpokeInfo;
|
|
36
|
+
readonly aave_v4_usdg_pendle_spoke: AaveV4SpokeInfo;
|
|
33
37
|
};
|
|
34
38
|
export declare const getAaveV4SpokeTypeInfo: (type: AaveV4SpokesType, network?: NetworkNumber) => AaveV4SpokeInfo;
|
|
35
39
|
export declare const findAaveV4SpokeByAddress: (networkId: NetworkNumber, address: string) => AaveV4SpokeInfo | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.findAaveV4SpokeByAddress = exports.getAaveV4SpokeTypeInfo = exports.AaveV4Spokes = exports.AAVE_V4_MAIN_SPOKE = exports.AAVE_V4_LOMBARD_BTC_SPOKE = exports.AAVE_V4_LIDO_SPOKE = exports.AAVE_V4_KELP_SPOKE = exports.AAVE_V4_GOLD_SPOKE = exports.AAVE_V4_FOREX_SPOKE = exports.AAVE_V4_ETHERFI_SPOKE = exports.AAVE_V4_ETHENA_ECOSYSTEM_SPOKE = exports.AAVE_V4_ETHENA_CORRELATED_SPOKE = exports.AAVE_V4_BLUECHIP_SPOKE = exports.getAaveV4HubByAddress = exports.getAaveV4HubTypeInfo = exports.AaveV4Hubs = exports.AAVE_V4_PRIME_HUB = exports.AAVE_V4_PLUS_HUB = exports.AAVE_V4_CORE_HUB = void 0;
|
|
3
|
+
exports.findAaveV4SpokeByAddress = exports.getAaveV4SpokeTypeInfo = exports.AaveV4Spokes = exports.AAVE_V4_USDG_PENDLE_SPOKE = exports.AAVE_V4_MAIN_SPOKE = exports.AAVE_V4_LOMBARD_BTC_SPOKE = exports.AAVE_V4_LIDO_SPOKE = exports.AAVE_V4_KELP_SPOKE = exports.AAVE_V4_GOLD_SPOKE = exports.AAVE_V4_FOREX_SPOKE = exports.AAVE_V4_ETHERFI_SPOKE = exports.AAVE_V4_ETHENA_ECOSYSTEM_SPOKE = exports.AAVE_V4_ETHENA_CORRELATED_SPOKE = exports.AAVE_V4_BLUECHIP_SPOKE = exports.getAaveV4HubByAddress = exports.getAaveV4HubTypeInfo = exports.AaveV4Hubs = exports.AAVE_V4_PAXOS_HUB = exports.AAVE_V4_PRIME_HUB = exports.AAVE_V4_PLUS_HUB = exports.AAVE_V4_CORE_HUB = void 0;
|
|
4
4
|
const types_1 = require("../../types");
|
|
5
5
|
// HUBS
|
|
6
6
|
const AAVE_V4_CORE_HUB = (networkId) => ({
|
|
@@ -24,10 +24,18 @@ const AAVE_V4_PRIME_HUB = (networkId) => ({
|
|
|
24
24
|
address: '0x943827DCA022D0F354a8a8c332dA1e5Eb9f9F931',
|
|
25
25
|
});
|
|
26
26
|
exports.AAVE_V4_PRIME_HUB = AAVE_V4_PRIME_HUB;
|
|
27
|
+
const AAVE_V4_PAXOS_HUB = (networkId) => ({
|
|
28
|
+
chainIds: [types_1.NetworkNumber.Eth],
|
|
29
|
+
label: 'Paxos Hub',
|
|
30
|
+
value: types_1.AaveV4HubsType.AaveV4PaxosHub,
|
|
31
|
+
address: '0x62d63197660c080236193CA60b70E49A08E90368',
|
|
32
|
+
});
|
|
33
|
+
exports.AAVE_V4_PAXOS_HUB = AAVE_V4_PAXOS_HUB;
|
|
27
34
|
const AaveV4Hubs = (networkId) => ({
|
|
28
35
|
[types_1.AaveV4HubsType.AaveV4CoreHub]: (0, exports.AAVE_V4_CORE_HUB)(networkId),
|
|
29
36
|
[types_1.AaveV4HubsType.AaveV4PlusHub]: (0, exports.AAVE_V4_PLUS_HUB)(networkId),
|
|
30
37
|
[types_1.AaveV4HubsType.AaveV4PrimeHub]: (0, exports.AAVE_V4_PRIME_HUB)(networkId),
|
|
38
|
+
[types_1.AaveV4HubsType.AaveV4PaxosHub]: (0, exports.AAVE_V4_PAXOS_HUB)(networkId),
|
|
31
39
|
});
|
|
32
40
|
exports.AaveV4Hubs = AaveV4Hubs;
|
|
33
41
|
const getAaveV4HubTypeInfo = (type, network) => (Object.assign({}, (0, exports.AaveV4Hubs)(network !== null && network !== void 0 ? network : types_1.NetworkNumber.Eth))[type]);
|
|
@@ -165,6 +173,18 @@ const AAVE_V4_MAIN_SPOKE = (networkId) => ({
|
|
|
165
173
|
],
|
|
166
174
|
});
|
|
167
175
|
exports.AAVE_V4_MAIN_SPOKE = AAVE_V4_MAIN_SPOKE;
|
|
176
|
+
const AAVE_V4_USDG_PENDLE_SPOKE = (networkId) => ({
|
|
177
|
+
chainIds: [types_1.NetworkNumber.Eth],
|
|
178
|
+
label: 'USDG Pendle',
|
|
179
|
+
value: types_1.AaveV4SpokesType.AaveV4USDGPendleSpoke,
|
|
180
|
+
url: 'usdg-pendle',
|
|
181
|
+
address: '0x956d8e0A89cfa3744428C4641b5a53B56167a7f9',
|
|
182
|
+
hubs: [
|
|
183
|
+
(0, exports.AAVE_V4_PAXOS_HUB)(types_1.NetworkNumber.Eth).address,
|
|
184
|
+
(0, exports.AAVE_V4_CORE_HUB)(types_1.NetworkNumber.Eth).address,
|
|
185
|
+
],
|
|
186
|
+
});
|
|
187
|
+
exports.AAVE_V4_USDG_PENDLE_SPOKE = AAVE_V4_USDG_PENDLE_SPOKE;
|
|
168
188
|
const AaveV4Spokes = (networkId) => ({
|
|
169
189
|
[types_1.AaveV4SpokesType.AaveV4BluechipSpoke]: (0, exports.AAVE_V4_BLUECHIP_SPOKE)(networkId),
|
|
170
190
|
[types_1.AaveV4SpokesType.AaveV4EthenaCorrelatedSpoke]: (0, exports.AAVE_V4_ETHENA_CORRELATED_SPOKE)(networkId),
|
|
@@ -176,6 +196,7 @@ const AaveV4Spokes = (networkId) => ({
|
|
|
176
196
|
[types_1.AaveV4SpokesType.AaveV4LidoSpoke]: (0, exports.AAVE_V4_LIDO_SPOKE)(networkId),
|
|
177
197
|
[types_1.AaveV4SpokesType.AaveV4LombardBtcSpoke]: (0, exports.AAVE_V4_LOMBARD_BTC_SPOKE)(networkId),
|
|
178
198
|
[types_1.AaveV4SpokesType.AaveV4MainSpoke]: (0, exports.AAVE_V4_MAIN_SPOKE)(networkId),
|
|
199
|
+
[types_1.AaveV4SpokesType.AaveV4USDGPendleSpoke]: (0, exports.AAVE_V4_USDG_PENDLE_SPOKE)(networkId),
|
|
179
200
|
});
|
|
180
201
|
exports.AaveV4Spokes = AaveV4Spokes;
|
|
181
202
|
const getAaveV4SpokeTypeInfo = (type, network) => (Object.assign({}, (0, exports.AaveV4Spokes)(network !== null && network !== void 0 ? network : types_1.NetworkNumber.Eth))[type]);
|
|
@@ -33,7 +33,7 @@ exports.STABLE_ASSETS = [
|
|
|
33
33
|
'USDe', 'sUSDe', 'srUSDe', 'USDS', 'sUSDS', 'USR', 'EURC', 'BOLD', 'BOLD Legacy', 'RLUSD', 'PT sUSDe July', 'PT eUSDe May',
|
|
34
34
|
'USDtb', 'eUSDe', 'PT USDe July', 'PT eUSDe Aug', 'PT sUSDe Sep', 'PT USDe Sep', 'PT sUSDe Nov', 'PT USDe Nov', 'PT sUSDe Jan', 'PT USDe Jan',
|
|
35
35
|
'PT sUSDe Feb', 'PT USDe Feb', 'PT sUSDe Apr', 'PT USDe Apr', 'PT sUSDe May', 'PT USDe May', 'PT srUSDe Apr', 'frxUSD', 'PT sUSDe June',
|
|
36
|
-
'PT USDe June', 'PT srUSDe Jun', 'PT srUSDe Oct', 'PT USDG May', 'PT sUSDS Nov', 'PT sUSDe Oct',
|
|
36
|
+
'PT USDe June', 'PT srUSDe Jun', 'PT srUSDe Oct', 'PT USDG May', 'PT sUSDS Nov', 'PT sUSDe Oct', 'PT USDG Sep',
|
|
37
37
|
];
|
|
38
38
|
const isLeveragedPos = (usedAssets, dustLimit = 5) => {
|
|
39
39
|
let borrowUnstable = 0;
|
package/cjs/staking/staking.js
CHANGED
|
@@ -73,7 +73,7 @@ exports.STAKING_ASSETS = [
|
|
|
73
73
|
'ezETH', 'ETHx', 'rsETH', 'pufETH', 'wrsETH', 'wsuperOETHb', 'sUSDS', 'tETH', 'PT sUSDe Sep', 'PT USDe Sep',
|
|
74
74
|
'PT sUSDe Nov', 'PT USDe Nov', 'PT USDe Jan', 'PT sUSDe Jan', 'wrsETH', 'wstETH', 'syrupUSDT', 'syrupUSDC', 'wstUSR',
|
|
75
75
|
'PT sUSDe Feb', 'PT USDe Feb', 'PT sUSDe Apr', 'PT USDe Apr', 'PT sUSDe May', 'PT USDe May', 'PT srUSDe Apr', 'GHO',
|
|
76
|
-
'PT sUSDe June', 'PT USDe June', 'PT srUSDe Jun', 'PT srUSDe Oct', 'PT USDG May', 'PT sUSDS Nov', 'PT sUSDe Oct',
|
|
76
|
+
'PT sUSDe June', 'PT USDe June', 'PT srUSDe Jun', 'PT srUSDe Oct', 'PT USDG May', 'PT sUSDS Nov', 'PT sUSDe Oct', 'PT USDG Sep',
|
|
77
77
|
];
|
|
78
78
|
exports.getStakingApy = (0, memoizee_1.default)((asset_1, ...args_1) => __awaiter(void 0, [asset_1, ...args_1], void 0, function* (asset, network = common_1.NetworkNumber.Eth) {
|
|
79
79
|
try {
|
|
@@ -159,6 +159,8 @@ exports.getStakingApy = (0, memoizee_1.default)((asset_1, ...args_1) => __awaite
|
|
|
159
159
|
return yield getApyFromDfsApi('PT USDe June', network);
|
|
160
160
|
if (asset === 'PT USDG May')
|
|
161
161
|
return yield getApyFromDfsApi('PT USDG May', network);
|
|
162
|
+
if (asset === 'PT USDG Sep')
|
|
163
|
+
return yield getApyFromDfsApi('PT USDG Sep', network);
|
|
162
164
|
if (asset === 'PT sUSDS Nov')
|
|
163
165
|
return yield getApyFromDfsApi('PT sUSDS Nov', network);
|
|
164
166
|
if (asset === 'GHO')
|
package/cjs/types/aaveV4.d.ts
CHANGED
|
@@ -2,7 +2,8 @@ import { EthAddress, IncentiveData, LeverageType, NetworkNumber } from './common
|
|
|
2
2
|
export declare enum AaveV4HubsType {
|
|
3
3
|
AaveV4CoreHub = "aave_v4_core_hub",
|
|
4
4
|
AaveV4PlusHub = "aave_v4_plus_hub",
|
|
5
|
-
AaveV4PrimeHub = "aave_v4_prime_hub"
|
|
5
|
+
AaveV4PrimeHub = "aave_v4_prime_hub",
|
|
6
|
+
AaveV4PaxosHub = "aave_v4_paxos_hub"
|
|
6
7
|
}
|
|
7
8
|
export declare enum AaveV4SpokesType {
|
|
8
9
|
AaveV4BluechipSpoke = "aave_v4_bluechip_spoke",
|
|
@@ -14,7 +15,8 @@ export declare enum AaveV4SpokesType {
|
|
|
14
15
|
AaveV4KelpSpoke = "aave_v4_kelp_spoke",
|
|
15
16
|
AaveV4LidoSpoke = "aave_v4_lido_spoke",
|
|
16
17
|
AaveV4LombardBtcSpoke = "aave_v4_lombard_btc_spoke",
|
|
17
|
-
AaveV4MainSpoke = "aave_v4_main_spoke"
|
|
18
|
+
AaveV4MainSpoke = "aave_v4_main_spoke",
|
|
19
|
+
AaveV4USDGPendleSpoke = "aave_v4_usdg_pendle_spoke"
|
|
18
20
|
}
|
|
19
21
|
export interface AaveV4HubInfo {
|
|
20
22
|
chainIds: NetworkNumber[];
|
package/cjs/types/aaveV4.js
CHANGED
|
@@ -6,6 +6,7 @@ var AaveV4HubsType;
|
|
|
6
6
|
AaveV4HubsType["AaveV4CoreHub"] = "aave_v4_core_hub";
|
|
7
7
|
AaveV4HubsType["AaveV4PlusHub"] = "aave_v4_plus_hub";
|
|
8
8
|
AaveV4HubsType["AaveV4PrimeHub"] = "aave_v4_prime_hub";
|
|
9
|
+
AaveV4HubsType["AaveV4PaxosHub"] = "aave_v4_paxos_hub";
|
|
9
10
|
})(AaveV4HubsType || (exports.AaveV4HubsType = AaveV4HubsType = {}));
|
|
10
11
|
var AaveV4SpokesType;
|
|
11
12
|
(function (AaveV4SpokesType) {
|
|
@@ -19,4 +20,5 @@ var AaveV4SpokesType;
|
|
|
19
20
|
AaveV4SpokesType["AaveV4LidoSpoke"] = "aave_v4_lido_spoke";
|
|
20
21
|
AaveV4SpokesType["AaveV4LombardBtcSpoke"] = "aave_v4_lombard_btc_spoke";
|
|
21
22
|
AaveV4SpokesType["AaveV4MainSpoke"] = "aave_v4_main_spoke";
|
|
23
|
+
AaveV4SpokesType["AaveV4USDGPendleSpoke"] = "aave_v4_usdg_pendle_spoke";
|
|
22
24
|
})(AaveV4SpokesType || (exports.AaveV4SpokesType = AaveV4SpokesType = {}));
|
package/esm/aaveV3/merkl.d.ts
CHANGED
package/esm/aaveV3/merkl.js
CHANGED
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { aprToApy } from '../moneymarket';
|
|
11
|
-
import {
|
|
11
|
+
import { LONGER_TIMEOUT, wethToEth } from '../services/utils';
|
|
12
12
|
import { OpportunityAction, OpportunityStatus, } from '../types';
|
|
13
13
|
export const getAaveUnderlyingSymbol = (_symbol = '') => {
|
|
14
14
|
let symbol = _symbol
|
|
@@ -35,8 +35,8 @@ export const formatAaveAsset = (_symbol) => {
|
|
|
35
35
|
};
|
|
36
36
|
export const getMerkleCampaigns = (chainId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
37
37
|
try {
|
|
38
|
-
const res = yield fetch('https://
|
|
39
|
-
signal: AbortSignal.timeout(
|
|
38
|
+
const res = yield fetch('https://fe.defisaver.com/api/merkl/opportunities?mainProtocolId=aave', {
|
|
39
|
+
signal: AbortSignal.timeout(LONGER_TIMEOUT),
|
|
40
40
|
});
|
|
41
41
|
if (!res.ok)
|
|
42
42
|
throw new Error('Failed to fetch Merkle campaigns');
|
package/esm/aaveV4/lend.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export interface AaveV4TokenizationSpokeData {
|
|
|
20
20
|
}
|
|
21
21
|
export declare const AAVE_V4_TOKENIZED_SPOKES: Record<string, EthAddress>;
|
|
22
22
|
export declare const AAVE_V4_TOKENIZED_SPOKE_ADDRESSES: Partial<Record<NetworkNumber, EthAddress[]>>;
|
|
23
|
-
export type AaveV4TokenizedHubKey = 'CORE' | 'PLUS' | 'PRIME';
|
|
23
|
+
export type AaveV4TokenizedHubKey = 'CORE' | 'PLUS' | 'PRIME' | 'PAXOS';
|
|
24
24
|
export declare const aaveV4GetTokenizedHubKey: (hubNameOrKey?: string | null) => AaveV4TokenizedHubKey | null;
|
|
25
25
|
export declare const aaveV4GetTokenizedVaultKey: (symbol: string, hubNameOrKey?: string | null) => string | null;
|
|
26
26
|
export declare const aaveV4GetTokenizedVaultAddress: (network: NetworkNumber, symbol: string, hubNameOrKey?: string | null) => EthAddress | undefined;
|
package/esm/aaveV4/lend.js
CHANGED
|
@@ -30,6 +30,8 @@ export const AAVE_V4_TOKENIZED_SPOKES = {
|
|
|
30
30
|
GHO_PRIME: '0x900fD46d565d1ac8995928c0179052ec02a6D0E1',
|
|
31
31
|
USDC_PRIME: '0x486415fb1F8b062c89ED548f871cf64304AACb31',
|
|
32
32
|
USDT_PRIME: '0x46c588DD8453aC259c1f6a54b4C9A93C2aC3762D',
|
|
33
|
+
// USDC_PAXOS: '0x0',
|
|
34
|
+
// USDT_PAXOS: '0x0',
|
|
33
35
|
};
|
|
34
36
|
export const AAVE_V4_TOKENIZED_SPOKE_ADDRESSES = {
|
|
35
37
|
[NetworkNumber.Eth]: Object.values(AAVE_V4_TOKENIZED_SPOKES),
|
|
@@ -44,12 +46,16 @@ export const aaveV4GetTokenizedHubKey = (hubNameOrKey) => {
|
|
|
44
46
|
return 'PLUS';
|
|
45
47
|
if (normalized === 'PRIME' || normalized === 'PRIME HUB')
|
|
46
48
|
return 'PRIME';
|
|
49
|
+
if (normalized === 'PAXOS' || normalized === 'PAXOS HUB')
|
|
50
|
+
return 'PAXOS';
|
|
47
51
|
if (normalized.includes('CORE'))
|
|
48
52
|
return 'CORE';
|
|
49
53
|
if (normalized.includes('PLUS'))
|
|
50
54
|
return 'PLUS';
|
|
51
55
|
if (normalized.includes('PRIME'))
|
|
52
56
|
return 'PRIME';
|
|
57
|
+
if (normalized.includes('PAXOS'))
|
|
58
|
+
return 'PAXOS';
|
|
53
59
|
return null;
|
|
54
60
|
};
|
|
55
61
|
export const aaveV4GetTokenizedVaultKey = (symbol, hubNameOrKey) => {
|
package/esm/aaveV4/merkl.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { AaveV4MerklRewardMap, AaveV4ReserveAssetData } from '../types';
|
|
2
|
-
import { NetworkNumber } from '../types/common';
|
|
1
|
+
import { AaveV4MerklRewardMap, AaveV4ReserveAssetData, NetworkNumber } from '../types';
|
|
3
2
|
export declare const getAaveV4MerkleCampaigns: (chainId: NetworkNumber) => Promise<AaveV4MerklRewardMap>;
|
|
4
3
|
/**
|
|
5
4
|
* Returns a copy of the asset with scope-specific incentive arrays pre-combined with the asset's
|
package/esm/aaveV4/merkl.js
CHANGED
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { aprToApy } from '../moneymarket';
|
|
11
|
-
import {
|
|
11
|
+
import { LONGER_TIMEOUT } from '../services/utils';
|
|
12
12
|
import { IncentiveKind, OpportunityAction, OpportunityStatus, } from '../types';
|
|
13
13
|
/**
|
|
14
14
|
* Merkl tags Aave V4 reward campaigns by scope via the `type` field:
|
|
@@ -31,8 +31,8 @@ const buildIncentive = (opportunity) => {
|
|
|
31
31
|
export const getAaveV4MerkleCampaigns = (chainId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
32
|
const result = { hub: {}, spoke: {} };
|
|
33
33
|
try {
|
|
34
|
-
const res = yield fetch('https://
|
|
35
|
-
signal: AbortSignal.timeout(
|
|
34
|
+
const res = yield fetch('https://fe.defisaver.com/api/merkl/opportunities?mainProtocolId=aave', {
|
|
35
|
+
signal: AbortSignal.timeout(LONGER_TIMEOUT),
|
|
36
36
|
});
|
|
37
37
|
if (!res.ok)
|
|
38
38
|
throw new Error('Failed to fetch Aave V4 Merkle campaigns');
|
package/esm/claiming/aaveV3.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Client } from 'viem';
|
|
2
|
-
import { EthAddress, NetworkNumber } from '../types
|
|
2
|
+
import { EthAddress, NetworkNumber } from '../types';
|
|
3
3
|
import { ClaimableToken } from '../types/claiming';
|
|
4
4
|
export declare function getUnclaimedRewardsForAllMarkets(provider: Client, network: NetworkNumber, walletAddress: EthAddress, marketAddress: EthAddress): Promise<ClaimableToken[]>;
|
|
5
5
|
export declare function getMeritUnclaimedRewards(account: EthAddress, network: NetworkNumber): Promise<ClaimableToken[]>;
|
package/esm/claiming/aaveV3.js
CHANGED
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import Dec from 'decimal.js';
|
|
11
11
|
import { ClaimType } from '../types/claiming';
|
|
12
12
|
import { AaveIncentiveDataProviderV3ContractViem, AaveRewardsControllerViem, } from '../contracts';
|
|
13
|
-
import { compareAddresses, getEthAmountForDecimals } from '../services/utils';
|
|
13
|
+
import { compareAddresses, getEthAmountForDecimals, LONGER_TIMEOUT } from '../services/utils';
|
|
14
14
|
import { getAaveUnderlyingSymbol } from '../helpers/aaveHelpers';
|
|
15
15
|
const mapAaveRewardsToClaimableTokens = (aaveRewards, marketAddress, walletAddress) => aaveRewards.map(reward => ({
|
|
16
16
|
symbol: reward.symbol,
|
|
@@ -92,7 +92,7 @@ export function getMeritUnclaimedRewards(account, network) {
|
|
|
92
92
|
return __awaiter(this, void 0, void 0, function* () {
|
|
93
93
|
let data;
|
|
94
94
|
try {
|
|
95
|
-
const res = yield fetch(`https://
|
|
95
|
+
const res = yield fetch(`https://fe.defisaver.com/api/merkl/get-user-rewards/${account}?chainId=${network}`, { signal: AbortSignal.timeout(LONGER_TIMEOUT) });
|
|
96
96
|
data = yield res.json();
|
|
97
97
|
}
|
|
98
98
|
catch (error) {
|
|
@@ -100,6 +100,10 @@ export function getMeritUnclaimedRewards(account, network) {
|
|
|
100
100
|
data = [];
|
|
101
101
|
}
|
|
102
102
|
const claimableTokens = [];
|
|
103
|
+
// Merkl (or our proxy, on a non-2xx) can return a non-array error body; `fetch` doesn't throw on
|
|
104
|
+
// HTTP errors, so guard before iterating. Mirrors the app-side getMeritUnclaimedRewards.
|
|
105
|
+
if (!Array.isArray(data))
|
|
106
|
+
return claimableTokens;
|
|
103
107
|
data.forEach((item) => {
|
|
104
108
|
item.rewards.forEach(reward => {
|
|
105
109
|
const { token, amount, claimed, proofs, } = reward;
|
|
@@ -2,10 +2,12 @@ import { AaveV4HubInfo, AaveV4HubsType, AaveV4SpokeInfo, AaveV4SpokesType, Netwo
|
|
|
2
2
|
export declare const AAVE_V4_CORE_HUB: (networkId: NetworkNumber) => AaveV4HubInfo;
|
|
3
3
|
export declare const AAVE_V4_PLUS_HUB: (networkId: NetworkNumber) => AaveV4HubInfo;
|
|
4
4
|
export declare const AAVE_V4_PRIME_HUB: (networkId: NetworkNumber) => AaveV4HubInfo;
|
|
5
|
+
export declare const AAVE_V4_PAXOS_HUB: (networkId: NetworkNumber) => AaveV4HubInfo;
|
|
5
6
|
export declare const AaveV4Hubs: (networkId: NetworkNumber) => {
|
|
6
7
|
readonly aave_v4_core_hub: AaveV4HubInfo;
|
|
7
8
|
readonly aave_v4_plus_hub: AaveV4HubInfo;
|
|
8
9
|
readonly aave_v4_prime_hub: AaveV4HubInfo;
|
|
10
|
+
readonly aave_v4_paxos_hub: AaveV4HubInfo;
|
|
9
11
|
};
|
|
10
12
|
export declare const getAaveV4HubTypeInfo: (type: AaveV4HubsType, network?: NetworkNumber) => AaveV4HubInfo;
|
|
11
13
|
export declare const getAaveV4HubByAddress: (networkId: NetworkNumber, address: string) => AaveV4HubInfo | undefined;
|
|
@@ -19,6 +21,7 @@ export declare const AAVE_V4_KELP_SPOKE: (networkId: NetworkNumber) => AaveV4Spo
|
|
|
19
21
|
export declare const AAVE_V4_LIDO_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
20
22
|
export declare const AAVE_V4_LOMBARD_BTC_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
21
23
|
export declare const AAVE_V4_MAIN_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
24
|
+
export declare const AAVE_V4_USDG_PENDLE_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
22
25
|
export declare const AaveV4Spokes: (networkId: NetworkNumber) => {
|
|
23
26
|
readonly aave_v4_bluechip_spoke: AaveV4SpokeInfo;
|
|
24
27
|
readonly aave_v4_ethena_correlated_spoke: AaveV4SpokeInfo;
|
|
@@ -30,6 +33,7 @@ export declare const AaveV4Spokes: (networkId: NetworkNumber) => {
|
|
|
30
33
|
readonly aave_v4_lido_spoke: AaveV4SpokeInfo;
|
|
31
34
|
readonly aave_v4_lombard_btc_spoke: AaveV4SpokeInfo;
|
|
32
35
|
readonly aave_v4_main_spoke: AaveV4SpokeInfo;
|
|
36
|
+
readonly aave_v4_usdg_pendle_spoke: AaveV4SpokeInfo;
|
|
33
37
|
};
|
|
34
38
|
export declare const getAaveV4SpokeTypeInfo: (type: AaveV4SpokesType, network?: NetworkNumber) => AaveV4SpokeInfo;
|
|
35
39
|
export declare const findAaveV4SpokeByAddress: (networkId: NetworkNumber, address: string) => AaveV4SpokeInfo | undefined;
|
|
@@ -18,10 +18,17 @@ export const AAVE_V4_PRIME_HUB = (networkId) => ({
|
|
|
18
18
|
value: AaveV4HubsType.AaveV4PrimeHub,
|
|
19
19
|
address: '0x943827DCA022D0F354a8a8c332dA1e5Eb9f9F931',
|
|
20
20
|
});
|
|
21
|
+
export const AAVE_V4_PAXOS_HUB = (networkId) => ({
|
|
22
|
+
chainIds: [NetworkNumber.Eth],
|
|
23
|
+
label: 'Paxos Hub',
|
|
24
|
+
value: AaveV4HubsType.AaveV4PaxosHub,
|
|
25
|
+
address: '0x62d63197660c080236193CA60b70E49A08E90368',
|
|
26
|
+
});
|
|
21
27
|
export const AaveV4Hubs = (networkId) => ({
|
|
22
28
|
[AaveV4HubsType.AaveV4CoreHub]: AAVE_V4_CORE_HUB(networkId),
|
|
23
29
|
[AaveV4HubsType.AaveV4PlusHub]: AAVE_V4_PLUS_HUB(networkId),
|
|
24
30
|
[AaveV4HubsType.AaveV4PrimeHub]: AAVE_V4_PRIME_HUB(networkId),
|
|
31
|
+
[AaveV4HubsType.AaveV4PaxosHub]: AAVE_V4_PAXOS_HUB(networkId),
|
|
25
32
|
});
|
|
26
33
|
export const getAaveV4HubTypeInfo = (type, network) => (Object.assign({}, AaveV4Hubs(network !== null && network !== void 0 ? network : NetworkNumber.Eth))[type]);
|
|
27
34
|
export const getAaveV4HubByAddress = (networkId, address) => Object.values(AaveV4Hubs(networkId)).find(hub => hub.address.toLowerCase() === address.toLowerCase());
|
|
@@ -146,6 +153,17 @@ export const AAVE_V4_MAIN_SPOKE = (networkId) => ({
|
|
|
146
153
|
AAVE_V4_PRIME_HUB(NetworkNumber.Eth).address,
|
|
147
154
|
],
|
|
148
155
|
});
|
|
156
|
+
export const AAVE_V4_USDG_PENDLE_SPOKE = (networkId) => ({
|
|
157
|
+
chainIds: [NetworkNumber.Eth],
|
|
158
|
+
label: 'USDG Pendle',
|
|
159
|
+
value: AaveV4SpokesType.AaveV4USDGPendleSpoke,
|
|
160
|
+
url: 'usdg-pendle',
|
|
161
|
+
address: '0x956d8e0A89cfa3744428C4641b5a53B56167a7f9',
|
|
162
|
+
hubs: [
|
|
163
|
+
AAVE_V4_PAXOS_HUB(NetworkNumber.Eth).address,
|
|
164
|
+
AAVE_V4_CORE_HUB(NetworkNumber.Eth).address,
|
|
165
|
+
],
|
|
166
|
+
});
|
|
149
167
|
export const AaveV4Spokes = (networkId) => ({
|
|
150
168
|
[AaveV4SpokesType.AaveV4BluechipSpoke]: AAVE_V4_BLUECHIP_SPOKE(networkId),
|
|
151
169
|
[AaveV4SpokesType.AaveV4EthenaCorrelatedSpoke]: AAVE_V4_ETHENA_CORRELATED_SPOKE(networkId),
|
|
@@ -157,6 +175,7 @@ export const AaveV4Spokes = (networkId) => ({
|
|
|
157
175
|
[AaveV4SpokesType.AaveV4LidoSpoke]: AAVE_V4_LIDO_SPOKE(networkId),
|
|
158
176
|
[AaveV4SpokesType.AaveV4LombardBtcSpoke]: AAVE_V4_LOMBARD_BTC_SPOKE(networkId),
|
|
159
177
|
[AaveV4SpokesType.AaveV4MainSpoke]: AAVE_V4_MAIN_SPOKE(networkId),
|
|
178
|
+
[AaveV4SpokesType.AaveV4USDGPendleSpoke]: AAVE_V4_USDG_PENDLE_SPOKE(networkId),
|
|
160
179
|
});
|
|
161
180
|
export const getAaveV4SpokeTypeInfo = (type, network) => (Object.assign({}, AaveV4Spokes(network !== null && network !== void 0 ? network : NetworkNumber.Eth))[type]);
|
|
162
181
|
export const findAaveV4SpokeByAddress = (networkId, address) => Object.values(AaveV4Spokes(networkId)).find(spoke => spoke.address.toLowerCase() === address.toLowerCase());
|
|
@@ -22,7 +22,7 @@ export const STABLE_ASSETS = [
|
|
|
22
22
|
'USDe', 'sUSDe', 'srUSDe', 'USDS', 'sUSDS', 'USR', 'EURC', 'BOLD', 'BOLD Legacy', 'RLUSD', 'PT sUSDe July', 'PT eUSDe May',
|
|
23
23
|
'USDtb', 'eUSDe', 'PT USDe July', 'PT eUSDe Aug', 'PT sUSDe Sep', 'PT USDe Sep', 'PT sUSDe Nov', 'PT USDe Nov', 'PT sUSDe Jan', 'PT USDe Jan',
|
|
24
24
|
'PT sUSDe Feb', 'PT USDe Feb', 'PT sUSDe Apr', 'PT USDe Apr', 'PT sUSDe May', 'PT USDe May', 'PT srUSDe Apr', 'frxUSD', 'PT sUSDe June',
|
|
25
|
-
'PT USDe June', 'PT srUSDe Jun', 'PT srUSDe Oct', 'PT USDG May', 'PT sUSDS Nov', 'PT sUSDe Oct',
|
|
25
|
+
'PT USDe June', 'PT srUSDe Jun', 'PT srUSDe Oct', 'PT USDG May', 'PT sUSDS Nov', 'PT sUSDe Oct', 'PT USDG Sep',
|
|
26
26
|
];
|
|
27
27
|
export const isLeveragedPos = (usedAssets, dustLimit = 5) => {
|
|
28
28
|
let borrowUnstable = 0;
|
package/esm/staking/staking.js
CHANGED
|
@@ -67,7 +67,7 @@ export const STAKING_ASSETS = [
|
|
|
67
67
|
'ezETH', 'ETHx', 'rsETH', 'pufETH', 'wrsETH', 'wsuperOETHb', 'sUSDS', 'tETH', 'PT sUSDe Sep', 'PT USDe Sep',
|
|
68
68
|
'PT sUSDe Nov', 'PT USDe Nov', 'PT USDe Jan', 'PT sUSDe Jan', 'wrsETH', 'wstETH', 'syrupUSDT', 'syrupUSDC', 'wstUSR',
|
|
69
69
|
'PT sUSDe Feb', 'PT USDe Feb', 'PT sUSDe Apr', 'PT USDe Apr', 'PT sUSDe May', 'PT USDe May', 'PT srUSDe Apr', 'GHO',
|
|
70
|
-
'PT sUSDe June', 'PT USDe June', 'PT srUSDe Jun', 'PT srUSDe Oct', 'PT USDG May', 'PT sUSDS Nov', 'PT sUSDe Oct',
|
|
70
|
+
'PT sUSDe June', 'PT USDe June', 'PT srUSDe Jun', 'PT srUSDe Oct', 'PT USDG May', 'PT sUSDS Nov', 'PT sUSDe Oct', 'PT USDG Sep',
|
|
71
71
|
];
|
|
72
72
|
export const getStakingApy = memoize((asset_1, ...args_1) => __awaiter(void 0, [asset_1, ...args_1], void 0, function* (asset, network = NetworkNumber.Eth) {
|
|
73
73
|
try {
|
|
@@ -153,6 +153,8 @@ export const getStakingApy = memoize((asset_1, ...args_1) => __awaiter(void 0, [
|
|
|
153
153
|
return yield getApyFromDfsApi('PT USDe June', network);
|
|
154
154
|
if (asset === 'PT USDG May')
|
|
155
155
|
return yield getApyFromDfsApi('PT USDG May', network);
|
|
156
|
+
if (asset === 'PT USDG Sep')
|
|
157
|
+
return yield getApyFromDfsApi('PT USDG Sep', network);
|
|
156
158
|
if (asset === 'PT sUSDS Nov')
|
|
157
159
|
return yield getApyFromDfsApi('PT sUSDS Nov', network);
|
|
158
160
|
if (asset === 'GHO')
|
package/esm/types/aaveV4.d.ts
CHANGED
|
@@ -2,7 +2,8 @@ import { EthAddress, IncentiveData, LeverageType, NetworkNumber } from './common
|
|
|
2
2
|
export declare enum AaveV4HubsType {
|
|
3
3
|
AaveV4CoreHub = "aave_v4_core_hub",
|
|
4
4
|
AaveV4PlusHub = "aave_v4_plus_hub",
|
|
5
|
-
AaveV4PrimeHub = "aave_v4_prime_hub"
|
|
5
|
+
AaveV4PrimeHub = "aave_v4_prime_hub",
|
|
6
|
+
AaveV4PaxosHub = "aave_v4_paxos_hub"
|
|
6
7
|
}
|
|
7
8
|
export declare enum AaveV4SpokesType {
|
|
8
9
|
AaveV4BluechipSpoke = "aave_v4_bluechip_spoke",
|
|
@@ -14,7 +15,8 @@ export declare enum AaveV4SpokesType {
|
|
|
14
15
|
AaveV4KelpSpoke = "aave_v4_kelp_spoke",
|
|
15
16
|
AaveV4LidoSpoke = "aave_v4_lido_spoke",
|
|
16
17
|
AaveV4LombardBtcSpoke = "aave_v4_lombard_btc_spoke",
|
|
17
|
-
AaveV4MainSpoke = "aave_v4_main_spoke"
|
|
18
|
+
AaveV4MainSpoke = "aave_v4_main_spoke",
|
|
19
|
+
AaveV4USDGPendleSpoke = "aave_v4_usdg_pendle_spoke"
|
|
18
20
|
}
|
|
19
21
|
export interface AaveV4HubInfo {
|
|
20
22
|
chainIds: NetworkNumber[];
|
package/esm/types/aaveV4.js
CHANGED
|
@@ -3,6 +3,7 @@ export var AaveV4HubsType;
|
|
|
3
3
|
AaveV4HubsType["AaveV4CoreHub"] = "aave_v4_core_hub";
|
|
4
4
|
AaveV4HubsType["AaveV4PlusHub"] = "aave_v4_plus_hub";
|
|
5
5
|
AaveV4HubsType["AaveV4PrimeHub"] = "aave_v4_prime_hub";
|
|
6
|
+
AaveV4HubsType["AaveV4PaxosHub"] = "aave_v4_paxos_hub";
|
|
6
7
|
})(AaveV4HubsType || (AaveV4HubsType = {}));
|
|
7
8
|
export var AaveV4SpokesType;
|
|
8
9
|
(function (AaveV4SpokesType) {
|
|
@@ -16,4 +17,5 @@ export var AaveV4SpokesType;
|
|
|
16
17
|
AaveV4SpokesType["AaveV4LidoSpoke"] = "aave_v4_lido_spoke";
|
|
17
18
|
AaveV4SpokesType["AaveV4LombardBtcSpoke"] = "aave_v4_lombard_btc_spoke";
|
|
18
19
|
AaveV4SpokesType["AaveV4MainSpoke"] = "aave_v4_main_spoke";
|
|
20
|
+
AaveV4SpokesType["AaveV4USDGPendleSpoke"] = "aave_v4_usdg_pendle_spoke";
|
|
19
21
|
})(AaveV4SpokesType || (AaveV4SpokesType = {}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defisaver/positions-sdk",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.116",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"author": "",
|
|
22
22
|
"license": "ISC",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@defisaver/tokens": "1.7.
|
|
24
|
+
"@defisaver/tokens": "^1.7.39",
|
|
25
25
|
"@types/lodash": "^4.17.15",
|
|
26
26
|
"@types/memoizee": "^0.4.12",
|
|
27
27
|
"decimal.js": "^10.6.0",
|
package/src/aaveV3/merkl.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { aprToApy } from '../moneymarket';
|
|
2
|
-
import {
|
|
2
|
+
import { LONGER_TIMEOUT, wethToEth } from '../services/utils';
|
|
3
3
|
import {
|
|
4
4
|
MerkleRewardMap, MerklOpportunity, OpportunityAction, OpportunityStatus,
|
|
5
|
+
EthAddress, NetworkNumber,
|
|
5
6
|
} from '../types';
|
|
6
|
-
import { EthAddress, NetworkNumber } from '../types/common';
|
|
7
7
|
|
|
8
8
|
export const getAaveUnderlyingSymbol = (_symbol = '') => {
|
|
9
9
|
let symbol = _symbol
|
|
@@ -31,8 +31,8 @@ export const formatAaveAsset = (_symbol: string) => {
|
|
|
31
31
|
|
|
32
32
|
export const getMerkleCampaigns = async (chainId: NetworkNumber): Promise<MerkleRewardMap> => {
|
|
33
33
|
try {
|
|
34
|
-
const res = await fetch('https://
|
|
35
|
-
signal: AbortSignal.timeout(
|
|
34
|
+
const res = await fetch('https://fe.defisaver.com/api/merkl/opportunities?mainProtocolId=aave', {
|
|
35
|
+
signal: AbortSignal.timeout(LONGER_TIMEOUT),
|
|
36
36
|
});
|
|
37
37
|
if (!res.ok) throw new Error('Failed to fetch Merkle campaigns');
|
|
38
38
|
const opportunities = await res.json() as MerklOpportunity[];
|
package/src/aaveV4/lend.ts
CHANGED
|
@@ -48,13 +48,16 @@ export const AAVE_V4_TOKENIZED_SPOKES: Record<string, EthAddress> = {
|
|
|
48
48
|
GHO_PRIME: '0x900fD46d565d1ac8995928c0179052ec02a6D0E1',
|
|
49
49
|
USDC_PRIME: '0x486415fb1F8b062c89ED548f871cf64304AACb31',
|
|
50
50
|
USDT_PRIME: '0x46c588DD8453aC259c1f6a54b4C9A93C2aC3762D',
|
|
51
|
+
|
|
52
|
+
// USDC_PAXOS: '0x0',
|
|
53
|
+
// USDT_PAXOS: '0x0',
|
|
51
54
|
};
|
|
52
55
|
|
|
53
56
|
export const AAVE_V4_TOKENIZED_SPOKE_ADDRESSES: Partial<Record<NetworkNumber, EthAddress[]>> = {
|
|
54
57
|
[NetworkNumber.Eth]: Object.values(AAVE_V4_TOKENIZED_SPOKES),
|
|
55
58
|
};
|
|
56
59
|
|
|
57
|
-
export type AaveV4TokenizedHubKey = 'CORE' | 'PLUS' | 'PRIME';
|
|
60
|
+
export type AaveV4TokenizedHubKey = 'CORE' | 'PLUS' | 'PRIME' | 'PAXOS';
|
|
58
61
|
|
|
59
62
|
export const aaveV4GetTokenizedHubKey = (hubNameOrKey?: string | null): AaveV4TokenizedHubKey | null => {
|
|
60
63
|
if (!hubNameOrKey) return null;
|
|
@@ -63,10 +66,12 @@ export const aaveV4GetTokenizedHubKey = (hubNameOrKey?: string | null): AaveV4To
|
|
|
63
66
|
if (normalized === 'CORE' || normalized === 'CORE HUB') return 'CORE';
|
|
64
67
|
if (normalized === 'PLUS' || normalized === 'PLUS HUB') return 'PLUS';
|
|
65
68
|
if (normalized === 'PRIME' || normalized === 'PRIME HUB') return 'PRIME';
|
|
69
|
+
if (normalized === 'PAXOS' || normalized === 'PAXOS HUB') return 'PAXOS';
|
|
66
70
|
|
|
67
71
|
if (normalized.includes('CORE')) return 'CORE';
|
|
68
72
|
if (normalized.includes('PLUS')) return 'PLUS';
|
|
69
73
|
if (normalized.includes('PRIME')) return 'PRIME';
|
|
74
|
+
if (normalized.includes('PAXOS')) return 'PAXOS';
|
|
70
75
|
|
|
71
76
|
return null;
|
|
72
77
|
};
|
package/src/aaveV4/merkl.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { aprToApy } from '../moneymarket';
|
|
2
|
-
import {
|
|
2
|
+
import { LONGER_TIMEOUT } from '../services/utils';
|
|
3
3
|
import {
|
|
4
4
|
AaveV4MerklRewardMap,
|
|
5
5
|
AaveV4ReserveAssetData,
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
MerklOpportunity,
|
|
9
9
|
OpportunityAction,
|
|
10
10
|
OpportunityStatus,
|
|
11
|
+
NetworkNumber,
|
|
11
12
|
} from '../types';
|
|
12
|
-
import { NetworkNumber } from '../types/common';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Merkl tags Aave V4 reward campaigns by scope via the `type` field:
|
|
@@ -34,8 +34,8 @@ const buildIncentive = (opportunity: MerklOpportunity): IncentiveData => {
|
|
|
34
34
|
export const getAaveV4MerkleCampaigns = async (chainId: NetworkNumber): Promise<AaveV4MerklRewardMap> => {
|
|
35
35
|
const result: AaveV4MerklRewardMap = { hub: {}, spoke: {} };
|
|
36
36
|
try {
|
|
37
|
-
const res = await fetch('https://
|
|
38
|
-
signal: AbortSignal.timeout(
|
|
37
|
+
const res = await fetch('https://fe.defisaver.com/api/merkl/opportunities?mainProtocolId=aave', {
|
|
38
|
+
signal: AbortSignal.timeout(LONGER_TIMEOUT),
|
|
39
39
|
});
|
|
40
40
|
if (!res.ok) throw new Error('Failed to fetch Aave V4 Merkle campaigns');
|
|
41
41
|
const opportunities = await res.json() as MerklOpportunity[];
|
package/src/claiming/aaveV3.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Client } from 'viem';
|
|
2
2
|
import Dec from 'decimal.js';
|
|
3
|
-
import { EthAddress, NetworkNumber } from '../types
|
|
3
|
+
import { EthAddress, NetworkNumber } from '../types';
|
|
4
4
|
import { ClaimableToken, ClaimType } from '../types/claiming';
|
|
5
5
|
import {
|
|
6
6
|
AaveIncentiveDataProviderV3ContractViem,
|
|
7
7
|
AaveRewardsControllerViem,
|
|
8
8
|
} from '../contracts';
|
|
9
|
-
import { compareAddresses, getEthAmountForDecimals } from '../services/utils';
|
|
9
|
+
import { compareAddresses, getEthAmountForDecimals, LONGER_TIMEOUT } from '../services/utils';
|
|
10
10
|
import { getAaveUnderlyingSymbol } from '../helpers/aaveHelpers';
|
|
11
11
|
|
|
12
12
|
type AaveReward = {
|
|
@@ -106,8 +106,8 @@ export async function getUnclaimedRewardsForAllMarkets(
|
|
|
106
106
|
export async function getMeritUnclaimedRewards(account: EthAddress, network: NetworkNumber): Promise<ClaimableToken[]> {
|
|
107
107
|
let data;
|
|
108
108
|
try {
|
|
109
|
-
const res = await fetch(`https://
|
|
110
|
-
{ signal: AbortSignal.timeout(
|
|
109
|
+
const res = await fetch(`https://fe.defisaver.com/api/merkl/get-user-rewards/${account}?chainId=${network}`,
|
|
110
|
+
{ signal: AbortSignal.timeout(LONGER_TIMEOUT) });
|
|
111
111
|
data = await res.json();
|
|
112
112
|
} catch (error) {
|
|
113
113
|
console.error('External API Failure: Aave Merit', error);
|
|
@@ -116,6 +116,10 @@ export async function getMeritUnclaimedRewards(account: EthAddress, network: Net
|
|
|
116
116
|
|
|
117
117
|
const claimableTokens: ClaimableToken[] = [];
|
|
118
118
|
|
|
119
|
+
// Merkl (or our proxy, on a non-2xx) can return a non-array error body; `fetch` doesn't throw on
|
|
120
|
+
// HTTP errors, so guard before iterating. Mirrors the app-side getMeritUnclaimedRewards.
|
|
121
|
+
if (!Array.isArray(data)) return claimableTokens;
|
|
122
|
+
|
|
119
123
|
data.forEach((item: { rewards: any[]; }) => {
|
|
120
124
|
item.rewards.forEach(reward => {
|
|
121
125
|
const {
|
|
@@ -29,10 +29,18 @@ export const AAVE_V4_PRIME_HUB = (networkId: NetworkNumber): AaveV4HubInfo => ({
|
|
|
29
29
|
address: '0x943827DCA022D0F354a8a8c332dA1e5Eb9f9F931',
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
+
export const AAVE_V4_PAXOS_HUB = (networkId: NetworkNumber): AaveV4HubInfo => ({
|
|
33
|
+
chainIds: [NetworkNumber.Eth],
|
|
34
|
+
label: 'Paxos Hub',
|
|
35
|
+
value: AaveV4HubsType.AaveV4PaxosHub,
|
|
36
|
+
address: '0x62d63197660c080236193CA60b70E49A08E90368',
|
|
37
|
+
});
|
|
38
|
+
|
|
32
39
|
export const AaveV4Hubs = (networkId: NetworkNumber) => ({
|
|
33
40
|
[AaveV4HubsType.AaveV4CoreHub]: AAVE_V4_CORE_HUB(networkId),
|
|
34
41
|
[AaveV4HubsType.AaveV4PlusHub]: AAVE_V4_PLUS_HUB(networkId),
|
|
35
42
|
[AaveV4HubsType.AaveV4PrimeHub]: AAVE_V4_PRIME_HUB(networkId),
|
|
43
|
+
[AaveV4HubsType.AaveV4PaxosHub]: AAVE_V4_PAXOS_HUB(networkId),
|
|
36
44
|
}) as const;
|
|
37
45
|
|
|
38
46
|
export const getAaveV4HubTypeInfo = (type: AaveV4HubsType, network?: NetworkNumber) => ({ ...AaveV4Hubs(network ?? NetworkNumber.Eth) }[type]);
|
|
@@ -173,6 +181,18 @@ export const AAVE_V4_MAIN_SPOKE = (networkId: NetworkNumber): AaveV4SpokeInfo =>
|
|
|
173
181
|
],
|
|
174
182
|
});
|
|
175
183
|
|
|
184
|
+
export const AAVE_V4_USDG_PENDLE_SPOKE = (networkId: NetworkNumber): AaveV4SpokeInfo => ({
|
|
185
|
+
chainIds: [NetworkNumber.Eth],
|
|
186
|
+
label: 'USDG Pendle',
|
|
187
|
+
value: AaveV4SpokesType.AaveV4USDGPendleSpoke,
|
|
188
|
+
url: 'usdg-pendle',
|
|
189
|
+
address: '0x956d8e0A89cfa3744428C4641b5a53B56167a7f9',
|
|
190
|
+
hubs: [
|
|
191
|
+
AAVE_V4_PAXOS_HUB(NetworkNumber.Eth).address,
|
|
192
|
+
AAVE_V4_CORE_HUB(NetworkNumber.Eth).address,
|
|
193
|
+
],
|
|
194
|
+
});
|
|
195
|
+
|
|
176
196
|
export const AaveV4Spokes = (networkId: NetworkNumber) => ({
|
|
177
197
|
[AaveV4SpokesType.AaveV4BluechipSpoke]: AAVE_V4_BLUECHIP_SPOKE(networkId),
|
|
178
198
|
[AaveV4SpokesType.AaveV4EthenaCorrelatedSpoke]: AAVE_V4_ETHENA_CORRELATED_SPOKE(networkId),
|
|
@@ -184,6 +204,7 @@ export const AaveV4Spokes = (networkId: NetworkNumber) => ({
|
|
|
184
204
|
[AaveV4SpokesType.AaveV4LidoSpoke]: AAVE_V4_LIDO_SPOKE(networkId),
|
|
185
205
|
[AaveV4SpokesType.AaveV4LombardBtcSpoke]: AAVE_V4_LOMBARD_BTC_SPOKE(networkId),
|
|
186
206
|
[AaveV4SpokesType.AaveV4MainSpoke]: AAVE_V4_MAIN_SPOKE(networkId),
|
|
207
|
+
[AaveV4SpokesType.AaveV4USDGPendleSpoke]: AAVE_V4_USDG_PENDLE_SPOKE(networkId),
|
|
187
208
|
}) as const;
|
|
188
209
|
|
|
189
210
|
export const getAaveV4SpokeTypeInfo = (type: AaveV4SpokesType, network?: NetworkNumber) => ({ ...AaveV4Spokes(network ?? NetworkNumber.Eth) }[type]);
|
|
@@ -25,7 +25,7 @@ export const STABLE_ASSETS = [
|
|
|
25
25
|
'USDe', 'sUSDe', 'srUSDe', 'USDS', 'sUSDS', 'USR', 'EURC', 'BOLD', 'BOLD Legacy', 'RLUSD', 'PT sUSDe July', 'PT eUSDe May',
|
|
26
26
|
'USDtb', 'eUSDe', 'PT USDe July', 'PT eUSDe Aug', 'PT sUSDe Sep', 'PT USDe Sep', 'PT sUSDe Nov', 'PT USDe Nov', 'PT sUSDe Jan', 'PT USDe Jan',
|
|
27
27
|
'PT sUSDe Feb', 'PT USDe Feb', 'PT sUSDe Apr', 'PT USDe Apr', 'PT sUSDe May', 'PT USDe May', 'PT srUSDe Apr', 'frxUSD', 'PT sUSDe June',
|
|
28
|
-
'PT USDe June', 'PT srUSDe Jun', 'PT srUSDe Oct', 'PT USDG May', 'PT sUSDS Nov', 'PT sUSDe Oct',
|
|
28
|
+
'PT USDe June', 'PT srUSDe Jun', 'PT srUSDe Oct', 'PT USDG May', 'PT sUSDS Nov', 'PT sUSDe Oct', 'PT USDG Sep',
|
|
29
29
|
];
|
|
30
30
|
|
|
31
31
|
export const isLeveragedPos = (usedAssets: MMUsedAssets, dustLimit = 5) => {
|
package/src/staking/staking.ts
CHANGED
|
@@ -65,7 +65,7 @@ export const STAKING_ASSETS = [
|
|
|
65
65
|
'ezETH', 'ETHx', 'rsETH', 'pufETH', 'wrsETH', 'wsuperOETHb', 'sUSDS', 'tETH', 'PT sUSDe Sep', 'PT USDe Sep',
|
|
66
66
|
'PT sUSDe Nov', 'PT USDe Nov', 'PT USDe Jan', 'PT sUSDe Jan', 'wrsETH', 'wstETH', 'syrupUSDT', 'syrupUSDC', 'wstUSR',
|
|
67
67
|
'PT sUSDe Feb', 'PT USDe Feb', 'PT sUSDe Apr', 'PT USDe Apr', 'PT sUSDe May', 'PT USDe May', 'PT srUSDe Apr', 'GHO',
|
|
68
|
-
'PT sUSDe June', 'PT USDe June', 'PT srUSDe Jun', 'PT srUSDe Oct', 'PT USDG May', 'PT sUSDS Nov', 'PT sUSDe Oct',
|
|
68
|
+
'PT sUSDe June', 'PT USDe June', 'PT srUSDe Jun', 'PT srUSDe Oct', 'PT USDG May', 'PT sUSDS Nov', 'PT sUSDe Oct', 'PT USDG Sep',
|
|
69
69
|
];
|
|
70
70
|
|
|
71
71
|
export const getStakingApy = memoize(async (asset: string, network: number = NetworkNumber.Eth) => {
|
|
@@ -111,6 +111,7 @@ export const getStakingApy = memoize(async (asset: string, network: number = Net
|
|
|
111
111
|
if (asset === 'PT sUSDe Oct') return await getApyFromDfsApi('PT sUSDe Oct', network);
|
|
112
112
|
if (asset === 'PT USDe June') return await getApyFromDfsApi('PT USDe June', network);
|
|
113
113
|
if (asset === 'PT USDG May') return await getApyFromDfsApi('PT USDG May', network);
|
|
114
|
+
if (asset === 'PT USDG Sep') return await getApyFromDfsApi('PT USDG Sep', network);
|
|
114
115
|
if (asset === 'PT sUSDS Nov') return await getApyFromDfsApi('PT sUSDS Nov', network);
|
|
115
116
|
if (asset === 'GHO') return await getApyFromDfsApi('GHO', network);
|
|
116
117
|
} catch (e) {
|
package/src/types/aaveV4.ts
CHANGED
|
@@ -6,6 +6,7 @@ export enum AaveV4HubsType {
|
|
|
6
6
|
AaveV4CoreHub = 'aave_v4_core_hub',
|
|
7
7
|
AaveV4PlusHub = 'aave_v4_plus_hub',
|
|
8
8
|
AaveV4PrimeHub = 'aave_v4_prime_hub',
|
|
9
|
+
AaveV4PaxosHub = 'aave_v4_paxos_hub',
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export enum AaveV4SpokesType {
|
|
@@ -19,6 +20,7 @@ export enum AaveV4SpokesType {
|
|
|
19
20
|
AaveV4LidoSpoke = 'aave_v4_lido_spoke',
|
|
20
21
|
AaveV4LombardBtcSpoke = 'aave_v4_lombard_btc_spoke',
|
|
21
22
|
AaveV4MainSpoke = 'aave_v4_main_spoke',
|
|
23
|
+
AaveV4USDGPendleSpoke = 'aave_v4_usdg_pendle_spoke',
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
export interface AaveV4HubInfo {
|