@0dotxyz/p0-ts-sdk 2.7.1-alpha.1 → 2.7.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/README.md +2 -9
- package/dist/index.cjs +30 -301
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -229
- package/dist/index.d.ts +10 -229
- package/dist/index.js +31 -286
- package/dist/index.js.map +1 -1
- package/dist/instructions.cjs.map +1 -1
- package/dist/instructions.d.cts +1 -1
- package/dist/instructions.d.ts +1 -1
- package/dist/instructions.js.map +1 -1
- package/dist/{types-B5SGXpex.d.ts → types-Ctm1kvCr.d.ts} +1 -1
- package/dist/{types-BFLi0Ozl.d.cts → types-DzbVhEfo.d.cts} +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -27718,11 +27718,6 @@ var klendInstructions = {
|
|
|
27718
27718
|
};
|
|
27719
27719
|
var instructions_default2 = klendInstructions;
|
|
27720
27720
|
|
|
27721
|
-
// src/vendor/drift/types/drift-spot-market/drift-spot-market.types.ts
|
|
27722
|
-
function isSpotBalanceTypeVariant(value, variant) {
|
|
27723
|
-
return value === variant;
|
|
27724
|
-
}
|
|
27725
|
-
|
|
27726
27721
|
// src/vendor/drift/idl/drift.json
|
|
27727
27722
|
var drift_default = {
|
|
27728
27723
|
address: "dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH",
|
|
@@ -42088,34 +42083,6 @@ function deriveDriftSpotMarketVault(marketIndex, programId = DRIFT_PROGRAM_ID) {
|
|
|
42088
42083
|
programId
|
|
42089
42084
|
);
|
|
42090
42085
|
}
|
|
42091
|
-
var ZERO = new BN9(0);
|
|
42092
|
-
var ONE = new BN9(1);
|
|
42093
|
-
var TEN = new BN9(10);
|
|
42094
|
-
var PERCENTAGE_PRECISION_EXP = new BN9(6);
|
|
42095
|
-
new BN9(10).pow(PERCENTAGE_PRECISION_EXP);
|
|
42096
|
-
var SPOT_MARKET_RATE_PRECISION_EXP = new BN9(6);
|
|
42097
|
-
new BN9(10).pow(SPOT_MARKET_RATE_PRECISION_EXP);
|
|
42098
|
-
var SPOT_MARKET_UTILIZATION_PRECISION_EXP = new BN9(6);
|
|
42099
|
-
new BN9(10).pow(
|
|
42100
|
-
SPOT_MARKET_UTILIZATION_PRECISION_EXP
|
|
42101
|
-
);
|
|
42102
|
-
new BN9(31536e3);
|
|
42103
|
-
function divCeil(a, b) {
|
|
42104
|
-
const quotient = a.div(b);
|
|
42105
|
-
const remainder = a.mod(b);
|
|
42106
|
-
if (remainder.gt(ZERO)) {
|
|
42107
|
-
return quotient.add(ONE);
|
|
42108
|
-
}
|
|
42109
|
-
return quotient;
|
|
42110
|
-
}
|
|
42111
|
-
function getDriftTokenAmount(balanceAmount, spotMarket, balanceType) {
|
|
42112
|
-
const precisionDecrease = TEN.pow(new BN9(19 - spotMarket.decimals));
|
|
42113
|
-
if (isSpotBalanceTypeVariant(balanceType, "deposit")) {
|
|
42114
|
-
return balanceAmount.mul(spotMarket.cumulativeDepositInterest).div(precisionDecrease);
|
|
42115
|
-
} else {
|
|
42116
|
-
return divCeil(balanceAmount.mul(spotMarket.cumulativeBorrowInterest), precisionDecrease);
|
|
42117
|
-
}
|
|
42118
|
-
}
|
|
42119
42086
|
|
|
42120
42087
|
// src/vendor/drift/utils/rewards.utils.ts
|
|
42121
42088
|
async function getDriftRewards(spotMarkets, userStates, connection) {
|
|
@@ -69514,6 +69481,7 @@ function makeEndFlashLoanIx2(programId, accounts, remainingAccounts = []) {
|
|
|
69514
69481
|
{ pubkey: accounts.group, isSigner: false, isWritable: false },
|
|
69515
69482
|
{ pubkey: accounts.authority, isSigner: true, isWritable: false }
|
|
69516
69483
|
];
|
|
69484
|
+
if (!isMarginfiV0110Live(programId)) keys.splice(1, 1);
|
|
69517
69485
|
keys.push(...remainingAccounts);
|
|
69518
69486
|
return new TransactionInstruction({
|
|
69519
69487
|
keys,
|
|
@@ -69723,6 +69691,7 @@ function makePulseHealthIx3(programId, accounts, remainingAccounts = []) {
|
|
|
69723
69691
|
{ pubkey: accounts.marginfiAccount, isSigner: false, isWritable: true },
|
|
69724
69692
|
{ pubkey: accounts.group, isSigner: false, isWritable: false }
|
|
69725
69693
|
];
|
|
69694
|
+
if (!isMarginfiV0110Live(programId)) keys.splice(1, 1);
|
|
69726
69695
|
keys.push(...remainingAccounts);
|
|
69727
69696
|
return new TransactionInstruction({
|
|
69728
69697
|
keys,
|
|
@@ -69742,6 +69711,7 @@ function makeAccountTransferToNewAccountIx2(programId, accounts) {
|
|
|
69742
69711
|
{ pubkey: accounts.feeState, isSigner: false, isWritable: false },
|
|
69743
69712
|
{ pubkey: SystemProgram.programId, isSigner: false, isWritable: false }
|
|
69744
69713
|
];
|
|
69714
|
+
if (!isMarginfiV0110Live(programId)) keys.splice(7, 1);
|
|
69745
69715
|
return new TransactionInstruction({
|
|
69746
69716
|
keys,
|
|
69747
69717
|
programId,
|
|
@@ -73890,20 +73860,6 @@ var MarginfiAccount = class _MarginfiAccount {
|
|
|
73890
73860
|
...params
|
|
73891
73861
|
});
|
|
73892
73862
|
}
|
|
73893
|
-
/**
|
|
73894
|
-
* Calculates the maximum amount that can be deposited into a bank.
|
|
73895
|
-
*
|
|
73896
|
-
* Deposits are not constrained by account health, only by the bank's remaining deposit cap
|
|
73897
|
-
* and (optionally) the wallet balance.
|
|
73898
|
-
*
|
|
73899
|
-
* @param params - Configuration for max deposit computation
|
|
73900
|
-
* @returns Maximum depositable amount in UI units
|
|
73901
|
-
*
|
|
73902
|
-
* @see {@link computeMaxDepositForBank} for implementation details
|
|
73903
|
-
*/
|
|
73904
|
-
computeMaxDepositForBank(params) {
|
|
73905
|
-
return computeMaxDepositForBank(params);
|
|
73906
|
-
}
|
|
73907
73863
|
/**
|
|
73908
73864
|
* Gets the banks required for health check calculations.
|
|
73909
73865
|
*
|
|
@@ -77763,9 +77719,7 @@ function computeMaxBorrowForBank(params) {
|
|
|
77763
77719
|
assetShareValueMultiplierByBank,
|
|
77764
77720
|
emodeImpactStatus,
|
|
77765
77721
|
volatilityFactor,
|
|
77766
|
-
activePair
|
|
77767
|
-
groupRateLimiter,
|
|
77768
|
-
ignoreBankLimits
|
|
77722
|
+
activePair
|
|
77769
77723
|
} = params;
|
|
77770
77724
|
const bank = banksMap.get(bankAddress.toBase58());
|
|
77771
77725
|
if (!bank) throw Error(`Bank ${bankAddress.toBase58()} not found`);
|
|
@@ -77825,67 +77779,15 @@ function computeMaxBorrowForBank(params) {
|
|
|
77825
77779
|
assetShareValueMultiplier
|
|
77826
77780
|
});
|
|
77827
77781
|
const liabWeight = getLiabilityWeight(bank.config, 0 /* Initial */);
|
|
77828
|
-
|
|
77829
|
-
bank.
|
|
77830
|
-
|
|
77831
|
-
|
|
77832
|
-
|
|
77833
|
-
freeCollateral.minus(untiedCollateralForBank).div(
|
|
77834
|
-
) : untiedCollateralForBank.div(priceLowestBias.times(assetWeight)).plus(freeCollateral.minus(untiedCollateralForBank).div(liabPriceWeighted));
|
|
77835
|
-
if (ignoreBankLimits) return healthMaxBorrow;
|
|
77836
|
-
const borrowCapRemaining = new BigNumber3(computeBankBorrowCapRemaining(bank)).div(
|
|
77837
|
-
originationFeeFactor
|
|
77838
|
-
);
|
|
77839
|
-
const availableLiquidity = computeBankProjectedAvailableLiquidity(
|
|
77840
|
-
bank,
|
|
77841
|
-
assetShareValueMultiplier
|
|
77842
|
-
).div(originationFeeFactor);
|
|
77843
|
-
const rateLimitRemaining = computeOutflowRateLimitRemaining(bank, oraclePrice, groupRateLimiter);
|
|
77844
|
-
return BigNumber3.max(
|
|
77845
|
-
0,
|
|
77846
|
-
BigNumber3.min(healthMaxBorrow, borrowCapRemaining, availableLiquidity, rateLimitRemaining)
|
|
77847
|
-
);
|
|
77848
|
-
}
|
|
77849
|
-
function computeOutflowRateLimitRemaining(bank, oraclePrice, groupRateLimiter) {
|
|
77850
|
-
const nowSeconds = Date.now() / 1e3;
|
|
77851
|
-
let remaining = new BigNumber3(Infinity);
|
|
77852
|
-
const bankRemaining = computeBankRateLimitRemaining(bank, nowSeconds);
|
|
77853
|
-
if (bankRemaining !== null) remaining = BigNumber3.min(remaining, bankRemaining);
|
|
77854
|
-
const groupRemainingUsd = computeGroupRateLimitRemainingUsd(groupRateLimiter, nowSeconds);
|
|
77855
|
-
if (groupRemainingUsd !== null) {
|
|
77856
|
-
const price = getPrice(oraclePrice, 1 /* None */, false);
|
|
77857
|
-
if (price.gt(0)) remaining = BigNumber3.min(remaining, groupRemainingUsd.div(price));
|
|
77782
|
+
if (assetWeight.eq(0)) {
|
|
77783
|
+
return computeQuantityUi(balance, bank, assetShareValueMultiplier).assets.plus(
|
|
77784
|
+
freeCollateral.minus(untiedCollateralForBank).div(priceHighestBias.times(liabWeight))
|
|
77785
|
+
);
|
|
77786
|
+
} else {
|
|
77787
|
+
return untiedCollateralForBank.div(priceLowestBias.times(assetWeight)).plus(freeCollateral.minus(untiedCollateralForBank).div(priceHighestBias.times(liabWeight)));
|
|
77858
77788
|
}
|
|
77859
|
-
return remaining;
|
|
77860
77789
|
}
|
|
77861
77790
|
function computeMaxWithdrawForBank(params) {
|
|
77862
|
-
const {
|
|
77863
|
-
banksMap,
|
|
77864
|
-
bankAddress,
|
|
77865
|
-
oraclePricesByBank,
|
|
77866
|
-
assetShareValueMultiplierByBank,
|
|
77867
|
-
groupRateLimiter,
|
|
77868
|
-
venueStates,
|
|
77869
|
-
ignoreBankLimits
|
|
77870
|
-
} = params;
|
|
77871
|
-
const bank = banksMap.get(bankAddress.toBase58());
|
|
77872
|
-
if (!bank) throw Error(`Bank ${bankAddress.toBase58()} not found`);
|
|
77873
|
-
const healthMaxWithdraw = computeHealthMaxWithdrawForBank(params);
|
|
77874
|
-
if (ignoreBankLimits) return healthMaxWithdraw;
|
|
77875
|
-
const oraclePrice = oraclePricesByBank.get(bankAddress.toBase58());
|
|
77876
|
-
if (!oraclePrice) throw Error(`Oracle price for ${bankAddress.toBase58()} not found`);
|
|
77877
|
-
const assetShareValueMultiplier = assetShareValueMultiplierByBank?.get(bankAddress.toBase58());
|
|
77878
|
-
const availableLiquidity = computeBankProjectedAvailableLiquidity(
|
|
77879
|
-
bank,
|
|
77880
|
-
assetShareValueMultiplier
|
|
77881
|
-
);
|
|
77882
|
-
const rateLimitRemaining = computeOutflowRateLimitRemaining(bank, oraclePrice, groupRateLimiter);
|
|
77883
|
-
const clamps = [healthMaxWithdraw, availableLiquidity, rateLimitRemaining];
|
|
77884
|
-
const venueLiquidity = computeVenueAvailableLiquidity(bank, venueStates);
|
|
77885
|
-
if (venueLiquidity !== void 0) clamps.push(venueLiquidity);
|
|
77886
|
-
return BigNumber3.max(0, BigNumber3.min(...clamps));
|
|
77887
|
-
}
|
|
77888
|
-
function computeHealthMaxWithdrawForBank(params) {
|
|
77889
77791
|
const {
|
|
77890
77792
|
account,
|
|
77891
77793
|
banksMap,
|
|
@@ -77981,17 +77883,6 @@ function computeHealthMaxWithdrawForBank(params) {
|
|
|
77981
77883
|
const maxWithdraw = initUntiedCollateralForBank.div(initWeightedPrice);
|
|
77982
77884
|
return maxWithdraw;
|
|
77983
77885
|
}
|
|
77984
|
-
function computeMaxDepositForBank(params) {
|
|
77985
|
-
const { banksMap, bankAddress, assetShareValueMultiplierByBank, walletBalance } = params;
|
|
77986
|
-
const bank = banksMap.get(bankAddress.toBase58());
|
|
77987
|
-
if (!bank) throw Error(`Bank ${bankAddress.toBase58()} not found`);
|
|
77988
|
-
const assetShareValueMultiplier = assetShareValueMultiplierByBank?.get(bankAddress.toBase58());
|
|
77989
|
-
const depositCapRemaining = new BigNumber3(computeBankDepositCapRemaining(bank)).times(
|
|
77990
|
-
assetShareValueMultiplier ?? 1
|
|
77991
|
-
);
|
|
77992
|
-
if (walletBalance === void 0) return depositCapRemaining;
|
|
77993
|
-
return BigNumber3.max(0, BigNumber3.min(depositCapRemaining, new BigNumber3(walletBalance)));
|
|
77994
|
-
}
|
|
77995
77886
|
|
|
77996
77887
|
// src/services/account/utils/misc.utils.ts
|
|
77997
77888
|
function floor(value, decimals) {
|
|
@@ -79664,21 +79555,6 @@ var fetchMultipleBanks = async (program, opts) => {
|
|
|
79664
79555
|
}
|
|
79665
79556
|
return bankDatas;
|
|
79666
79557
|
};
|
|
79667
|
-
var U64_MAX = new BigNumber3("18446744073709551615");
|
|
79668
|
-
var DRIFT_SCALED_BALANCE_DECIMALS = 9;
|
|
79669
|
-
function isDepositLimitActive(bank) {
|
|
79670
|
-
return !bank.config.depositLimit.eq(U64_MAX);
|
|
79671
|
-
}
|
|
79672
|
-
function isBorrowLimitActive(bank) {
|
|
79673
|
-
return !bank.config.borrowLimit.eq(U64_MAX);
|
|
79674
|
-
}
|
|
79675
|
-
function getEffectiveDepositLimit(bank) {
|
|
79676
|
-
const limit = bank.config.depositLimit;
|
|
79677
|
-
if (bank.config.assetTag !== 4 /* DRIFT */) return limit;
|
|
79678
|
-
const diff = DRIFT_SCALED_BALANCE_DECIMALS - bank.mintDecimals;
|
|
79679
|
-
if (diff === 0) return limit;
|
|
79680
|
-
return diff > 0 ? limit.times(10 ** diff) : limit.div(10 ** -diff);
|
|
79681
|
-
}
|
|
79682
79558
|
function computeInterestRates(bank) {
|
|
79683
79559
|
const { insuranceFeeFixedApr, insuranceIrFee, protocolFixedFeeApr, protocolIrFee } = bank.config.interestRateConfig;
|
|
79684
79560
|
const fixedFee = insuranceFeeFixedApr.plus(protocolFixedFeeApr);
|
|
@@ -79773,34 +79649,25 @@ function computeUtilizationRate(bank) {
|
|
|
79773
79649
|
return liabilities.div(assets);
|
|
79774
79650
|
}
|
|
79775
79651
|
var SECONDS_PER_DAY = 24 * 60 * 60;
|
|
79776
|
-
var SECONDS_PER_YEAR = SECONDS_PER_DAY * 365;
|
|
79777
|
-
var EXECUTION_HEADROOM_SECONDS = 120;
|
|
79778
|
-
function computeAccrualProjectionSeconds(bank, nowSeconds = Date.now() / 1e3) {
|
|
79779
|
-
const age = Math.max(0, nowSeconds - bank.lastUpdate);
|
|
79780
|
-
return Math.max(2 * age, age + EXECUTION_HEADROOM_SECONDS);
|
|
79781
|
-
}
|
|
79652
|
+
var SECONDS_PER_YEAR = SECONDS_PER_DAY * 365.25;
|
|
79782
79653
|
function computeRemainingCapacity(bank) {
|
|
79783
79654
|
const totalDeposits = getTotalAssetQuantity(bank);
|
|
79784
|
-
const remainingCapacity =
|
|
79785
|
-
0,
|
|
79786
|
-
getEffectiveDepositLimit(bank).minus(totalDeposits).minus(1).integerValue(BigNumber3.ROUND_FLOOR)
|
|
79787
|
-
) : U64_MAX;
|
|
79655
|
+
const remainingCapacity = BigNumber3.max(0, bank.config.depositLimit.minus(totalDeposits));
|
|
79788
79656
|
const totalBorrows = getTotalLiabilityQuantity(bank);
|
|
79789
|
-
const remainingBorrowCapacity =
|
|
79790
|
-
|
|
79791
|
-
bank.config.borrowLimit.minus(totalBorrows).minus(1).integerValue(BigNumber3.ROUND_FLOOR)
|
|
79792
|
-
) : U64_MAX;
|
|
79793
|
-
const projectionSeconds = computeAccrualProjectionSeconds(bank);
|
|
79657
|
+
const remainingBorrowCapacity = BigNumber3.max(0, bank.config.borrowLimit.minus(totalBorrows));
|
|
79658
|
+
const durationSinceLastAccrual = Date.now() / 1e3 - bank.lastUpdate;
|
|
79794
79659
|
const { lendingRate, borrowingRate } = computeInterestRates(bank);
|
|
79795
|
-
const
|
|
79796
|
-
const
|
|
79797
|
-
const depositCapacity = remainingCapacity.minus(
|
|
79798
|
-
const borrowCapacity = remainingBorrowCapacity.minus(
|
|
79660
|
+
const outstandingLendingInterest = lendingRate.times(durationSinceLastAccrual).dividedBy(SECONDS_PER_YEAR).times(totalDeposits);
|
|
79661
|
+
const outstandingBorrowInterest = borrowingRate.times(durationSinceLastAccrual).dividedBy(SECONDS_PER_YEAR).times(totalBorrows);
|
|
79662
|
+
const depositCapacity = remainingCapacity.minus(outstandingLendingInterest.times(2));
|
|
79663
|
+
const borrowCapacity = remainingBorrowCapacity.minus(outstandingBorrowInterest.times(2));
|
|
79799
79664
|
return {
|
|
79800
79665
|
depositCapacity,
|
|
79801
79666
|
borrowCapacity
|
|
79802
79667
|
};
|
|
79803
79668
|
}
|
|
79669
|
+
|
|
79670
|
+
// src/services/bank/utils/bank-metrics.utils.ts
|
|
79804
79671
|
function isStandardBorrowable(bank) {
|
|
79805
79672
|
const { assetTag, operationalState, borrowLimit } = bank.config;
|
|
79806
79673
|
return (assetTag === 0 /* DEFAULT */ || assetTag === 1 /* SOL */) && operationalState === "Operational" /* Operational */ && borrowLimit.gt(0);
|
|
@@ -79810,7 +79677,9 @@ function isStandardDepositable(bank) {
|
|
|
79810
79677
|
return (assetTag === 0 /* DEFAULT */ || assetTag === 1 /* SOL */) && operationalState === "Operational" /* Operational */;
|
|
79811
79678
|
}
|
|
79812
79679
|
function computeBankTotalDeposits(bank, assetShareValueMultiplier) {
|
|
79813
|
-
const totalAssets = getTotalAssetQuantity(bank).times(
|
|
79680
|
+
const totalAssets = getTotalAssetQuantity(bank).times(
|
|
79681
|
+
assetShareValueMultiplier ?? 1
|
|
79682
|
+
);
|
|
79814
79683
|
return nativeToUi(totalAssets, bank.mintDecimals);
|
|
79815
79684
|
}
|
|
79816
79685
|
function computeBankTotalBorrows(bank) {
|
|
@@ -79841,35 +79710,14 @@ function computeBankPoolSize(bank, assetShareValueMultiplier) {
|
|
|
79841
79710
|
const borrowCap = nativeToUi(bank.config.borrowLimit, bank.mintDecimals);
|
|
79842
79711
|
return Math.max(0, Math.min(totalDeposits, borrowCap) - totalBorrows);
|
|
79843
79712
|
}
|
|
79844
|
-
function computeBankAvailableLiquidity(bank, assetShareValueMultiplier) {
|
|
79845
|
-
const totalDeposits = computeBankTotalDeposits(bank, assetShareValueMultiplier);
|
|
79846
|
-
const totalBorrows = computeBankTotalBorrows(bank);
|
|
79847
|
-
return BigNumber3.max(0, new BigNumber3(totalDeposits).minus(totalBorrows));
|
|
79848
|
-
}
|
|
79849
79713
|
function computeBankDepositCapRemaining(bank) {
|
|
79850
|
-
if (!isDepositLimitActive(bank)) return Infinity;
|
|
79851
79714
|
const { depositCapacity } = computeRemainingCapacity(bank);
|
|
79852
79715
|
return Math.max(0, nativeToUi(depositCapacity, bank.mintDecimals));
|
|
79853
79716
|
}
|
|
79854
79717
|
function computeBankBorrowCapRemaining(bank) {
|
|
79855
|
-
if (!isBorrowLimitActive(bank)) return Infinity;
|
|
79856
79718
|
const { borrowCapacity } = computeRemainingCapacity(bank);
|
|
79857
79719
|
return Math.max(0, nativeToUi(borrowCapacity, bank.mintDecimals));
|
|
79858
79720
|
}
|
|
79859
|
-
function computeBankProjectedAvailableLiquidity(bank, assetShareValueMultiplier) {
|
|
79860
|
-
const liquidity = computeBankAvailableLiquidity(bank, assetShareValueMultiplier);
|
|
79861
|
-
const totalDeposits = computeBankTotalDeposits(bank, assetShareValueMultiplier);
|
|
79862
|
-
const totalBorrows = computeBankTotalBorrows(bank);
|
|
79863
|
-
const projectionYears = computeAccrualProjectionSeconds(bank) / SECONDS_PER_YEAR;
|
|
79864
|
-
const { lendingRate, borrowingRate } = computeInterestRates(bank);
|
|
79865
|
-
const projectedBorrowInterest = borrowingRate.times(totalBorrows).times(projectionYears);
|
|
79866
|
-
const projectedLendingInterest = lendingRate.times(totalDeposits).times(projectionYears);
|
|
79867
|
-
const liquidityLostToAccrual = BigNumber3.max(
|
|
79868
|
-
0,
|
|
79869
|
-
projectedBorrowInterest.minus(projectedLendingInterest)
|
|
79870
|
-
);
|
|
79871
|
-
return BigNumber3.max(0, liquidity.minus(liquidityLostToAccrual));
|
|
79872
|
-
}
|
|
79873
79721
|
function computeBankSupplyApy(bank) {
|
|
79874
79722
|
return aprToApy(computeInterestRates(bank).lendingRate.toNumber());
|
|
79875
79723
|
}
|
|
@@ -79882,7 +79730,11 @@ function computeBankMetrics(params) {
|
|
|
79882
79730
|
symbol,
|
|
79883
79731
|
totalDeposits: computeBankTotalDeposits(bank, assetShareValueMultiplier),
|
|
79884
79732
|
totalBorrows: computeBankTotalBorrows(bank),
|
|
79885
|
-
totalDepositsUsd: computeBankTotalDepositsUsd(
|
|
79733
|
+
totalDepositsUsd: computeBankTotalDepositsUsd(
|
|
79734
|
+
bank,
|
|
79735
|
+
oraclePrice,
|
|
79736
|
+
assetShareValueMultiplier
|
|
79737
|
+
),
|
|
79886
79738
|
totalBorrowsUsd: computeBankTotalBorrowsUsd(bank, oraclePrice),
|
|
79887
79739
|
utilizationRate: computeUtilizationRate(bank).toNumber(),
|
|
79888
79740
|
poolSize: computeBankPoolSize(bank, assetShareValueMultiplier),
|
|
@@ -79910,92 +79762,6 @@ function requireTokenProgram(tokenProgramsByBank, address, makeError = (message)
|
|
|
79910
79762
|
}
|
|
79911
79763
|
return tokenProgram;
|
|
79912
79764
|
}
|
|
79913
|
-
function computeRateLimitWindowRemainingCapacity(window, nowSeconds) {
|
|
79914
|
-
const { maxOutflow, windowDuration } = window;
|
|
79915
|
-
if (maxOutflow.lte(0)) return null;
|
|
79916
|
-
if (windowDuration === 0) return maxOutflow;
|
|
79917
|
-
let { windowStart, prevWindowOutflow, curWindowOutflow } = window;
|
|
79918
|
-
const elapsedRaw = Math.floor(nowSeconds) - windowStart;
|
|
79919
|
-
if (elapsedRaw >= windowDuration * 2) {
|
|
79920
|
-
windowStart = Math.floor(nowSeconds);
|
|
79921
|
-
prevWindowOutflow = new BigNumber3(0);
|
|
79922
|
-
curWindowOutflow = new BigNumber3(0);
|
|
79923
|
-
} else if (elapsedRaw >= windowDuration) {
|
|
79924
|
-
windowStart = windowStart + windowDuration;
|
|
79925
|
-
prevWindowOutflow = curWindowOutflow;
|
|
79926
|
-
curWindowOutflow = new BigNumber3(0);
|
|
79927
|
-
}
|
|
79928
|
-
const elapsed = Math.floor(nowSeconds) - windowStart;
|
|
79929
|
-
if (elapsed < 0) return new BigNumber3(0);
|
|
79930
|
-
if (elapsed >= windowDuration) return maxOutflow;
|
|
79931
|
-
const remainingTime = windowDuration - elapsed;
|
|
79932
|
-
const weightedPrev = prevWindowOutflow.abs().times(remainingTime).idiv(windowDuration).times(prevWindowOutflow.isNegative() ? -1 : 1);
|
|
79933
|
-
const totalNetOutflow = weightedPrev.plus(curWindowOutflow);
|
|
79934
|
-
return maxOutflow.minus(totalNetOutflow);
|
|
79935
|
-
}
|
|
79936
|
-
function computeRateLimiterRemainingCapacity(rateLimiter, nowSeconds) {
|
|
79937
|
-
if (!rateLimiter) return null;
|
|
79938
|
-
const hourly = computeRateLimitWindowRemainingCapacity(rateLimiter.hourly, nowSeconds);
|
|
79939
|
-
const daily = computeRateLimitWindowRemainingCapacity(rateLimiter.daily, nowSeconds);
|
|
79940
|
-
if (hourly === null) return daily;
|
|
79941
|
-
if (daily === null) return hourly;
|
|
79942
|
-
return BigNumber3.min(hourly, daily);
|
|
79943
|
-
}
|
|
79944
|
-
function computeBankRateLimitRemaining(bank, nowSeconds = Date.now() / 1e3) {
|
|
79945
|
-
const remaining = computeRateLimiterRemainingCapacity(bank.rateLimiter, nowSeconds);
|
|
79946
|
-
if (remaining === null) return null;
|
|
79947
|
-
return BigNumber3.max(0, nativeToUi(remaining, bank.mintDecimals));
|
|
79948
|
-
}
|
|
79949
|
-
function computeGroupRateLimitRemainingUsd(rateLimiter, nowSeconds = Date.now() / 1e3) {
|
|
79950
|
-
const remaining = computeRateLimiterRemainingCapacity(rateLimiter, nowSeconds);
|
|
79951
|
-
if (remaining === null) return null;
|
|
79952
|
-
return BigNumber3.max(0, remaining);
|
|
79953
|
-
}
|
|
79954
|
-
var VENUE_AVAILABLE_LIQUIDITY_BUFFER = 0.995;
|
|
79955
|
-
function computeVenueAvailableLiquidity(bank, venueStates) {
|
|
79956
|
-
const decimals = bank.mintDecimals;
|
|
79957
|
-
switch (bank.config.assetTag) {
|
|
79958
|
-
case 3 /* KAMINO */: {
|
|
79959
|
-
const reserveState = venueStates?.kaminoStates?.reserveState;
|
|
79960
|
-
if (!reserveState) return void 0;
|
|
79961
|
-
return new BigNumber3(
|
|
79962
|
-
nativeToUi(reserveState.liquidity.availableAmount.toString(), decimals)
|
|
79963
|
-
).times(VENUE_AVAILABLE_LIQUIDITY_BUFFER);
|
|
79964
|
-
}
|
|
79965
|
-
case 4 /* DRIFT */: {
|
|
79966
|
-
const spotMarketState = venueStates?.driftStates?.spotMarketState;
|
|
79967
|
-
if (!spotMarketState) return void 0;
|
|
79968
|
-
const deposits = getDriftTokenAmount(
|
|
79969
|
-
spotMarketState.depositBalance,
|
|
79970
|
-
spotMarketState,
|
|
79971
|
-
"deposit" /* DEPOSIT */
|
|
79972
|
-
);
|
|
79973
|
-
const borrows = getDriftTokenAmount(
|
|
79974
|
-
spotMarketState.borrowBalance,
|
|
79975
|
-
spotMarketState,
|
|
79976
|
-
"borrow" /* BORROW */
|
|
79977
|
-
);
|
|
79978
|
-
const idle = deposits.sub(borrows);
|
|
79979
|
-
return new BigNumber3(nativeToUi(idle.isNeg() ? "0" : idle.toString(), decimals)).times(
|
|
79980
|
-
VENUE_AVAILABLE_LIQUIDITY_BUFFER
|
|
79981
|
-
);
|
|
79982
|
-
}
|
|
79983
|
-
case 6 /* JUPLEND */: {
|
|
79984
|
-
const reserveState = venueStates?.jupLendStates?.jupTokenReserveState;
|
|
79985
|
-
if (!reserveState) return void 0;
|
|
79986
|
-
const supplyWithInterestNative = reserveState.totalSupplyWithInterest.mul(reserveState.supplyExchangePrice).div(JUP_EXCHANGE_PRICES_PRECISION);
|
|
79987
|
-
const borrowWithInterestNative = reserveState.totalBorrowWithInterest.mul(reserveState.borrowExchangePrice).div(JUP_EXCHANGE_PRICES_PRECISION);
|
|
79988
|
-
const totalSupply = supplyWithInterestNative.add(reserveState.totalSupplyInterestFree);
|
|
79989
|
-
const totalBorrow = borrowWithInterestNative.add(reserveState.totalBorrowInterestFree);
|
|
79990
|
-
const idle = totalSupply.sub(totalBorrow);
|
|
79991
|
-
return new BigNumber3(nativeToUi(idle.isNeg() ? "0" : idle.toString(), decimals)).times(
|
|
79992
|
-
VENUE_AVAILABLE_LIQUIDITY_BUFFER
|
|
79993
|
-
);
|
|
79994
|
-
}
|
|
79995
|
-
default:
|
|
79996
|
-
return void 0;
|
|
79997
|
-
}
|
|
79998
|
-
}
|
|
79999
79765
|
|
|
80000
79766
|
// src/services/bank/bank.service.ts
|
|
80001
79767
|
async function freezeBankConfigIx(program, bankAddress, bankConfigOpt) {
|
|
@@ -82820,9 +82586,7 @@ var MarginfiAccountWrapper = class {
|
|
|
82820
82586
|
assetShareValueMultiplierByBank: this.client.assetShareValueMultiplierByBank,
|
|
82821
82587
|
emodeImpactStatus: borrowImpact?.status,
|
|
82822
82588
|
activePair: borrowImpact?.activePair,
|
|
82823
|
-
volatilityFactor: opts?.volatilityFactor
|
|
82824
|
-
groupRateLimiter: this.client.group.rateLimiter,
|
|
82825
|
-
ignoreBankLimits: opts?.ignoreBankLimits
|
|
82589
|
+
volatilityFactor: opts?.volatilityFactor
|
|
82826
82590
|
});
|
|
82827
82591
|
}
|
|
82828
82592
|
/**
|
|
@@ -82840,26 +82604,7 @@ var MarginfiAccountWrapper = class {
|
|
|
82840
82604
|
bankAddress,
|
|
82841
82605
|
assetShareValueMultiplierByBank: this.client.assetShareValueMultiplierByBank,
|
|
82842
82606
|
activePair,
|
|
82843
|
-
volatilityFactor: opts?.volatilityFactor
|
|
82844
|
-
groupRateLimiter: this.client.group.rateLimiter,
|
|
82845
|
-
venueStates: this.client.bankIntegrationMap[bankAddress.toBase58()],
|
|
82846
|
-
ignoreBankLimits: opts?.ignoreBankLimits
|
|
82847
|
-
});
|
|
82848
|
-
}
|
|
82849
|
-
/**
|
|
82850
|
-
* Computes max deposit for a bank with auto-injected client data.
|
|
82851
|
-
*
|
|
82852
|
-
* Bounded by the bank's remaining deposit cap and, if provided, the wallet balance.
|
|
82853
|
-
*
|
|
82854
|
-
* @param bankAddress - Bank address to check max deposit for
|
|
82855
|
-
* @param opts - Optional wallet balance (UI units) to cap the result
|
|
82856
|
-
*/
|
|
82857
|
-
computeMaxDepositForBank(bankAddress, opts) {
|
|
82858
|
-
return this.account.computeMaxDepositForBank({
|
|
82859
|
-
banksMap: this.client.bankMap,
|
|
82860
|
-
bankAddress,
|
|
82861
|
-
assetShareValueMultiplierByBank: this.client.assetShareValueMultiplierByBank,
|
|
82862
|
-
walletBalance: opts?.walletBalance
|
|
82607
|
+
volatilityFactor: opts?.volatilityFactor
|
|
82863
82608
|
});
|
|
82864
82609
|
}
|
|
82865
82610
|
/**
|
|
@@ -83273,6 +83018,6 @@ var EmodeSettings = class _EmodeSettings {
|
|
|
83273
83018
|
}
|
|
83274
83019
|
};
|
|
83275
83020
|
|
|
83276
|
-
export { ADDRESS_LOOKUP_TABLE_FOR_GROUP, ADDRESS_LOOKUP_TABLE_FOR_GROUP_NATIVE_STAKE, ADDRESS_LOOKUP_TABLE_FOR_SWAP, AccountFlags, AccountType, AssetTag, BUNDLE_TX_SIZE, Balance, Bank, BankConfig, BankConfigFlag, BankVaultType, DEFAULT_BRIDGE_MINTS, DEFAULT_CROSSBAR_URL, DEFAULT_FALLBACK_CROSSBAR_URL, DEFAULT_ORACLE_MAX_AGE, DEFAULT_REPAY_ALL_EXTRA_BUFFER_BPS, DISABLED_FLAG, EMPTY_HEALTH_CACHE, EXECUTION_HEADROOM_SECONDS, 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, MARGINFI_V0_1_10_ACTIVATION, 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, SECONDS_PER_YEAR, SINGLE_POOL_PROGRAM_ID, STAKED_ORACLE_DISABLED_FLAG, STAKED_ORACLE_USES_ONRAMP_FLAG, STAKE_CONFIG_ID, STAKE_PROGRAM_ID, SWAP_ADAPTERS, 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, U64_MAX, USDC_DECIMALS, USDC_MINT, USDT_MINT, VENUE_AVAILABLE_LIQUIDITY_BUFFER, WSOL_MINT, ZERO_ORACLE_KEY, accountConflictsWithBridgeBank, accountFlagToBN, addOracleToBanksIx, addTransactionMetadata, adjustPriceComponent, aprToApy, apyToApr, balanceToDto, bankConfigRawToDto, bankConfigToBankConfigRaw, bankMetadataMapToDto, bankMetadataToDto, bankRateLimiterRawToDto, bankRawToDto, bigNumberToWrappedI80F48, bpsToPercentile, buildCollateralLegIxs, calculateApyFromInterest, calculateInterestFromApy, capConfidenceInterval, categorizePythBanks, checkBatchOracleCrankability, checkJupiterFeeAccount, checkMultipleOraclesCrankability, checkTitanFeeAccount, chunkedGetRawMultipleAccountInfoOrdered, chunkedGetRawMultipleAccountInfoOrderedWithNulls, chunkedGetRawMultipleAccountInfos, classifyAndValidate, compileFlashloanPrecheck, composeBridgedSwap, composeRemainingAccounts, computeAccountValue, computeAccrualProjectionSeconds, computeActiveEmodePairs, computeAssetHealthComponent, computeAssetUsdValue, computeBalanceUsdValue, computeBankAvailableLiquidity, computeBankBorrowApy, computeBankBorrowCapRemaining, computeBankDepositCapRemaining, computeBankMetrics, computeBankPoolSize, computeBankProjectedAvailableLiquidity, computeBankRateLimitRemaining, computeBankSupplyApy, computeBankTotalBorrows, computeBankTotalBorrowsUsd, computeBankTotalDeposits, computeBankTotalDepositsUsd, computeBaseInterestRate, computeBorrowEstimateForRepay, computeClaimedEmissions, computeClosePositionTokenAmount, computeEmodeImpacts, computeFlashLoanNonSwapBudget, computeFlashloanSwapConstraints, computeFreeCollateralFromBalances, computeFreeCollateralFromCache, computeGroupRateLimitRemainingUsd, computeHealthAccountMetas, computeHealthCacheStatus, computeHealthCheckAccounts, computeHealthComponentsFromBalances, computeHealthComponentsFromCache, computeInterestRates, computeLiabilityHealthComponent, computeLiabilityUsdValue, computeLiquidationPriceForBank, computeLoopingParams, computeLowestEmodeWeights, computeMaxBorrowForBank, computeMaxDepositForBank, computeMaxLeverage, computeMaxWithdrawForBank, computeNetApy, computeProjectedActiveBalancesNoCpi, computeProjectedActiveBanksNoCpi, computeQuantity, computeQuantityUi, computeRateLimitWindowRemainingCapacity, computeRateLimiterRemainingCapacity, computeRemainingCapacity, computeSmartCrank, computeStakedBankMultipliers, computeTotalOutstandingEmissions, computeTvl, computeUsdValue, computeUtilizationRate, computeV0TxSize, computeVenueAvailableLiquidity, convertVoteAccCoeffsToBankCoeffs, createActiveEmodePairFromPairs, createEmptyBalance, decodeAccountRaw, decodeBankRaw, decodeInstruction, decompileV0Transaction, deriveBankEmissionsAuth, deriveBankEmissionsVault, deriveBankFeeVault, deriveBankFeeVaultAuthority, deriveBankInsuranceVault, deriveBankInsuranceVaultAuthority, deriveBankLiquidityVault, deriveBankLiquidityVaultAuthority, deriveFeeState, deriveMarginfiAccount, deserializeInstruction, deserializeLut, deserializeSwapEngineRequest, deserializeSwapEngineResult, dtoToBalance, dtoToBank, dtoToBankConfig, dtoToBankConfigRaw, dtoToBankMetadata, dtoToBankMetadataMap, dtoToBankRateLimiter, dtoToBankRateLimiterRaw, dtoToBankRaw, dtoToEmodeSettings, dtoToEmodeSettingsRaw, dtoToGroup, dtoToHealthCache, dtoToInterestRateConfig, dtoToMarginfiAccount, dtoToOraclePrice, dtoToValidatorStakeGroup, emodeSettingsRawToDto, extractPythOracleKeys, fetchBank, fetchBankIntegrationMetadata, fetchGammaLpVault, fetchGammaWithdrawReceipt, fetchMarginfiAccountActiveBalancesForBank, fetchMarginfiAccountAddresses, fetchMarginfiAccountAddressesHoldingBank, 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, getEffectiveDepositLimit, getEmodePairs, getExactOutEstimate, getFallbackPricesByFeedId, getFallbackPricesForMints, getHealthCacheStatusDescription, getHealthSimulationTransactions, getJupLendFTokenMultiplier, getJupLendMetadata, getJupLendStatesDto, getJupiterReferralFeeAccount, getJupiterSwapIxsForFlashloan, getKaminoCTokenMultiplier, getKaminoMetadata, getKaminoStatesDto, getLiabilityQuantity, getLiabilityShares, getLiabilityWeight, getOracleSourceFromBank, getOracleSourceFromOracleSetup, getOracleSourceNameFromKey, getPrice, getPriceWithConfidence, getStakedBankMetadataMap, getSwapAdapter, getSwapIxsForFlashloan, getTitanExactOutEstimate, getTitanSwapIxsForFlashloan, getTotalAccountKeys, getTotalAssetQuantity, getTotalLiabilityQuantity, getTxSize, getValidatorVoteAccountByBank, getWritableAccountKeys, groupToDto, hasAccountFlag, hasEmodeEntryFlag, hasEmodeFlag, hasHealthCacheFlag, healthCacheToDto, isBorrowLimitActive, isBridgeConflictError, isDecomposableSwapError, isDepositIx, isDepositLimitActive, isFlashloan, isGroupRateLimiterEnabled, isMarginfiV0110Live, isStandardBorrowable, isStandardDepositable, isV0Tx, isWeightedPrice, isWholePosition, makeAccountTransferToNewAccountTx, makeAddPermissionlessStakedBankIx, makeBeginFlashLoanIx3 as makeBeginFlashLoanIx, makeBorrowIx3 as makeBorrowIx, makeBorrowTx, makeBridgedLoopTx, makeBridgedSwapCollateralTx, makeBridgedSwapDebtTx, makeBulkRepayTx, makeBulkWithdrawTx, makeBundleTipIx, 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, makeRefreshIntegrationBanksIxs, makeRefreshKaminoBanksIxs, makeRepayIx3 as makeRepayIx, makeRepayTx, makeRepayWithCollatTx, makeRollPtTx, makeSetupIx, makeSmartCrankSwbFeedIx, makeSmartCrankSwbFeedIxForAccounts, makeSwapCollateralTx, makeSwapDebtTx, makeTransferPositionsTx, makeTxPriorityIx, makeUnwrapSolIx, makeUpdateDriftMarketIxs, makeUpdateJupLendRateIxs, makeUpdateSwbFeedIx, makeVaultCompleteWithdrawalIx, makeVaultCompleteWithdrawalTx, makeVaultDepositIx, makeVaultDepositTx, makeVaultDepositWithSwapTx, makeVaultWithdrawIx, makeVaultWithdrawTx, makeVersionedTransaction, makeWithdrawIx3 as makeWithdrawIx, makeWithdrawTx, makeWrapSolIxs, mapBrokenFeedsToOraclePrices, mapJupiterQuoteToSwapQuoteResult, mapPythBanksToOraclePrices, mapSwbBanksToOraclePrices, marginfiAccountToDto, mergeBridgeQuotes, mergeBridgeQuotesDebt, mergeBridgeQuotesLoop, nativeToUi, oraclePriceToDto, parseBalanceRaw, parseBankConfigRaw, parseBankRateLimiterRaw, parseBankRaw, parseEmodeSettingsRaw, parseEmodeTag, parseHealthCacheRaw, parseMarginfiAccountRaw, parseOperationalState, parseOracleSetup, parseOraclePriceData as parsePriceInfo, parseRiskTier, parseRpcPythPriceData, parseSwbOraclePriceData, partitionBanksByCrankability, patchDepositAmount, requireBank, requireTokenProgram, resolveAmount, resolveBridgeCandidateBanks, resolvePinnedSwapRoute, resolveTokenProgramForMint, resolveVaultTokenProgram, runSwapEngine, selectLutsForAccountAction, selectLutsForBanks, selectSwapBridges, serializeBankConfigOpt, serializeInstruction, serializeInterestRateConfig, serializeLut, serializeOperationalState, serializeOracleSetup, serializeOracleSetupToIndex, serializeRiskTier, serializeSwapEngineRequest, serializeSwapEngineResult, sharedBridgeLegContext, shortenAddress, simulateAccountHealthCache, simulateAccountHealthCacheWithFallback, simulateBundle, splitInstructionsToFitTransactions, swapEngineProvidersFromOpts, swapEngineQuoteFieldsFromOpts, toBankConfigDto, toBankDto, toBankRateLimiterDto, toBigNumber, toEmodeSettingsDto, toInterestRateConfigDto, toJupiterConfig, toNumber, tryBridgeCandidates, uiToNative, uiToNativeBigNumber, validatorStakeGroupToDto, wrappedI80F48toBigNumber };
|
|
83021
|
+
export { ADDRESS_LOOKUP_TABLE_FOR_GROUP, ADDRESS_LOOKUP_TABLE_FOR_GROUP_NATIVE_STAKE, ADDRESS_LOOKUP_TABLE_FOR_SWAP, AccountFlags, AccountType, AssetTag, BUNDLE_TX_SIZE, Balance, Bank, BankConfig, BankConfigFlag, BankVaultType, DEFAULT_BRIDGE_MINTS, DEFAULT_CROSSBAR_URL, DEFAULT_FALLBACK_CROSSBAR_URL, DEFAULT_ORACLE_MAX_AGE, DEFAULT_REPAY_ALL_EXTRA_BUFFER_BPS, 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, MARGINFI_V0_1_10_ACTIVATION, 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, STAKED_ORACLE_DISABLED_FLAG, STAKED_ORACLE_USES_ONRAMP_FLAG, STAKE_CONFIG_ID, STAKE_PROGRAM_ID, SWAP_ADAPTERS, 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, USDT_MINT, WSOL_MINT, ZERO_ORACLE_KEY, accountConflictsWithBridgeBank, accountFlagToBN, addOracleToBanksIx, addTransactionMetadata, adjustPriceComponent, aprToApy, apyToApr, balanceToDto, bankConfigRawToDto, bankConfigToBankConfigRaw, bankMetadataMapToDto, bankMetadataToDto, bankRateLimiterRawToDto, bankRawToDto, bigNumberToWrappedI80F48, bpsToPercentile, buildCollateralLegIxs, calculateApyFromInterest, calculateInterestFromApy, capConfidenceInterval, categorizePythBanks, checkBatchOracleCrankability, checkJupiterFeeAccount, checkMultipleOraclesCrankability, checkTitanFeeAccount, chunkedGetRawMultipleAccountInfoOrdered, chunkedGetRawMultipleAccountInfoOrderedWithNulls, chunkedGetRawMultipleAccountInfos, classifyAndValidate, compileFlashloanPrecheck, composeBridgedSwap, composeRemainingAccounts, computeAccountValue, computeActiveEmodePairs, computeAssetHealthComponent, computeAssetUsdValue, computeBalanceUsdValue, computeBankBorrowApy, computeBankBorrowCapRemaining, computeBankDepositCapRemaining, computeBankMetrics, computeBankPoolSize, computeBankSupplyApy, computeBankTotalBorrows, computeBankTotalBorrowsUsd, computeBankTotalDeposits, computeBankTotalDepositsUsd, computeBaseInterestRate, computeBorrowEstimateForRepay, 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, deserializeInstruction, deserializeLut, deserializeSwapEngineRequest, deserializeSwapEngineResult, dtoToBalance, dtoToBank, dtoToBankConfig, dtoToBankConfigRaw, dtoToBankMetadata, dtoToBankMetadataMap, dtoToBankRateLimiter, dtoToBankRateLimiterRaw, dtoToBankRaw, dtoToEmodeSettings, dtoToEmodeSettingsRaw, dtoToGroup, dtoToHealthCache, dtoToInterestRateConfig, dtoToMarginfiAccount, dtoToOraclePrice, dtoToValidatorStakeGroup, emodeSettingsRawToDto, extractPythOracleKeys, fetchBank, fetchBankIntegrationMetadata, fetchGammaLpVault, fetchGammaWithdrawReceipt, fetchMarginfiAccountActiveBalancesForBank, fetchMarginfiAccountAddresses, fetchMarginfiAccountAddressesHoldingBank, 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, getFallbackPricesByFeedId, getFallbackPricesForMints, getHealthCacheStatusDescription, getHealthSimulationTransactions, getJupLendFTokenMultiplier, getJupLendMetadata, getJupLendStatesDto, getJupiterReferralFeeAccount, getJupiterSwapIxsForFlashloan, getKaminoCTokenMultiplier, getKaminoMetadata, getKaminoStatesDto, getLiabilityQuantity, getLiabilityShares, getLiabilityWeight, getOracleSourceFromBank, getOracleSourceFromOracleSetup, getOracleSourceNameFromKey, getPrice, getPriceWithConfidence, getStakedBankMetadataMap, getSwapAdapter, getSwapIxsForFlashloan, getTitanExactOutEstimate, getTitanSwapIxsForFlashloan, getTotalAccountKeys, getTotalAssetQuantity, getTotalLiabilityQuantity, getTxSize, getValidatorVoteAccountByBank, getWritableAccountKeys, groupToDto, hasAccountFlag, hasEmodeEntryFlag, hasEmodeFlag, hasHealthCacheFlag, healthCacheToDto, isBridgeConflictError, isDecomposableSwapError, isDepositIx, isFlashloan, isGroupRateLimiterEnabled, isMarginfiV0110Live, isStandardBorrowable, isStandardDepositable, isV0Tx, isWeightedPrice, isWholePosition, makeAccountTransferToNewAccountTx, makeAddPermissionlessStakedBankIx, makeBeginFlashLoanIx3 as makeBeginFlashLoanIx, makeBorrowIx3 as makeBorrowIx, makeBorrowTx, makeBridgedLoopTx, makeBridgedSwapCollateralTx, makeBridgedSwapDebtTx, makeBulkRepayTx, makeBulkWithdrawTx, makeBundleTipIx, 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, makeRefreshIntegrationBanksIxs, makeRefreshKaminoBanksIxs, makeRepayIx3 as makeRepayIx, makeRepayTx, makeRepayWithCollatTx, makeRollPtTx, makeSetupIx, makeSmartCrankSwbFeedIx, makeSmartCrankSwbFeedIxForAccounts, makeSwapCollateralTx, makeSwapDebtTx, makeTransferPositionsTx, makeTxPriorityIx, makeUnwrapSolIx, makeUpdateDriftMarketIxs, makeUpdateJupLendRateIxs, makeUpdateSwbFeedIx, makeVaultCompleteWithdrawalIx, makeVaultCompleteWithdrawalTx, makeVaultDepositIx, makeVaultDepositTx, makeVaultDepositWithSwapTx, makeVaultWithdrawIx, makeVaultWithdrawTx, makeVersionedTransaction, makeWithdrawIx3 as makeWithdrawIx, makeWithdrawTx, makeWrapSolIxs, mapBrokenFeedsToOraclePrices, mapJupiterQuoteToSwapQuoteResult, mapPythBanksToOraclePrices, mapSwbBanksToOraclePrices, marginfiAccountToDto, mergeBridgeQuotes, mergeBridgeQuotesDebt, mergeBridgeQuotesLoop, nativeToUi, oraclePriceToDto, parseBalanceRaw, parseBankConfigRaw, parseBankRateLimiterRaw, parseBankRaw, parseEmodeSettingsRaw, parseEmodeTag, parseHealthCacheRaw, parseMarginfiAccountRaw, parseOperationalState, parseOracleSetup, parseOraclePriceData as parsePriceInfo, parseRiskTier, parseRpcPythPriceData, parseSwbOraclePriceData, partitionBanksByCrankability, patchDepositAmount, requireBank, requireTokenProgram, resolveAmount, resolveBridgeCandidateBanks, resolvePinnedSwapRoute, resolveTokenProgramForMint, resolveVaultTokenProgram, runSwapEngine, selectLutsForAccountAction, selectLutsForBanks, selectSwapBridges, serializeBankConfigOpt, serializeInstruction, serializeInterestRateConfig, serializeLut, serializeOperationalState, serializeOracleSetup, serializeOracleSetupToIndex, serializeRiskTier, serializeSwapEngineRequest, serializeSwapEngineResult, sharedBridgeLegContext, shortenAddress, simulateAccountHealthCache, simulateAccountHealthCacheWithFallback, simulateBundle, splitInstructionsToFitTransactions, swapEngineProvidersFromOpts, swapEngineQuoteFieldsFromOpts, toBankConfigDto, toBankDto, toBankRateLimiterDto, toBigNumber, toEmodeSettingsDto, toInterestRateConfigDto, toJupiterConfig, toNumber, tryBridgeCandidates, uiToNative, uiToNativeBigNumber, validatorStakeGroupToDto, wrappedI80F48toBigNumber };
|
|
83277
83022
|
//# sourceMappingURL=index.js.map
|
|
83278
83023
|
//# sourceMappingURL=index.js.map
|