@0dotxyz/p0-ts-sdk 2.7.0 → 2.7.1-alpha.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 +9 -2
- package/dist/index.cjs +301 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +226 -6
- package/dist/index.d.ts +226 -6
- package/dist/index.js +286 -28
- package/dist/index.js.map +1 -1
- package/dist/instructions.d.cts +1 -1
- package/dist/instructions.d.ts +1 -1
- package/dist/{types-Ctm1kvCr.d.ts → types-B5SGXpex.d.ts} +1 -1
- package/dist/{types-DzbVhEfo.d.cts → types-BFLi0Ozl.d.cts} +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -27718,6 +27718,11 @@ 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
|
+
|
|
27721
27726
|
// src/vendor/drift/idl/drift.json
|
|
27722
27727
|
var drift_default = {
|
|
27723
27728
|
address: "dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH",
|
|
@@ -42083,6 +42088,34 @@ function deriveDriftSpotMarketVault(marketIndex, programId = DRIFT_PROGRAM_ID) {
|
|
|
42083
42088
|
programId
|
|
42084
42089
|
);
|
|
42085
42090
|
}
|
|
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
|
+
}
|
|
42086
42119
|
|
|
42087
42120
|
// src/vendor/drift/utils/rewards.utils.ts
|
|
42088
42121
|
async function getDriftRewards(spotMarkets, userStates, connection) {
|
|
@@ -73857,6 +73890,20 @@ var MarginfiAccount = class _MarginfiAccount {
|
|
|
73857
73890
|
...params
|
|
73858
73891
|
});
|
|
73859
73892
|
}
|
|
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
|
+
}
|
|
73860
73907
|
/**
|
|
73861
73908
|
* Gets the banks required for health check calculations.
|
|
73862
73909
|
*
|
|
@@ -77716,7 +77763,9 @@ function computeMaxBorrowForBank(params) {
|
|
|
77716
77763
|
assetShareValueMultiplierByBank,
|
|
77717
77764
|
emodeImpactStatus,
|
|
77718
77765
|
volatilityFactor,
|
|
77719
|
-
activePair
|
|
77766
|
+
activePair,
|
|
77767
|
+
groupRateLimiter,
|
|
77768
|
+
ignoreBankLimits
|
|
77720
77769
|
} = params;
|
|
77721
77770
|
const bank = banksMap.get(bankAddress.toBase58());
|
|
77722
77771
|
if (!bank) throw Error(`Bank ${bankAddress.toBase58()} not found`);
|
|
@@ -77776,15 +77825,67 @@ function computeMaxBorrowForBank(params) {
|
|
|
77776
77825
|
assetShareValueMultiplier
|
|
77777
77826
|
});
|
|
77778
77827
|
const liabWeight = getLiabilityWeight(bank.config, 0 /* Initial */);
|
|
77779
|
-
|
|
77780
|
-
|
|
77781
|
-
|
|
77782
|
-
|
|
77783
|
-
|
|
77784
|
-
|
|
77828
|
+
const originationFeeFactor = new BigNumber3(1).plus(
|
|
77829
|
+
bank.config.interestRateConfig.protocolOriginationFee
|
|
77830
|
+
);
|
|
77831
|
+
const liabPriceWeighted = priceHighestBias.times(liabWeight).times(originationFeeFactor);
|
|
77832
|
+
const healthMaxBorrow = assetWeight.eq(0) ? computeQuantityUi(balance, bank, assetShareValueMultiplier).assets.plus(
|
|
77833
|
+
freeCollateral.minus(untiedCollateralForBank).div(liabPriceWeighted)
|
|
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));
|
|
77785
77858
|
}
|
|
77859
|
+
return remaining;
|
|
77786
77860
|
}
|
|
77787
77861
|
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) {
|
|
77788
77889
|
const {
|
|
77789
77890
|
account,
|
|
77790
77891
|
banksMap,
|
|
@@ -77880,6 +77981,17 @@ function computeMaxWithdrawForBank(params) {
|
|
|
77880
77981
|
const maxWithdraw = initUntiedCollateralForBank.div(initWeightedPrice);
|
|
77881
77982
|
return maxWithdraw;
|
|
77882
77983
|
}
|
|
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
|
+
}
|
|
77883
77995
|
|
|
77884
77996
|
// src/services/account/utils/misc.utils.ts
|
|
77885
77997
|
function floor(value, decimals) {
|
|
@@ -79552,6 +79664,21 @@ var fetchMultipleBanks = async (program, opts) => {
|
|
|
79552
79664
|
}
|
|
79553
79665
|
return bankDatas;
|
|
79554
79666
|
};
|
|
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
|
+
}
|
|
79555
79682
|
function computeInterestRates(bank) {
|
|
79556
79683
|
const { insuranceFeeFixedApr, insuranceIrFee, protocolFixedFeeApr, protocolIrFee } = bank.config.interestRateConfig;
|
|
79557
79684
|
const fixedFee = insuranceFeeFixedApr.plus(protocolFixedFeeApr);
|
|
@@ -79646,25 +79773,34 @@ function computeUtilizationRate(bank) {
|
|
|
79646
79773
|
return liabilities.div(assets);
|
|
79647
79774
|
}
|
|
79648
79775
|
var SECONDS_PER_DAY = 24 * 60 * 60;
|
|
79649
|
-
var SECONDS_PER_YEAR = SECONDS_PER_DAY * 365
|
|
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
|
+
}
|
|
79650
79782
|
function computeRemainingCapacity(bank) {
|
|
79651
79783
|
const totalDeposits = getTotalAssetQuantity(bank);
|
|
79652
|
-
const remainingCapacity = BigNumber3.max(
|
|
79784
|
+
const remainingCapacity = isDepositLimitActive(bank) ? BigNumber3.max(
|
|
79785
|
+
0,
|
|
79786
|
+
getEffectiveDepositLimit(bank).minus(totalDeposits).minus(1).integerValue(BigNumber3.ROUND_FLOOR)
|
|
79787
|
+
) : U64_MAX;
|
|
79653
79788
|
const totalBorrows = getTotalLiabilityQuantity(bank);
|
|
79654
|
-
const remainingBorrowCapacity = BigNumber3.max(
|
|
79655
|
-
|
|
79789
|
+
const remainingBorrowCapacity = isBorrowLimitActive(bank) ? BigNumber3.max(
|
|
79790
|
+
0,
|
|
79791
|
+
bank.config.borrowLimit.minus(totalBorrows).minus(1).integerValue(BigNumber3.ROUND_FLOOR)
|
|
79792
|
+
) : U64_MAX;
|
|
79793
|
+
const projectionSeconds = computeAccrualProjectionSeconds(bank);
|
|
79656
79794
|
const { lendingRate, borrowingRate } = computeInterestRates(bank);
|
|
79657
|
-
const
|
|
79658
|
-
const
|
|
79659
|
-
const depositCapacity = remainingCapacity.minus(
|
|
79660
|
-
const borrowCapacity = remainingBorrowCapacity.minus(
|
|
79795
|
+
const projectedLendingInterest = lendingRate.times(projectionSeconds).dividedBy(SECONDS_PER_YEAR).times(totalDeposits);
|
|
79796
|
+
const projectedBorrowInterest = borrowingRate.times(projectionSeconds).dividedBy(SECONDS_PER_YEAR).times(totalBorrows);
|
|
79797
|
+
const depositCapacity = remainingCapacity.minus(projectedLendingInterest);
|
|
79798
|
+
const borrowCapacity = remainingBorrowCapacity.minus(projectedBorrowInterest);
|
|
79661
79799
|
return {
|
|
79662
79800
|
depositCapacity,
|
|
79663
79801
|
borrowCapacity
|
|
79664
79802
|
};
|
|
79665
79803
|
}
|
|
79666
|
-
|
|
79667
|
-
// src/services/bank/utils/bank-metrics.utils.ts
|
|
79668
79804
|
function isStandardBorrowable(bank) {
|
|
79669
79805
|
const { assetTag, operationalState, borrowLimit } = bank.config;
|
|
79670
79806
|
return (assetTag === 0 /* DEFAULT */ || assetTag === 1 /* SOL */) && operationalState === "Operational" /* Operational */ && borrowLimit.gt(0);
|
|
@@ -79674,9 +79810,7 @@ function isStandardDepositable(bank) {
|
|
|
79674
79810
|
return (assetTag === 0 /* DEFAULT */ || assetTag === 1 /* SOL */) && operationalState === "Operational" /* Operational */;
|
|
79675
79811
|
}
|
|
79676
79812
|
function computeBankTotalDeposits(bank, assetShareValueMultiplier) {
|
|
79677
|
-
const totalAssets = getTotalAssetQuantity(bank).times(
|
|
79678
|
-
assetShareValueMultiplier ?? 1
|
|
79679
|
-
);
|
|
79813
|
+
const totalAssets = getTotalAssetQuantity(bank).times(assetShareValueMultiplier ?? 1);
|
|
79680
79814
|
return nativeToUi(totalAssets, bank.mintDecimals);
|
|
79681
79815
|
}
|
|
79682
79816
|
function computeBankTotalBorrows(bank) {
|
|
@@ -79707,14 +79841,35 @@ function computeBankPoolSize(bank, assetShareValueMultiplier) {
|
|
|
79707
79841
|
const borrowCap = nativeToUi(bank.config.borrowLimit, bank.mintDecimals);
|
|
79708
79842
|
return Math.max(0, Math.min(totalDeposits, borrowCap) - totalBorrows);
|
|
79709
79843
|
}
|
|
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
|
+
}
|
|
79710
79849
|
function computeBankDepositCapRemaining(bank) {
|
|
79850
|
+
if (!isDepositLimitActive(bank)) return Infinity;
|
|
79711
79851
|
const { depositCapacity } = computeRemainingCapacity(bank);
|
|
79712
79852
|
return Math.max(0, nativeToUi(depositCapacity, bank.mintDecimals));
|
|
79713
79853
|
}
|
|
79714
79854
|
function computeBankBorrowCapRemaining(bank) {
|
|
79855
|
+
if (!isBorrowLimitActive(bank)) return Infinity;
|
|
79715
79856
|
const { borrowCapacity } = computeRemainingCapacity(bank);
|
|
79716
79857
|
return Math.max(0, nativeToUi(borrowCapacity, bank.mintDecimals));
|
|
79717
79858
|
}
|
|
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
|
+
}
|
|
79718
79873
|
function computeBankSupplyApy(bank) {
|
|
79719
79874
|
return aprToApy(computeInterestRates(bank).lendingRate.toNumber());
|
|
79720
79875
|
}
|
|
@@ -79727,11 +79882,7 @@ function computeBankMetrics(params) {
|
|
|
79727
79882
|
symbol,
|
|
79728
79883
|
totalDeposits: computeBankTotalDeposits(bank, assetShareValueMultiplier),
|
|
79729
79884
|
totalBorrows: computeBankTotalBorrows(bank),
|
|
79730
|
-
totalDepositsUsd: computeBankTotalDepositsUsd(
|
|
79731
|
-
bank,
|
|
79732
|
-
oraclePrice,
|
|
79733
|
-
assetShareValueMultiplier
|
|
79734
|
-
),
|
|
79885
|
+
totalDepositsUsd: computeBankTotalDepositsUsd(bank, oraclePrice, assetShareValueMultiplier),
|
|
79735
79886
|
totalBorrowsUsd: computeBankTotalBorrowsUsd(bank, oraclePrice),
|
|
79736
79887
|
utilizationRate: computeUtilizationRate(bank).toNumber(),
|
|
79737
79888
|
poolSize: computeBankPoolSize(bank, assetShareValueMultiplier),
|
|
@@ -79759,6 +79910,92 @@ function requireTokenProgram(tokenProgramsByBank, address, makeError = (message)
|
|
|
79759
79910
|
}
|
|
79760
79911
|
return tokenProgram;
|
|
79761
79912
|
}
|
|
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
|
+
}
|
|
79762
79999
|
|
|
79763
80000
|
// src/services/bank/bank.service.ts
|
|
79764
80001
|
async function freezeBankConfigIx(program, bankAddress, bankConfigOpt) {
|
|
@@ -82583,7 +82820,9 @@ var MarginfiAccountWrapper = class {
|
|
|
82583
82820
|
assetShareValueMultiplierByBank: this.client.assetShareValueMultiplierByBank,
|
|
82584
82821
|
emodeImpactStatus: borrowImpact?.status,
|
|
82585
82822
|
activePair: borrowImpact?.activePair,
|
|
82586
|
-
volatilityFactor: opts?.volatilityFactor
|
|
82823
|
+
volatilityFactor: opts?.volatilityFactor,
|
|
82824
|
+
groupRateLimiter: this.client.group.rateLimiter,
|
|
82825
|
+
ignoreBankLimits: opts?.ignoreBankLimits
|
|
82587
82826
|
});
|
|
82588
82827
|
}
|
|
82589
82828
|
/**
|
|
@@ -82601,7 +82840,26 @@ var MarginfiAccountWrapper = class {
|
|
|
82601
82840
|
bankAddress,
|
|
82602
82841
|
assetShareValueMultiplierByBank: this.client.assetShareValueMultiplierByBank,
|
|
82603
82842
|
activePair,
|
|
82604
|
-
volatilityFactor: opts?.volatilityFactor
|
|
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
|
|
82605
82863
|
});
|
|
82606
82864
|
}
|
|
82607
82865
|
/**
|
|
@@ -83015,6 +83273,6 @@ var EmodeSettings = class _EmodeSettings {
|
|
|
83015
83273
|
}
|
|
83016
83274
|
};
|
|
83017
83275
|
|
|
83018
|
-
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 };
|
|
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 };
|
|
83019
83277
|
//# sourceMappingURL=index.js.map
|
|
83020
83278
|
//# sourceMappingURL=index.js.map
|