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

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/vendor.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { PublicKey, TransactionInstruction, SYSVAR_RENT_PUBKEY, SystemProgram, STAKE_CONFIG_ID, Transaction, LAMPORTS_PER_SOL, StakeProgram, SYSVAR_CLOCK_PUBKEY, AddressLookupTableAccount } from '@solana/web3.js';
2
2
  import { BigNumber } from 'bignumber.js';
3
3
  import { deserialize } from 'borsh';
4
- import BN2, { BN } from 'bn.js';
4
+ import BN5, { BN } from 'bn.js';
5
5
  import { struct, u8, u32 } from '@solana/buffer-layout';
6
6
  import { bool, publicKey, u64 } from '@solana/buffer-layout-utils';
7
7
  import { Buffer as Buffer$1 } from 'buffer';
@@ -4037,233 +4037,65 @@ async function makeRefreshingIxs({
4037
4037
  }
4038
4038
 
4039
4039
  // src/vendor/klend/utils/klend/serialize.utils.ts
4040
- function obligationRawToDto(obligationRaw) {
4040
+ function kaminoObligationToDto(obligation) {
4041
4041
  return {
4042
- tag: obligationRaw.tag.toString(),
4043
- lastUpdate: {
4044
- slot: obligationRaw.lastUpdate.slot.toString(),
4045
- stale: obligationRaw.lastUpdate.stale,
4046
- priceStatus: obligationRaw.lastUpdate.priceStatus,
4047
- placeholder: obligationRaw.lastUpdate.placeholder
4048
- },
4049
- lendingMarket: obligationRaw.lendingMarket.toBase58(),
4050
- owner: obligationRaw.owner.toBase58(),
4051
- deposits: obligationRaw.deposits.map(
4052
- (item) => obligationCollateralToDto(item)
4053
- ),
4054
- lowestReserveDepositLiquidationLtv: obligationRaw.lowestReserveDepositLiquidationLtv.toString(),
4055
- depositedValueSf: obligationRaw.depositedValueSf.toString(),
4056
- borrows: obligationRaw.borrows.map(
4057
- (item) => obligationLiquidityToDto(item)
4058
- ),
4059
- borrowFactorAdjustedDebtValueSf: obligationRaw.borrowFactorAdjustedDebtValueSf.toString(),
4060
- borrowedAssetsMarketValueSf: obligationRaw.borrowedAssetsMarketValueSf.toString(),
4061
- allowedBorrowValueSf: obligationRaw.allowedBorrowValueSf.toString(),
4062
- unhealthyBorrowValueSf: obligationRaw.unhealthyBorrowValueSf.toString(),
4063
- depositsAssetTiers: obligationRaw.depositsAssetTiers,
4064
- borrowsAssetTiers: obligationRaw.borrowsAssetTiers,
4065
- elevationGroup: obligationRaw.elevationGroup,
4066
- numOfObsoleteDepositReserves: obligationRaw.numOfObsoleteDepositReserves,
4067
- hasDebt: obligationRaw.hasDebt,
4068
- referrer: obligationRaw.referrer.toBase58(),
4069
- borrowingDisabled: obligationRaw.borrowingDisabled,
4070
- autodeleverageTargetLtvPct: obligationRaw.autodeleverageTargetLtvPct,
4071
- lowestReserveDepositMaxLtvPct: obligationRaw.lowestReserveDepositMaxLtvPct,
4072
- numOfObsoleteBorrowReserves: obligationRaw.numOfObsoleteBorrowReserves,
4073
- reserved: obligationRaw.reserved,
4074
- highestBorrowFactorPct: obligationRaw.highestBorrowFactorPct.toString(),
4075
- autodeleverageMarginCallStartedTimestamp: obligationRaw.autodeleverageMarginCallStartedTimestamp.toString(),
4076
- orders: obligationRaw.orders.map((item) => obligationOrderToDto(item)),
4077
- padding3: obligationRaw.padding3.map((item) => item.toString())
4078
- };
4079
- }
4080
- function reserveRawToDto(reserveRaw) {
4081
- return {
4082
- version: reserveRaw.version.toString(),
4083
- lastUpdate: {
4084
- slot: reserveRaw.lastUpdate.slot.toString(),
4085
- stale: reserveRaw.lastUpdate.stale,
4086
- priceStatus: reserveRaw.lastUpdate.priceStatus,
4087
- placeholder: reserveRaw.lastUpdate.placeholder
4088
- },
4089
- lendingMarket: reserveRaw.lendingMarket.toBase58(),
4090
- farmCollateral: reserveRaw.farmCollateral.toBase58(),
4091
- farmDebt: reserveRaw.farmDebt.toBase58(),
4092
- liquidity: reserveLiquidityFieldsToDto(reserveRaw.liquidity),
4093
- reserveLiquidityPadding: reserveRaw.reserveLiquidityPadding.map(
4094
- (item) => item.toString()
4095
- ),
4096
- collateral: {
4097
- mintPubkey: reserveRaw.collateral.mintPubkey.toBase58(),
4098
- mintTotalSupply: reserveRaw.collateral.mintTotalSupply.toString(),
4099
- supplyVault: reserveRaw.collateral.supplyVault.toBase58(),
4100
- padding1: reserveRaw.collateral.padding1.map((item) => item.toString()),
4101
- padding2: reserveRaw.collateral.padding2.map((item) => item.toString())
4102
- },
4103
- reserveCollateralPadding: reserveRaw.reserveCollateralPadding.map(
4104
- (item) => item.toString()
4105
- ),
4106
- config: reserveConfigFieldsToDto(reserveRaw.config),
4107
- configPadding: reserveRaw.configPadding.map((item) => item.toString()),
4108
- borrowedAmountOutsideElevationGroup: reserveRaw.borrowedAmountOutsideElevationGroup.toString(),
4109
- borrowedAmountsAgainstThisReserveInElevationGroups: reserveRaw.borrowedAmountsAgainstThisReserveInElevationGroups.map(
4110
- (item) => item.toString()
4111
- ),
4112
- padding: reserveRaw.padding.map((item) => item.toString())
4113
- };
4114
- }
4115
- function reserveLiquidityFieldsToDto(reserveLiquidityFields) {
4116
- return {
4117
- mintPubkey: reserveLiquidityFields.mintPubkey.toBase58(),
4118
- supplyVault: reserveLiquidityFields.supplyVault.toBase58(),
4119
- feeVault: reserveLiquidityFields.feeVault.toBase58(),
4120
- availableAmount: reserveLiquidityFields.availableAmount.toString(),
4121
- borrowedAmountSf: reserveLiquidityFields.borrowedAmountSf.toString(),
4122
- marketPriceSf: reserveLiquidityFields.marketPriceSf.toString(),
4123
- marketPriceLastUpdatedTs: reserveLiquidityFields.marketPriceLastUpdatedTs.toString(),
4124
- mintDecimals: reserveLiquidityFields.mintDecimals.toString(),
4125
- depositLimitCrossedTimestamp: reserveLiquidityFields.depositLimitCrossedTimestamp.toString(),
4126
- borrowLimitCrossedTimestamp: reserveLiquidityFields.borrowLimitCrossedTimestamp.toString(),
4127
- cumulativeBorrowRateBsf: {
4128
- value: reserveLiquidityFields.cumulativeBorrowRateBsf.value.map(
4129
- (item) => item.toString()
4130
- ),
4131
- padding: reserveLiquidityFields.cumulativeBorrowRateBsf.padding.map(
4132
- (item) => item.toString()
4133
- )
4134
- },
4135
- accumulatedProtocolFeesSf: reserveLiquidityFields.accumulatedProtocolFeesSf.toString(),
4136
- accumulatedReferrerFeesSf: reserveLiquidityFields.accumulatedReferrerFeesSf.toString(),
4137
- pendingReferrerFeesSf: reserveLiquidityFields.pendingReferrerFeesSf.toString(),
4138
- absoluteReferralRateSf: reserveLiquidityFields.absoluteReferralRateSf.toString(),
4139
- tokenProgram: reserveLiquidityFields.tokenProgram.toBase58(),
4140
- padding2: reserveLiquidityFields.padding2.map((item) => item.toString()),
4141
- padding3: reserveLiquidityFields.padding3.map((item) => item.toString())
4142
- };
4143
- }
4144
- function reserveConfigFieldsToDto(reserveConfigFields) {
4145
- return {
4146
- status: reserveConfigFields.status,
4147
- assetTier: reserveConfigFields.assetTier,
4148
- hostFixedInterestRateBps: reserveConfigFields.hostFixedInterestRateBps,
4149
- reserved2: reserveConfigFields.reserved2,
4150
- protocolOrderExecutionFeePct: reserveConfigFields.protocolOrderExecutionFeePct,
4151
- protocolTakeRatePct: reserveConfigFields.protocolTakeRatePct,
4152
- protocolLiquidationFeePct: reserveConfigFields.protocolLiquidationFeePct,
4153
- loanToValuePct: reserveConfigFields.loanToValuePct,
4154
- liquidationThresholdPct: reserveConfigFields.liquidationThresholdPct,
4155
- minLiquidationBonusBps: reserveConfigFields.minLiquidationBonusBps,
4156
- maxLiquidationBonusBps: reserveConfigFields.maxLiquidationBonusBps,
4157
- badDebtLiquidationBonusBps: reserveConfigFields.badDebtLiquidationBonusBps,
4158
- deleveragingMarginCallPeriodSecs: reserveConfigFields.deleveragingMarginCallPeriodSecs.toString(),
4159
- deleveragingThresholdDecreaseBpsPerDay: reserveConfigFields.deleveragingThresholdDecreaseBpsPerDay.toString(),
4160
- fees: {
4161
- borrowFeeSf: reserveConfigFields.fees.borrowFeeSf.toString(),
4162
- flashLoanFeeSf: reserveConfigFields.fees.flashLoanFeeSf.toString(),
4163
- padding: reserveConfigFields.fees.padding
4164
- },
4165
- borrowRateCurve: {
4166
- points: reserveConfigFields.borrowRateCurve.points.map((item) => ({
4167
- utilizationRateBps: item.utilizationRateBps,
4168
- borrowRateBps: item.borrowRateBps
4169
- }))
4170
- },
4171
- borrowFactorPct: reserveConfigFields.borrowFactorPct.toString(),
4172
- depositLimit: reserveConfigFields.depositLimit.toString(),
4173
- borrowLimit: reserveConfigFields.borrowLimit.toString(),
4174
- tokenInfo: tokenInfoFieldsToDto(reserveConfigFields.tokenInfo),
4175
- depositWithdrawalCap: withdrawalCapsFieldsToDto(
4176
- reserveConfigFields.depositWithdrawalCap
4177
- ),
4178
- debtWithdrawalCap: withdrawalCapsFieldsToDto(
4179
- reserveConfigFields.debtWithdrawalCap
4180
- ),
4181
- elevationGroups: reserveConfigFields.elevationGroups,
4182
- disableUsageAsCollOutsideEmode: reserveConfigFields.disableUsageAsCollOutsideEmode,
4183
- utilizationLimitBlockBorrowingAbovePct: reserveConfigFields.utilizationLimitBlockBorrowingAbovePct,
4184
- autodeleverageEnabled: reserveConfigFields.autodeleverageEnabled,
4185
- reserved1: reserveConfigFields.reserved1,
4186
- borrowLimitOutsideElevationGroup: reserveConfigFields.borrowLimitOutsideElevationGroup.toString(),
4187
- borrowLimitAgainstThisCollateralInElevationGroup: reserveConfigFields.borrowLimitAgainstThisCollateralInElevationGroup.map(
4188
- (item) => item.toString()
4189
- ),
4190
- deleveragingBonusIncreaseBpsPerDay: reserveConfigFields.deleveragingBonusIncreaseBpsPerDay.toString()
4191
- };
4192
- }
4193
- function tokenInfoFieldsToDto(tokenInfoFields) {
4194
- return {
4195
- name: tokenInfoFields.name,
4196
- heuristic: {
4197
- lower: tokenInfoFields.heuristic.lower.toString(),
4198
- upper: tokenInfoFields.heuristic.upper.toString(),
4199
- exp: tokenInfoFields.heuristic.exp.toString()
4200
- },
4201
- maxTwapDivergenceBps: tokenInfoFields.maxTwapDivergenceBps.toString(),
4202
- maxAgePriceSeconds: tokenInfoFields.maxAgePriceSeconds.toString(),
4203
- maxAgeTwapSeconds: tokenInfoFields.maxAgeTwapSeconds.toString(),
4204
- scopeConfiguration: {
4205
- priceFeed: tokenInfoFields.scopeConfiguration.priceFeed.toBase58(),
4206
- priceChain: tokenInfoFields.scopeConfiguration.priceChain,
4207
- twapChain: tokenInfoFields.scopeConfiguration.twapChain
4208
- },
4209
- switchboardConfiguration: {
4210
- priceAggregator: tokenInfoFields.switchboardConfiguration.priceAggregator.toBase58(),
4211
- twapAggregator: tokenInfoFields.switchboardConfiguration.twapAggregator.toBase58()
4212
- },
4213
- pythConfiguration: {
4214
- price: tokenInfoFields.pythConfiguration.price.toBase58()
4215
- },
4216
- blockPriceUsage: tokenInfoFields.blockPriceUsage,
4217
- reserved: tokenInfoFields.reserved,
4218
- padding: tokenInfoFields.padding.map((item) => item.toString())
4219
- };
4220
- }
4221
- function withdrawalCapsFieldsToDto(withdrawalCapsFields) {
4222
- return {
4223
- configCapacity: withdrawalCapsFields.configCapacity.toString(),
4224
- currentTotal: withdrawalCapsFields.currentTotal.toString(),
4225
- lastIntervalStartTimestamp: withdrawalCapsFields.lastIntervalStartTimestamp.toString(),
4226
- configIntervalLengthSeconds: withdrawalCapsFields.configIntervalLengthSeconds.toString()
4227
- };
4228
- }
4229
- function obligationCollateralToDto(obligationCollateralFields) {
4230
- return {
4231
- depositReserve: obligationCollateralFields.depositReserve.toBase58(),
4232
- depositedAmount: obligationCollateralFields.depositedAmount.toString(),
4233
- marketValueSf: obligationCollateralFields.marketValueSf.toString(),
4234
- borrowedAmountAgainstThisCollateralInElevationGroup: obligationCollateralFields.borrowedAmountAgainstThisCollateralInElevationGroup.toString(),
4235
- padding: obligationCollateralFields.padding.map((item) => item.toString())
4042
+ lendingMarket: obligation.lendingMarket.toBase58(),
4043
+ owner: obligation.owner.toBase58(),
4044
+ deposits: obligation.deposits.map((item) => ({
4045
+ depositReserve: item.depositReserve.toBase58(),
4046
+ depositedAmount: item.depositedAmount.toString(),
4047
+ marketValueSf: item.marketValueSf.toString()
4048
+ })),
4049
+ borrows: obligation.borrows.map((item) => ({
4050
+ borrowReserve: item.borrowReserve.toBase58(),
4051
+ borrowedAmountSf: item.borrowedAmountSf.toString(),
4052
+ marketValueSf: item.marketValueSf.toString()
4053
+ }))
4236
4054
  };
4237
4055
  }
4238
- function obligationLiquidityToDto(obligationLiquidityFields) {
4056
+ function kaminoReserveToDto(reserve) {
4239
4057
  return {
4240
- borrowReserve: obligationLiquidityFields.borrowReserve.toBase58(),
4241
- cumulativeBorrowRateBsf: {
4242
- value: obligationLiquidityFields.cumulativeBorrowRateBsf.value.map(
4243
- (item) => item.toString()
4244
- ),
4245
- padding: obligationLiquidityFields.cumulativeBorrowRateBsf.padding.map(
4246
- (item) => item.toString()
4247
- )
4058
+ lendingMarket: reserve.lendingMarket.toBase58(),
4059
+ farmCollateral: reserve.farmCollateral.toBase58(),
4060
+ liquidity: {
4061
+ mintPubkey: reserve.liquidity.mintPubkey.toBase58(),
4062
+ supplyVault: reserve.liquidity.supplyVault.toBase58(),
4063
+ mintDecimals: reserve.liquidity.mintDecimals.toString(),
4064
+ availableAmount: reserve.liquidity.availableAmount.toString(),
4065
+ borrowedAmountSf: reserve.liquidity.borrowedAmountSf.toString(),
4066
+ accumulatedProtocolFeesSf: reserve.liquidity.accumulatedProtocolFeesSf.toString(),
4067
+ accumulatedReferrerFeesSf: reserve.liquidity.accumulatedReferrerFeesSf.toString(),
4068
+ pendingReferrerFeesSf: reserve.liquidity.pendingReferrerFeesSf.toString()
4248
4069
  },
4249
- padding: obligationLiquidityFields.padding.toString(),
4250
- borrowedAmountSf: obligationLiquidityFields.borrowedAmountSf.toString(),
4251
- marketValueSf: obligationLiquidityFields.marketValueSf.toString(),
4252
- borrowFactorAdjustedMarketValueSf: obligationLiquidityFields.borrowFactorAdjustedMarketValueSf.toString(),
4253
- borrowedAmountOutsideElevationGroups: obligationLiquidityFields.borrowedAmountOutsideElevationGroups.toString(),
4254
- padding2: obligationLiquidityFields.padding2.map((item) => item.toString())
4255
- };
4256
- }
4257
- function obligationOrderToDto(obligationOrderFields) {
4258
- return {
4259
- conditionThresholdSf: obligationOrderFields.conditionThresholdSf.toString(),
4260
- opportunityParameterSf: obligationOrderFields.opportunityParameterSf.toString(),
4261
- minExecutionBonusBps: obligationOrderFields.minExecutionBonusBps,
4262
- maxExecutionBonusBps: obligationOrderFields.maxExecutionBonusBps,
4263
- conditionType: obligationOrderFields.conditionType,
4264
- opportunityType: obligationOrderFields.opportunityType,
4265
- padding1: obligationOrderFields.padding1,
4266
- padding2: obligationOrderFields.padding2.map((item) => item.toString())
4070
+ collateral: {
4071
+ mintPubkey: reserve.collateral.mintPubkey.toBase58(),
4072
+ mintTotalSupply: reserve.collateral.mintTotalSupply.toString(),
4073
+ supplyVault: reserve.collateral.supplyVault.toBase58()
4074
+ },
4075
+ config: {
4076
+ protocolTakeRatePct: reserve.config.protocolTakeRatePct,
4077
+ hostFixedInterestRateBps: reserve.config.hostFixedInterestRateBps,
4078
+ depositLimit: reserve.config.depositLimit.toString(),
4079
+ borrowLimit: reserve.config.borrowLimit.toString(),
4080
+ borrowRateCurve: {
4081
+ points: reserve.config.borrowRateCurve.points.map((item) => ({
4082
+ utilizationRateBps: item.utilizationRateBps,
4083
+ borrowRateBps: item.borrowRateBps
4084
+ }))
4085
+ },
4086
+ tokenInfo: {
4087
+ scopeConfiguration: {
4088
+ priceFeed: reserve.config.tokenInfo.scopeConfiguration.priceFeed.toBase58()
4089
+ },
4090
+ switchboardConfiguration: {
4091
+ priceAggregator: reserve.config.tokenInfo.switchboardConfiguration.priceAggregator.toBase58(),
4092
+ twapAggregator: reserve.config.tokenInfo.switchboardConfiguration.twapAggregator.toBase58()
4093
+ },
4094
+ pythConfiguration: {
4095
+ price: reserve.config.tokenInfo.pythConfiguration.price.toBase58()
4096
+ }
4097
+ }
4098
+ }
4267
4099
  };
4268
4100
  }
4269
4101
 
@@ -12548,267 +12380,78 @@ function decodeKlendObligationData(data) {
12548
12380
  const dec = obligationLayout.decode(data.slice(8));
12549
12381
  return dec;
12550
12382
  }
12551
- function dtoToObligationRaw(obligationDto) {
12383
+ function dtoToKaminoObligation(obligationDto) {
12552
12384
  return {
12553
- tag: new BN2(obligationDto.tag),
12554
- lastUpdate: {
12555
- slot: new BN2(obligationDto.lastUpdate.slot),
12556
- stale: obligationDto.lastUpdate.stale,
12557
- priceStatus: obligationDto.lastUpdate.priceStatus,
12558
- placeholder: obligationDto.lastUpdate.placeholder
12559
- },
12560
12385
  lendingMarket: new PublicKey(obligationDto.lendingMarket),
12561
12386
  owner: new PublicKey(obligationDto.owner),
12562
- deposits: obligationDto.deposits.map(
12563
- (item) => dtoToObligationCollateralFields(item)
12564
- ),
12565
- lowestReserveDepositLiquidationLtv: new BN2(
12566
- obligationDto.lowestReserveDepositLiquidationLtv
12567
- ),
12568
- depositedValueSf: new BN2(obligationDto.depositedValueSf),
12569
- borrows: obligationDto.borrows.map(
12570
- (item) => dtoToObligationLiquidityFields(item)
12571
- ),
12572
- borrowFactorAdjustedDebtValueSf: new BN2(
12573
- obligationDto.borrowFactorAdjustedDebtValueSf
12574
- ),
12575
- borrowedAssetsMarketValueSf: new BN2(
12576
- obligationDto.borrowedAssetsMarketValueSf
12577
- ),
12578
- allowedBorrowValueSf: new BN2(obligationDto.allowedBorrowValueSf),
12579
- unhealthyBorrowValueSf: new BN2(obligationDto.unhealthyBorrowValueSf),
12580
- depositsAssetTiers: obligationDto.depositsAssetTiers,
12581
- borrowsAssetTiers: obligationDto.borrowsAssetTiers,
12582
- elevationGroup: obligationDto.elevationGroup,
12583
- numOfObsoleteDepositReserves: obligationDto.numOfObsoleteDepositReserves,
12584
- hasDebt: obligationDto.hasDebt,
12585
- referrer: new PublicKey(obligationDto.referrer),
12586
- borrowingDisabled: obligationDto.borrowingDisabled,
12587
- autodeleverageTargetLtvPct: obligationDto.autodeleverageTargetLtvPct,
12588
- lowestReserveDepositMaxLtvPct: obligationDto.lowestReserveDepositMaxLtvPct,
12589
- numOfObsoleteBorrowReserves: obligationDto.numOfObsoleteBorrowReserves,
12590
- reserved: obligationDto.reserved,
12591
- highestBorrowFactorPct: new BN2(obligationDto.highestBorrowFactorPct),
12592
- autodeleverageMarginCallStartedTimestamp: new BN2(
12593
- obligationDto.autodeleverageMarginCallStartedTimestamp
12594
- ),
12595
- orders: obligationDto.orders.map(
12596
- (item) => dtoToObligationOrderFields(item)
12597
- ),
12598
- padding3: obligationDto.padding3.map((item) => new BN2(item))
12387
+ // Hosted endpoints may prune empty position arrays from the payload
12388
+ deposits: (obligationDto.deposits ?? []).map((item) => ({
12389
+ depositReserve: new PublicKey(item.depositReserve),
12390
+ depositedAmount: new BN5(item.depositedAmount),
12391
+ marketValueSf: new BN5(item.marketValueSf)
12392
+ })),
12393
+ borrows: (obligationDto.borrows ?? []).map((item) => ({
12394
+ borrowReserve: new PublicKey(item.borrowReserve),
12395
+ borrowedAmountSf: new BN5(item.borrowedAmountSf),
12396
+ marketValueSf: new BN5(item.marketValueSf)
12397
+ }))
12599
12398
  };
12600
12399
  }
12601
- function dtoToReserveRaw(reserveDto) {
12400
+ function dtoToKaminoReserve(reserveDto) {
12602
12401
  return {
12603
- version: new BN2(reserveDto.version),
12604
- lastUpdate: {
12605
- slot: new BN2(reserveDto.lastUpdate.slot),
12606
- stale: reserveDto.lastUpdate.stale,
12607
- priceStatus: reserveDto.lastUpdate.priceStatus,
12608
- placeholder: reserveDto.lastUpdate.placeholder
12609
- },
12610
12402
  lendingMarket: new PublicKey(reserveDto.lendingMarket),
12611
12403
  farmCollateral: new PublicKey(reserveDto.farmCollateral),
12612
- farmDebt: new PublicKey(reserveDto.farmDebt),
12613
- liquidity: dtoToReserveLiquidityFields(reserveDto.liquidity),
12614
- reserveLiquidityPadding: reserveDto.reserveLiquidityPadding.map(
12615
- (item) => new BN2(item)
12616
- ),
12617
- collateral: {
12618
- mintPubkey: new PublicKey(reserveDto.collateral.mintPubkey),
12619
- mintTotalSupply: new BN2(reserveDto.collateral.mintTotalSupply),
12620
- supplyVault: new PublicKey(reserveDto.collateral.supplyVault),
12621
- padding1: reserveDto.collateral.padding1.map((item) => new BN2(item)),
12622
- padding2: reserveDto.collateral.padding2.map((item) => new BN2(item))
12623
- },
12624
- reserveCollateralPadding: reserveDto.reserveCollateralPadding.map(
12625
- (item) => new BN2(item)
12626
- ),
12627
- config: dtoToReserveConfigFields(reserveDto.config),
12628
- configPadding: reserveDto.configPadding.map((item) => new BN2(item)),
12629
- borrowedAmountOutsideElevationGroup: new BN2(
12630
- reserveDto.borrowedAmountOutsideElevationGroup
12631
- ),
12632
- borrowedAmountsAgainstThisReserveInElevationGroups: reserveDto.borrowedAmountsAgainstThisReserveInElevationGroups.map(
12633
- (item) => new BN2(item)
12634
- ),
12635
- padding: reserveDto.padding.map((item) => new BN2(item))
12636
- };
12637
- }
12638
- function dtoToReserveLiquidityFields(reserveDto) {
12639
- return {
12640
- mintPubkey: new PublicKey(reserveDto.mintPubkey),
12641
- supplyVault: new PublicKey(reserveDto.supplyVault),
12642
- feeVault: new PublicKey(reserveDto.feeVault),
12643
- availableAmount: new BN2(reserveDto.availableAmount),
12644
- borrowedAmountSf: new BN2(reserveDto.borrowedAmountSf),
12645
- marketPriceSf: new BN2(reserveDto.marketPriceSf),
12646
- marketPriceLastUpdatedTs: new BN2(reserveDto.marketPriceLastUpdatedTs),
12647
- mintDecimals: new BN2(reserveDto.mintDecimals),
12648
- depositLimitCrossedTimestamp: new BN2(
12649
- reserveDto.depositLimitCrossedTimestamp
12650
- ),
12651
- borrowLimitCrossedTimestamp: new BN2(reserveDto.borrowLimitCrossedTimestamp),
12652
- cumulativeBorrowRateBsf: {
12653
- value: reserveDto.cumulativeBorrowRateBsf.value.map(
12654
- (item) => new BN2(item)
12404
+ liquidity: {
12405
+ mintPubkey: new PublicKey(reserveDto.liquidity.mintPubkey),
12406
+ supplyVault: new PublicKey(reserveDto.liquidity.supplyVault),
12407
+ mintDecimals: new BN5(reserveDto.liquidity.mintDecimals),
12408
+ availableAmount: new BN5(reserveDto.liquidity.availableAmount),
12409
+ borrowedAmountSf: new BN5(reserveDto.liquidity.borrowedAmountSf),
12410
+ accumulatedProtocolFeesSf: new BN5(
12411
+ reserveDto.liquidity.accumulatedProtocolFeesSf
12655
12412
  ),
12656
- padding: reserveDto.cumulativeBorrowRateBsf.padding.map(
12657
- (item) => new BN2(item)
12658
- )
12659
- },
12660
- accumulatedProtocolFeesSf: new BN2(reserveDto.accumulatedProtocolFeesSf),
12661
- accumulatedReferrerFeesSf: new BN2(reserveDto.accumulatedReferrerFeesSf),
12662
- pendingReferrerFeesSf: new BN2(reserveDto.pendingReferrerFeesSf),
12663
- absoluteReferralRateSf: new BN2(reserveDto.absoluteReferralRateSf),
12664
- tokenProgram: new PublicKey(reserveDto.tokenProgram),
12665
- padding2: reserveDto.padding2.map((item) => new BN2(item)),
12666
- padding3: reserveDto.padding3.map((item) => new BN2(item))
12667
- };
12668
- }
12669
- function dtoToReserveConfigFields(reserveDto) {
12670
- return {
12671
- status: reserveDto.status,
12672
- assetTier: reserveDto.assetTier,
12673
- hostFixedInterestRateBps: reserveDto.hostFixedInterestRateBps,
12674
- reserved2: reserveDto.reserved2,
12675
- protocolOrderExecutionFeePct: reserveDto.protocolOrderExecutionFeePct,
12676
- protocolTakeRatePct: reserveDto.protocolTakeRatePct,
12677
- protocolLiquidationFeePct: reserveDto.protocolLiquidationFeePct,
12678
- loanToValuePct: reserveDto.loanToValuePct,
12679
- liquidationThresholdPct: reserveDto.liquidationThresholdPct,
12680
- minLiquidationBonusBps: reserveDto.minLiquidationBonusBps,
12681
- maxLiquidationBonusBps: reserveDto.maxLiquidationBonusBps,
12682
- badDebtLiquidationBonusBps: reserveDto.badDebtLiquidationBonusBps,
12683
- deleveragingMarginCallPeriodSecs: new BN2(
12684
- reserveDto.deleveragingMarginCallPeriodSecs
12685
- ),
12686
- deleveragingThresholdDecreaseBpsPerDay: new BN2(
12687
- reserveDto.deleveragingThresholdDecreaseBpsPerDay
12688
- ),
12689
- fees: {
12690
- borrowFeeSf: new BN2(reserveDto.fees.borrowFeeSf),
12691
- flashLoanFeeSf: new BN2(reserveDto.fees.flashLoanFeeSf),
12692
- padding: reserveDto.fees.padding
12693
- },
12694
- borrowRateCurve: {
12695
- points: reserveDto.borrowRateCurve.points.map((item) => ({
12696
- utilizationRateBps: item.utilizationRateBps,
12697
- borrowRateBps: item.borrowRateBps
12698
- }))
12699
- },
12700
- borrowFactorPct: new BN2(reserveDto.borrowFactorPct),
12701
- depositLimit: new BN2(reserveDto.depositLimit),
12702
- borrowLimit: new BN2(reserveDto.borrowLimit),
12703
- tokenInfo: dtoToTokenInfoFields(reserveDto.tokenInfo),
12704
- depositWithdrawalCap: dtoToWithdrawalCapsFields(
12705
- reserveDto.depositWithdrawalCap
12706
- ),
12707
- debtWithdrawalCap: dtoToWithdrawalCapsFields(reserveDto.debtWithdrawalCap),
12708
- elevationGroups: reserveDto.elevationGroups,
12709
- disableUsageAsCollOutsideEmode: reserveDto.disableUsageAsCollOutsideEmode,
12710
- utilizationLimitBlockBorrowingAbovePct: reserveDto.utilizationLimitBlockBorrowingAbovePct,
12711
- autodeleverageEnabled: reserveDto.autodeleverageEnabled,
12712
- reserved1: reserveDto.reserved1,
12713
- borrowLimitOutsideElevationGroup: new BN2(
12714
- reserveDto.borrowLimitOutsideElevationGroup
12715
- ),
12716
- borrowLimitAgainstThisCollateralInElevationGroup: reserveDto.borrowLimitAgainstThisCollateralInElevationGroup.map(
12717
- (item) => new BN2(item)
12718
- ),
12719
- deleveragingBonusIncreaseBpsPerDay: new BN2(
12720
- reserveDto.deleveragingBonusIncreaseBpsPerDay
12721
- )
12722
- };
12723
- }
12724
- function dtoToTokenInfoFields(tokenInfoDto) {
12725
- return {
12726
- name: tokenInfoDto.name,
12727
- heuristic: {
12728
- lower: new BN2(tokenInfoDto.heuristic.lower),
12729
- upper: new BN2(tokenInfoDto.heuristic.upper),
12730
- exp: new BN2(tokenInfoDto.heuristic.exp)
12731
- },
12732
- maxTwapDivergenceBps: new BN2(tokenInfoDto.maxTwapDivergenceBps),
12733
- maxAgePriceSeconds: new BN2(tokenInfoDto.maxAgePriceSeconds),
12734
- maxAgeTwapSeconds: new BN2(tokenInfoDto.maxAgeTwapSeconds),
12735
- scopeConfiguration: {
12736
- priceFeed: new PublicKey(tokenInfoDto.scopeConfiguration.priceFeed),
12737
- priceChain: tokenInfoDto.scopeConfiguration.priceChain,
12738
- twapChain: tokenInfoDto.scopeConfiguration.twapChain
12739
- },
12740
- switchboardConfiguration: {
12741
- priceAggregator: new PublicKey(
12742
- tokenInfoDto.switchboardConfiguration.priceAggregator
12413
+ accumulatedReferrerFeesSf: new BN5(
12414
+ reserveDto.liquidity.accumulatedReferrerFeesSf
12743
12415
  ),
12744
- twapAggregator: new PublicKey(
12745
- tokenInfoDto.switchboardConfiguration.twapAggregator
12746
- )
12747
- },
12748
- pythConfiguration: {
12749
- price: new PublicKey(tokenInfoDto.pythConfiguration.price)
12416
+ pendingReferrerFeesSf: new BN5(reserveDto.liquidity.pendingReferrerFeesSf)
12750
12417
  },
12751
- blockPriceUsage: tokenInfoDto.blockPriceUsage,
12752
- reserved: tokenInfoDto.reserved,
12753
- padding: tokenInfoDto.padding.map((item) => new BN2(item))
12754
- };
12755
- }
12756
- function dtoToWithdrawalCapsFields(withdrawalCapsDto) {
12757
- return {
12758
- configCapacity: new BN2(withdrawalCapsDto.configCapacity),
12759
- currentTotal: new BN2(withdrawalCapsDto.currentTotal),
12760
- lastIntervalStartTimestamp: new BN2(
12761
- withdrawalCapsDto.lastIntervalStartTimestamp
12762
- ),
12763
- configIntervalLengthSeconds: new BN2(
12764
- withdrawalCapsDto.configIntervalLengthSeconds
12765
- )
12766
- };
12767
- }
12768
- function dtoToObligationCollateralFields(obligationCollateralDto) {
12769
- return {
12770
- depositReserve: new PublicKey(obligationCollateralDto.depositReserve),
12771
- depositedAmount: new BN2(obligationCollateralDto.depositedAmount),
12772
- marketValueSf: new BN2(obligationCollateralDto.marketValueSf),
12773
- borrowedAmountAgainstThisCollateralInElevationGroup: new BN2(
12774
- obligationCollateralDto.borrowedAmountAgainstThisCollateralInElevationGroup
12775
- ),
12776
- padding: obligationCollateralDto.padding.map((item) => new BN2(item))
12777
- };
12778
- }
12779
- function dtoToObligationLiquidityFields(obligationLiquidityDto) {
12780
- return {
12781
- borrowReserve: new PublicKey(obligationLiquidityDto.borrowReserve),
12782
- cumulativeBorrowRateBsf: {
12783
- value: obligationLiquidityDto.cumulativeBorrowRateBsf.value.map(
12784
- (item) => new BN2(item)
12785
- ),
12786
- padding: obligationLiquidityDto.cumulativeBorrowRateBsf.padding.map(
12787
- (item) => new BN2(item)
12788
- )
12789
- },
12790
- padding: new BN2(obligationLiquidityDto.padding),
12791
- borrowedAmountSf: new BN2(obligationLiquidityDto.borrowedAmountSf),
12792
- marketValueSf: new BN2(obligationLiquidityDto.marketValueSf),
12793
- borrowFactorAdjustedMarketValueSf: new BN2(
12794
- obligationLiquidityDto.borrowFactorAdjustedMarketValueSf
12795
- ),
12796
- borrowedAmountOutsideElevationGroups: new BN2(
12797
- obligationLiquidityDto.borrowedAmountOutsideElevationGroups
12798
- ),
12799
- padding2: obligationLiquidityDto.padding2.map((item) => new BN2(item))
12800
- };
12801
- }
12802
- function dtoToObligationOrderFields(obligationOrderDto) {
12803
- return {
12804
- conditionThresholdSf: new BN2(obligationOrderDto.conditionThresholdSf),
12805
- opportunityParameterSf: new BN2(obligationOrderDto.opportunityParameterSf),
12806
- minExecutionBonusBps: obligationOrderDto.minExecutionBonusBps,
12807
- maxExecutionBonusBps: obligationOrderDto.maxExecutionBonusBps,
12808
- conditionType: obligationOrderDto.conditionType,
12809
- opportunityType: obligationOrderDto.opportunityType,
12810
- padding1: obligationOrderDto.padding1,
12811
- padding2: obligationOrderDto.padding2.map((item) => new BN2(item))
12418
+ collateral: {
12419
+ mintPubkey: new PublicKey(reserveDto.collateral.mintPubkey),
12420
+ mintTotalSupply: new BN5(reserveDto.collateral.mintTotalSupply),
12421
+ supplyVault: new PublicKey(reserveDto.collateral.supplyVault)
12422
+ },
12423
+ config: {
12424
+ protocolTakeRatePct: reserveDto.config.protocolTakeRatePct,
12425
+ hostFixedInterestRateBps: reserveDto.config.hostFixedInterestRateBps,
12426
+ depositLimit: new BN5(reserveDto.config.depositLimit),
12427
+ borrowLimit: new BN5(reserveDto.config.borrowLimit),
12428
+ borrowRateCurve: {
12429
+ points: reserveDto.config.borrowRateCurve.points.map((item) => ({
12430
+ utilizationRateBps: item.utilizationRateBps,
12431
+ borrowRateBps: item.borrowRateBps
12432
+ }))
12433
+ },
12434
+ tokenInfo: {
12435
+ scopeConfiguration: {
12436
+ priceFeed: new PublicKey(
12437
+ reserveDto.config.tokenInfo.scopeConfiguration.priceFeed
12438
+ )
12439
+ },
12440
+ switchboardConfiguration: {
12441
+ priceAggregator: new PublicKey(
12442
+ reserveDto.config.tokenInfo.switchboardConfiguration.priceAggregator
12443
+ ),
12444
+ twapAggregator: new PublicKey(
12445
+ reserveDto.config.tokenInfo.switchboardConfiguration.twapAggregator
12446
+ )
12447
+ },
12448
+ pythConfiguration: {
12449
+ price: new PublicKey(
12450
+ reserveDto.config.tokenInfo.pythConfiguration.price
12451
+ )
12452
+ }
12453
+ }
12454
+ }
12812
12455
  };
12813
12456
  }
12814
12457
  var SEED_LENDING_MARKET_AUTH = "lma";
@@ -12934,9 +12577,9 @@ var Fraction = class _Fraction {
12934
12577
  static MAX_SIZE_BF = 256;
12935
12578
  static FRACTIONS = 60;
12936
12579
  static MULTIPLIER = new FractionDecimal(2).pow(_Fraction.FRACTIONS);
12937
- static MAX_F_BN = new BN2(2).pow(new BN2(_Fraction.MAX_SIZE_F)).sub(new BN2(1));
12938
- static MAX_BF_BN = new BN2(2).pow(new BN2(_Fraction.MAX_SIZE_BF)).sub(new BN2(1));
12939
- static MIN_BN = new BN2(0);
12580
+ static MAX_F_BN = new BN5(2).pow(new BN5(_Fraction.MAX_SIZE_F)).sub(new BN5(1));
12581
+ static MAX_BF_BN = new BN5(2).pow(new BN5(_Fraction.MAX_SIZE_BF)).sub(new BN5(1));
12582
+ static MIN_BN = new BN5(0);
12940
12583
  valueSf;
12941
12584
  constructor(valueSf) {
12942
12585
  if (valueSf.lt(_Fraction.MIN_BN) || valueSf.gt(_Fraction.MAX_BF_BN)) {
@@ -12952,7 +12595,7 @@ var Fraction = class _Fraction {
12952
12595
  static fromDecimal(n) {
12953
12596
  const scaledDecimal = new FractionDecimal(n).mul(_Fraction.MULTIPLIER);
12954
12597
  const roundedScaledDecimal = roundNearest(scaledDecimal);
12955
- const scaledValue = new BN2(roundedScaledDecimal.toFixed());
12598
+ const scaledValue = new BN5(roundedScaledDecimal.toFixed());
12956
12599
  return new _Fraction(scaledValue);
12957
12600
  }
12958
12601
  static fromBps(n) {
@@ -12982,7 +12625,7 @@ var Fraction = class _Fraction {
12982
12625
  return this.valueSf.eq(x.getValue());
12983
12626
  }
12984
12627
  };
12985
- new Fraction(new BN2(0));
12628
+ new Fraction(new BN5(0));
12986
12629
  function roundNearest(decimal) {
12987
12630
  return decimal.toDecimalPlaces(0, Decimal3.ROUND_HALF_CEIL);
12988
12631
  }
@@ -13185,76 +12828,26 @@ function lamportsToNumberDecimal(amount, decimals) {
13185
12828
  }
13186
12829
 
13187
12830
  // src/vendor/klend/utils/farms/serialize.utils.ts
13188
- function farmRawToDto(farmRaw) {
12831
+ function kaminoFarmStateToDto(farmState) {
13189
12832
  return {
13190
- farmAdmin: farmRaw.farmAdmin.toBase58(),
13191
- globalConfig: farmRaw.globalConfig.toBase58(),
13192
12833
  token: {
13193
- mint: farmRaw.token.mint.toBase58(),
13194
- decimals: farmRaw.token.decimals.toString(),
13195
- tokenProgram: farmRaw.token.tokenProgram.toBase58(),
13196
- padding: farmRaw.token.padding.map((p) => p.toString())
12834
+ mint: farmState.token.mint.toBase58(),
12835
+ decimals: farmState.token.decimals.toString()
13197
12836
  },
13198
- rewardInfos: farmRaw.rewardInfos.map((item) => ({
12837
+ rewardInfos: farmState.rewardInfos.map((item) => ({
13199
12838
  token: {
13200
12839
  mint: item.token.mint.toBase58(),
13201
- decimals: item.token.decimals.toString(),
13202
- tokenProgram: item.token.tokenProgram.toBase58(),
13203
- padding: item.token.padding.map((p) => p.toString())
12840
+ decimals: item.token.decimals.toString()
13204
12841
  },
13205
- rewardsVault: item.rewardsVault.toBase58(),
13206
12842
  rewardsAvailable: item.rewardsAvailable.toString(),
12843
+ rewardsPerSecondDecimals: item.rewardsPerSecondDecimals,
13207
12844
  rewardScheduleCurve: {
13208
12845
  points: item.rewardScheduleCurve.points.map((p) => ({
13209
12846
  tsStart: p.tsStart.toString(),
13210
12847
  rewardPerTimeUnit: p.rewardPerTimeUnit.toString()
13211
12848
  }))
13212
- },
13213
- minClaimDurationSeconds: item.minClaimDurationSeconds.toString(),
13214
- lastIssuanceTs: item.lastIssuanceTs.toString(),
13215
- rewardsIssuedUnclaimed: item.rewardsIssuedUnclaimed.toString(),
13216
- rewardsIssuedCumulative: item.rewardsIssuedCumulative.toString(),
13217
- rewardPerShareScaled: item.rewardPerShareScaled.toString(),
13218
- placeholder0: item.placeholder0.toString(),
13219
- rewardType: item.rewardType,
13220
- rewardsPerSecondDecimals: item.rewardsPerSecondDecimals,
13221
- padding0: item.padding0,
13222
- padding1: item.padding1.map((p) => p.toString())
13223
- })),
13224
- numRewardTokens: farmRaw.numRewardTokens.toString(),
13225
- numUsers: farmRaw.numUsers.toString(),
13226
- totalStakedAmount: farmRaw.totalStakedAmount.toString(),
13227
- farmVault: farmRaw.farmVault.toBase58(),
13228
- farmVaultsAuthority: farmRaw.farmVaultsAuthority.toBase58(),
13229
- farmVaultsAuthorityBump: farmRaw.farmVaultsAuthorityBump.toString(),
13230
- delegateAuthority: farmRaw.delegateAuthority.toBase58(),
13231
- timeUnit: farmRaw.timeUnit,
13232
- isFarmFrozen: farmRaw.isFarmFrozen,
13233
- isFarmDelegated: farmRaw.isFarmDelegated,
13234
- padding0: farmRaw.padding0,
13235
- withdrawAuthority: farmRaw.withdrawAuthority.toBase58(),
13236
- depositWarmupPeriod: farmRaw.depositWarmupPeriod,
13237
- withdrawalCooldownPeriod: farmRaw.withdrawalCooldownPeriod,
13238
- totalActiveStakeScaled: farmRaw.totalActiveStakeScaled.toString(),
13239
- totalPendingStakeScaled: farmRaw.totalPendingStakeScaled.toString(),
13240
- totalPendingAmount: farmRaw.totalPendingAmount.toString(),
13241
- slashedAmountCurrent: farmRaw.slashedAmountCurrent.toString(),
13242
- slashedAmountCumulative: farmRaw.slashedAmountCumulative.toString(),
13243
- slashedAmountSpillAddress: farmRaw.slashedAmountSpillAddress.toBase58(),
13244
- lockingMode: farmRaw.lockingMode.toString(),
13245
- lockingStartTimestamp: farmRaw.lockingStartTimestamp.toString(),
13246
- lockingDuration: farmRaw.lockingDuration.toString(),
13247
- lockingEarlyWithdrawalPenaltyBps: farmRaw.lockingEarlyWithdrawalPenaltyBps.toString(),
13248
- depositCapAmount: farmRaw.depositCapAmount.toString(),
13249
- scopePrices: farmRaw.scopePrices.toBase58(),
13250
- scopeOraclePriceId: farmRaw.scopeOraclePriceId.toString(),
13251
- scopeOracleMaxAge: farmRaw.scopeOracleMaxAge.toString(),
13252
- pendingFarmAdmin: farmRaw.pendingFarmAdmin.toBase58(),
13253
- strategyId: farmRaw.strategyId.toBase58(),
13254
- delegatedRpsAdmin: farmRaw.delegatedRpsAdmin.toBase58(),
13255
- vaultId: farmRaw.vaultId.toBase58(),
13256
- secondDelegatedAuthority: farmRaw.secondDelegatedAuthority.toBase58(),
13257
- padding: farmRaw.padding.map((item) => item.toString())
12849
+ }
12850
+ }))
13258
12851
  };
13259
12852
  }
13260
12853
  var farmDiscriminator = Buffer.from([198, 102, 216, 74, 63, 66, 163, 190]);
@@ -13349,78 +12942,26 @@ function decodeFarmDataRaw(data) {
13349
12942
  const dec = farmLayout.decode(data.slice(8));
13350
12943
  return dec;
13351
12944
  }
13352
- function dtoToFarmRaw(dto) {
12945
+ function dtoToKaminoFarmState(dto) {
13353
12946
  return {
13354
- farmAdmin: new PublicKey(dto.farmAdmin),
13355
- globalConfig: new PublicKey(dto.globalConfig),
13356
12947
  token: {
13357
12948
  mint: new PublicKey(dto.token.mint),
13358
- decimals: new BN2(dto.token.decimals),
13359
- tokenProgram: new PublicKey(dto.token.tokenProgram),
13360
- padding: dto.token.padding.map((item) => new BN2(item))
12949
+ decimals: new BN5(dto.token.decimals)
13361
12950
  },
13362
12951
  rewardInfos: dto.rewardInfos.map((item) => ({
13363
12952
  token: {
13364
12953
  mint: new PublicKey(item.token.mint),
13365
- decimals: new BN2(item.token.decimals),
13366
- tokenProgram: new PublicKey(item.token.tokenProgram),
13367
- padding: item.token.padding.map((p) => new BN2(p))
12954
+ decimals: new BN5(item.token.decimals)
13368
12955
  },
13369
- rewardsVault: new PublicKey(item.rewardsVault),
13370
- rewardsAvailable: new BN2(item.rewardsAvailable),
12956
+ rewardsAvailable: new BN5(item.rewardsAvailable),
12957
+ rewardsPerSecondDecimals: item.rewardsPerSecondDecimals,
13371
12958
  rewardScheduleCurve: {
13372
12959
  points: item.rewardScheduleCurve.points.map((p) => ({
13373
- tsStart: new BN2(p.tsStart),
13374
- rewardPerTimeUnit: new BN2(p.rewardPerTimeUnit)
12960
+ tsStart: new BN5(p.tsStart),
12961
+ rewardPerTimeUnit: new BN5(p.rewardPerTimeUnit)
13375
12962
  }))
13376
- },
13377
- minClaimDurationSeconds: new BN2(item.minClaimDurationSeconds),
13378
- lastIssuanceTs: new BN2(item.lastIssuanceTs),
13379
- rewardsIssuedUnclaimed: new BN2(item.rewardsIssuedUnclaimed),
13380
- rewardsIssuedCumulative: new BN2(item.rewardsIssuedCumulative),
13381
- rewardPerShareScaled: new BN2(item.rewardPerShareScaled),
13382
- placeholder0: new BN2(item.placeholder0),
13383
- rewardType: item.rewardType,
13384
- rewardsPerSecondDecimals: item.rewardsPerSecondDecimals,
13385
- padding0: item.padding0,
13386
- padding1: item.padding1.map((p) => new BN2(p))
13387
- })),
13388
- numRewardTokens: new BN2(dto.numRewardTokens),
13389
- numUsers: new BN2(dto.numUsers),
13390
- totalStakedAmount: new BN2(dto.totalStakedAmount),
13391
- farmVault: new PublicKey(dto.farmVault),
13392
- farmVaultsAuthority: new PublicKey(dto.farmVaultsAuthority),
13393
- farmVaultsAuthorityBump: new BN2(dto.farmVaultsAuthorityBump),
13394
- delegateAuthority: new PublicKey(dto.delegateAuthority),
13395
- timeUnit: dto.timeUnit,
13396
- isFarmFrozen: dto.isFarmFrozen,
13397
- isFarmDelegated: dto.isFarmDelegated,
13398
- padding0: dto.padding0,
13399
- withdrawAuthority: new PublicKey(dto.withdrawAuthority),
13400
- depositWarmupPeriod: dto.depositWarmupPeriod,
13401
- withdrawalCooldownPeriod: dto.withdrawalCooldownPeriod,
13402
- totalActiveStakeScaled: new BN2(dto.totalActiveStakeScaled),
13403
- totalPendingStakeScaled: new BN2(dto.totalPendingStakeScaled),
13404
- totalPendingAmount: new BN2(dto.totalPendingAmount),
13405
- slashedAmountCurrent: new BN2(dto.slashedAmountCurrent),
13406
- slashedAmountCumulative: new BN2(dto.slashedAmountCumulative),
13407
- slashedAmountSpillAddress: new PublicKey(dto.slashedAmountSpillAddress),
13408
- lockingMode: new BN2(dto.lockingMode),
13409
- lockingStartTimestamp: new BN2(dto.lockingStartTimestamp),
13410
- lockingDuration: new BN2(dto.lockingDuration),
13411
- lockingEarlyWithdrawalPenaltyBps: new BN2(
13412
- dto.lockingEarlyWithdrawalPenaltyBps
13413
- ),
13414
- depositCapAmount: new BN2(dto.depositCapAmount),
13415
- scopePrices: new PublicKey(dto.scopePrices),
13416
- scopeOraclePriceId: new BN2(dto.scopeOraclePriceId),
13417
- scopeOracleMaxAge: new BN2(dto.scopeOracleMaxAge),
13418
- pendingFarmAdmin: new PublicKey(dto.pendingFarmAdmin),
13419
- strategyId: new PublicKey(dto.strategyId),
13420
- delegatedRpsAdmin: new PublicKey(dto.delegatedRpsAdmin),
13421
- vaultId: new PublicKey(dto.vaultId),
13422
- secondDelegatedAuthority: new PublicKey(dto.secondDelegatedAuthority),
13423
- padding: dto.padding.map((item) => new BN2(item))
12963
+ }
12964
+ }))
13424
12965
  };
13425
12966
  }
13426
12967
 
@@ -27582,23 +27123,23 @@ function dtoToDriftUserStatsRaw(userStatsDto) {
27582
27123
  authority: new PublicKey(userStatsDto.authority),
27583
27124
  referrer: new PublicKey(userStatsDto.referrer),
27584
27125
  fees: {
27585
- totalFeePaid: new BN2(userStatsDto.fees.totalFeePaid),
27586
- totalFeeRebate: new BN2(userStatsDto.fees.totalFeeRebate),
27587
- totalTokenDiscount: new BN2(userStatsDto.fees.totalTokenDiscount),
27588
- totalRefereeDiscount: new BN2(userStatsDto.fees.totalRefereeDiscount),
27589
- totalReferrerReward: new BN2(userStatsDto.fees.totalReferrerReward),
27590
- currentEpochReferrerReward: new BN2(
27126
+ totalFeePaid: new BN5(userStatsDto.fees.totalFeePaid),
27127
+ totalFeeRebate: new BN5(userStatsDto.fees.totalFeeRebate),
27128
+ totalTokenDiscount: new BN5(userStatsDto.fees.totalTokenDiscount),
27129
+ totalRefereeDiscount: new BN5(userStatsDto.fees.totalRefereeDiscount),
27130
+ totalReferrerReward: new BN5(userStatsDto.fees.totalReferrerReward),
27131
+ currentEpochReferrerReward: new BN5(
27591
27132
  userStatsDto.fees.currentEpochReferrerReward
27592
27133
  )
27593
27134
  },
27594
- nextEpochTs: new BN2(userStatsDto.nextEpochTs),
27595
- makerVolume30d: new BN2(userStatsDto.makerVolume30d),
27596
- takerVolume30d: new BN2(userStatsDto.takerVolume30d),
27597
- fillerVolume30d: new BN2(userStatsDto.fillerVolume30d),
27598
- lastMakerVolume30dTs: new BN2(userStatsDto.lastMakerVolume30dTs),
27599
- lastTakerVolume30dTs: new BN2(userStatsDto.lastTakerVolume30dTs),
27600
- lastFillerVolume30dTs: new BN2(userStatsDto.lastFillerVolume30dTs),
27601
- ifStakedQuoteAssetAmount: new BN2(userStatsDto.ifStakedQuoteAssetAmount),
27135
+ nextEpochTs: new BN5(userStatsDto.nextEpochTs),
27136
+ makerVolume30d: new BN5(userStatsDto.makerVolume30d),
27137
+ takerVolume30d: new BN5(userStatsDto.takerVolume30d),
27138
+ fillerVolume30d: new BN5(userStatsDto.fillerVolume30d),
27139
+ lastMakerVolume30dTs: new BN5(userStatsDto.lastMakerVolume30dTs),
27140
+ lastTakerVolume30dTs: new BN5(userStatsDto.lastTakerVolume30dTs),
27141
+ lastFillerVolume30dTs: new BN5(userStatsDto.lastFillerVolume30dTs),
27142
+ ifStakedQuoteAssetAmount: new BN5(userStatsDto.ifStakedQuoteAssetAmount),
27602
27143
  numberOfSubAccounts: userStatsDto.numberOfSubAccounts,
27603
27144
  numberOfSubAccountsCreated: userStatsDto.numberOfSubAccountsCreated,
27604
27145
  referrerStatus: userStatsDto.referrerStatus,
@@ -27611,7 +27152,7 @@ function dtoToDriftUserStatsRaw(userStatsDto) {
27611
27152
  fuelPositions: userStatsDto.fuelPositions,
27612
27153
  fuelTaker: userStatsDto.fuelTaker,
27613
27154
  fuelMaker: userStatsDto.fuelMaker,
27614
- ifStakedGovTokenAmount: new BN2(userStatsDto.ifStakedGovTokenAmount),
27155
+ ifStakedGovTokenAmount: new BN5(userStatsDto.ifStakedGovTokenAmount),
27615
27156
  lastFuelIfBonusUpdateTs: userStatsDto.lastFuelIfBonusUpdateTs,
27616
27157
  padding: userStatsDto.padding
27617
27158
  };
@@ -27620,10 +27161,10 @@ function dtoToDriftUserRaw(userDto) {
27620
27161
  return {
27621
27162
  authority: new PublicKey(userDto.authority),
27622
27163
  spotPositions: userDto.spotPositions.map((p) => ({
27623
- scaledBalance: new BN2(p.scaledBalance),
27624
- openBids: new BN2(p.openBids),
27625
- openAsks: new BN2(p.openAsks),
27626
- cumulativeDeposits: new BN2(p.cumulativeDeposits),
27164
+ scaledBalance: new BN5(p.scaledBalance),
27165
+ openBids: new BN5(p.openBids),
27166
+ openAsks: new BN5(p.openAsks),
27167
+ cumulativeDeposits: new BN5(p.cumulativeDeposits),
27627
27168
  marketIndex: p.marketIndex,
27628
27169
  balanceType: p.balanceType,
27629
27170
  openOrders: p.openOrders,
@@ -27641,9 +27182,9 @@ function dtoToDriftStateRaw(stateDto) {
27641
27182
  perpFeeStructure: stateDto.perpFeeStructure,
27642
27183
  spotFeeStructure: stateDto.spotFeeStructure,
27643
27184
  oracleGuardRails: stateDto.oracleGuardRails,
27644
- numberOfAuthorities: new BN2(stateDto.numberOfAuthorities),
27645
- numberOfSubAccounts: new BN2(stateDto.numberOfSubAccounts),
27646
- lpCooldownTime: new BN2(stateDto.lpCooldownTime),
27185
+ numberOfAuthorities: new BN5(stateDto.numberOfAuthorities),
27186
+ numberOfSubAccounts: new BN5(stateDto.numberOfSubAccounts),
27187
+ lpCooldownTime: new BN5(stateDto.lpCooldownTime),
27647
27188
  liquidationMarginBufferRatio: stateDto.liquidationMarginBufferRatio,
27648
27189
  settlementDuration: stateDto.settlementDuration,
27649
27190
  numberOfMarkets: stateDto.numberOfMarkets,
@@ -27667,10 +27208,10 @@ function dtoToDriftRewardsRaw(rewardsDto) {
27667
27208
  spotMarket: new PublicKey(rewardsDto.spotMarket),
27668
27209
  mint: new PublicKey(rewardsDto.mint),
27669
27210
  spotPosition: {
27670
- scaledBalance: new BN2(rewardsDto.spotPosition.scaledBalance),
27671
- openBids: new BN2(rewardsDto.spotPosition.openBids),
27672
- openAsks: new BN2(rewardsDto.spotPosition.openAsks),
27673
- cumulativeDeposits: new BN2(rewardsDto.spotPosition.cumulativeDeposits),
27211
+ scaledBalance: new BN5(rewardsDto.spotPosition.scaledBalance),
27212
+ openBids: new BN5(rewardsDto.spotPosition.openBids),
27213
+ openAsks: new BN5(rewardsDto.spotPosition.openAsks),
27214
+ cumulativeDeposits: new BN5(rewardsDto.spotPosition.cumulativeDeposits),
27674
27215
  marketIndex: rewardsDto.spotPosition.marketIndex,
27675
27216
  balanceType: rewardsDto.spotPosition.balanceType,
27676
27217
  openOrders: rewardsDto.spotPosition.openOrders,
@@ -27684,11 +27225,11 @@ function dtoToDriftSpotMarketRaw(spotMarketDto) {
27684
27225
  oracle: new PublicKey(spotMarketDto.oracle),
27685
27226
  mint: new PublicKey(spotMarketDto.mint),
27686
27227
  decimals: spotMarketDto.decimals,
27687
- cumulativeDepositInterest: new BN2(spotMarketDto.cumulativeDepositInterest),
27228
+ cumulativeDepositInterest: new BN5(spotMarketDto.cumulativeDepositInterest),
27688
27229
  marketIndex: spotMarketDto.marketIndex,
27689
- depositBalance: new BN2(spotMarketDto.depositBalance),
27690
- borrowBalance: new BN2(spotMarketDto.borrowBalance),
27691
- cumulativeBorrowInterest: new BN2(spotMarketDto.cumulativeBorrowInterest),
27230
+ depositBalance: new BN5(spotMarketDto.depositBalance),
27231
+ borrowBalance: new BN5(spotMarketDto.borrowBalance),
27232
+ cumulativeBorrowInterest: new BN5(spotMarketDto.cumulativeBorrowInterest),
27692
27233
  optimalUtilization: spotMarketDto.optimalUtilization,
27693
27234
  optimalBorrowRate: spotMarketDto.optimalBorrowRate,
27694
27235
  maxBorrowRate: spotMarketDto.maxBorrowRate,
@@ -27810,10 +27351,10 @@ function decodeDriftUserData(data) {
27810
27351
  return {
27811
27352
  authority: decoded.authority,
27812
27353
  spotPositions: decoded.spot_positions.map((p) => ({
27813
- scaledBalance: new BN2(p.scaled_balance),
27814
- openBids: new BN2(p.open_bids),
27815
- openAsks: new BN2(p.open_asks),
27816
- cumulativeDeposits: new BN2(p.cumulative_deposits),
27354
+ scaledBalance: new BN5(p.scaled_balance),
27355
+ openBids: new BN5(p.open_bids),
27356
+ openAsks: new BN5(p.open_asks),
27357
+ cumulativeDeposits: new BN5(p.cumulative_deposits),
27817
27358
  marketIndex: p.market_index,
27818
27359
  balanceType: p.balance_type,
27819
27360
  openOrders: p.open_orders,
@@ -27920,7 +27461,7 @@ function deriveDriftUser(authority, subAccountId, programId = DRIFT_PROGRAM_ID)
27920
27461
  [
27921
27462
  Buffer.from(SEED_USER),
27922
27463
  authority.toBuffer(),
27923
- new BN2(subAccountId).toArrayLike(Buffer, "le", 2)
27464
+ new BN5(subAccountId).toArrayLike(Buffer, "le", 2)
27924
27465
  ],
27925
27466
  programId
27926
27467
  );
@@ -27935,7 +27476,7 @@ function deriveDriftSpotMarket(marketIndex, programId = DRIFT_PROGRAM_ID) {
27935
27476
  return PublicKey.findProgramAddressSync(
27936
27477
  [
27937
27478
  Buffer.from(SEED_SPOT_MARKET),
27938
- new BN2(marketIndex).toArrayLike(Buffer, "le", 2)
27479
+ new BN5(marketIndex).toArrayLike(Buffer, "le", 2)
27939
27480
  ],
27940
27481
  programId
27941
27482
  );
@@ -27944,23 +27485,23 @@ function deriveDriftSpotMarketVault(marketIndex, programId = DRIFT_PROGRAM_ID) {
27944
27485
  return PublicKey.findProgramAddressSync(
27945
27486
  [
27946
27487
  Buffer.from(SEED_SPOT_MARKET_VAULT),
27947
- new BN2(marketIndex).toArrayLike(Buffer, "le", 2)
27488
+ new BN5(marketIndex).toArrayLike(Buffer, "le", 2)
27948
27489
  ],
27949
27490
  programId
27950
27491
  );
27951
27492
  }
27952
- var ZERO = new BN2(0);
27953
- var ONE = new BN2(1);
27954
- var TEN = new BN2(10);
27955
- var PERCENTAGE_PRECISION_EXP = new BN2(6);
27956
- var PERCENTAGE_PRECISION = new BN2(10).pow(PERCENTAGE_PRECISION_EXP);
27957
- var SPOT_MARKET_RATE_PRECISION_EXP = new BN2(6);
27958
- var SPOT_MARKET_RATE_PRECISION = new BN2(10).pow(SPOT_MARKET_RATE_PRECISION_EXP);
27959
- var SPOT_MARKET_UTILIZATION_PRECISION_EXP = new BN2(6);
27960
- var SPOT_MARKET_UTILIZATION_PRECISION = new BN2(10).pow(
27493
+ var ZERO = new BN5(0);
27494
+ var ONE = new BN5(1);
27495
+ var TEN = new BN5(10);
27496
+ var PERCENTAGE_PRECISION_EXP = new BN5(6);
27497
+ var PERCENTAGE_PRECISION = new BN5(10).pow(PERCENTAGE_PRECISION_EXP);
27498
+ var SPOT_MARKET_RATE_PRECISION_EXP = new BN5(6);
27499
+ var SPOT_MARKET_RATE_PRECISION = new BN5(10).pow(SPOT_MARKET_RATE_PRECISION_EXP);
27500
+ var SPOT_MARKET_UTILIZATION_PRECISION_EXP = new BN5(6);
27501
+ var SPOT_MARKET_UTILIZATION_PRECISION = new BN5(10).pow(
27961
27502
  SPOT_MARKET_UTILIZATION_PRECISION_EXP
27962
27503
  );
27963
- var ONE_YEAR = new BN2(31536e3);
27504
+ var ONE_YEAR = new BN5(31536e3);
27964
27505
  function divCeil(a, b) {
27965
27506
  const quotient = a.div(b);
27966
27507
  const remainder = a.mod(b);
@@ -27970,7 +27511,7 @@ function divCeil(a, b) {
27970
27511
  return quotient;
27971
27512
  }
27972
27513
  function getDriftTokenAmount(balanceAmount, spotMarket, balanceType) {
27973
- const precisionDecrease = TEN.pow(new BN2(19 - spotMarket.decimals));
27514
+ const precisionDecrease = TEN.pow(new BN5(19 - spotMarket.decimals));
27974
27515
  if (isSpotBalanceTypeVariant(balanceType, "deposit")) {
27975
27516
  return balanceAmount.mul(spotMarket.cumulativeDepositInterest).div(precisionDecrease);
27976
27517
  } else {
@@ -28005,18 +27546,18 @@ function calculateDriftUtilization(bank, delta = ZERO) {
28005
27546
  }
28006
27547
  function calculateDriftInterestRate(bank, delta = ZERO, currentUtilization = null) {
28007
27548
  const utilization = currentUtilization || calculateDriftUtilization(bank, delta);
28008
- const optimalUtil = new BN2(bank.optimalUtilization);
28009
- const optimalRate = new BN2(bank.optimalBorrowRate);
28010
- const maxRate = new BN2(bank.maxBorrowRate);
28011
- const minRate = new BN2(bank.minBorrowRate).mul(PERCENTAGE_PRECISION.divn(200));
28012
- const weightsDivisor = new BN2(1e3);
27549
+ const optimalUtil = new BN5(bank.optimalUtilization);
27550
+ const optimalRate = new BN5(bank.optimalBorrowRate);
27551
+ const maxRate = new BN5(bank.maxBorrowRate);
27552
+ const minRate = new BN5(bank.minBorrowRate).mul(PERCENTAGE_PRECISION.divn(200));
27553
+ const weightsDivisor = new BN5(1e3);
28013
27554
  const segments = [
28014
- [new BN2(85e4), new BN2(50)],
28015
- [new BN2(9e5), new BN2(100)],
28016
- [new BN2(95e4), new BN2(150)],
28017
- [new BN2(99e4), new BN2(200)],
28018
- [new BN2(995e3), new BN2(250)],
28019
- [SPOT_MARKET_UTILIZATION_PRECISION, new BN2(250)]
27555
+ [new BN5(85e4), new BN5(50)],
27556
+ [new BN5(9e5), new BN5(100)],
27557
+ [new BN5(95e4), new BN5(150)],
27558
+ [new BN5(99e4), new BN5(200)],
27559
+ [new BN5(995e3), new BN5(250)],
27560
+ [SPOT_MARKET_UTILIZATION_PRECISION, new BN5(250)]
28020
27561
  ];
28021
27562
  let rate;
28022
27563
  if (utilization.lte(optimalUtil)) {
@@ -28041,7 +27582,7 @@ function calculateDriftInterestRate(bank, delta = ZERO, currentUtilization = nul
28041
27582
  }
28042
27583
  }
28043
27584
  }
28044
- return BN2.max(minRate, rate);
27585
+ return BN5.max(minRate, rate);
28045
27586
  }
28046
27587
  function calculateDriftBorrowRate(bank, delta = ZERO, currentUtilization = null) {
28047
27588
  return calculateDriftInterestRate(bank, delta, currentUtilization);
@@ -28049,7 +27590,7 @@ function calculateDriftBorrowRate(bank, delta = ZERO, currentUtilization = null)
28049
27590
  function calculateDriftDepositRate(bank, delta = ZERO, currentUtilization = null) {
28050
27591
  const utilization = currentUtilization || calculateDriftUtilization(bank, delta);
28051
27592
  const borrowRate = calculateDriftBorrowRate(bank, delta, utilization);
28052
- const depositRate = borrowRate.mul(PERCENTAGE_PRECISION.sub(new BN2(bank.insuranceFund.totalFactor))).mul(utilization).div(SPOT_MARKET_UTILIZATION_PRECISION).div(PERCENTAGE_PRECISION);
27593
+ const depositRate = borrowRate.mul(PERCENTAGE_PRECISION.sub(new BN5(bank.insuranceFund.totalFactor))).mul(utilization).div(SPOT_MARKET_UTILIZATION_PRECISION).div(PERCENTAGE_PRECISION);
28053
27594
  return depositRate;
28054
27595
  }
28055
27596
  function calculateDriftLendingAPY(bank, delta = ZERO, currentUtilization = null, compoundingPeriodsPerYear = 365) {
@@ -28057,7 +27598,7 @@ function calculateDriftLendingAPY(bank, delta = ZERO, currentUtilization = null,
28057
27598
  if (depositRate.eq(ZERO)) {
28058
27599
  return ZERO;
28059
27600
  }
28060
- const CALC_PRECISION = new BN2(10).pow(new BN2(18));
27601
+ const CALC_PRECISION = new BN5(10).pow(new BN5(18));
28061
27602
  const rateInCalcPrecisionDecimal = depositRate.mul(CALC_PRECISION).div(SPOT_MARKET_RATE_PRECISION);
28062
27603
  let expResult = CALC_PRECISION;
28063
27604
  let term = rateInCalcPrecisionDecimal;
@@ -28090,7 +27631,7 @@ function calculateDriftBorrowAPY(bank, delta = ZERO, currentUtilization = null,
28090
27631
  if (borrowRate.eq(ZERO)) {
28091
27632
  return ZERO;
28092
27633
  }
28093
- const CALC_PRECISION = new BN2(10).pow(new BN2(18));
27634
+ const CALC_PRECISION = new BN5(10).pow(new BN5(18));
28094
27635
  const rateInCalcPrecisionDecimal = borrowRate.mul(CALC_PRECISION).div(SPOT_MARKET_RATE_PRECISION);
28095
27636
  let expResult = CALC_PRECISION;
28096
27637
  let term = rateInCalcPrecisionDecimal;
@@ -28126,7 +27667,7 @@ function calculateAPYFromAPR2(apr) {
28126
27667
  function generateDriftReserveCurve(spotMarket) {
28127
27668
  return Array.from({ length: 101 }, (_, i) => {
28128
27669
  const utilizationPercent = i / 100;
28129
- const utilizationBN = new BN2(
27670
+ const utilizationBN = new BN5(
28130
27671
  Math.floor(utilizationPercent * SPOT_MARKET_UTILIZATION_PRECISION.toNumber())
28131
27672
  );
28132
27673
  const borrowRateBN = calculateDriftBorrowRate(spotMarket, ZERO, utilizationBN);
@@ -31532,29 +31073,29 @@ function decodeJupTokenReserveData(data, pubkey) {
31532
31073
  offset += 2;
31533
31074
  const lastUtilization = data.readUInt16LE(offset);
31534
31075
  offset += 2;
31535
- const lastUpdateTimestamp = new BN2(data.slice(offset, offset + 8), "le");
31076
+ const lastUpdateTimestamp = new BN5(data.slice(offset, offset + 8), "le");
31536
31077
  offset += 8;
31537
- const supplyExchangePrice = new BN2(data.slice(offset, offset + 8), "le");
31078
+ const supplyExchangePrice = new BN5(data.slice(offset, offset + 8), "le");
31538
31079
  offset += 8;
31539
- const borrowExchangePrice = new BN2(data.slice(offset, offset + 8), "le");
31080
+ const borrowExchangePrice = new BN5(data.slice(offset, offset + 8), "le");
31540
31081
  offset += 8;
31541
31082
  const maxUtilization = data.readUInt16LE(offset);
31542
31083
  offset += 2;
31543
- const totalSupplyWithInterest = new BN2(data.slice(offset, offset + 8), "le");
31084
+ const totalSupplyWithInterest = new BN5(data.slice(offset, offset + 8), "le");
31544
31085
  offset += 8;
31545
- const totalSupplyInterestFree = new BN2(data.slice(offset, offset + 8), "le");
31086
+ const totalSupplyInterestFree = new BN5(data.slice(offset, offset + 8), "le");
31546
31087
  offset += 8;
31547
- const totalBorrowWithInterest = new BN2(data.slice(offset, offset + 8), "le");
31088
+ const totalBorrowWithInterest = new BN5(data.slice(offset, offset + 8), "le");
31548
31089
  offset += 8;
31549
- const totalBorrowInterestFree = new BN2(data.slice(offset, offset + 8), "le");
31090
+ const totalBorrowInterestFree = new BN5(data.slice(offset, offset + 8), "le");
31550
31091
  offset += 8;
31551
- const totalClaimAmount = new BN2(data.slice(offset, offset + 8), "le");
31092
+ const totalClaimAmount = new BN5(data.slice(offset, offset + 8), "le");
31552
31093
  offset += 8;
31553
31094
  const interactingProtocol = new PublicKey(data.slice(offset, offset + 32));
31554
31095
  offset += 32;
31555
- const interactingTimestamp = new BN2(data.slice(offset, offset + 8), "le");
31096
+ const interactingTimestamp = new BN5(data.slice(offset, offset + 8), "le");
31556
31097
  offset += 8;
31557
- const interactingBalance = new BN2(data.slice(offset, offset + 8), "le");
31098
+ const interactingBalance = new BN5(data.slice(offset, offset + 8), "le");
31558
31099
  return {
31559
31100
  pubkey,
31560
31101
  mint,
@@ -31616,9 +31157,9 @@ function dtoToJupLendingStateRaw(dto) {
31616
31157
  lendingId: dto.lendingId,
31617
31158
  decimals: dto.decimals,
31618
31159
  rewardsRateModel: new PublicKey(dto.rewardsRateModel),
31619
- liquidityExchangePrice: new BN2(dto.liquidityExchangePrice),
31620
- tokenExchangePrice: new BN2(dto.tokenExchangePrice),
31621
- lastUpdateTimestamp: new BN2(dto.lastUpdateTimestamp),
31160
+ liquidityExchangePrice: new BN5(dto.liquidityExchangePrice),
31161
+ tokenExchangePrice: new BN5(dto.tokenExchangePrice),
31162
+ lastUpdateTimestamp: new BN5(dto.lastUpdateTimestamp),
31622
31163
  tokenReservesLiquidity: new PublicKey(dto.tokenReservesLiquidity),
31623
31164
  supplyPositionOnLiquidity: new PublicKey(dto.supplyPositionOnLiquidity)
31624
31165
  };
@@ -31631,30 +31172,30 @@ function dtoToJupTokenReserveRaw(dto) {
31631
31172
  borrowRate: dto.borrowRate,
31632
31173
  feeOnInterest: dto.feeOnInterest,
31633
31174
  lastUtilization: dto.lastUtilization,
31634
- lastUpdateTimestamp: new BN2(dto.lastUpdateTimestamp),
31635
- supplyExchangePrice: new BN2(dto.supplyExchangePrice),
31636
- borrowExchangePrice: new BN2(dto.borrowExchangePrice),
31175
+ lastUpdateTimestamp: new BN5(dto.lastUpdateTimestamp),
31176
+ supplyExchangePrice: new BN5(dto.supplyExchangePrice),
31177
+ borrowExchangePrice: new BN5(dto.borrowExchangePrice),
31637
31178
  maxUtilization: dto.maxUtilization,
31638
- totalSupplyWithInterest: new BN2(dto.totalSupplyWithInterest),
31639
- totalSupplyInterestFree: new BN2(dto.totalSupplyInterestFree),
31640
- totalBorrowWithInterest: new BN2(dto.totalBorrowWithInterest),
31641
- totalBorrowInterestFree: new BN2(dto.totalBorrowInterestFree),
31642
- totalClaimAmount: new BN2(dto.totalClaimAmount),
31179
+ totalSupplyWithInterest: new BN5(dto.totalSupplyWithInterest),
31180
+ totalSupplyInterestFree: new BN5(dto.totalSupplyInterestFree),
31181
+ totalBorrowWithInterest: new BN5(dto.totalBorrowWithInterest),
31182
+ totalBorrowInterestFree: new BN5(dto.totalBorrowInterestFree),
31183
+ totalClaimAmount: new BN5(dto.totalClaimAmount),
31643
31184
  interactingProtocol: new PublicKey(dto.interactingProtocol),
31644
- interactingTimestamp: new BN2(dto.interactingTimestamp),
31645
- interactingBalance: new BN2(dto.interactingBalance)
31185
+ interactingTimestamp: new BN5(dto.interactingTimestamp),
31186
+ interactingBalance: new BN5(dto.interactingBalance)
31646
31187
  };
31647
31188
  }
31648
31189
  function dtoToJupLendingRewardsRateModelRaw(dto) {
31649
31190
  return {
31650
31191
  pubkey: new PublicKey(dto.pubkey),
31651
31192
  mint: new PublicKey(dto.mint),
31652
- startTvl: new BN2(dto.startTvl),
31653
- duration: new BN2(dto.duration),
31654
- startTime: new BN2(dto.startTime),
31655
- yearlyReward: new BN2(dto.yearlyReward),
31656
- nextDuration: new BN2(dto.nextDuration),
31657
- nextRewardAmount: new BN2(dto.nextRewardAmount)
31193
+ startTvl: new BN5(dto.startTvl),
31194
+ duration: new BN5(dto.duration),
31195
+ startTime: new BN5(dto.startTime),
31196
+ yearlyReward: new BN5(dto.yearlyReward),
31197
+ nextDuration: new BN5(dto.nextDuration),
31198
+ nextRewardAmount: new BN5(dto.nextRewardAmount)
31658
31199
  };
31659
31200
  }
31660
31201
  function dtoToJupRateModelRaw(dto) {
@@ -31770,15 +31311,15 @@ function deriveJupLendLiquiditySupplyPositionPda(underlyingMint, lendingPda, liq
31770
31311
  var aprToApy2 = (apr, compoundingFrequency = HOURS_PER_YEAR, apyCap = 3) => Math.min((1 + apr / compoundingFrequency) ** compoundingFrequency - 1, apyCap);
31771
31312
 
31772
31313
  // src/vendor/jup-lend/utils/interest-rate.utils.ts
31773
- var JUP_EXCHANGE_PRICES_PRECISION = new BN2("1000000000000");
31774
- var JUP_SECONDS_PER_YEAR = new BN2(31536e3);
31775
- var JUP_MAX_REWARDS_RATE = new BN2("50000000000000");
31314
+ var JUP_EXCHANGE_PRICES_PRECISION = new BN5("1000000000000");
31315
+ var JUP_SECONDS_PER_YEAR = new BN5(31536e3);
31316
+ var JUP_MAX_REWARDS_RATE = new BN5("50000000000000");
31776
31317
  function calculateJupLendTotalAssets(lendingState, fTokenTotalSupply) {
31777
31318
  return lendingState.tokenExchangePrice.mul(fTokenTotalSupply).div(JUP_EXCHANGE_PRICES_PRECISION);
31778
31319
  }
31779
31320
  function calculateJupLendRewardsRate(rewardsModel, totalAssets, currentTimestamp) {
31780
31321
  const defaultResult = {
31781
- rewardsRate: new BN2(0),
31322
+ rewardsRate: new BN5(0),
31782
31323
  rewardsEnded: false,
31783
31324
  rewardsStartTime: rewardsModel.startTime
31784
31325
  };
@@ -31791,7 +31332,7 @@ function calculateJupLendRewardsRate(rewardsModel, totalAssets, currentTimestamp
31791
31332
  if (totalAssets.lt(rewardsModel.startTvl)) {
31792
31333
  return defaultResult;
31793
31334
  }
31794
- let rewardsRate = rewardsModel.yearlyReward.mul(new BN2(1e4)).div(totalAssets);
31335
+ let rewardsRate = rewardsModel.yearlyReward.mul(new BN5(1e4)).div(totalAssets);
31795
31336
  if (rewardsRate.gt(JUP_MAX_REWARDS_RATE)) {
31796
31337
  rewardsRate = JUP_MAX_REWARDS_RATE;
31797
31338
  }
@@ -31802,7 +31343,7 @@ function calculateJupLendRewardsRate(rewardsModel, totalAssets, currentTimestamp
31802
31343
  };
31803
31344
  }
31804
31345
  function calculateJupLendRewardsRateForExchangePrice(rewardsModel, totalAssets, currentTimestamp) {
31805
- const defaultResult = { rate: new BN2(0), rewardsStartTime: rewardsModel.startTime };
31346
+ const defaultResult = { rate: new BN5(0), rewardsStartTime: rewardsModel.startTime };
31806
31347
  if (rewardsModel.startTime.isZero() || rewardsModel.duration.isZero()) {
31807
31348
  return defaultResult;
31808
31349
  }
@@ -31822,7 +31363,7 @@ function calculateJupLendNewExchangePrice(lendingState, tokenReserve, rewardsMod
31822
31363
  const oldTokenExchangePrice = lendingState.tokenExchangePrice;
31823
31364
  const oldLiquidityExchangePrice = lendingState.liquidityExchangePrice;
31824
31365
  const currentLiquidityExchangePrice = tokenReserve.supplyExchangePrice;
31825
- let rewardsRate = new BN2(0);
31366
+ let rewardsRate = new BN5(0);
31826
31367
  let rewardsStartTime = lendingState.lastUpdateTimestamp;
31827
31368
  if (rewardsModel) {
31828
31369
  const totalAssets = calculateJupLendTotalAssets(lendingState, fTokenTotalSupply);
@@ -31839,32 +31380,32 @@ function calculateJupLendNewExchangePrice(lendingState, tokenReserve, rewardsMod
31839
31380
  lastUpdateTime = rewardsStartTime;
31840
31381
  }
31841
31382
  const secondsElapsed = currentTimestamp.sub(lastUpdateTime);
31842
- let totalReturnPercent = rewardsRate.mul(secondsElapsed).div(JUP_SECONDS_PER_YEAR).mul(new BN2(100));
31383
+ let totalReturnPercent = rewardsRate.mul(secondsElapsed).div(JUP_SECONDS_PER_YEAR).mul(new BN5(100));
31843
31384
  const delta = currentLiquidityExchangePrice.sub(oldLiquidityExchangePrice);
31844
31385
  totalReturnPercent = totalReturnPercent.add(
31845
- delta.mul(new BN2(1e14)).div(oldLiquidityExchangePrice)
31386
+ delta.mul(new BN5(1e14)).div(oldLiquidityExchangePrice)
31846
31387
  );
31847
- return oldTokenExchangePrice.add(oldTokenExchangePrice.mul(totalReturnPercent).div(new BN2(1e14)));
31388
+ return oldTokenExchangePrice.add(oldTokenExchangePrice.mul(totalReturnPercent).div(new BN5(1e14)));
31848
31389
  }
31849
31390
  function calculateJupLendLiquiditySupplyRate(tokenReserve) {
31850
- const borrowRate = new BN2(tokenReserve.borrowRate);
31851
- const fee = new BN2(tokenReserve.feeOnInterest);
31391
+ const borrowRate = new BN5(tokenReserve.borrowRate);
31392
+ const fee = new BN5(tokenReserve.feeOnInterest);
31852
31393
  if (tokenReserve.totalSupplyWithInterest.isZero()) {
31853
- return new BN2(0);
31394
+ return new BN5(0);
31854
31395
  }
31855
31396
  const borrowWithInterestForRate = tokenReserve.totalBorrowWithInterest.mul(tokenReserve.borrowExchangePrice).div(JUP_EXCHANGE_PRICES_PRECISION);
31856
31397
  const supplyWithInterestForRate = tokenReserve.totalSupplyWithInterest.mul(tokenReserve.supplyExchangePrice).div(JUP_EXCHANGE_PRICES_PRECISION);
31857
31398
  if (supplyWithInterestForRate.isZero()) {
31858
- return new BN2(0);
31399
+ return new BN5(0);
31859
31400
  }
31860
- return borrowRate.mul(new BN2(1e4).sub(fee)).mul(borrowWithInterestForRate).div(supplyWithInterestForRate.mul(new BN2(1e4)));
31401
+ return borrowRate.mul(new BN5(1e4).sub(fee)).mul(borrowWithInterestForRate).div(supplyWithInterestForRate.mul(new BN5(1e4)));
31861
31402
  }
31862
31403
  function calculateJupLendSupplyRate(lendingState, tokenReserve, rewardsModel, fTokenTotalSupply) {
31863
31404
  const supplyRate = calculateJupLendLiquiditySupplyRate(tokenReserve);
31864
31405
  let totalRateBps = supplyRate.toNumber();
31865
31406
  if (rewardsModel) {
31866
31407
  const totalAssets = calculateJupLendTotalAssets(lendingState, fTokenTotalSupply);
31867
- const currentTimestamp = new BN2(Math.floor(Date.now() / 1e3));
31408
+ const currentTimestamp = new BN5(Math.floor(Date.now() / 1e3));
31868
31409
  const { rewardsRate } = calculateJupLendRewardsRate(
31869
31410
  rewardsModel,
31870
31411
  totalAssets,
@@ -31951,13 +31492,13 @@ function generateJupLendSupplyCurve(rateModel, feeOnInterest) {
31951
31492
  function getJupLendRewards(lendingState, rewardsModel, fTokenTotalSupply) {
31952
31493
  if (lendingState.rewardsRateModel.equals(PublicKey.default)) {
31953
31494
  return {
31954
- rewardsRate: new BN2(0),
31495
+ rewardsRate: new BN5(0),
31955
31496
  rewardsEnded: false,
31956
- rewardsStartTime: new BN2(0)
31497
+ rewardsStartTime: new BN5(0)
31957
31498
  };
31958
31499
  }
31959
31500
  const totalAssets = calculateJupLendTotalAssets(lendingState, fTokenTotalSupply);
31960
- const currentTimestamp = new BN2(Math.floor(Date.now() / 1e3));
31501
+ const currentTimestamp = new BN5(Math.floor(Date.now() / 1e3));
31961
31502
  return calculateJupLendRewardsRate(rewardsModel, totalAssets, currentTimestamp);
31962
31503
  }
31963
31504
  var UPDATE_RATE_DISCRIMINATOR = Buffer.from([
@@ -45540,7 +45081,7 @@ function exponentNumberToBigNumber(raw) {
45540
45081
  let value = new BigNumber(0);
45541
45082
  const TWO_64 = new BigNumber(2).pow(64);
45542
45083
  words.forEach((w, i) => {
45543
- const word = new BigNumber(BN2.isBN(w) ? w.toString() : String(w));
45084
+ const word = new BigNumber(BN5.isBN(w) ? w.toString() : String(w));
45544
45085
  value = value.plus(word.times(TWO_64.pow(i)));
45545
45086
  });
45546
45087
  return value.div(EXPONENT_NUMBER_DENOM);
@@ -45551,7 +45092,7 @@ function pk(v) {
45551
45092
  function decodeExponentVault(data) {
45552
45093
  const d = EXPONENT_ACCOUNTS_CODER.decode("Vault", data);
45553
45094
  const get = (snake, camel) => d[snake] ?? d[camel];
45554
- const u646 = (v) => BigInt(BN2.isBN(v) ? v.toString() : String(v ?? 0));
45095
+ const u646 = (v) => BigInt(BN5.isBN(v) ? v.toString() : String(v ?? 0));
45555
45096
  const cpi = get("cpi_accounts", "cpiAccounts") ?? {};
45556
45097
  return {
45557
45098
  authority: pk(get("authority", "authority")),
@@ -46240,6 +45781,6 @@ async function resolveExponentWrapperMergeContext(params) {
46240
45781
  };
46241
45782
  }
46242
45783
 
46243
- export { ACCOUNT_SIZE, ACCOUNT_TYPE_SIZE, ASSOCIATED_TOKEN_PROGRAM_ID, AccountLayout, AccountState, AccountType, ConnectionClosed, CorpAction, DEFAULT_RECENT_SLOT_DURATION_MS, DRIFT_IDL, DRIFT_PROGRAM_ID, DriftSpotBalanceType, EXPONENT_CLMM_IDL, EXPONENT_CLMM_PROGRAM_ID, EXPONENT_CORE_IDL, EXPONENT_CORE_PROGRAM_ID, EXPONENT_EVENT_AUTHORITY_SEED, EXPONENT_GENERIC_SY_PROGRAM_ID, EXPONENT_JITO_RESTAKING_SY_PROGRAM_ID, EXPONENT_KAMINO_SY_PROGRAM_ID, EXPONENT_MARGINFI_SY_PROGRAM_ID, EXPONENT_NUMBER_DENOM, EXPONENT_ORDERBOOK_PROGRAM_ID, EXPONENT_PERENA_SY_PROGRAM_ID, EXPONENT_VAULTS_PROGRAM_ID, ErrorResponse, ExponentSwapDirection, ExtensionType, FARMS_PROGRAM_ID, JUP_EXCHANGE_PRICES_PRECISION, JUP_LEND_IDL, JUP_LEND_PROGRAM_ID, JUP_LIQUIDITY_IDL, JUP_LIQUIDITY_PROGRAM_ID, JUP_MAX_REWARDS_RATE, JUP_REWARDS_PROGRAM_ID, JUP_SECONDS_PER_YEAR, KFARMS_IDL, KLEND_ACCOUNT_CODER, KLEND_IDL, KLEND_PROGRAM_ID, LENGTH_SIZE, MAX_SLOT_DIFFERENCE, MEMO_PROGRAM_ID, MINT_SIZE, MULTISIG_SIZE, MintLayout, MultisigLayout, NATIVE_MINT, ONE, ONE_HUNDRED_PCT_IN_BPS, ONE_YEAR, PERCENTAGE_PRECISION, PERCENTAGE_PRECISION_EXP, PriceStatus, PriceType, REFRESH_OBLIGATION_DISCRIMINATOR, SEED_BASE_REFERRER_STATE, SEED_BASE_REFERRER_TOKEN_STATE, SEED_BASE_SHORT_URL, SEED_BASE_USER_METADATA, SEED_DRIFT_SIGNER, SEED_DRIFT_STATE, SEED_FEE_RECEIVER, SEED_F_TOKEN_MINT, SEED_LENDING, SEED_LENDING_ADMIN, SEED_LENDING_MARKET_AUTH, SEED_LENDING_REWARDS_RATE_MODEL, SEED_LIQUIDITY, SEED_RATE_MODEL, SEED_RESERVE, SEED_RESERVE_COLL_MINT, SEED_RESERVE_COLL_SUPPLY, SEED_RESERVE_LIQ_SUPPLY, SEED_SPOT_MARKET, SEED_SPOT_MARKET_VAULT, SEED_USER, SEED_USER_CLAIM, SEED_USER_STATE, SEED_USER_STATS, SEED_USER_SUPPLY_POSITION, SLOTS_PER_DAY, SLOTS_PER_HOUR, SLOTS_PER_MINUTE, SLOTS_PER_SECOND, SLOTS_PER_YEAR, SPOT_MARKET_RATE_PRECISION, SPOT_MARKET_RATE_PRECISION_EXP, SPOT_MARKET_UTILIZATION_PRECISION, SPOT_MARKET_UTILIZATION_PRECISION_EXP, SWITCHBOARD_ONDEMANDE_PRICE_PRECISION, SinglePoolInstruction, SplAccountType, SpotBalanceType, StreamError, SwapMode, SwapVersion, TEN, TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID, TYPE_SIZE, TokenAccountNotFoundError, TokenError, TokenInstruction, TokenInvalidAccountError, TokenInvalidAccountOwnerError, TokenInvalidAccountSizeError, TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, TokenInvalidMintError, TokenInvalidOwnerError, TokenOwnerOffCurveError, TokenUnsupportedInstructionError, V1Client, ZERO, addSigners, approveInstructionData, buildSwapQuoteResult, buildTitanTemplate, calculateAPYFromAPR, calculateDriftBorrowAPR, calculateDriftBorrowAPY, calculateDriftBorrowRate, calculateDriftDepositRate, calculateDriftInterestRate, calculateDriftLendingAPR, calculateDriftLendingAPY, calculateDriftUtilization, calculateJupLendBorrowRate, calculateJupLendLiquiditySupplyRate, calculateJupLendNewExchangePrice, calculateJupLendRewardsRate, calculateJupLendRewardsRateForExchangePrice, calculateJupLendSupplyAPY, calculateJupLendSupplyRate, calculateJupLendTotalAssets, calculateKaminoEstimatedBorrowRate, calculateKaminoEstimatedSupplyRate, calculateKaminoSupplyAPY, calculateRewardApy, calculateSlotAdjustmentFactor, calculateUtilizationRatio, closeAccountInstructionData, createAccountIx, createApproveInstruction, createAssociatedTokenAccountIdempotentInstruction, createAssociatedTokenAccountInstruction, createCloseAccountInstruction, createInitializeAccountInstruction, createMemoInstruction, createPoolOnrampIx, createSyncNativeInstruction, createTransferCheckedInstruction, decodeDriftSpotMarketData, decodeDriftStateData, decodeDriftUserData, decodeDriftUserStatsData, decodeExponentMarketThree, decodeExponentMarketTwo, decodeExponentMarketVault, decodeExponentVault, decodeFarmDataRaw, decodeJupLendingRewardsRateModelData, decodeJupLendingStateData, decodeJupRateModelData, decodeJupTokenReserveData, decodeKlendObligationData, decodeKlendReserveData, decodeSwitchboardPullFeedData, deriveBaseObligation, deriveDriftSigner, deriveDriftSpotMarket, deriveDriftSpotMarketVault, deriveDriftState, deriveDriftUser, deriveDriftUserStats, deriveExponentClmmEventAuthority, deriveExponentEventAuthority, deriveFeeReceiver, deriveJupLendClaimAccount, deriveJupLendFTokenMint, deriveJupLendLending, deriveJupLendLendingAdmin, deriveJupLendLendingPdas, deriveJupLendLendingRewardsRateModel, deriveJupLendLiquidity, deriveJupLendLiquiditySupplyPositionPda, deriveJupLendLiquidityVaultAta, deriveJupLendRateModel, deriveJupLendTokenReserve, deriveLendingMarketAuthority, deriveObligation, deriveReferrerState, deriveReferrerTokenState, deriveReserveCollateralMint, deriveReserveCollateralSupply, deriveReserveLiquiditySupply, deriveShortUrl, deriveUserMetadata, deriveUserState, deserializeSerializedInstruction, deserializeTitanWireInstruction, driftRewardsRawToDto, driftSpotMarketRawToDto, driftStateRawToDto, driftUserRawToDto, driftUserStatsRawToDto, dtoToDriftRewardsRaw, dtoToDriftSpotMarketRaw, dtoToDriftStateRaw, dtoToDriftUserRaw, dtoToDriftUserStatsRaw, dtoToFarmRaw, dtoToJupLendingRewardsRateModelRaw, dtoToJupLendingStateRaw, dtoToJupRateModelRaw, dtoToJupTokenReserveRaw, dtoToObligationRaw, dtoToReserveRaw, encodeTitanTemplate, exponentBuyPtArgs, exponentClmmBuyPtArgs, exponentNumberToBigNumber, farmRawToDto, fetchExponentMarketThree, fetchExponentMarketTwo, fetchExponentVault, fetchExponentVaultFromMarket, fetchTitanQuoteSwapV3, findMplMetadataAddress, findPoolAddress, findPoolMintAddress, findPoolMintAddressByVoteAccount, findPoolMintAuthorityAddress, findPoolMplAuthorityAddress, findPoolOnRampAddress, findPoolStakeAddress, findPoolStakeAuthorityAddress, generateDriftReserveCurve, generateJupLendSupplyCurve, generateKaminoReserveCurve, getAccount, getAccountLen, getAllDerivedDriftAccounts, getAllDerivedJupLendAccounts, getAllDerivedKaminoAccounts, getAllRequiredMarkets, getAssociatedTokenAddressSync, getDriftRewards, getDriftTokenAmount, getFixedHostInterestRate, getJupLendRewards, getKaminoBorrowRate, getKaminoTotalSupply, getMinimumBalanceForRentExemptAccount, getMinimumBalanceForRentExemptAccountWithExtensions, getMint, getMintDecimals, getMultipleAccounts, getProtocolTakeRatePct, getReserveRewardsApy, getRewardPerTimeUnitSecond, getStakeAccount, getSwitchboardProgram, initializeAccountInstructionData, initializeStakedPoolIxs, initializeStakedPoolTx, instructionToTitanWire, interpolateLinear, isJitoDontFront, isSpotBalanceTypeVariant, jupLendingRewardsRateModelRawToDto, jupLendingStateRawToDto, jupRateModelRawToDto, jupTokenReserveRawToDto, layout, lutToTitanWire, makeExponentClmmTradePtIx, makeExponentMergeIx, makeExponentStripIx, makeExponentTradePtIx, makeExponentWrapperMergeIx, makeRefreshObligationIx, makeRefreshReservesBatchIx, makeRefreshingIxs, makeSplStakePoolUpdateBalanceIx, makeUpdateJupLendRate, makeUpdateJupLendRateIx, makeUpdateSpotMarketCumulativeInterestIx, makeUpdateSpotMarketIx, obligationRawToDto, parsePriceData, parsePriceInfo2 as parsePriceInfo, replenishPoolIx, reserveRawToDto, resolveExponentClmmTradePtContext, resolveExponentMergeContext, resolveExponentStripContext, resolveExponentTradePtContext, resolveExponentWrapperMergeContext, resolveLookupTables, scaledSupplies, selectBestRoute, selectGatewayRoute, slotAdjustmentFactor, switchboardAccountCoder, syncNativeInstructionData, transferCheckedInstructionData, truncateBorrowCurve, unpackAccount };
45784
+ export { ACCOUNT_SIZE, ACCOUNT_TYPE_SIZE, ASSOCIATED_TOKEN_PROGRAM_ID, AccountLayout, AccountState, AccountType, ConnectionClosed, CorpAction, DEFAULT_RECENT_SLOT_DURATION_MS, DRIFT_IDL, DRIFT_PROGRAM_ID, DriftSpotBalanceType, EXPONENT_CLMM_IDL, EXPONENT_CLMM_PROGRAM_ID, EXPONENT_CORE_IDL, EXPONENT_CORE_PROGRAM_ID, EXPONENT_EVENT_AUTHORITY_SEED, EXPONENT_GENERIC_SY_PROGRAM_ID, EXPONENT_JITO_RESTAKING_SY_PROGRAM_ID, EXPONENT_KAMINO_SY_PROGRAM_ID, EXPONENT_MARGINFI_SY_PROGRAM_ID, EXPONENT_NUMBER_DENOM, EXPONENT_ORDERBOOK_PROGRAM_ID, EXPONENT_PERENA_SY_PROGRAM_ID, EXPONENT_VAULTS_PROGRAM_ID, ErrorResponse, ExponentSwapDirection, ExtensionType, FARMS_PROGRAM_ID, JUP_EXCHANGE_PRICES_PRECISION, JUP_LEND_IDL, JUP_LEND_PROGRAM_ID, JUP_LIQUIDITY_IDL, JUP_LIQUIDITY_PROGRAM_ID, JUP_MAX_REWARDS_RATE, JUP_REWARDS_PROGRAM_ID, JUP_SECONDS_PER_YEAR, KFARMS_IDL, KLEND_ACCOUNT_CODER, KLEND_IDL, KLEND_PROGRAM_ID, LENGTH_SIZE, MAX_SLOT_DIFFERENCE, MEMO_PROGRAM_ID, MINT_SIZE, MULTISIG_SIZE, MintLayout, MultisigLayout, NATIVE_MINT, ONE, ONE_HUNDRED_PCT_IN_BPS, ONE_YEAR, PERCENTAGE_PRECISION, PERCENTAGE_PRECISION_EXP, PriceStatus, PriceType, REFRESH_OBLIGATION_DISCRIMINATOR, SEED_BASE_REFERRER_STATE, SEED_BASE_REFERRER_TOKEN_STATE, SEED_BASE_SHORT_URL, SEED_BASE_USER_METADATA, SEED_DRIFT_SIGNER, SEED_DRIFT_STATE, SEED_FEE_RECEIVER, SEED_F_TOKEN_MINT, SEED_LENDING, SEED_LENDING_ADMIN, SEED_LENDING_MARKET_AUTH, SEED_LENDING_REWARDS_RATE_MODEL, SEED_LIQUIDITY, SEED_RATE_MODEL, SEED_RESERVE, SEED_RESERVE_COLL_MINT, SEED_RESERVE_COLL_SUPPLY, SEED_RESERVE_LIQ_SUPPLY, SEED_SPOT_MARKET, SEED_SPOT_MARKET_VAULT, SEED_USER, SEED_USER_CLAIM, SEED_USER_STATE, SEED_USER_STATS, SEED_USER_SUPPLY_POSITION, SLOTS_PER_DAY, SLOTS_PER_HOUR, SLOTS_PER_MINUTE, SLOTS_PER_SECOND, SLOTS_PER_YEAR, SPOT_MARKET_RATE_PRECISION, SPOT_MARKET_RATE_PRECISION_EXP, SPOT_MARKET_UTILIZATION_PRECISION, SPOT_MARKET_UTILIZATION_PRECISION_EXP, SWITCHBOARD_ONDEMANDE_PRICE_PRECISION, SinglePoolInstruction, SplAccountType, SpotBalanceType, StreamError, SwapMode, SwapVersion, TEN, TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID, TYPE_SIZE, TokenAccountNotFoundError, TokenError, TokenInstruction, TokenInvalidAccountError, TokenInvalidAccountOwnerError, TokenInvalidAccountSizeError, TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, TokenInvalidMintError, TokenInvalidOwnerError, TokenOwnerOffCurveError, TokenUnsupportedInstructionError, V1Client, ZERO, addSigners, approveInstructionData, buildSwapQuoteResult, buildTitanTemplate, calculateAPYFromAPR, calculateDriftBorrowAPR, calculateDriftBorrowAPY, calculateDriftBorrowRate, calculateDriftDepositRate, calculateDriftInterestRate, calculateDriftLendingAPR, calculateDriftLendingAPY, calculateDriftUtilization, calculateJupLendBorrowRate, calculateJupLendLiquiditySupplyRate, calculateJupLendNewExchangePrice, calculateJupLendRewardsRate, calculateJupLendRewardsRateForExchangePrice, calculateJupLendSupplyAPY, calculateJupLendSupplyRate, calculateJupLendTotalAssets, calculateKaminoEstimatedBorrowRate, calculateKaminoEstimatedSupplyRate, calculateKaminoSupplyAPY, calculateRewardApy, calculateSlotAdjustmentFactor, calculateUtilizationRatio, closeAccountInstructionData, createAccountIx, createApproveInstruction, createAssociatedTokenAccountIdempotentInstruction, createAssociatedTokenAccountInstruction, createCloseAccountInstruction, createInitializeAccountInstruction, createMemoInstruction, createPoolOnrampIx, createSyncNativeInstruction, createTransferCheckedInstruction, decodeDriftSpotMarketData, decodeDriftStateData, decodeDriftUserData, decodeDriftUserStatsData, decodeExponentMarketThree, decodeExponentMarketTwo, decodeExponentMarketVault, decodeExponentVault, decodeFarmDataRaw, decodeJupLendingRewardsRateModelData, decodeJupLendingStateData, decodeJupRateModelData, decodeJupTokenReserveData, decodeKlendObligationData, decodeKlendReserveData, decodeSwitchboardPullFeedData, deriveBaseObligation, deriveDriftSigner, deriveDriftSpotMarket, deriveDriftSpotMarketVault, deriveDriftState, deriveDriftUser, deriveDriftUserStats, deriveExponentClmmEventAuthority, deriveExponentEventAuthority, deriveFeeReceiver, deriveJupLendClaimAccount, deriveJupLendFTokenMint, deriveJupLendLending, deriveJupLendLendingAdmin, deriveJupLendLendingPdas, deriveJupLendLendingRewardsRateModel, deriveJupLendLiquidity, deriveJupLendLiquiditySupplyPositionPda, deriveJupLendLiquidityVaultAta, deriveJupLendRateModel, deriveJupLendTokenReserve, deriveLendingMarketAuthority, deriveObligation, deriveReferrerState, deriveReferrerTokenState, deriveReserveCollateralMint, deriveReserveCollateralSupply, deriveReserveLiquiditySupply, deriveShortUrl, deriveUserMetadata, deriveUserState, deserializeSerializedInstruction, deserializeTitanWireInstruction, driftRewardsRawToDto, driftSpotMarketRawToDto, driftStateRawToDto, driftUserRawToDto, driftUserStatsRawToDto, dtoToDriftRewardsRaw, dtoToDriftSpotMarketRaw, dtoToDriftStateRaw, dtoToDriftUserRaw, dtoToDriftUserStatsRaw, dtoToJupLendingRewardsRateModelRaw, dtoToJupLendingStateRaw, dtoToJupRateModelRaw, dtoToJupTokenReserveRaw, dtoToKaminoFarmState, dtoToKaminoObligation, dtoToKaminoReserve, encodeTitanTemplate, exponentBuyPtArgs, exponentClmmBuyPtArgs, exponentNumberToBigNumber, fetchExponentMarketThree, fetchExponentMarketTwo, fetchExponentVault, fetchExponentVaultFromMarket, fetchTitanQuoteSwapV3, findMplMetadataAddress, findPoolAddress, findPoolMintAddress, findPoolMintAddressByVoteAccount, findPoolMintAuthorityAddress, findPoolMplAuthorityAddress, findPoolOnRampAddress, findPoolStakeAddress, findPoolStakeAuthorityAddress, generateDriftReserveCurve, generateJupLendSupplyCurve, generateKaminoReserveCurve, getAccount, getAccountLen, getAllDerivedDriftAccounts, getAllDerivedJupLendAccounts, getAllDerivedKaminoAccounts, getAllRequiredMarkets, getAssociatedTokenAddressSync, getDriftRewards, getDriftTokenAmount, getFixedHostInterestRate, getJupLendRewards, getKaminoBorrowRate, getKaminoTotalSupply, getMinimumBalanceForRentExemptAccount, getMinimumBalanceForRentExemptAccountWithExtensions, getMint, getMintDecimals, getMultipleAccounts, getProtocolTakeRatePct, getReserveRewardsApy, getRewardPerTimeUnitSecond, getStakeAccount, getSwitchboardProgram, initializeAccountInstructionData, initializeStakedPoolIxs, initializeStakedPoolTx, instructionToTitanWire, interpolateLinear, isJitoDontFront, isSpotBalanceTypeVariant, jupLendingRewardsRateModelRawToDto, jupLendingStateRawToDto, jupRateModelRawToDto, jupTokenReserveRawToDto, kaminoFarmStateToDto, kaminoObligationToDto, kaminoReserveToDto, layout, lutToTitanWire, makeExponentClmmTradePtIx, makeExponentMergeIx, makeExponentStripIx, makeExponentTradePtIx, makeExponentWrapperMergeIx, makeRefreshObligationIx, makeRefreshReservesBatchIx, makeRefreshingIxs, makeSplStakePoolUpdateBalanceIx, makeUpdateJupLendRate, makeUpdateJupLendRateIx, makeUpdateSpotMarketCumulativeInterestIx, makeUpdateSpotMarketIx, parsePriceData, parsePriceInfo2 as parsePriceInfo, replenishPoolIx, resolveExponentClmmTradePtContext, resolveExponentMergeContext, resolveExponentStripContext, resolveExponentTradePtContext, resolveExponentWrapperMergeContext, resolveLookupTables, scaledSupplies, selectBestRoute, selectGatewayRoute, slotAdjustmentFactor, switchboardAccountCoder, syncNativeInstructionData, transferCheckedInstructionData, truncateBorrowCurve, unpackAccount };
46244
45785
  //# sourceMappingURL=vendor.js.map
46245
45786
  //# sourceMappingURL=vendor.js.map