impermax-sdk 2.1.352 → 2.1.353
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.
|
@@ -33,7 +33,7 @@ class OffchainLendingPoolV3 extends offchainLendingPool_1.default {
|
|
|
33
33
|
}
|
|
34
34
|
async getAmm() {
|
|
35
35
|
const nftlpData = await this.getNftlp().getNftlpData();
|
|
36
|
-
return (0, amms_1.getAmmByFactory)(this.offchain.network, nftlpData
|
|
36
|
+
return (0, amms_1.getAmmByFactory)(this.offchain.network, nftlpData?.dexFactory);
|
|
37
37
|
}
|
|
38
38
|
//Shown Leverage
|
|
39
39
|
async getShownLeverage() {
|
|
@@ -188,19 +188,25 @@ class OffchainMultichain {
|
|
|
188
188
|
* Whitelisted AMMs list
|
|
189
189
|
*--------------------------------------------------------*/
|
|
190
190
|
async getActiveAmms(params = {}) {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
const
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
191
|
+
try {
|
|
192
|
+
// Get lending pools
|
|
193
|
+
const lendingPools = await this.getLendingPoolList(params);
|
|
194
|
+
// Go through each lending pool and get amm.
|
|
195
|
+
// Check if pool is whitelisted, if so add amm to set.
|
|
196
|
+
const activeAmms = new Set();
|
|
197
|
+
const results = lendingPools.map(async (pool) => {
|
|
198
|
+
const amm = await pool.getAmm();
|
|
199
|
+
if (amm && pool.isWhitelisted())
|
|
200
|
+
activeAmms.add(amms_1.hrAmms[amm]);
|
|
201
|
+
});
|
|
202
|
+
await Promise.all(results);
|
|
203
|
+
// Unique AMMs
|
|
204
|
+
return Array.from(activeAmms);
|
|
205
|
+
}
|
|
206
|
+
catch (err) {
|
|
207
|
+
console.log("Failed to get active AMMs: ", err);
|
|
208
|
+
return [];
|
|
209
|
+
}
|
|
204
210
|
}
|
|
205
211
|
}
|
|
206
212
|
exports.default = OffchainMultichain;
|