@defisaver/positions-sdk 2.1.130 → 2.1.132
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/aaveV3/index.js +7 -1
- package/cjs/curveUsd/index.js +1 -1
- package/cjs/llamaLend/index.js +1 -1
- package/cjs/markets/aaveV4/index.d.ts +2 -0
- package/cjs/markets/aaveV4/index.js +13 -1
- package/cjs/portfolio/index.js +1 -1
- package/cjs/staking/staking.js +3 -0
- package/cjs/types/aaveV4.d.ts +2 -1
- package/cjs/types/aaveV4.js +1 -0
- package/esm/aaveV3/index.js +7 -1
- package/esm/curveUsd/index.js +1 -1
- package/esm/llamaLend/index.js +1 -1
- package/esm/markets/aaveV4/index.d.ts +2 -0
- package/esm/markets/aaveV4/index.js +11 -0
- package/esm/portfolio/index.js +1 -1
- package/esm/staking/staking.js +3 -0
- package/esm/types/aaveV4.d.ts +2 -1
- package/esm/types/aaveV4.js +1 -0
- package/package.json +2 -2
- package/src/aaveV3/index.ts +13 -1
- package/src/curveUsd/index.ts +1 -1
- package/src/llamaLend/index.ts +1 -1
- package/src/markets/aaveV4/index.ts +12 -0
- package/src/portfolio/index.ts +2 -1
- package/src/staking/staking.ts +2 -0
- package/src/types/aaveV4.ts +1 -0
package/cjs/aaveV3/index.js
CHANGED
|
@@ -64,9 +64,15 @@ function _getAaveV3MarketData(provider_1, network_1, market_1) {
|
|
|
64
64
|
const aaveIncentivesContract = (0, contracts_1.AaveIncentiveDataProviderV3ContractViem)(provider, network);
|
|
65
65
|
const marketAddress = market.providerAddress;
|
|
66
66
|
const networksWithIncentives = [common_1.NetworkNumber.Eth, common_1.NetworkNumber.Arb, common_1.NetworkNumber.Opt, common_1.NetworkNumber.Linea, common_1.NetworkNumber.Plasma];
|
|
67
|
+
// Limit each view call to 10 tokens, run chunks concurrently, then combine their results into loanInfo.
|
|
68
|
+
const addressesPerRequest = 10;
|
|
69
|
+
const addressChunks = _addresses.length > addressesPerRequest
|
|
70
|
+
? Array.from({ length: Math.ceil(_addresses.length / addressesPerRequest) }, (_, index) => _addresses.slice(index * addressesPerRequest, (index + 1) * addressesPerRequest))
|
|
71
|
+
: [_addresses];
|
|
72
|
+
const loanInfoPromise = Promise.all(addressChunks.map((addresses) => loanInfoContract.read.getFullTokensInfo([marketAddress, addresses], (0, viem_1.setViemBlockNumber)(blockNumber)))).then((loanInfoChunks) => loanInfoChunks.flat());
|
|
67
73
|
// eslint-disable-next-line prefer-const
|
|
68
74
|
let [loanInfo, eModesInfo, rewardInfo, merkleRewardsMap, meritRewardsMap] = yield Promise.all([
|
|
69
|
-
|
|
75
|
+
loanInfoPromise,
|
|
70
76
|
loanInfoContract.read.getAllEmodes([marketAddress], (0, viem_1.setViemBlockNumber)(blockNumber)),
|
|
71
77
|
networksWithIncentives.includes(network) ? aaveIncentivesContract.read.getReservesIncentivesData([marketAddress], (0, viem_1.setViemBlockNumber)(blockNumber)) : null,
|
|
72
78
|
(0, merkl_1.getMerkleCampaigns)(network),
|
package/cjs/curveUsd/index.js
CHANGED
|
@@ -30,7 +30,7 @@ const getAndFormatBands = (provider, network, selectedMarket, _minBand, _maxBand
|
|
|
30
30
|
// getBandsData uses a lot of gas to get all of the bands at once, so we use pagination and fetch 200 bands at a time
|
|
31
31
|
let i = minBand;
|
|
32
32
|
while (i < maxBand) {
|
|
33
|
-
i +=
|
|
33
|
+
i += 20;
|
|
34
34
|
if (i > maxBand) {
|
|
35
35
|
pivots.push(maxBand);
|
|
36
36
|
}
|
package/cjs/llamaLend/index.js
CHANGED
|
@@ -31,7 +31,7 @@ const getAndFormatBands = (provider, network, selectedMarket, _minBand, _maxBand
|
|
|
31
31
|
// getBandsData uses a lot of gas to get all of the bands at once, so we use pagination and fetch 200 bands at a time
|
|
32
32
|
let i = minBand;
|
|
33
33
|
while (i < maxBand) {
|
|
34
|
-
i +=
|
|
34
|
+
i += 20;
|
|
35
35
|
if (i > maxBand) {
|
|
36
36
|
pivots.push(maxBand);
|
|
37
37
|
}
|
|
@@ -22,6 +22,7 @@ export declare const AAVE_V4_LIDO_SPOKE: (networkId: NetworkNumber) => AaveV4Spo
|
|
|
22
22
|
export declare const AAVE_V4_LOMBARD_BTC_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
23
23
|
export declare const AAVE_V4_MAIN_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
24
24
|
export declare const AAVE_V4_USDG_PENDLE_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
25
|
+
export declare const AAVE_V4_USDG_MAPLE_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
25
26
|
export declare const AaveV4Spokes: (networkId: NetworkNumber) => {
|
|
26
27
|
readonly aave_v4_bluechip_spoke: AaveV4SpokeInfo;
|
|
27
28
|
readonly aave_v4_ethena_correlated_spoke: AaveV4SpokeInfo;
|
|
@@ -34,6 +35,7 @@ export declare const AaveV4Spokes: (networkId: NetworkNumber) => {
|
|
|
34
35
|
readonly aave_v4_lombard_btc_spoke: AaveV4SpokeInfo;
|
|
35
36
|
readonly aave_v4_main_spoke: AaveV4SpokeInfo;
|
|
36
37
|
readonly aave_v4_usdg_pendle_spoke: AaveV4SpokeInfo;
|
|
38
|
+
readonly aave_v4_usdg_maple_spoke: AaveV4SpokeInfo;
|
|
37
39
|
};
|
|
38
40
|
export declare const getAaveV4SpokeTypeInfo: (type: AaveV4SpokesType, network?: NetworkNumber) => AaveV4SpokeInfo;
|
|
39
41
|
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_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;
|
|
3
|
+
exports.findAaveV4SpokeByAddress = exports.getAaveV4SpokeTypeInfo = exports.AaveV4Spokes = exports.AAVE_V4_USDG_MAPLE_SPOKE = 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) => ({
|
|
@@ -185,6 +185,17 @@ const AAVE_V4_USDG_PENDLE_SPOKE = (networkId) => ({
|
|
|
185
185
|
],
|
|
186
186
|
});
|
|
187
187
|
exports.AAVE_V4_USDG_PENDLE_SPOKE = AAVE_V4_USDG_PENDLE_SPOKE;
|
|
188
|
+
const AAVE_V4_USDG_MAPLE_SPOKE = (networkId) => ({
|
|
189
|
+
chainIds: [types_1.NetworkNumber.Eth],
|
|
190
|
+
label: 'USDG Maple',
|
|
191
|
+
value: types_1.AaveV4SpokesType.AaveV4USDGMapleSpoke,
|
|
192
|
+
url: 'usdg-maple',
|
|
193
|
+
address: '0x774b9655413c34809c1f1b16b654465A89EBE989',
|
|
194
|
+
hubs: [
|
|
195
|
+
(0, exports.AAVE_V4_PAXOS_HUB)(types_1.NetworkNumber.Eth).address,
|
|
196
|
+
],
|
|
197
|
+
});
|
|
198
|
+
exports.AAVE_V4_USDG_MAPLE_SPOKE = AAVE_V4_USDG_MAPLE_SPOKE;
|
|
188
199
|
const AaveV4Spokes = (networkId) => ({
|
|
189
200
|
[types_1.AaveV4SpokesType.AaveV4BluechipSpoke]: (0, exports.AAVE_V4_BLUECHIP_SPOKE)(networkId),
|
|
190
201
|
[types_1.AaveV4SpokesType.AaveV4EthenaCorrelatedSpoke]: (0, exports.AAVE_V4_ETHENA_CORRELATED_SPOKE)(networkId),
|
|
@@ -197,6 +208,7 @@ const AaveV4Spokes = (networkId) => ({
|
|
|
197
208
|
[types_1.AaveV4SpokesType.AaveV4LombardBtcSpoke]: (0, exports.AAVE_V4_LOMBARD_BTC_SPOKE)(networkId),
|
|
198
209
|
[types_1.AaveV4SpokesType.AaveV4MainSpoke]: (0, exports.AAVE_V4_MAIN_SPOKE)(networkId),
|
|
199
210
|
[types_1.AaveV4SpokesType.AaveV4USDGPendleSpoke]: (0, exports.AAVE_V4_USDG_PENDLE_SPOKE)(networkId),
|
|
211
|
+
[types_1.AaveV4SpokesType.AaveV4USDGMapleSpoke]: (0, exports.AAVE_V4_USDG_MAPLE_SPOKE)(networkId),
|
|
200
212
|
});
|
|
201
213
|
exports.AaveV4Spokes = AaveV4Spokes;
|
|
202
214
|
const getAaveV4SpokeTypeInfo = (type, network) => (Object.assign({}, (0, exports.AaveV4Spokes)(network !== null && network !== void 0 ? network : types_1.NetworkNumber.Eth))[type]);
|
package/cjs/portfolio/index.js
CHANGED
|
@@ -71,7 +71,7 @@ function getPortfolioData(provider_1, network_1, defaultProvider_1, addresses_1)
|
|
|
71
71
|
const liquityV2Markets = [common_1.NetworkNumber.Eth].includes(network) ? Object.values((0, markets_1.LiquityV2Markets)(network)) : [];
|
|
72
72
|
const liquityV2MarketsStaking = [common_1.NetworkNumber.Eth].includes(network) ? Object.values((0, markets_1.LiquityV2Markets)(network)).filter(market => !market.isLegacy) : [];
|
|
73
73
|
const aaveV4Spokes = Object.values((0, markets_1.AaveV4Spokes)(network)).filter((market) => market.chainIds.includes(network));
|
|
74
|
-
const args = [network, { batch: { multicall: { batchSize: isSim ?
|
|
74
|
+
const args = [network, { batch: { multicall: { batchSize: isSim ? 1000 : 2500000 } } }];
|
|
75
75
|
const client = (0, viem_1.getViemProvider)(provider, ...args);
|
|
76
76
|
const defaultClient = (0, viem_1.getViemProvider)(defaultProvider, ...args);
|
|
77
77
|
const morphoMarketsData = {};
|
package/cjs/staking/staking.js
CHANGED
|
@@ -74,6 +74,7 @@ exports.STAKING_ASSETS = [
|
|
|
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
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
|
+
'syrupUSDG',
|
|
77
78
|
];
|
|
78
79
|
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
80
|
try {
|
|
@@ -131,6 +132,8 @@ exports.getStakingApy = (0, memoizee_1.default)((asset_1, ...args_1) => __awaite
|
|
|
131
132
|
return yield getApyFromDfsApi('syrupUSDT');
|
|
132
133
|
if (asset === 'syrupUSDC')
|
|
133
134
|
return yield getApyFromDfsApi('syrupUSDC');
|
|
135
|
+
if (asset === 'syrupUSDG')
|
|
136
|
+
return yield getApyFromDfsApi('syrupUSDG');
|
|
134
137
|
if (asset === 'wstUSR')
|
|
135
138
|
return yield getApyFromDfsApi('wstUSR');
|
|
136
139
|
if (asset === 'PT sUSDe Feb')
|
package/cjs/types/aaveV4.d.ts
CHANGED
|
@@ -16,7 +16,8 @@ export declare enum AaveV4SpokesType {
|
|
|
16
16
|
AaveV4LidoSpoke = "aave_v4_lido_spoke",
|
|
17
17
|
AaveV4LombardBtcSpoke = "aave_v4_lombard_btc_spoke",
|
|
18
18
|
AaveV4MainSpoke = "aave_v4_main_spoke",
|
|
19
|
-
AaveV4USDGPendleSpoke = "aave_v4_usdg_pendle_spoke"
|
|
19
|
+
AaveV4USDGPendleSpoke = "aave_v4_usdg_pendle_spoke",
|
|
20
|
+
AaveV4USDGMapleSpoke = "aave_v4_usdg_maple_spoke"
|
|
20
21
|
}
|
|
21
22
|
export interface AaveV4HubInfo {
|
|
22
23
|
chainIds: NetworkNumber[];
|
package/cjs/types/aaveV4.js
CHANGED
|
@@ -21,4 +21,5 @@ var AaveV4SpokesType;
|
|
|
21
21
|
AaveV4SpokesType["AaveV4LombardBtcSpoke"] = "aave_v4_lombard_btc_spoke";
|
|
22
22
|
AaveV4SpokesType["AaveV4MainSpoke"] = "aave_v4_main_spoke";
|
|
23
23
|
AaveV4SpokesType["AaveV4USDGPendleSpoke"] = "aave_v4_usdg_pendle_spoke";
|
|
24
|
+
AaveV4SpokesType["AaveV4USDGMapleSpoke"] = "aave_v4_usdg_maple_spoke";
|
|
24
25
|
})(AaveV4SpokesType || (exports.AaveV4SpokesType = AaveV4SpokesType = {}));
|
package/esm/aaveV3/index.js
CHANGED
|
@@ -53,9 +53,15 @@ export function _getAaveV3MarketData(provider_1, network_1, market_1) {
|
|
|
53
53
|
const aaveIncentivesContract = AaveIncentiveDataProviderV3ContractViem(provider, network);
|
|
54
54
|
const marketAddress = market.providerAddress;
|
|
55
55
|
const networksWithIncentives = [NetworkNumber.Eth, NetworkNumber.Arb, NetworkNumber.Opt, NetworkNumber.Linea, NetworkNumber.Plasma];
|
|
56
|
+
// Limit each view call to 10 tokens, run chunks concurrently, then combine their results into loanInfo.
|
|
57
|
+
const addressesPerRequest = 10;
|
|
58
|
+
const addressChunks = _addresses.length > addressesPerRequest
|
|
59
|
+
? Array.from({ length: Math.ceil(_addresses.length / addressesPerRequest) }, (_, index) => _addresses.slice(index * addressesPerRequest, (index + 1) * addressesPerRequest))
|
|
60
|
+
: [_addresses];
|
|
61
|
+
const loanInfoPromise = Promise.all(addressChunks.map((addresses) => loanInfoContract.read.getFullTokensInfo([marketAddress, addresses], setViemBlockNumber(blockNumber)))).then((loanInfoChunks) => loanInfoChunks.flat());
|
|
56
62
|
// eslint-disable-next-line prefer-const
|
|
57
63
|
let [loanInfo, eModesInfo, rewardInfo, merkleRewardsMap, meritRewardsMap] = yield Promise.all([
|
|
58
|
-
|
|
64
|
+
loanInfoPromise,
|
|
59
65
|
loanInfoContract.read.getAllEmodes([marketAddress], setViemBlockNumber(blockNumber)),
|
|
60
66
|
networksWithIncentives.includes(network) ? aaveIncentivesContract.read.getReservesIncentivesData([marketAddress], setViemBlockNumber(blockNumber)) : null,
|
|
61
67
|
getMerkleCampaigns(network),
|
package/esm/curveUsd/index.js
CHANGED
|
@@ -24,7 +24,7 @@ const getAndFormatBands = (provider, network, selectedMarket, _minBand, _maxBand
|
|
|
24
24
|
// getBandsData uses a lot of gas to get all of the bands at once, so we use pagination and fetch 200 bands at a time
|
|
25
25
|
let i = minBand;
|
|
26
26
|
while (i < maxBand) {
|
|
27
|
-
i +=
|
|
27
|
+
i += 20;
|
|
28
28
|
if (i > maxBand) {
|
|
29
29
|
pivots.push(maxBand);
|
|
30
30
|
}
|
package/esm/llamaLend/index.js
CHANGED
|
@@ -25,7 +25,7 @@ const getAndFormatBands = (provider, network, selectedMarket, _minBand, _maxBand
|
|
|
25
25
|
// getBandsData uses a lot of gas to get all of the bands at once, so we use pagination and fetch 200 bands at a time
|
|
26
26
|
let i = minBand;
|
|
27
27
|
while (i < maxBand) {
|
|
28
|
-
i +=
|
|
28
|
+
i += 20;
|
|
29
29
|
if (i > maxBand) {
|
|
30
30
|
pivots.push(maxBand);
|
|
31
31
|
}
|
|
@@ -22,6 +22,7 @@ export declare const AAVE_V4_LIDO_SPOKE: (networkId: NetworkNumber) => AaveV4Spo
|
|
|
22
22
|
export declare const AAVE_V4_LOMBARD_BTC_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
23
23
|
export declare const AAVE_V4_MAIN_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
24
24
|
export declare const AAVE_V4_USDG_PENDLE_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
25
|
+
export declare const AAVE_V4_USDG_MAPLE_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
25
26
|
export declare const AaveV4Spokes: (networkId: NetworkNumber) => {
|
|
26
27
|
readonly aave_v4_bluechip_spoke: AaveV4SpokeInfo;
|
|
27
28
|
readonly aave_v4_ethena_correlated_spoke: AaveV4SpokeInfo;
|
|
@@ -34,6 +35,7 @@ export declare const AaveV4Spokes: (networkId: NetworkNumber) => {
|
|
|
34
35
|
readonly aave_v4_lombard_btc_spoke: AaveV4SpokeInfo;
|
|
35
36
|
readonly aave_v4_main_spoke: AaveV4SpokeInfo;
|
|
36
37
|
readonly aave_v4_usdg_pendle_spoke: AaveV4SpokeInfo;
|
|
38
|
+
readonly aave_v4_usdg_maple_spoke: AaveV4SpokeInfo;
|
|
37
39
|
};
|
|
38
40
|
export declare const getAaveV4SpokeTypeInfo: (type: AaveV4SpokesType, network?: NetworkNumber) => AaveV4SpokeInfo;
|
|
39
41
|
export declare const findAaveV4SpokeByAddress: (networkId: NetworkNumber, address: string) => AaveV4SpokeInfo | undefined;
|
|
@@ -164,6 +164,16 @@ export const AAVE_V4_USDG_PENDLE_SPOKE = (networkId) => ({
|
|
|
164
164
|
AAVE_V4_CORE_HUB(NetworkNumber.Eth).address,
|
|
165
165
|
],
|
|
166
166
|
});
|
|
167
|
+
export const AAVE_V4_USDG_MAPLE_SPOKE = (networkId) => ({
|
|
168
|
+
chainIds: [NetworkNumber.Eth],
|
|
169
|
+
label: 'USDG Maple',
|
|
170
|
+
value: AaveV4SpokesType.AaveV4USDGMapleSpoke,
|
|
171
|
+
url: 'usdg-maple',
|
|
172
|
+
address: '0x774b9655413c34809c1f1b16b654465A89EBE989',
|
|
173
|
+
hubs: [
|
|
174
|
+
AAVE_V4_PAXOS_HUB(NetworkNumber.Eth).address,
|
|
175
|
+
],
|
|
176
|
+
});
|
|
167
177
|
export const AaveV4Spokes = (networkId) => ({
|
|
168
178
|
[AaveV4SpokesType.AaveV4BluechipSpoke]: AAVE_V4_BLUECHIP_SPOKE(networkId),
|
|
169
179
|
[AaveV4SpokesType.AaveV4EthenaCorrelatedSpoke]: AAVE_V4_ETHENA_CORRELATED_SPOKE(networkId),
|
|
@@ -176,6 +186,7 @@ export const AaveV4Spokes = (networkId) => ({
|
|
|
176
186
|
[AaveV4SpokesType.AaveV4LombardBtcSpoke]: AAVE_V4_LOMBARD_BTC_SPOKE(networkId),
|
|
177
187
|
[AaveV4SpokesType.AaveV4MainSpoke]: AAVE_V4_MAIN_SPOKE(networkId),
|
|
178
188
|
[AaveV4SpokesType.AaveV4USDGPendleSpoke]: AAVE_V4_USDG_PENDLE_SPOKE(networkId),
|
|
189
|
+
[AaveV4SpokesType.AaveV4USDGMapleSpoke]: AAVE_V4_USDG_MAPLE_SPOKE(networkId),
|
|
179
190
|
});
|
|
180
191
|
export const getAaveV4SpokeTypeInfo = (type, network) => (Object.assign({}, AaveV4Spokes(network !== null && network !== void 0 ? network : NetworkNumber.Eth))[type]);
|
|
181
192
|
export const findAaveV4SpokeByAddress = (networkId, address) => Object.values(AaveV4Spokes(networkId)).find(spoke => spoke.address.toLowerCase() === address.toLowerCase());
|
package/esm/portfolio/index.js
CHANGED
|
@@ -51,7 +51,7 @@ export function getPortfolioData(provider_1, network_1, defaultProvider_1, addre
|
|
|
51
51
|
const liquityV2Markets = [NetworkNumber.Eth].includes(network) ? Object.values(LiquityV2Markets(network)) : [];
|
|
52
52
|
const liquityV2MarketsStaking = [NetworkNumber.Eth].includes(network) ? Object.values(LiquityV2Markets(network)).filter(market => !market.isLegacy) : [];
|
|
53
53
|
const aaveV4Spokes = Object.values(AaveV4Spokes(network)).filter((market) => market.chainIds.includes(network));
|
|
54
|
-
const args = [network, { batch: { multicall: { batchSize: isSim ?
|
|
54
|
+
const args = [network, { batch: { multicall: { batchSize: isSim ? 1000 : 2500000 } } }];
|
|
55
55
|
const client = getViemProvider(provider, ...args);
|
|
56
56
|
const defaultClient = getViemProvider(defaultProvider, ...args);
|
|
57
57
|
const morphoMarketsData = {};
|
package/esm/staking/staking.js
CHANGED
|
@@ -68,6 +68,7 @@ export const STAKING_ASSETS = [
|
|
|
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
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
|
+
'syrupUSDG',
|
|
71
72
|
];
|
|
72
73
|
export const getStakingApy = memoize((asset_1, ...args_1) => __awaiter(void 0, [asset_1, ...args_1], void 0, function* (asset, network = NetworkNumber.Eth) {
|
|
73
74
|
try {
|
|
@@ -125,6 +126,8 @@ export const getStakingApy = memoize((asset_1, ...args_1) => __awaiter(void 0, [
|
|
|
125
126
|
return yield getApyFromDfsApi('syrupUSDT');
|
|
126
127
|
if (asset === 'syrupUSDC')
|
|
127
128
|
return yield getApyFromDfsApi('syrupUSDC');
|
|
129
|
+
if (asset === 'syrupUSDG')
|
|
130
|
+
return yield getApyFromDfsApi('syrupUSDG');
|
|
128
131
|
if (asset === 'wstUSR')
|
|
129
132
|
return yield getApyFromDfsApi('wstUSR');
|
|
130
133
|
if (asset === 'PT sUSDe Feb')
|
package/esm/types/aaveV4.d.ts
CHANGED
|
@@ -16,7 +16,8 @@ export declare enum AaveV4SpokesType {
|
|
|
16
16
|
AaveV4LidoSpoke = "aave_v4_lido_spoke",
|
|
17
17
|
AaveV4LombardBtcSpoke = "aave_v4_lombard_btc_spoke",
|
|
18
18
|
AaveV4MainSpoke = "aave_v4_main_spoke",
|
|
19
|
-
AaveV4USDGPendleSpoke = "aave_v4_usdg_pendle_spoke"
|
|
19
|
+
AaveV4USDGPendleSpoke = "aave_v4_usdg_pendle_spoke",
|
|
20
|
+
AaveV4USDGMapleSpoke = "aave_v4_usdg_maple_spoke"
|
|
20
21
|
}
|
|
21
22
|
export interface AaveV4HubInfo {
|
|
22
23
|
chainIds: NetworkNumber[];
|
package/esm/types/aaveV4.js
CHANGED
|
@@ -18,4 +18,5 @@ export var AaveV4SpokesType;
|
|
|
18
18
|
AaveV4SpokesType["AaveV4LombardBtcSpoke"] = "aave_v4_lombard_btc_spoke";
|
|
19
19
|
AaveV4SpokesType["AaveV4MainSpoke"] = "aave_v4_main_spoke";
|
|
20
20
|
AaveV4SpokesType["AaveV4USDGPendleSpoke"] = "aave_v4_usdg_pendle_spoke";
|
|
21
|
+
AaveV4SpokesType["AaveV4USDGMapleSpoke"] = "aave_v4_usdg_maple_spoke";
|
|
21
22
|
})(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.132",
|
|
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.44",
|
|
25
25
|
"@types/lodash": "^4.17.15",
|
|
26
26
|
"@types/memoizee": "^0.4.12",
|
|
27
27
|
"decimal.js": "^10.6.0",
|
package/src/aaveV3/index.ts
CHANGED
|
@@ -84,9 +84,21 @@ export async function _getAaveV3MarketData(provider: Client, network: NetworkNum
|
|
|
84
84
|
const aaveIncentivesContract = AaveIncentiveDataProviderV3ContractViem(provider, network);
|
|
85
85
|
const marketAddress = market.providerAddress;
|
|
86
86
|
const networksWithIncentives = [NetworkNumber.Eth, NetworkNumber.Arb, NetworkNumber.Opt, NetworkNumber.Linea, NetworkNumber.Plasma];
|
|
87
|
+
// Limit each view call to 10 tokens, run chunks concurrently, then combine their results into loanInfo.
|
|
88
|
+
const addressesPerRequest = 10;
|
|
89
|
+
const addressChunks: EthAddress[][] = _addresses.length > addressesPerRequest
|
|
90
|
+
? Array.from(
|
|
91
|
+
{ length: Math.ceil(_addresses.length / addressesPerRequest) },
|
|
92
|
+
(_, index) => _addresses.slice(index * addressesPerRequest, (index + 1) * addressesPerRequest) as EthAddress[],
|
|
93
|
+
)
|
|
94
|
+
: [_addresses as EthAddress[]];
|
|
95
|
+
const loanInfoPromise = Promise.all(addressChunks.map((addresses) => loanInfoContract.read.getFullTokensInfo(
|
|
96
|
+
[marketAddress, addresses],
|
|
97
|
+
setViemBlockNumber(blockNumber),
|
|
98
|
+
))).then((loanInfoChunks) => loanInfoChunks.flat());
|
|
87
99
|
// eslint-disable-next-line prefer-const
|
|
88
100
|
let [loanInfo, eModesInfo, rewardInfo, merkleRewardsMap, meritRewardsMap] = await Promise.all([
|
|
89
|
-
|
|
101
|
+
loanInfoPromise,
|
|
90
102
|
loanInfoContract.read.getAllEmodes([marketAddress], setViemBlockNumber(blockNumber)),
|
|
91
103
|
networksWithIncentives.includes(network) ? aaveIncentivesContract.read.getReservesIncentivesData([marketAddress], setViemBlockNumber(blockNumber)) : null,
|
|
92
104
|
getMerkleCampaigns(network),
|
package/src/curveUsd/index.ts
CHANGED
|
@@ -24,7 +24,7 @@ const getAndFormatBands = async (provider: Client, network: NetworkNumber, selec
|
|
|
24
24
|
// getBandsData uses a lot of gas to get all of the bands at once, so we use pagination and fetch 200 bands at a time
|
|
25
25
|
let i = minBand;
|
|
26
26
|
while (i < maxBand) {
|
|
27
|
-
i +=
|
|
27
|
+
i += 20;
|
|
28
28
|
if (i > maxBand) {
|
|
29
29
|
pivots.push(maxBand);
|
|
30
30
|
} else {
|
package/src/llamaLend/index.ts
CHANGED
|
@@ -24,7 +24,7 @@ const getAndFormatBands = async (provider: Client, network: NetworkNumber, selec
|
|
|
24
24
|
// getBandsData uses a lot of gas to get all of the bands at once, so we use pagination and fetch 200 bands at a time
|
|
25
25
|
let i = minBand;
|
|
26
26
|
while (i < maxBand) {
|
|
27
|
-
i +=
|
|
27
|
+
i += 20;
|
|
28
28
|
if (i > maxBand) {
|
|
29
29
|
pivots.push(maxBand);
|
|
30
30
|
} else {
|
|
@@ -193,6 +193,17 @@ export const AAVE_V4_USDG_PENDLE_SPOKE = (networkId: NetworkNumber): AaveV4Spoke
|
|
|
193
193
|
],
|
|
194
194
|
});
|
|
195
195
|
|
|
196
|
+
export const AAVE_V4_USDG_MAPLE_SPOKE = (networkId: NetworkNumber): AaveV4SpokeInfo => ({
|
|
197
|
+
chainIds: [NetworkNumber.Eth],
|
|
198
|
+
label: 'USDG Maple',
|
|
199
|
+
value: AaveV4SpokesType.AaveV4USDGMapleSpoke,
|
|
200
|
+
url: 'usdg-maple',
|
|
201
|
+
address: '0x774b9655413c34809c1f1b16b654465A89EBE989',
|
|
202
|
+
hubs: [
|
|
203
|
+
AAVE_V4_PAXOS_HUB(NetworkNumber.Eth).address,
|
|
204
|
+
],
|
|
205
|
+
});
|
|
206
|
+
|
|
196
207
|
export const AaveV4Spokes = (networkId: NetworkNumber) => ({
|
|
197
208
|
[AaveV4SpokesType.AaveV4BluechipSpoke]: AAVE_V4_BLUECHIP_SPOKE(networkId),
|
|
198
209
|
[AaveV4SpokesType.AaveV4EthenaCorrelatedSpoke]: AAVE_V4_ETHENA_CORRELATED_SPOKE(networkId),
|
|
@@ -205,6 +216,7 @@ export const AaveV4Spokes = (networkId: NetworkNumber) => ({
|
|
|
205
216
|
[AaveV4SpokesType.AaveV4LombardBtcSpoke]: AAVE_V4_LOMBARD_BTC_SPOKE(networkId),
|
|
206
217
|
[AaveV4SpokesType.AaveV4MainSpoke]: AAVE_V4_MAIN_SPOKE(networkId),
|
|
207
218
|
[AaveV4SpokesType.AaveV4USDGPendleSpoke]: AAVE_V4_USDG_PENDLE_SPOKE(networkId),
|
|
219
|
+
[AaveV4SpokesType.AaveV4USDGMapleSpoke]: AAVE_V4_USDG_MAPLE_SPOKE(networkId),
|
|
208
220
|
}) as const;
|
|
209
221
|
|
|
210
222
|
export const getAaveV4SpokeTypeInfo = (type: AaveV4SpokesType, network?: NetworkNumber) => ({ ...AaveV4Spokes(network ?? NetworkNumber.Eth) }[type]);
|
package/src/portfolio/index.ts
CHANGED
|
@@ -75,7 +75,8 @@ export async function getPortfolioData(provider: EthereumProvider, network: Netw
|
|
|
75
75
|
const liquityV2MarketsStaking = [NetworkNumber.Eth].includes(network) ? Object.values(LiquityV2Markets(network)).filter(market => !market.isLegacy) : [];
|
|
76
76
|
const aaveV4Spokes = Object.values(AaveV4Spokes(network)).filter((market) => market.chainIds.includes(network));
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
|
|
79
|
+
const args: [NetworkNumber, any?] = [network, { batch: { multicall: { batchSize: isSim ? 1_000 : 2_500_000 } } }];
|
|
79
80
|
const client = getViemProvider(provider, ...args);
|
|
80
81
|
const defaultClient = getViemProvider(defaultProvider, ...args);
|
|
81
82
|
|
package/src/staking/staking.ts
CHANGED
|
@@ -66,6 +66,7 @@ export const STAKING_ASSETS = [
|
|
|
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
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
|
+
'syrupUSDG',
|
|
69
70
|
];
|
|
70
71
|
|
|
71
72
|
export const getStakingApy = memoize(async (asset: string, network: number = NetworkNumber.Eth) => {
|
|
@@ -97,6 +98,7 @@ export const getStakingApy = memoize(async (asset: string, network: number = Net
|
|
|
97
98
|
if (asset === 'PT sUSDe Jan') return await getApyFromDfsApi('PT sUSDe Jan', network);
|
|
98
99
|
if (asset === 'syrupUSDT') return await getApyFromDfsApi('syrupUSDT');
|
|
99
100
|
if (asset === 'syrupUSDC') return await getApyFromDfsApi('syrupUSDC');
|
|
101
|
+
if (asset === 'syrupUSDG') return await getApyFromDfsApi('syrupUSDG');
|
|
100
102
|
if (asset === 'wstUSR') return await getApyFromDfsApi('wstUSR');
|
|
101
103
|
if (asset === 'PT sUSDe Feb') return await getApyFromDfsApi('PT sUSDe Feb', network);
|
|
102
104
|
if (asset === 'PT USDe Feb') return await getApyFromDfsApi('PT USDe Feb', network);
|
package/src/types/aaveV4.ts
CHANGED
|
@@ -21,6 +21,7 @@ export enum AaveV4SpokesType {
|
|
|
21
21
|
AaveV4LombardBtcSpoke = 'aave_v4_lombard_btc_spoke',
|
|
22
22
|
AaveV4MainSpoke = 'aave_v4_main_spoke',
|
|
23
23
|
AaveV4USDGPendleSpoke = 'aave_v4_usdg_pendle_spoke',
|
|
24
|
+
AaveV4USDGMapleSpoke = 'aave_v4_usdg_maple_spoke',
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
export interface AaveV4HubInfo {
|