impermax-sdk 2.1.136 → 2.1.138
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/config/factories.d.ts +1 -0
- package/lib/config/factories.js +4 -1
- package/lib/index.d.ts +4 -1
- package/lib/index.js +7 -1
- package/lib/offchain/account/lendingPool/offchainAccountCollateralV2.d.ts +1 -0
- package/lib/offchain/account/lendingPool/offchainAccountCollateralV2.js +13 -1
- package/lib/offchain/account/lendingPool/offchainAccountCollateralV3.d.ts +0 -1
- package/lib/offchain/account/lendingPool/offchainAccountCollateralV3.js +1 -6
- package/package.json +1 -1
package/lib/config/factories.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.STABLE_FACTORIES = exports.V2_FACTORIES = exports.LIQUIDATION_FEE_FACTORIES = exports.OLD_KINK_MULTIPLIER_FACTORIES = exports.BORROW_FEE_FACTORIES = exports.SOLIDEX_FACTORIES = void 0;
|
|
3
|
+
exports.V3_FACTORIES = exports.STABLE_FACTORIES = exports.V2_FACTORIES = exports.LIQUIDATION_FEE_FACTORIES = exports.OLD_KINK_MULTIPLIER_FACTORIES = exports.BORROW_FEE_FACTORIES = exports.SOLIDEX_FACTORIES = void 0;
|
|
4
4
|
const types_1 = require("./types");
|
|
5
5
|
exports.SOLIDEX_FACTORIES = [
|
|
6
6
|
types_1.Factory.SOLV1_2,
|
|
@@ -29,3 +29,6 @@ exports.V2_FACTORIES = [
|
|
|
29
29
|
exports.STABLE_FACTORIES = [
|
|
30
30
|
types_1.Factory.SOL_STABLE,
|
|
31
31
|
];
|
|
32
|
+
exports.V3_FACTORIES = [
|
|
33
|
+
types_1.Factory.V3
|
|
34
|
+
];
|
package/lib/index.d.ts
CHANGED
|
@@ -38,9 +38,12 @@ import { VaultRisk } from "./offchain/vault/offchainVault";
|
|
|
38
38
|
import { LendingPoolVersion } from "./offchain/lendingPool/offchainLendingPool";
|
|
39
39
|
import { PositionType, AccountPosition } from "./offchain/account/offchainMultichainAccount";
|
|
40
40
|
import { OnchainInteractionsNftlpUniswapV3 } from './onchain/interactions/lendingPool/nftlp';
|
|
41
|
+
import OnchainAccountNftlpUniswapV3 from './onchain/account/lendingPool/nftlp/onchainAccountNftlpUniswapV3';
|
|
42
|
+
import OnchainAccountLendingPoolV3 from './onchain/account/lendingPool/onchainAccountLendingPoolV3';
|
|
43
|
+
import OnchainAccountLendingPoolV2 from './onchain/account/lendingPool/onchainAccountLendingPoolV2';
|
|
41
44
|
import { decimalToBalance } from './utils/ether-utils';
|
|
42
45
|
import OffchainAccountLendingPoolV3 from "./offchain/account/lendingPool/offchainAccountLendingPoolV3";
|
|
43
46
|
import OffchainAccountNftlpUniswapV3 from './offchain/account/lendingPool/nftlp/offchainAccountNftlpUniswapV3';
|
|
44
47
|
import { MAX_TICK, MIN_TICK, formatPriceSqrtX96, uniV3TickToPrice } from "./utils/nftlpMath/uniswapV3General";
|
|
45
48
|
import UniswapV3Position from './utils/nftlpMath/uniswapV3Position';
|
|
46
|
-
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, BorrowableV2Config, BorrowableV3Config, PairConfig, CLAIM_AGGREGATOR, IMPERMAX_CHEF, IMX, IMPERMAX_FACTORY, getNetworkFactories, getFactoryByAddress, 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, Extension, PoolTokenType, Amms, Address, NetworkIndex, FactoryIndex, AddressIndex, NetworkFactoryIndex, LendingPoolIndex, AmmIndex, DistributorDetails, ProposalState, WhitelistState, VaultListOrderBy, VaultListParams, LendingPoolListOrderBy, LendingPoolListParams, SortDirection, LendingPoolVersion, PositionType, AccountPosition, PermitType, Permits, Permit, Borrowable, OnchainInteractionsLendingPoolV3, OnchainInteractionsNftlpUniswapV3, decimalToBalance, OffchainAccountLendingPoolV3, OffchainAccountNftlpUniswapV3, MAX_TICK, MIN_TICK, formatPriceSqrtX96, uniV3TickToPrice, isV3Factory, UniswapV3Position };
|
|
49
|
+
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, BorrowableV2Config, BorrowableV3Config, PairConfig, CLAIM_AGGREGATOR, IMPERMAX_CHEF, IMX, IMPERMAX_FACTORY, getNetworkFactories, getFactoryByAddress, 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, Extension, PoolTokenType, Amms, Address, NetworkIndex, FactoryIndex, AddressIndex, NetworkFactoryIndex, LendingPoolIndex, AmmIndex, DistributorDetails, ProposalState, WhitelistState, VaultListOrderBy, VaultListParams, LendingPoolListOrderBy, LendingPoolListParams, SortDirection, LendingPoolVersion, PositionType, AccountPosition, PermitType, Permits, Permit, Borrowable, OnchainInteractionsLendingPoolV3, OnchainInteractionsNftlpUniswapV3, decimalToBalance, OffchainAccountLendingPoolV3, OffchainAccountNftlpUniswapV3, MAX_TICK, MIN_TICK, formatPriceSqrtX96, uniV3TickToPrice, isV3Factory, UniswapV3Position, OnchainAccountNftlpUniswapV3, OnchainAccountLendingPoolV3, OnchainAccountLendingPoolV2 };
|
package/lib/index.js
CHANGED
|
@@ -28,7 +28,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
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;
|
|
30
30
|
exports.Amms = exports.PoolTokenType = exports.Extension = 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.getFactoryByAddress = exports.getNetworkFactories = exports.IMPERMAX_FACTORY = exports.IMX = exports.IMPERMAX_CHEF = exports.CLAIM_AGGREGATOR = exports.NO_CHANGES = exports.ApprovalType = exports.OnchainInteractionsConfigManager = void 0;
|
|
31
|
-
exports.UniswapV3Position = exports.isV3Factory = exports.uniV3TickToPrice = exports.formatPriceSqrtX96 = exports.MIN_TICK = exports.MAX_TICK = exports.OffchainAccountNftlpUniswapV3 = exports.OffchainAccountLendingPoolV3 = exports.decimalToBalance = exports.OnchainInteractionsNftlpUniswapV3 = exports.OnchainInteractionsLendingPoolV3 = exports.Borrowable = exports.PermitType = exports.PositionType = exports.LendingPoolVersion = exports.SortDirection = exports.LendingPoolListOrderBy = exports.VaultListOrderBy = exports.WhitelistState = exports.ProposalState = void 0;
|
|
31
|
+
exports.OnchainAccountLendingPoolV2 = exports.OnchainAccountLendingPoolV3 = exports.OnchainAccountNftlpUniswapV3 = exports.UniswapV3Position = exports.isV3Factory = exports.uniV3TickToPrice = exports.formatPriceSqrtX96 = exports.MIN_TICK = exports.MAX_TICK = exports.OffchainAccountNftlpUniswapV3 = exports.OffchainAccountLendingPoolV3 = exports.decimalToBalance = exports.OnchainInteractionsNftlpUniswapV3 = exports.OnchainInteractionsLendingPoolV3 = exports.Borrowable = exports.PermitType = exports.PositionType = exports.LendingPoolVersion = exports.SortDirection = exports.LendingPoolListOrderBy = exports.VaultListOrderBy = exports.WhitelistState = exports.ProposalState = void 0;
|
|
32
32
|
const offchain_1 = __importStar(require("./offchain"));
|
|
33
33
|
exports.Offchain = offchain_1.default;
|
|
34
34
|
Object.defineProperty(exports, "OffchainAccount", { enumerable: true, get: function () { return offchain_1.OffchainAccount; } });
|
|
@@ -183,6 +183,12 @@ Object.defineProperty(exports, "PositionType", { enumerable: true, get: function
|
|
|
183
183
|
// Nftlp
|
|
184
184
|
const nftlp_1 = require("./onchain/interactions/lendingPool/nftlp");
|
|
185
185
|
Object.defineProperty(exports, "OnchainInteractionsNftlpUniswapV3", { enumerable: true, get: function () { return nftlp_1.OnchainInteractionsNftlpUniswapV3; } });
|
|
186
|
+
const onchainAccountNftlpUniswapV3_1 = __importDefault(require("./onchain/account/lendingPool/nftlp/onchainAccountNftlpUniswapV3"));
|
|
187
|
+
exports.OnchainAccountNftlpUniswapV3 = onchainAccountNftlpUniswapV3_1.default;
|
|
188
|
+
const onchainAccountLendingPoolV3_1 = __importDefault(require("./onchain/account/lendingPool/onchainAccountLendingPoolV3"));
|
|
189
|
+
exports.OnchainAccountLendingPoolV3 = onchainAccountLendingPoolV3_1.default;
|
|
190
|
+
const onchainAccountLendingPoolV2_1 = __importDefault(require("./onchain/account/lendingPool/onchainAccountLendingPoolV2"));
|
|
191
|
+
exports.OnchainAccountLendingPoolV2 = onchainAccountLendingPoolV2_1.default;
|
|
186
192
|
// Utils
|
|
187
193
|
const ether_utils_1 = require("./utils/ether-utils");
|
|
188
194
|
Object.defineProperty(exports, "decimalToBalance", { enumerable: true, get: function () { return ether_utils_1.decimalToBalance; } });
|
|
@@ -8,5 +8,6 @@ export default class OffchainAccountCollateralV2 extends OffchainAccountPoolToke
|
|
|
8
8
|
constructor(lendingPool: OffchainAccountLendingPoolV2);
|
|
9
9
|
getAccount: () => import("..").default;
|
|
10
10
|
getLendingPool: () => OffchainAccountLendingPoolV2;
|
|
11
|
+
private getCollateralPosition;
|
|
11
12
|
getAmount(): Promise<number>;
|
|
12
13
|
}
|
|
@@ -20,9 +20,21 @@ class OffchainAccountCollateralV2 extends offchainAccountPoolToken_1.default {
|
|
|
20
20
|
this.getLendingPool = () => this.lendingPool;
|
|
21
21
|
this.lendingPool = lendingPool;
|
|
22
22
|
}
|
|
23
|
+
getCollateralPosition() {
|
|
24
|
+
var _a;
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
const lendingPoolPosition = yield this.lendingPool.getLendingPoolPosition();
|
|
27
|
+
if (!lendingPoolPosition)
|
|
28
|
+
return undefined;
|
|
29
|
+
return (_a = lendingPoolPosition[`collateralPosition`]) === null || _a === void 0 ? void 0 : _a[0];
|
|
30
|
+
});
|
|
31
|
+
}
|
|
23
32
|
getAmount() {
|
|
24
33
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
|
|
34
|
+
const collateralPosition = yield this.getCollateralPosition();
|
|
35
|
+
if (!collateralPosition)
|
|
36
|
+
return 0;
|
|
37
|
+
return parseFloat(collateralPosition.balance);
|
|
26
38
|
});
|
|
27
39
|
}
|
|
28
40
|
}
|
|
@@ -13,6 +13,5 @@ export default class OffchainAccountCollateralV3 extends OffchainAccountCollater
|
|
|
13
13
|
getNftlp: () => OffchainAccountNftlp;
|
|
14
14
|
getAccount: () => import("..").default;
|
|
15
15
|
cleanCache(): void;
|
|
16
|
-
getDepositedUSD(tokenId: number): Promise<number>;
|
|
17
16
|
getAmount(): Promise<number>;
|
|
18
17
|
}
|
|
@@ -31,14 +31,9 @@ class OffchainAccountCollateralV3 extends offchainAccountCollateral_1.default {
|
|
|
31
31
|
cleanCache() {
|
|
32
32
|
this.collateralCache = {};
|
|
33
33
|
}
|
|
34
|
-
getDepositedUSD(tokenId) {
|
|
35
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
-
return 0;
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
34
|
getAmount() {
|
|
40
35
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
-
return
|
|
36
|
+
return 1;
|
|
42
37
|
});
|
|
43
38
|
}
|
|
44
39
|
}
|