impermax-sdk 2.1.332 → 2.1.333

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.
@@ -17,15 +17,16 @@ class OffchainPriceHelper {
17
17
  cleanCache() {
18
18
  this.apiTokens = null;
19
19
  this.apiTokensInitialized = null;
20
+ this.offchainPriceHelperV1.cleanCache();
20
21
  }
21
22
  /**
22
23
  * NOTE: Used as a fallback at the moment while we deprecate the old price helper
23
24
  */
24
25
  async getTokenPriceOld(network, tokenAddress) {
26
+ // Initializes v1 prices once if necessary
25
27
  const price = await this.offchainPriceHelperV1.getDebankTokenPrice(network, tokenAddress);
26
- if (price === 0) {
27
- console.log("Missing price for token: %s", network.concat("-", tokenAddress));
28
- }
28
+ if (price === 0)
29
+ console.log("Missing price: ", network, tokenAddress);
29
30
  return price;
30
31
  }
31
32
  /* -----------------------------------------------------------------------
@@ -61,13 +62,10 @@ class OffchainPriceHelper {
61
62
  async getTokenPrice(network, tokenAddress) {
62
63
  // Initialize tokens if necessary
63
64
  const apiData = await this.getTokenPrices();
64
- // Not supported
65
- const chainId = chainId_1.CHAIN_IDS[network];
66
- if (!chainId)
67
- return 0;
68
65
  // Our price aggregator stores tokens as `chainId-tokenAddress`
69
66
  // in case diff tokens have same address on diff networks
70
- const key = `${chainId}-${tokenAddress.toLowerCase()}`;
67
+ const key = `${chainId_1.CHAIN_IDS[network]}-${tokenAddress.toLowerCase()}`;
68
+ // First try get token price from our price-aggregator
71
69
  const token = apiData?.tokens[key];
72
70
  if (token)
73
71
  return parseFloat(token.derivedUSD);
@@ -88,7 +88,7 @@ class PonderQueryBuilder {
88
88
  return (0, graphql_tag_1.default) `{
89
89
  user(id: "${account.toLowerCase()}") {
90
90
  id
91
- positions(where: { factoryId: "${impermax_factories_1.IMPERMAX_FACTORY[network][factory]}" }) {
91
+ positions(limit: 1000, where: { factoryId: "${impermax_factories_1.IMPERMAX_FACTORY[network][factory]}" }) {
92
92
  items {
93
93
  id
94
94
  tokenId
@@ -455,7 +455,7 @@ class PonderQueryBuilder {
455
455
  nftlpsQuery(extension, network) {
456
456
  if (extension === types_1.Extension.UniswapV3) {
457
457
  return (0, graphql_tag_1.default) `{
458
- nftlps {
458
+ nftlps(limit: 1000) {
459
459
  items {
460
460
  id
461
461
  dexFactory
@@ -482,7 +482,7 @@ class PonderQueryBuilder {
482
482
  nftlpPositionQuery(lendingPoolId, tokenId) {
483
483
  const id = `${lendingPoolId}-${tokenId}`;
484
484
  return (0, graphql_tag_1.default) `{
485
- nftlpPositions(where: { id: "${id}" }) {
485
+ nftlpPositions(limit: 1000, where: { id: "${id}" }) {
486
486
  items {
487
487
  liquidity
488
488
  fee
@@ -514,17 +514,23 @@ class PonderQueryBuilder {
514
514
  *-----------------------------*/
515
515
  borrowersListQueryV2() {
516
516
  return (0, graphql_tag_1.default) `{
517
- borrowPositions(where: {borrowBalance_not: "0"}) {
518
- items {
519
- user {
520
- id
517
+ borrowPositions(limit: 1000, where: {borrowBalance_not: "0"}) {
518
+ items {
519
+ user {
520
+ id
521
+ }
521
522
  }
522
- }
523
- }
524
- _meta {
525
- status
526
- }
527
- }`;
523
+ pageInfo {
524
+ startCursor
525
+ endCursor
526
+ hasPreviousPage
527
+ hasNextPage
528
+ }
529
+ }
530
+ _meta {
531
+ status
532
+ }
533
+ }`;
528
534
  }
529
535
  }
530
536
  exports.PonderQueryBuilder = PonderQueryBuilder;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impermax-sdk",
3
- "version": "2.1.332",
3
+ "version": "2.1.333",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",