impermax-sdk 2.1.397 → 2.1.398

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.
@@ -9,4 +9,4 @@ export declare const IMPERMAX_POOLS_API: NetworkFactoryIndex<string>;
9
9
  export declare const IMPERMAX_VAULT_API: NetworkVaultTypeIndex<string>;
10
10
  export declare const NFTLP_API: NetworkExtensionIndex<string>;
11
11
  export declare const PRICE_AGGREGATOR_API_URL = "https://price-aggregator-production.up.railway.app/api/tokens";
12
- export declare const POSITIONS_AGGREGATOR_API_URL = "https://positions-aggregator-production.up.railway.app/api/nftlps";
12
+ export declare const NFTLP_POSITIONS_API: NetworkExtensionIndex<string>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.POSITIONS_AGGREGATOR_API_URL = exports.PRICE_AGGREGATOR_API_URL = exports.NFTLP_API = exports.IMPERMAX_VAULT_API = exports.IMPERMAX_POOLS_API = void 0;
3
+ exports.NFTLP_POSITIONS_API = exports.PRICE_AGGREGATOR_API_URL = exports.NFTLP_API = exports.IMPERMAX_VAULT_API = exports.IMPERMAX_POOLS_API = void 0;
4
4
  const types_1 = require("./types");
5
5
  /**
6
6
  * Private API Endpoints which we might need to use in future for non-core
@@ -101,4 +101,33 @@ exports.NFTLP_API = {
101
101
  // Single endpoint for all factory subgraph token prices
102
102
  exports.PRICE_AGGREGATOR_API_URL = "https://price-aggregator-production.up.railway.app/api/tokens";
103
103
  // Single endpoint for all NFTLP positions
104
- exports.POSITIONS_AGGREGATOR_API_URL = "https://positions-aggregator-production.up.railway.app/api/nftlps";
104
+ //export const POSITIONS_AGGREGATOR_API_URL = "https://positions-aggregator-production.up.railway.app/api/nftlps";
105
+ // TODO: This properly
106
+ exports.NFTLP_POSITIONS_API = {
107
+ [types_1.Networks.Ropsten]: {},
108
+ [types_1.Networks.Mainnet]: {},
109
+ [types_1.Networks.Polygon]: {},
110
+ [types_1.Networks.Arbitrum]: {
111
+ [types_1.Extension.UniswapV3]: "https://positions-aggregator-production.up.railway.app/api/"
112
+ },
113
+ [types_1.Networks.Avalanche]: {},
114
+ [types_1.Networks.Mantle]: {},
115
+ [types_1.Networks.Moonriver]: {},
116
+ [types_1.Networks.Aurora]: {},
117
+ [types_1.Networks.Cronos]: {},
118
+ [types_1.Networks.Fantom]: {},
119
+ [types_1.Networks.Canto]: {},
120
+ [types_1.Networks.ZksyncEra]: {},
121
+ [types_1.Networks.Harmony]: {},
122
+ [types_1.Networks.Moonbeam]: {},
123
+ [types_1.Networks.Sxnetwork]: {},
124
+ [types_1.Networks.Blast]: {},
125
+ [types_1.Networks.Base]: {
126
+ [types_1.Extension.UniswapV3]: "https://positions-aggregator-production.up.railway.app/api/"
127
+ },
128
+ [types_1.Networks.Scroll]: {},
129
+ [types_1.Networks.Optimism]: {},
130
+ [types_1.Networks.Real]: {},
131
+ [types_1.Networks.Sonic]: {},
132
+ [types_1.Networks.Linea]: {},
133
+ };
@@ -195,6 +195,7 @@ exports.WHITELISTED_PAIRS = {
195
195
  "0x7e549Bae7D2ee4049d14E0e479C31829a7B68e0f",
196
196
  "0x9D7D2460F866CE20Ef2BEA8a574Da617f005Ca2c",
197
197
  "0x15746E3298333E0fc1C77bd3f71810FFC5674F04",
198
+ "0x99774dfda556167ef111623376613e0727fa0b86",
198
199
  // shadowswap
199
200
  "0x327B5fC08e36Afdde1De297621bb4569fFd83DDd",
200
201
  "0xBDc8B85Cf8f7E82B6DD08816eBD9B7377997b3f2",
@@ -2,4 +2,4 @@ import { AddressIndex, Address } from "../../../../../../config/types";
2
2
  import Offchain from "../../../../../offchain";
3
3
  import { NftlpStats } from "../../../../../offchainTypes";
4
4
  export declare function fetchNftlpTvls(this: Offchain): Promise<AddressIndex<NftlpStats>>;
5
- export declare function getNftlpTvl(this: Offchain, nftlpAddress: Address): Promise<NftlpStats | null>;
5
+ export declare function getNftlpTvl(this: Offchain, nftlpAddress: Address): Promise<NftlpStats | undefined>;
@@ -3,21 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getNftlpTvl = exports.fetchNftlpTvls = void 0;
4
4
  const types_1 = require("../../../../../../config/types");
5
5
  const private_api_1 = require("../../../../../../config/private-api");
6
+ // TODO: getNftlpTvl should be done by extension -> nftlpAddress
6
7
  /*--------------------------------------------------------------------------*
7
8
  * Fetchers *
8
9
  *--------------------------------------------------------------------------*/
9
10
  // Fetches all charts of all lending pools for an NFTLP factory (ie. Dex)
10
11
  async function fetchNftlpTvls() {
12
+ const api = private_api_1.NFTLP_POSITIONS_API[this.network][types_1.Extension.UniswapV3];
13
+ if (!api) {
14
+ return {};
15
+ }
11
16
  try {
12
- const response = await fetch(private_api_1.POSITIONS_AGGREGATOR_API_URL);
13
- if (!response.ok)
14
- throw new Error(`Positions aggregator API response error: ${response.status}`);
15
- const res = await response.json();
16
- return res;
17
+ const response = await fetch(api.concat(`${this.chainId}/nftlps`)).then(i => i.json());
18
+ return response;
17
19
  }
18
20
  catch (err) {
19
21
  console.log(`Failed to fetch uniswapV3 TVL data on ${this.network}`);
20
- console.log(err);
21
22
  return {};
22
23
  }
23
24
  }
@@ -30,6 +31,6 @@ async function getNftlpTvl(nftlpAddress) {
30
31
  this.extensionStatsData[types_1.Extension.UniswapV3] = this.fetchNftlpTvls();
31
32
  }
32
33
  const nftlpTvlsData = await this.extensionStatsData[types_1.Extension.UniswapV3];
33
- return nftlpTvlsData[nftlpAddress];
34
+ return nftlpTvlsData?.[nftlpAddress];
34
35
  }
35
36
  exports.getNftlpTvl = getNftlpTvl;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impermax-sdk",
3
- "version": "2.1.397",
3
+ "version": "2.1.398",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",