impermax-sdk 2.1.566 → 2.1.568

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.
@@ -1,6 +1,7 @@
1
1
  import { NetworkVaultTypeIndex, NetworkFactoryIndex, NetworkExtensionIndex } from "./types";
2
2
  /** Single endpoint for all factory subgraph token prices */
3
3
  export declare const PRICE_AGGREGATOR_API_URL = "https://price-aggregator-production.up.railway.app/api/tokens";
4
+ /** Single endpoint to get NFTLP collateral TVL across all networks */
4
5
  /**
5
6
  * Private API Endpoints which we might need to use in future for non-core
6
7
  * things (ie. charts, leaderboards, etc.). The app must function well
@@ -5,6 +5,8 @@ exports.POSITIONS_AGGREGATOR_API_URL = exports.NFTLP_API = exports.IMPERMAX_VAUL
5
5
  const types_1 = require("./types");
6
6
  /** Single endpoint for all factory subgraph token prices */
7
7
  exports.PRICE_AGGREGATOR_API_URL = "https://price-aggregator-production.up.railway.app/api/tokens";
8
+ /** Single endpoint to get NFTLP collateral TVL across all networks */
9
+ //export const POSITIONS_AGGREGATOR_API_URL = "https://positions-aggregator-production.up.railway.app/api/";
8
10
  /**
9
11
  * Private API Endpoints which we might need to use in future for non-core
10
12
  * things (ie. charts, leaderboards, etc.). The app must function well
@@ -2,6 +2,7 @@ import { Address, FactoryIndex } from "../../../../config/types";
2
2
  import { RawUserData, UserData } from "../../../offchainTypes";
3
3
  import Offchain from "../../../offchain";
4
4
  export declare function getUserData(this: Offchain, account: Address): Promise<FactoryIndex<UserData> | null>;
5
+ export declare function getAllUsersData(this: Offchain): Promise<Record<Address, FactoryIndex<UserData>>>;
5
6
  export declare function initializeUserData(this: Offchain, account: Address): Promise<FactoryIndex<UserData> | null>;
6
7
  export declare function initializeAllUsersData(this: Offchain): Promise<Record<Address, FactoryIndex<UserData>>>;
7
8
  export declare function fetchUserData(this: Offchain, account: Address): Promise<FactoryIndex<RawUserData>>;
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchAllUsersData = exports.fetchUserData = exports.initializeAllUsersData = exports.initializeUserData = exports.getUserData = void 0;
3
+ exports.fetchAllUsersData = exports.fetchUserData = exports.initializeAllUsersData = exports.initializeUserData = exports.getAllUsersData = exports.getUserData = void 0;
4
4
  const subgraphs_1 = require("../../../../config/subgraphs");
5
5
  const types_1 = require("../../../../config/types");
6
6
  const offchainTypes_1 = require("../../../offchainTypes");
7
7
  const positionsV2_1 = require("./positionsV2");
8
8
  const positionsV3_1 = require("./positionsV3");
9
+ // Functions for getting single user data and all users data as they need slightly diff logic
9
10
  /*--------------------------------------------------------------------------*
10
11
  * Getters *
11
12
  *--------------------------------------------------------------------------*/
@@ -15,6 +16,12 @@ async function getUserData(account) {
15
16
  return this.usersData[account];
16
17
  }
17
18
  exports.getUserData = getUserData;
19
+ async function getAllUsersData() {
20
+ if (!this.allUsersData)
21
+ this.allUsersData = this.initializeAllUsersData();
22
+ return this.allUsersData;
23
+ }
24
+ exports.getAllUsersData = getAllUsersData;
18
25
  /*--------------------------------------------------------------------------*
19
26
  * Initializers *
20
27
  *--------------------------------------------------------------------------*/
@@ -22,7 +29,6 @@ exports.getUserData = getUserData;
22
29
  // For collateralPositions/borrowPositions we separate into:
23
30
  // - `initializeV2Positions` for V2
24
31
  // - `initializeV3Positions` for V3
25
- // Initialize single user data
26
32
  async function initializeUserData(account) {
27
33
  const result = {};
28
34
  const userData = await this.fetchUserData(account);
@@ -38,17 +44,14 @@ async function initializeUserData(account) {
38
44
  };
39
45
  // Get collateral/borrow positions for V2/V3
40
46
  if ((0, offchainTypes_1.isV3Factory)(factory)) {
41
- // TODO: V3 pair filter (nftlp)
42
47
  const v3Data = await (0, positionsV3_1.initializeV3Positions)(this, factory, userDataOfFactory);
43
48
  result[factory].positions = v3Data.positions;
44
49
  }
45
50
  else {
46
- // Pass filtered pairs
47
51
  const v2Data = await (0, positionsV2_1.initializeV2Positions)(this, factory, userDataOfFactory, []);
48
52
  result[factory].collateralPositions = v2Data.collateralPositions;
49
53
  result[factory].borrowPositions = v2Data.borrowPositions;
50
54
  }
51
- // Supply positions is same for v2 and v3
52
55
  for (const supplyPosition of userDataOfFactory.supplyPositions) {
53
56
  const lendingPoolId = supplyPosition.borrowable.lendingPool.id;
54
57
  // Don't include supply positions if lending pool is not in pair list
@@ -64,39 +67,66 @@ async function initializeUserData(account) {
64
67
  const poolTokenType = underlyingId === addressA
65
68
  ? types_1.PoolTokenType.BorrowableA
66
69
  : types_1.PoolTokenType.BorrowableB;
67
- if (!(lendingPoolId in result[factory].supplyPositions)) {
70
+ if (!(lendingPoolId in result[factory].supplyPositions))
68
71
  result[factory].supplyPositions[lendingPoolId] = {};
69
- }
70
72
  result[factory].supplyPositions[lendingPoolId][poolTokenType] = supplyPosition;
71
73
  }
72
74
  }
73
75
  return result;
74
76
  }
75
77
  exports.initializeUserData = initializeUserData;
76
- // Initialize all users data
77
- // NOTE: Only v3 atm as we test
78
+ // Similar to `initializeUserData`, but loop also through addresses instead of just factory
78
79
  async function initializeAllUsersData() {
79
- const allUserData = await this.fetchAllUsersData();
80
+ const allUsersData = await this.fetchAllUsersData();
80
81
  const result = {};
81
- for (const userAddress in allUserData) {
82
- const userData = allUserData[userAddress];
82
+ const allV3UserData = {};
83
+ // Borrow positions
84
+ for (const userAddress in allUsersData) {
85
+ const userData = allUsersData[userAddress];
83
86
  result[userAddress] = {};
87
+ // 2. Loop through factory (atm only v3 as we test)
84
88
  for (const factory in userData) {
85
89
  if (!(0, offchainTypes_1.isV3Factory)(factory))
86
90
  continue;
87
91
  const userDataOfFactory = userData[factory];
92
+ if (!userDataOfFactory.positions || userDataOfFactory.positions.length === 0)
93
+ continue;
88
94
  result[userAddress][factory] = {
89
95
  positions: {},
90
96
  collateralPositions: {},
91
97
  supplyPositions: {},
92
98
  borrowPositions: {},
93
99
  };
94
- // Get V3 positions only
95
- const v3Data = await (0, positionsV3_1.initializeV3Positions)(this, factory, userDataOfFactory);
96
- result[userAddress][factory].positions = v3Data.positions;
97
- // Supply positions is same for v2 and v3
100
+ allV3UserData[userAddress] = userDataOfFactory;
101
+ }
102
+ }
103
+ const positions = await (0, positionsV3_1.initializeV3PositionsAll)(this, allV3UserData);
104
+ for (const userAddress in positions) {
105
+ for (const factory in allUsersData[userAddress]) {
106
+ if (!(0, offchainTypes_1.isV3Factory)(factory))
107
+ continue;
108
+ result[userAddress][factory].positions = positions[userAddress];
109
+ }
110
+ }
111
+ // Supply positions
112
+ for (const userAddress in allUsersData) {
113
+ const userData = allUsersData[userAddress];
114
+ for (const factory in userData) {
115
+ if (!(0, offchainTypes_1.isV3Factory)(factory))
116
+ continue;
117
+ const userDataOfFactory = userData[factory];
118
+ if (!result[userAddress][factory]) {
119
+ result[userAddress][factory] = {
120
+ positions: {},
121
+ collateralPositions: {},
122
+ supplyPositions: {},
123
+ borrowPositions: {},
124
+ };
125
+ }
98
126
  for (const supplyPosition of userDataOfFactory.supplyPositions) {
99
127
  const lendingPoolId = supplyPosition.borrowable.lendingPool.id;
128
+ // Don't include supply positions if lending pool is not in pair list
129
+ // if (pairs.length > 0 && !pairs.includes(lendingPoolId)) continue
100
130
  const underlyingId = supplyPosition.borrowable.underlying.id;
101
131
  const lendingPool = await this.getLendingPool(factory, lendingPoolId);
102
132
  if (!lendingPool) {
@@ -108,25 +138,28 @@ async function initializeAllUsersData() {
108
138
  const poolTokenType = underlyingId === addressA
109
139
  ? types_1.PoolTokenType.BorrowableA
110
140
  : types_1.PoolTokenType.BorrowableB;
111
- if (!(lendingPoolId in result[userAddress][factory].supplyPositions)) {
141
+ if (!(lendingPoolId in result[userAddress][factory].supplyPositions))
112
142
  result[userAddress][factory].supplyPositions[lendingPoolId] = {};
113
- }
114
143
  result[userAddress][factory].supplyPositions[lendingPoolId][poolTokenType] = supplyPosition;
115
144
  }
116
145
  }
117
146
  }
147
+ // Cache result into usersData so we don't make any more api calls when calling account methods
148
+ for (const userAddress in result) {
149
+ this.usersData[userAddress] = Promise.resolve(result[userAddress]);
150
+ }
118
151
  return result;
119
152
  }
120
153
  exports.initializeAllUsersData = initializeAllUsersData;
121
154
  /*--------------------------------------------------------------------------*
122
155
  * Fetchers *
123
156
  *--------------------------------------------------------------------------*/
124
- // Fetch single user data
157
+ // - fetchUserData - Gets data for single user
158
+ // - fetchUsersData - Gets data of all users (doesn't use address filter in the queries)
125
159
  async function fetchUserData(account) {
126
160
  const positions = {};
127
161
  for (const factory in subgraphs_1.IMPERMAX_SUBGRAPH_URL[this.network]) {
128
162
  const subgraphs = subgraphs_1.IMPERMAX_SUBGRAPH_URL[this.network][factory];
129
- // Decides for v3 query internally
130
163
  const result = await this.getEndpointManager().fetch(subgraphs, this.network, (queryBuilder) => queryBuilder.userQuery(account, this.network, factory));
131
164
  if (!result || !result.data?.user)
132
165
  continue;
@@ -135,14 +168,12 @@ async function fetchUserData(account) {
135
168
  positions: user.positions,
136
169
  supplyPositions: user.supplyPositions,
137
170
  collateralPositions: user.collateralPositions,
138
- borrowPositions: user.borrowPositions, // Undefined if V3
171
+ borrowPositions: user.borrowPositions,
139
172
  };
140
173
  }
141
174
  return positions;
142
175
  }
143
176
  exports.fetchUserData = fetchUserData;
144
- // Fetch all users data
145
- // NOTE: Only v3 atm as we test
146
177
  async function fetchAllUsersData() {
147
178
  const allUserData = {};
148
179
  for (const factory in subgraphs_1.IMPERMAX_SUBGRAPH_URL[this.network]) {
@@ -153,7 +184,6 @@ async function fetchAllUsersData() {
153
184
  if (!result || !result.data?.users)
154
185
  continue;
155
186
  const users = result.data.users;
156
- // Process each user and group by user address
157
187
  for (const user of users) {
158
188
  const userAddress = user.id;
159
189
  if (!allUserData[userAddress])
@@ -162,7 +192,7 @@ async function fetchAllUsersData() {
162
192
  positions: user.positions,
163
193
  supplyPositions: user.supplyPositions,
164
194
  collateralPositions: user.collateralPositions,
165
- borrowPositions: user.borrowPositions, // Undefined if V3
195
+ borrowPositions: user.borrowPositions,
166
196
  };
167
197
  }
168
198
  }
@@ -1,4 +1,4 @@
1
- import { AddressIndex, Factory } from "../../../../config/types";
1
+ import { Address, AddressIndex, Factory } from "../../../../config/types";
2
2
  import { NftlpPosition, RawV3UserData } from "../../../offchainTypes";
3
3
  import Offchain from "../../../offchain";
4
4
  /**
@@ -31,3 +31,7 @@ import Offchain from "../../../offchain";
31
31
  export declare function initializeV3Positions(offchain: Offchain, factory: Factory, rawUserData: RawV3UserData): Promise<{
32
32
  positions: AddressIndex<NftlpPosition[]>;
33
33
  }>;
34
+ /**
35
+ * Same as initializeV3Positions but returns positions indexed by user address
36
+ */
37
+ export declare function initializeV3PositionsAll(offchain: Offchain, allUserData: Record<Address, RawV3UserData>): Promise<Record<Address, AddressIndex<NftlpPosition[]>>>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.initializeV3Positions = void 0;
3
+ exports.initializeV3PositionsAll = exports.initializeV3Positions = void 0;
4
4
  const nftlp_1 = require("../../../../config/nftlp");
5
5
  /**
6
6
  * At this point we have all Collateral Positions (V3 NFTLP positions) of a user
@@ -78,3 +78,59 @@ async function initializeV3Positions(offchain, factory, rawUserData) {
78
78
  return { positions };
79
79
  }
80
80
  exports.initializeV3Positions = initializeV3Positions;
81
+ /**
82
+ * Same as initializeV3Positions but returns positions indexed by user address
83
+ */
84
+ async function initializeV3PositionsAll(offchain, allUserData) {
85
+ // userAddress -> lendingPoolId -> NftlpPosition[]
86
+ const result = {};
87
+ for (const userAddress in allUserData) {
88
+ result[userAddress] = {};
89
+ }
90
+ const dexPositions = {};
91
+ const positionMap = new Map();
92
+ // 1. Get all positions from all users and group by NFTLP factory
93
+ for (const userAddress in allUserData) {
94
+ const rawUserData = allUserData[userAddress];
95
+ for (const position of rawUserData.positions) {
96
+ const factoryId = position.lendingPool.nftlp.factory;
97
+ const lendingPoolId = position.lendingPool.id;
98
+ if (!result[userAddress][lendingPoolId])
99
+ result[userAddress][lendingPoolId] = [];
100
+ if (!dexPositions[factoryId])
101
+ dexPositions[factoryId] = [];
102
+ // Group position with its factory
103
+ dexPositions[factoryId].push(position.id);
104
+ // Cache position and user address
105
+ positionMap.set(position.id, { position, lendingPoolId, userAddress });
106
+ }
107
+ }
108
+ // 2. Get all unique NFTLP factories across all users
109
+ const nftlpFactories = Object.keys(dexPositions);
110
+ // 3. Get unique position data from dex subgraph
111
+ for (const nftlpFactory of nftlpFactories) {
112
+ const dex = (0, nftlp_1.getNftlpDex)(offchain.network, nftlpFactory);
113
+ if (dex === undefined) {
114
+ console.warn(`Unknown DEX for NFTLP factory ${nftlpFactory} on ${offchain.network}`);
115
+ continue;
116
+ }
117
+ const endpoints = (0, nftlp_1.getNftlpSubgraph)(offchain.network, dex);
118
+ if (!endpoints?.length) {
119
+ console.warn(`No NFTLP endpoints found for ${dex} on ${offchain.network}`);
120
+ continue;
121
+ }
122
+ const nftlpData = await offchain.getEndpointManager().fetch(endpoints, offchain.network, (queryBuilder) => queryBuilder.nftlpPositionQuery(dex, dexPositions[nftlpFactory]));
123
+ if (!nftlpData || !nftlpData.data?.nftlpPositions)
124
+ continue;
125
+ // 4. Now need to map the position to the user address
126
+ for (const nftlp of nftlpData.data.nftlpPositions) {
127
+ const positionInfo = positionMap.get(nftlp.id);
128
+ if (positionInfo) {
129
+ const { position, lendingPoolId, userAddress } = positionInfo;
130
+ result[userAddress][lendingPoolId].push({ ...position, dex, nftlp });
131
+ }
132
+ }
133
+ }
134
+ return result;
135
+ }
136
+ exports.initializeV3PositionsAll = initializeV3PositionsAll;
@@ -53,6 +53,7 @@ export default class Offchain {
53
53
  protected xibexUsersData: {
54
54
  [key in Address]?: Promise<XIbexUserData | null>;
55
55
  };
56
+ protected allUsersData: Promise<Record<Address, FactoryIndex<UserData>>> | null;
56
57
  protected extensionChartsData: {
57
58
  [key in Extension]?: Promise<AddressIndex<PoolChart[]>>;
58
59
  };
@@ -105,6 +106,7 @@ export default class Offchain {
105
106
  protected fetchUserData: typeof initializer.fetchUserData;
106
107
  protected initializeUserData: typeof initializer.initializeUserData;
107
108
  getUserData: typeof initializer.getUserData;
109
+ getAllUsersData: typeof initializer.getAllUsersData;
108
110
  fetchAllUsersData: typeof initializer.fetchAllUsersData;
109
111
  initializeAllUsersData: typeof initializer.initializeAllUsersData;
110
112
  protected initializeXIbexData: typeof initializer.initializeXIbexData;
@@ -86,6 +86,7 @@ class Offchain {
86
86
  this.fetchUserData = initializer.fetchUserData;
87
87
  this.initializeUserData = initializer.initializeUserData;
88
88
  this.getUserData = initializer.getUserData;
89
+ this.getAllUsersData = initializer.getAllUsersData;
89
90
  this.fetchAllUsersData = initializer.fetchAllUsersData;
90
91
  this.initializeAllUsersData = initializer.initializeAllUsersData;
91
92
  this.initializeXIbexData = initializer.initializeXIbexData;
@@ -164,6 +165,7 @@ class Offchain {
164
165
  this.xibexUsersData = {};
165
166
  this.vaultsLinkToBorrowable = {};
166
167
  this.stakingModule?.cleanCache();
168
+ this.allUsersData = null;
167
169
  for (const address in this.accounts) {
168
170
  await this.accounts[address].cleanCache();
169
171
  }
@@ -15,6 +15,7 @@ import OffchainAccount from "./account/offchainAccount";
15
15
  import { PairState } from '../config/whitelist';
16
16
  import { LlamaTvlChart } from './offchainAPRHelper';
17
17
  import { NetworkTokenData } from "./offchainTypes";
18
+ import { OffchainAccountLendingPool } from "./account";
18
19
  export declare enum SortDirection {
19
20
  ASC = "asc",
20
21
  DESC = "desc"
@@ -95,9 +96,13 @@ export default class OffchainMultichain {
95
96
  getMultichainAccount(accountAddress: Address): OffchainMultichainAccount;
96
97
  getMultichainBorrowersList(params?: BorrowersListParams): Promise<OffchainAccount[]>;
97
98
  /**
98
- * TODO: Get all borrowers positions across networks.
99
+ * Get all borrower positions for V3
99
100
  */
100
- getAllBorrowerPositions(params?: BorrowersListParams): Promise<any>;
101
+ getAllBorrowerPositions(params?: BorrowersListParams): Promise<OffchainAccountLendingPool[][]>;
102
+ /**
103
+ * Get all lender (supply) positions for V3
104
+ */
105
+ getAllLenderPositions(params?: BorrowersListParams): Promise<OffchainAccountLendingPool[][]>;
101
106
  getActiveAmms(params?: LendingPoolListParams): Promise<Amms[]>;
102
107
  /** Gets TVL from defillama */
103
108
  getDefillamaTvlData(params?: MultichainTvlParams): Promise<MultichainTvlData>;
@@ -190,16 +190,46 @@ class OffchainMultichain {
190
190
  return [...new Set(allBorrowers.flat())];
191
191
  }
192
192
  /**
193
- * TODO: Get all borrowers positions across networks.
193
+ * Get all borrower positions for V3
194
194
  */
195
195
  async getAllBorrowerPositions(params = {}) {
196
196
  const allNetworks = params.networks || Object.values(types_1.Networks);
197
- // Fetch all users data for each network in parallel
198
197
  const networkPromises = allNetworks.map(async (network) => {
198
+ const networkPositions = [];
199
199
  const offchain = this.getOffchain(network);
200
- // TODO: Get all users data and return position objects
201
- //const allUsersData = await offchain.initializeAllUsersData();
200
+ const allUsersData = await offchain.getAllUsersData();
201
+ for (const user of Object.keys(allUsersData)) {
202
+ const account = this.getMultichainAccount(user);
203
+ const nftlpPositions = await account.getNftlpPositions({ networks: [network] });
204
+ if (nftlpPositions.length > 0) {
205
+ networkPositions.push(nftlpPositions);
206
+ }
207
+ }
208
+ return networkPositions;
202
209
  });
210
+ const results = await Promise.all(networkPromises);
211
+ return results.flat();
212
+ }
213
+ /**
214
+ * Get all lender (supply) positions for V3
215
+ */
216
+ async getAllLenderPositions(params = {}) {
217
+ const allNetworks = params.networks || Object.values(types_1.Networks);
218
+ const networkPromises = allNetworks.map(async (network) => {
219
+ const networkPositions = [];
220
+ const offchain = this.getOffchain(network);
221
+ const allUsersData = await offchain.getAllUsersData();
222
+ for (const user of Object.keys(allUsersData)) {
223
+ const account = this.getMultichainAccount(user);
224
+ const supplyPositions = await account.getSupplyPositions({ networks: [network] });
225
+ if (supplyPositions.length > 0) {
226
+ networkPositions.push(supplyPositions);
227
+ }
228
+ }
229
+ return networkPositions;
230
+ });
231
+ const results = await Promise.all(networkPromises);
232
+ return results.flat();
203
233
  }
204
234
  /*--------------------------------------------------------*
205
235
  * Whitelisted AMMs list
@@ -138,7 +138,7 @@ class PonderQueryBuilder {
138
138
  // Get all users V3 positions from network factory, no address filter
139
139
  usersQueryV3(network, factory) {
140
140
  return (0, graphql_tag_1.default) `{
141
- users(limit: 1000, where: {id_not: "0x0000000000000000000000000000000000000000"}) {
141
+ users(limit: 1000, where: { id_not: "0x0000000000000000000000000000000000000000" }) {
142
142
  items {
143
143
  id
144
144
  positions(limit: 1000, where: { factoryId: "${impermax_factories_1.IMPERMAX_FACTORY[network][factory]}" }) {
@@ -151,7 +151,7 @@ class PonderQueryBuilder {
151
151
  factory
152
152
  }
153
153
  }
154
- borrowPositions {
154
+ borrowPositions(where: { borrowBalance_not: "0" }) {
155
155
  items {
156
156
  borrowBalance
157
157
  borrowIndex
@@ -353,21 +353,6 @@ class PonderQueryBuilder {
353
353
  }
354
354
  }
355
355
  }
356
- supplyPositions(limit:1000, where: { factoryId: "${impermax_factories_1.IMPERMAX_FACTORY[network][factory]}", balance_not: "0"}) {
357
- items {
358
- balance
359
- cumulativeEarnings
360
- lastExchangeRate
361
- borrowable {
362
- underlying {
363
- id
364
- }
365
- lendingPool {
366
- id
367
- }
368
- }
369
- }
370
- }
371
356
  borrowPositions(limit:1000, where: { factoryId: "${impermax_factories_1.IMPERMAX_FACTORY[network][factory]}", borrowBalance_not: "0"}) {
372
357
  items {
373
358
  borrowBalance
@@ -138,7 +138,7 @@ class TheGraphQueryBuilder {
138
138
  network;
139
139
  factory;
140
140
  return (0, graphql_tag_1.default) `{
141
- users(first: 1000, where: { borrowPositions_: { borrowBalance_gt: "0", id_not: "0x0000000000000000000000000000000000000000" } }) {
141
+ users(first: 1000, where: { id_not: "0x0000000000000000000000000000000000000000" } ) {
142
142
  id
143
143
  positions(first: 1000) {
144
144
  id
@@ -345,19 +345,6 @@ class TheGraphQueryBuilder {
345
345
  }
346
346
  }
347
347
  }
348
- supplyPositions(first:1000, where: { balance_gt: "0" }) {
349
- balance
350
- lastExchangeRate
351
- cumulativeEarnings
352
- borrowable {
353
- underlying {
354
- id
355
- }
356
- lendingPool {
357
- id
358
- }
359
- }
360
- }
361
348
  borrowPositions(first:1000, where: { borrowBalance_gt: "0" }) {
362
349
  borrowBalance
363
350
  borrowIndex
@@ -31,7 +31,7 @@ export default class Onchain {
31
31
  multicall: OnchainMulticall;
32
32
  protected stakingModule: OnchainStakingModule;
33
33
  constructor(cfg: OnchainConfig);
34
- cleanCache(): void;
34
+ cleanCache(): Promise<void>;
35
35
  setPriceInverted(priceInverted: boolean): void;
36
36
  getOffchain: () => Offchain;
37
37
  getContractHelper: () => OnchainContractsHelper;
@@ -46,7 +46,7 @@ class Onchain {
46
46
  // Using default settings, See OnchainMulticall constructor
47
47
  this.multicall = new onchainMulticall_1.default(multicall);
48
48
  }
49
- cleanCache() {
49
+ async cleanCache() {
50
50
  for (const factory in this.factories) {
51
51
  this.factories[factory].cleanCache();
52
52
  }
@@ -54,10 +54,10 @@ class Onchain {
54
54
  this.lendingVaults[address].cleanCache();
55
55
  }
56
56
  for (const address in this.accounts) {
57
- this.accounts[address].cleanCache();
57
+ await this.accounts[address].cleanCache();
58
58
  }
59
59
  for (const address in this.interactions) {
60
- this.interactions[address].cleanCache();
60
+ await this.interactions[address].cleanCache();
61
61
  }
62
62
  this.stakingModule?.cleanCache();
63
63
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impermax-sdk",
3
- "version": "2.1.566",
3
+ "version": "2.1.568",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",