impermax-sdk 2.1.174 → 2.1.175

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 CHANGED
@@ -23,7 +23,7 @@ import { AirdropData, ApprovalType, Changes, Contract, OnchainConfig, NO_CHANGES
23
23
  import { BorrowableData, BorrowablePastData, BorrowPosition, CollateralData, CollateralPosition, FarmingPoolData, LendingPoolData, LendingPoolPastData, PairData, PoolTokenData, RewardData, SupplyPosition, TokenData, TvlData, UserData, XimxData, LendingVaultData, VaultPosition, PairConfigData, ProposalData, ProposalMetadata, isV3Factory } from './offchain/offchainTypes';
24
24
  import { OffchainBorrowable, OffchainCollateral } from './offchain/lendingPool';
25
25
  import OffchainConfigManager, { OffchainPairConfig, OffchainProposal } from './offchain/configManager';
26
- import OffchainAccountLendingPool, { OffchainAccountBorrowable, OffchainAccountCollateral, OffchainLeveragedPosition } from './offchain/account/lendingPool';
26
+ import OffchainAccountLendingPool, { OffchainAccountBorrowable, OffchainAccountCollateral, OffchainLeveragedPosition, OffchainAccountCollateralV2 } from './offchain/account/lendingPool';
27
27
  import { OffchainAccountVault, OffchainAccountPoolToken, OffchainMultichainAccount } from './offchain/account';
28
28
  import OnchainLendingPool, { OnchainBorrowable, OnchainCollateral } from './onchain/impermaxFactory/lendingPool';
29
29
  import OnchainConfigManager, { OnchainPairConfig, OnchainProposal } from './onchain/configManager';
@@ -47,4 +47,4 @@ import OffchainAccountNftlpUniswapV3 from './offchain/account/lendingPool/nftlp/
47
47
  import { MAX_TICK, MIN_TICK, formatPriceSqrtX96, uniV3TickToPrice } from "./utils/nftlpMath/uniswapV3General";
48
48
  import UniswapV3Position from './utils/position/uniswapV3';
49
49
  import UniswapV2Position from './utils/position/uniswapV2';
50
- 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, OnchainAccountLendingPoolV2, OnchainAccountLendingPoolV3, OnchainAccountNftlpUniswapV3, 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, UniswapV2Position, };
50
+ 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, OnchainAccountLendingPoolV2, OnchainAccountLendingPoolV3, OnchainAccountNftlpUniswapV3, 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, UniswapV2Position, OffchainAccountCollateralV2 };
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.OnchainInteractionsPoolToken = exports.OnchainInteractionsLendingPool = exports.OnchainInteractions = exports.OnchainImpermaxFactory = exports.OnchainContractsHelper = exports.OnchainAccountLendingVault = exports.OnchainAccountCollateral = exports.OnchainAccountBorrowable = exports.OnchainAccountPoolToken = exports.OnchainAccountNftlpUniswapV3 = exports.OnchainAccountLendingPoolV3 = exports.OnchainAccountLendingPoolV2 = 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.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 = exports.OnchainInteractionsLendingVault = exports.OnchainInteractionsBorrowable = exports.OnchainInteractionsCollateral = void 0;
31
- exports.UniswapV2Position = 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 = exports.Amms = exports.PoolTokenType = exports.Extension = void 0;
31
+ exports.OffchainAccountCollateralV2 = exports.UniswapV2Position = 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 = exports.Amms = exports.PoolTokenType = exports.Extension = 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; } });
@@ -134,6 +134,7 @@ exports.OffchainAccountLendingPool = lendingPool_2.default;
134
134
  Object.defineProperty(exports, "OffchainAccountBorrowable", { enumerable: true, get: function () { return lendingPool_2.OffchainAccountBorrowable; } });
135
135
  Object.defineProperty(exports, "OffchainAccountCollateral", { enumerable: true, get: function () { return lendingPool_2.OffchainAccountCollateral; } });
136
136
  Object.defineProperty(exports, "OffchainLeveragedPosition", { enumerable: true, get: function () { return lendingPool_2.OffchainLeveragedPosition; } });
137
+ Object.defineProperty(exports, "OffchainAccountCollateralV2", { enumerable: true, get: function () { return lendingPool_2.OffchainAccountCollateralV2; } });
137
138
  const account_1 = require("./offchain/account");
138
139
  Object.defineProperty(exports, "OffchainAccountVault", { enumerable: true, get: function () { return account_1.OffchainAccountVault; } });
139
140
  Object.defineProperty(exports, "OffchainAccountPoolToken", { enumerable: true, get: function () { return account_1.OffchainAccountPoolToken; } });
@@ -2,5 +2,6 @@ import OffchainAccountCollateral from "./offchainAccountCollateral";
2
2
  import OffchainAccountBorrowable from "./offchainAccountBorrowable";
3
3
  import OffchainAccountLendingPool from "./offchainAccountLendingPool";
4
4
  import OffchainLeveragedPosition from "./offchainLeveragedPosition";
5
- export { OffchainAccountBorrowable, OffchainAccountCollateral, OffchainLeveragedPosition, };
5
+ import OffchainAccountCollateralV2 from "./offchainAccountCollateralV2";
6
+ export { OffchainAccountBorrowable, OffchainAccountCollateral, OffchainLeveragedPosition, OffchainAccountCollateralV2 };
6
7
  export default OffchainAccountLendingPool;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.OffchainLeveragedPosition = exports.OffchainAccountCollateral = exports.OffchainAccountBorrowable = void 0;
6
+ exports.OffchainAccountCollateralV2 = exports.OffchainLeveragedPosition = exports.OffchainAccountCollateral = exports.OffchainAccountBorrowable = void 0;
7
7
  const offchainAccountCollateral_1 = __importDefault(require("./offchainAccountCollateral"));
8
8
  exports.OffchainAccountCollateral = offchainAccountCollateral_1.default;
9
9
  const offchainAccountBorrowable_1 = __importDefault(require("./offchainAccountBorrowable"));
@@ -11,4 +11,6 @@ exports.OffchainAccountBorrowable = offchainAccountBorrowable_1.default;
11
11
  const offchainAccountLendingPool_1 = __importDefault(require("./offchainAccountLendingPool"));
12
12
  const offchainLeveragedPosition_1 = __importDefault(require("./offchainLeveragedPosition"));
13
13
  exports.OffchainLeveragedPosition = offchainLeveragedPosition_1.default;
14
+ const offchainAccountCollateralV2_1 = __importDefault(require("./offchainAccountCollateralV2"));
15
+ exports.OffchainAccountCollateralV2 = offchainAccountCollateralV2_1.default;
14
16
  exports.default = offchainAccountLendingPool_1.default;
@@ -6,6 +6,9 @@ import { UniswapV2Position } from "../../../utils/position";
6
6
  export default class OffchainAccountCollateralV2 extends OffchainAccountPoolToken implements OffchainAccountCollateral {
7
7
  protected readonly lendingPool: OffchainAccountLendingPoolV2;
8
8
  protected readonly poolToken: OffchainCollateralV2;
9
+ protected cache: {
10
+ positionsObject?: Promise<UniswapV2Position>;
11
+ };
9
12
  constructor(lendingPool: OffchainAccountLendingPoolV2);
10
13
  getAccount: () => import("..").default;
11
14
  getLendingPool: () => OffchainAccountLendingPoolV2;
@@ -14,4 +17,6 @@ export default class OffchainAccountCollateralV2 extends OffchainAccountPoolToke
14
17
  getAmount(): Promise<number>;
15
18
  private getLiquidity;
16
19
  createPositionObject(lockStateChange?: boolean): Promise<UniswapV2Position>;
20
+ createNewPositionObject(lockStateChange?: boolean): Promise<UniswapV2Position>;
21
+ getPositionObject(): Promise<UniswapV2Position>;
17
22
  }
@@ -8,6 +8,7 @@ const position_1 = require("../../../utils/position");
8
8
  class OffchainAccountCollateralV2 extends offchainAccountPoolToken_1.default {
9
9
  constructor(lendingPool) {
10
10
  super();
11
+ this.cache = {};
11
12
  this.getAccount = () => this.getLendingPool().getAccount();
12
13
  this.getLendingPool = () => this.lendingPool;
13
14
  this.getCollateral = () => this.lendingPool.getLendingPool().getCollateral();
@@ -37,5 +38,13 @@ class OffchainAccountCollateralV2 extends offchainAccountPoolToken_1.default {
37
38
  return new position_1.UniswapV2Position(await this.getLiquidity(), await this.getLendingPool().getBorrowableA().getBorrowedAmount(), await this.getLendingPool().getBorrowableB().getBorrowedAmount(), await this.getLendingPool().getLendingPool().getMarketPrice(), await this.getLendingPool().getLendingPool().getMarketPrice(), await this.getLendingPool().getSafetyMargin(), await this.getLendingPool().getLiquidationPenalty(), lockStateChange);
38
39
  //}
39
40
  }
41
+ async createNewPositionObject(lockStateChange = false) {
42
+ return new position_1.UniswapV2Position(0, 0, 0, await this.getLendingPool().getLendingPool().getMarketPrice(), await this.getLendingPool().getLendingPool().getMarketPrice(), await this.getLendingPool().getSafetyMargin(), await this.getLendingPool().getLiquidationPenalty(), lockStateChange);
43
+ }
44
+ async getPositionObject() {
45
+ if (!this.cache.positionsObject)
46
+ this.cache.positionsObject = this.createPositionObject();
47
+ return this.cache.positionsObject;
48
+ }
40
49
  }
41
50
  exports.default = OffchainAccountCollateralV2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impermax-sdk",
3
- "version": "2.1.174",
3
+ "version": "2.1.175",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",