impermax-sdk 2.1.22 → 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.
- package/lib/index.d.ts +2 -2
- package/lib/index.js +2 -1
- package/lib/offchain/account/lendingPool/offchainAccountLendingPool.js +2 -0
- package/lib/offchain/queries/apis/ponder/index.d.ts +1 -0
- package/lib/offchain/queries/apis/ponder/index.js +48 -0
- package/lib/offchain/queries/apis/thegraph/index.d.ts +1 -0
- package/lib/offchain/queries/apis/thegraph/index.js +13 -5
- package/lib/offchain/queries/interfaces/query-builder.d.ts +1 -0
- package/lib/onchain/impermaxFactory/onchainImpermaxFactoryV2.js +1 -1
- package/lib/onchain/impermaxFactory/onchainImpermaxFactoryV3.js +1 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ import { BORROW_FEE_FACTORIES, LIQUIDATION_FEE_FACTORIES, OLD_KINK_MULTIPLIER_FA
|
|
|
18
18
|
import { FarmIndex, Farms, getFarmByStakedLPFactory, hrFarms, STAKED_LP_FACTORY } from './config/farms';
|
|
19
19
|
import { APPROVE_AMOUNT, DEADLINE, NOT_SYNCED, ZERO } from './config/general';
|
|
20
20
|
import { BLOCKS_SUBGRAPH_URL, IMPERMAX_CHEF_SUBGRAPH_URL, IMPERMAX_SUBGRAPH_URL, XIMX_SUBGRAPH_URL } from './config/subgraphs';
|
|
21
|
-
import { Address, AddressIndex, AmmIndex, DistributorDetails, Factory, FactoryIndex, LendingPoolIndex, NetworkFactoryIndex, NetworkIndex, Networks, PoolTokenType, ProposalState, WhitelistState, VaultType } from './config/types';
|
|
21
|
+
import { Address, AddressIndex, AmmIndex, DistributorDetails, Factory, FactoryIndex, LendingPoolIndex, NetworkFactoryIndex, NetworkIndex, Networks, PoolTokenType, ProposalState, WhitelistState, VaultType, Borrowable } from './config/types';
|
|
22
22
|
import { AirdropData, ApprovalType, Changes, Contract, OnchainConfig, NO_CHANGES, PendingRewardUI, PermitData, Values, CollateralConfig, BorrowableConfig, PairConfig, Permits, Permit, PermitType } from './onchain/onchainTypes';
|
|
23
23
|
import { BorrowableData, BorrowablePastData, BorrowPosition, CollateralData, CollateralPosition, FarmingPoolData, LendingPoolData, LendingPoolPastData, PairData, PoolTokenData, RewardData, SupplyPosition, TokenData, TvlData, UserData, XimxData, LendingVaultData, VaultPosition, PairConfigData, ProposalData, ProposalMetadata } from './offchain/offchainTypes';
|
|
24
24
|
import { OffchainBorrowable, OffchainCollateral } from './offchain/lendingPool';
|
|
@@ -36,4 +36,4 @@ import OffchainVault, { OffchainLendingVault, OffchainLeveragedVault, OffchainHe
|
|
|
36
36
|
import { SortDirection, VaultListOrderBy, VaultListParams, LendingPoolListParams, LendingPoolListOrderBy } from "./offchain/offchainMultichain";
|
|
37
37
|
import { VaultRisk } from "./offchain/vault/offchainVault";
|
|
38
38
|
import { LendingPoolVersion } from "./offchain/lendingPool/offchainLendingPool";
|
|
39
|
-
export { offchain, OffchainMultichain, Offchain, OffchainLendingPool, OffchainPoolToken, OffchainCollateral, OffchainBorrowable, OffchainVault, OffchainLeveragedVault, OffchainLendingVault, OffchainHedgedVault, OffchainConfigManager, OffchainPairConfig, OffchainProposal, OffchainMultichainAccount, OffchainAccount, OffchainAccountLendingPool, OffchainAccountPoolToken, OffchainAccountCollateral, OffchainAccountBorrowable, OffchainLeveragedPosition, OffchainAccountVault, OffchainPriceHelper, OffchainSolidexHelper, PoolTokenData, BorrowableData, CollateralData, BorrowablePastData, TokenData, RewardData, PairData, FarmingPoolData, LendingPoolPastData, LendingPoolData, CollateralPosition, SupplyPosition, BorrowPosition, UserData, TvlData, XimxData, LendingVaultData, VaultPosition, PairConfigData, ProposalData, ProposalMetadata, VaultRisk, VaultType, onchain, Onchain, OnchainLendingPool, OnchainPoolToken, OnchainBorrowable, OnchainCollateral, OnchainLendingVault, OnchainConfigManager, OnchainProposal, OnchainPairConfig, OnchainAccount, OnchainAccountLendingPool, OnchainAccountPoolToken, OnchainAccountBorrowable, OnchainAccountCollateral, OnchainAccountLendingVault, OnchainContractsHelper, OnchainImpermaxFactory, OnchainInteractions, OnchainInteractionsLendingPool, OnchainInteractionsPoolToken, OnchainInteractionsCollateral, OnchainInteractionsBorrowable, OnchainInteractionsLendingVault, OnchainInteractionsConfigManager, Contract, ApprovalType, PermitData, OnchainConfig, Changes, NO_CHANGES, Values, AirdropData, PendingRewardUI, CollateralConfig, BorrowableConfig, PairConfig, CLAIM_AGGREGATOR, IMPERMAX_CHEF, IMX, IMPERMAX_FACTORY, getNetworkFactories, LENDING_VAULT_WATCHER, MERKLE_DISTRIBUTOR_IBEX, MERKLE_DISTRIBUTOR_IBEX_2, MERKLE_DISTRIBUTOR_ETH, ROUTER, SIMPLE_UNISWAP_ORACLE, WETH, MERKLE_URL_ETH, MERKLE_URL_IBEX, MERKLE_URL_IBEX_2, hrAmms, AMM_FACTORY, getAmmByFactory, AMM_SUBGRAPH_URLS, ADD_LIQUIDITY_URLS, AMM_LP_FEE, DEBANK_IDS, ETH_SYMBOL, ETH_NAME, SOLIDEX_FACTORIES, BORROW_FEE_FACTORIES, OLD_KINK_MULTIPLIER_FACTORIES, LIQUIDATION_FEE_FACTORIES, V2_FACTORIES, Farms, hrFarms, FarmIndex, STAKED_LP_FACTORY, getFarmByStakedLPFactory, NOT_SYNCED, DEADLINE, ZERO, APPROVE_AMOUNT, IMPERMAX_SUBGRAPH_URL, IMPERMAX_CHEF_SUBGRAPH_URL, BLOCKS_SUBGRAPH_URL, XIMX_SUBGRAPH_URL, Networks, Factory, PoolTokenType, Amms, Address, NetworkIndex, FactoryIndex, AddressIndex, NetworkFactoryIndex, LendingPoolIndex, AmmIndex, DistributorDetails, ProposalState, WhitelistState, VaultListOrderBy, VaultListParams, LendingPoolListOrderBy, LendingPoolListParams, SortDirection, LendingPoolVersion, PermitType, Permits, Permit, };
|
|
39
|
+
export { offchain, OffchainMultichain, Offchain, OffchainLendingPool, OffchainPoolToken, OffchainCollateral, OffchainBorrowable, OffchainVault, OffchainLeveragedVault, OffchainLendingVault, OffchainHedgedVault, OffchainConfigManager, OffchainPairConfig, OffchainProposal, OffchainMultichainAccount, OffchainAccount, OffchainAccountLendingPool, OffchainAccountPoolToken, OffchainAccountCollateral, OffchainAccountBorrowable, OffchainLeveragedPosition, OffchainAccountVault, OffchainPriceHelper, OffchainSolidexHelper, PoolTokenData, BorrowableData, CollateralData, BorrowablePastData, TokenData, RewardData, PairData, FarmingPoolData, LendingPoolPastData, LendingPoolData, CollateralPosition, SupplyPosition, BorrowPosition, UserData, TvlData, XimxData, LendingVaultData, VaultPosition, PairConfigData, ProposalData, ProposalMetadata, VaultRisk, VaultType, onchain, Onchain, OnchainLendingPool, OnchainPoolToken, OnchainBorrowable, OnchainCollateral, OnchainLendingVault, OnchainConfigManager, OnchainProposal, OnchainPairConfig, OnchainAccount, OnchainAccountLendingPool, OnchainAccountPoolToken, OnchainAccountBorrowable, OnchainAccountCollateral, OnchainAccountLendingVault, OnchainContractsHelper, OnchainImpermaxFactory, OnchainInteractions, OnchainInteractionsLendingPool, OnchainInteractionsPoolToken, OnchainInteractionsCollateral, OnchainInteractionsBorrowable, OnchainInteractionsLendingVault, OnchainInteractionsConfigManager, Contract, ApprovalType, PermitData, OnchainConfig, Changes, NO_CHANGES, Values, AirdropData, PendingRewardUI, CollateralConfig, BorrowableConfig, PairConfig, CLAIM_AGGREGATOR, IMPERMAX_CHEF, IMX, IMPERMAX_FACTORY, getNetworkFactories, LENDING_VAULT_WATCHER, MERKLE_DISTRIBUTOR_IBEX, MERKLE_DISTRIBUTOR_IBEX_2, MERKLE_DISTRIBUTOR_ETH, ROUTER, SIMPLE_UNISWAP_ORACLE, WETH, MERKLE_URL_ETH, MERKLE_URL_IBEX, MERKLE_URL_IBEX_2, hrAmms, AMM_FACTORY, getAmmByFactory, AMM_SUBGRAPH_URLS, ADD_LIQUIDITY_URLS, AMM_LP_FEE, DEBANK_IDS, ETH_SYMBOL, ETH_NAME, SOLIDEX_FACTORIES, BORROW_FEE_FACTORIES, OLD_KINK_MULTIPLIER_FACTORIES, LIQUIDATION_FEE_FACTORIES, V2_FACTORIES, Farms, hrFarms, FarmIndex, STAKED_LP_FACTORY, getFarmByStakedLPFactory, NOT_SYNCED, DEADLINE, ZERO, APPROVE_AMOUNT, IMPERMAX_SUBGRAPH_URL, IMPERMAX_CHEF_SUBGRAPH_URL, BLOCKS_SUBGRAPH_URL, XIMX_SUBGRAPH_URL, Networks, Factory, PoolTokenType, Amms, Address, NetworkIndex, FactoryIndex, AddressIndex, NetworkFactoryIndex, LendingPoolIndex, AmmIndex, DistributorDetails, ProposalState, WhitelistState, VaultListOrderBy, VaultListParams, LendingPoolListOrderBy, LendingPoolListParams, SortDirection, LendingPoolVersion, PermitType, Permits, Permit, Borrowable };
|
package/lib/index.js
CHANGED
|
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.OnchainInteractionsLendingVault = exports.OnchainInteractionsBorrowable = exports.OnchainInteractionsCollateral = exports.OnchainInteractionsPoolToken = exports.OnchainInteractionsLendingPool = exports.OnchainInteractions = exports.OnchainImpermaxFactory = exports.OnchainContractsHelper = exports.OnchainAccountLendingVault = exports.OnchainAccountCollateral = exports.OnchainAccountBorrowable = exports.OnchainAccountPoolToken = exports.OnchainAccountLendingPool = exports.OnchainAccount = exports.OnchainPairConfig = exports.OnchainProposal = exports.OnchainConfigManager = exports.OnchainLendingVault = exports.OnchainCollateral = exports.OnchainBorrowable = exports.OnchainPoolToken = exports.OnchainLendingPool = exports.Onchain = exports.onchain = exports.VaultType = exports.VaultRisk = exports.OffchainSolidexHelper = exports.OffchainPriceHelper = exports.OffchainAccountVault = exports.OffchainLeveragedPosition = exports.OffchainAccountBorrowable = exports.OffchainAccountCollateral = exports.OffchainAccountPoolToken = exports.OffchainAccountLendingPool = exports.OffchainAccount = exports.OffchainMultichainAccount = exports.OffchainProposal = exports.OffchainPairConfig = exports.OffchainConfigManager = exports.OffchainHedgedVault = exports.OffchainLendingVault = exports.OffchainLeveragedVault = exports.OffchainVault = exports.OffchainBorrowable = exports.OffchainCollateral = exports.OffchainPoolToken = exports.OffchainLendingPool = exports.Offchain = exports.OffchainMultichain = exports.offchain = void 0;
|
|
27
27
|
exports.WhitelistState = exports.ProposalState = exports.Amms = exports.PoolTokenType = exports.Factory = exports.Networks = exports.XIMX_SUBGRAPH_URL = exports.BLOCKS_SUBGRAPH_URL = exports.IMPERMAX_CHEF_SUBGRAPH_URL = exports.IMPERMAX_SUBGRAPH_URL = exports.APPROVE_AMOUNT = exports.ZERO = exports.DEADLINE = exports.NOT_SYNCED = exports.getFarmByStakedLPFactory = exports.STAKED_LP_FACTORY = exports.hrFarms = exports.Farms = exports.V2_FACTORIES = exports.LIQUIDATION_FEE_FACTORIES = exports.OLD_KINK_MULTIPLIER_FACTORIES = exports.BORROW_FEE_FACTORIES = exports.SOLIDEX_FACTORIES = exports.ETH_NAME = exports.ETH_SYMBOL = exports.DEBANK_IDS = exports.AMM_LP_FEE = exports.ADD_LIQUIDITY_URLS = exports.AMM_SUBGRAPH_URLS = exports.getAmmByFactory = exports.AMM_FACTORY = exports.hrAmms = exports.MERKLE_URL_IBEX_2 = exports.MERKLE_URL_IBEX = exports.MERKLE_URL_ETH = exports.WETH = exports.SIMPLE_UNISWAP_ORACLE = exports.ROUTER = exports.MERKLE_DISTRIBUTOR_ETH = exports.MERKLE_DISTRIBUTOR_IBEX_2 = exports.MERKLE_DISTRIBUTOR_IBEX = exports.LENDING_VAULT_WATCHER = exports.getNetworkFactories = exports.IMPERMAX_FACTORY = exports.IMX = exports.IMPERMAX_CHEF = exports.CLAIM_AGGREGATOR = exports.NO_CHANGES = exports.ApprovalType = exports.OnchainInteractionsConfigManager = void 0;
|
|
28
|
-
exports.PermitType = exports.LendingPoolVersion = exports.SortDirection = exports.LendingPoolListOrderBy = exports.VaultListOrderBy = void 0;
|
|
28
|
+
exports.Borrowable = exports.PermitType = exports.LendingPoolVersion = exports.SortDirection = exports.LendingPoolListOrderBy = exports.VaultListOrderBy = void 0;
|
|
29
29
|
const offchain_1 = __importStar(require("./offchain"));
|
|
30
30
|
exports.Offchain = offchain_1.default;
|
|
31
31
|
Object.defineProperty(exports, "OffchainAccount", { enumerable: true, get: function () { return offchain_1.OffchainAccount; } });
|
|
@@ -110,6 +110,7 @@ Object.defineProperty(exports, "PoolTokenType", { enumerable: true, get: functio
|
|
|
110
110
|
Object.defineProperty(exports, "ProposalState", { enumerable: true, get: function () { return types_1.ProposalState; } });
|
|
111
111
|
Object.defineProperty(exports, "WhitelistState", { enumerable: true, get: function () { return types_1.WhitelistState; } });
|
|
112
112
|
Object.defineProperty(exports, "VaultType", { enumerable: true, get: function () { return types_1.VaultType; } });
|
|
113
|
+
Object.defineProperty(exports, "Borrowable", { enumerable: true, get: function () { return types_1.Borrowable; } });
|
|
113
114
|
const onchainTypes_1 = require("./onchain/onchainTypes");
|
|
114
115
|
Object.defineProperty(exports, "ApprovalType", { enumerable: true, get: function () { return onchainTypes_1.ApprovalType; } });
|
|
115
116
|
Object.defineProperty(exports, "NO_CHANGES", { enumerable: true, get: function () { return onchainTypes_1.NO_CHANGES; } });
|
|
@@ -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);
|
|
@@ -110,7 +116,7 @@ class TheGraphQueryBuilder {
|
|
|
110
116
|
periodFinish
|
|
111
117
|
}
|
|
112
118
|
}`;
|
|
113
|
-
const id_in_string =
|
|
119
|
+
const id_in_string = (addressesFilter === null || addressesFilter === void 0 ? void 0 : addressesFilter.length) ? `where: {id_in: ["${addressesFilter.join('","').toLowerCase()}"]}` : "";
|
|
114
120
|
return (0, graphql_tag_1.default) `{
|
|
115
121
|
lendingPools(first: 1000, orderBy: totalBorrowsUSD, orderDirection: desc ${id_in_string}) {
|
|
116
122
|
id
|
|
@@ -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;
|
|
@@ -296,7 +304,7 @@ class TheGraphQueryBuilder {
|
|
|
296
304
|
accrualTimestamp
|
|
297
305
|
exchangeRate
|
|
298
306
|
}`;
|
|
299
|
-
const id_in_string =
|
|
307
|
+
const id_in_string = (addressesFilter === null || addressesFilter === void 0 ? void 0 : addressesFilter.length) ? `where: {id_in: ["${addressesFilter.join('","').toLowerCase()}"]}` : "";
|
|
300
308
|
return (0, graphql_tag_1.default) `{
|
|
301
309
|
lendingPools(first: 1000, orderBy: totalBorrowsUSD, orderDirection: desc, block: {number: ${blockNumber}} ${id_in_string}) {
|
|
302
310
|
id
|
|
@@ -332,7 +340,7 @@ class TheGraphQueryBuilder {
|
|
|
332
340
|
}`;
|
|
333
341
|
}
|
|
334
342
|
pastVolumeQuery(blockNumber, addressesFilter) {
|
|
335
|
-
const id_in_string =
|
|
343
|
+
const id_in_string = (addressesFilter === null || addressesFilter === void 0 ? void 0 : addressesFilter.length) ? `where: {id_in: ["${addressesFilter.join('","').toLowerCase()}"]}` : "";
|
|
336
344
|
return (0, graphql_tag_1.default) `{
|
|
337
345
|
pairs (block: {number: ${blockNumber}} ${id_in_string}) {
|
|
338
346
|
id
|
|
@@ -341,7 +349,7 @@ class TheGraphQueryBuilder {
|
|
|
341
349
|
}`;
|
|
342
350
|
}
|
|
343
351
|
currentVolumeAndReservesQuery(addressesFilter) {
|
|
344
|
-
const id_in_string =
|
|
352
|
+
const id_in_string = (addressesFilter === null || addressesFilter === void 0 ? void 0 : addressesFilter.length) ? `where: {id_in: ["${addressesFilter.join('","').toLowerCase()}"]}` : "";
|
|
345
353
|
return (0, graphql_tag_1.default) `{
|
|
346
354
|
pairs (${id_in_string}) {
|
|
347
355
|
id
|
|
@@ -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;
|
|
@@ -60,7 +60,7 @@ class OnchainImpermaxFactoryV2 extends onchainImpermaxFactory_1.default {
|
|
|
60
60
|
return __awaiter(this, void 0, void 0, function* () {
|
|
61
61
|
if (!this.cache.factoryContract) {
|
|
62
62
|
const router = this.getRouter();
|
|
63
|
-
const factoryAddress = router.methods.factory().call();
|
|
63
|
+
const factoryAddress = yield router.methods.factory().call();
|
|
64
64
|
this.cache.factoryContract = this.onchain.getContractHelper().newFactoryV2(factoryAddress);
|
|
65
65
|
}
|
|
66
66
|
return this.cache.factoryContract;
|
|
@@ -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
|
}
|