@0dotxyz/p0-ts-sdk 2.3.3 → 2.4.0

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/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { PublicKey, SolanaJSONRPCError, ComputeBudgetProgram, SystemProgram, TransactionMessage, VersionedTransaction, Keypair, Transaction, TransactionInstruction, AddressLookupTableAccount, SYSVAR_RENT_PUBKEY, StakeProgram, LAMPORTS_PER_SOL, StakeAuthorizationLayout, SYSVAR_INSTRUCTIONS_PUBKEY, STAKE_CONFIG_ID as STAKE_CONFIG_ID$1 } from '@solana/web3.js';
2
2
  import { object, string, enums, array, assert } from 'superstruct';
3
3
  import BigNumber3, { BigNumber } from 'bignumber.js';
4
- import BN11, { BN } from 'bn.js';
4
+ import BN8, { BN } from 'bn.js';
5
5
  import Decimal3, { Decimal } from 'decimal.js';
6
6
  import { BorshCoder, BorshAccountsCoder, BorshInstructionCoder, AnchorProvider, Program } from '@coral-xyz/anchor';
7
7
  import { struct, u32, u8 } from '@solana/buffer-layout';
@@ -404,7 +404,7 @@ function bigNumberToWrappedI80F48(value) {
404
404
  let decimalValue = new Decimal(value.toString());
405
405
  const isNegative = decimalValue.isNegative();
406
406
  decimalValue = decimalValue.times(I80F48_DIVISOR);
407
- let wrappedValue = new BN11(decimalValue.round().toFixed()).toArray();
407
+ let wrappedValue = new BN8(decimalValue.round().toFixed()).toArray();
408
408
  if (wrappedValue.length < I80F48_TOTAL_BYTES) {
409
409
  const padding = Array(I80F48_TOTAL_BYTES - wrappedValue.length).fill(0);
410
410
  wrappedValue.unshift(...padding);
@@ -438,7 +438,7 @@ function toBigNumber(amount) {
438
438
  }
439
439
  function uiToNative(amount, decimals) {
440
440
  let amt = toBigNumber(amount);
441
- return new BN11(amt.times(10 ** decimals).toFixed(0, BigNumber3.ROUND_FLOOR));
441
+ return new BN8(amt.times(10 ** decimals).toFixed(0, BigNumber3.ROUND_FLOOR));
442
442
  }
443
443
  function uiToNativeBigNumber(amount, decimals) {
444
444
  let amt = toBigNumber(amount);
@@ -15779,7 +15779,7 @@ async function makePoolAddPermissionlessStakedBankIx(mfProgram, accounts, remain
15779
15779
  tokenProgram = TOKEN_PROGRAM_ID,
15780
15780
  ...optionalAccounts
15781
15781
  } = accounts;
15782
- return mfProgram.methods.lendingPoolAddBankPermissionless(args.seed ?? new BN11(0)).accounts({
15782
+ return mfProgram.methods.lendingPoolAddBankPermissionless(args.seed ?? new BN8(0)).accounts({
15783
15783
  stakedSettings,
15784
15784
  feePayer,
15785
15785
  bankMint,
@@ -15843,7 +15843,7 @@ var instructions = {
15843
15843
  var instructions_default = instructions;
15844
15844
  function serializeBankConfigOpt(bankConfigOpt) {
15845
15845
  const toWrappedI80F48 = (value) => value && bigNumberToWrappedI80F48(value);
15846
- const toBN = (value) => value && new BN11(value.toString());
15846
+ const toBN = (value) => value && new BN8(value.toString());
15847
15847
  return {
15848
15848
  assetWeightInit: toWrappedI80F48(bankConfigOpt.assetWeightInit),
15849
15849
  assetWeightMaint: toWrappedI80F48(bankConfigOpt.assetWeightMaint),
@@ -16196,16 +16196,16 @@ function bankConfigToBankConfigRaw(config) {
16196
16196
  assetWeightMaint: bigNumberToWrappedI80F48(config.assetWeightMaint),
16197
16197
  liabilityWeightInit: bigNumberToWrappedI80F48(config.liabilityWeightInit),
16198
16198
  liabilityWeightMaint: bigNumberToWrappedI80F48(config.liabilityWeightMaint),
16199
- depositLimit: new BN11(config.depositLimit.toString()),
16199
+ depositLimit: new BN8(config.depositLimit.toString()),
16200
16200
  interestRateConfig: serializeInterestRateConfig(config.interestRateConfig),
16201
16201
  operationalState: serializeOperationalState(config.operationalState),
16202
16202
  oracleSetup: serializeOracleSetup(config.oracleSetup),
16203
16203
  oracleKeys: config.oracleKeys,
16204
16204
  configFlags: config.configFlags,
16205
- borrowLimit: new BN11(config.borrowLimit.toString()),
16205
+ borrowLimit: new BN8(config.borrowLimit.toString()),
16206
16206
  riskTier: serializeRiskTier(config.riskTier),
16207
16207
  assetTag: config.assetTag,
16208
- totalAssetValueInitLimit: new BN11(config.totalAssetValueInitLimit.toString()),
16208
+ totalAssetValueInitLimit: new BN8(config.totalAssetValueInitLimit.toString()),
16209
16209
  oracleMaxAge: config.oracleMaxAge,
16210
16210
  oracleMaxConfidence: config.oracleMaxConfidence,
16211
16211
  fixedPrice: bigNumberToWrappedI80F48(config.fixedPrice)
@@ -16537,12 +16537,12 @@ function dtoToBankRaw(bankDto) {
16537
16537
  feeVaultBump: bankDto.feeVaultBump,
16538
16538
  feeVaultAuthorityBump: bankDto.feeVaultAuthorityBump,
16539
16539
  collectedGroupFeesOutstanding: bankDto.collectedGroupFeesOutstanding,
16540
- lastUpdate: new BN11(bankDto.lastUpdate),
16540
+ lastUpdate: new BN8(bankDto.lastUpdate),
16541
16541
  config: dtoToBankConfigRaw(bankDto.config),
16542
16542
  totalAssetShares: bankDto.totalAssetShares,
16543
16543
  totalLiabilityShares: bankDto.totalLiabilityShares,
16544
- flags: new BN11(bankDto.flags),
16545
- emissionsRate: new BN11(bankDto.emissionsRate),
16544
+ flags: new BN8(bankDto.flags),
16545
+ emissionsRate: new BN8(bankDto.emissionsRate),
16546
16546
  emissionsRemaining: bankDto.emissionsRemaining,
16547
16547
  emissionsMint: new PublicKey(bankDto.emissionsMint),
16548
16548
  collectedProgramFeesOutstanding: bankDto.collectedProgramFeesOutstanding,
@@ -16558,11 +16558,11 @@ function dtoToBankRaw(bankDto) {
16558
16558
  }
16559
16559
  function dtoToRateLimitWindowRaw(window) {
16560
16560
  return {
16561
- maxOutflow: new BN11(window.maxOutflow),
16562
- windowDuration: new BN11(window.windowDuration),
16563
- windowStart: new BN11(window.windowStart),
16564
- prevWindowOutflow: new BN11(window.prevWindowOutflow),
16565
- curWindowOutflow: new BN11(window.curWindowOutflow)
16561
+ maxOutflow: new BN8(window.maxOutflow),
16562
+ windowDuration: new BN8(window.windowDuration),
16563
+ windowStart: new BN8(window.windowStart),
16564
+ prevWindowOutflow: new BN8(window.prevWindowOutflow),
16565
+ curWindowOutflow: new BN8(window.curWindowOutflow)
16566
16566
  };
16567
16567
  }
16568
16568
  function dtoToBankRateLimiterRaw(rateLimiter) {
@@ -16574,8 +16574,8 @@ function dtoToBankRateLimiterRaw(rateLimiter) {
16574
16574
  function dtoToEmodeSettingsRaw(emodeSettingsDto) {
16575
16575
  return {
16576
16576
  emodeTag: emodeSettingsDto.emodeTag,
16577
- timestamp: new BN11(emodeSettingsDto.timestamp),
16578
- flags: new BN11(emodeSettingsDto.flags),
16577
+ timestamp: new BN8(emodeSettingsDto.timestamp),
16578
+ flags: new BN8(emodeSettingsDto.flags),
16579
16579
  emodeConfig: {
16580
16580
  entries: emodeSettingsDto.emodeConfig.entries.map((entry) => {
16581
16581
  return {
@@ -16594,11 +16594,11 @@ function dtoToBankConfigRaw(bankConfigDto) {
16594
16594
  assetWeightMaint: bankConfigDto.assetWeightMaint,
16595
16595
  liabilityWeightInit: bankConfigDto.liabilityWeightInit,
16596
16596
  liabilityWeightMaint: bankConfigDto.liabilityWeightMaint,
16597
- depositLimit: new BN11(bankConfigDto.depositLimit),
16598
- borrowLimit: new BN11(bankConfigDto.borrowLimit),
16597
+ depositLimit: new BN8(bankConfigDto.depositLimit),
16598
+ borrowLimit: new BN8(bankConfigDto.borrowLimit),
16599
16599
  riskTier: bankConfigDto.riskTier,
16600
16600
  operationalState: bankConfigDto.operationalState,
16601
- totalAssetValueInitLimit: new BN11(bankConfigDto.totalAssetValueInitLimit),
16601
+ totalAssetValueInitLimit: new BN8(bankConfigDto.totalAssetValueInitLimit),
16602
16602
  assetTag: bankConfigDto.assetTag,
16603
16603
  configFlags: bankConfigDto.configFlags,
16604
16604
  oracleSetup: bankConfigDto.oracleSetup,
@@ -16746,7 +16746,7 @@ function getActiveEmodeFlags(flags) {
16746
16746
  return activeFlags;
16747
16747
  }
16748
16748
  function hasEmodeFlag(flags, flag) {
16749
- return !flags.and(new BN11(flag)).isZero();
16749
+ return !flags.and(new BN8(flag)).isZero();
16750
16750
  }
16751
16751
  function getActiveEmodeEntryFlags(flags) {
16752
16752
  const activeFlags = [];
@@ -19735,8 +19735,8 @@ var mapSwbBanksToOraclePrices = (banks, swbOracleAiDataByKey, crossbarResponse)
19735
19735
  const crossbarData = crossbarResponse[oracleFeed]?.results;
19736
19736
  const timestamp = (/* @__PURE__ */ new Date()).getTime().toString();
19737
19737
  const oraclePrice = parseSwbOraclePriceData(
19738
- crossbarData ?? new BN11(oracleData.rawPrice),
19739
- new BN11(oracleData.stdev),
19738
+ crossbarData ?? new BN8(oracleData.rawPrice),
19739
+ new BN8(oracleData.stdev),
19740
19740
  timestamp,
19741
19741
  oracleData
19742
19742
  );
@@ -19762,7 +19762,7 @@ var mapBrokenFeedsToOraclePrices = (banks, swbOracleAiDataByKey, birdeyeResponse
19762
19762
  const timestamp = (/* @__PURE__ */ new Date()).getTime().toString();
19763
19763
  const oraclePrice = parseSwbOraclePriceData(
19764
19764
  [birdeyeData],
19765
- new BN11(oracleData.stdev),
19765
+ new BN8(oracleData.stdev),
19766
19766
  timestamp,
19767
19767
  oracleData
19768
19768
  );
@@ -20378,7 +20378,7 @@ var EMPTY_HEALTH_CACHE = {
20378
20378
  liabilityValue: {
20379
20379
  value: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
20380
20380
  },
20381
- timestamp: new BN11(0),
20381
+ timestamp: new BN8(0),
20382
20382
  flags: 0,
20383
20383
  prices: [],
20384
20384
  assetValueMaint: bigNumberToWrappedI80F48(new BigNumber3(0)),
@@ -20465,7 +20465,7 @@ function getActiveAccountFlags(flags) {
20465
20465
  return activeFlags;
20466
20466
  }
20467
20467
  function hasAccountFlag(flags, flag) {
20468
- return !flags.and(new BN11(flag)).isZero();
20468
+ return !flags.and(new BN8(flag)).isZero();
20469
20469
  }
20470
20470
  function getActiveHealthCacheFlags(flags) {
20471
20471
  const activeFlags = [];
@@ -20535,7 +20535,7 @@ function dtoToHealthCache(healthCacheDto) {
20535
20535
  };
20536
20536
  }
20537
20537
  function accountFlagToBN(flag) {
20538
- return new BN11(flag);
20538
+ return new BN8(flag);
20539
20539
  }
20540
20540
  function marginfiAccountToDto(marginfiAccount) {
20541
20541
  return {
@@ -35725,23 +35725,23 @@ function dtoToDriftUserStatsRaw(userStatsDto) {
35725
35725
  authority: new PublicKey(userStatsDto.authority),
35726
35726
  referrer: new PublicKey(userStatsDto.referrer),
35727
35727
  fees: {
35728
- totalFeePaid: new BN11(userStatsDto.fees.totalFeePaid),
35729
- totalFeeRebate: new BN11(userStatsDto.fees.totalFeeRebate),
35730
- totalTokenDiscount: new BN11(userStatsDto.fees.totalTokenDiscount),
35731
- totalRefereeDiscount: new BN11(userStatsDto.fees.totalRefereeDiscount),
35732
- totalReferrerReward: new BN11(userStatsDto.fees.totalReferrerReward),
35733
- currentEpochReferrerReward: new BN11(
35728
+ totalFeePaid: new BN8(userStatsDto.fees.totalFeePaid),
35729
+ totalFeeRebate: new BN8(userStatsDto.fees.totalFeeRebate),
35730
+ totalTokenDiscount: new BN8(userStatsDto.fees.totalTokenDiscount),
35731
+ totalRefereeDiscount: new BN8(userStatsDto.fees.totalRefereeDiscount),
35732
+ totalReferrerReward: new BN8(userStatsDto.fees.totalReferrerReward),
35733
+ currentEpochReferrerReward: new BN8(
35734
35734
  userStatsDto.fees.currentEpochReferrerReward
35735
35735
  )
35736
35736
  },
35737
- nextEpochTs: new BN11(userStatsDto.nextEpochTs),
35738
- makerVolume30d: new BN11(userStatsDto.makerVolume30d),
35739
- takerVolume30d: new BN11(userStatsDto.takerVolume30d),
35740
- fillerVolume30d: new BN11(userStatsDto.fillerVolume30d),
35741
- lastMakerVolume30dTs: new BN11(userStatsDto.lastMakerVolume30dTs),
35742
- lastTakerVolume30dTs: new BN11(userStatsDto.lastTakerVolume30dTs),
35743
- lastFillerVolume30dTs: new BN11(userStatsDto.lastFillerVolume30dTs),
35744
- ifStakedQuoteAssetAmount: new BN11(userStatsDto.ifStakedQuoteAssetAmount),
35737
+ nextEpochTs: new BN8(userStatsDto.nextEpochTs),
35738
+ makerVolume30d: new BN8(userStatsDto.makerVolume30d),
35739
+ takerVolume30d: new BN8(userStatsDto.takerVolume30d),
35740
+ fillerVolume30d: new BN8(userStatsDto.fillerVolume30d),
35741
+ lastMakerVolume30dTs: new BN8(userStatsDto.lastMakerVolume30dTs),
35742
+ lastTakerVolume30dTs: new BN8(userStatsDto.lastTakerVolume30dTs),
35743
+ lastFillerVolume30dTs: new BN8(userStatsDto.lastFillerVolume30dTs),
35744
+ ifStakedQuoteAssetAmount: new BN8(userStatsDto.ifStakedQuoteAssetAmount),
35745
35745
  numberOfSubAccounts: userStatsDto.numberOfSubAccounts,
35746
35746
  numberOfSubAccountsCreated: userStatsDto.numberOfSubAccountsCreated,
35747
35747
  referrerStatus: userStatsDto.referrerStatus,
@@ -35754,7 +35754,7 @@ function dtoToDriftUserStatsRaw(userStatsDto) {
35754
35754
  fuelPositions: userStatsDto.fuelPositions,
35755
35755
  fuelTaker: userStatsDto.fuelTaker,
35756
35756
  fuelMaker: userStatsDto.fuelMaker,
35757
- ifStakedGovTokenAmount: new BN11(userStatsDto.ifStakedGovTokenAmount),
35757
+ ifStakedGovTokenAmount: new BN8(userStatsDto.ifStakedGovTokenAmount),
35758
35758
  lastFuelIfBonusUpdateTs: userStatsDto.lastFuelIfBonusUpdateTs,
35759
35759
  padding: userStatsDto.padding
35760
35760
  };
@@ -35763,10 +35763,10 @@ function dtoToDriftUserRaw(userDto) {
35763
35763
  return {
35764
35764
  authority: new PublicKey(userDto.authority),
35765
35765
  spotPositions: userDto.spotPositions.map((p) => ({
35766
- scaledBalance: new BN11(p.scaledBalance),
35767
- openBids: new BN11(p.openBids),
35768
- openAsks: new BN11(p.openAsks),
35769
- cumulativeDeposits: new BN11(p.cumulativeDeposits),
35766
+ scaledBalance: new BN8(p.scaledBalance),
35767
+ openBids: new BN8(p.openBids),
35768
+ openAsks: new BN8(p.openAsks),
35769
+ cumulativeDeposits: new BN8(p.cumulativeDeposits),
35770
35770
  marketIndex: p.marketIndex,
35771
35771
  balanceType: p.balanceType,
35772
35772
  openOrders: p.openOrders,
@@ -35781,10 +35781,10 @@ function dtoToDriftRewardsRaw(rewardsDto) {
35781
35781
  spotMarket: new PublicKey(rewardsDto.spotMarket),
35782
35782
  mint: new PublicKey(rewardsDto.mint),
35783
35783
  spotPosition: {
35784
- scaledBalance: new BN11(rewardsDto.spotPosition.scaledBalance),
35785
- openBids: new BN11(rewardsDto.spotPosition.openBids),
35786
- openAsks: new BN11(rewardsDto.spotPosition.openAsks),
35787
- cumulativeDeposits: new BN11(rewardsDto.spotPosition.cumulativeDeposits),
35784
+ scaledBalance: new BN8(rewardsDto.spotPosition.scaledBalance),
35785
+ openBids: new BN8(rewardsDto.spotPosition.openBids),
35786
+ openAsks: new BN8(rewardsDto.spotPosition.openAsks),
35787
+ cumulativeDeposits: new BN8(rewardsDto.spotPosition.cumulativeDeposits),
35788
35788
  marketIndex: rewardsDto.spotPosition.marketIndex,
35789
35789
  balanceType: rewardsDto.spotPosition.balanceType,
35790
35790
  openOrders: rewardsDto.spotPosition.openOrders,
@@ -35798,11 +35798,11 @@ function dtoToDriftSpotMarketRaw(spotMarketDto) {
35798
35798
  oracle: new PublicKey(spotMarketDto.oracle),
35799
35799
  mint: new PublicKey(spotMarketDto.mint),
35800
35800
  decimals: spotMarketDto.decimals,
35801
- cumulativeDepositInterest: new BN11(spotMarketDto.cumulativeDepositInterest),
35801
+ cumulativeDepositInterest: new BN8(spotMarketDto.cumulativeDepositInterest),
35802
35802
  marketIndex: spotMarketDto.marketIndex,
35803
- depositBalance: new BN11(spotMarketDto.depositBalance),
35804
- borrowBalance: new BN11(spotMarketDto.borrowBalance),
35805
- cumulativeBorrowInterest: new BN11(spotMarketDto.cumulativeBorrowInterest),
35803
+ depositBalance: new BN8(spotMarketDto.depositBalance),
35804
+ borrowBalance: new BN8(spotMarketDto.borrowBalance),
35805
+ cumulativeBorrowInterest: new BN8(spotMarketDto.cumulativeBorrowInterest),
35806
35806
  optimalUtilization: spotMarketDto.optimalUtilization,
35807
35807
  optimalBorrowRate: spotMarketDto.optimalBorrowRate,
35808
35808
  maxBorrowRate: spotMarketDto.maxBorrowRate,
@@ -35891,10 +35891,10 @@ function decodeDriftUserData(data) {
35891
35891
  return {
35892
35892
  authority: decoded.authority,
35893
35893
  spotPositions: decoded.spot_positions.map((p) => ({
35894
- scaledBalance: new BN11(p.scaled_balance),
35895
- openBids: new BN11(p.open_bids),
35896
- openAsks: new BN11(p.open_asks),
35897
- cumulativeDeposits: new BN11(p.cumulative_deposits),
35894
+ scaledBalance: new BN8(p.scaled_balance),
35895
+ openBids: new BN8(p.open_bids),
35896
+ openAsks: new BN8(p.open_asks),
35897
+ cumulativeDeposits: new BN8(p.cumulative_deposits),
35898
35898
  marketIndex: p.market_index,
35899
35899
  balanceType: p.balance_type,
35900
35900
  openOrders: p.open_orders,
@@ -35964,7 +35964,7 @@ function deriveDriftSpotMarket(marketIndex, programId = DRIFT_PROGRAM_ID) {
35964
35964
  return PublicKey.findProgramAddressSync(
35965
35965
  [
35966
35966
  Buffer.from(SEED_SPOT_MARKET),
35967
- new BN11(marketIndex).toArrayLike(Buffer, "le", 2)
35967
+ new BN8(marketIndex).toArrayLike(Buffer, "le", 2)
35968
35968
  ],
35969
35969
  programId
35970
35970
  );
@@ -35973,7 +35973,7 @@ function deriveDriftSpotMarketVault(marketIndex, programId = DRIFT_PROGRAM_ID) {
35973
35973
  return PublicKey.findProgramAddressSync(
35974
35974
  [
35975
35975
  Buffer.from(SEED_SPOT_MARKET_VAULT),
35976
- new BN11(marketIndex).toArrayLike(Buffer, "le", 2)
35976
+ new BN8(marketIndex).toArrayLike(Buffer, "le", 2)
35977
35977
  ],
35978
35978
  programId
35979
35979
  );
@@ -36367,7 +36367,7 @@ function generateDummyAccount(group, authority, accountKey) {
36367
36367
  assetShares: dummyWrappedI80F48,
36368
36368
  liabilityShares: dummyWrappedI80F48,
36369
36369
  emissionsOutstanding: dummyWrappedI80F48,
36370
- lastUpdate: new BN11(0)
36370
+ lastUpdate: new BN8(0)
36371
36371
  });
36372
36372
  const rawAccount = {
36373
36373
  group,
@@ -36380,7 +36380,7 @@ function generateDummyAccount(group, authority, accountKey) {
36380
36380
  liabilityValue: {
36381
36381
  value: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
36382
36382
  },
36383
- timestamp: new BN11(0),
36383
+ timestamp: new BN8(0),
36384
36384
  flags: 0,
36385
36385
  prices: [],
36386
36386
  assetValueMaint: bigNumberToWrappedI80F48(new BigNumber3(0)),
@@ -36394,7 +36394,7 @@ function generateDummyAccount(group, authority, accountKey) {
36394
36394
  mrgnErr: 0
36395
36395
  },
36396
36396
  emissionsDestinationAccount: new PublicKey("11111111111111111111111111111111"),
36397
- accountFlags: new BN11([0, 0, 0])
36397
+ accountFlags: new BN8([0, 0, 0])
36398
36398
  };
36399
36399
  return parseMarginfiAccountRaw(accountKey, rawAccount);
36400
36400
  }
@@ -36427,233 +36427,63 @@ async function makeRefreshingIxs({
36427
36427
  }
36428
36428
 
36429
36429
  // src/vendor/klend/utils/klend/serialize.utils.ts
36430
- function obligationRawToDto(obligationRaw) {
36430
+ function kaminoObligationToDto(obligation) {
36431
36431
  return {
36432
- tag: obligationRaw.tag.toString(),
36433
- lastUpdate: {
36434
- slot: obligationRaw.lastUpdate.slot.toString(),
36435
- stale: obligationRaw.lastUpdate.stale,
36436
- priceStatus: obligationRaw.lastUpdate.priceStatus,
36437
- placeholder: obligationRaw.lastUpdate.placeholder
36438
- },
36439
- lendingMarket: obligationRaw.lendingMarket.toBase58(),
36440
- owner: obligationRaw.owner.toBase58(),
36441
- deposits: obligationRaw.deposits.map(
36442
- (item) => obligationCollateralToDto(item)
36443
- ),
36444
- lowestReserveDepositLiquidationLtv: obligationRaw.lowestReserveDepositLiquidationLtv.toString(),
36445
- depositedValueSf: obligationRaw.depositedValueSf.toString(),
36446
- borrows: obligationRaw.borrows.map(
36447
- (item) => obligationLiquidityToDto(item)
36448
- ),
36449
- borrowFactorAdjustedDebtValueSf: obligationRaw.borrowFactorAdjustedDebtValueSf.toString(),
36450
- borrowedAssetsMarketValueSf: obligationRaw.borrowedAssetsMarketValueSf.toString(),
36451
- allowedBorrowValueSf: obligationRaw.allowedBorrowValueSf.toString(),
36452
- unhealthyBorrowValueSf: obligationRaw.unhealthyBorrowValueSf.toString(),
36453
- depositsAssetTiers: obligationRaw.depositsAssetTiers,
36454
- borrowsAssetTiers: obligationRaw.borrowsAssetTiers,
36455
- elevationGroup: obligationRaw.elevationGroup,
36456
- numOfObsoleteDepositReserves: obligationRaw.numOfObsoleteDepositReserves,
36457
- hasDebt: obligationRaw.hasDebt,
36458
- referrer: obligationRaw.referrer.toBase58(),
36459
- borrowingDisabled: obligationRaw.borrowingDisabled,
36460
- autodeleverageTargetLtvPct: obligationRaw.autodeleverageTargetLtvPct,
36461
- lowestReserveDepositMaxLtvPct: obligationRaw.lowestReserveDepositMaxLtvPct,
36462
- numOfObsoleteBorrowReserves: obligationRaw.numOfObsoleteBorrowReserves,
36463
- reserved: obligationRaw.reserved,
36464
- highestBorrowFactorPct: obligationRaw.highestBorrowFactorPct.toString(),
36465
- autodeleverageMarginCallStartedTimestamp: obligationRaw.autodeleverageMarginCallStartedTimestamp.toString(),
36466
- orders: obligationRaw.orders.map((item) => obligationOrderToDto(item)),
36467
- padding3: obligationRaw.padding3.map((item) => item.toString())
36468
- };
36469
- }
36470
- function reserveRawToDto(reserveRaw) {
36471
- return {
36472
- version: reserveRaw.version.toString(),
36473
- lastUpdate: {
36474
- slot: reserveRaw.lastUpdate.slot.toString(),
36475
- stale: reserveRaw.lastUpdate.stale,
36476
- priceStatus: reserveRaw.lastUpdate.priceStatus,
36477
- placeholder: reserveRaw.lastUpdate.placeholder
36478
- },
36479
- lendingMarket: reserveRaw.lendingMarket.toBase58(),
36480
- farmCollateral: reserveRaw.farmCollateral.toBase58(),
36481
- farmDebt: reserveRaw.farmDebt.toBase58(),
36482
- liquidity: reserveLiquidityFieldsToDto(reserveRaw.liquidity),
36483
- reserveLiquidityPadding: reserveRaw.reserveLiquidityPadding.map(
36484
- (item) => item.toString()
36485
- ),
36486
- collateral: {
36487
- mintPubkey: reserveRaw.collateral.mintPubkey.toBase58(),
36488
- mintTotalSupply: reserveRaw.collateral.mintTotalSupply.toString(),
36489
- supplyVault: reserveRaw.collateral.supplyVault.toBase58(),
36490
- padding1: reserveRaw.collateral.padding1.map((item) => item.toString()),
36491
- padding2: reserveRaw.collateral.padding2.map((item) => item.toString())
36492
- },
36493
- reserveCollateralPadding: reserveRaw.reserveCollateralPadding.map(
36494
- (item) => item.toString()
36495
- ),
36496
- config: reserveConfigFieldsToDto(reserveRaw.config),
36497
- configPadding: reserveRaw.configPadding.map((item) => item.toString()),
36498
- borrowedAmountOutsideElevationGroup: reserveRaw.borrowedAmountOutsideElevationGroup.toString(),
36499
- borrowedAmountsAgainstThisReserveInElevationGroups: reserveRaw.borrowedAmountsAgainstThisReserveInElevationGroups.map(
36500
- (item) => item.toString()
36501
- ),
36502
- padding: reserveRaw.padding.map((item) => item.toString())
36503
- };
36504
- }
36505
- function reserveLiquidityFieldsToDto(reserveLiquidityFields) {
36506
- return {
36507
- mintPubkey: reserveLiquidityFields.mintPubkey.toBase58(),
36508
- supplyVault: reserveLiquidityFields.supplyVault.toBase58(),
36509
- feeVault: reserveLiquidityFields.feeVault.toBase58(),
36510
- availableAmount: reserveLiquidityFields.availableAmount.toString(),
36511
- borrowedAmountSf: reserveLiquidityFields.borrowedAmountSf.toString(),
36512
- marketPriceSf: reserveLiquidityFields.marketPriceSf.toString(),
36513
- marketPriceLastUpdatedTs: reserveLiquidityFields.marketPriceLastUpdatedTs.toString(),
36514
- mintDecimals: reserveLiquidityFields.mintDecimals.toString(),
36515
- depositLimitCrossedTimestamp: reserveLiquidityFields.depositLimitCrossedTimestamp.toString(),
36516
- borrowLimitCrossedTimestamp: reserveLiquidityFields.borrowLimitCrossedTimestamp.toString(),
36517
- cumulativeBorrowRateBsf: {
36518
- value: reserveLiquidityFields.cumulativeBorrowRateBsf.value.map(
36519
- (item) => item.toString()
36520
- ),
36521
- padding: reserveLiquidityFields.cumulativeBorrowRateBsf.padding.map(
36522
- (item) => item.toString()
36523
- )
36524
- },
36525
- accumulatedProtocolFeesSf: reserveLiquidityFields.accumulatedProtocolFeesSf.toString(),
36526
- accumulatedReferrerFeesSf: reserveLiquidityFields.accumulatedReferrerFeesSf.toString(),
36527
- pendingReferrerFeesSf: reserveLiquidityFields.pendingReferrerFeesSf.toString(),
36528
- absoluteReferralRateSf: reserveLiquidityFields.absoluteReferralRateSf.toString(),
36529
- tokenProgram: reserveLiquidityFields.tokenProgram.toBase58(),
36530
- padding2: reserveLiquidityFields.padding2.map((item) => item.toString()),
36531
- padding3: reserveLiquidityFields.padding3.map((item) => item.toString())
36532
- };
36533
- }
36534
- function reserveConfigFieldsToDto(reserveConfigFields) {
36535
- return {
36536
- status: reserveConfigFields.status,
36537
- assetTier: reserveConfigFields.assetTier,
36538
- hostFixedInterestRateBps: reserveConfigFields.hostFixedInterestRateBps,
36539
- reserved2: reserveConfigFields.reserved2,
36540
- protocolOrderExecutionFeePct: reserveConfigFields.protocolOrderExecutionFeePct,
36541
- protocolTakeRatePct: reserveConfigFields.protocolTakeRatePct,
36542
- protocolLiquidationFeePct: reserveConfigFields.protocolLiquidationFeePct,
36543
- loanToValuePct: reserveConfigFields.loanToValuePct,
36544
- liquidationThresholdPct: reserveConfigFields.liquidationThresholdPct,
36545
- minLiquidationBonusBps: reserveConfigFields.minLiquidationBonusBps,
36546
- maxLiquidationBonusBps: reserveConfigFields.maxLiquidationBonusBps,
36547
- badDebtLiquidationBonusBps: reserveConfigFields.badDebtLiquidationBonusBps,
36548
- deleveragingMarginCallPeriodSecs: reserveConfigFields.deleveragingMarginCallPeriodSecs.toString(),
36549
- deleveragingThresholdDecreaseBpsPerDay: reserveConfigFields.deleveragingThresholdDecreaseBpsPerDay.toString(),
36550
- fees: {
36551
- borrowFeeSf: reserveConfigFields.fees.borrowFeeSf.toString(),
36552
- flashLoanFeeSf: reserveConfigFields.fees.flashLoanFeeSf.toString(),
36553
- padding: reserveConfigFields.fees.padding
36554
- },
36555
- borrowRateCurve: {
36556
- points: reserveConfigFields.borrowRateCurve.points.map((item) => ({
36557
- utilizationRateBps: item.utilizationRateBps,
36558
- borrowRateBps: item.borrowRateBps
36559
- }))
36560
- },
36561
- borrowFactorPct: reserveConfigFields.borrowFactorPct.toString(),
36562
- depositLimit: reserveConfigFields.depositLimit.toString(),
36563
- borrowLimit: reserveConfigFields.borrowLimit.toString(),
36564
- tokenInfo: tokenInfoFieldsToDto(reserveConfigFields.tokenInfo),
36565
- depositWithdrawalCap: withdrawalCapsFieldsToDto(
36566
- reserveConfigFields.depositWithdrawalCap
36567
- ),
36568
- debtWithdrawalCap: withdrawalCapsFieldsToDto(
36569
- reserveConfigFields.debtWithdrawalCap
36570
- ),
36571
- elevationGroups: reserveConfigFields.elevationGroups,
36572
- disableUsageAsCollOutsideEmode: reserveConfigFields.disableUsageAsCollOutsideEmode,
36573
- utilizationLimitBlockBorrowingAbovePct: reserveConfigFields.utilizationLimitBlockBorrowingAbovePct,
36574
- autodeleverageEnabled: reserveConfigFields.autodeleverageEnabled,
36575
- reserved1: reserveConfigFields.reserved1,
36576
- borrowLimitOutsideElevationGroup: reserveConfigFields.borrowLimitOutsideElevationGroup.toString(),
36577
- borrowLimitAgainstThisCollateralInElevationGroup: reserveConfigFields.borrowLimitAgainstThisCollateralInElevationGroup.map(
36578
- (item) => item.toString()
36579
- ),
36580
- deleveragingBonusIncreaseBpsPerDay: reserveConfigFields.deleveragingBonusIncreaseBpsPerDay.toString()
36581
- };
36582
- }
36583
- function tokenInfoFieldsToDto(tokenInfoFields) {
36584
- return {
36585
- name: tokenInfoFields.name,
36586
- heuristic: {
36587
- lower: tokenInfoFields.heuristic.lower.toString(),
36588
- upper: tokenInfoFields.heuristic.upper.toString(),
36589
- exp: tokenInfoFields.heuristic.exp.toString()
36590
- },
36591
- maxTwapDivergenceBps: tokenInfoFields.maxTwapDivergenceBps.toString(),
36592
- maxAgePriceSeconds: tokenInfoFields.maxAgePriceSeconds.toString(),
36593
- maxAgeTwapSeconds: tokenInfoFields.maxAgeTwapSeconds.toString(),
36594
- scopeConfiguration: {
36595
- priceFeed: tokenInfoFields.scopeConfiguration.priceFeed.toBase58(),
36596
- priceChain: tokenInfoFields.scopeConfiguration.priceChain,
36597
- twapChain: tokenInfoFields.scopeConfiguration.twapChain
36598
- },
36599
- switchboardConfiguration: {
36600
- priceAggregator: tokenInfoFields.switchboardConfiguration.priceAggregator.toBase58(),
36601
- twapAggregator: tokenInfoFields.switchboardConfiguration.twapAggregator.toBase58()
36602
- },
36603
- pythConfiguration: {
36604
- price: tokenInfoFields.pythConfiguration.price.toBase58()
36605
- },
36606
- blockPriceUsage: tokenInfoFields.blockPriceUsage,
36607
- reserved: tokenInfoFields.reserved,
36608
- padding: tokenInfoFields.padding.map((item) => item.toString())
36609
- };
36610
- }
36611
- function withdrawalCapsFieldsToDto(withdrawalCapsFields) {
36612
- return {
36613
- configCapacity: withdrawalCapsFields.configCapacity.toString(),
36614
- currentTotal: withdrawalCapsFields.currentTotal.toString(),
36615
- lastIntervalStartTimestamp: withdrawalCapsFields.lastIntervalStartTimestamp.toString(),
36616
- configIntervalLengthSeconds: withdrawalCapsFields.configIntervalLengthSeconds.toString()
36617
- };
36618
- }
36619
- function obligationCollateralToDto(obligationCollateralFields) {
36620
- return {
36621
- depositReserve: obligationCollateralFields.depositReserve.toBase58(),
36622
- depositedAmount: obligationCollateralFields.depositedAmount.toString(),
36623
- marketValueSf: obligationCollateralFields.marketValueSf.toString(),
36624
- borrowedAmountAgainstThisCollateralInElevationGroup: obligationCollateralFields.borrowedAmountAgainstThisCollateralInElevationGroup.toString(),
36625
- padding: obligationCollateralFields.padding.map((item) => item.toString())
36432
+ lendingMarket: obligation.lendingMarket.toBase58(),
36433
+ owner: obligation.owner.toBase58(),
36434
+ deposits: obligation.deposits.map((item) => ({
36435
+ depositReserve: item.depositReserve.toBase58(),
36436
+ depositedAmount: item.depositedAmount.toString(),
36437
+ marketValueSf: item.marketValueSf.toString()
36438
+ })),
36439
+ borrows: obligation.borrows.map((item) => ({
36440
+ borrowReserve: item.borrowReserve.toBase58(),
36441
+ borrowedAmountSf: item.borrowedAmountSf.toString(),
36442
+ marketValueSf: item.marketValueSf.toString()
36443
+ }))
36626
36444
  };
36627
36445
  }
36628
- function obligationLiquidityToDto(obligationLiquidityFields) {
36446
+ function kaminoReserveToDto(reserve) {
36629
36447
  return {
36630
- borrowReserve: obligationLiquidityFields.borrowReserve.toBase58(),
36631
- cumulativeBorrowRateBsf: {
36632
- value: obligationLiquidityFields.cumulativeBorrowRateBsf.value.map(
36633
- (item) => item.toString()
36634
- ),
36635
- padding: obligationLiquidityFields.cumulativeBorrowRateBsf.padding.map(
36636
- (item) => item.toString()
36637
- )
36448
+ lendingMarket: reserve.lendingMarket.toBase58(),
36449
+ farmCollateral: reserve.farmCollateral.toBase58(),
36450
+ liquidity: {
36451
+ mintPubkey: reserve.liquidity.mintPubkey.toBase58(),
36452
+ supplyVault: reserve.liquidity.supplyVault.toBase58(),
36453
+ mintDecimals: reserve.liquidity.mintDecimals.toString(),
36454
+ availableAmount: reserve.liquidity.availableAmount.toString(),
36455
+ borrowedAmountSf: reserve.liquidity.borrowedAmountSf.toString(),
36456
+ accumulatedProtocolFeesSf: reserve.liquidity.accumulatedProtocolFeesSf.toString(),
36457
+ accumulatedReferrerFeesSf: reserve.liquidity.accumulatedReferrerFeesSf.toString(),
36458
+ pendingReferrerFeesSf: reserve.liquidity.pendingReferrerFeesSf.toString()
36638
36459
  },
36639
- padding: obligationLiquidityFields.padding.toString(),
36640
- borrowedAmountSf: obligationLiquidityFields.borrowedAmountSf.toString(),
36641
- marketValueSf: obligationLiquidityFields.marketValueSf.toString(),
36642
- borrowFactorAdjustedMarketValueSf: obligationLiquidityFields.borrowFactorAdjustedMarketValueSf.toString(),
36643
- borrowedAmountOutsideElevationGroups: obligationLiquidityFields.borrowedAmountOutsideElevationGroups.toString(),
36644
- padding2: obligationLiquidityFields.padding2.map((item) => item.toString())
36645
- };
36646
- }
36647
- function obligationOrderToDto(obligationOrderFields) {
36648
- return {
36649
- conditionThresholdSf: obligationOrderFields.conditionThresholdSf.toString(),
36650
- opportunityParameterSf: obligationOrderFields.opportunityParameterSf.toString(),
36651
- minExecutionBonusBps: obligationOrderFields.minExecutionBonusBps,
36652
- maxExecutionBonusBps: obligationOrderFields.maxExecutionBonusBps,
36653
- conditionType: obligationOrderFields.conditionType,
36654
- opportunityType: obligationOrderFields.opportunityType,
36655
- padding1: obligationOrderFields.padding1,
36656
- padding2: obligationOrderFields.padding2.map((item) => item.toString())
36460
+ collateral: {
36461
+ mintPubkey: reserve.collateral.mintPubkey.toBase58(),
36462
+ mintTotalSupply: reserve.collateral.mintTotalSupply.toString(),
36463
+ supplyVault: reserve.collateral.supplyVault.toBase58()
36464
+ },
36465
+ config: {
36466
+ protocolTakeRatePct: reserve.config.protocolTakeRatePct,
36467
+ hostFixedInterestRateBps: reserve.config.hostFixedInterestRateBps,
36468
+ borrowRateCurve: {
36469
+ points: reserve.config.borrowRateCurve.points.map((item) => ({
36470
+ utilizationRateBps: item.utilizationRateBps,
36471
+ borrowRateBps: item.borrowRateBps
36472
+ }))
36473
+ },
36474
+ tokenInfo: {
36475
+ scopeConfiguration: {
36476
+ priceFeed: reserve.config.tokenInfo.scopeConfiguration.priceFeed.toBase58()
36477
+ },
36478
+ switchboardConfiguration: {
36479
+ priceAggregator: reserve.config.tokenInfo.switchboardConfiguration.priceAggregator.toBase58(),
36480
+ twapAggregator: reserve.config.tokenInfo.switchboardConfiguration.twapAggregator.toBase58()
36481
+ },
36482
+ pythConfiguration: {
36483
+ price: reserve.config.tokenInfo.pythConfiguration.price.toBase58()
36484
+ }
36485
+ }
36486
+ }
36657
36487
  };
36658
36488
  }
36659
36489
 
@@ -43151,267 +42981,75 @@ function decodeKlendObligationData(data) {
43151
42981
  const dec = obligationLayout.decode(data.slice(8));
43152
42982
  return dec;
43153
42983
  }
43154
- function dtoToObligationRaw(obligationDto) {
42984
+ function dtoToKaminoObligation(obligationDto) {
43155
42985
  return {
43156
- tag: new BN11(obligationDto.tag),
43157
- lastUpdate: {
43158
- slot: new BN11(obligationDto.lastUpdate.slot),
43159
- stale: obligationDto.lastUpdate.stale,
43160
- priceStatus: obligationDto.lastUpdate.priceStatus,
43161
- placeholder: obligationDto.lastUpdate.placeholder
43162
- },
43163
42986
  lendingMarket: new PublicKey(obligationDto.lendingMarket),
43164
42987
  owner: new PublicKey(obligationDto.owner),
43165
- deposits: obligationDto.deposits.map(
43166
- (item) => dtoToObligationCollateralFields(item)
43167
- ),
43168
- lowestReserveDepositLiquidationLtv: new BN11(
43169
- obligationDto.lowestReserveDepositLiquidationLtv
43170
- ),
43171
- depositedValueSf: new BN11(obligationDto.depositedValueSf),
43172
- borrows: obligationDto.borrows.map(
43173
- (item) => dtoToObligationLiquidityFields(item)
43174
- ),
43175
- borrowFactorAdjustedDebtValueSf: new BN11(
43176
- obligationDto.borrowFactorAdjustedDebtValueSf
43177
- ),
43178
- borrowedAssetsMarketValueSf: new BN11(
43179
- obligationDto.borrowedAssetsMarketValueSf
43180
- ),
43181
- allowedBorrowValueSf: new BN11(obligationDto.allowedBorrowValueSf),
43182
- unhealthyBorrowValueSf: new BN11(obligationDto.unhealthyBorrowValueSf),
43183
- depositsAssetTiers: obligationDto.depositsAssetTiers,
43184
- borrowsAssetTiers: obligationDto.borrowsAssetTiers,
43185
- elevationGroup: obligationDto.elevationGroup,
43186
- numOfObsoleteDepositReserves: obligationDto.numOfObsoleteDepositReserves,
43187
- hasDebt: obligationDto.hasDebt,
43188
- referrer: new PublicKey(obligationDto.referrer),
43189
- borrowingDisabled: obligationDto.borrowingDisabled,
43190
- autodeleverageTargetLtvPct: obligationDto.autodeleverageTargetLtvPct,
43191
- lowestReserveDepositMaxLtvPct: obligationDto.lowestReserveDepositMaxLtvPct,
43192
- numOfObsoleteBorrowReserves: obligationDto.numOfObsoleteBorrowReserves,
43193
- reserved: obligationDto.reserved,
43194
- highestBorrowFactorPct: new BN11(obligationDto.highestBorrowFactorPct),
43195
- autodeleverageMarginCallStartedTimestamp: new BN11(
43196
- obligationDto.autodeleverageMarginCallStartedTimestamp
43197
- ),
43198
- orders: obligationDto.orders.map(
43199
- (item) => dtoToObligationOrderFields(item)
43200
- ),
43201
- padding3: obligationDto.padding3.map((item) => new BN11(item))
42988
+ deposits: obligationDto.deposits.map((item) => ({
42989
+ depositReserve: new PublicKey(item.depositReserve),
42990
+ depositedAmount: new BN8(item.depositedAmount),
42991
+ marketValueSf: new BN8(item.marketValueSf)
42992
+ })),
42993
+ borrows: obligationDto.borrows.map((item) => ({
42994
+ borrowReserve: new PublicKey(item.borrowReserve),
42995
+ borrowedAmountSf: new BN8(item.borrowedAmountSf),
42996
+ marketValueSf: new BN8(item.marketValueSf)
42997
+ }))
43202
42998
  };
43203
42999
  }
43204
- function dtoToReserveRaw(reserveDto) {
43000
+ function dtoToKaminoReserve(reserveDto) {
43205
43001
  return {
43206
- version: new BN11(reserveDto.version),
43207
- lastUpdate: {
43208
- slot: new BN11(reserveDto.lastUpdate.slot),
43209
- stale: reserveDto.lastUpdate.stale,
43210
- priceStatus: reserveDto.lastUpdate.priceStatus,
43211
- placeholder: reserveDto.lastUpdate.placeholder
43212
- },
43213
43002
  lendingMarket: new PublicKey(reserveDto.lendingMarket),
43214
43003
  farmCollateral: new PublicKey(reserveDto.farmCollateral),
43215
- farmDebt: new PublicKey(reserveDto.farmDebt),
43216
- liquidity: dtoToReserveLiquidityFields(reserveDto.liquidity),
43217
- reserveLiquidityPadding: reserveDto.reserveLiquidityPadding.map(
43218
- (item) => new BN11(item)
43219
- ),
43220
- collateral: {
43221
- mintPubkey: new PublicKey(reserveDto.collateral.mintPubkey),
43222
- mintTotalSupply: new BN11(reserveDto.collateral.mintTotalSupply),
43223
- supplyVault: new PublicKey(reserveDto.collateral.supplyVault),
43224
- padding1: reserveDto.collateral.padding1.map((item) => new BN11(item)),
43225
- padding2: reserveDto.collateral.padding2.map((item) => new BN11(item))
43226
- },
43227
- reserveCollateralPadding: reserveDto.reserveCollateralPadding.map(
43228
- (item) => new BN11(item)
43229
- ),
43230
- config: dtoToReserveConfigFields(reserveDto.config),
43231
- configPadding: reserveDto.configPadding.map((item) => new BN11(item)),
43232
- borrowedAmountOutsideElevationGroup: new BN11(
43233
- reserveDto.borrowedAmountOutsideElevationGroup
43234
- ),
43235
- borrowedAmountsAgainstThisReserveInElevationGroups: reserveDto.borrowedAmountsAgainstThisReserveInElevationGroups.map(
43236
- (item) => new BN11(item)
43237
- ),
43238
- padding: reserveDto.padding.map((item) => new BN11(item))
43239
- };
43240
- }
43241
- function dtoToReserveLiquidityFields(reserveDto) {
43242
- return {
43243
- mintPubkey: new PublicKey(reserveDto.mintPubkey),
43244
- supplyVault: new PublicKey(reserveDto.supplyVault),
43245
- feeVault: new PublicKey(reserveDto.feeVault),
43246
- availableAmount: new BN11(reserveDto.availableAmount),
43247
- borrowedAmountSf: new BN11(reserveDto.borrowedAmountSf),
43248
- marketPriceSf: new BN11(reserveDto.marketPriceSf),
43249
- marketPriceLastUpdatedTs: new BN11(reserveDto.marketPriceLastUpdatedTs),
43250
- mintDecimals: new BN11(reserveDto.mintDecimals),
43251
- depositLimitCrossedTimestamp: new BN11(
43252
- reserveDto.depositLimitCrossedTimestamp
43253
- ),
43254
- borrowLimitCrossedTimestamp: new BN11(reserveDto.borrowLimitCrossedTimestamp),
43255
- cumulativeBorrowRateBsf: {
43256
- value: reserveDto.cumulativeBorrowRateBsf.value.map(
43257
- (item) => new BN11(item)
43004
+ liquidity: {
43005
+ mintPubkey: new PublicKey(reserveDto.liquidity.mintPubkey),
43006
+ supplyVault: new PublicKey(reserveDto.liquidity.supplyVault),
43007
+ mintDecimals: new BN8(reserveDto.liquidity.mintDecimals),
43008
+ availableAmount: new BN8(reserveDto.liquidity.availableAmount),
43009
+ borrowedAmountSf: new BN8(reserveDto.liquidity.borrowedAmountSf),
43010
+ accumulatedProtocolFeesSf: new BN8(
43011
+ reserveDto.liquidity.accumulatedProtocolFeesSf
43258
43012
  ),
43259
- padding: reserveDto.cumulativeBorrowRateBsf.padding.map(
43260
- (item) => new BN11(item)
43261
- )
43262
- },
43263
- accumulatedProtocolFeesSf: new BN11(reserveDto.accumulatedProtocolFeesSf),
43264
- accumulatedReferrerFeesSf: new BN11(reserveDto.accumulatedReferrerFeesSf),
43265
- pendingReferrerFeesSf: new BN11(reserveDto.pendingReferrerFeesSf),
43266
- absoluteReferralRateSf: new BN11(reserveDto.absoluteReferralRateSf),
43267
- tokenProgram: new PublicKey(reserveDto.tokenProgram),
43268
- padding2: reserveDto.padding2.map((item) => new BN11(item)),
43269
- padding3: reserveDto.padding3.map((item) => new BN11(item))
43270
- };
43271
- }
43272
- function dtoToReserveConfigFields(reserveDto) {
43273
- return {
43274
- status: reserveDto.status,
43275
- assetTier: reserveDto.assetTier,
43276
- hostFixedInterestRateBps: reserveDto.hostFixedInterestRateBps,
43277
- reserved2: reserveDto.reserved2,
43278
- protocolOrderExecutionFeePct: reserveDto.protocolOrderExecutionFeePct,
43279
- protocolTakeRatePct: reserveDto.protocolTakeRatePct,
43280
- protocolLiquidationFeePct: reserveDto.protocolLiquidationFeePct,
43281
- loanToValuePct: reserveDto.loanToValuePct,
43282
- liquidationThresholdPct: reserveDto.liquidationThresholdPct,
43283
- minLiquidationBonusBps: reserveDto.minLiquidationBonusBps,
43284
- maxLiquidationBonusBps: reserveDto.maxLiquidationBonusBps,
43285
- badDebtLiquidationBonusBps: reserveDto.badDebtLiquidationBonusBps,
43286
- deleveragingMarginCallPeriodSecs: new BN11(
43287
- reserveDto.deleveragingMarginCallPeriodSecs
43288
- ),
43289
- deleveragingThresholdDecreaseBpsPerDay: new BN11(
43290
- reserveDto.deleveragingThresholdDecreaseBpsPerDay
43291
- ),
43292
- fees: {
43293
- borrowFeeSf: new BN11(reserveDto.fees.borrowFeeSf),
43294
- flashLoanFeeSf: new BN11(reserveDto.fees.flashLoanFeeSf),
43295
- padding: reserveDto.fees.padding
43296
- },
43297
- borrowRateCurve: {
43298
- points: reserveDto.borrowRateCurve.points.map((item) => ({
43299
- utilizationRateBps: item.utilizationRateBps,
43300
- borrowRateBps: item.borrowRateBps
43301
- }))
43302
- },
43303
- borrowFactorPct: new BN11(reserveDto.borrowFactorPct),
43304
- depositLimit: new BN11(reserveDto.depositLimit),
43305
- borrowLimit: new BN11(reserveDto.borrowLimit),
43306
- tokenInfo: dtoToTokenInfoFields(reserveDto.tokenInfo),
43307
- depositWithdrawalCap: dtoToWithdrawalCapsFields(
43308
- reserveDto.depositWithdrawalCap
43309
- ),
43310
- debtWithdrawalCap: dtoToWithdrawalCapsFields(reserveDto.debtWithdrawalCap),
43311
- elevationGroups: reserveDto.elevationGroups,
43312
- disableUsageAsCollOutsideEmode: reserveDto.disableUsageAsCollOutsideEmode,
43313
- utilizationLimitBlockBorrowingAbovePct: reserveDto.utilizationLimitBlockBorrowingAbovePct,
43314
- autodeleverageEnabled: reserveDto.autodeleverageEnabled,
43315
- reserved1: reserveDto.reserved1,
43316
- borrowLimitOutsideElevationGroup: new BN11(
43317
- reserveDto.borrowLimitOutsideElevationGroup
43318
- ),
43319
- borrowLimitAgainstThisCollateralInElevationGroup: reserveDto.borrowLimitAgainstThisCollateralInElevationGroup.map(
43320
- (item) => new BN11(item)
43321
- ),
43322
- deleveragingBonusIncreaseBpsPerDay: new BN11(
43323
- reserveDto.deleveragingBonusIncreaseBpsPerDay
43324
- )
43325
- };
43326
- }
43327
- function dtoToTokenInfoFields(tokenInfoDto) {
43328
- return {
43329
- name: tokenInfoDto.name,
43330
- heuristic: {
43331
- lower: new BN11(tokenInfoDto.heuristic.lower),
43332
- upper: new BN11(tokenInfoDto.heuristic.upper),
43333
- exp: new BN11(tokenInfoDto.heuristic.exp)
43334
- },
43335
- maxTwapDivergenceBps: new BN11(tokenInfoDto.maxTwapDivergenceBps),
43336
- maxAgePriceSeconds: new BN11(tokenInfoDto.maxAgePriceSeconds),
43337
- maxAgeTwapSeconds: new BN11(tokenInfoDto.maxAgeTwapSeconds),
43338
- scopeConfiguration: {
43339
- priceFeed: new PublicKey(tokenInfoDto.scopeConfiguration.priceFeed),
43340
- priceChain: tokenInfoDto.scopeConfiguration.priceChain,
43341
- twapChain: tokenInfoDto.scopeConfiguration.twapChain
43342
- },
43343
- switchboardConfiguration: {
43344
- priceAggregator: new PublicKey(
43345
- tokenInfoDto.switchboardConfiguration.priceAggregator
43013
+ accumulatedReferrerFeesSf: new BN8(
43014
+ reserveDto.liquidity.accumulatedReferrerFeesSf
43346
43015
  ),
43347
- twapAggregator: new PublicKey(
43348
- tokenInfoDto.switchboardConfiguration.twapAggregator
43349
- )
43016
+ pendingReferrerFeesSf: new BN8(reserveDto.liquidity.pendingReferrerFeesSf)
43350
43017
  },
43351
- pythConfiguration: {
43352
- price: new PublicKey(tokenInfoDto.pythConfiguration.price)
43353
- },
43354
- blockPriceUsage: tokenInfoDto.blockPriceUsage,
43355
- reserved: tokenInfoDto.reserved,
43356
- padding: tokenInfoDto.padding.map((item) => new BN11(item))
43357
- };
43358
- }
43359
- function dtoToWithdrawalCapsFields(withdrawalCapsDto) {
43360
- return {
43361
- configCapacity: new BN11(withdrawalCapsDto.configCapacity),
43362
- currentTotal: new BN11(withdrawalCapsDto.currentTotal),
43363
- lastIntervalStartTimestamp: new BN11(
43364
- withdrawalCapsDto.lastIntervalStartTimestamp
43365
- ),
43366
- configIntervalLengthSeconds: new BN11(
43367
- withdrawalCapsDto.configIntervalLengthSeconds
43368
- )
43369
- };
43370
- }
43371
- function dtoToObligationCollateralFields(obligationCollateralDto) {
43372
- return {
43373
- depositReserve: new PublicKey(obligationCollateralDto.depositReserve),
43374
- depositedAmount: new BN11(obligationCollateralDto.depositedAmount),
43375
- marketValueSf: new BN11(obligationCollateralDto.marketValueSf),
43376
- borrowedAmountAgainstThisCollateralInElevationGroup: new BN11(
43377
- obligationCollateralDto.borrowedAmountAgainstThisCollateralInElevationGroup
43378
- ),
43379
- padding: obligationCollateralDto.padding.map((item) => new BN11(item))
43380
- };
43381
- }
43382
- function dtoToObligationLiquidityFields(obligationLiquidityDto) {
43383
- return {
43384
- borrowReserve: new PublicKey(obligationLiquidityDto.borrowReserve),
43385
- cumulativeBorrowRateBsf: {
43386
- value: obligationLiquidityDto.cumulativeBorrowRateBsf.value.map(
43387
- (item) => new BN11(item)
43388
- ),
43389
- padding: obligationLiquidityDto.cumulativeBorrowRateBsf.padding.map(
43390
- (item) => new BN11(item)
43391
- )
43392
- },
43393
- padding: new BN11(obligationLiquidityDto.padding),
43394
- borrowedAmountSf: new BN11(obligationLiquidityDto.borrowedAmountSf),
43395
- marketValueSf: new BN11(obligationLiquidityDto.marketValueSf),
43396
- borrowFactorAdjustedMarketValueSf: new BN11(
43397
- obligationLiquidityDto.borrowFactorAdjustedMarketValueSf
43398
- ),
43399
- borrowedAmountOutsideElevationGroups: new BN11(
43400
- obligationLiquidityDto.borrowedAmountOutsideElevationGroups
43401
- ),
43402
- padding2: obligationLiquidityDto.padding2.map((item) => new BN11(item))
43403
- };
43404
- }
43405
- function dtoToObligationOrderFields(obligationOrderDto) {
43406
- return {
43407
- conditionThresholdSf: new BN11(obligationOrderDto.conditionThresholdSf),
43408
- opportunityParameterSf: new BN11(obligationOrderDto.opportunityParameterSf),
43409
- minExecutionBonusBps: obligationOrderDto.minExecutionBonusBps,
43410
- maxExecutionBonusBps: obligationOrderDto.maxExecutionBonusBps,
43411
- conditionType: obligationOrderDto.conditionType,
43412
- opportunityType: obligationOrderDto.opportunityType,
43413
- padding1: obligationOrderDto.padding1,
43414
- padding2: obligationOrderDto.padding2.map((item) => new BN11(item))
43018
+ collateral: {
43019
+ mintPubkey: new PublicKey(reserveDto.collateral.mintPubkey),
43020
+ mintTotalSupply: new BN8(reserveDto.collateral.mintTotalSupply),
43021
+ supplyVault: new PublicKey(reserveDto.collateral.supplyVault)
43022
+ },
43023
+ config: {
43024
+ protocolTakeRatePct: reserveDto.config.protocolTakeRatePct,
43025
+ hostFixedInterestRateBps: reserveDto.config.hostFixedInterestRateBps,
43026
+ borrowRateCurve: {
43027
+ points: reserveDto.config.borrowRateCurve.points.map((item) => ({
43028
+ utilizationRateBps: item.utilizationRateBps,
43029
+ borrowRateBps: item.borrowRateBps
43030
+ }))
43031
+ },
43032
+ tokenInfo: {
43033
+ scopeConfiguration: {
43034
+ priceFeed: new PublicKey(
43035
+ reserveDto.config.tokenInfo.scopeConfiguration.priceFeed
43036
+ )
43037
+ },
43038
+ switchboardConfiguration: {
43039
+ priceAggregator: new PublicKey(
43040
+ reserveDto.config.tokenInfo.switchboardConfiguration.priceAggregator
43041
+ ),
43042
+ twapAggregator: new PublicKey(
43043
+ reserveDto.config.tokenInfo.switchboardConfiguration.twapAggregator
43044
+ )
43045
+ },
43046
+ pythConfiguration: {
43047
+ price: new PublicKey(
43048
+ reserveDto.config.tokenInfo.pythConfiguration.price
43049
+ )
43050
+ }
43051
+ }
43052
+ }
43415
43053
  };
43416
43054
  }
43417
43055
  var SEED_LENDING_MARKET_AUTH = "lma";
@@ -43478,9 +43116,9 @@ var Fraction = class _Fraction {
43478
43116
  static MAX_SIZE_BF = 256;
43479
43117
  static FRACTIONS = 60;
43480
43118
  static MULTIPLIER = new FractionDecimal(2).pow(_Fraction.FRACTIONS);
43481
- static MAX_F_BN = new BN11(2).pow(new BN11(_Fraction.MAX_SIZE_F)).sub(new BN11(1));
43482
- static MAX_BF_BN = new BN11(2).pow(new BN11(_Fraction.MAX_SIZE_BF)).sub(new BN11(1));
43483
- static MIN_BN = new BN11(0);
43119
+ static MAX_F_BN = new BN8(2).pow(new BN8(_Fraction.MAX_SIZE_F)).sub(new BN8(1));
43120
+ static MAX_BF_BN = new BN8(2).pow(new BN8(_Fraction.MAX_SIZE_BF)).sub(new BN8(1));
43121
+ static MIN_BN = new BN8(0);
43484
43122
  valueSf;
43485
43123
  constructor(valueSf) {
43486
43124
  if (valueSf.lt(_Fraction.MIN_BN) || valueSf.gt(_Fraction.MAX_BF_BN)) {
@@ -43496,7 +43134,7 @@ var Fraction = class _Fraction {
43496
43134
  static fromDecimal(n) {
43497
43135
  const scaledDecimal = new FractionDecimal(n).mul(_Fraction.MULTIPLIER);
43498
43136
  const roundedScaledDecimal = roundNearest(scaledDecimal);
43499
- const scaledValue = new BN11(roundedScaledDecimal.toFixed());
43137
+ const scaledValue = new BN8(roundedScaledDecimal.toFixed());
43500
43138
  return new _Fraction(scaledValue);
43501
43139
  }
43502
43140
  static fromBps(n) {
@@ -43526,7 +43164,7 @@ var Fraction = class _Fraction {
43526
43164
  return this.valueSf.eq(x.getValue());
43527
43165
  }
43528
43166
  };
43529
- new Fraction(new BN11(0));
43167
+ new Fraction(new BN8(0));
43530
43168
  function roundNearest(decimal) {
43531
43169
  return decimal.toDecimalPlaces(0, Decimal3.ROUND_HALF_CEIL);
43532
43170
  }
@@ -44126,29 +43764,29 @@ function decodeJupTokenReserveData(data, pubkey) {
44126
43764
  offset += 2;
44127
43765
  const lastUtilization = data.readUInt16LE(offset);
44128
43766
  offset += 2;
44129
- const lastUpdateTimestamp = new BN11(data.slice(offset, offset + 8), "le");
43767
+ const lastUpdateTimestamp = new BN8(data.slice(offset, offset + 8), "le");
44130
43768
  offset += 8;
44131
- const supplyExchangePrice = new BN11(data.slice(offset, offset + 8), "le");
43769
+ const supplyExchangePrice = new BN8(data.slice(offset, offset + 8), "le");
44132
43770
  offset += 8;
44133
- const borrowExchangePrice = new BN11(data.slice(offset, offset + 8), "le");
43771
+ const borrowExchangePrice = new BN8(data.slice(offset, offset + 8), "le");
44134
43772
  offset += 8;
44135
43773
  const maxUtilization = data.readUInt16LE(offset);
44136
43774
  offset += 2;
44137
- const totalSupplyWithInterest = new BN11(data.slice(offset, offset + 8), "le");
43775
+ const totalSupplyWithInterest = new BN8(data.slice(offset, offset + 8), "le");
44138
43776
  offset += 8;
44139
- const totalSupplyInterestFree = new BN11(data.slice(offset, offset + 8), "le");
43777
+ const totalSupplyInterestFree = new BN8(data.slice(offset, offset + 8), "le");
44140
43778
  offset += 8;
44141
- const totalBorrowWithInterest = new BN11(data.slice(offset, offset + 8), "le");
43779
+ const totalBorrowWithInterest = new BN8(data.slice(offset, offset + 8), "le");
44142
43780
  offset += 8;
44143
- const totalBorrowInterestFree = new BN11(data.slice(offset, offset + 8), "le");
43781
+ const totalBorrowInterestFree = new BN8(data.slice(offset, offset + 8), "le");
44144
43782
  offset += 8;
44145
- const totalClaimAmount = new BN11(data.slice(offset, offset + 8), "le");
43783
+ const totalClaimAmount = new BN8(data.slice(offset, offset + 8), "le");
44146
43784
  offset += 8;
44147
43785
  const interactingProtocol = new PublicKey(data.slice(offset, offset + 32));
44148
43786
  offset += 32;
44149
- const interactingTimestamp = new BN11(data.slice(offset, offset + 8), "le");
43787
+ const interactingTimestamp = new BN8(data.slice(offset, offset + 8), "le");
44150
43788
  offset += 8;
44151
- const interactingBalance = new BN11(data.slice(offset, offset + 8), "le");
43789
+ const interactingBalance = new BN8(data.slice(offset, offset + 8), "le");
44152
43790
  return {
44153
43791
  pubkey,
44154
43792
  mint,
@@ -44210,9 +43848,9 @@ function dtoToJupLendingStateRaw(dto) {
44210
43848
  lendingId: dto.lendingId,
44211
43849
  decimals: dto.decimals,
44212
43850
  rewardsRateModel: new PublicKey(dto.rewardsRateModel),
44213
- liquidityExchangePrice: new BN11(dto.liquidityExchangePrice),
44214
- tokenExchangePrice: new BN11(dto.tokenExchangePrice),
44215
- lastUpdateTimestamp: new BN11(dto.lastUpdateTimestamp),
43851
+ liquidityExchangePrice: new BN8(dto.liquidityExchangePrice),
43852
+ tokenExchangePrice: new BN8(dto.tokenExchangePrice),
43853
+ lastUpdateTimestamp: new BN8(dto.lastUpdateTimestamp),
44216
43854
  tokenReservesLiquidity: new PublicKey(dto.tokenReservesLiquidity),
44217
43855
  supplyPositionOnLiquidity: new PublicKey(dto.supplyPositionOnLiquidity)
44218
43856
  };
@@ -44225,30 +43863,30 @@ function dtoToJupTokenReserveRaw(dto) {
44225
43863
  borrowRate: dto.borrowRate,
44226
43864
  feeOnInterest: dto.feeOnInterest,
44227
43865
  lastUtilization: dto.lastUtilization,
44228
- lastUpdateTimestamp: new BN11(dto.lastUpdateTimestamp),
44229
- supplyExchangePrice: new BN11(dto.supplyExchangePrice),
44230
- borrowExchangePrice: new BN11(dto.borrowExchangePrice),
43866
+ lastUpdateTimestamp: new BN8(dto.lastUpdateTimestamp),
43867
+ supplyExchangePrice: new BN8(dto.supplyExchangePrice),
43868
+ borrowExchangePrice: new BN8(dto.borrowExchangePrice),
44231
43869
  maxUtilization: dto.maxUtilization,
44232
- totalSupplyWithInterest: new BN11(dto.totalSupplyWithInterest),
44233
- totalSupplyInterestFree: new BN11(dto.totalSupplyInterestFree),
44234
- totalBorrowWithInterest: new BN11(dto.totalBorrowWithInterest),
44235
- totalBorrowInterestFree: new BN11(dto.totalBorrowInterestFree),
44236
- totalClaimAmount: new BN11(dto.totalClaimAmount),
43870
+ totalSupplyWithInterest: new BN8(dto.totalSupplyWithInterest),
43871
+ totalSupplyInterestFree: new BN8(dto.totalSupplyInterestFree),
43872
+ totalBorrowWithInterest: new BN8(dto.totalBorrowWithInterest),
43873
+ totalBorrowInterestFree: new BN8(dto.totalBorrowInterestFree),
43874
+ totalClaimAmount: new BN8(dto.totalClaimAmount),
44237
43875
  interactingProtocol: new PublicKey(dto.interactingProtocol),
44238
- interactingTimestamp: new BN11(dto.interactingTimestamp),
44239
- interactingBalance: new BN11(dto.interactingBalance)
43876
+ interactingTimestamp: new BN8(dto.interactingTimestamp),
43877
+ interactingBalance: new BN8(dto.interactingBalance)
44240
43878
  };
44241
43879
  }
44242
43880
  function dtoToJupLendingRewardsRateModelRaw(dto) {
44243
43881
  return {
44244
43882
  pubkey: new PublicKey(dto.pubkey),
44245
43883
  mint: new PublicKey(dto.mint),
44246
- startTvl: new BN11(dto.startTvl),
44247
- duration: new BN11(dto.duration),
44248
- startTime: new BN11(dto.startTime),
44249
- yearlyReward: new BN11(dto.yearlyReward),
44250
- nextDuration: new BN11(dto.nextDuration),
44251
- nextRewardAmount: new BN11(dto.nextRewardAmount)
43884
+ startTvl: new BN8(dto.startTvl),
43885
+ duration: new BN8(dto.duration),
43886
+ startTime: new BN8(dto.startTime),
43887
+ yearlyReward: new BN8(dto.yearlyReward),
43888
+ nextDuration: new BN8(dto.nextDuration),
43889
+ nextRewardAmount: new BN8(dto.nextRewardAmount)
44252
43890
  };
44253
43891
  }
44254
43892
  function dtoToJupRateModelRaw(dto) {
@@ -44339,14 +43977,14 @@ function deriveJupLendLiquiditySupplyPositionPda(underlyingMint, lendingPda, liq
44339
43977
  liquidityProgramId
44340
43978
  );
44341
43979
  }
44342
- var JUP_EXCHANGE_PRICES_PRECISION = new BN11("1000000000000");
44343
- var JUP_SECONDS_PER_YEAR = new BN11(31536e3);
44344
- var JUP_MAX_REWARDS_RATE = new BN11("50000000000000");
43980
+ var JUP_EXCHANGE_PRICES_PRECISION = new BN8("1000000000000");
43981
+ var JUP_SECONDS_PER_YEAR = new BN8(31536e3);
43982
+ var JUP_MAX_REWARDS_RATE = new BN8("50000000000000");
44345
43983
  function calculateJupLendTotalAssets(lendingState, fTokenTotalSupply) {
44346
43984
  return lendingState.tokenExchangePrice.mul(fTokenTotalSupply).div(JUP_EXCHANGE_PRICES_PRECISION);
44347
43985
  }
44348
43986
  function calculateJupLendRewardsRateForExchangePrice(rewardsModel, totalAssets, currentTimestamp) {
44349
- const defaultResult = { rate: new BN11(0), rewardsStartTime: rewardsModel.startTime };
43987
+ const defaultResult = { rate: new BN8(0), rewardsStartTime: rewardsModel.startTime };
44350
43988
  if (rewardsModel.startTime.isZero() || rewardsModel.duration.isZero()) {
44351
43989
  return defaultResult;
44352
43990
  }
@@ -44366,7 +44004,7 @@ function calculateJupLendNewExchangePrice(lendingState, tokenReserve, rewardsMod
44366
44004
  const oldTokenExchangePrice = lendingState.tokenExchangePrice;
44367
44005
  const oldLiquidityExchangePrice = lendingState.liquidityExchangePrice;
44368
44006
  const currentLiquidityExchangePrice = tokenReserve.supplyExchangePrice;
44369
- let rewardsRate = new BN11(0);
44007
+ let rewardsRate = new BN8(0);
44370
44008
  let rewardsStartTime = lendingState.lastUpdateTimestamp;
44371
44009
  if (rewardsModel) {
44372
44010
  const totalAssets = calculateJupLendTotalAssets(lendingState, fTokenTotalSupply);
@@ -44383,12 +44021,12 @@ function calculateJupLendNewExchangePrice(lendingState, tokenReserve, rewardsMod
44383
44021
  lastUpdateTime = rewardsStartTime;
44384
44022
  }
44385
44023
  const secondsElapsed = currentTimestamp.sub(lastUpdateTime);
44386
- let totalReturnPercent = rewardsRate.mul(secondsElapsed).div(JUP_SECONDS_PER_YEAR).mul(new BN11(100));
44024
+ let totalReturnPercent = rewardsRate.mul(secondsElapsed).div(JUP_SECONDS_PER_YEAR).mul(new BN8(100));
44387
44025
  const delta = currentLiquidityExchangePrice.sub(oldLiquidityExchangePrice);
44388
44026
  totalReturnPercent = totalReturnPercent.add(
44389
- delta.mul(new BN11(1e14)).div(oldLiquidityExchangePrice)
44027
+ delta.mul(new BN8(1e14)).div(oldLiquidityExchangePrice)
44390
44028
  );
44391
- return oldTokenExchangePrice.add(oldTokenExchangePrice.mul(totalReturnPercent).div(new BN11(1e14)));
44029
+ return oldTokenExchangePrice.add(oldTokenExchangePrice.mul(totalReturnPercent).div(new BN8(1e14)));
44392
44030
  }
44393
44031
  var UPDATE_RATE_DISCRIMINATOR = Buffer.from([
44394
44032
  24,
@@ -57869,7 +57507,7 @@ function exponentNumberToBigNumber(raw) {
57869
57507
  let value = new BigNumber(0);
57870
57508
  const TWO_64 = new BigNumber(2).pow(64);
57871
57509
  words.forEach((w, i) => {
57872
- const word = new BigNumber(BN11.isBN(w) ? w.toString() : String(w));
57510
+ const word = new BigNumber(BN8.isBN(w) ? w.toString() : String(w));
57873
57511
  value = value.plus(word.times(TWO_64.pow(i)));
57874
57512
  });
57875
57513
  return value.div(EXPONENT_NUMBER_DENOM);
@@ -57880,7 +57518,7 @@ function pk(v) {
57880
57518
  function decodeExponentVault(data) {
57881
57519
  const d = EXPONENT_ACCOUNTS_CODER.decode("Vault", data);
57882
57520
  const get = (snake, camel) => d[snake] ?? d[camel];
57883
- const u646 = (v) => BigInt(BN11.isBN(v) ? v.toString() : String(v ?? 0));
57521
+ const u646 = (v) => BigInt(BN8.isBN(v) ? v.toString() : String(v ?? 0));
57884
57522
  const cpi = get("cpi_accounts", "cpiAccounts") ?? {};
57885
57523
  return {
57886
57524
  authority: pk(get("authority", "authority")),
@@ -58227,76 +57865,25 @@ function scaledSupplies(state) {
58227
57865
  }
58228
57866
 
58229
57867
  // src/vendor/klend/utils/farms/serialize.utils.ts
58230
- function farmRawToDto(farmRaw) {
57868
+ function kaminoFarmStateToDto(farmState) {
58231
57869
  return {
58232
- farmAdmin: farmRaw.farmAdmin.toBase58(),
58233
- globalConfig: farmRaw.globalConfig.toBase58(),
58234
57870
  token: {
58235
- mint: farmRaw.token.mint.toBase58(),
58236
- decimals: farmRaw.token.decimals.toString(),
58237
- tokenProgram: farmRaw.token.tokenProgram.toBase58(),
58238
- padding: farmRaw.token.padding.map((p) => p.toString())
57871
+ mint: farmState.token.mint.toBase58(),
57872
+ decimals: farmState.token.decimals.toString()
58239
57873
  },
58240
- rewardInfos: farmRaw.rewardInfos.map((item) => ({
57874
+ rewardInfos: farmState.rewardInfos.map((item) => ({
58241
57875
  token: {
58242
57876
  mint: item.token.mint.toBase58(),
58243
- decimals: item.token.decimals.toString(),
58244
- tokenProgram: item.token.tokenProgram.toBase58(),
58245
- padding: item.token.padding.map((p) => p.toString())
57877
+ decimals: item.token.decimals.toString()
58246
57878
  },
58247
- rewardsVault: item.rewardsVault.toBase58(),
58248
- rewardsAvailable: item.rewardsAvailable.toString(),
57879
+ rewardsPerSecondDecimals: item.rewardsPerSecondDecimals,
58249
57880
  rewardScheduleCurve: {
58250
57881
  points: item.rewardScheduleCurve.points.map((p) => ({
58251
57882
  tsStart: p.tsStart.toString(),
58252
57883
  rewardPerTimeUnit: p.rewardPerTimeUnit.toString()
58253
57884
  }))
58254
- },
58255
- minClaimDurationSeconds: item.minClaimDurationSeconds.toString(),
58256
- lastIssuanceTs: item.lastIssuanceTs.toString(),
58257
- rewardsIssuedUnclaimed: item.rewardsIssuedUnclaimed.toString(),
58258
- rewardsIssuedCumulative: item.rewardsIssuedCumulative.toString(),
58259
- rewardPerShareScaled: item.rewardPerShareScaled.toString(),
58260
- placeholder0: item.placeholder0.toString(),
58261
- rewardType: item.rewardType,
58262
- rewardsPerSecondDecimals: item.rewardsPerSecondDecimals,
58263
- padding0: item.padding0,
58264
- padding1: item.padding1.map((p) => p.toString())
58265
- })),
58266
- numRewardTokens: farmRaw.numRewardTokens.toString(),
58267
- numUsers: farmRaw.numUsers.toString(),
58268
- totalStakedAmount: farmRaw.totalStakedAmount.toString(),
58269
- farmVault: farmRaw.farmVault.toBase58(),
58270
- farmVaultsAuthority: farmRaw.farmVaultsAuthority.toBase58(),
58271
- farmVaultsAuthorityBump: farmRaw.farmVaultsAuthorityBump.toString(),
58272
- delegateAuthority: farmRaw.delegateAuthority.toBase58(),
58273
- timeUnit: farmRaw.timeUnit,
58274
- isFarmFrozen: farmRaw.isFarmFrozen,
58275
- isFarmDelegated: farmRaw.isFarmDelegated,
58276
- padding0: farmRaw.padding0,
58277
- withdrawAuthority: farmRaw.withdrawAuthority.toBase58(),
58278
- depositWarmupPeriod: farmRaw.depositWarmupPeriod,
58279
- withdrawalCooldownPeriod: farmRaw.withdrawalCooldownPeriod,
58280
- totalActiveStakeScaled: farmRaw.totalActiveStakeScaled.toString(),
58281
- totalPendingStakeScaled: farmRaw.totalPendingStakeScaled.toString(),
58282
- totalPendingAmount: farmRaw.totalPendingAmount.toString(),
58283
- slashedAmountCurrent: farmRaw.slashedAmountCurrent.toString(),
58284
- slashedAmountCumulative: farmRaw.slashedAmountCumulative.toString(),
58285
- slashedAmountSpillAddress: farmRaw.slashedAmountSpillAddress.toBase58(),
58286
- lockingMode: farmRaw.lockingMode.toString(),
58287
- lockingStartTimestamp: farmRaw.lockingStartTimestamp.toString(),
58288
- lockingDuration: farmRaw.lockingDuration.toString(),
58289
- lockingEarlyWithdrawalPenaltyBps: farmRaw.lockingEarlyWithdrawalPenaltyBps.toString(),
58290
- depositCapAmount: farmRaw.depositCapAmount.toString(),
58291
- scopePrices: farmRaw.scopePrices.toBase58(),
58292
- scopeOraclePriceId: farmRaw.scopeOraclePriceId.toString(),
58293
- scopeOracleMaxAge: farmRaw.scopeOracleMaxAge.toString(),
58294
- pendingFarmAdmin: farmRaw.pendingFarmAdmin.toBase58(),
58295
- strategyId: farmRaw.strategyId.toBase58(),
58296
- delegatedRpsAdmin: farmRaw.delegatedRpsAdmin.toBase58(),
58297
- vaultId: farmRaw.vaultId.toBase58(),
58298
- secondDelegatedAuthority: farmRaw.secondDelegatedAuthority.toBase58(),
58299
- padding: farmRaw.padding.map((item) => item.toString())
57885
+ }
57886
+ }))
58300
57887
  };
58301
57888
  }
58302
57889
  var farmDiscriminator = Buffer.from([198, 102, 216, 74, 63, 66, 163, 190]);
@@ -58391,78 +57978,25 @@ function decodeFarmDataRaw(data) {
58391
57978
  const dec = farmLayout.decode(data.slice(8));
58392
57979
  return dec;
58393
57980
  }
58394
- function dtoToFarmRaw(dto) {
57981
+ function dtoToKaminoFarmState(dto) {
58395
57982
  return {
58396
- farmAdmin: new PublicKey(dto.farmAdmin),
58397
- globalConfig: new PublicKey(dto.globalConfig),
58398
57983
  token: {
58399
57984
  mint: new PublicKey(dto.token.mint),
58400
- decimals: new BN11(dto.token.decimals),
58401
- tokenProgram: new PublicKey(dto.token.tokenProgram),
58402
- padding: dto.token.padding.map((item) => new BN11(item))
57985
+ decimals: new BN8(dto.token.decimals)
58403
57986
  },
58404
57987
  rewardInfos: dto.rewardInfos.map((item) => ({
58405
57988
  token: {
58406
57989
  mint: new PublicKey(item.token.mint),
58407
- decimals: new BN11(item.token.decimals),
58408
- tokenProgram: new PublicKey(item.token.tokenProgram),
58409
- padding: item.token.padding.map((p) => new BN11(p))
57990
+ decimals: new BN8(item.token.decimals)
58410
57991
  },
58411
- rewardsVault: new PublicKey(item.rewardsVault),
58412
- rewardsAvailable: new BN11(item.rewardsAvailable),
57992
+ rewardsPerSecondDecimals: item.rewardsPerSecondDecimals,
58413
57993
  rewardScheduleCurve: {
58414
57994
  points: item.rewardScheduleCurve.points.map((p) => ({
58415
- tsStart: new BN11(p.tsStart),
58416
- rewardPerTimeUnit: new BN11(p.rewardPerTimeUnit)
57995
+ tsStart: new BN8(p.tsStart),
57996
+ rewardPerTimeUnit: new BN8(p.rewardPerTimeUnit)
58417
57997
  }))
58418
- },
58419
- minClaimDurationSeconds: new BN11(item.minClaimDurationSeconds),
58420
- lastIssuanceTs: new BN11(item.lastIssuanceTs),
58421
- rewardsIssuedUnclaimed: new BN11(item.rewardsIssuedUnclaimed),
58422
- rewardsIssuedCumulative: new BN11(item.rewardsIssuedCumulative),
58423
- rewardPerShareScaled: new BN11(item.rewardPerShareScaled),
58424
- placeholder0: new BN11(item.placeholder0),
58425
- rewardType: item.rewardType,
58426
- rewardsPerSecondDecimals: item.rewardsPerSecondDecimals,
58427
- padding0: item.padding0,
58428
- padding1: item.padding1.map((p) => new BN11(p))
58429
- })),
58430
- numRewardTokens: new BN11(dto.numRewardTokens),
58431
- numUsers: new BN11(dto.numUsers),
58432
- totalStakedAmount: new BN11(dto.totalStakedAmount),
58433
- farmVault: new PublicKey(dto.farmVault),
58434
- farmVaultsAuthority: new PublicKey(dto.farmVaultsAuthority),
58435
- farmVaultsAuthorityBump: new BN11(dto.farmVaultsAuthorityBump),
58436
- delegateAuthority: new PublicKey(dto.delegateAuthority),
58437
- timeUnit: dto.timeUnit,
58438
- isFarmFrozen: dto.isFarmFrozen,
58439
- isFarmDelegated: dto.isFarmDelegated,
58440
- padding0: dto.padding0,
58441
- withdrawAuthority: new PublicKey(dto.withdrawAuthority),
58442
- depositWarmupPeriod: dto.depositWarmupPeriod,
58443
- withdrawalCooldownPeriod: dto.withdrawalCooldownPeriod,
58444
- totalActiveStakeScaled: new BN11(dto.totalActiveStakeScaled),
58445
- totalPendingStakeScaled: new BN11(dto.totalPendingStakeScaled),
58446
- totalPendingAmount: new BN11(dto.totalPendingAmount),
58447
- slashedAmountCurrent: new BN11(dto.slashedAmountCurrent),
58448
- slashedAmountCumulative: new BN11(dto.slashedAmountCumulative),
58449
- slashedAmountSpillAddress: new PublicKey(dto.slashedAmountSpillAddress),
58450
- lockingMode: new BN11(dto.lockingMode),
58451
- lockingStartTimestamp: new BN11(dto.lockingStartTimestamp),
58452
- lockingDuration: new BN11(dto.lockingDuration),
58453
- lockingEarlyWithdrawalPenaltyBps: new BN11(
58454
- dto.lockingEarlyWithdrawalPenaltyBps
58455
- ),
58456
- depositCapAmount: new BN11(dto.depositCapAmount),
58457
- scopePrices: new PublicKey(dto.scopePrices),
58458
- scopeOraclePriceId: new BN11(dto.scopeOraclePriceId),
58459
- scopeOracleMaxAge: new BN11(dto.scopeOracleMaxAge),
58460
- pendingFarmAdmin: new PublicKey(dto.pendingFarmAdmin),
58461
- strategyId: new PublicKey(dto.strategyId),
58462
- delegatedRpsAdmin: new PublicKey(dto.delegatedRpsAdmin),
58463
- vaultId: new PublicKey(dto.vaultId),
58464
- secondDelegatedAuthority: new PublicKey(dto.secondDelegatedAuthority),
58465
- padding: dto.padding.map((item) => new BN11(item))
57998
+ }
57999
+ }))
58466
58000
  };
58467
58001
  }
58468
58002
  var KAMINO_PROGRAM_ID = new PublicKey("KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD");
@@ -59137,7 +58671,7 @@ function makePoolAddPermissionlessStakedBankIx2(programId, accounts, remainingAc
59137
58671
  keys.push(...remainingAccounts);
59138
58672
  const data = Buffer.concat([
59139
58673
  DISCRIMINATORS.LENDING_POOL_ADD_BANK_PERMISSIONLESS,
59140
- encodeU64(args.seed || new BN11(0))
58674
+ encodeU64(args.seed || new BN8(0))
59141
58675
  ]);
59142
58676
  return new TransactionInstruction({
59143
58677
  keys,
@@ -60641,7 +60175,7 @@ function deserializeSwapEngineResult(s) {
60641
60175
  setupInstructions: s.setupInstructions.map(deserializeInstruction),
60642
60176
  swapLuts: s.swapLuts.map(deserializeLut),
60643
60177
  quoteResponse: s.quoteResponse,
60644
- outputAmountNative: new BN11(s.outputAmountNative),
60178
+ outputAmountNative: new BN8(s.outputAmountNative),
60645
60179
  provider: s.provider
60646
60180
  };
60647
60181
  }
@@ -61440,8 +60974,8 @@ async function buildCandidates(req, apiConfig) {
61440
60974
  swapInstructions: [deserializeJupiterInstruction2(build.swapInstruction)],
61441
60975
  setupInstructions: (build.setupInstructions ?? []).map(deserializeJupiterInstruction2),
61442
60976
  luts,
61443
- outAmountNative: new BN11(build.outAmount),
61444
- otherAmountThresholdNative: new BN11(build.otherAmountThreshold),
60977
+ outAmountNative: new BN8(build.outAmount),
60978
+ otherAmountThresholdNative: new BN8(build.otherAmountThreshold),
61445
60979
  quoteResult: mapBuildToQuoteResult(build),
61446
60980
  label: `jupiter:maxAccounts=${maxAccounts}`
61447
60981
  };
@@ -61538,8 +61072,8 @@ async function buildCandidates2(req, apiConfig) {
61538
61072
  swapInstructions,
61539
61073
  setupInstructions: [],
61540
61074
  luts,
61541
- outAmountNative: new BN11(quote.outAmount),
61542
- otherAmountThresholdNative: new BN11(quote.otherAmountThreshold),
61075
+ outAmountNative: new BN8(quote.outAmount),
61076
+ otherAmountThresholdNative: new BN8(quote.otherAmountThreshold),
61543
61077
  quoteResult: { ...quote, provider: "TITAN" /* TITAN */ },
61544
61078
  label: "titan:v3"
61545
61079
  }
@@ -61595,14 +61129,14 @@ async function makeBeginFlashLoanIx3(program, marginfiAccountPk, endIndex, autho
61595
61129
  marginfiAccount: marginfiAccountPk,
61596
61130
  authority
61597
61131
  },
61598
- { endIndex: new BN11(endIndex) }
61132
+ { endIndex: new BN8(endIndex) }
61599
61133
  ) : await instructions_default.makeBeginFlashLoanIx(
61600
61134
  program,
61601
61135
  {
61602
61136
  marginfiAccount: marginfiAccountPk,
61603
61137
  authority
61604
61138
  },
61605
- { endIndex: new BN11(endIndex) }
61139
+ { endIndex: new BN8(endIndex) }
61606
61140
  );
61607
61141
  return { instructions: [ix], keys: [] };
61608
61142
  }
@@ -62281,7 +61815,7 @@ function computeFlashLoanNonSwapBudget({
62281
61815
  const beginFlIx = sync_instructions_default.makeBeginFlashLoanIx(
62282
61816
  program.programId,
62283
61817
  { marginfiAccount: marginfiAccount.address, authority: marginfiAccount.authority },
62284
- { endIndex: new BN11(endIndex) }
61818
+ { endIndex: new BN8(endIndex) }
62285
61819
  );
62286
61820
  const endFlRemainingAccounts = computeHealthAccountMetas(projectedActiveBanks);
62287
61821
  const endFlIx = sync_instructions_default.makeEndFlashLoanIx(
@@ -62860,7 +62394,7 @@ async function buildLoopFlashloanTx(params) {
62860
62394
  const engineResult = await runLoopSwapEngine(descriptor, params);
62861
62395
  const finalIxs = [...descriptor.innerIxs];
62862
62396
  finalIxs.splice(descriptor.swapSlotIndex, 0, ...engineResult.swapInstructions);
62863
- const principalNative = depositOpts.loopMode === "DEPOSIT" ? uiToNative(depositOpts.inputDepositAmount, depositOpts.depositBank.mintDecimals) : new BN11(0);
62397
+ const principalNative = depositOpts.loopMode === "DEPOSIT" ? uiToNative(depositOpts.inputDepositAmount, depositOpts.depositBank.mintDecimals) : new BN8(0);
62864
62398
  const finalDepositNative = engineResult.outputAmountNative.add(principalNative);
62865
62399
  const depositIxPosition = descriptor.depositIxIndex + engineResult.swapInstructions.length;
62866
62400
  patchDepositAmount(finalIxs[depositIxPosition], finalDepositNative);
@@ -63072,7 +62606,7 @@ async function runLoopSwapEngine(descriptor, params) {
63072
62606
  otherAmountThreshold: "0",
63073
62607
  slippageBps: 0
63074
62608
  },
63075
- outputAmountNative: new BN11(0)
62609
+ outputAmountNative: new BN8(0)
63076
62610
  };
63077
62611
  }
63078
62612
  const runEngine = swapEngineRunner ?? runSwapEngine;
@@ -64093,7 +63627,7 @@ async function buildRollPtFlashloanTx({
64093
63627
  if (!depositIxToPatch) {
64094
63628
  throw new Error("roll-pt: could not locate deposit instruction for amount patching");
64095
63629
  }
64096
- patchDepositAmount(depositIxToPatch, new BN11(minPtOut.toString()));
63630
+ patchDepositAmount(depositIxToPatch, new BN8(minPtOut.toString()));
64097
63631
  const allNonFlIxs = [
64098
63632
  ...cuRequestIxs,
64099
63633
  ...withdrawIxs.instructions,
@@ -66643,9 +66177,9 @@ function dtoToBankMetadataMap(bankMetadataDto) {
66643
66177
  function dtoToBankMetadata(bankMetadataDto) {
66644
66178
  return {
66645
66179
  kaminoStates: bankMetadataDto.kaminoStates ? {
66646
- reserveState: dtoToReserveRaw(bankMetadataDto.kaminoStates.reserveState),
66647
- obligationState: dtoToObligationRaw(bankMetadataDto.kaminoStates.obligationState),
66648
- farmState: bankMetadataDto.kaminoStates.farmState ? dtoToFarmRaw(bankMetadataDto.kaminoStates.farmState) : void 0
66180
+ reserveState: dtoToKaminoReserve(bankMetadataDto.kaminoStates.reserveState),
66181
+ obligationState: dtoToKaminoObligation(bankMetadataDto.kaminoStates.obligationState),
66182
+ farmState: bankMetadataDto.kaminoStates.farmState ? dtoToKaminoFarmState(bankMetadataDto.kaminoStates.farmState) : void 0
66649
66183
  } : void 0,
66650
66184
  driftStates: bankMetadataDto.driftStates ? {
66651
66185
  spotMarketState: dtoToDriftSpotMarketRaw(bankMetadataDto.driftStates.spotMarketState),
@@ -66660,16 +66194,16 @@ function dtoToBankMetadata(bankMetadataDto) {
66660
66194
  ),
66661
66195
  jupRewardsRateModel: bankMetadataDto.jupLendStates.jupRewardsRateModel ? dtoToJupLendingRewardsRateModelRaw(bankMetadataDto.jupLendStates.jupRewardsRateModel) : null,
66662
66196
  jupRateModel: bankMetadataDto.jupLendStates.jupRateModel ? dtoToJupRateModelRaw(bankMetadataDto.jupLendStates.jupRateModel) : null,
66663
- fTokenTotalSupply: new BN11(bankMetadataDto.jupLendStates.fTokenTotalSupply)
66197
+ fTokenTotalSupply: new BN8(bankMetadataDto.jupLendStates.fTokenTotalSupply)
66664
66198
  } : void 0
66665
66199
  };
66666
66200
  }
66667
66201
  function bankMetadataToDto(bankMetadata) {
66668
66202
  return {
66669
66203
  kaminoStates: bankMetadata.kaminoStates ? {
66670
- reserveState: reserveRawToDto(bankMetadata.kaminoStates.reserveState),
66671
- obligationState: obligationRawToDto(bankMetadata.kaminoStates.obligationState),
66672
- farmState: bankMetadata.kaminoStates.farmState ? farmRawToDto(bankMetadata.kaminoStates.farmState) : void 0
66204
+ reserveState: kaminoReserveToDto(bankMetadata.kaminoStates.reserveState),
66205
+ obligationState: kaminoObligationToDto(bankMetadata.kaminoStates.obligationState),
66206
+ farmState: bankMetadata.kaminoStates.farmState ? kaminoFarmStateToDto(bankMetadata.kaminoStates.farmState) : void 0
66673
66207
  } : void 0,
66674
66208
  driftStates: bankMetadata.driftStates ? {
66675
66209
  spotMarketState: driftSpotMarketRawToDto(bankMetadata.driftStates.spotMarketState),
@@ -66978,8 +66512,8 @@ var fetchSwbOracleData = async (banks, opts) => {
66978
66512
  const brokenSwbFeeds = [];
66979
66513
  Object.keys(swbOracleAiDataByKey).forEach((oracleKey) => {
66980
66514
  const oracleAiData = swbOracleAiDataByKey[oracleKey];
66981
- const rawPriceBN = new BN11(oracleAiData.rawPrice);
66982
- const isFeedBroken = rawPriceBN.isZero() || rawPriceBN.eq(new BN11(1e-6)) || rawPriceBN.eq(new BN11(1e-8));
66515
+ const rawPriceBN = new BN8(oracleAiData.rawPrice);
66516
+ const isFeedBroken = rawPriceBN.isZero() || rawPriceBN.eq(new BN8(1e-6)) || rawPriceBN.eq(new BN8(1e-8));
66983
66517
  if (isFeedBroken) {
66984
66518
  const bank = switchboardBanks.find(
66985
66519
  (bank2) => bank2.config.oracleKeys[0].toBase58() === oracleKey
@@ -67878,7 +67412,7 @@ async function makeAddPermissionlessStakedBankIx(program, group, voteAccountAddr
67878
67412
  isWritable: false
67879
67413
  })),
67880
67414
  {
67881
- seed: new BN11(0)
67415
+ seed: new BN8(0)
67882
67416
  }
67883
67417
  );
67884
67418
  return {
@@ -68810,9 +68344,9 @@ async function getKaminoMetadata(options) {
68810
68344
  for (const [bankAddress, state] of Object.entries(kaminoStates)) {
68811
68345
  kaminoMetadataMap.set(bankAddress, {
68812
68346
  kaminoStates: {
68813
- reserveState: dtoToReserveRaw(state.reserveState),
68814
- obligationState: dtoToObligationRaw(state.obligationState),
68815
- farmState: state.farmState ? dtoToFarmRaw(state.farmState) : void 0
68347
+ reserveState: dtoToKaminoReserve(state.reserveState),
68348
+ obligationState: dtoToKaminoObligation(state.obligationState),
68349
+ farmState: state.farmState ? dtoToKaminoFarmState(state.farmState) : void 0
68816
68350
  }
68817
68351
  });
68818
68352
  }
@@ -68844,8 +68378,8 @@ async function getKaminoStatesDto(connection, kaminoBanks) {
68844
68378
  bankByFarmKey[reserveState.farmCollateral.toBase58()] = bank.bankAddress;
68845
68379
  }
68846
68380
  kaminoStatesMap[bank.bankAddress] = {
68847
- reserveState: reserveRawToDto(reserveState),
68848
- obligationState: obligationRawToDto(obligationState)
68381
+ reserveState: kaminoReserveToDto(reserveState),
68382
+ obligationState: kaminoObligationToDto(obligationState)
68849
68383
  };
68850
68384
  }
68851
68385
  const allFarmKeys = Object.keys(bankByFarmKey);
@@ -68868,7 +68402,7 @@ async function getKaminoStatesDto(connection, kaminoBanks) {
68868
68402
  const decodedFarmState = decodeFarmDataRaw(farmState.data);
68869
68403
  kaminoStatesMap[bankKey] = {
68870
68404
  ...kaminoState,
68871
- farmState: farmRawToDto(decodedFarmState)
68405
+ farmState: kaminoFarmStateToDto(decodedFarmState)
68872
68406
  };
68873
68407
  }
68874
68408
  }
@@ -68999,7 +68533,7 @@ async function getJupLendMetadata(options) {
68999
68533
  jupTokenReserveState: dtoToJupTokenReserveRaw(state.jupTokenReserveState),
69000
68534
  jupRewardsRateModel: state.jupRewardsRateModel ? dtoToJupLendingRewardsRateModelRaw(state.jupRewardsRateModel) : null,
69001
68535
  jupRateModel: state.jupRateModel ? dtoToJupRateModelRaw(state.jupRateModel) : null,
69002
- fTokenTotalSupply: new BN11(state.fTokenTotalSupply)
68536
+ fTokenTotalSupply: new BN8(state.fTokenTotalSupply)
69003
68537
  }
69004
68538
  });
69005
68539
  }
@@ -69114,7 +68648,7 @@ async function getJupLendStatesDto(connection, jupLendBanks) {
69114
68648
  return jupLendStatesMap;
69115
68649
  }
69116
68650
  function getJupLendFTokenMultiplier(lendingState, tokenReserve, rewardsModel, fTokenTotalSupply, nowSeconds) {
69117
- const currentTimestamp = new BN11(nowSeconds);
68651
+ const currentTimestamp = new BN8(nowSeconds);
69118
68652
  const newExchangePrice = calculateJupLendNewExchangePrice(
69119
68653
  lendingState,
69120
68654
  tokenReserve,