@0dotxyz/p0-ts-sdk 2.2.3 → 2.2.5-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { PublicKey, SolanaJSONRPCError, ComputeBudgetProgram, SystemProgram, TransactionMessage, VersionedTransaction, Transaction, AddressLookupTableAccount, SYSVAR_RENT_PUBKEY, StakeProgram, TransactionInstruction, LAMPORTS_PER_SOL, Keypair, StakeAuthorizationLayout, SYSVAR_INSTRUCTIONS_PUBKEY, STAKE_CONFIG_ID as STAKE_CONFIG_ID$1 } from '@solana/web3.js';
1
+ import { PublicKey, SolanaJSONRPCError, ComputeBudgetProgram, SystemProgram, TransactionMessage, VersionedTransaction, Keypair, Transaction, AddressLookupTableAccount, SYSVAR_RENT_PUBKEY, StakeProgram, TransactionInstruction, LAMPORTS_PER_SOL, StakeAuthorizationLayout, SYSVAR_INSTRUCTIONS_PUBKEY, STAKE_CONFIG_ID as STAKE_CONFIG_ID$1 } from '@solana/web3.js';
2
2
  import { object, string, enums, array, assert } from 'superstruct';
3
3
  import BigNumber3, { BigNumber } from 'bignumber.js';
4
4
  import BN11, { BN } from 'bn.js';
@@ -12,7 +12,6 @@ import * as borsh from '@coral-xyz/borsh';
12
12
  import { struct as struct$1, bool as bool$1, 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';
13
13
  import WebSocket from 'ws';
14
14
  import { Encoder, Decoder } from '@msgpack/msgpack';
15
- import { SwapApi, Configuration, createJupiterApiClient } from '@jup-ag/api';
16
15
  import { AnchorUtils, PullFeed } from '@switchboard-xyz/on-demand';
17
16
  import { CrossbarClient } from '@switchboard-xyz/common';
18
17
 
@@ -15602,12 +15601,20 @@ function makeEndFlashLoanIx(mfiProgram, accounts, remainingAccounts = []) {
15602
15601
  }).accountsPartial(optionalAccounts).remainingAccounts(remainingAccounts).instruction();
15603
15602
  }
15604
15603
  async function makeAccountTransferToNewAccountIx(mfProgram, accounts) {
15605
- const { oldMarginfiAccount, newMarginfiAccount, newAuthority, feePayer, ...optionalAccounts } = accounts;
15604
+ const {
15605
+ oldMarginfiAccount,
15606
+ newMarginfiAccount,
15607
+ newAuthority,
15608
+ globalFeeWallet,
15609
+ feePayer,
15610
+ ...optionalAccounts
15611
+ } = accounts;
15606
15612
  return mfProgram.methods.transferToNewAccount().accounts({
15607
15613
  oldMarginfiAccount,
15608
15614
  newMarginfiAccount,
15609
15615
  newAuthority,
15610
- globalFeeWallet: feePayer
15616
+ globalFeeWallet,
15617
+ feePayer
15611
15618
  }).accountsPartial(optionalAccounts).instruction();
15612
15619
  }
15613
15620
  async function makeGroupInitIx(mfProgram, accounts) {
@@ -20501,16 +20508,77 @@ function createActiveEmodePairFromPairs(pairs) {
20501
20508
  assetWeightInit: bestPair.assetWeightInit
20502
20509
  };
20503
20510
  }
20511
+ function indexConfiguredPairs(emodePairs) {
20512
+ const configured = [];
20513
+ const liabTagByBank = /* @__PURE__ */ new Map();
20514
+ for (const p of emodePairs) {
20515
+ if (p.collateralBankTag === 0 /* UNSET */ || p.liabilityBankTag === 0 /* UNSET */) {
20516
+ continue;
20517
+ }
20518
+ const liabStr = p.liabilityBank.toBase58();
20519
+ const liabTagStr = p.liabilityBankTag.toString();
20520
+ configured.push({
20521
+ orig: p,
20522
+ liabStr,
20523
+ liabTagStr,
20524
+ collTagStr: p.collateralBankTag.toString(),
20525
+ collStrs: p.collateralBanks.map((b) => b.toBase58())
20526
+ });
20527
+ liabTagByBank.set(liabStr, liabTagStr);
20528
+ }
20529
+ return { configured, liabTagByBank };
20530
+ }
20531
+ function activePairsFromIndex(configured, liabTagByBank, liabSet, collSet) {
20532
+ const requiredTags = /* @__PURE__ */ new Set();
20533
+ for (const liab of liabSet) {
20534
+ const tag = liabTagByBank.get(liab);
20535
+ if (!tag) return [];
20536
+ requiredTags.add(tag);
20537
+ }
20538
+ const possible = configured.filter(
20539
+ (p) => liabSet.has(p.liabStr) && p.collStrs.some((c) => collSet.has(c))
20540
+ );
20541
+ if (possible.length === 0) return [];
20542
+ const byCollTag = {};
20543
+ for (const p of possible) {
20544
+ (byCollTag[p.collTagStr] ||= []).push(p);
20545
+ }
20546
+ const validGroups = [];
20547
+ for (const group of Object.values(byCollTag)) {
20548
+ const supports = new Set(group.map((p) => p.liabTagStr));
20549
+ let coversAll = true;
20550
+ for (const rt of requiredTags) {
20551
+ if (!supports.has(rt)) {
20552
+ coversAll = false;
20553
+ break;
20554
+ }
20555
+ }
20556
+ if (coversAll) validGroups.push(group);
20557
+ }
20558
+ if (validGroups.length === 0) return [];
20559
+ return validGroups.flat().map((p) => p.orig);
20560
+ }
20504
20561
  function computeEmodeImpacts(emodePairs, activeLiabilities, activeCollateral, allBanks) {
20505
- const toKey = (k) => k.toBase58();
20506
- const basePairs = computeActiveEmodePairs(emodePairs, activeLiabilities, activeCollateral);
20507
- const baseOn = basePairs.length > 0;
20508
- const liabTagMap = /* @__PURE__ */ new Map();
20562
+ const activeLiabilitiesSet = new Set(activeLiabilities.map((b) => b.toBase58()));
20563
+ const activeCollateralSet = new Set(activeCollateral.map((b) => b.toBase58()));
20564
+ const { configured, liabTagByBank } = indexConfiguredPairs(emodePairs);
20565
+ const liabTagMapAll = /* @__PURE__ */ new Map();
20509
20566
  for (const p of emodePairs) {
20510
- liabTagMap.set(p.liabilityBank.toBase58(), p.liabilityBankTag.toString());
20567
+ liabTagMapAll.set(p.liabilityBank.toBase58(), p.liabilityBankTag.toString());
20511
20568
  }
20569
+ const allCollateralBankStrs = /* @__PURE__ */ new Set();
20570
+ for (const p of emodePairs) {
20571
+ for (const c of p.collateralBanks) allCollateralBankStrs.add(c.toBase58());
20572
+ }
20573
+ const basePairs = activePairsFromIndex(
20574
+ configured,
20575
+ liabTagByBank,
20576
+ activeLiabilitiesSet,
20577
+ activeCollateralSet
20578
+ );
20579
+ const baseOn = basePairs.length > 0;
20512
20580
  const existingTags = new Set(
20513
- activeLiabilities.map((l) => liabTagMap.get(l.toBase58())).filter((t) => !!t)
20581
+ Array.from(activeLiabilitiesSet).map((l) => liabTagMapAll.get(l)).filter((t) => !!t)
20514
20582
  );
20515
20583
  function minWeight(ps) {
20516
20584
  let m = ps[0].assetWeightInit;
@@ -20527,27 +20595,26 @@ function computeEmodeImpacts(emodePairs, activeLiabilities, activeCollateral, al
20527
20595
  if (aMin.lt(bMin)) return 3 /* ReduceEmode */;
20528
20596
  return 1 /* ExtendEmode */;
20529
20597
  }
20530
- function simulate(bank, action) {
20531
- bank.equals(new PublicKey("CCKtUs6Cgwo4aaQUmBPmyoApH2gUDErxNZCAntD6LYGh"));
20532
- let L = [...activeLiabilities], C = [...activeCollateral];
20598
+ function simulate(bankStr, action) {
20599
+ const L = new Set(activeLiabilitiesSet), C = new Set(activeCollateralSet);
20533
20600
  switch (action) {
20534
20601
  case "borrow":
20535
- if (!L.some((x) => x.equals(bank))) L.push(bank);
20602
+ L.add(bankStr);
20536
20603
  break;
20537
20604
  case "repay":
20538
- L = L.filter((x) => !x.equals(bank));
20605
+ L.delete(bankStr);
20539
20606
  break;
20540
20607
  case "supply":
20541
- if (!C.some((x) => x.equals(bank))) C.push(bank);
20608
+ C.add(bankStr);
20542
20609
  break;
20543
20610
  case "withdraw":
20544
- C = C.filter((x) => !x.equals(bank));
20611
+ C.delete(bankStr);
20545
20612
  break;
20546
20613
  }
20547
- const after = computeActiveEmodePairs(emodePairs, L, C);
20614
+ const after = activePairsFromIndex(configured, liabTagByBank, L, C);
20548
20615
  let status = diffState(basePairs, after);
20549
20616
  if (action === "borrow") {
20550
- const tag = liabTagMap.get(bank.toBase58());
20617
+ const tag = liabTagMapAll.get(bankStr);
20551
20618
  if (!tag) {
20552
20619
  status = baseOn ? 4 /* RemoveEmode */ : 5 /* InactiveEmode */;
20553
20620
  } else if (baseOn) {
@@ -20583,66 +20650,29 @@ function computeEmodeImpacts(emodePairs, activeLiabilities, activeCollateral, al
20583
20650
  }
20584
20651
  const result = {};
20585
20652
  for (const bank of allBanks) {
20586
- const key = toKey(bank);
20653
+ const key = bank.toBase58();
20587
20654
  const impact = {};
20588
- if (!activeCollateral.some((x) => x.equals(bank))) {
20589
- impact.borrowImpact = simulate(bank, "borrow");
20655
+ if (!activeCollateralSet.has(key)) {
20656
+ impact.borrowImpact = simulate(key, "borrow");
20590
20657
  }
20591
- const collSet = new Set(emodePairs.flatMap((p) => p.collateralBanks.map((c) => c.toBase58())));
20592
- if (collSet.has(key) && !activeCollateral.some((x) => x.equals(bank)) && !activeLiabilities.some((x) => x.equals(bank))) {
20593
- impact.supplyImpact = simulate(bank, "supply");
20658
+ if (allCollateralBankStrs.has(key) && !activeCollateralSet.has(key) && !activeLiabilitiesSet.has(key)) {
20659
+ impact.supplyImpact = simulate(key, "supply");
20594
20660
  }
20595
- if (activeLiabilities.some((x) => x.equals(bank))) {
20596
- impact.repayAllImpact = simulate(bank, "repay");
20661
+ if (activeLiabilitiesSet.has(key)) {
20662
+ impact.repayAllImpact = simulate(key, "repay");
20597
20663
  }
20598
- if (activeCollateral.some((x) => x.equals(bank))) {
20599
- impact.withdrawAllImpact = simulate(bank, "withdraw");
20664
+ if (activeCollateralSet.has(key)) {
20665
+ impact.withdrawAllImpact = simulate(key, "withdraw");
20600
20666
  }
20601
20667
  result[key] = impact;
20602
20668
  }
20603
20669
  return result;
20604
20670
  }
20605
20671
  function computeActiveEmodePairs(emodePairs, activeLiabilities, activeCollateral) {
20606
- const configured = emodePairs.filter(
20607
- (p) => p.collateralBankTag !== 0 /* UNSET */ && p.liabilityBankTag !== 0 /* UNSET */
20608
- );
20609
- const liabTagByBank = /* @__PURE__ */ new Map();
20610
- for (const p of configured) {
20611
- liabTagByBank.set(p.liabilityBank.toBase58(), p.liabilityBankTag.toString());
20612
- }
20613
- const requiredTags = /* @__PURE__ */ new Set();
20614
- for (const liab of activeLiabilities) {
20615
- const tag = liabTagByBank.get(liab.toBase58());
20616
- if (!tag) {
20617
- return [];
20618
- }
20619
- requiredTags.add(tag);
20620
- }
20621
- const possible = configured.filter(
20622
- (p) => activeLiabilities.some((l) => l.equals(p.liabilityBank)) && p.collateralBanks.some((c) => activeCollateral.some((a) => a.equals(c)))
20623
- );
20624
- if (possible.length === 0) return [];
20625
- const byCollTag = {};
20626
- for (const p of possible) {
20627
- const ct = p.collateralBankTag.toString();
20628
- (byCollTag[ct] ||= []).push(p);
20629
- }
20630
- const validGroups = [];
20631
- for (const group of Object.values(byCollTag)) {
20632
- const supports = new Set(group.map((p) => p.liabilityBankTag.toString()));
20633
- let coversAll = true;
20634
- for (const rt of requiredTags) {
20635
- if (!supports.has(rt)) {
20636
- coversAll = false;
20637
- break;
20638
- }
20639
- }
20640
- if (coversAll) {
20641
- validGroups.push(group);
20642
- }
20643
- }
20644
- if (validGroups.length === 0) return [];
20645
- return validGroups.flat();
20672
+ const { configured, liabTagByBank } = indexConfiguredPairs(emodePairs);
20673
+ const liabSet = new Set(activeLiabilities.map((b) => b.toBase58()));
20674
+ const collSet = new Set(activeCollateral.map((b) => b.toBase58()));
20675
+ return activePairsFromIndex(configured, liabTagByBank, liabSet, collSet);
20646
20676
  }
20647
20677
  function computeBalanceUsdValue(params) {
20648
20678
  const {
@@ -20821,62 +20851,6 @@ function computeHealthComponentsFromBalances(params) {
20821
20851
  }
20822
20852
  return { assets: totalAssets, liabilities: totalLiabilities };
20823
20853
  }
20824
- function computeHealthComponentsWithoutBiasFromBalances(params) {
20825
- const {
20826
- activeBalances,
20827
- banksMap,
20828
- oraclePricesByBank,
20829
- marginRequirement,
20830
- assetShareValueMultiplierByBank,
20831
- activeEmodeWeightsByBank,
20832
- excludedBanks
20833
- } = params;
20834
- const filteredBalances = activeBalances.filter(
20835
- (accountBalance) => !(excludedBanks ?? []).find((b) => b.equals(accountBalance.bankPk))
20836
- );
20837
- let totalAssets = new BigNumber3(0);
20838
- let totalLiabilities = new BigNumber3(0);
20839
- for (const accountBalance of filteredBalances) {
20840
- const bankKey = accountBalance.bankPk.toBase58();
20841
- const bank = banksMap.get(bankKey);
20842
- if (!bank) {
20843
- console.warn(
20844
- `Bank ${shortenAddress(accountBalance.bankPk)} not found, excluding from health computation`
20845
- );
20846
- continue;
20847
- }
20848
- const oraclePrice = oraclePricesByBank.get(bankKey);
20849
- if (!oraclePrice) {
20850
- console.warn(
20851
- `Price info for bank ${shortenAddress(accountBalance.bankPk)} not found, excluding from health computation`
20852
- );
20853
- continue;
20854
- }
20855
- const emodeWeight = activeEmodeWeightsByBank?.get(bankKey);
20856
- const assetShareValueMultiplier = assetShareValueMultiplierByBank?.get(bankKey);
20857
- const activeEmodeWeights = emodeWeight ? {
20858
- assetWeightInit: BigNumber3.max(
20859
- bank.config.assetWeightInit,
20860
- emodeWeight.assetWeightInit ?? bank.config.assetWeightInit
20861
- ),
20862
- assetWeightMaint: BigNumber3.max(
20863
- bank.config.assetWeightMaint,
20864
- emodeWeight.assetWeightMaint ?? bank.config.assetWeightMaint
20865
- )
20866
- } : void 0;
20867
- const { assets, liabilities } = computeBalanceUsdValue({
20868
- balance: accountBalance,
20869
- bank,
20870
- oraclePrice,
20871
- marginRequirement,
20872
- activeEmodeWeights,
20873
- assetShareValueMultiplier
20874
- });
20875
- totalAssets = totalAssets.plus(assets);
20876
- totalLiabilities = totalLiabilities.plus(liabilities);
20877
- }
20878
- return { assets: totalAssets, liabilities: totalLiabilities };
20879
- }
20880
20854
  function computeHealthCacheStatus(params) {
20881
20855
  const {
20882
20856
  activeBalances,
@@ -20885,7 +20859,7 @@ function computeHealthCacheStatus(params) {
20885
20859
  assetShareValueMultiplierByBank,
20886
20860
  activeEmodeWeightsByBank
20887
20861
  } = params;
20888
- const { assets: assetValueEquity, liabilities: liabilityValueEquity } = computeHealthComponentsWithoutBiasFromBalances({
20862
+ const { assets: assetValueEquity, liabilities: liabilityValueEquity } = computeHealthComponentsFromBalances({
20889
20863
  activeBalances,
20890
20864
  marginRequirement: 2 /* Equity */,
20891
20865
  banksMap,
@@ -36061,6 +36035,48 @@ async function makeCloseMarginfiAccountTx({
36061
36035
  );
36062
36036
  return closeTx;
36063
36037
  }
36038
+ async function makeAccountTransferToNewAccountTx({
36039
+ connection,
36040
+ program,
36041
+ marginfiAccount,
36042
+ newMarginfiAccount,
36043
+ newAuthority,
36044
+ feePayer
36045
+ }) {
36046
+ const feePayerKey = feePayer instanceof Keypair ? feePayer.publicKey : feePayer ?? marginfiAccount.authority;
36047
+ const [feeStateKey] = PublicKey.findProgramAddressSync(
36048
+ [Buffer.from("feestate", "utf-8")],
36049
+ program.programId
36050
+ );
36051
+ const feeState = await program.account.feeState.fetch(feeStateKey);
36052
+ const transferIx = await instructions_default.makeAccountTransferToNewAccountIx(program, {
36053
+ oldMarginfiAccount: marginfiAccount.address,
36054
+ newMarginfiAccount: newMarginfiAccount.publicKey,
36055
+ newAuthority,
36056
+ globalFeeWallet: feeState.globalFeeWallet,
36057
+ feePayer: feePayerKey
36058
+ });
36059
+ const {
36060
+ value: { blockhash }
36061
+ } = await connection.getLatestBlockhashAndContext("confirmed");
36062
+ const signers = [newMarginfiAccount];
36063
+ if (feePayer instanceof Keypair) signers.push(feePayer);
36064
+ const transferTx = addTransactionMetadata(
36065
+ new VersionedTransaction(
36066
+ new TransactionMessage({
36067
+ instructions: [transferIx],
36068
+ payerKey: feePayerKey,
36069
+ recentBlockhash: blockhash
36070
+ }).compileToV0Message([])
36071
+ ),
36072
+ {
36073
+ signers,
36074
+ addressLookupTables: [],
36075
+ type: "TRANSFER_AUTH" /* TRANSFER_AUTH */
36076
+ }
36077
+ );
36078
+ return transferTx;
36079
+ }
36064
36080
  async function makeCreateAccountTxWithProjection(props) {
36065
36081
  const [marginfiAccountAddress] = deriveMarginfiAccount(
36066
36082
  props.program.programId,
@@ -48518,7 +48534,7 @@ async function simulateAccountHealthCacheWithFallback(params) {
48518
48534
  } = params;
48519
48535
  let marginfiAccount = params.marginfiAccount;
48520
48536
  const activeBalances = marginfiAccount.balances.filter((b) => b.active);
48521
- const { assets: assetValueEquity, liabilities: liabilityValueEquity } = computeHealthComponentsWithoutBiasFromBalances({
48537
+ const { assets: assetValueEquity, liabilities: liabilityValueEquity } = computeHealthComponentsFromBalances({
48522
48538
  activeBalances,
48523
48539
  banksMap,
48524
48540
  oraclePricesByBank,
@@ -49131,6 +49147,61 @@ function computeMaxWithdrawForBank(params) {
49131
49147
  const maxWithdraw = initUntiedCollateralForBank.div(initWeightedPrice);
49132
49148
  return maxWithdraw;
49133
49149
  }
49150
+
49151
+ // src/vendor/jupiter/client.ts
49152
+ var DEFAULT_BASE_PATH = "https://lite-api.jup.ag/swap/v1";
49153
+ var JupiterApiError = class _JupiterApiError extends Error {
49154
+ status;
49155
+ body;
49156
+ constructor(status, body) {
49157
+ super(`Jupiter API request failed with status ${status}: ${body}`);
49158
+ this.name = "JupiterApiError";
49159
+ Object.setPrototypeOf(this, _JupiterApiError.prototype);
49160
+ this.status = status;
49161
+ this.body = body;
49162
+ }
49163
+ };
49164
+ function buildQuoteSearchParams(request) {
49165
+ const params = new URLSearchParams();
49166
+ for (const [key, value] of Object.entries(request)) {
49167
+ if (value === void 0 || value === null) continue;
49168
+ if (Array.isArray(value)) {
49169
+ if (value.length > 0) params.append(key, value.join(","));
49170
+ continue;
49171
+ }
49172
+ params.append(key, String(value));
49173
+ }
49174
+ return params;
49175
+ }
49176
+ function createJupiterClient(config = {}) {
49177
+ const basePath = (config.basePath ?? DEFAULT_BASE_PATH).replace(/\/+$/, "");
49178
+ const baseHeaders = { ...config.headers };
49179
+ if (config.apiKey) baseHeaders["x-api-key"] = config.apiKey;
49180
+ const request = async (path, init) => {
49181
+ const response = await fetch(`${basePath}${path}`, init);
49182
+ if (!response.ok) {
49183
+ const body = await response.text().catch(() => "");
49184
+ throw new JupiterApiError(response.status, body);
49185
+ }
49186
+ return await response.json();
49187
+ };
49188
+ return {
49189
+ quoteGet(quoteRequest) {
49190
+ const search = buildQuoteSearchParams(quoteRequest);
49191
+ return request(`/quote?${search.toString()}`, {
49192
+ method: "GET",
49193
+ headers: baseHeaders
49194
+ });
49195
+ },
49196
+ swapInstructionsPost({ swapRequest }) {
49197
+ return request(`/swap-instructions`, {
49198
+ method: "POST",
49199
+ headers: { ...baseHeaders, "content-type": "application/json" },
49200
+ body: JSON.stringify(swapRequest)
49201
+ });
49202
+ }
49203
+ };
49204
+ }
49134
49205
  var TITAN_FEE_WALLET = new PublicKey("FEES6XLN7dMz2iBwKab9Hri9Kwc4WJ6TmDAiT4BNhyej");
49135
49206
  var getTitanFeeAccount = (mint) => {
49136
49207
  return getAssociatedTokenAddressSync(mint, TITAN_FEE_WALLET, true);
@@ -49508,15 +49579,17 @@ function getExactOutProviderFn({
49508
49579
  });
49509
49580
  case "JUPITER" /* JUPITER */:
49510
49581
  return async () => {
49511
- const configParams = toJupiterConfig(apiConfig);
49512
- const jupiterApiClient = configParams?.basePath ? new SwapApi(new Configuration(configParams)) : createJupiterApiClient(configParams);
49582
+ const jupiterApiClient = createJupiterClient(toJupiterConfig(apiConfig));
49513
49583
  const estimateQuote = await jupiterApiClient.quoteGet({
49514
49584
  inputMint,
49515
49585
  outputMint,
49516
49586
  amount,
49517
49587
  swapMode: "ExactOut",
49518
49588
  dynamicSlippage: swapOpts.swapConfig ? swapOpts.swapConfig.slippageMode === "DYNAMIC" : true,
49519
- slippageBps: swapOpts.swapConfig?.slippageBps
49589
+ slippageBps: swapOpts.swapConfig?.slippageBps,
49590
+ // Match the bundle-compatible routing used by the executed flashloan
49591
+ // swap so the ExactOut estimate reflects an achievable route.
49592
+ forJitoBundle: true
49520
49593
  });
49521
49594
  const quoteResult = mapJupiterQuoteToSwapQuoteResult(estimateQuote);
49522
49595
  return { otherAmountThreshold: quoteResult.otherAmountThreshold, quoteResult };
@@ -49672,7 +49745,7 @@ function toJupiterConfig(apiConfig) {
49672
49745
  if (!apiConfig) return void 0;
49673
49746
  return {
49674
49747
  basePath: apiConfig.basePath,
49675
- apiKey: apiConfig.apiKey ? () => apiConfig.apiKey : void 0,
49748
+ apiKey: apiConfig.apiKey,
49676
49749
  headers: apiConfig.headers
49677
49750
  };
49678
49751
  }
@@ -49684,8 +49757,7 @@ var getJupiterSwapIxsForFlashloan = async ({
49684
49757
  apiConfig,
49685
49758
  maxSwapAccounts
49686
49759
  }) => {
49687
- const configParams = toJupiterConfig(apiConfig);
49688
- const jupiterApiClient = configParams?.basePath ? new SwapApi(new Configuration(configParams)) : createJupiterApiClient(configParams);
49760
+ const jupiterApiClient = createJupiterClient(toJupiterConfig(apiConfig));
49689
49761
  const feeMint = quoteParams.swapMode === "ExactIn" ? quoteParams.outputMint : quoteParams.inputMint;
49690
49762
  const { feeAccount, hasFeeAccount } = await checkFeeAccount(connection, new PublicKey(feeMint));
49691
49763
  const project0JupiterLut = (await connection.getAddressLookupTable(ADDRESS_LOOKUP_TABLE_FOR_SWAP))?.value;
@@ -49704,7 +49776,10 @@ var getJupiterSwapIxsForFlashloan = async ({
49704
49776
  const maxAccounts = maxSwapAccounts !== void 0 ? maxSwapAccounts - JUPITER_MAX_ACCOUNTS_MARGIN : 40;
49705
49777
  const swapQuote = await jupiterApiClient.quoteGet({
49706
49778
  ...finalQuoteParams,
49707
- maxAccounts
49779
+ maxAccounts,
49780
+ // Flashloan swaps are landed via a Jito bundle, so restrict routing to
49781
+ // bundle-compatible DEXes (excludes e.g. HumidiFi).
49782
+ forJitoBundle: true
49708
49783
  });
49709
49784
  const swapInstructionResponse = await jupiterApiClient.swapInstructionsPost({
49710
49785
  swapRequest: {
@@ -51340,7 +51415,7 @@ function mergeOracleResults(results, allBanks) {
51340
51415
 
51341
51416
  // src/services/bank/utils/compute/value-computations.utils.ts
51342
51417
  function isWeightedPrice(marginRequirement) {
51343
- return marginRequirement === 0 /* Initial */;
51418
+ return marginRequirement === 0 /* Initial */ || marginRequirement === 2 /* Equity */;
51344
51419
  }
51345
51420
  function getAssetWeight(params) {
51346
51421
  const {
@@ -51351,6 +51426,12 @@ function getAssetWeight(params) {
51351
51426
  activeEmodeWeights,
51352
51427
  ignoreSoftLimits
51353
51428
  } = params;
51429
+ if (bank.config.riskTier === "Isolated" /* Isolated */) {
51430
+ return new BigNumber3(0);
51431
+ }
51432
+ if (marginRequirement === 0 /* Initial */ && bank.config.operationalState === "ReduceOnly" /* ReduceOnly */) {
51433
+ return new BigNumber3(0);
51434
+ }
51354
51435
  const assetWeightInit = BigNumber3.max(
51355
51436
  activeEmodeWeights?.assetWeightInit ?? BigNumber3(0),
51356
51437
  bank.config.assetWeightInit
@@ -51367,6 +51448,8 @@ function getAssetWeight(params) {
51367
51448
  bank,
51368
51449
  oraclePrice,
51369
51450
  assetShares: bank.totalAssetShares,
51451
+ // Unweighted (Equity => weight 1) total bank value, priced at the same time-weighted
51452
+ // low price used for the Initial balance valuation (program: maybe_get_asset_weight_init_discount).
51370
51453
  marginRequirement: 2 /* Equity */,
51371
51454
  priceBias: 0 /* Lowest */,
51372
51455
  assetShareValueMultiplier,
@@ -53789,21 +53872,6 @@ var MarginfiAccount = class _MarginfiAccount {
53789
53872
  ...params
53790
53873
  });
53791
53874
  }
53792
- /**
53793
- * Computes health components from balances without price bias.
53794
- *
53795
- * Returns weighted asset and liability values using neutral pricing
53796
- * (no conservative adjustments).
53797
- *
53798
- * @param params - Configuration for health computation (excluding activeBalances)
53799
- * @returns Object containing assets and liabilities values in USD
53800
- */
53801
- computeHealthComponentsWithoutBiasFromBalances(params) {
53802
- return computeHealthComponentsWithoutBiasFromBalances({
53803
- activeBalances: this.activeBalances,
53804
- ...params
53805
- });
53806
- }
53807
53875
  /**
53808
53876
  * Computes the total account value (equity).
53809
53877
  *
@@ -54039,29 +54107,29 @@ var MarginfiAccount = class _MarginfiAccount {
54039
54107
  return makeEndFlashLoanIx3(program, this.address, banks, authority);
54040
54108
  }
54041
54109
  /**
54042
- * Creates an instruction to transfer this account to a new authority.
54110
+ * Builds a transaction to transfer this account to a new authority.
54043
54111
  *
54044
- * Transfers ownership of the marginfi account to a new authority and account address.
54112
+ * Thin wrapper over the {@link makeAccountTransferToNewAccountTx} action,
54113
+ * injecting the connection and this account from context. The global fee
54114
+ * wallet is derived inside the action from the program's fee state.
54045
54115
  *
54046
54116
  * @param program - The Marginfi program instance
54047
- * @param newMarginfiAccount - The new marginfi account public key
54117
+ * @param newMarginfiAccount - Freshly generated keypair for the destination account
54048
54118
  * @param newAuthority - The new authority public key
54119
+ * @param feePayer - Optional `PublicKey` (adapter-signed) or `Keypair` (separate
54120
+ * payer); defaults to this account's authority
54049
54121
  *
54050
- * @returns Promise resolving to InstructionsWrapper containing the transfer instruction
54051
- *
54052
- * @see {@link makeAccountTransferToNewAccountIx} for implementation
54122
+ * @returns Promise resolving to the transfer transaction
54053
54123
  */
54054
- async makeAccountTransferToNewAccountIx(program, newMarginfiAccount, newAuthority) {
54055
- const accountTransferToNewAccountIx = await instructions_default.makeAccountTransferToNewAccountIx(
54124
+ async makeAccountTransferToNewAccountTx(program, newMarginfiAccount, newAuthority, feePayer) {
54125
+ return makeAccountTransferToNewAccountTx({
54126
+ connection: program.provider.connection,
54056
54127
  program,
54057
- {
54058
- oldMarginfiAccount: this.address,
54059
- newMarginfiAccount,
54060
- newAuthority,
54061
- feePayer: this.authority
54062
- }
54063
- );
54064
- return { instructions: [accountTransferToNewAccountIx], keys: [] };
54128
+ marginfiAccount: this,
54129
+ newMarginfiAccount,
54130
+ newAuthority,
54131
+ feePayer
54132
+ });
54065
54133
  }
54066
54134
  /**
54067
54135
  * Creates an instruction to close this marginfi account.
@@ -54709,16 +54777,19 @@ var MarginfiAccountWrapper = class {
54709
54777
  );
54710
54778
  }
54711
54779
  /**
54712
- * Creates an account transfer instruction.
54780
+ * Builds a transaction to transfer this account to a new authority.
54713
54781
  *
54714
- * @param newMarginfiAccount - New account public key
54782
+ * @param newMarginfiAccount - Freshly generated keypair for the destination account
54715
54783
  * @param newAuthority - New authority public key
54784
+ * @param feePayer - Optional `PublicKey` (adapter-signed) or `Keypair` (separate
54785
+ * payer); defaults to this account's authority
54716
54786
  */
54717
- async makeAccountTransferToNewAccountIx(newMarginfiAccount, newAuthority) {
54718
- return this.account.makeAccountTransferToNewAccountIx(
54787
+ async makeAccountTransferToNewAccountTx(newMarginfiAccount, newAuthority, feePayer) {
54788
+ return this.account.makeAccountTransferToNewAccountTx(
54719
54789
  this.client.program,
54720
54790
  newMarginfiAccount,
54721
- newAuthority
54791
+ newAuthority,
54792
+ feePayer
54722
54793
  );
54723
54794
  }
54724
54795
  /**
@@ -55513,6 +55584,6 @@ var EmodeSettings = class _EmodeSettings {
55513
55584
  }
55514
55585
  };
55515
55586
 
55516
- export { ADDRESS_LOOKUP_TABLE_FOR_GROUP, ADDRESS_LOOKUP_TABLE_FOR_SWAP, AccountFlags, AccountType, AssetTag, BUNDLE_TX_SIZE, Balance, Bank, BankConfig, BankConfigFlag, BankVaultType, DEFAULT_CROSSBAR_URL, DEFAULT_FALLBACK_CROSSBAR_URL, DEFAULT_ORACLE_MAX_AGE, DISABLED_FLAG, EMPTY_HEALTH_CACHE, EmodeEntryFlags, EmodeFlags, EmodeImpactStatus, EmodeSettings, EmodeTag, FLASHLOAN_ENABLED_FLAG, HOURS_PER_YEAR, HealthCache, HealthCacheFlags, HealthCacheSimulationError, HealthCacheStatus, JUPITER_V6_PROGRAM, JUP_SWAP_LUT_PROGRAM_AUTHORITY_INDEX, LST_MINT, MARGINFI_IDL, MARGINFI_PROGRAM, MARGINFI_PROGRAM_STAGING, MARGINFI_PROGRAM_STAGING_ALT, MARGINFI_SPONSORED_SHARD_ID, MAX_ACCOUNT_LOCKS, MAX_CONFIDENCE_INTERVAL_RATIO, MAX_TX_SIZE, MAX_U64, MPL_METADATA_PROGRAM_ID, MarginRequirementType, MarginfiAccount, MarginfiAccountWrapper, MarginfiGroup, OperationalState, OracleSetup, PDA_BANK_EMISSIONS_AUTH_SEED, PDA_BANK_EMISSIONS_VAULT_SEED, PDA_BANK_FEE_STATE_SEED, PDA_BANK_FEE_VAULT_AUTH_SEED, PDA_BANK_FEE_VAULT_SEED, PDA_BANK_INSURANCE_VAULT_AUTH_SEED, PDA_BANK_INSURANCE_VAULT_SEED, PDA_BANK_LIQUIDITY_VAULT_AUTH_SEED, PDA_BANK_LIQUIDITY_VAULT_SEED, PDA_MARGINFI_ACCOUNT_SEED, PRIORITY_TX_SIZE, PYTH_PRICE_CONF_INTERVALS, PYTH_PUSH_ORACLE_ID, PYTH_SPONSORED_SHARD_ID, PriceBias, Project0Client, RiskTier, SINGLE_POOL_PROGRAM_ID, STAKE_CONFIG_ID, STAKE_PROGRAM_ID, SWB_PRICE_CONF_INTERVALS, SYSTEM_PROGRAM_ID, SYSVAR_CLOCK_ID, SYSVAR_RENT_ID, SYSVAR_STAKE_HISTORY_ID, SwapProvider, TRANSFER_ACCOUNT_AUTHORITY_FLAG, TransactionArenaKeyMap, TransactionBuildingError, TransactionBuildingErrorCode, TransactionConfigMap, TransactionType, USDC_DECIMALS, USDC_MINT, WSOL_MINT, ZERO_ORACLE_KEY, accountFlagToBN, addOracleToBanksIx, addTransactionMetadata, adjustPriceComponent, aprToApy, apyToApr, balanceToDto, bankConfigRawToDto, bankConfigToBankConfigRaw, bankMetadataMapToDto, bankMetadataToDto, bankRawToDto, bigNumberToWrappedI80F48, bpsToPercentile, calculateApyFromInterest, calculateInterestFromApy, capConfidenceInterval, categorizePythBanks, checkBatchOracleCrankability, checkMultipleOraclesCrankability, chunkedGetRawMultipleAccountInfoOrdered, chunkedGetRawMultipleAccountInfoOrderedWithNulls, chunkedGetRawMultipleAccountInfos, compileFlashloanPrecheck, composeRemainingAccounts, computeAccountValue, computeActiveEmodePairs, computeAssetHealthComponent, computeAssetUsdValue, computeBalanceUsdValue, computeBankBorrowApy, computeBankBorrowCapRemaining, computeBankDepositCapRemaining, computeBankMetrics, computeBankPoolSize, computeBankSupplyApy, computeBankTotalBorrows, computeBankTotalBorrowsUsd, computeBankTotalDeposits, computeBankTotalDepositsUsd, computeBaseInterestRate, computeClaimedEmissions, computeClosePositionTokenAmount, computeEmodeImpacts, computeFlashLoanNonSwapBudget, computeFlashloanSwapConstraints, computeFreeCollateralFromBalances, computeFreeCollateralFromCache, computeHealthAccountMetas, computeHealthCacheStatus, computeHealthCheckAccounts, computeHealthComponentsFromBalances, computeHealthComponentsFromCache, computeHealthComponentsWithoutBiasFromBalances, computeInterestRates, computeLiabilityHealthComponent, computeLiabilityUsdValue, computeLiquidationPriceForBank, computeLoopingParams, computeLowestEmodeWeights, computeMaxBorrowForBank, computeMaxLeverage, computeMaxWithdrawForBank, computeNetApy, computeProjectedActiveBalancesNoCpi, computeProjectedActiveBanksNoCpi, computeQuantity, computeQuantityUi, computeRemainingCapacity, computeSmartCrank, computeStakedBankMultipliers, computeTotalOutstandingEmissions, computeTvl, computeUsdValue, computeUtilizationRate, computeV0TxSize, convertVoteAccCoeffsToBankCoeffs, createActiveEmodePairFromPairs, createEmptyBalance, decodeAccountRaw, decodeBankRaw, decodeInstruction, decompileV0Transaction, deriveBankEmissionsAuth, deriveBankEmissionsVault, deriveBankFeeVault, deriveBankFeeVaultAuthority, deriveBankInsuranceVault, deriveBankInsuranceVaultAuthority, deriveBankLiquidityVault, deriveBankLiquidityVaultAuthority, deriveFeeState, deriveMarginfiAccount, dtoToBalance, dtoToBank, dtoToBankConfig, dtoToBankConfigRaw, dtoToBankMetadata, dtoToBankMetadataMap, dtoToBankRaw, dtoToEmodeSettings, dtoToEmodeSettingsRaw, dtoToGroup, dtoToHealthCache, dtoToInterestRateConfig, dtoToMarginfiAccount, dtoToOraclePrice, dtoToValidatorStakeGroup, emodeSettingsRawToDto, extractPythOracleKeys, fetchBank, fetchBankIntegrationMetadata, fetchMarginfiAccountAddresses, fetchMarginfiAccountData, fetchMultipleBanks, fetchNativeStakeAccounts, fetchOracleData, fetchProgramForMints, fetchPythOracleData, fetchPythOraclePricesFromAPI, fetchPythOraclePricesFromChain, fetchStakeAccount, fetchStakePoolActiveStates, fetchStakePoolMev, fetchSwbOracleAccountsFromAPI, fetchSwbOracleAccountsFromChain, fetchSwbOracleData, fetchSwbOraclePricesFromAPI, fetchSwbOraclePricesFromCrossbar, findRandomAvailableAccountIndex, freezeBankConfigIx, generateDummyAccount, getAccountKeys, getActiveAccountFlags, getActiveBalances, getActiveEmodeEntryFlags, getActiveEmodeFlags, getActiveHealthCacheFlags, getAssetQuantity, getAssetShares, getAssetWeight, getBalance, getBalanceUsdValueWithPriceBias, getBankVaultAuthority, getBankVaultSeeds, getBirdeyeFallbackPricesByFeedId, getBirdeyePricesForMints, getConfig, getDriftCTokenMultiplier, getDriftMetadata, getDriftStatesDto, getEmodePairs, getExactOutEstimate, getHealthCacheStatusDescription, getHealthSimulationTransactions, getJupLendFTokenMultiplier, getJupLendMetadata, getJupLendStatesDto, getJupiterSwapIxsForFlashloan, getKaminoCTokenMultiplier, getKaminoMetadata, getKaminoStatesDto, getLiabilityQuantity, getLiabilityShares, getLiabilityWeight, getOracleSourceFromBank, getOracleSourceFromOracleSetup, getOracleSourceNameFromKey, getPrice, getPriceWithConfidence, getStakedBankMetadataMap, getSwapIxsForFlashloan, getTitanExactOutEstimate, getTitanSwapIxsForFlashloan, getTotalAccountKeys, getTotalAssetQuantity, getTotalLiabilityQuantity, getTxSize, getValidatorVoteAccountByBank, getWritableAccountKeys, groupToDto, hasAccountFlag, hasEmodeEntryFlag, hasEmodeFlag, hasHealthCacheFlag, healthCacheToDto, isFlashloan, isV0Tx, isWeightedPrice, isWholePosition, makeAddPermissionlessStakedBankIx, makeBeginFlashLoanIx3 as makeBeginFlashLoanIx, makeBorrowIx3 as makeBorrowIx, makeBorrowTx, makeBundleTipIx, makeClearEmissionsIx, makeCloseMarginfiAccountIx, makeCloseMarginfiAccountTx, makeCrankSwbFeedIx, makeCreateAccountIxWithProjection, makeCreateAccountTxWithProjection, makeCreateMarginfiAccountIx, makeCreateMarginfiAccountTx, makeDepositIx3 as makeDepositIx, makeDepositTx, makeDriftDepositIx3 as makeDriftDepositIx, makeDriftDepositTx, makeDriftWithdrawIx3 as makeDriftWithdrawIx, makeDriftWithdrawTx, makeEndFlashLoanIx3 as makeEndFlashLoanIx, makeFlashLoanTx, makeJuplendDepositIx2 as makeJuplendDepositIx, makeJuplendDepositTx, makeJuplendWithdrawIx2 as makeJuplendWithdrawIx, makeJuplendWithdrawTx, makeKaminoDepositIx3 as makeKaminoDepositIx, makeKaminoDepositTx, makeKaminoWithdrawIx3 as makeKaminoWithdrawIx, makeKaminoWithdrawTx, makeLoopTx, makeMergeStakeAccountsTx, makeMintStakedLstIx, makeMintStakedLstTx, makePoolAddBankIx3 as makePoolAddBankIx, makePoolConfigureBankIx3 as makePoolConfigureBankIx, makePriorityFeeIx, makePriorityFeeMicroIx, makePulseHealthIx2 as makePulseHealthIx, makeRedeemStakedLstIx, makeRedeemStakedLstTx, makeRefreshKaminoBanksIxs, makeRepayIx3 as makeRepayIx, makeRepayTx, makeRepayWithCollatTx, makeSetupIx, makeSmartCrankSwbFeedIx, makeSwapCollateralTx, makeSwapDebtTx, makeTxPriorityIx, makeUnwrapSolIx, makeUpdateDriftMarketIxs, makeUpdateJupLendRateIxs, makeUpdateSwbFeedIx, makeVersionedTransaction, makeWithdrawIx3 as makeWithdrawIx, makeWithdrawTx, makeWrapSolIxs, mapBrokenFeedsToOraclePrices, mapJupiterQuoteToSwapQuoteResult, mapPythBanksToOraclePrices, mapSwbBanksToOraclePrices, marginfiAccountToDto, nativeToUi, oraclePriceToDto, parseBalanceRaw, parseBankConfigRaw, parseBankRaw, parseEmodeSettingsRaw, parseEmodeTag, parseHealthCacheRaw, parseMarginfiAccountRaw, parseOperationalState, parseOracleSetup, parseOraclePriceData as parsePriceInfo, parseRiskTier, parseRpcPythPriceData, parseSwbOraclePriceData, partitionBanksByCrankability, resolveAmount, serializeBankConfigOpt, serializeInterestRateConfig, serializeOperationalState, serializeOracleSetup, serializeOracleSetupToIndex, serializeRiskTier, shortenAddress, simulateAccountHealthCache, simulateAccountHealthCacheWithFallback, simulateBundle, splitInstructionsToFitTransactions, toBankConfigDto, toBankDto, toBigNumber, toEmodeSettingsDto, toInterestRateConfigDto, toJupiterConfig, toNumber, uiToNative, uiToNativeBigNumber, validatorStakeGroupToDto, wrappedI80F48toBigNumber };
55587
+ export { ADDRESS_LOOKUP_TABLE_FOR_GROUP, ADDRESS_LOOKUP_TABLE_FOR_SWAP, AccountFlags, AccountType, AssetTag, BUNDLE_TX_SIZE, Balance, Bank, BankConfig, BankConfigFlag, BankVaultType, DEFAULT_CROSSBAR_URL, DEFAULT_FALLBACK_CROSSBAR_URL, DEFAULT_ORACLE_MAX_AGE, DISABLED_FLAG, EMPTY_HEALTH_CACHE, EmodeEntryFlags, EmodeFlags, EmodeImpactStatus, EmodeSettings, EmodeTag, FLASHLOAN_ENABLED_FLAG, HOURS_PER_YEAR, HealthCache, HealthCacheFlags, HealthCacheSimulationError, HealthCacheStatus, JUPITER_V6_PROGRAM, JUP_SWAP_LUT_PROGRAM_AUTHORITY_INDEX, LST_MINT, MARGINFI_IDL, MARGINFI_PROGRAM, MARGINFI_PROGRAM_STAGING, MARGINFI_PROGRAM_STAGING_ALT, MARGINFI_SPONSORED_SHARD_ID, MAX_ACCOUNT_LOCKS, MAX_CONFIDENCE_INTERVAL_RATIO, MAX_TX_SIZE, MAX_U64, MPL_METADATA_PROGRAM_ID, MarginRequirementType, MarginfiAccount, MarginfiAccountWrapper, MarginfiGroup, OperationalState, OracleSetup, PDA_BANK_EMISSIONS_AUTH_SEED, PDA_BANK_EMISSIONS_VAULT_SEED, PDA_BANK_FEE_STATE_SEED, PDA_BANK_FEE_VAULT_AUTH_SEED, PDA_BANK_FEE_VAULT_SEED, PDA_BANK_INSURANCE_VAULT_AUTH_SEED, PDA_BANK_INSURANCE_VAULT_SEED, PDA_BANK_LIQUIDITY_VAULT_AUTH_SEED, PDA_BANK_LIQUIDITY_VAULT_SEED, PDA_MARGINFI_ACCOUNT_SEED, PRIORITY_TX_SIZE, PYTH_PRICE_CONF_INTERVALS, PYTH_PUSH_ORACLE_ID, PYTH_SPONSORED_SHARD_ID, PriceBias, Project0Client, RiskTier, SINGLE_POOL_PROGRAM_ID, STAKE_CONFIG_ID, STAKE_PROGRAM_ID, SWB_PRICE_CONF_INTERVALS, SYSTEM_PROGRAM_ID, SYSVAR_CLOCK_ID, SYSVAR_RENT_ID, SYSVAR_STAKE_HISTORY_ID, SwapProvider, TRANSFER_ACCOUNT_AUTHORITY_FLAG, TransactionArenaKeyMap, TransactionBuildingError, TransactionBuildingErrorCode, TransactionConfigMap, TransactionType, USDC_DECIMALS, USDC_MINT, WSOL_MINT, ZERO_ORACLE_KEY, accountFlagToBN, addOracleToBanksIx, addTransactionMetadata, adjustPriceComponent, aprToApy, apyToApr, balanceToDto, bankConfigRawToDto, bankConfigToBankConfigRaw, bankMetadataMapToDto, bankMetadataToDto, bankRawToDto, bigNumberToWrappedI80F48, bpsToPercentile, calculateApyFromInterest, calculateInterestFromApy, capConfidenceInterval, categorizePythBanks, checkBatchOracleCrankability, checkMultipleOraclesCrankability, chunkedGetRawMultipleAccountInfoOrdered, chunkedGetRawMultipleAccountInfoOrderedWithNulls, chunkedGetRawMultipleAccountInfos, compileFlashloanPrecheck, composeRemainingAccounts, computeAccountValue, computeActiveEmodePairs, computeAssetHealthComponent, computeAssetUsdValue, computeBalanceUsdValue, computeBankBorrowApy, computeBankBorrowCapRemaining, computeBankDepositCapRemaining, computeBankMetrics, computeBankPoolSize, computeBankSupplyApy, computeBankTotalBorrows, computeBankTotalBorrowsUsd, computeBankTotalDeposits, computeBankTotalDepositsUsd, computeBaseInterestRate, computeClaimedEmissions, computeClosePositionTokenAmount, computeEmodeImpacts, computeFlashLoanNonSwapBudget, computeFlashloanSwapConstraints, computeFreeCollateralFromBalances, computeFreeCollateralFromCache, computeHealthAccountMetas, computeHealthCacheStatus, computeHealthCheckAccounts, computeHealthComponentsFromBalances, computeHealthComponentsFromCache, computeInterestRates, computeLiabilityHealthComponent, computeLiabilityUsdValue, computeLiquidationPriceForBank, computeLoopingParams, computeLowestEmodeWeights, computeMaxBorrowForBank, computeMaxLeverage, computeMaxWithdrawForBank, computeNetApy, computeProjectedActiveBalancesNoCpi, computeProjectedActiveBanksNoCpi, computeQuantity, computeQuantityUi, computeRemainingCapacity, computeSmartCrank, computeStakedBankMultipliers, computeTotalOutstandingEmissions, computeTvl, computeUsdValue, computeUtilizationRate, computeV0TxSize, convertVoteAccCoeffsToBankCoeffs, createActiveEmodePairFromPairs, createEmptyBalance, decodeAccountRaw, decodeBankRaw, decodeInstruction, decompileV0Transaction, deriveBankEmissionsAuth, deriveBankEmissionsVault, deriveBankFeeVault, deriveBankFeeVaultAuthority, deriveBankInsuranceVault, deriveBankInsuranceVaultAuthority, deriveBankLiquidityVault, deriveBankLiquidityVaultAuthority, deriveFeeState, deriveMarginfiAccount, dtoToBalance, dtoToBank, dtoToBankConfig, dtoToBankConfigRaw, dtoToBankMetadata, dtoToBankMetadataMap, dtoToBankRaw, dtoToEmodeSettings, dtoToEmodeSettingsRaw, dtoToGroup, dtoToHealthCache, dtoToInterestRateConfig, dtoToMarginfiAccount, dtoToOraclePrice, dtoToValidatorStakeGroup, emodeSettingsRawToDto, extractPythOracleKeys, fetchBank, fetchBankIntegrationMetadata, fetchMarginfiAccountAddresses, fetchMarginfiAccountData, fetchMultipleBanks, fetchNativeStakeAccounts, fetchOracleData, fetchProgramForMints, fetchPythOracleData, fetchPythOraclePricesFromAPI, fetchPythOraclePricesFromChain, fetchStakeAccount, fetchStakePoolActiveStates, fetchStakePoolMev, fetchSwbOracleAccountsFromAPI, fetchSwbOracleAccountsFromChain, fetchSwbOracleData, fetchSwbOraclePricesFromAPI, fetchSwbOraclePricesFromCrossbar, findRandomAvailableAccountIndex, freezeBankConfigIx, generateDummyAccount, getAccountKeys, getActiveAccountFlags, getActiveBalances, getActiveEmodeEntryFlags, getActiveEmodeFlags, getActiveHealthCacheFlags, getAssetQuantity, getAssetShares, getAssetWeight, getBalance, getBalanceUsdValueWithPriceBias, getBankVaultAuthority, getBankVaultSeeds, getBirdeyeFallbackPricesByFeedId, getBirdeyePricesForMints, getConfig, getDriftCTokenMultiplier, getDriftMetadata, getDriftStatesDto, getEmodePairs, getExactOutEstimate, getHealthCacheStatusDescription, getHealthSimulationTransactions, getJupLendFTokenMultiplier, getJupLendMetadata, getJupLendStatesDto, getJupiterSwapIxsForFlashloan, getKaminoCTokenMultiplier, getKaminoMetadata, getKaminoStatesDto, getLiabilityQuantity, getLiabilityShares, getLiabilityWeight, getOracleSourceFromBank, getOracleSourceFromOracleSetup, getOracleSourceNameFromKey, getPrice, getPriceWithConfidence, getStakedBankMetadataMap, getSwapIxsForFlashloan, getTitanExactOutEstimate, getTitanSwapIxsForFlashloan, getTotalAccountKeys, getTotalAssetQuantity, getTotalLiabilityQuantity, getTxSize, getValidatorVoteAccountByBank, getWritableAccountKeys, groupToDto, hasAccountFlag, hasEmodeEntryFlag, hasEmodeFlag, hasHealthCacheFlag, healthCacheToDto, isFlashloan, isV0Tx, isWeightedPrice, isWholePosition, makeAccountTransferToNewAccountTx, makeAddPermissionlessStakedBankIx, makeBeginFlashLoanIx3 as makeBeginFlashLoanIx, makeBorrowIx3 as makeBorrowIx, makeBorrowTx, makeBundleTipIx, makeClearEmissionsIx, makeCloseMarginfiAccountIx, makeCloseMarginfiAccountTx, makeCrankSwbFeedIx, makeCreateAccountIxWithProjection, makeCreateAccountTxWithProjection, makeCreateMarginfiAccountIx, makeCreateMarginfiAccountTx, makeDepositIx3 as makeDepositIx, makeDepositTx, makeDriftDepositIx3 as makeDriftDepositIx, makeDriftDepositTx, makeDriftWithdrawIx3 as makeDriftWithdrawIx, makeDriftWithdrawTx, makeEndFlashLoanIx3 as makeEndFlashLoanIx, makeFlashLoanTx, makeJuplendDepositIx2 as makeJuplendDepositIx, makeJuplendDepositTx, makeJuplendWithdrawIx2 as makeJuplendWithdrawIx, makeJuplendWithdrawTx, makeKaminoDepositIx3 as makeKaminoDepositIx, makeKaminoDepositTx, makeKaminoWithdrawIx3 as makeKaminoWithdrawIx, makeKaminoWithdrawTx, makeLoopTx, makeMergeStakeAccountsTx, makeMintStakedLstIx, makeMintStakedLstTx, makePoolAddBankIx3 as makePoolAddBankIx, makePoolConfigureBankIx3 as makePoolConfigureBankIx, makePriorityFeeIx, makePriorityFeeMicroIx, makePulseHealthIx2 as makePulseHealthIx, makeRedeemStakedLstIx, makeRedeemStakedLstTx, makeRefreshKaminoBanksIxs, makeRepayIx3 as makeRepayIx, makeRepayTx, makeRepayWithCollatTx, makeSetupIx, makeSmartCrankSwbFeedIx, makeSwapCollateralTx, makeSwapDebtTx, makeTxPriorityIx, makeUnwrapSolIx, makeUpdateDriftMarketIxs, makeUpdateJupLendRateIxs, makeUpdateSwbFeedIx, makeVersionedTransaction, makeWithdrawIx3 as makeWithdrawIx, makeWithdrawTx, makeWrapSolIxs, mapBrokenFeedsToOraclePrices, mapJupiterQuoteToSwapQuoteResult, mapPythBanksToOraclePrices, mapSwbBanksToOraclePrices, marginfiAccountToDto, nativeToUi, oraclePriceToDto, parseBalanceRaw, parseBankConfigRaw, parseBankRaw, parseEmodeSettingsRaw, parseEmodeTag, parseHealthCacheRaw, parseMarginfiAccountRaw, parseOperationalState, parseOracleSetup, parseOraclePriceData as parsePriceInfo, parseRiskTier, parseRpcPythPriceData, parseSwbOraclePriceData, partitionBanksByCrankability, resolveAmount, serializeBankConfigOpt, serializeInterestRateConfig, serializeOperationalState, serializeOracleSetup, serializeOracleSetupToIndex, serializeRiskTier, shortenAddress, simulateAccountHealthCache, simulateAccountHealthCacheWithFallback, simulateBundle, splitInstructionsToFitTransactions, toBankConfigDto, toBankDto, toBigNumber, toEmodeSettingsDto, toInterestRateConfigDto, toJupiterConfig, toNumber, uiToNative, uiToNativeBigNumber, validatorStakeGroupToDto, wrappedI80F48toBigNumber };
55517
55588
  //# sourceMappingURL=index.js.map
55518
55589
  //# sourceMappingURL=index.js.map