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.dexFactory);
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
- // Get lending pools
192
- const lendingPools = await this.getLendingPoolList(params);
193
- // Go through each lending pool and get amm.
194
- // Check if pool is whitelisted, if so add amm to set.
195
- const activeAmms = new Set();
196
- const results = lendingPools.map(async (pool) => {
197
- const amm = await pool.getAmm();
198
- if (amm && pool.isWhitelisted())
199
- activeAmms.add(amms_1.hrAmms[amm]);
200
- });
201
- await Promise.all(results);
202
- // Unique AMMs
203
- return Array.from(activeAmms);
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impermax-sdk",
3
- "version": "2.1.352",
3
+ "version": "2.1.353",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",