@suilend/sdk 1.1.25 → 1.1.27

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/client.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { SuiClient } from "@mysten/sui/client";
2
- import { Transaction, TransactionObjectInput } from "@mysten/sui/transactions";
2
+ import { Transaction, TransactionObjectInput, TransactionResult } from "@mysten/sui/transactions";
3
3
  import { SuiPriceServiceConnection, SuiPythClient } from "@pythnetwork/pyth-sui-js";
4
4
  import { LendingMarket, ObligationOwnerCap } from "./_generated/suilend/lending-market/structs";
5
5
  import { Obligation } from "./_generated/suilend/obligation/structs";
@@ -31,37 +31,36 @@ export declare class SuilendClient {
31
31
  getObligation(obligationId: string): Promise<Obligation<string>>;
32
32
  static getLendingMarketOwnerCapId(ownerId: string, lendingMarketTypeArgs: string[], client: SuiClient): Promise<string | null>;
33
33
  getLendingMarketOwnerCapId(ownerId: string): Promise<string | null>;
34
- createReserve(lendingMarketOwnerCapId: string, transaction: Transaction, pythPriceId: string, coinType: string, createReserveConfigArgs: CreateReserveConfigArgs): Promise<import("@mysten/sui/transactions").TransactionResult>;
35
- addReward(ownerId: string, lendingMarketOwnerCapId: string, reserveArrayIndex: bigint, isDepositReward: boolean, rewardCoinType: string, rewardValue: string, startTimeMs: bigint, endTimeMs: bigint, transaction: Transaction, mergeCoins?: boolean): Promise<import("@mysten/sui/transactions").TransactionResult>;
36
- cancelReward(lendingMarketOwnerCapId: string, reserveArrayIndex: bigint, isDepositReward: boolean, rewardIndex: bigint, rewardCoinType: string, transaction: Transaction): import("@mysten/sui/transactions").TransactionResult;
37
- closeReward(lendingMarketOwnerCapId: string, reserveArrayIndex: bigint, isDepositReward: boolean, rewardIndex: bigint, rewardCoinType: string, transaction: Transaction): import("@mysten/sui/transactions").TransactionResult;
38
- claimReward(obligationOwnerCapId: string, reserveArrayIndex: bigint, rewardIndex: bigint, rewardType: string, side: Side, transaction: Transaction): import("@mysten/sui/transactions").TransactionResult;
39
- claimRewardAndDeposit(obligationId: string, rewardReserveArrayIndex: bigint, rewardIndex: bigint, rewardType: string, side: Side, depositReserveArrayIndex: bigint, transaction: Transaction): import("@mysten/sui/transactions").TransactionResult;
34
+ createReserve(lendingMarketOwnerCapId: string, transaction: Transaction, pythPriceId: string, coinType: string, createReserveConfigArgs: CreateReserveConfigArgs): Promise<TransactionResult>;
35
+ addReward(ownerId: string, lendingMarketOwnerCapId: string, reserveArrayIndex: bigint, isDepositReward: boolean, rewardCoinType: string, rewardValue: string, startTimeMs: bigint, endTimeMs: bigint, transaction: Transaction, mergeCoins?: boolean): Promise<TransactionResult>;
36
+ cancelReward(lendingMarketOwnerCapId: string, reserveArrayIndex: bigint, isDepositReward: boolean, rewardIndex: bigint, rewardCoinType: string, transaction: Transaction): TransactionResult;
37
+ closeReward(lendingMarketOwnerCapId: string, reserveArrayIndex: bigint, isDepositReward: boolean, rewardIndex: bigint, rewardCoinType: string, transaction: Transaction): TransactionResult;
38
+ claimReward(obligationOwnerCapId: string, reserveArrayIndex: bigint, rewardIndex: bigint, rewardType: string, side: Side, transaction: Transaction): TransactionResult;
39
+ claimRewardAndDeposit(obligationId: string, rewardReserveArrayIndex: bigint, rewardIndex: bigint, rewardType: string, side: Side, depositReserveArrayIndex: bigint, transaction: Transaction): TransactionResult;
40
40
  claimRewards(ownerId: string, obligationOwnerCapId: string, rewards: ClaimRewardsReward[], transaction: Transaction, isDepositing: boolean): void;
41
41
  claimRewardsAndSendToUser(ownerId: string, obligationOwnerCapId: string, rewards: ClaimRewardsReward[], transaction: Transaction): void;
42
42
  claimRewardsAndDeposit(ownerId: string, obligationOwnerCapId: string, rewards: ClaimRewardsReward[], transaction: Transaction): void;
43
43
  findReserveArrayIndex(coinType: string): bigint;
44
- updateReserveConfig(lendingMarketOwnerCapId: string, transaction: Transaction, coinType: string, createReserveConfigArgs: CreateReserveConfigArgs): import("@mysten/sui/transactions").TransactionResult;
44
+ updateReserveConfig(lendingMarketOwnerCapId: string, transaction: Transaction, coinType: string, createReserveConfigArgs: CreateReserveConfigArgs): TransactionResult;
45
45
  newObligationOwnerCap(transaction: Transaction, lendingMarketOwnerCapId: string, destinationAddress: string, obligationId: string): void;
46
- updateRateLimiterConfig(lendingMarketOwnerCapId: string, transaction: Transaction, newRateLimiterConfigArgs: CreateRateLimiterConfigArgs): import("@mysten/sui/transactions").TransactionResult;
47
- changeReservePriceFeed(lendingMarketOwnerCapId: string, coinType: string, pythPriceId: string, transaction: Transaction): Promise<import("@mysten/sui/transactions").TransactionResult>;
48
- createObligation(transaction: Transaction): import("@mysten/sui/transactions").TransactionResult;
46
+ updateRateLimiterConfig(lendingMarketOwnerCapId: string, transaction: Transaction, newRateLimiterConfigArgs: CreateRateLimiterConfigArgs): TransactionResult;
47
+ changeReservePriceFeed(lendingMarketOwnerCapId: string, coinType: string, pythPriceId: string, transaction: Transaction): Promise<TransactionResult>;
48
+ createObligation(transaction: Transaction): TransactionResult;
49
49
  refreshAll(transaction: Transaction, obligation: Obligation<string>, extraReserveArrayIndex?: bigint): Promise<void>;
50
50
  refreshReservePrices(transaction: Transaction, priceInfoObjectId: string, reserveArrayIndex: bigint): Promise<void>;
51
51
  deposit(sendCoin: TransactionObjectInput, coinType: string, obligationOwnerCap: TransactionObjectInput, transaction: Transaction): void;
52
- depositCoin(ownerId: string, sendCoin: TransactionObjectInput, coinType: string, transaction: Transaction, obligationOwnerCapId?: string): void;
53
- depositIntoObligation(ownerId: string, coinType: string, value: string, transaction: Transaction, obligationOwnerCapId?: string): Promise<void>;
52
+ depositIntoObligation(ownerId: string, coinType: string, value: string, transaction: Transaction, obligationOwnerCapId: string | TransactionResult): Promise<void>;
54
53
  depositLiquidityAndGetCTokens(ownerId: string, coinType: string, value: string, transaction: Transaction): Promise<void>;
55
- withdraw(obligationOwnerCapId: string, obligationId: string, coinType: string, value: string, transaction: Transaction): Promise<import("@mysten/sui/transactions").TransactionResult>;
56
- redeem(ctokens: TransactionObjectInput, coinType: string, exemption: TransactionObjectInput, transaction: Transaction): import("@mysten/sui/transactions").TransactionResult;
54
+ withdraw(obligationOwnerCapId: string, obligationId: string, coinType: string, value: string, transaction: Transaction): Promise<TransactionResult>;
55
+ redeem(ctokens: TransactionObjectInput, coinType: string, exemption: TransactionObjectInput, transaction: Transaction): TransactionResult;
57
56
  withdrawAndSendToUser(ownerId: string, obligationOwnerCapId: string, obligationId: string, coinType: string, value: string, transaction: Transaction): Promise<void>;
58
- borrow(obligationOwnerCapId: string, obligationId: string, coinType: string, value: string, transaction: Transaction): Promise<import("@mysten/sui/transactions").TransactionResult>;
57
+ borrow(obligationOwnerCapId: string, obligationId: string, coinType: string, value: string, transaction: Transaction): Promise<TransactionResult>;
59
58
  borrowAndSendToUser(ownerId: string, obligationOwnerCapId: string, obligationId: string, coinType: string, value: string, transaction: Transaction): Promise<void>;
60
- repay(obligationId: string, coinType: string, coin: TransactionObjectInput, transaction: Transaction): import("@mysten/sui/transactions").TransactionResult;
61
- repayIntoObligation(ownerId: string, obligationId: string, coinType: string, value: string, transaction: Transaction): Promise<import("@mysten/sui/transactions").TransactionResult>;
62
- liquidateAndRedeem(transaction: Transaction, obligation: Obligation<string>, repayCoinType: string, withdrawCoinType: string, repayCoinId: TransactionObjectInput): Promise<import("@mysten/sui/transactions").TransactionResult>;
63
- liquidate(transaction: Transaction, obligation: Obligation<string>, repayCoinType: string, withdrawCoinType: string, repayCoinId: TransactionObjectInput): Promise<import("@mysten/sui/transactions").TransactionResult>;
64
- migrate(transaction: Transaction, lendingMarketOwnerCapId: string): import("@mysten/sui/transactions").TransactionResult;
65
- claimFees(transaction: Transaction, coinType: string): import("@mysten/sui/transactions").TransactionResult;
59
+ repay(obligationId: string, coinType: string, coin: TransactionObjectInput, transaction: Transaction): TransactionResult;
60
+ repayIntoObligation(ownerId: string, obligationId: string, coinType: string, value: string, transaction: Transaction): Promise<TransactionResult>;
61
+ liquidateAndRedeem(transaction: Transaction, obligation: Obligation<string>, repayCoinType: string, withdrawCoinType: string, repayCoinId: TransactionObjectInput): Promise<TransactionResult>;
62
+ liquidate(transaction: Transaction, obligation: Obligation<string>, repayCoinType: string, withdrawCoinType: string, repayCoinId: TransactionObjectInput): Promise<TransactionResult>;
63
+ migrate(transaction: Transaction, lendingMarketOwnerCapId: string): TransactionResult;
64
+ claimFees(transaction: Transaction, coinType: string): TransactionResult;
66
65
  redeemCtokensAndWithdrawLiquidity(ownerId: string, ctokenCoinTypes: string[], transaction: Transaction): Promise<void>;
67
66
  }
package/client.js CHANGED
@@ -268,7 +268,7 @@ class SuilendClient {
268
268
  transaction.transferObjects([mergeCoin], transaction.pure.address(ownerId));
269
269
  }
270
270
  else {
271
- this.depositCoin(ownerId, mergeCoin, rewardCoinType, transaction, obligationOwnerCapId);
271
+ this.deposit(mergeCoin, rewardCoinType, obligationOwnerCapId, transaction);
272
272
  }
273
273
  }
274
274
  }
@@ -402,16 +402,6 @@ class SuilendClient {
402
402
  deposit: ctokens,
403
403
  });
404
404
  }
405
- depositCoin(ownerId, sendCoin, coinType, transaction, obligationOwnerCapId) {
406
- let createdObligationOwnerCap;
407
- if (!obligationOwnerCapId) {
408
- createdObligationOwnerCap = this.createObligation(transaction)[0];
409
- }
410
- this.deposit(sendCoin, coinType, (obligationOwnerCapId !== null && obligationOwnerCapId !== void 0 ? obligationOwnerCapId : createdObligationOwnerCap), transaction);
411
- if (createdObligationOwnerCap) {
412
- transaction.transferObjects([createdObligationOwnerCap], transaction.pure.address(ownerId));
413
- }
414
- }
415
405
  depositIntoObligation(ownerId, coinType, value, transaction, obligationOwnerCapId) {
416
406
  return __awaiter(this, void 0, void 0, function* () {
417
407
  const coins = (yield this.client.getCoins({
@@ -425,7 +415,7 @@ class SuilendClient {
425
415
  const [sendCoin] = transaction.splitCoins(isSui(coinType)
426
416
  ? transaction.gas
427
417
  : transaction.object(mergeCoin.coinObjectId), [value]);
428
- this.depositCoin(ownerId, sendCoin, coinType, transaction, obligationOwnerCapId);
418
+ this.deposit(sendCoin, coinType, obligationOwnerCapId, transaction);
429
419
  });
430
420
  }
431
421
  depositLiquidityAndGetCTokens(ownerId, coinType, value, transaction) {
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@suilend/sdk","version":"1.1.25","private":false,"description":"A TypeScript SDK for interacting with the Suilend program","author":"Suilend","license":"MIT","main":"./index.js","exports":{".":"./index.js","./client":"./client.js","./constants":"./constants.js","./types":"./types.js","./api/events":"./api/events.js","./api":"./api/index.js","./parsers/apiReserveAssetDataEvent":"./parsers/apiReserveAssetDataEvent.js","./parsers":"./parsers/index.js","./parsers/lendingMarket":"./parsers/lendingMarket.js","./parsers/obligation":"./parsers/obligation.js","./parsers/rateLimiter":"./parsers/rateLimiter.js","./parsers/reserve":"./parsers/reserve.js","./utils/events":"./utils/events.js","./utils":"./utils/index.js","./utils/obligation":"./utils/obligation.js","./utils/simulate":"./utils/simulate.js","./_generated/_framework/reified":"./_generated/_framework/reified.js","./_generated/_framework/util":"./_generated/_framework/util.js","./_generated/_framework/vector":"./_generated/_framework/vector.js","./_generated/suilend":"./_generated/suilend/index.js","./_generated/suilend/cell/structs":"./_generated/suilend/cell/structs.js","./_generated/suilend/decimal/structs":"./_generated/suilend/decimal/structs.js","./_generated/suilend/lending-market/functions":"./_generated/suilend/lending-market/functions.js","./_generated/suilend/lending-market/structs":"./_generated/suilend/lending-market/structs.js","./_generated/suilend/lending-market-registry/functions":"./_generated/suilend/lending-market-registry/functions.js","./_generated/suilend/liquidity-mining/structs":"./_generated/suilend/liquidity-mining/structs.js","./_generated/suilend/obligation/structs":"./_generated/suilend/obligation/structs.js","./_generated/suilend/rate-limiter/functions":"./_generated/suilend/rate-limiter/functions.js","./_generated/suilend/rate-limiter/structs":"./_generated/suilend/rate-limiter/structs.js","./_generated/suilend/reserve/structs":"./_generated/suilend/reserve/structs.js","./_generated/suilend/reserve-config/functions":"./_generated/suilend/reserve-config/functions.js","./_generated/suilend/reserve-config/structs":"./_generated/suilend/reserve-config/structs.js","./_generated/_dependencies/source/0x1":"./_generated/_dependencies/source/0x1/index.js","./_generated/_dependencies/source/0x2":"./_generated/_dependencies/source/0x2/index.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/index.js","./_generated/_dependencies/source/0x1/ascii/structs":"./_generated/_dependencies/source/0x1/ascii/structs.js","./_generated/_dependencies/source/0x1/option/structs":"./_generated/_dependencies/source/0x1/option/structs.js","./_generated/_dependencies/source/0x1/type-name/structs":"./_generated/_dependencies/source/0x1/type-name/structs.js","./_generated/_dependencies/source/0x2/bag/structs":"./_generated/_dependencies/source/0x2/bag/structs.js","./_generated/_dependencies/source/0x2/balance/structs":"./_generated/_dependencies/source/0x2/balance/structs.js","./_generated/_dependencies/source/0x2/object/structs":"./_generated/_dependencies/source/0x2/object/structs.js","./_generated/_dependencies/source/0x2/object-table/structs":"./_generated/_dependencies/source/0x2/object-table/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/i64/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/i64/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs.js"},"types":"./index.js","scripts":{"build":"rm -rf ./dist && bun tsc","eslint":"eslint --fix \"./src/**/*.ts\"","prettier":"prettier --write \"./src/**/*\"","lint":"bun eslint && bun prettier && bun tsc --noEmit","release":"bun run build && bun ts-node ./release.ts && cd ./dist && npm publish --access public"},"repository":{"type":"git","url":"git+https://github.com/solendprotocol/suilend-public.git"},"bugs":{"url":"https://github.com/solendprotocol/suilend-public/issues"},"dependencies":{"@mysten/bcs":"1.2.0","@mysten/sui":"1.17.0","@pythnetwork/pyth-sui-js":"^2.1.0","bignumber.js":"^9.1.2","p-limit":"3.1.0","uuid":"^11.0.3"},"devDependencies":{"ts-node":"^10.9.2"}}
1
+ {"name":"@suilend/sdk","version":"1.1.27","private":false,"description":"A TypeScript SDK for interacting with the Suilend program","author":"Suilend","license":"MIT","main":"./index.js","exports":{".":"./index.js","./client":"./client.js","./constants":"./constants.js","./types":"./types.js","./api/events":"./api/events.js","./api":"./api/index.js","./parsers/apiReserveAssetDataEvent":"./parsers/apiReserveAssetDataEvent.js","./parsers":"./parsers/index.js","./parsers/lendingMarket":"./parsers/lendingMarket.js","./parsers/obligation":"./parsers/obligation.js","./parsers/rateLimiter":"./parsers/rateLimiter.js","./parsers/reserve":"./parsers/reserve.js","./utils/events":"./utils/events.js","./utils":"./utils/index.js","./utils/obligation":"./utils/obligation.js","./utils/simulate":"./utils/simulate.js","./_generated/_framework/reified":"./_generated/_framework/reified.js","./_generated/_framework/util":"./_generated/_framework/util.js","./_generated/_framework/vector":"./_generated/_framework/vector.js","./_generated/suilend":"./_generated/suilend/index.js","./_generated/suilend/cell/structs":"./_generated/suilend/cell/structs.js","./_generated/suilend/decimal/structs":"./_generated/suilend/decimal/structs.js","./_generated/suilend/lending-market/functions":"./_generated/suilend/lending-market/functions.js","./_generated/suilend/lending-market/structs":"./_generated/suilend/lending-market/structs.js","./_generated/suilend/lending-market-registry/functions":"./_generated/suilend/lending-market-registry/functions.js","./_generated/suilend/liquidity-mining/structs":"./_generated/suilend/liquidity-mining/structs.js","./_generated/suilend/obligation/structs":"./_generated/suilend/obligation/structs.js","./_generated/suilend/rate-limiter/functions":"./_generated/suilend/rate-limiter/functions.js","./_generated/suilend/rate-limiter/structs":"./_generated/suilend/rate-limiter/structs.js","./_generated/suilend/reserve/structs":"./_generated/suilend/reserve/structs.js","./_generated/suilend/reserve-config/functions":"./_generated/suilend/reserve-config/functions.js","./_generated/suilend/reserve-config/structs":"./_generated/suilend/reserve-config/structs.js","./_generated/_dependencies/source/0x1":"./_generated/_dependencies/source/0x1/index.js","./_generated/_dependencies/source/0x2":"./_generated/_dependencies/source/0x2/index.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/index.js","./_generated/_dependencies/source/0x1/ascii/structs":"./_generated/_dependencies/source/0x1/ascii/structs.js","./_generated/_dependencies/source/0x1/option/structs":"./_generated/_dependencies/source/0x1/option/structs.js","./_generated/_dependencies/source/0x1/type-name/structs":"./_generated/_dependencies/source/0x1/type-name/structs.js","./_generated/_dependencies/source/0x2/bag/structs":"./_generated/_dependencies/source/0x2/bag/structs.js","./_generated/_dependencies/source/0x2/balance/structs":"./_generated/_dependencies/source/0x2/balance/structs.js","./_generated/_dependencies/source/0x2/object/structs":"./_generated/_dependencies/source/0x2/object/structs.js","./_generated/_dependencies/source/0x2/object-table/structs":"./_generated/_dependencies/source/0x2/object-table/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/i64/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/i64/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs.js"},"types":"./index.js","scripts":{"build":"rm -rf ./dist && bun tsc","eslint":"eslint --fix \"./src/**/*.ts\"","prettier":"prettier --write \"./src/**/*\"","lint":"bun eslint && bun prettier && bun tsc --noEmit","release":"bun run build && bun ts-node ./release.ts && cd ./dist && npm publish --access public"},"repository":{"type":"git","url":"git+https://github.com/solendprotocol/suilend-public.git"},"bugs":{"url":"https://github.com/solendprotocol/suilend-public/issues"},"dependencies":{"@mysten/bcs":"1.2.0","@mysten/sui":"1.17.0","@pythnetwork/pyth-sui-js":"^2.1.0","bignumber.js":"^9.1.2","p-limit":"3.1.0","uuid":"^11.0.3"},"devDependencies":{"ts-node":"^10.9.2"}}
@@ -12,7 +12,7 @@ export declare const parseLendingMarket: (lendingMarket: LendingMarket<string>,
12
12
  openLtvPct: number;
13
13
  closeLtvPct: number;
14
14
  maxCloseLtvPct: number;
15
- borrowWeightBps: number;
15
+ borrowWeightBps: BigNumber;
16
16
  depositLimit: BigNumber;
17
17
  borrowLimit: BigNumber;
18
18
  liquidationBonusBps: number;
@@ -32,7 +32,7 @@ export declare const parseObligation: (obligation: Obligation<string>, parsedRes
32
32
  openLtvPct: number;
33
33
  closeLtvPct: number;
34
34
  maxCloseLtvPct: number;
35
- borrowWeightBps: number;
35
+ borrowWeightBps: BigNumber;
36
36
  depositLimit: BigNumber;
37
37
  borrowLimit: BigNumber;
38
38
  liquidationBonusBps: number;
@@ -149,7 +149,7 @@ export declare const parseObligation: (obligation: Obligation<string>, parsedRes
149
149
  openLtvPct: number;
150
150
  closeLtvPct: number;
151
151
  maxCloseLtvPct: number;
152
- borrowWeightBps: number;
152
+ borrowWeightBps: BigNumber;
153
153
  depositLimit: BigNumber;
154
154
  borrowLimit: BigNumber;
155
155
  liquidationBonusBps: number;
@@ -62,10 +62,11 @@ const parseObligation = (obligation, parsedReserveMap) => {
62
62
  const borrowInterestIndex = reserve.cumulativeBorrowRate.div(cumulativeBorrowRate);
63
63
  const borrowedAmount = borrowedAmountInitial.times(borrowInterestIndex);
64
64
  const borrowedAmountUsd = borrowedAmount.times(reserve.price);
65
- const borrowWeight = reserve.config.borrowWeightBps / 10000;
66
65
  totalBorrowedAmountUsd = totalBorrowedAmountUsd.plus(borrowedAmountUsd);
67
- weightedBorrowsUsd = weightedBorrowsUsd.plus(borrowedAmountUsd.times(borrowWeight));
68
- maxPriceWeightedBorrowsUsd = maxPriceWeightedBorrowsUsd.plus(borrowedAmount.times(reserve.maxPrice).times(borrowWeight));
66
+ weightedBorrowsUsd = weightedBorrowsUsd.plus(borrowedAmountUsd.times(reserve.config.borrowWeightBps.div(10000)));
67
+ maxPriceWeightedBorrowsUsd = maxPriceWeightedBorrowsUsd.plus(borrowedAmount
68
+ .times(reserve.maxPrice)
69
+ .times(reserve.config.borrowWeightBps.div(10000)));
69
70
  const reserveArrayIndex = borrow.reserveArrayIndex;
70
71
  const userRewardManagerIndex = Number(borrow.userRewardManagerIndex.toString());
71
72
  const userRewardManager = obligation.userRewardManagers[userRewardManagerIndex];
@@ -12,7 +12,7 @@ export declare const parseReserve: (reserve: Reserve<string>, coinMetadataMap: R
12
12
  openLtvPct: number;
13
13
  closeLtvPct: number;
14
14
  maxCloseLtvPct: number;
15
- borrowWeightBps: number;
15
+ borrowWeightBps: BigNumber;
16
16
  depositLimit: BigNumber;
17
17
  borrowLimit: BigNumber;
18
18
  liquidationBonusBps: number;
@@ -134,7 +134,7 @@ export declare const parseReserveConfig: (reserve: Reserve<string>) => {
134
134
  openLtvPct: number;
135
135
  closeLtvPct: number;
136
136
  maxCloseLtvPct: number;
137
- borrowWeightBps: number;
137
+ borrowWeightBps: BigNumber;
138
138
  depositLimit: BigNumber;
139
139
  borrowLimit: BigNumber;
140
140
  liquidationBonusBps: number;
@@ -148,7 +148,7 @@ const parseReserveConfig = (reserve) => {
148
148
  const openLtvPct = config.openLtvPct;
149
149
  const closeLtvPct = config.closeLtvPct;
150
150
  const maxCloseLtvPct = config.maxCloseLtvPct;
151
- const borrowWeightBps = Number(config.borrowWeightBps.toString());
151
+ const borrowWeightBps = (0, bignumber_js_1.default)(config.borrowWeightBps.toString());
152
152
  const depositLimit = new bignumber_js_1.default(config.depositLimit.toString()).div(10 ** mintDecimals);
153
153
  const borrowLimit = new bignumber_js_1.default(config.borrowLimit.toString()).div(10 ** mintDecimals);
154
154
  const liquidationBonusBps = Number(config.liquidationBonusBps.toString());