impermax-sdk 2.1.409 → 2.1.411
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.
|
@@ -162,6 +162,7 @@ class OffchainMultichainAccount {
|
|
|
162
162
|
// Gets the top positions for a user
|
|
163
163
|
async getTopPositions(params = {}) {
|
|
164
164
|
const topPositionsLimit = params.topPositionsLimit ?? 10;
|
|
165
|
+
const minimumUSD = params.minimumUSD ?? 0;
|
|
165
166
|
const [supplyPositions, vaultPositions, v2Positions, v3Positions] = await Promise.all([
|
|
166
167
|
this.getSupplyPositions(params),
|
|
167
168
|
this.getVaultPositions(params),
|
|
@@ -256,7 +257,7 @@ class OffchainMultichainAccount {
|
|
|
256
257
|
factory: undefined,
|
|
257
258
|
};
|
|
258
259
|
}));
|
|
259
|
-
const allPositions = [...supplyValues, ...vaultValues, ...v2PositionValues, ...v3PositionValues].sort((a, b) => b.value - a.value);
|
|
260
|
+
const allPositions = [...supplyValues, ...vaultValues, ...v2PositionValues, ...v3PositionValues].filter(i => i.value >= minimumUSD).sort((a, b) => b.value - a.value);
|
|
260
261
|
const mergedPositions = allPositions.reduce((acc, pos) => {
|
|
261
262
|
const existing = acc.find((p) => p.address === pos.address && p.network === pos.network);
|
|
262
263
|
if (existing)
|
|
@@ -19,7 +19,7 @@ const LlamaChains = {
|
|
|
19
19
|
[types_1.Networks.Base]: "base",
|
|
20
20
|
[types_1.Networks.Mantle]: "mantle",
|
|
21
21
|
[types_1.Networks.Scroll]: "scroll",
|
|
22
|
-
[types_1.Networks.Optimism]: "
|
|
22
|
+
[types_1.Networks.Optimism]: "optimism",
|
|
23
23
|
[types_1.Networks.Real]: "re.al",
|
|
24
24
|
[types_1.Networks.Blast]: "blast",
|
|
25
25
|
[types_1.Networks.Sonic]: "sonic",
|
|
@@ -85,7 +85,10 @@ class OffchainAPRHelper {
|
|
|
85
85
|
// contracts exists on diff chains
|
|
86
86
|
this.llamaAllPools = filteredPools.reduce((acc, i) => {
|
|
87
87
|
const pool = i.pool_old.split("-")[0];
|
|
88
|
-
|
|
88
|
+
// OP is outdated, report to llama
|
|
89
|
+
let llamaChain = i.chain.toLowerCase();
|
|
90
|
+
if (llamaChain === 'op mainnet')
|
|
91
|
+
llamaChain = 'optimism';
|
|
89
92
|
const llamaId = pool.concat("-", llamaChain).toLowerCase();
|
|
90
93
|
acc[llamaId] = i;
|
|
91
94
|
return acc;
|
|
@@ -120,12 +123,18 @@ class OffchainAPRHelper {
|
|
|
120
123
|
const impermaxTvlChart = response.tvl;
|
|
121
124
|
// Get the chain tvls
|
|
122
125
|
this.chainTvls = Object.entries(currentChainTvls).reduce((acc, [chain, tvl]) => {
|
|
123
|
-
|
|
126
|
+
let llamaChain = chain.toLowerCase();
|
|
127
|
+
if (llamaChain === 'op mainnet')
|
|
128
|
+
llamaChain = 'optimism';
|
|
129
|
+
acc[llamaChain.toLowerCase()] = tvl;
|
|
124
130
|
return acc;
|
|
125
131
|
}, {});
|
|
126
132
|
// Get the chain tvls day data to build charts
|
|
127
133
|
this.chainTvlCharts = Object.entries(chainTvlCharts).reduce((acc, [chain, dayData]) => {
|
|
128
|
-
|
|
134
|
+
let llamaChain = chain.toLowerCase();
|
|
135
|
+
if (llamaChain === 'op mainnet')
|
|
136
|
+
llamaChain = 'optimism';
|
|
137
|
+
acc[llamaChain.toLowerCase()] = dayData.tvl;
|
|
129
138
|
return acc;
|
|
130
139
|
}, {});
|
|
131
140
|
this.impermaxTvlChart = impermaxTvlChart;
|
|
@@ -145,7 +154,9 @@ class OffchainAPRHelper {
|
|
|
145
154
|
const impermaxPools = response.data.filter((i) => i.project === "impermax-v2" || i.project === "impermax-v3");
|
|
146
155
|
this.chainsTotalSupplied = impermaxPools.reduce((acc, pool) => {
|
|
147
156
|
// OP is outdated, report to llama
|
|
148
|
-
|
|
157
|
+
let chain = pool.chain.toLowerCase();
|
|
158
|
+
if (chain === 'op mainnet')
|
|
159
|
+
chain = 'optimism';
|
|
149
160
|
acc[chain] = (acc[chain] || 0) + pool.totalSupplyUsd;
|
|
150
161
|
return acc;
|
|
151
162
|
}, {});
|