impermax-sdk 2.1.549 → 2.1.550

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.
@@ -81,8 +81,8 @@ class OffchainAccountNftlpGenericCL extends offchainAccountNftlp_1.default {
81
81
  priceB: await this.getPriceB(tokenId),
82
82
  safetyMargin: await this.getLendingPool().getSafetyMargin(),
83
83
  liquidationPenalty: await this.getLendingPool().getLiquidationPenalty(),
84
- borrowableX: await this.getNftlp().getLendingPool().getBorrowableA().createBorrowableObject(),
85
- borrowableY: await this.getNftlp().getLendingPool().getBorrowableB().createBorrowableObject(),
84
+ borrowableX: await this.getNftlp().getLendingPool().getBorrowableA().createBorrowableObject(false, true),
85
+ borrowableY: await this.getNftlp().getLendingPool().getBorrowableB().createBorrowableObject(false, true),
86
86
  fullRangeRate: await this.getNftlp().getFullRangeRate(await this.getTickSpacing(tokenId)),
87
87
  cumulativeDepositX: await this.getCumulativeDeposit0(tokenId),
88
88
  cumulativeDepositY: await this.getCumulativeDeposit1(tokenId),
@@ -57,7 +57,7 @@ class OffchainAccountBorrowable extends offchainAccountPoolToken_1.default {
57
57
  async createBorrowablePositionObject(lockStateChange = false) {
58
58
  return new borrowablePosition_1.BorrowablePosition({
59
59
  amount: await this.getAmount(),
60
- borrowable: await this.getPoolToken().createBorrowableObject(lockStateChange),
60
+ borrowable: await this.getPoolToken().createBorrowableObject(lockStateChange, true),
61
61
  lockStateChange,
62
62
  });
63
63
  }
@@ -7,7 +7,7 @@ import { OffchainLendingVault } from "../vault";
7
7
  export default class OffchainBorrowable extends OffchainPoolToken {
8
8
  protected readonly lendingPool: OffchainLendingPool;
9
9
  protected readonly borrowable: Borrowable;
10
- createBorrowableObject(lockStateChange?: boolean): Promise<BorrowableEntity>;
10
+ createBorrowableObject(lockStateChange?: boolean, useMaxFlashAllocate?: boolean): Promise<BorrowableEntity>;
11
11
  private _accrueInterest;
12
12
  private _calculateBorrowRate;
13
13
  constructor(lendingPool: OffchainLendingPool, borrowable: Borrowable);
@@ -7,9 +7,9 @@ const utils_1 = require("../../utils");
7
7
  const offchainPoolToken_1 = __importDefault(require("../offchainPoolToken"));
8
8
  const borrowableEntity_1 = require("../../utils/borrowable/borrowableEntity");
9
9
  class OffchainBorrowable extends offchainPoolToken_1.default {
10
- async createBorrowableObject(lockStateChange = false) {
10
+ async createBorrowableObject(lockStateChange = false, useMaxFlashAllocate = false) {
11
11
  const { kinkBorrowRate } = await this._calculateBorrowRate();
12
- const maxFlashAllocate = await this.getMaxFlashAllocate();
12
+ const maxFlashAllocate = useMaxFlashAllocate ? await this.getMaxFlashAllocate() : null;
13
13
  return new borrowableEntity_1.BorrowableEntity({
14
14
  totalSupply: await this.getSupply(),
15
15
  totalBorrows: await this.getTotalBorrows(),
@@ -38,7 +38,7 @@ class OnchainBorrowable extends onchainPoolToken_1.default {
38
38
  return (underlying.toLowerCase() === weths_1.WETH[this.getLendingPool().getImpermaxFactory().getOnchain().network].toLowerCase());
39
39
  }
40
40
  async createBorrowableObject(lockStateChange = false) {
41
- return (await this.getOffchainBorrowable()).createBorrowableObject(lockStateChange);
41
+ return (await this.getOffchainBorrowable()).createBorrowableObject(lockStateChange, true);
42
42
  }
43
43
  async getAvailableToBorrow() {
44
44
  return await this.getTotalBalance();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impermax-sdk",
3
- "version": "2.1.549",
3
+ "version": "2.1.550",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",