impermax-sdk 2.1.23 → 2.1.24

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.
@@ -42,6 +42,8 @@ class OffchainAccountLendingPool {
42
42
  if (!userData)
43
43
  return undefined;
44
44
  const userDataOfFactory = userData[this.lendingPool.getFactory()];
45
+ if (!userDataOfFactory)
46
+ return undefined;
45
47
  const pairAddress = this.lendingPool.getPairAddress();
46
48
  const supplyPositions = userDataOfFactory.supplyPositions[pairAddress];
47
49
  return {
@@ -4,6 +4,7 @@ export declare class PonderQueryBuilder implements IQueryBuilder {
4
4
  blockQuery(): import("graphql").DocumentNode;
5
5
  getBlockNumber(response: any, network: Networks): number;
6
6
  lendingPoolsV3Query(factory: Factory, addressesFilter: Address[], network: Networks): import("graphql").DocumentNode;
7
+ userQueryV3(account: Address, network: Networks, factory: Factory): import("graphql").DocumentNode;
7
8
  lendingPoolsQuery(factory: Factory, addressesFilter: Address[], network: Networks): import("graphql").DocumentNode;
8
9
  userQuery(account: Address, network: Networks, factory: Factory): import("graphql").DocumentNode;
9
10
  tvlQuery(): import("graphql").DocumentNode;
@@ -102,6 +102,52 @@ class PonderQueryBuilder {
102
102
  }
103
103
  }`;
104
104
  }
105
+ // WARN: Removed balance from collateralPositions
106
+ userQueryV3(account, network, factory) {
107
+ return (0, graphql_tag_1.default) `{
108
+ user(id: "${account.toLowerCase()}") {
109
+ collateralPositions(limit:1000, where: { factoryId: "${impermax_factories_1.IMPERMAX_FACTORY[network][factory]}"}) {
110
+ items {
111
+ collateral {
112
+ lendingPool {
113
+ id
114
+ }
115
+ }
116
+ }
117
+ }
118
+ supplyPositions(limit:1000, where: { factoryId: "${impermax_factories_1.IMPERMAX_FACTORY[network][factory]}"}) {
119
+ items {
120
+ balance
121
+ borrowable {
122
+ underlying {
123
+ id
124
+ }
125
+ lendingPool {
126
+ id
127
+ }
128
+ }
129
+ }
130
+ }
131
+ borrowPositions(limit:1000, where: { factoryId: "${impermax_factories_1.IMPERMAX_FACTORY[network][factory]}"}) {
132
+ items {
133
+ borrowBalance
134
+ borrowIndex
135
+ borrowable {
136
+ underlying {
137
+ id
138
+ }
139
+ lendingPool {
140
+ id
141
+ }
142
+ }
143
+ }
144
+ }
145
+ }
146
+ _meta {
147
+ status
148
+ }
149
+ }`;
150
+ }
105
151
  /*-----------------------------*
106
152
  * 2. Lending pools
107
153
  *-----------------------------*/
@@ -197,6 +243,8 @@ class PonderQueryBuilder {
197
243
  }`;
198
244
  }
199
245
  userQuery(account, network, factory) {
246
+ if (factory === types_1.Factory.V3)
247
+ return this.userQueryV3(account, network, factory);
200
248
  return (0, graphql_tag_1.default) `{
201
249
  user(id: "${account.toLowerCase()}") {
202
250
  collateralPositions(limit:1000, where: { factoryId: "${impermax_factories_1.IMPERMAX_FACTORY[network][factory]}"}) {
@@ -4,6 +4,7 @@ export declare class TheGraphQueryBuilder implements IQueryBuilder {
4
4
  blockQuery(timestamp: number): import("graphql").DocumentNode;
5
5
  getBlockNumber(response: any, network: Networks): number;
6
6
  lendingPoolsV3Query(factory: Factory, addressesFilter: Address[]): import("graphql").DocumentNode;
7
+ userQueryV3(account: Address, network: Networks, factory: Factory): import("graphql").DocumentNode;
7
8
  lendingPoolsQuery(factory: Factory, addressesFilter: Address[]): import("graphql").DocumentNode;
8
9
  userQuery(account: Address, network: Networks, factory: Factory): import("graphql").DocumentNode;
9
10
  tvlQuery(): import("graphql").DocumentNode;
@@ -32,11 +32,17 @@ class TheGraphQueryBuilder {
32
32
  return ((_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a._meta) === null || _b === void 0 ? void 0 : _b.block) === null || _c === void 0 ? void 0 : _c.number) || 0;
33
33
  }
34
34
  /*-----------------------------*
35
- * 2. Lending pools
35
+ * 2. Lending pools V3
36
36
  *-----------------------------*/
37
37
  lendingPoolsV3Query(factory, addressesFilter) {
38
38
  return (0, graphql_tag_1.default) `{}`;
39
39
  }
40
+ userQueryV3(account, network, factory) {
41
+ return (0, graphql_tag_1.default) `{}`;
42
+ }
43
+ /*-----------------------------*
44
+ * 2. Lending pools
45
+ *-----------------------------*/
40
46
  lendingPoolsQuery(factory, addressesFilter) {
41
47
  if (factory == types_1.Factory.V3)
42
48
  return this.lendingPoolsV3Query(factory, addressesFilter);
@@ -128,6 +134,8 @@ class TheGraphQueryBuilder {
128
134
  }`;
129
135
  }
130
136
  userQuery(account, network, factory) {
137
+ if (factory === types_1.Factory.V3)
138
+ return this.userQueryV3(account, network, factory);
131
139
  // Shh
132
140
  network;
133
141
  factory;
@@ -4,6 +4,7 @@ export interface IQueryBuilder {
4
4
  blockQuery(timestamp: number): DocumentNode;
5
5
  getBlockNumber: (response: any, network: Networks) => number;
6
6
  lendingPoolsV3Query(factory: Factory, addressesFilter: Address[], network: Networks): DocumentNode;
7
+ userQueryV3(account: Address, network: Networks, factory: Factory): DocumentNode;
7
8
  lendingPoolsQuery(factory: Factory, addressesFilter: Address[] | undefined, network: Networks): DocumentNode;
8
9
  userQuery(account: Address, network: Networks, factory: Factory): DocumentNode;
9
10
  tvlQuery(): DocumentNode;
@@ -70,7 +70,7 @@ class OnchainImpermaxFactoryV3 extends onchainImpermaxFactory_1.default {
70
70
  if (!routers_1.ROUTER_V3[this.onchain.network][types_1.Extension[extension]])
71
71
  continue;
72
72
  const router = this.getRouterExtension(types_1.Extension[extension]);
73
- const factoryAddress = router.methods.factory().call();
73
+ const factoryAddress = yield router.methods.factory().call();
74
74
  this.cache.factoryContract = this.onchain.getContractHelper().newFactoryV3(factoryAddress);
75
75
  break;
76
76
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impermax-sdk",
3
- "version": "2.1.23",
3
+ "version": "2.1.24",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",