@0dotxyz/p0-ts-sdk 1.0.0-alpha.3 → 1.0.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/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { PublicKey, SolanaJSONRPCError, ComputeBudgetProgram, SystemProgram, TransactionMessage, VersionedTransaction, Transaction, AddressLookupTableAccount, SYSVAR_RENT_PUBKEY, StakeProgram, TransactionInstruction, LAMPORTS_PER_SOL, SYSVAR_INSTRUCTIONS_PUBKEY } from '@solana/web3.js';
2
2
  import { object, string, enums, array, assert } from 'superstruct';
3
3
  import BigNumber10, { BigNumber } from 'bignumber.js';
4
- import { BorshCoder, BN, BorshInstructionCoder, AnchorProvider, Program } from '@coral-xyz/anchor';
4
+ import BN9, { BN } from 'bn.js';
5
5
  import { Decimal } from 'decimal.js';
6
+ import { BorshCoder, BorshInstructionCoder, AnchorProvider, Program } from '@coral-xyz/anchor';
6
7
  import { struct, u32, u8 } from '@solana/buffer-layout';
7
8
  import { publicKey, u64 } from '@solana/buffer-layout-utils';
8
9
  import { Buffer as Buffer$1 } from 'buffer';
9
- import BN10, { BN as BN$1 } from 'bn.js';
10
10
  import { deserialize } from 'borsh';
11
11
  import * as borsh from '@coral-xyz/borsh';
12
12
  import { struct as struct$1, bool, publicKey as publicKey$1, array as array$1, u64 as u64$1, u8 as u8$1, u32 as u32$1, u128 } from '@coral-xyz/borsh';
@@ -326,7 +326,7 @@ function bigNumberToWrappedI80F48(value) {
326
326
  let decimalValue = new Decimal(value.toString());
327
327
  const isNegative = decimalValue.isNegative();
328
328
  decimalValue = decimalValue.times(I80F48_DIVISOR);
329
- let wrappedValue = new BN(decimalValue.round().toFixed()).toArray();
329
+ let wrappedValue = new BN9(decimalValue.round().toFixed()).toArray();
330
330
  if (wrappedValue.length < I80F48_TOTAL_BYTES) {
331
331
  const padding = Array(I80F48_TOTAL_BYTES - wrappedValue.length).fill(0);
332
332
  wrappedValue.unshift(...padding);
@@ -360,7 +360,7 @@ function toBigNumber(amount) {
360
360
  }
361
361
  function uiToNative(amount, decimals) {
362
362
  let amt = toBigNumber(amount);
363
- return new BN(amt.times(10 ** decimals).toFixed(0, BigNumber10.ROUND_FLOOR));
363
+ return new BN9(amt.times(10 ** decimals).toFixed(0, BigNumber10.ROUND_FLOOR));
364
364
  }
365
365
  function uiToNativeBigNumber(amount, decimals) {
366
366
  let amt = toBigNumber(amount);
@@ -10791,7 +10791,7 @@ async function makePoolAddPermissionlessStakedBankIx(mfProgram, accounts, remain
10791
10791
  tokenProgram = TOKEN_PROGRAM_ID,
10792
10792
  ...optionalAccounts
10793
10793
  } = accounts;
10794
- return mfProgram.methods.lendingPoolAddBankPermissionless(args.seed ?? new BN10(0)).accounts({
10794
+ return mfProgram.methods.lendingPoolAddBankPermissionless(args.seed ?? new BN9(0)).accounts({
10795
10795
  stakedSettings,
10796
10796
  feePayer,
10797
10797
  bankMint,
@@ -10933,7 +10933,7 @@ var BankVaultType = /* @__PURE__ */ ((BankVaultType2) => {
10933
10933
  // src/services/bank/utils/serialize.utils.ts
10934
10934
  function serializeBankConfigOpt(bankConfigOpt) {
10935
10935
  const toWrappedI80F48 = (value) => value && bigNumberToWrappedI80F48(value);
10936
- const toBN = (value) => value && new BN10(value.toString());
10936
+ const toBN = (value) => value && new BN9(value.toString());
10937
10937
  return {
10938
10938
  assetWeightInit: toWrappedI80F48(bankConfigOpt.assetWeightInit),
10939
10939
  assetWeightMaint: toWrappedI80F48(bankConfigOpt.assetWeightMaint),
@@ -11199,16 +11199,16 @@ function bankConfigToBankConfigRaw(config) {
11199
11199
  assetWeightMaint: bigNumberToWrappedI80F48(config.assetWeightMaint),
11200
11200
  liabilityWeightInit: bigNumberToWrappedI80F48(config.liabilityWeightInit),
11201
11201
  liabilityWeightMaint: bigNumberToWrappedI80F48(config.liabilityWeightMaint),
11202
- depositLimit: new BN10(config.depositLimit.toString()),
11202
+ depositLimit: new BN9(config.depositLimit.toString()),
11203
11203
  interestRateConfig: serializeInterestRateConfig(config.interestRateConfig),
11204
11204
  operationalState: serializeOperationalState(config.operationalState),
11205
11205
  oracleSetup: serializeOracleSetup(config.oracleSetup),
11206
11206
  oracleKeys: config.oracleKeys,
11207
11207
  configFlags: config.configFlags,
11208
- borrowLimit: new BN10(config.borrowLimit.toString()),
11208
+ borrowLimit: new BN9(config.borrowLimit.toString()),
11209
11209
  riskTier: serializeRiskTier(config.riskTier),
11210
11210
  assetTag: config.assetTag,
11211
- totalAssetValueInitLimit: new BN10(config.totalAssetValueInitLimit.toString()),
11211
+ totalAssetValueInitLimit: new BN9(config.totalAssetValueInitLimit.toString()),
11212
11212
  oracleMaxAge: config.oracleMaxAge,
11213
11213
  oracleMaxConfidence: config.oracleMaxConfidence,
11214
11214
  fixedPrice: bigNumberToWrappedI80F48(config.fixedPrice)
@@ -11458,12 +11458,12 @@ function dtoToBankRaw(bankDto) {
11458
11458
  feeVaultBump: bankDto.feeVaultBump,
11459
11459
  feeVaultAuthorityBump: bankDto.feeVaultAuthorityBump,
11460
11460
  collectedGroupFeesOutstanding: bankDto.collectedGroupFeesOutstanding,
11461
- lastUpdate: new BN10(bankDto.lastUpdate),
11461
+ lastUpdate: new BN9(bankDto.lastUpdate),
11462
11462
  config: dtoToBankConfigRaw(bankDto.config),
11463
11463
  totalAssetShares: bankDto.totalAssetShares,
11464
11464
  totalLiabilityShares: bankDto.totalLiabilityShares,
11465
- flags: new BN10(bankDto.flags),
11466
- emissionsRate: new BN10(bankDto.emissionsRate),
11465
+ flags: new BN9(bankDto.flags),
11466
+ emissionsRate: new BN9(bankDto.emissionsRate),
11467
11467
  emissionsRemaining: bankDto.emissionsRemaining,
11468
11468
  emissionsMint: new PublicKey(bankDto.emissionsMint),
11469
11469
  feesDestinationAccount: bankDto.feesDestinationAccount ? new PublicKey(bankDto.feesDestinationAccount) : void 0,
@@ -11477,8 +11477,8 @@ function dtoToBankRaw(bankDto) {
11477
11477
  function dtoToEmodeSettingsRaw(emodeSettingsDto) {
11478
11478
  return {
11479
11479
  emodeTag: emodeSettingsDto.emodeTag,
11480
- timestamp: new BN10(emodeSettingsDto.timestamp),
11481
- flags: new BN10(emodeSettingsDto.flags),
11480
+ timestamp: new BN9(emodeSettingsDto.timestamp),
11481
+ flags: new BN9(emodeSettingsDto.flags),
11482
11482
  emodeConfig: {
11483
11483
  entries: emodeSettingsDto.emodeConfig.entries.map((entry) => {
11484
11484
  return {
@@ -11497,11 +11497,11 @@ function dtoToBankConfigRaw(bankConfigDto) {
11497
11497
  assetWeightMaint: bankConfigDto.assetWeightMaint,
11498
11498
  liabilityWeightInit: bankConfigDto.liabilityWeightInit,
11499
11499
  liabilityWeightMaint: bankConfigDto.liabilityWeightMaint,
11500
- depositLimit: new BN10(bankConfigDto.depositLimit),
11501
- borrowLimit: new BN10(bankConfigDto.borrowLimit),
11500
+ depositLimit: new BN9(bankConfigDto.depositLimit),
11501
+ borrowLimit: new BN9(bankConfigDto.borrowLimit),
11502
11502
  riskTier: bankConfigDto.riskTier,
11503
11503
  operationalState: bankConfigDto.operationalState,
11504
- totalAssetValueInitLimit: new BN10(bankConfigDto.totalAssetValueInitLimit),
11504
+ totalAssetValueInitLimit: new BN9(bankConfigDto.totalAssetValueInitLimit),
11505
11505
  assetTag: bankConfigDto.assetTag,
11506
11506
  configFlags: bankConfigDto.configFlags,
11507
11507
  oracleSetup: bankConfigDto.oracleSetup,
@@ -11631,7 +11631,7 @@ function getActiveEmodeFlags(flags) {
11631
11631
  return activeFlags;
11632
11632
  }
11633
11633
  function hasEmodeFlag(flags, flag) {
11634
- return !flags.and(new BN10(flag)).isZero();
11634
+ return !flags.and(new BN9(flag)).isZero();
11635
11635
  }
11636
11636
  function getActiveEmodeEntryFlags(flags) {
11637
11637
  const activeFlags = [];
@@ -14558,9 +14558,7 @@ var idl_default = {
14558
14558
 
14559
14559
  // src/vendor/switchboard_pull/index.ts
14560
14560
  var SWITCHBOARD_ONDEMANDE_PRICE_PRECISION = 18;
14561
- var switchboardAccountCoder = new BorshCoder(
14562
- idl_default
14563
- );
14561
+ var switchboardAccountCoder = new BorshCoder(idl_default);
14564
14562
  function decodeSwitchboardPullFeedData(data) {
14565
14563
  const pullFeedDAta = switchboardAccountCoder.accounts.decode(
14566
14564
  "PullFeedAccountData",
@@ -14586,8 +14584,8 @@ var mapSwbBanksToOraclePrices = (banks, swbOracleAiDataByKey, crossbarResponse)
14586
14584
  const crossbarData = crossbarResponse[oracleFeed]?.results;
14587
14585
  const timestamp = (/* @__PURE__ */ new Date()).getTime().toString();
14588
14586
  const oraclePrice = parseSwbOraclePriceData(
14589
- crossbarData ?? new BN10(oracleData.rawPrice),
14590
- new BN10(oracleData.stdev),
14587
+ crossbarData ?? new BN9(oracleData.rawPrice),
14588
+ new BN9(oracleData.stdev),
14591
14589
  timestamp,
14592
14590
  oracleData
14593
14591
  );
@@ -14613,7 +14611,7 @@ var mapBrokenFeedsToOraclePrices = (banks, swbOracleAiDataByKey, birdeyeResponse
14613
14611
  const timestamp = (/* @__PURE__ */ new Date()).getTime().toString();
14614
14612
  const oraclePrice = parseSwbOraclePriceData(
14615
14613
  [birdeyeData],
14616
- new BN10(oracleData.stdev),
14614
+ new BN9(oracleData.stdev),
14617
14615
  timestamp,
14618
14616
  oracleData
14619
14617
  );
@@ -15175,7 +15173,7 @@ var EMPTY_HEALTH_CACHE = {
15175
15173
  liabilityValue: {
15176
15174
  value: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
15177
15175
  },
15178
- timestamp: new BN10(0),
15176
+ timestamp: new BN9(0),
15179
15177
  flags: 0,
15180
15178
  prices: [],
15181
15179
  assetValueMaint: bigNumberToWrappedI80F48(new BigNumber10(0)),
@@ -15262,7 +15260,7 @@ function getActiveAccountFlags(flags) {
15262
15260
  return activeFlags;
15263
15261
  }
15264
15262
  function hasAccountFlag(flags, flag) {
15265
- return !flags.and(new BN10(flag)).isZero();
15263
+ return !flags.and(new BN9(flag)).isZero();
15266
15264
  }
15267
15265
  function getActiveHealthCacheFlags(flags) {
15268
15266
  const activeFlags = [];
@@ -15332,7 +15330,7 @@ function dtoToHealthCache(healthCacheDto) {
15332
15330
  };
15333
15331
  }
15334
15332
  function accountFlagToBN(flag) {
15335
- return new BN10(flag);
15333
+ return new BN9(flag);
15336
15334
  }
15337
15335
  function marginfiAccountToDto(marginfiAccount) {
15338
15336
  return {
@@ -16484,7 +16482,7 @@ function generateDummyAccount(group, authority, accountKey) {
16484
16482
  assetShares: dummyWrappedI80F48,
16485
16483
  liabilityShares: dummyWrappedI80F48,
16486
16484
  emissionsOutstanding: dummyWrappedI80F48,
16487
- lastUpdate: new BN10(0)
16485
+ lastUpdate: new BN9(0)
16488
16486
  });
16489
16487
  const rawAccount = {
16490
16488
  group,
@@ -16497,7 +16495,7 @@ function generateDummyAccount(group, authority, accountKey) {
16497
16495
  liabilityValue: {
16498
16496
  value: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
16499
16497
  },
16500
- timestamp: new BN10(0),
16498
+ timestamp: new BN9(0),
16501
16499
  flags: 0,
16502
16500
  prices: [],
16503
16501
  assetValueMaint: bigNumberToWrappedI80F48(new BigNumber10(0)),
@@ -16511,7 +16509,7 @@ function generateDummyAccount(group, authority, accountKey) {
16511
16509
  mrgnErr: 0
16512
16510
  },
16513
16511
  emissionsDestinationAccount: new PublicKey("11111111111111111111111111111111"),
16514
- accountFlags: new BN10([0, 0, 0])
16512
+ accountFlags: new BN9([0, 0, 0])
16515
16513
  };
16516
16514
  return parseMarginfiAccountRaw(accountKey, rawAccount);
16517
16515
  }
@@ -23270,9 +23268,9 @@ function decodeKlendObligationData(data) {
23270
23268
  }
23271
23269
  function dtoToObligationRaw(obligationDto) {
23272
23270
  return {
23273
- tag: new BN10(obligationDto.tag),
23271
+ tag: new BN9(obligationDto.tag),
23274
23272
  lastUpdate: {
23275
- slot: new BN10(obligationDto.lastUpdate.slot),
23273
+ slot: new BN9(obligationDto.lastUpdate.slot),
23276
23274
  stale: obligationDto.lastUpdate.stale,
23277
23275
  priceStatus: obligationDto.lastUpdate.priceStatus,
23278
23276
  placeholder: obligationDto.lastUpdate.placeholder
@@ -23282,21 +23280,21 @@ function dtoToObligationRaw(obligationDto) {
23282
23280
  deposits: obligationDto.deposits.map(
23283
23281
  (item) => dtoToObligationCollateralFields(item)
23284
23282
  ),
23285
- lowestReserveDepositLiquidationLtv: new BN10(
23283
+ lowestReserveDepositLiquidationLtv: new BN9(
23286
23284
  obligationDto.lowestReserveDepositLiquidationLtv
23287
23285
  ),
23288
- depositedValueSf: new BN10(obligationDto.depositedValueSf),
23286
+ depositedValueSf: new BN9(obligationDto.depositedValueSf),
23289
23287
  borrows: obligationDto.borrows.map(
23290
23288
  (item) => dtoToObligationLiquidityFields(item)
23291
23289
  ),
23292
- borrowFactorAdjustedDebtValueSf: new BN10(
23290
+ borrowFactorAdjustedDebtValueSf: new BN9(
23293
23291
  obligationDto.borrowFactorAdjustedDebtValueSf
23294
23292
  ),
23295
- borrowedAssetsMarketValueSf: new BN10(
23293
+ borrowedAssetsMarketValueSf: new BN9(
23296
23294
  obligationDto.borrowedAssetsMarketValueSf
23297
23295
  ),
23298
- allowedBorrowValueSf: new BN10(obligationDto.allowedBorrowValueSf),
23299
- unhealthyBorrowValueSf: new BN10(obligationDto.unhealthyBorrowValueSf),
23296
+ allowedBorrowValueSf: new BN9(obligationDto.allowedBorrowValueSf),
23297
+ unhealthyBorrowValueSf: new BN9(obligationDto.unhealthyBorrowValueSf),
23300
23298
  depositsAssetTiers: obligationDto.depositsAssetTiers,
23301
23299
  borrowsAssetTiers: obligationDto.borrowsAssetTiers,
23302
23300
  elevationGroup: obligationDto.elevationGroup,
@@ -23308,21 +23306,21 @@ function dtoToObligationRaw(obligationDto) {
23308
23306
  lowestReserveDepositMaxLtvPct: obligationDto.lowestReserveDepositMaxLtvPct,
23309
23307
  numOfObsoleteBorrowReserves: obligationDto.numOfObsoleteBorrowReserves,
23310
23308
  reserved: obligationDto.reserved,
23311
- highestBorrowFactorPct: new BN10(obligationDto.highestBorrowFactorPct),
23312
- autodeleverageMarginCallStartedTimestamp: new BN10(
23309
+ highestBorrowFactorPct: new BN9(obligationDto.highestBorrowFactorPct),
23310
+ autodeleverageMarginCallStartedTimestamp: new BN9(
23313
23311
  obligationDto.autodeleverageMarginCallStartedTimestamp
23314
23312
  ),
23315
23313
  orders: obligationDto.orders.map(
23316
23314
  (item) => dtoToObligationOrderFields(item)
23317
23315
  ),
23318
- padding3: obligationDto.padding3.map((item) => new BN10(item))
23316
+ padding3: obligationDto.padding3.map((item) => new BN9(item))
23319
23317
  };
23320
23318
  }
23321
23319
  function dtoToReserveRaw(reserveDto) {
23322
23320
  return {
23323
- version: new BN10(reserveDto.version),
23321
+ version: new BN9(reserveDto.version),
23324
23322
  lastUpdate: {
23325
- slot: new BN10(reserveDto.lastUpdate.slot),
23323
+ slot: new BN9(reserveDto.lastUpdate.slot),
23326
23324
  stale: reserveDto.lastUpdate.stale,
23327
23325
  priceStatus: reserveDto.lastUpdate.priceStatus,
23328
23326
  placeholder: reserveDto.lastUpdate.placeholder
@@ -23332,27 +23330,27 @@ function dtoToReserveRaw(reserveDto) {
23332
23330
  farmDebt: new PublicKey(reserveDto.farmDebt),
23333
23331
  liquidity: dtoToReserveLiquidityFields(reserveDto.liquidity),
23334
23332
  reserveLiquidityPadding: reserveDto.reserveLiquidityPadding.map(
23335
- (item) => new BN10(item)
23333
+ (item) => new BN9(item)
23336
23334
  ),
23337
23335
  collateral: {
23338
23336
  mintPubkey: new PublicKey(reserveDto.collateral.mintPubkey),
23339
- mintTotalSupply: new BN10(reserveDto.collateral.mintTotalSupply),
23337
+ mintTotalSupply: new BN9(reserveDto.collateral.mintTotalSupply),
23340
23338
  supplyVault: new PublicKey(reserveDto.collateral.supplyVault),
23341
- padding1: reserveDto.collateral.padding1.map((item) => new BN10(item)),
23342
- padding2: reserveDto.collateral.padding2.map((item) => new BN10(item))
23339
+ padding1: reserveDto.collateral.padding1.map((item) => new BN9(item)),
23340
+ padding2: reserveDto.collateral.padding2.map((item) => new BN9(item))
23343
23341
  },
23344
23342
  reserveCollateralPadding: reserveDto.reserveCollateralPadding.map(
23345
- (item) => new BN10(item)
23343
+ (item) => new BN9(item)
23346
23344
  ),
23347
23345
  config: dtoToReserveConfigFields(reserveDto.config),
23348
- configPadding: reserveDto.configPadding.map((item) => new BN10(item)),
23349
- borrowedAmountOutsideElevationGroup: new BN10(
23346
+ configPadding: reserveDto.configPadding.map((item) => new BN9(item)),
23347
+ borrowedAmountOutsideElevationGroup: new BN9(
23350
23348
  reserveDto.borrowedAmountOutsideElevationGroup
23351
23349
  ),
23352
23350
  borrowedAmountsAgainstThisReserveInElevationGroups: reserveDto.borrowedAmountsAgainstThisReserveInElevationGroups.map(
23353
- (item) => new BN10(item)
23351
+ (item) => new BN9(item)
23354
23352
  ),
23355
- padding: reserveDto.padding.map((item) => new BN10(item))
23353
+ padding: reserveDto.padding.map((item) => new BN9(item))
23356
23354
  };
23357
23355
  }
23358
23356
  function dtoToReserveLiquidityFields(reserveDto) {
@@ -23360,30 +23358,30 @@ function dtoToReserveLiquidityFields(reserveDto) {
23360
23358
  mintPubkey: new PublicKey(reserveDto.mintPubkey),
23361
23359
  supplyVault: new PublicKey(reserveDto.supplyVault),
23362
23360
  feeVault: new PublicKey(reserveDto.feeVault),
23363
- availableAmount: new BN10(reserveDto.availableAmount),
23364
- borrowedAmountSf: new BN10(reserveDto.borrowedAmountSf),
23365
- marketPriceSf: new BN10(reserveDto.marketPriceSf),
23366
- marketPriceLastUpdatedTs: new BN10(reserveDto.marketPriceLastUpdatedTs),
23367
- mintDecimals: new BN10(reserveDto.mintDecimals),
23368
- depositLimitCrossedTimestamp: new BN10(
23361
+ availableAmount: new BN9(reserveDto.availableAmount),
23362
+ borrowedAmountSf: new BN9(reserveDto.borrowedAmountSf),
23363
+ marketPriceSf: new BN9(reserveDto.marketPriceSf),
23364
+ marketPriceLastUpdatedTs: new BN9(reserveDto.marketPriceLastUpdatedTs),
23365
+ mintDecimals: new BN9(reserveDto.mintDecimals),
23366
+ depositLimitCrossedTimestamp: new BN9(
23369
23367
  reserveDto.depositLimitCrossedTimestamp
23370
23368
  ),
23371
- borrowLimitCrossedTimestamp: new BN10(reserveDto.borrowLimitCrossedTimestamp),
23369
+ borrowLimitCrossedTimestamp: new BN9(reserveDto.borrowLimitCrossedTimestamp),
23372
23370
  cumulativeBorrowRateBsf: {
23373
23371
  value: reserveDto.cumulativeBorrowRateBsf.value.map(
23374
- (item) => new BN10(item)
23372
+ (item) => new BN9(item)
23375
23373
  ),
23376
23374
  padding: reserveDto.cumulativeBorrowRateBsf.padding.map(
23377
- (item) => new BN10(item)
23375
+ (item) => new BN9(item)
23378
23376
  )
23379
23377
  },
23380
- accumulatedProtocolFeesSf: new BN10(reserveDto.accumulatedProtocolFeesSf),
23381
- accumulatedReferrerFeesSf: new BN10(reserveDto.accumulatedReferrerFeesSf),
23382
- pendingReferrerFeesSf: new BN10(reserveDto.pendingReferrerFeesSf),
23383
- absoluteReferralRateSf: new BN10(reserveDto.absoluteReferralRateSf),
23378
+ accumulatedProtocolFeesSf: new BN9(reserveDto.accumulatedProtocolFeesSf),
23379
+ accumulatedReferrerFeesSf: new BN9(reserveDto.accumulatedReferrerFeesSf),
23380
+ pendingReferrerFeesSf: new BN9(reserveDto.pendingReferrerFeesSf),
23381
+ absoluteReferralRateSf: new BN9(reserveDto.absoluteReferralRateSf),
23384
23382
  tokenProgram: new PublicKey(reserveDto.tokenProgram),
23385
- padding2: reserveDto.padding2.map((item) => new BN10(item)),
23386
- padding3: reserveDto.padding3.map((item) => new BN10(item))
23383
+ padding2: reserveDto.padding2.map((item) => new BN9(item)),
23384
+ padding3: reserveDto.padding3.map((item) => new BN9(item))
23387
23385
  };
23388
23386
  }
23389
23387
  function dtoToReserveConfigFields(reserveDto) {
@@ -23400,15 +23398,15 @@ function dtoToReserveConfigFields(reserveDto) {
23400
23398
  minLiquidationBonusBps: reserveDto.minLiquidationBonusBps,
23401
23399
  maxLiquidationBonusBps: reserveDto.maxLiquidationBonusBps,
23402
23400
  badDebtLiquidationBonusBps: reserveDto.badDebtLiquidationBonusBps,
23403
- deleveragingMarginCallPeriodSecs: new BN10(
23401
+ deleveragingMarginCallPeriodSecs: new BN9(
23404
23402
  reserveDto.deleveragingMarginCallPeriodSecs
23405
23403
  ),
23406
- deleveragingThresholdDecreaseBpsPerDay: new BN10(
23404
+ deleveragingThresholdDecreaseBpsPerDay: new BN9(
23407
23405
  reserveDto.deleveragingThresholdDecreaseBpsPerDay
23408
23406
  ),
23409
23407
  fees: {
23410
- borrowFeeSf: new BN10(reserveDto.fees.borrowFeeSf),
23411
- flashLoanFeeSf: new BN10(reserveDto.fees.flashLoanFeeSf),
23408
+ borrowFeeSf: new BN9(reserveDto.fees.borrowFeeSf),
23409
+ flashLoanFeeSf: new BN9(reserveDto.fees.flashLoanFeeSf),
23412
23410
  padding: reserveDto.fees.padding
23413
23411
  },
23414
23412
  borrowRateCurve: {
@@ -23417,9 +23415,9 @@ function dtoToReserveConfigFields(reserveDto) {
23417
23415
  borrowRateBps: item.borrowRateBps
23418
23416
  }))
23419
23417
  },
23420
- borrowFactorPct: new BN10(reserveDto.borrowFactorPct),
23421
- depositLimit: new BN10(reserveDto.depositLimit),
23422
- borrowLimit: new BN10(reserveDto.borrowLimit),
23418
+ borrowFactorPct: new BN9(reserveDto.borrowFactorPct),
23419
+ depositLimit: new BN9(reserveDto.depositLimit),
23420
+ borrowLimit: new BN9(reserveDto.borrowLimit),
23423
23421
  tokenInfo: dtoToTokenInfoFields(reserveDto.tokenInfo),
23424
23422
  depositWithdrawalCap: dtoToWithdrawalCapsFields(
23425
23423
  reserveDto.depositWithdrawalCap
@@ -23430,13 +23428,13 @@ function dtoToReserveConfigFields(reserveDto) {
23430
23428
  utilizationLimitBlockBorrowingAbovePct: reserveDto.utilizationLimitBlockBorrowingAbovePct,
23431
23429
  autodeleverageEnabled: reserveDto.autodeleverageEnabled,
23432
23430
  reserved1: reserveDto.reserved1,
23433
- borrowLimitOutsideElevationGroup: new BN10(
23431
+ borrowLimitOutsideElevationGroup: new BN9(
23434
23432
  reserveDto.borrowLimitOutsideElevationGroup
23435
23433
  ),
23436
23434
  borrowLimitAgainstThisCollateralInElevationGroup: reserveDto.borrowLimitAgainstThisCollateralInElevationGroup.map(
23437
- (item) => new BN10(item)
23435
+ (item) => new BN9(item)
23438
23436
  ),
23439
- deleveragingBonusIncreaseBpsPerDay: new BN10(
23437
+ deleveragingBonusIncreaseBpsPerDay: new BN9(
23440
23438
  reserveDto.deleveragingBonusIncreaseBpsPerDay
23441
23439
  )
23442
23440
  };
@@ -23445,13 +23443,13 @@ function dtoToTokenInfoFields(tokenInfoDto) {
23445
23443
  return {
23446
23444
  name: tokenInfoDto.name,
23447
23445
  heuristic: {
23448
- lower: new BN10(tokenInfoDto.heuristic.lower),
23449
- upper: new BN10(tokenInfoDto.heuristic.upper),
23450
- exp: new BN10(tokenInfoDto.heuristic.exp)
23446
+ lower: new BN9(tokenInfoDto.heuristic.lower),
23447
+ upper: new BN9(tokenInfoDto.heuristic.upper),
23448
+ exp: new BN9(tokenInfoDto.heuristic.exp)
23451
23449
  },
23452
- maxTwapDivergenceBps: new BN10(tokenInfoDto.maxTwapDivergenceBps),
23453
- maxAgePriceSeconds: new BN10(tokenInfoDto.maxAgePriceSeconds),
23454
- maxAgeTwapSeconds: new BN10(tokenInfoDto.maxAgeTwapSeconds),
23450
+ maxTwapDivergenceBps: new BN9(tokenInfoDto.maxTwapDivergenceBps),
23451
+ maxAgePriceSeconds: new BN9(tokenInfoDto.maxAgePriceSeconds),
23452
+ maxAgeTwapSeconds: new BN9(tokenInfoDto.maxAgeTwapSeconds),
23455
23453
  scopeConfiguration: {
23456
23454
  priceFeed: new PublicKey(tokenInfoDto.scopeConfiguration.priceFeed),
23457
23455
  priceChain: tokenInfoDto.scopeConfiguration.priceChain,
@@ -23470,17 +23468,17 @@ function dtoToTokenInfoFields(tokenInfoDto) {
23470
23468
  },
23471
23469
  blockPriceUsage: tokenInfoDto.blockPriceUsage,
23472
23470
  reserved: tokenInfoDto.reserved,
23473
- padding: tokenInfoDto.padding.map((item) => new BN10(item))
23471
+ padding: tokenInfoDto.padding.map((item) => new BN9(item))
23474
23472
  };
23475
23473
  }
23476
23474
  function dtoToWithdrawalCapsFields(withdrawalCapsDto) {
23477
23475
  return {
23478
- configCapacity: new BN10(withdrawalCapsDto.configCapacity),
23479
- currentTotal: new BN10(withdrawalCapsDto.currentTotal),
23480
- lastIntervalStartTimestamp: new BN10(
23476
+ configCapacity: new BN9(withdrawalCapsDto.configCapacity),
23477
+ currentTotal: new BN9(withdrawalCapsDto.currentTotal),
23478
+ lastIntervalStartTimestamp: new BN9(
23481
23479
  withdrawalCapsDto.lastIntervalStartTimestamp
23482
23480
  ),
23483
- configIntervalLengthSeconds: new BN10(
23481
+ configIntervalLengthSeconds: new BN9(
23484
23482
  withdrawalCapsDto.configIntervalLengthSeconds
23485
23483
  )
23486
23484
  };
@@ -23488,12 +23486,12 @@ function dtoToWithdrawalCapsFields(withdrawalCapsDto) {
23488
23486
  function dtoToObligationCollateralFields(obligationCollateralDto) {
23489
23487
  return {
23490
23488
  depositReserve: new PublicKey(obligationCollateralDto.depositReserve),
23491
- depositedAmount: new BN10(obligationCollateralDto.depositedAmount),
23492
- marketValueSf: new BN10(obligationCollateralDto.marketValueSf),
23493
- borrowedAmountAgainstThisCollateralInElevationGroup: new BN10(
23489
+ depositedAmount: new BN9(obligationCollateralDto.depositedAmount),
23490
+ marketValueSf: new BN9(obligationCollateralDto.marketValueSf),
23491
+ borrowedAmountAgainstThisCollateralInElevationGroup: new BN9(
23494
23492
  obligationCollateralDto.borrowedAmountAgainstThisCollateralInElevationGroup
23495
23493
  ),
23496
- padding: obligationCollateralDto.padding.map((item) => new BN10(item))
23494
+ padding: obligationCollateralDto.padding.map((item) => new BN9(item))
23497
23495
  };
23498
23496
  }
23499
23497
  function dtoToObligationLiquidityFields(obligationLiquidityDto) {
@@ -23501,34 +23499,34 @@ function dtoToObligationLiquidityFields(obligationLiquidityDto) {
23501
23499
  borrowReserve: new PublicKey(obligationLiquidityDto.borrowReserve),
23502
23500
  cumulativeBorrowRateBsf: {
23503
23501
  value: obligationLiquidityDto.cumulativeBorrowRateBsf.value.map(
23504
- (item) => new BN10(item)
23502
+ (item) => new BN9(item)
23505
23503
  ),
23506
23504
  padding: obligationLiquidityDto.cumulativeBorrowRateBsf.padding.map(
23507
- (item) => new BN10(item)
23505
+ (item) => new BN9(item)
23508
23506
  )
23509
23507
  },
23510
- padding: new BN10(obligationLiquidityDto.padding),
23511
- borrowedAmountSf: new BN10(obligationLiquidityDto.borrowedAmountSf),
23512
- marketValueSf: new BN10(obligationLiquidityDto.marketValueSf),
23513
- borrowFactorAdjustedMarketValueSf: new BN10(
23508
+ padding: new BN9(obligationLiquidityDto.padding),
23509
+ borrowedAmountSf: new BN9(obligationLiquidityDto.borrowedAmountSf),
23510
+ marketValueSf: new BN9(obligationLiquidityDto.marketValueSf),
23511
+ borrowFactorAdjustedMarketValueSf: new BN9(
23514
23512
  obligationLiquidityDto.borrowFactorAdjustedMarketValueSf
23515
23513
  ),
23516
- borrowedAmountOutsideElevationGroups: new BN10(
23514
+ borrowedAmountOutsideElevationGroups: new BN9(
23517
23515
  obligationLiquidityDto.borrowedAmountOutsideElevationGroups
23518
23516
  ),
23519
- padding2: obligationLiquidityDto.padding2.map((item) => new BN10(item))
23517
+ padding2: obligationLiquidityDto.padding2.map((item) => new BN9(item))
23520
23518
  };
23521
23519
  }
23522
23520
  function dtoToObligationOrderFields(obligationOrderDto) {
23523
23521
  return {
23524
- conditionThresholdSf: new BN10(obligationOrderDto.conditionThresholdSf),
23525
- opportunityParameterSf: new BN10(obligationOrderDto.opportunityParameterSf),
23522
+ conditionThresholdSf: new BN9(obligationOrderDto.conditionThresholdSf),
23523
+ opportunityParameterSf: new BN9(obligationOrderDto.opportunityParameterSf),
23526
23524
  minExecutionBonusBps: obligationOrderDto.minExecutionBonusBps,
23527
23525
  maxExecutionBonusBps: obligationOrderDto.maxExecutionBonusBps,
23528
23526
  conditionType: obligationOrderDto.conditionType,
23529
23527
  opportunityType: obligationOrderDto.opportunityType,
23530
23528
  padding1: obligationOrderDto.padding1,
23531
- padding2: obligationOrderDto.padding2.map((item) => new BN10(item))
23529
+ padding2: obligationOrderDto.padding2.map((item) => new BN9(item))
23532
23530
  };
23533
23531
  }
23534
23532
  var SEED_LENDING_MARKET_AUTH = "lma";
@@ -23781,42 +23779,42 @@ function dtoToFarmRaw(dto) {
23781
23779
  globalConfig: new PublicKey(dto.globalConfig),
23782
23780
  token: {
23783
23781
  mint: new PublicKey(dto.token.mint),
23784
- decimals: new BN10(dto.token.decimals),
23782
+ decimals: new BN9(dto.token.decimals),
23785
23783
  tokenProgram: new PublicKey(dto.token.tokenProgram),
23786
- padding: dto.token.padding.map((item) => new BN10(item))
23784
+ padding: dto.token.padding.map((item) => new BN9(item))
23787
23785
  },
23788
23786
  rewardInfos: dto.rewardInfos.map((item) => ({
23789
23787
  token: {
23790
23788
  mint: new PublicKey(item.token.mint),
23791
- decimals: new BN10(item.token.decimals),
23789
+ decimals: new BN9(item.token.decimals),
23792
23790
  tokenProgram: new PublicKey(item.token.tokenProgram),
23793
- padding: item.token.padding.map((p) => new BN10(p))
23791
+ padding: item.token.padding.map((p) => new BN9(p))
23794
23792
  },
23795
23793
  rewardsVault: new PublicKey(item.rewardsVault),
23796
- rewardsAvailable: new BN10(item.rewardsAvailable),
23794
+ rewardsAvailable: new BN9(item.rewardsAvailable),
23797
23795
  rewardScheduleCurve: {
23798
23796
  points: item.rewardScheduleCurve.points.map((p) => ({
23799
- tsStart: new BN10(p.tsStart),
23800
- rewardPerTimeUnit: new BN10(p.rewardPerTimeUnit)
23797
+ tsStart: new BN9(p.tsStart),
23798
+ rewardPerTimeUnit: new BN9(p.rewardPerTimeUnit)
23801
23799
  }))
23802
23800
  },
23803
- minClaimDurationSeconds: new BN10(item.minClaimDurationSeconds),
23804
- lastIssuanceTs: new BN10(item.lastIssuanceTs),
23805
- rewardsIssuedUnclaimed: new BN10(item.rewardsIssuedUnclaimed),
23806
- rewardsIssuedCumulative: new BN10(item.rewardsIssuedCumulative),
23807
- rewardPerShareScaled: new BN10(item.rewardPerShareScaled),
23808
- placeholder0: new BN10(item.placeholder0),
23801
+ minClaimDurationSeconds: new BN9(item.minClaimDurationSeconds),
23802
+ lastIssuanceTs: new BN9(item.lastIssuanceTs),
23803
+ rewardsIssuedUnclaimed: new BN9(item.rewardsIssuedUnclaimed),
23804
+ rewardsIssuedCumulative: new BN9(item.rewardsIssuedCumulative),
23805
+ rewardPerShareScaled: new BN9(item.rewardPerShareScaled),
23806
+ placeholder0: new BN9(item.placeholder0),
23809
23807
  rewardType: item.rewardType,
23810
23808
  rewardsPerSecondDecimals: item.rewardsPerSecondDecimals,
23811
23809
  padding0: item.padding0,
23812
- padding1: item.padding1.map((p) => new BN10(p))
23810
+ padding1: item.padding1.map((p) => new BN9(p))
23813
23811
  })),
23814
- numRewardTokens: new BN10(dto.numRewardTokens),
23815
- numUsers: new BN10(dto.numUsers),
23816
- totalStakedAmount: new BN10(dto.totalStakedAmount),
23812
+ numRewardTokens: new BN9(dto.numRewardTokens),
23813
+ numUsers: new BN9(dto.numUsers),
23814
+ totalStakedAmount: new BN9(dto.totalStakedAmount),
23817
23815
  farmVault: new PublicKey(dto.farmVault),
23818
23816
  farmVaultsAuthority: new PublicKey(dto.farmVaultsAuthority),
23819
- farmVaultsAuthorityBump: new BN10(dto.farmVaultsAuthorityBump),
23817
+ farmVaultsAuthorityBump: new BN9(dto.farmVaultsAuthorityBump),
23820
23818
  delegateAuthority: new PublicKey(dto.delegateAuthority),
23821
23819
  timeUnit: dto.timeUnit,
23822
23820
  isFarmFrozen: dto.isFarmFrozen,
@@ -23825,28 +23823,28 @@ function dtoToFarmRaw(dto) {
23825
23823
  withdrawAuthority: new PublicKey(dto.withdrawAuthority),
23826
23824
  depositWarmupPeriod: dto.depositWarmupPeriod,
23827
23825
  withdrawalCooldownPeriod: dto.withdrawalCooldownPeriod,
23828
- totalActiveStakeScaled: new BN10(dto.totalActiveStakeScaled),
23829
- totalPendingStakeScaled: new BN10(dto.totalPendingStakeScaled),
23830
- totalPendingAmount: new BN10(dto.totalPendingAmount),
23831
- slashedAmountCurrent: new BN10(dto.slashedAmountCurrent),
23832
- slashedAmountCumulative: new BN10(dto.slashedAmountCumulative),
23826
+ totalActiveStakeScaled: new BN9(dto.totalActiveStakeScaled),
23827
+ totalPendingStakeScaled: new BN9(dto.totalPendingStakeScaled),
23828
+ totalPendingAmount: new BN9(dto.totalPendingAmount),
23829
+ slashedAmountCurrent: new BN9(dto.slashedAmountCurrent),
23830
+ slashedAmountCumulative: new BN9(dto.slashedAmountCumulative),
23833
23831
  slashedAmountSpillAddress: new PublicKey(dto.slashedAmountSpillAddress),
23834
- lockingMode: new BN10(dto.lockingMode),
23835
- lockingStartTimestamp: new BN10(dto.lockingStartTimestamp),
23836
- lockingDuration: new BN10(dto.lockingDuration),
23837
- lockingEarlyWithdrawalPenaltyBps: new BN10(
23832
+ lockingMode: new BN9(dto.lockingMode),
23833
+ lockingStartTimestamp: new BN9(dto.lockingStartTimestamp),
23834
+ lockingDuration: new BN9(dto.lockingDuration),
23835
+ lockingEarlyWithdrawalPenaltyBps: new BN9(
23838
23836
  dto.lockingEarlyWithdrawalPenaltyBps
23839
23837
  ),
23840
- depositCapAmount: new BN10(dto.depositCapAmount),
23838
+ depositCapAmount: new BN9(dto.depositCapAmount),
23841
23839
  scopePrices: new PublicKey(dto.scopePrices),
23842
- scopeOraclePriceId: new BN10(dto.scopeOraclePriceId),
23843
- scopeOracleMaxAge: new BN10(dto.scopeOracleMaxAge),
23840
+ scopeOraclePriceId: new BN9(dto.scopeOraclePriceId),
23841
+ scopeOracleMaxAge: new BN9(dto.scopeOracleMaxAge),
23844
23842
  pendingFarmAdmin: new PublicKey(dto.pendingFarmAdmin),
23845
23843
  strategyId: new PublicKey(dto.strategyId),
23846
23844
  delegatedRpsAdmin: new PublicKey(dto.delegatedRpsAdmin),
23847
23845
  vaultId: new PublicKey(dto.vaultId),
23848
23846
  secondDelegatedAuthority: new PublicKey(dto.secondDelegatedAuthority),
23849
- padding: dto.padding.map((item) => new BN10(item))
23847
+ padding: dto.padding.map((item) => new BN9(item))
23850
23848
  };
23851
23849
  }
23852
23850
  var KAMINO_PROGRAM_ID = new PublicKey("KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD");
@@ -24412,7 +24410,7 @@ function makePoolAddPermissionlessStakedBankIx2(programId, accounts, remainingAc
24412
24410
  keys.push(...remainingAccounts);
24413
24411
  const data = Buffer.concat([
24414
24412
  DISCRIMINATORS.LENDING_POOL_ADD_BANK_PERMISSIONLESS,
24415
- encodeU64(args.seed || new BN10(0))
24413
+ encodeU64(args.seed || new BN9(0))
24416
24414
  ]);
24417
24415
  return new TransactionInstruction({
24418
24416
  keys,
@@ -25120,14 +25118,14 @@ async function makeBeginFlashLoanIx3(program, marginfiAccountPk, endIndex, autho
25120
25118
  marginfiAccount: marginfiAccountPk,
25121
25119
  authority
25122
25120
  },
25123
- { endIndex: new BN10(endIndex) }
25121
+ { endIndex: new BN9(endIndex) }
25124
25122
  ) : await instructions_default.makeBeginFlashLoanIx(
25125
25123
  program,
25126
25124
  {
25127
25125
  marginfiAccount: marginfiAccountPk,
25128
25126
  authority
25129
25127
  },
25130
- { endIndex: new BN10(endIndex) }
25128
+ { endIndex: new BN9(endIndex) }
25131
25129
  );
25132
25130
  return { instructions: [ix], keys: [] };
25133
25131
  }
@@ -26798,7 +26796,7 @@ async function makeUpdateSwbFeedIx(props) {
26798
26796
  pullFeed.data = {
26799
26797
  queue: new PublicKey(swbData.queue),
26800
26798
  feedHash: new Uint8Array(Buffer.from(swbData.feedHash, "hex")),
26801
- maxVariance: new BN$1(swbData.maxVariance),
26799
+ maxVariance: new BN(swbData.maxVariance),
26802
26800
  minResponses: swbData.minResponses
26803
26801
  };
26804
26802
  }
@@ -27189,8 +27187,8 @@ var fetchSwbOracleData = async (banks, opts) => {
27189
27187
  const brokenSwbFeeds = [];
27190
27188
  Object.keys(swbOracleAiDataByKey).forEach((oracleKey) => {
27191
27189
  const oracleAiData = swbOracleAiDataByKey[oracleKey];
27192
- const rawPriceBN = new BN10(oracleAiData.rawPrice);
27193
- const isFeedBroken = rawPriceBN.isZero() || rawPriceBN.eq(new BN10(1e-6)) || rawPriceBN.eq(new BN10(1e-8));
27190
+ const rawPriceBN = new BN9(oracleAiData.rawPrice);
27191
+ const isFeedBroken = rawPriceBN.isZero() || rawPriceBN.eq(new BN9(1e-6)) || rawPriceBN.eq(new BN9(1e-8));
27194
27192
  if (isFeedBroken) {
27195
27193
  const bank = switchboardBanks.find(
27196
27194
  (bank2) => bank2.config.oracleKeys[0].toBase58() === oracleKey
@@ -28010,7 +28008,7 @@ async function makeAddPermissionlessStakedBankIx(program, group, voteAccountAddr
28010
28008
  isWritable: false
28011
28009
  })),
28012
28010
  {
28013
- seed: new BN10(0)
28011
+ seed: new BN9(0)
28014
28012
  }
28015
28013
  );
28016
28014
  return {