@kamino-finance/klend-sdk 5.13.13 → 5.13.15

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.
@@ -185,6 +185,8 @@ export class DebtConfig implements AssetConfig {
185
185
  readonly mintDecimals: number;
186
186
  readonly mintTokenProgram: PublicKey;
187
187
  assetReserveConfigParams: AssetReserveConfigParams;
188
+ borrowLimitOutsideElevationGroup?: Decimal;
189
+ debtWithdrawalCapConfigCapacity?: Decimal;
188
190
 
189
191
  constructor(fields: {
190
192
  mint: PublicKey;
@@ -193,11 +195,15 @@ export class DebtConfig implements AssetConfig {
193
195
  mintDecimals: number;
194
196
  priceFeed: PriceFeed;
195
197
  borrowRateCurve: BorrowRateCurve;
198
+ borrowLimitOutsideElevationGroup?: Decimal;
199
+ debtWithdrawalCapConfigCapacity?: Decimal;
196
200
  }) {
197
201
  this.mint = fields.mint;
198
202
  this.tokenName = fields.tokenName;
199
203
  this.mintDecimals = fields.mintDecimals;
200
204
  this.mintTokenProgram = fields.mintTokenProgram;
205
+ this.borrowLimitOutsideElevationGroup = fields.borrowLimitOutsideElevationGroup;
206
+ this.debtWithdrawalCapConfigCapacity = fields.debtWithdrawalCapConfigCapacity;
201
207
 
202
208
  // TODO: verify defaults and ensure opinionated
203
209
  this.assetReserveConfigParams = DefaultConfigParams;
@@ -214,6 +220,8 @@ export class DebtConfig implements AssetConfig {
214
220
  configParams: this.assetReserveConfigParams,
215
221
  mintDecimals: this.mintDecimals,
216
222
  tokenName: this.tokenName,
223
+ borrowLimitOutsideElevationGroup: this.borrowLimitOutsideElevationGroup,
224
+ debtWithdrawalCapConfigCapacity: this.debtWithdrawalCapConfigCapacity,
217
225
  });
218
226
  }
219
227
  }
@@ -285,6 +293,8 @@ function buildReserveConfig(fields: {
285
293
  configParams: AssetReserveConfigParams;
286
294
  mintDecimals: number;
287
295
  tokenName: string;
296
+ borrowLimitOutsideElevationGroup?: Decimal;
297
+ debtWithdrawalCapConfigCapacity?: Decimal;
288
298
  }): ReserveConfig {
289
299
  const reserveConfigFields: ReserveConfigFields = {
290
300
  status: 0,
@@ -323,13 +333,17 @@ function buildReserveConfig(fields: {
323
333
  } as TokenInfo,
324
334
  borrowRateCurve: fields.configParams.borrowRateCurve,
325
335
  depositWithdrawalCap: new WithdrawalCaps({
326
- configCapacity: new BN(0),
336
+ configCapacity: new BN(
337
+ numberToLamportsDecimal(fields.configParams.depositLimit ?? new Decimal(0), fields.mintDecimals).floor().toString()
338
+ ),
327
339
  currentTotal: new BN(0),
328
340
  lastIntervalStartTimestamp: new BN(0),
329
341
  configIntervalLengthSeconds: new BN(0),
330
342
  }),
331
343
  debtWithdrawalCap: new WithdrawalCaps({
332
- configCapacity: new BN(0),
344
+ configCapacity: new BN(
345
+ numberToLamportsDecimal(fields.debtWithdrawalCapConfigCapacity ?? new Decimal(0), fields.mintDecimals).floor().toString()
346
+ ),
333
347
  currentTotal: new BN(0),
334
348
  lastIntervalStartTimestamp: new BN(0),
335
349
  configIntervalLengthSeconds: new BN(0),
@@ -342,7 +356,9 @@ function buildReserveConfig(fields: {
342
356
  utilizationLimitBlockBorrowingAbovePct: 0,
343
357
  hostFixedInterestRateBps: 0,
344
358
  autodeleverageEnabled: 0,
345
- borrowLimitOutsideElevationGroup: new BN(0),
359
+ borrowLimitOutsideElevationGroup: new BN(
360
+ numberToLamportsDecimal(fields.borrowLimitOutsideElevationGroup ?? new Decimal(0), fields.mintDecimals).floor().toString()
361
+ ),
346
362
  borrowLimitAgainstThisCollateralInElevationGroup: Array(32).fill(new BN(0)),
347
363
  deleveragingBonusIncreaseBpsPerDay: new BN(100),
348
364
  reserved1: Array(1).fill(0),