@0dotxyz/p0-ts-sdk 2.10.1-alpha.0 → 2.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +114 -106
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -15
- package/dist/index.d.ts +28 -15
- package/dist/index.js +114 -106
- package/dist/index.js.map +1 -1
- package/dist/instructions.d.cts +1 -1
- package/dist/instructions.d.ts +1 -1
- package/dist/{types-DQD0k0pr.d.cts → types-BOPERR6x.d.cts} +12 -1
- package/dist/{types--m9sTr2x.d.ts → types-D2GhlUZp.d.ts} +12 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -76854,18 +76854,12 @@ function computeHealthComponentsFromBalances(params) {
|
|
|
76854
76854
|
let totalLiabilities = new BigNumber3__default.default(0);
|
|
76855
76855
|
for (const accountBalance of filteredBalances) {
|
|
76856
76856
|
const bankKey = accountBalance.bankPk.toBase58();
|
|
76857
|
-
const bank = banksMap.
|
|
76858
|
-
if (!bank) {
|
|
76859
|
-
console.warn(
|
|
76860
|
-
`Bank ${shortenAddress(accountBalance.bankPk)} not found, excluding from health computation`
|
|
76861
|
-
);
|
|
76862
|
-
continue;
|
|
76863
|
-
}
|
|
76857
|
+
const bank = requireBank(banksMap, accountBalance.bankPk);
|
|
76864
76858
|
const oraclePrice = oraclePricesByBank.get(bankKey);
|
|
76865
76859
|
if (!oraclePrice) {
|
|
76866
|
-
|
|
76867
|
-
`
|
|
76868
|
-
|
|
76860
|
+
if (accountBalance.liabilityShares.gt(0)) {
|
|
76861
|
+
throw Error(`Oracle price for ${bankKey} not found`);
|
|
76862
|
+
}
|
|
76869
76863
|
continue;
|
|
76870
76864
|
}
|
|
76871
76865
|
const emodeWeight = activeEmodeWeightsByBank?.get(bankKey);
|
|
@@ -77074,7 +77068,7 @@ function computeLiquidationPriceForBank(params) {
|
|
|
77074
77068
|
const { bank, oraclePrice, marginfiAccount, assetShareValueMultiplier, activeEmodeWeights } = params;
|
|
77075
77069
|
const balance = getBalance(bank.address, marginfiAccount.balances);
|
|
77076
77070
|
if (!balance.active) return null;
|
|
77077
|
-
const { assets: assetBank, liabilities: liabilitiesBank } =
|
|
77071
|
+
const { assets: assetBank, liabilities: liabilitiesBank } = getBalanceUsdValueWithPriceBias({
|
|
77078
77072
|
balance,
|
|
77079
77073
|
bank,
|
|
77080
77074
|
oraclePrice,
|
|
@@ -77088,7 +77082,8 @@ function computeLiquidationPriceForBank(params) {
|
|
|
77088
77082
|
const isLending = balance.liabilityShares.isZero();
|
|
77089
77083
|
const { assets: assetQuantityUi, liabilities: liabQuantitiesUi } = computeQuantityUi(
|
|
77090
77084
|
balance,
|
|
77091
|
-
bank
|
|
77085
|
+
bank,
|
|
77086
|
+
assetShareValueMultiplier
|
|
77092
77087
|
);
|
|
77093
77088
|
let liquidationPrice;
|
|
77094
77089
|
if (isLending) {
|
|
@@ -77194,6 +77189,8 @@ function computeBankRiskAccountKeys(bank) {
|
|
|
77194
77189
|
} else if (bank.stakedOracleUsesOnramp && bank.stakedIntegrationAccounts && !bank.stakedIntegrationAccounts.validatorVoteAccount.equals(web3_js.PublicKey.default)) {
|
|
77195
77190
|
const pool = findPoolAddress(bank.stakedIntegrationAccounts.validatorVoteAccount);
|
|
77196
77191
|
keys.push(findPoolOnRampAddress(pool));
|
|
77192
|
+
} else {
|
|
77193
|
+
keys.push(web3_js.PublicKey.default);
|
|
77197
77194
|
}
|
|
77198
77195
|
}
|
|
77199
77196
|
return keys;
|
|
@@ -78232,7 +78229,6 @@ function createJupiterClient(config = {}) {
|
|
|
78232
78229
|
// src/services/account/utils/swap.utils.ts
|
|
78233
78230
|
function resolvePinnedSwapRoute(swapIxs, expectedInAmountNative) {
|
|
78234
78231
|
const { quoteResponse } = swapIxs;
|
|
78235
|
-
const expectedIn = new BN8__default.default(expectedInAmountNative);
|
|
78236
78232
|
let minOut;
|
|
78237
78233
|
try {
|
|
78238
78234
|
minOut = new BN8__default.default(quoteResponse.otherAmountThreshold);
|
|
@@ -78245,15 +78241,15 @@ function resolvePinnedSwapRoute(swapIxs, expectedInAmountNative) {
|
|
|
78245
78241
|
);
|
|
78246
78242
|
}
|
|
78247
78243
|
const pinnedIn = new BN8__default.default(quoteResponse.inAmount);
|
|
78248
|
-
if (!pinnedIn.eq(
|
|
78244
|
+
if (expectedInAmountNative !== void 0 && !pinnedIn.eq(new BN8__default.default(expectedInAmountNative))) {
|
|
78249
78245
|
throw new Error(
|
|
78250
|
-
`Pinned swap route (swapOpts.swapIxs) was quoted for a different input amount than the flow will swap: quote inAmount=${pinnedIn.toString()}, flow swap input=${
|
|
78246
|
+
`Pinned swap route (swapOpts.swapIxs) was quoted for a different input amount than the flow will swap: quote inAmount=${pinnedIn.toString()}, flow swap input=${expectedInAmountNative.toString()} (native units). Re-quote the pinned route for the exact flow amount.`
|
|
78251
78247
|
);
|
|
78252
78248
|
}
|
|
78253
78249
|
return {
|
|
78254
78250
|
swapInstructions: swapIxs.instructions,
|
|
78255
78251
|
setupInstructions: [],
|
|
78256
|
-
|
|
78252
|
+
swapLuts: swapIxs.lookupTables,
|
|
78257
78253
|
quoteResponse,
|
|
78258
78254
|
outputAmountNative: minOut
|
|
78259
78255
|
};
|
|
@@ -78367,7 +78363,7 @@ var getSwapIxsForFlashloan = async (params) => {
|
|
|
78367
78363
|
return {
|
|
78368
78364
|
swapInstructions: pinned.swapInstructions,
|
|
78369
78365
|
setupInstructions: pinned.setupInstructions,
|
|
78370
|
-
addressLookupTableAddresses: pinned.
|
|
78366
|
+
addressLookupTableAddresses: pinned.swapLuts,
|
|
78371
78367
|
quoteResponse: pinned.quoteResponse
|
|
78372
78368
|
};
|
|
78373
78369
|
}
|
|
@@ -78565,17 +78561,8 @@ var getJupiterSwapIxsForFlashloan = async ({
|
|
|
78565
78561
|
quoteResponse: mapJupiterQuoteToSwapQuoteResult(swapQuote)
|
|
78566
78562
|
};
|
|
78567
78563
|
};
|
|
78568
|
-
|
|
78569
|
-
// src/services/account/utils/misc.utils.ts
|
|
78570
|
-
function floor(value, decimals) {
|
|
78571
|
-
return Math.floor(value * 10 ** decimals) / 10 ** decimals;
|
|
78572
|
-
}
|
|
78573
|
-
function ceil(value, decimals) {
|
|
78574
|
-
return Math.ceil(value * 10 ** decimals) / 10 ** decimals;
|
|
78575
|
-
}
|
|
78576
78564
|
function computeClosePositionTokenAmount(position, mintDecimals) {
|
|
78577
|
-
|
|
78578
|
-
return closePositionTokenAmount;
|
|
78565
|
+
return new BigNumber3.BigNumber(position.amount).decimalPlaces(mintDecimals, position.isLending ? BigNumber3.BigNumber.ROUND_FLOOR : BigNumber3.BigNumber.ROUND_CEIL).toNumber();
|
|
78579
78566
|
}
|
|
78580
78567
|
function isWholePosition(position, amount, mintDecimals) {
|
|
78581
78568
|
const closePositionTokenAmount = computeClosePositionTokenAmount(position, mintDecimals);
|
|
@@ -83987,7 +83974,7 @@ async function buildSwapDebtFlashloanTx({
|
|
|
83987
83974
|
opts: { wrapAndUnwrapSol: false, overrideInferAccounts }
|
|
83988
83975
|
});
|
|
83989
83976
|
const runEngine = swapEngineRunner ?? runSwapEngine;
|
|
83990
|
-
const engineResult = await runEngine({
|
|
83977
|
+
const engineResult = swapOpts.swapIxs ? resolvePinnedSwapRoute(swapOpts.swapIxs) : await runEngine({
|
|
83991
83978
|
inputMint: borrowBank.mint.toBase58(),
|
|
83992
83979
|
outputMint: repayBank.mint.toBase58(),
|
|
83993
83980
|
amountNative: uiToNative(estimatedBorrowAmount, borrowBank.mintDecimals).toNumber(),
|
|
@@ -84013,7 +84000,8 @@ async function buildSwapDebtFlashloanTx({
|
|
|
84013
84000
|
const quoteResponse = engineResult.quoteResponse;
|
|
84014
84001
|
const outAmount = nativeToUi(quoteResponse.outAmount, repayBank.mintDecimals);
|
|
84015
84002
|
const outAmountThreshold = nativeToUi(quoteResponse.otherAmountThreshold, repayBank.mintDecimals);
|
|
84016
|
-
const
|
|
84003
|
+
const repayAll = outAmount > totalPositionAmount;
|
|
84004
|
+
const amountToRepay = repayAll ? totalPositionAmount : outAmountThreshold;
|
|
84017
84005
|
const borrowAmount = nativeToUi(quoteResponse.inAmount, borrowBank.mintDecimals);
|
|
84018
84006
|
const borrowIxs = await makeBorrowIx3({
|
|
84019
84007
|
program,
|
|
@@ -84037,14 +84025,7 @@ async function buildSwapDebtFlashloanTx({
|
|
|
84037
84025
|
amount: amountToRepay,
|
|
84038
84026
|
accountAddress: marginfiAccount.address,
|
|
84039
84027
|
authority: marginfiAccount.authority,
|
|
84040
|
-
repayAll
|
|
84041
|
-
{
|
|
84042
|
-
amount: totalPositionAmount,
|
|
84043
|
-
isLending: false
|
|
84044
|
-
},
|
|
84045
|
-
amountToRepay,
|
|
84046
|
-
repayBank.mintDecimals
|
|
84047
|
-
),
|
|
84028
|
+
repayAll,
|
|
84048
84029
|
isSync: true,
|
|
84049
84030
|
opts: {
|
|
84050
84031
|
wrapAndUnwrapSol: false,
|
|
@@ -84503,16 +84484,7 @@ async function buildDepositIxs(params, amountUi) {
|
|
|
84503
84484
|
}
|
|
84504
84485
|
async function runLoopSwapEngine(descriptor, params) {
|
|
84505
84486
|
const { connection, swapOpts, marginfiAccount, swapEngineRunner } = params;
|
|
84506
|
-
if (swapOpts.swapIxs)
|
|
84507
|
-
const pinned = resolvePinnedSwapRoute(swapOpts.swapIxs, descriptor.inAmountNative);
|
|
84508
|
-
return {
|
|
84509
|
-
swapInstructions: pinned.swapInstructions,
|
|
84510
|
-
setupInstructions: pinned.setupInstructions,
|
|
84511
|
-
swapLuts: pinned.lookupTables,
|
|
84512
|
-
quoteResponse: pinned.quoteResponse,
|
|
84513
|
-
outputAmountNative: pinned.outputAmountNative
|
|
84514
|
-
};
|
|
84515
|
-
}
|
|
84487
|
+
if (swapOpts.swapIxs) return resolvePinnedSwapRoute(swapOpts.swapIxs, descriptor.inAmountNative);
|
|
84516
84488
|
const runEngine = swapEngineRunner ?? runSwapEngine;
|
|
84517
84489
|
const engineResult = await runEngine({
|
|
84518
84490
|
inputMint: descriptor.inputMint,
|
|
@@ -85008,10 +84980,11 @@ async function buildSwapCollateralFlashloanTx({
|
|
|
85008
84980
|
});
|
|
85009
84981
|
sizeConstraintUsed = swapConstraints.sizeConstraint;
|
|
85010
84982
|
const runEngine = swapEngineRunner ?? runSwapEngine;
|
|
85011
|
-
const
|
|
84983
|
+
const amountNative = uiToNative(actualWithdrawAmount, withdrawBank.mintDecimals);
|
|
84984
|
+
const engineResult = swapOpts.swapIxs ? resolvePinnedSwapRoute(swapOpts.swapIxs, amountNative) : await runEngine({
|
|
85012
84985
|
inputMint: withdrawBank.mint.toBase58(),
|
|
85013
84986
|
outputMint: depositBank.mint.toBase58(),
|
|
85014
|
-
amountNative:
|
|
84987
|
+
amountNative: amountNative.toNumber(),
|
|
85015
84988
|
inputDecimals: withdrawBank.mintDecimals,
|
|
85016
84989
|
outputDecimals: depositBank.mintDecimals,
|
|
85017
84990
|
...swapEngineQuoteFieldsFromOpts(swapOpts),
|
|
@@ -85019,7 +84992,11 @@ async function buildSwapCollateralFlashloanTx({
|
|
|
85019
84992
|
destinationTokenAccount,
|
|
85020
84993
|
connection,
|
|
85021
84994
|
footprint: {
|
|
85022
|
-
instructions: [
|
|
84995
|
+
instructions: [
|
|
84996
|
+
...cuRequestIxs,
|
|
84997
|
+
...withdrawIxs.instructions,
|
|
84998
|
+
...depositIxs.instructions
|
|
84999
|
+
],
|
|
85023
85000
|
luts: addressLookupTableAccounts ?? [],
|
|
85024
85001
|
payer: marginfiAccount.authority,
|
|
85025
85002
|
sizeConstraint: swapConstraints.sizeConstraint,
|
|
@@ -86208,9 +86185,16 @@ async function simulateAccountHealthCacheWithFallback(params) {
|
|
|
86208
86185
|
marginfiAccount,
|
|
86209
86186
|
bankIntegrationMap
|
|
86210
86187
|
});
|
|
86211
|
-
|
|
86212
|
-
|
|
86213
|
-
|
|
86188
|
+
const simulated = parseMarginfiAccountRaw(params.marginfiAccount.address, simulatedAccount);
|
|
86189
|
+
marginfiAccount = {
|
|
86190
|
+
...simulated,
|
|
86191
|
+
healthCache: {
|
|
86192
|
+
...simulated.healthCache,
|
|
86193
|
+
assetValueEquity,
|
|
86194
|
+
liabilityValueEquity,
|
|
86195
|
+
simulationStatus: 1 /* ONCHAIN */
|
|
86196
|
+
}
|
|
86197
|
+
};
|
|
86214
86198
|
} catch (e) {
|
|
86215
86199
|
console.log("e", e);
|
|
86216
86200
|
const { assets: assetValueMaint, liabilities: liabilityValueMaint } = computeHealthComponentsFromBalances({
|
|
@@ -86718,7 +86702,7 @@ var fetchStakePoolActiveStates = async (connection, validatorVoteAccounts) => {
|
|
|
86718
86702
|
});
|
|
86719
86703
|
const poolStakeAddressKeys = Object.keys(poolStakeAddressRecord);
|
|
86720
86704
|
const poolStakeAccounts = Object.fromEntries(
|
|
86721
|
-
(await
|
|
86705
|
+
(await chunkedGetRawMultipleAccountInfoOrderedWithNulls(connection, poolStakeAddressKeys)).map((ai, index) => {
|
|
86722
86706
|
const key = poolStakeAddressKeys[index];
|
|
86723
86707
|
const validatorVote = key ? poolStakeAddressRecord[key] : void 0;
|
|
86724
86708
|
return [validatorVote, ai?.data || null];
|
|
@@ -86726,7 +86710,8 @@ var fetchStakePoolActiveStates = async (connection, validatorVoteAccounts) => {
|
|
|
86726
86710
|
);
|
|
86727
86711
|
validatorVoteAccounts.map((validatorVoteAccount) => {
|
|
86728
86712
|
const voteAccountKey = validatorVoteAccount.toBase58();
|
|
86729
|
-
const
|
|
86713
|
+
const stakeData = poolStakeAccounts[voteAccountKey];
|
|
86714
|
+
const stakeAccount = stakeData ? fetchStakeAccount(stakeData) : null;
|
|
86730
86715
|
const poolMintAddress = poolMintAddressRecord[voteAccountKey];
|
|
86731
86716
|
if (!poolMintAddress) {
|
|
86732
86717
|
return;
|
|
@@ -86813,26 +86798,28 @@ var fetchStakePoolMev = async (connection, validatorVoteAccounts) => {
|
|
|
86813
86798
|
const allAddresses = [...poolStakeAddresses, ...onRampAddresses].map(
|
|
86814
86799
|
(address) => address.toBase58()
|
|
86815
86800
|
);
|
|
86816
|
-
return
|
|
86817
|
-
|
|
86818
|
-
|
|
86819
|
-
|
|
86820
|
-
|
|
86821
|
-
|
|
86822
|
-
|
|
86823
|
-
|
|
86824
|
-
|
|
86825
|
-
|
|
86826
|
-
|
|
86827
|
-
|
|
86828
|
-
|
|
86829
|
-
|
|
86830
|
-
|
|
86831
|
-
|
|
86832
|
-
|
|
86833
|
-
|
|
86834
|
-
|
|
86835
|
-
|
|
86801
|
+
return chunkedGetRawMultipleAccountInfoOrderedWithNulls(connection, allAddresses).then(
|
|
86802
|
+
(accountInfos) => {
|
|
86803
|
+
const poolStakeInfos = accountInfos.slice(0, poolStakeAddresses.length);
|
|
86804
|
+
const onRampInfos = accountInfos.slice(poolStakeAddresses.length);
|
|
86805
|
+
const rent = 2282280;
|
|
86806
|
+
validatorVoteAccounts.forEach((validatorVoteAccount, index) => {
|
|
86807
|
+
const poolStakeInfo = poolStakeInfos[index];
|
|
86808
|
+
const onRampInfo = onRampInfos[index];
|
|
86809
|
+
if (poolStakeInfo && onRampInfo) {
|
|
86810
|
+
const stakeDecoded = fetchStakeAccount(poolStakeInfo.data);
|
|
86811
|
+
const onrampDecoded = fetchStakeAccount(onRampInfo.data);
|
|
86812
|
+
const poolLamps = poolStakeInfo.lamports - rent - Number(stakeDecoded.stake.delegation.stake.toString());
|
|
86813
|
+
const onrampStake = Number(onrampDecoded.stake.delegation.stake.toString());
|
|
86814
|
+
mev.set(validatorVoteAccount.toBase58(), {
|
|
86815
|
+
pool: poolLamps >= 1e3 ? poolLamps : 0,
|
|
86816
|
+
onramp: onrampStake
|
|
86817
|
+
});
|
|
86818
|
+
}
|
|
86819
|
+
});
|
|
86820
|
+
return mev;
|
|
86821
|
+
}
|
|
86822
|
+
);
|
|
86836
86823
|
};
|
|
86837
86824
|
|
|
86838
86825
|
// src/services/native-stake/utils/serialize.utils.ts
|
|
@@ -87272,55 +87259,67 @@ function getValidatorVoteAccountByBank() {
|
|
|
87272
87259
|
}
|
|
87273
87260
|
return _voteAccountByBank;
|
|
87274
87261
|
}
|
|
87262
|
+
var POOL_BOOTSTRAP_LAMPORTS = 1000000000n;
|
|
87263
|
+
var STAKE_STATE_DELEGATED = 2;
|
|
87275
87264
|
async function computeStakedBankMultipliers(stakedBanks, connection) {
|
|
87276
87265
|
const multiplierByBank = /* @__PURE__ */ new Map();
|
|
87277
87266
|
if (stakedBanks.length === 0) {
|
|
87278
87267
|
return multiplierByBank;
|
|
87279
87268
|
}
|
|
87280
87269
|
const metadataMap = getStakedBankMetadataMap();
|
|
87281
|
-
const
|
|
87270
|
+
const resolvedBanks = [];
|
|
87282
87271
|
const poolStakeAddresses = [];
|
|
87283
87272
|
const lstMintAddresses = [];
|
|
87273
|
+
const onrampAddresses = [];
|
|
87284
87274
|
for (const bank of stakedBanks) {
|
|
87285
87275
|
const metadata = metadataMap.get(bank.address.toBase58());
|
|
87286
87276
|
if (!metadata) {
|
|
87287
|
-
multiplierByBank.set(bank.address.toBase58(), new
|
|
87277
|
+
multiplierByBank.set(bank.address.toBase58(), new BigNumber3.BigNumber(1));
|
|
87288
87278
|
continue;
|
|
87289
87279
|
}
|
|
87290
87280
|
const pool = findPoolAddress(new web3_js.PublicKey(metadata.validatorVoteAccount));
|
|
87291
|
-
|
|
87281
|
+
resolvedBanks.push(bank);
|
|
87292
87282
|
poolStakeAddresses.push(findPoolStakeAddress(pool));
|
|
87293
87283
|
lstMintAddresses.push(findPoolMintAddress(pool));
|
|
87284
|
+
onrampAddresses.push(findPoolOnRampAddress(pool));
|
|
87294
87285
|
}
|
|
87295
|
-
if (
|
|
87286
|
+
if (resolvedBanks.length === 0) {
|
|
87296
87287
|
return multiplierByBank;
|
|
87297
87288
|
}
|
|
87298
|
-
const allAddresses = [
|
|
87299
|
-
|
|
87300
|
-
|
|
87301
|
-
]
|
|
87302
|
-
|
|
87303
|
-
|
|
87304
|
-
|
|
87305
|
-
|
|
87306
|
-
|
|
87307
|
-
|
|
87308
|
-
const
|
|
87309
|
-
|
|
87310
|
-
|
|
87311
|
-
|
|
87289
|
+
const allAddresses = [...poolStakeAddresses, ...lstMintAddresses, ...onrampAddresses].map(
|
|
87290
|
+
(a) => a.toBase58()
|
|
87291
|
+
);
|
|
87292
|
+
const [accountInfos, stakeRent] = await Promise.all([
|
|
87293
|
+
chunkedGetRawMultipleAccountInfoOrderedWithNulls(connection, allAddresses),
|
|
87294
|
+
resolvedBanks.some((bank) => bank.stakedOracleUsesOnramp) ? connection.getMinimumBalanceForRentExemption(web3_js.StakeProgram.space) : 0
|
|
87295
|
+
]);
|
|
87296
|
+
const count = resolvedBanks.length;
|
|
87297
|
+
const aboveRent = (lamports) => Math.max(lamports - stakeRent, 0);
|
|
87298
|
+
resolvedBanks.forEach((bank, i) => {
|
|
87299
|
+
const bankAddr = bank.address.toBase58();
|
|
87300
|
+
const poolStakeInfo = accountInfos[i];
|
|
87301
|
+
const lstMintInfo = accountInfos[count + i];
|
|
87302
|
+
const onrampInfo = accountInfos[2 * count + i];
|
|
87303
|
+
const lstMintSupply = lstMintInfo ? buffer.Buffer.from(lstMintInfo.data.subarray(36, 44)).readBigUInt64LE(0) : 0n;
|
|
87304
|
+
if (!poolStakeInfo || lstMintSupply === 0n) {
|
|
87305
|
+
multiplierByBank.set(bankAddr, new BigNumber3.BigNumber(1));
|
|
87306
|
+
return;
|
|
87312
87307
|
}
|
|
87313
|
-
|
|
87314
|
-
|
|
87315
|
-
|
|
87316
|
-
|
|
87317
|
-
|
|
87318
|
-
|
|
87308
|
+
if (bank.stakedOracleUsesOnramp) {
|
|
87309
|
+
const value = aboveRent(poolStakeInfo.lamports) + (onrampInfo ? aboveRent(onrampInfo.lamports) : 0);
|
|
87310
|
+
multiplierByBank.set(
|
|
87311
|
+
bankAddr,
|
|
87312
|
+
new BigNumber3.BigNumber(value).dividedBy((lstMintSupply + POOL_BOOTSTRAP_LAMPORTS).toString())
|
|
87313
|
+
);
|
|
87314
|
+
return;
|
|
87319
87315
|
}
|
|
87320
|
-
const
|
|
87321
|
-
const
|
|
87322
|
-
multiplierByBank.set(
|
|
87323
|
-
|
|
87316
|
+
const delegated = poolStakeInfo.data.readUInt32LE(0) === STAKE_STATE_DELEGATED ? fetchStakeAccount(poolStakeInfo.data).stake.delegation.stake : 0n;
|
|
87317
|
+
const delegatedAboveBootstrap = delegated > POOL_BOOTSTRAP_LAMPORTS ? delegated - POOL_BOOTSTRAP_LAMPORTS : 0n;
|
|
87318
|
+
multiplierByBank.set(
|
|
87319
|
+
bankAddr,
|
|
87320
|
+
new BigNumber3.BigNumber(delegatedAboveBootstrap.toString()).dividedBy(lstMintSupply.toString())
|
|
87321
|
+
);
|
|
87322
|
+
});
|
|
87324
87323
|
return multiplierByBank;
|
|
87325
87324
|
}
|
|
87326
87325
|
var SYSVAR_CLOCK_ID2 = new web3_js.PublicKey("SysvarC1ock11111111111111111111111111111111");
|
|
@@ -88149,7 +88148,7 @@ async function fetchBankIntegrationMetadata(options) {
|
|
|
88149
88148
|
|
|
88150
88149
|
// src/models/bank.ts
|
|
88151
88150
|
var Bank = class _Bank {
|
|
88152
|
-
constructor(address, mint, mintDecimals, group, assetShareValue, liabilityShareValue, liquidityVault, liquidityVaultBump, liquidityVaultAuthorityBump, insuranceVault, insuranceVaultBump, insuranceVaultAuthorityBump, collectedInsuranceFeesOutstanding, feeVault, feeVaultBump, feeVaultAuthorityBump, collectedGroupFeesOutstanding, lastUpdate, config, totalAssetShares, totalLiabilityShares, emissionsActiveBorrowing, emissionsActiveLending, emissionsRate, emissionsMint, emissionsRemaining, collectedProgramFeesOutstanding, oracleKey, emode, premiumTag, premiumActive, premiumActivatedAt, kaminoEmergency, rateLimiter, kaminoIntegrationAccounts, driftIntegrationAccounts, solendIntegrationAccounts, jupLendIntegrationAccounts, feesDestinationAccount, lendingPositionCount, borrowingPositionCount, tokenSymbol) {
|
|
88151
|
+
constructor(address, mint, mintDecimals, group, assetShareValue, liabilityShareValue, liquidityVault, liquidityVaultBump, liquidityVaultAuthorityBump, insuranceVault, insuranceVaultBump, insuranceVaultAuthorityBump, collectedInsuranceFeesOutstanding, feeVault, feeVaultBump, feeVaultAuthorityBump, collectedGroupFeesOutstanding, lastUpdate, config, totalAssetShares, totalLiabilityShares, emissionsActiveBorrowing, emissionsActiveLending, emissionsRate, emissionsMint, emissionsRemaining, collectedProgramFeesOutstanding, oracleKey, emode, premiumTag, premiumActive, premiumActivatedAt, kaminoEmergency, rateLimiter, kaminoIntegrationAccounts, driftIntegrationAccounts, solendIntegrationAccounts, jupLendIntegrationAccounts, feesDestinationAccount, lendingPositionCount, borrowingPositionCount, tokenSymbol, stakedOracleDisabled, stakedOracleUsesOnramp, stakedIntegrationAccounts) {
|
|
88153
88152
|
this.address = address;
|
|
88154
88153
|
this.mint = mint;
|
|
88155
88154
|
this.mintDecimals = mintDecimals;
|
|
@@ -88192,6 +88191,9 @@ var Bank = class _Bank {
|
|
|
88192
88191
|
this.lendingPositionCount = lendingPositionCount;
|
|
88193
88192
|
this.borrowingPositionCount = borrowingPositionCount;
|
|
88194
88193
|
this.tokenSymbol = tokenSymbol;
|
|
88194
|
+
this.stakedOracleDisabled = stakedOracleDisabled;
|
|
88195
|
+
this.stakedOracleUsesOnramp = stakedOracleUsesOnramp;
|
|
88196
|
+
this.stakedIntegrationAccounts = stakedIntegrationAccounts;
|
|
88195
88197
|
}
|
|
88196
88198
|
static async fetch(address, program, bankMetadata) {
|
|
88197
88199
|
const data = await program.account.bank.fetch(address);
|
|
@@ -88267,7 +88269,10 @@ var Bank = class _Bank {
|
|
|
88267
88269
|
bankType.feesDestinationAccount,
|
|
88268
88270
|
bankType.lendingPositionCount,
|
|
88269
88271
|
bankType.borrowingPositionCount,
|
|
88270
|
-
bankType.tokenSymbol
|
|
88272
|
+
bankType.tokenSymbol,
|
|
88273
|
+
bankType.stakedOracleDisabled,
|
|
88274
|
+
bankType.stakedOracleUsesOnramp,
|
|
88275
|
+
bankType.stakedIntegrationAccounts
|
|
88271
88276
|
);
|
|
88272
88277
|
}
|
|
88273
88278
|
static fromAccountParsed(address, accountParsed, bankMetadata) {
|
|
@@ -88314,7 +88319,10 @@ var Bank = class _Bank {
|
|
|
88314
88319
|
props.feesDestinationAccount,
|
|
88315
88320
|
props.lendingPositionCount,
|
|
88316
88321
|
props.borrowingPositionCount,
|
|
88317
|
-
props.tokenSymbol
|
|
88322
|
+
props.tokenSymbol,
|
|
88323
|
+
props.stakedOracleDisabled,
|
|
88324
|
+
props.stakedOracleUsesOnramp,
|
|
88325
|
+
props.stakedIntegrationAccounts
|
|
88318
88326
|
);
|
|
88319
88327
|
}
|
|
88320
88328
|
static withEmodeWeights(bank, emodeWeights) {
|