@0dotxyz/p0-ts-sdk 2.1.1 → 2.2.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +887 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +120 -1
- package/dist/index.d.ts +120 -1
- package/dist/index.js +883 -9
- package/dist/index.js.map +1 -1
- package/dist/vendor.cjs +26 -0
- package/dist/vendor.cjs.map +1 -1
- package/dist/vendor.d.cts +21 -1
- package/dist/vendor.d.ts +21 -1
- package/dist/vendor.js +25 -1
- package/dist/vendor.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PublicKey, SolanaJSONRPCError, ComputeBudgetProgram, SystemProgram, TransactionMessage, VersionedTransaction, Transaction, AddressLookupTableAccount, SYSVAR_RENT_PUBKEY,
|
|
1
|
+
import { PublicKey, SolanaJSONRPCError, ComputeBudgetProgram, SystemProgram, TransactionMessage, VersionedTransaction, Transaction, StakeProgram, Keypair, StakeAuthorizationLayout, AddressLookupTableAccount, SYSVAR_RENT_PUBKEY, TransactionInstruction, LAMPORTS_PER_SOL, SYSVAR_INSTRUCTIONS_PUBKEY, STAKE_CONFIG_ID as STAKE_CONFIG_ID$1 } from '@solana/web3.js';
|
|
2
2
|
import { object, string, enums, array, assert } from 'superstruct';
|
|
3
3
|
import BigNumber3, { BigNumber } from 'bignumber.js';
|
|
4
|
-
import BN11 from 'bn.js';
|
|
4
|
+
import BN11, { BN } from 'bn.js';
|
|
5
5
|
import Decimal3, { Decimal } from 'decimal.js';
|
|
6
6
|
import { BorshCoder, BorshAccountsCoder, BorshInstructionCoder, AnchorProvider, Program } from '@coral-xyz/anchor';
|
|
7
7
|
import { struct, u32, u8 } from '@solana/buffer-layout';
|
|
@@ -15136,9 +15136,48 @@ var MintLayout = struct([
|
|
|
15136
15136
|
publicKey("freezeAuthority")
|
|
15137
15137
|
]);
|
|
15138
15138
|
MintLayout.span;
|
|
15139
|
+
var approveInstructionData = struct([
|
|
15140
|
+
u8("instruction"),
|
|
15141
|
+
u64("amount")
|
|
15142
|
+
]);
|
|
15143
|
+
function createApproveInstruction(account, delegate, owner, amount, multiSigners = [], programId = TOKEN_PROGRAM_ID) {
|
|
15144
|
+
const keys = addSigners(
|
|
15145
|
+
[
|
|
15146
|
+
{ pubkey: account, isSigner: false, isWritable: true },
|
|
15147
|
+
{ pubkey: delegate, isSigner: false, isWritable: false }
|
|
15148
|
+
],
|
|
15149
|
+
owner,
|
|
15150
|
+
multiSigners
|
|
15151
|
+
);
|
|
15152
|
+
const data = Buffer$1.alloc(approveInstructionData.span);
|
|
15153
|
+
approveInstructionData.encode(
|
|
15154
|
+
{
|
|
15155
|
+
instruction: 4 /* Approve */,
|
|
15156
|
+
amount: BigInt(amount)
|
|
15157
|
+
},
|
|
15158
|
+
data
|
|
15159
|
+
);
|
|
15160
|
+
return new TransactionInstruction({ keys, programId, data });
|
|
15161
|
+
}
|
|
15139
15162
|
struct([
|
|
15140
15163
|
u8("instruction")
|
|
15141
15164
|
]);
|
|
15165
|
+
function createAssociatedTokenAccountInstruction(payer, associatedToken, owner, mint, programId = TOKEN_PROGRAM_ID, associatedTokenProgramId = ASSOCIATED_TOKEN_PROGRAM_ID) {
|
|
15166
|
+
const keys = [
|
|
15167
|
+
{ pubkey: payer, isSigner: true, isWritable: true },
|
|
15168
|
+
{ pubkey: associatedToken, isSigner: false, isWritable: true },
|
|
15169
|
+
{ pubkey: owner, isSigner: false, isWritable: false },
|
|
15170
|
+
{ pubkey: mint, isSigner: false, isWritable: false },
|
|
15171
|
+
{ pubkey: SystemProgram.programId, isSigner: false, isWritable: false },
|
|
15172
|
+
{ pubkey: programId, isSigner: false, isWritable: false },
|
|
15173
|
+
{ pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false }
|
|
15174
|
+
];
|
|
15175
|
+
return new TransactionInstruction({
|
|
15176
|
+
keys,
|
|
15177
|
+
programId: associatedTokenProgramId,
|
|
15178
|
+
data: Buffer$1.alloc(0)
|
|
15179
|
+
});
|
|
15180
|
+
}
|
|
15142
15181
|
function createAssociatedTokenAccountIdempotentInstruction(payer, associatedToken, owner, mint, programId = TOKEN_PROGRAM_ID, associatedTokenProgramId = ASSOCIATED_TOKEN_PROGRAM_ID) {
|
|
15143
15182
|
return buildAssociatedTokenAccountInstruction(
|
|
15144
15183
|
payer,
|
|
@@ -43353,6 +43392,169 @@ new Fraction(new BN11(0));
|
|
|
43353
43392
|
function roundNearest(decimal) {
|
|
43354
43393
|
return decimal.toDecimalPlaces(0, Decimal3.ROUND_HALF_CEIL);
|
|
43355
43394
|
}
|
|
43395
|
+
var SinglePoolInstruction = {
|
|
43396
|
+
initializePool: (voteAccount) => {
|
|
43397
|
+
const pool = findPoolAddress(voteAccount);
|
|
43398
|
+
const stake = findPoolStakeAddress(pool);
|
|
43399
|
+
const mint = findPoolMintAddress(pool);
|
|
43400
|
+
const stakeAuthority = findPoolStakeAuthorityAddress(pool);
|
|
43401
|
+
const mintAuthority = findPoolMintAuthorityAddress(pool);
|
|
43402
|
+
return createTransactionInstruction(
|
|
43403
|
+
SINGLE_POOL_PROGRAM_ID,
|
|
43404
|
+
[
|
|
43405
|
+
{ pubkey: voteAccount, isSigner: false, isWritable: false },
|
|
43406
|
+
{ pubkey: pool, isSigner: false, isWritable: true },
|
|
43407
|
+
{ pubkey: stake, isSigner: false, isWritable: true },
|
|
43408
|
+
{ pubkey: mint, isSigner: false, isWritable: true },
|
|
43409
|
+
{ pubkey: stakeAuthority, isSigner: false, isWritable: false },
|
|
43410
|
+
{ pubkey: mintAuthority, isSigner: false, isWritable: false },
|
|
43411
|
+
{ pubkey: SYSVAR_RENT_ID, isSigner: false, isWritable: false },
|
|
43412
|
+
{ pubkey: SYSVAR_CLOCK_ID, isSigner: false, isWritable: false },
|
|
43413
|
+
{ pubkey: SYSVAR_STAKE_HISTORY_ID, isSigner: false, isWritable: false },
|
|
43414
|
+
{ pubkey: STAKE_CONFIG_ID$1, isSigner: false, isWritable: false },
|
|
43415
|
+
{ pubkey: SYSTEM_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
43416
|
+
{ pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
43417
|
+
{ pubkey: STAKE_PROGRAM_ID, isSigner: false, isWritable: false }
|
|
43418
|
+
],
|
|
43419
|
+
Buffer.from([0 /* InitializePool */])
|
|
43420
|
+
);
|
|
43421
|
+
},
|
|
43422
|
+
initializeOnRamp: (pool) => {
|
|
43423
|
+
const onRamp = findPoolOnRampAddress(pool);
|
|
43424
|
+
const stakeAuthority = findPoolStakeAuthorityAddress(pool);
|
|
43425
|
+
return createTransactionInstruction(
|
|
43426
|
+
SINGLE_POOL_PROGRAM_ID,
|
|
43427
|
+
[
|
|
43428
|
+
{ pubkey: pool, isSigner: false, isWritable: false },
|
|
43429
|
+
{ pubkey: onRamp, isSigner: false, isWritable: true },
|
|
43430
|
+
{ pubkey: stakeAuthority, isSigner: false, isWritable: false },
|
|
43431
|
+
{ pubkey: SYSVAR_RENT_ID, isSigner: false, isWritable: false },
|
|
43432
|
+
{ pubkey: SYSTEM_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
43433
|
+
{ pubkey: STAKE_PROGRAM_ID, isSigner: false, isWritable: false }
|
|
43434
|
+
],
|
|
43435
|
+
Buffer.from([6 /* InitializeOnRamp */])
|
|
43436
|
+
);
|
|
43437
|
+
},
|
|
43438
|
+
depositStake: async (pool, userStakeAccount, userTokenAccount, userLamportAccount) => {
|
|
43439
|
+
const stake = findPoolStakeAddress(pool);
|
|
43440
|
+
const mint = findPoolMintAddress(pool);
|
|
43441
|
+
const stakeAuthority = findPoolStakeAuthorityAddress(pool);
|
|
43442
|
+
const mintAuthority = findPoolMintAuthorityAddress(pool);
|
|
43443
|
+
return createTransactionInstruction(
|
|
43444
|
+
SINGLE_POOL_PROGRAM_ID,
|
|
43445
|
+
[
|
|
43446
|
+
{ pubkey: pool, isSigner: false, isWritable: false },
|
|
43447
|
+
{ pubkey: stake, isSigner: false, isWritable: true },
|
|
43448
|
+
{ pubkey: mint, isSigner: false, isWritable: true },
|
|
43449
|
+
{ pubkey: stakeAuthority, isSigner: false, isWritable: false },
|
|
43450
|
+
{ pubkey: mintAuthority, isSigner: false, isWritable: false },
|
|
43451
|
+
{ pubkey: userStakeAccount, isSigner: false, isWritable: true },
|
|
43452
|
+
{ pubkey: userTokenAccount, isSigner: false, isWritable: true },
|
|
43453
|
+
{ pubkey: userLamportAccount, isSigner: false, isWritable: true },
|
|
43454
|
+
{ pubkey: SYSVAR_CLOCK_ID, isSigner: false, isWritable: false },
|
|
43455
|
+
{ pubkey: SYSVAR_STAKE_HISTORY_ID, isSigner: false, isWritable: false },
|
|
43456
|
+
{ pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
43457
|
+
{ pubkey: STAKE_PROGRAM_ID, isSigner: false, isWritable: false }
|
|
43458
|
+
],
|
|
43459
|
+
Buffer.from([2 /* DepositStake */])
|
|
43460
|
+
);
|
|
43461
|
+
},
|
|
43462
|
+
withdrawStake: async (pool, userStakeAccount, userStakeAuthority, userTokenAccount, tokenAmount) => {
|
|
43463
|
+
const stake = findPoolStakeAddress(pool);
|
|
43464
|
+
const mint = findPoolMintAddress(pool);
|
|
43465
|
+
const stakeAuthority = findPoolStakeAuthorityAddress(pool);
|
|
43466
|
+
const mintAuthority = findPoolMintAuthorityAddress(pool);
|
|
43467
|
+
const rawAmount = BigInt(tokenAmount.multipliedBy(1e9).toString());
|
|
43468
|
+
const data = Buffer.concat([
|
|
43469
|
+
Buffer.from([3 /* WithdrawStake */]),
|
|
43470
|
+
userStakeAuthority.toBuffer(),
|
|
43471
|
+
Buffer.from(new BN(rawAmount.toString()).toArray("le", 8))
|
|
43472
|
+
]);
|
|
43473
|
+
return createTransactionInstruction(
|
|
43474
|
+
SINGLE_POOL_PROGRAM_ID,
|
|
43475
|
+
[
|
|
43476
|
+
{ pubkey: pool, isSigner: false, isWritable: false },
|
|
43477
|
+
{ pubkey: stake, isSigner: false, isWritable: true },
|
|
43478
|
+
{ pubkey: mint, isSigner: false, isWritable: true },
|
|
43479
|
+
{ pubkey: stakeAuthority, isSigner: false, isWritable: false },
|
|
43480
|
+
{ pubkey: mintAuthority, isSigner: false, isWritable: false },
|
|
43481
|
+
{ pubkey: userStakeAccount, isSigner: false, isWritable: true },
|
|
43482
|
+
{ pubkey: userTokenAccount, isSigner: false, isWritable: true },
|
|
43483
|
+
{ pubkey: SYSVAR_CLOCK_ID, isSigner: false, isWritable: false },
|
|
43484
|
+
{ pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
43485
|
+
{ pubkey: STAKE_PROGRAM_ID, isSigner: false, isWritable: false }
|
|
43486
|
+
],
|
|
43487
|
+
data
|
|
43488
|
+
);
|
|
43489
|
+
},
|
|
43490
|
+
createTokenMetadata: async (pool, payer) => {
|
|
43491
|
+
const mint = findPoolMintAddress(pool);
|
|
43492
|
+
const [mintAuthority, mplAuthority, mplMetadata] = await Promise.all([
|
|
43493
|
+
findPoolMintAuthorityAddress(pool),
|
|
43494
|
+
findPoolMplAuthorityAddress(pool),
|
|
43495
|
+
findMplMetadataAddress(mint)
|
|
43496
|
+
]);
|
|
43497
|
+
return createTransactionInstruction(
|
|
43498
|
+
SINGLE_POOL_PROGRAM_ID,
|
|
43499
|
+
[
|
|
43500
|
+
{ pubkey: pool, isSigner: false, isWritable: false },
|
|
43501
|
+
{ pubkey: mint, isSigner: false, isWritable: false },
|
|
43502
|
+
{ pubkey: mintAuthority, isSigner: false, isWritable: false },
|
|
43503
|
+
{ pubkey: mplAuthority, isSigner: false, isWritable: false },
|
|
43504
|
+
{ pubkey: payer, isSigner: true, isWritable: true },
|
|
43505
|
+
{ pubkey: mplMetadata, isSigner: false, isWritable: true },
|
|
43506
|
+
{ pubkey: MPL_METADATA_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
43507
|
+
{ pubkey: SYSTEM_PROGRAM_ID, isSigner: false, isWritable: false }
|
|
43508
|
+
],
|
|
43509
|
+
Buffer.from([4 /* CreateTokenMetadata */])
|
|
43510
|
+
);
|
|
43511
|
+
},
|
|
43512
|
+
updateTokenMetadata: async (voteAccount, authorizedWithdrawer, tokenName, tokenSymbol, tokenUri = "") => {
|
|
43513
|
+
if (tokenName.length > 32) {
|
|
43514
|
+
throw new Error("maximum token name length is 32 characters");
|
|
43515
|
+
}
|
|
43516
|
+
if (tokenSymbol.length > 10) {
|
|
43517
|
+
throw new Error("maximum token symbol length is 10 characters");
|
|
43518
|
+
}
|
|
43519
|
+
if (tokenUri.length > 200) {
|
|
43520
|
+
throw new Error("maximum token uri length is 200 characters");
|
|
43521
|
+
}
|
|
43522
|
+
const pool = findPoolAddress(voteAccount);
|
|
43523
|
+
const [mint, mplAuthority] = await Promise.all([
|
|
43524
|
+
findPoolMintAddress(pool),
|
|
43525
|
+
findPoolMplAuthorityAddress(pool)
|
|
43526
|
+
]);
|
|
43527
|
+
const mplMetadata = await findMplMetadataAddress(mint);
|
|
43528
|
+
const data = Buffer.concat([
|
|
43529
|
+
Buffer.from([5 /* UpdateTokenMetadata */]),
|
|
43530
|
+
Buffer.from(new Uint32Array([tokenName.length]).buffer),
|
|
43531
|
+
Buffer.from(tokenName),
|
|
43532
|
+
Buffer.from(new Uint32Array([tokenSymbol.length]).buffer),
|
|
43533
|
+
Buffer.from(tokenSymbol),
|
|
43534
|
+
Buffer.from(new Uint32Array([tokenUri.length]).buffer),
|
|
43535
|
+
Buffer.from(tokenUri)
|
|
43536
|
+
]);
|
|
43537
|
+
return createTransactionInstruction(
|
|
43538
|
+
SINGLE_POOL_PROGRAM_ID,
|
|
43539
|
+
[
|
|
43540
|
+
{ pubkey: voteAccount, isSigner: false, isWritable: false },
|
|
43541
|
+
{ pubkey: pool, isSigner: false, isWritable: false },
|
|
43542
|
+
{ pubkey: mplAuthority, isSigner: false, isWritable: false },
|
|
43543
|
+
{ pubkey: authorizedWithdrawer, isSigner: true, isWritable: false },
|
|
43544
|
+
{ pubkey: mplMetadata, isSigner: false, isWritable: true },
|
|
43545
|
+
{ pubkey: MPL_METADATA_PROGRAM_ID, isSigner: false, isWritable: false }
|
|
43546
|
+
],
|
|
43547
|
+
data
|
|
43548
|
+
);
|
|
43549
|
+
}
|
|
43550
|
+
};
|
|
43551
|
+
var createTransactionInstruction = (programId, keys, data) => {
|
|
43552
|
+
return {
|
|
43553
|
+
programId,
|
|
43554
|
+
keys,
|
|
43555
|
+
data
|
|
43556
|
+
};
|
|
43557
|
+
};
|
|
43356
43558
|
var findPda = (baseAddress, prefix, programId = SINGLE_POOL_PROGRAM_ID) => {
|
|
43357
43559
|
const [pda] = PublicKey.findProgramAddressSync(
|
|
43358
43560
|
[Buffer.from(prefix), baseAddress.toBuffer()],
|
|
@@ -43363,7 +43565,17 @@ var findPda = (baseAddress, prefix, programId = SINGLE_POOL_PROGRAM_ID) => {
|
|
|
43363
43565
|
var findPoolAddress = (voteAccountAddress) => findPda(voteAccountAddress, "pool");
|
|
43364
43566
|
var findPoolMintAddress = (poolAddress) => findPda(poolAddress, "mint");
|
|
43365
43567
|
var findPoolStakeAddress = (poolAddress) => findPda(poolAddress, "stake");
|
|
43568
|
+
var findPoolStakeAuthorityAddress = (poolAddress) => findPda(poolAddress, "stake_authority");
|
|
43569
|
+
var findPoolMintAuthorityAddress = (poolAddress) => findPda(poolAddress, "mint_authority");
|
|
43570
|
+
var findPoolMplAuthorityAddress = (poolAddress) => findPda(poolAddress, "mpl_authority");
|
|
43366
43571
|
var findPoolOnRampAddress = (poolAddress) => findPda(poolAddress, "onramp");
|
|
43572
|
+
var findMplMetadataAddress = async (poolMintAddress) => {
|
|
43573
|
+
const [pda] = PublicKey.findProgramAddressSync(
|
|
43574
|
+
[Buffer.from("metadata"), MPL_METADATA_PROGRAM_ID.toBuffer(), poolMintAddress.toBuffer()],
|
|
43575
|
+
MPL_METADATA_PROGRAM_ID
|
|
43576
|
+
);
|
|
43577
|
+
return pda;
|
|
43578
|
+
};
|
|
43367
43579
|
BigInt(33);
|
|
43368
43580
|
BigInt(200);
|
|
43369
43581
|
BigInt(82);
|
|
@@ -47999,6 +48211,179 @@ async function buildSwapDebtFlashloanTx({
|
|
|
47999
48211
|
}
|
|
48000
48212
|
throw new Error("Failed to build swap debt flashloan tx");
|
|
48001
48213
|
}
|
|
48214
|
+
var SYSVAR_CLOCK_ID2 = new PublicKey("SysvarC1ock11111111111111111111111111111111");
|
|
48215
|
+
async function makeMintStakedLstIx(params) {
|
|
48216
|
+
const { amount, authority, stakeAccountPk, validator, connection } = params;
|
|
48217
|
+
const pool = findPoolAddress(validator);
|
|
48218
|
+
const lstMint = findPoolMintAddress(pool);
|
|
48219
|
+
const poolStakeAuth = findPoolStakeAuthorityAddress(pool);
|
|
48220
|
+
const lstAta = getAssociatedTokenAddressSync(lstMint, authority);
|
|
48221
|
+
const [lstAccInfo, stakeAccInfoParsed, rentExemptReserve] = await Promise.all([
|
|
48222
|
+
connection.getAccountInfo(lstAta),
|
|
48223
|
+
connection.getParsedAccountInfo(stakeAccountPk),
|
|
48224
|
+
connection.getMinimumBalanceForRentExemption(StakeProgram.space)
|
|
48225
|
+
]);
|
|
48226
|
+
const stakeAccParsed = stakeAccInfoParsed?.value?.data;
|
|
48227
|
+
const amountLamports = Math.round(Number(amount) * LAMPORTS_PER_SOL);
|
|
48228
|
+
const stakeAccLamports = Number(stakeAccParsed?.parsed?.info?.stake?.delegation?.stake ?? 0);
|
|
48229
|
+
const isFullStake = amountLamports >= stakeAccLamports;
|
|
48230
|
+
const instructions2 = [];
|
|
48231
|
+
const signers = [];
|
|
48232
|
+
if (!lstAccInfo) {
|
|
48233
|
+
instructions2.push(
|
|
48234
|
+
createAssociatedTokenAccountInstruction(authority, lstAta, authority, lstMint)
|
|
48235
|
+
);
|
|
48236
|
+
}
|
|
48237
|
+
let targetStakePubkey;
|
|
48238
|
+
if (!isFullStake) {
|
|
48239
|
+
const splitStakeAccount = Keypair.generate();
|
|
48240
|
+
signers.push(splitStakeAccount);
|
|
48241
|
+
targetStakePubkey = splitStakeAccount.publicKey;
|
|
48242
|
+
instructions2.push(
|
|
48243
|
+
...StakeProgram.split(
|
|
48244
|
+
{
|
|
48245
|
+
stakePubkey: stakeAccountPk,
|
|
48246
|
+
authorizedPubkey: authority,
|
|
48247
|
+
splitStakePubkey: splitStakeAccount.publicKey,
|
|
48248
|
+
lamports: amountLamports
|
|
48249
|
+
},
|
|
48250
|
+
rentExemptReserve
|
|
48251
|
+
).instructions
|
|
48252
|
+
);
|
|
48253
|
+
} else {
|
|
48254
|
+
targetStakePubkey = stakeAccountPk;
|
|
48255
|
+
}
|
|
48256
|
+
const [authorizeStakerIx, authorizeWithdrawIx] = await Promise.all([
|
|
48257
|
+
StakeProgram.authorize({
|
|
48258
|
+
stakePubkey: targetStakePubkey,
|
|
48259
|
+
authorizedPubkey: authority,
|
|
48260
|
+
newAuthorizedPubkey: poolStakeAuth,
|
|
48261
|
+
stakeAuthorizationType: StakeAuthorizationLayout.Staker
|
|
48262
|
+
}).instructions,
|
|
48263
|
+
StakeProgram.authorize({
|
|
48264
|
+
stakePubkey: targetStakePubkey,
|
|
48265
|
+
authorizedPubkey: authority,
|
|
48266
|
+
newAuthorizedPubkey: poolStakeAuth,
|
|
48267
|
+
stakeAuthorizationType: StakeAuthorizationLayout.Withdrawer
|
|
48268
|
+
}).instructions
|
|
48269
|
+
]);
|
|
48270
|
+
[authorizeStakerIx[0], authorizeWithdrawIx[0]].forEach((ix) => {
|
|
48271
|
+
if (ix) {
|
|
48272
|
+
ix.keys = ix.keys.map((key) => ({
|
|
48273
|
+
...key,
|
|
48274
|
+
isWritable: key.pubkey.equals(SYSVAR_CLOCK_ID2) ? false : key.isWritable
|
|
48275
|
+
}));
|
|
48276
|
+
}
|
|
48277
|
+
});
|
|
48278
|
+
instructions2.push(...authorizeStakerIx, ...authorizeWithdrawIx);
|
|
48279
|
+
const depositStakeIx = await SinglePoolInstruction.depositStake(
|
|
48280
|
+
pool,
|
|
48281
|
+
targetStakePubkey,
|
|
48282
|
+
lstAta,
|
|
48283
|
+
authority
|
|
48284
|
+
);
|
|
48285
|
+
instructions2.push(depositStakeIx);
|
|
48286
|
+
return { instructions: instructions2, keys: signers };
|
|
48287
|
+
}
|
|
48288
|
+
async function makeMintStakedLstTx(params) {
|
|
48289
|
+
const { connection, luts, blockhash: providedBlockhash } = params;
|
|
48290
|
+
const { instructions: instructions2, keys } = await makeMintStakedLstIx(params);
|
|
48291
|
+
const blockhash = providedBlockhash ?? (await connection.getLatestBlockhash("confirmed")).blockhash;
|
|
48292
|
+
const message = new TransactionMessage({
|
|
48293
|
+
payerKey: params.authority,
|
|
48294
|
+
recentBlockhash: blockhash,
|
|
48295
|
+
instructions: instructions2
|
|
48296
|
+
}).compileToV0Message(luts);
|
|
48297
|
+
const tx = new VersionedTransaction(message);
|
|
48298
|
+
return addTransactionMetadata(tx, {
|
|
48299
|
+
signers: keys,
|
|
48300
|
+
addressLookupTables: luts,
|
|
48301
|
+
type: "DEPOSIT_STAKE" /* DEPOSIT_STAKE */
|
|
48302
|
+
});
|
|
48303
|
+
}
|
|
48304
|
+
async function makeRedeemStakedLstIx(params) {
|
|
48305
|
+
const { amount, authority, validator, connection } = params;
|
|
48306
|
+
const pool = findPoolAddress(validator);
|
|
48307
|
+
const lstMint = findPoolMintAddress(pool);
|
|
48308
|
+
const mintAuthority = findPoolMintAuthorityAddress(pool);
|
|
48309
|
+
const lstAta = getAssociatedTokenAddressSync(lstMint, authority);
|
|
48310
|
+
const rentExemption = await connection.getMinimumBalanceForRentExemption(
|
|
48311
|
+
StakeProgram.space
|
|
48312
|
+
);
|
|
48313
|
+
const stakeAmount = new BigNumber3(new BigNumber3(amount).toString());
|
|
48314
|
+
const instructions2 = [];
|
|
48315
|
+
const signers = [];
|
|
48316
|
+
const stakeAccount = Keypair.generate();
|
|
48317
|
+
signers.push(stakeAccount);
|
|
48318
|
+
instructions2.push(
|
|
48319
|
+
SystemProgram.createAccount({
|
|
48320
|
+
fromPubkey: authority,
|
|
48321
|
+
newAccountPubkey: stakeAccount.publicKey,
|
|
48322
|
+
lamports: rentExemption,
|
|
48323
|
+
space: StakeProgram.space,
|
|
48324
|
+
programId: StakeProgram.programId
|
|
48325
|
+
})
|
|
48326
|
+
);
|
|
48327
|
+
instructions2.push(
|
|
48328
|
+
createApproveInstruction(
|
|
48329
|
+
lstAta,
|
|
48330
|
+
mintAuthority,
|
|
48331
|
+
authority,
|
|
48332
|
+
BigInt(stakeAmount.multipliedBy(1e9).toFixed(0))
|
|
48333
|
+
)
|
|
48334
|
+
);
|
|
48335
|
+
const withdrawStakeIx = await SinglePoolInstruction.withdrawStake(
|
|
48336
|
+
pool,
|
|
48337
|
+
stakeAccount.publicKey,
|
|
48338
|
+
authority,
|
|
48339
|
+
lstAta,
|
|
48340
|
+
stakeAmount
|
|
48341
|
+
);
|
|
48342
|
+
instructions2.push(withdrawStakeIx);
|
|
48343
|
+
return { instructions: instructions2, keys: signers };
|
|
48344
|
+
}
|
|
48345
|
+
async function makeRedeemStakedLstTx(params) {
|
|
48346
|
+
const { connection, luts, blockhash: providedBlockhash } = params;
|
|
48347
|
+
const { instructions: instructions2, keys } = await makeRedeemStakedLstIx(params);
|
|
48348
|
+
const blockhash = providedBlockhash ?? (await connection.getLatestBlockhash("confirmed")).blockhash;
|
|
48349
|
+
const message = new TransactionMessage({
|
|
48350
|
+
payerKey: params.authority,
|
|
48351
|
+
recentBlockhash: blockhash,
|
|
48352
|
+
instructions: instructions2
|
|
48353
|
+
}).compileToV0Message(luts);
|
|
48354
|
+
const tx = new VersionedTransaction(message);
|
|
48355
|
+
return addTransactionMetadata(tx, {
|
|
48356
|
+
signers: keys,
|
|
48357
|
+
addressLookupTables: luts,
|
|
48358
|
+
type: "WITHDRAW_STAKE" /* WITHDRAW_STAKE */
|
|
48359
|
+
});
|
|
48360
|
+
}
|
|
48361
|
+
async function makeMergeStakeAccountsTx(params) {
|
|
48362
|
+
const {
|
|
48363
|
+
authority,
|
|
48364
|
+
sourceStakeAccount,
|
|
48365
|
+
destinationStakeAccount,
|
|
48366
|
+
connection,
|
|
48367
|
+
luts,
|
|
48368
|
+
blockhash: providedBlockhash
|
|
48369
|
+
} = params;
|
|
48370
|
+
const mergeIx = StakeProgram.merge({
|
|
48371
|
+
stakePubkey: destinationStakeAccount,
|
|
48372
|
+
sourceStakePubKey: sourceStakeAccount,
|
|
48373
|
+
authorizedPubkey: authority
|
|
48374
|
+
}).instructions;
|
|
48375
|
+
const blockhash = providedBlockhash ?? (await connection.getLatestBlockhash("confirmed")).blockhash;
|
|
48376
|
+
const message = new TransactionMessage({
|
|
48377
|
+
payerKey: authority,
|
|
48378
|
+
recentBlockhash: blockhash,
|
|
48379
|
+
instructions: mergeIx
|
|
48380
|
+
}).compileToV0Message(luts);
|
|
48381
|
+
const tx = new VersionedTransaction(message);
|
|
48382
|
+
return addTransactionMetadata(tx, {
|
|
48383
|
+
addressLookupTables: luts,
|
|
48384
|
+
type: "MERGE_STAKE_ACCOUNTS" /* MERGE_STAKE_ACCOUNTS */
|
|
48385
|
+
});
|
|
48386
|
+
}
|
|
48002
48387
|
|
|
48003
48388
|
// src/services/account/services/account-simulation.service.ts
|
|
48004
48389
|
async function simulateAccountHealthCacheWithFallback(params) {
|
|
@@ -49409,18 +49794,15 @@ var fetchPythOracleData = async (banks, opts) => {
|
|
|
49409
49794
|
bankOraclePriceMap: /* @__PURE__ */ new Map()
|
|
49410
49795
|
};
|
|
49411
49796
|
}
|
|
49412
|
-
pythStakedCollateralBanks.map((bank) => [
|
|
49413
|
-
opts.validatorVoteAccountByBank?.[bank.address.toBase58()] ?? "",
|
|
49414
|
-
bank.mint.toBase58()
|
|
49415
|
-
]);
|
|
49416
|
-
const priceCoeffByBank = {};
|
|
49417
49797
|
const combinedPythBanks = [
|
|
49418
49798
|
...pythPushBanks,
|
|
49799
|
+
...pythStakedCollateralBanks,
|
|
49419
49800
|
...pythPushKaminosBanks,
|
|
49420
49801
|
...driftPythPullBanks,
|
|
49421
49802
|
...solendPythPullBanks,
|
|
49422
49803
|
...juplendPythPullBanks
|
|
49423
49804
|
];
|
|
49805
|
+
const priceCoeffByBank = {};
|
|
49424
49806
|
const pythOracleKeys = extractPythOracleKeys(combinedPythBanks);
|
|
49425
49807
|
const uniquePythOracleKeys = Array.from(new Set(pythOracleKeys));
|
|
49426
49808
|
let oraclePrices;
|
|
@@ -50625,6 +51007,389 @@ function dtoToValidatorStakeGroup(validatorStakeGroupDto) {
|
|
|
50625
51007
|
}))
|
|
50626
51008
|
};
|
|
50627
51009
|
}
|
|
51010
|
+
|
|
51011
|
+
// src/services/native-stake/utils/metadata.data.ts
|
|
51012
|
+
var STAKED_BANK_METADATA_JSON = [
|
|
51013
|
+
{
|
|
51014
|
+
bankAddress: "8g5qG6PVygcVSXV1cJnjXaD1yhrDwcWAMQCY2wR9VuAf",
|
|
51015
|
+
validatorVoteAccount: "CooLbbZy5Xmdt7DiHPQ3ss2uRXawnTXXVgpMS8E8jDzr",
|
|
51016
|
+
tokenAddress: "BADo3D6nMtGnsAaTv3iEes8mMcq92TuFoBWebFe8kzeA",
|
|
51017
|
+
tokenName: "Cavey Cool",
|
|
51018
|
+
tokenSymbol: "COOL"
|
|
51019
|
+
},
|
|
51020
|
+
{
|
|
51021
|
+
bankAddress: "BuCckNm1djpp3vZVhvh1CrrniirY6sr2hwUmeP5kTcGz",
|
|
51022
|
+
validatorVoteAccount: "mrgn4t2JabSgvGnrCaHXMvz8ocr4F52scsxJnkQMQsQ",
|
|
51023
|
+
tokenAddress: "FUyAyVbYrMfiaN1QEQYFZTuBNzW5EJf3jWzjjymGqKLv",
|
|
51024
|
+
tokenName: "Project 0 Meridian",
|
|
51025
|
+
tokenSymbol: "MERIDIAN"
|
|
51026
|
+
},
|
|
51027
|
+
{
|
|
51028
|
+
bankAddress: "Hco1P3dGRXz3ZGFvMkbDgghZQy47Tp7vp7koSYRvP6nm",
|
|
51029
|
+
validatorVoteAccount: "mrgn6ETrBDM8mjjYN8rbVwFqVwF8z6rtmvGLbdGuVUU",
|
|
51030
|
+
tokenAddress: "A4B5MGQvcZCUqeiUEAB4ckZ2tvH2UmEg31vF7TiERDkH",
|
|
51031
|
+
tokenName: "MRGN 3",
|
|
51032
|
+
tokenSymbol: "MRGN3"
|
|
51033
|
+
},
|
|
51034
|
+
{
|
|
51035
|
+
bankAddress: "EPh2abWP8DusPH8myWnECAAeQUZgAz927aMbmwXt3eRY",
|
|
51036
|
+
validatorVoteAccount: "mrgn2vsZ5EJ8YEfAMNPXmRux7th9cNfBasQ1JJvVwPn",
|
|
51037
|
+
tokenAddress: "6Mt7tBWLUJfDxqCFTsjoRXF9wD55g4Lhs5nAyYp244pX",
|
|
51038
|
+
tokenName: "Project 0 Horizon",
|
|
51039
|
+
tokenSymbol: "HORIZON"
|
|
51040
|
+
},
|
|
51041
|
+
{
|
|
51042
|
+
bankAddress: "6wjAwhnxTMEzHk8NNHVXgkx1jSrb6TX1bC17j3S56FfB",
|
|
51043
|
+
validatorVoteAccount: "3N7s9zXMZ4QqvHQR15t5GNHyqc89KduzMP7423eWiD5g",
|
|
51044
|
+
tokenAddress: "DKPvRV4dxUejjGpr2XwFmzZbbbTD7vx9Jmt1kk43n4d5",
|
|
51045
|
+
tokenName: "Binance",
|
|
51046
|
+
tokenSymbol: "BINANCE"
|
|
51047
|
+
},
|
|
51048
|
+
{
|
|
51049
|
+
bankAddress: "J9tksvZEDSwtNtZ6yxYjWDDkzhPbwDMnihU61NkFG9FE",
|
|
51050
|
+
validatorVoteAccount: "he1iusunGwqrNtafDtLdhsUQDFvo13z9sUa36PauBtk",
|
|
51051
|
+
tokenAddress: "2k79y8CApbU9jAvWhLS2j6uRbaVjpLJTUzstBTho9vGq",
|
|
51052
|
+
tokenName: "Helius",
|
|
51053
|
+
tokenSymbol: "HELIUS"
|
|
51054
|
+
},
|
|
51055
|
+
{
|
|
51056
|
+
bankAddress: "Dfr6Sf44ftecaJaoJMzFQABdkt3CEHfBwut1WyacRzaE",
|
|
51057
|
+
validatorVoteAccount: "SLaYv7tCwetrFGbPCRnqpHswG5qqKino78EYpbGF7xY",
|
|
51058
|
+
tokenAddress: "Vsw4JT33S7bLbhjySMMyrP3JKvTAcNi9WG5Doekrmgg",
|
|
51059
|
+
tokenName: "Solayer",
|
|
51060
|
+
tokenSymbol: "SOLAYER"
|
|
51061
|
+
},
|
|
51062
|
+
{
|
|
51063
|
+
bankAddress: "BZAm4qGscR8gg5bmWrEq6BTofgaZPbg7Fwfa7rFghEXL",
|
|
51064
|
+
validatorVoteAccount: "J1to3PQfXidUUhprQWgdKkQAMWPJAEqSJ7amkBDE9qhF",
|
|
51065
|
+
tokenAddress: "6B8hZSupE5mcACmjzozP6C1DR2uaCCtmrGqcYWC6SBCc",
|
|
51066
|
+
tokenName: "Bonk",
|
|
51067
|
+
tokenSymbol: "BONK"
|
|
51068
|
+
},
|
|
51069
|
+
{
|
|
51070
|
+
bankAddress: "3UrMZ26NRKu2y6c2dPE7gZVHwEmhpwKLcWACg3tjCVEt",
|
|
51071
|
+
validatorVoteAccount: "J2nUHEAgZFRyuJbFjdqPrAa9gyWDuc7hErtDQHPhsYRp",
|
|
51072
|
+
tokenAddress: "9M7oMo4oL6RDPG7WbAX3Zz4dPzbMgpiCzwrQPMwG4Wgq",
|
|
51073
|
+
tokenName: "Phantom",
|
|
51074
|
+
tokenSymbol: "PHANTOM"
|
|
51075
|
+
},
|
|
51076
|
+
{
|
|
51077
|
+
bankAddress: "8c269gkonvATm93nviuYiriCQ829f7ypx3aScYDR1YoQ",
|
|
51078
|
+
validatorVoteAccount: "D3QPJm7BDzzPeRG51YZSEz3LfV7GvFNu9NkcibzURxuj",
|
|
51079
|
+
tokenAddress: "8hXCCQmYFcDhU5Mkuvyixp2Q11sbyQComkceSSh3GY4a",
|
|
51080
|
+
tokenName: "Starke Finance",
|
|
51081
|
+
tokenSymbol: "STARKE"
|
|
51082
|
+
},
|
|
51083
|
+
{
|
|
51084
|
+
bankAddress: "37tiA2NTF6YCt85XzCidPo9ZVpuqkkmfVJCYQ5Yx5Uhs",
|
|
51085
|
+
validatorVoteAccount: "SBLZib4npE7svxFA7AsD3ytdQAfYNb39c8zsU82AA2E",
|
|
51086
|
+
tokenAddress: "96rXgCFy1Er49169XoKHkeLiKC2k4bTy1641q1TVrMm2",
|
|
51087
|
+
tokenName: "SolBlaze Validator",
|
|
51088
|
+
tokenSymbol: "SOLBLAZE"
|
|
51089
|
+
},
|
|
51090
|
+
{
|
|
51091
|
+
bankAddress: "J9trpcrVdFjVNg6VFrdF1XPGgjftQKZhbbWsxertdv9V",
|
|
51092
|
+
validatorVoteAccount: "FACqsS19VScz8oo2YhdMg35EsAy6xsCZ9Y58eJXGv8QJ",
|
|
51093
|
+
tokenAddress: "AH6fxpHS2gtMtJgBy8y8pEAPkqyop2pSugF6REs9NaTp",
|
|
51094
|
+
tokenName: "Lantern",
|
|
51095
|
+
tokenSymbol: "LNTRN"
|
|
51096
|
+
},
|
|
51097
|
+
{
|
|
51098
|
+
bankAddress: "EGTfrYiuWpPPZ4yfY9tCxnK6QMkY7pzVie9DxK772iGe",
|
|
51099
|
+
validatorVoteAccount: "EfnywDKqArxK6N6FS9ctsuzNdxfx3pzfXEQE5EevQ1SV",
|
|
51100
|
+
tokenAddress: "FcXEwHku68ZquqtSj1eSWS1SVWkhAZSyb4usfpiuEJAL",
|
|
51101
|
+
tokenName: "PROJECT SUPER",
|
|
51102
|
+
tokenSymbol: "SUPER"
|
|
51103
|
+
},
|
|
51104
|
+
{
|
|
51105
|
+
bankAddress: "A5e7UTE3g11ZfKgftqRCvxAgcDuFGyeDjMka96zJWSWe",
|
|
51106
|
+
validatorVoteAccount: "3ZUQekqiZoybB57y49eqtvSaoonqDwuNbeqEGwN88JkQ",
|
|
51107
|
+
tokenAddress: "F1XPjtpsEy23Q7po4JkWjp1jkDZcvFYSrqD8TR1YL3EF",
|
|
51108
|
+
tokenName: "Paws",
|
|
51109
|
+
tokenSymbol: "PAWS"
|
|
51110
|
+
},
|
|
51111
|
+
{
|
|
51112
|
+
bankAddress: "91jkdp4cF8vCDhjwude3SGSGrmVWFk5vTAtR6fsGVAfy",
|
|
51113
|
+
validatorVoteAccount: "gangtRyGPTvYWb8K3xS2feJQaCks4iJ7rytFUPtVqSY",
|
|
51114
|
+
tokenAddress: "6ZS7ZVDw91BVAC8gsz3SZBSeVeF2GtXtL2BHK31Kvyjm",
|
|
51115
|
+
tokenName: "Lotus Validator",
|
|
51116
|
+
tokenSymbol: "LOTUS"
|
|
51117
|
+
},
|
|
51118
|
+
{
|
|
51119
|
+
bankAddress: "72BS34HkCgq8RWQR7kuVVmiJMtKqSxG4CHX6ZXpSCwg7",
|
|
51120
|
+
validatorVoteAccount: "oRAnGeU5h8h2UkvbfnE5cjXnnAa4rBoaxmS4kbFymSe",
|
|
51121
|
+
tokenAddress: "9yF8pXctzicum2P73uuk4Dhqf2MVz6tzRAe8THGXCJcp",
|
|
51122
|
+
tokenName: "Orangefin Ventures",
|
|
51123
|
+
tokenSymbol: "ORANGEFIN"
|
|
51124
|
+
},
|
|
51125
|
+
{
|
|
51126
|
+
bankAddress: "8F4DsU3NMFunUxBZkWrpYR8zwhAfoAt7QuiEPMtyhWvX",
|
|
51127
|
+
validatorVoteAccount: "3xjfK9C9YNcta8MvK1US4sQ3bc6DEjoJoR3qLExGf9xE",
|
|
51128
|
+
tokenAddress: "Akib1NYJzzh9HkiDH41S2LUefUmR1bKsk65xgqUcW5C5",
|
|
51129
|
+
tokenName: "pico\u{1F644}.sol",
|
|
51130
|
+
tokenSymbol: "PICO"
|
|
51131
|
+
},
|
|
51132
|
+
{
|
|
51133
|
+
bankAddress: "GdtggomQth6cxuYPdiVhBbcX7VC9rnDDwLMfxipxE2Po",
|
|
51134
|
+
validatorVoteAccount: "oPaLTmyvoUhW26QCMwLA5JNUeBYy72PDpFoXQF8SeX4",
|
|
51135
|
+
tokenAddress: "C71A3W7g5XALUNwTDWTwHX3qhfypaYZ41aNZjBpcaC9D",
|
|
51136
|
+
tokenName: "Temporal Opal",
|
|
51137
|
+
tokenSymbol: "OPAL"
|
|
51138
|
+
},
|
|
51139
|
+
{
|
|
51140
|
+
bankAddress: "5sJCKePwAhyD3mzrzLRDM2PkFMc85nnvvarxHLsvWvpg",
|
|
51141
|
+
validatorVoteAccount: "9jYFwBfbjYmvasFbJyES9apLJDTkwtbgSDRWanHEvcRw",
|
|
51142
|
+
tokenAddress: "Hj69K1WbnfZFipLbrzdxgGhDqCR47q48bN5nUHt6xQZo",
|
|
51143
|
+
tokenName: "WATCHTOWER",
|
|
51144
|
+
tokenSymbol: "WATCHTOWER"
|
|
51145
|
+
},
|
|
51146
|
+
{
|
|
51147
|
+
bankAddress: "3F3QXT3BtkegaBfFjn2odKLurFYLHJHJ99xKV2TRTvrk",
|
|
51148
|
+
validatorVoteAccount: "6JfBwvcz5QUKQJ37BMKTLrf968DDJBtwoZLw19aHwFtQ",
|
|
51149
|
+
tokenAddress: "8FqX86cQofBHReetZgxrxxvzN4iqMVsj2hbiv7pj2h73",
|
|
51150
|
+
tokenName: "Spectrum Staking",
|
|
51151
|
+
tokenSymbol: "SPECTRUM"
|
|
51152
|
+
},
|
|
51153
|
+
{
|
|
51154
|
+
bankAddress: "CFmvdtEPQJPVqS1QRkeRcdQm2itAPk6k8hSJbmt88Sjc",
|
|
51155
|
+
validatorVoteAccount: "Haz7b47sZBpxh9SwggGndN3fAyNQ1S949BPdxWXS3ab6",
|
|
51156
|
+
tokenAddress: "38ZUTefZnKSUJU3wxpUe3xpiw2j5WQPnmzSTNbS1JqLA",
|
|
51157
|
+
tokenName: "Temporal Emerald",
|
|
51158
|
+
tokenSymbol: "EMERALD"
|
|
51159
|
+
},
|
|
51160
|
+
{
|
|
51161
|
+
bankAddress: "CmBDHSVuodmUnanbBVFvY9cauLeosbdFQn9bJANMVYUG",
|
|
51162
|
+
validatorVoteAccount: "mintrNtxN3PhAB45Pt41XqyKghTTpqcoBkQTZqh96iR",
|
|
51163
|
+
tokenAddress: "GxGmv7s7s2co3pLZukns946fr5zmR8c5buWRD9prGd6v",
|
|
51164
|
+
tokenName: "Hanabi Staking",
|
|
51165
|
+
tokenSymbol: "haSOLmrgn"
|
|
51166
|
+
},
|
|
51167
|
+
{
|
|
51168
|
+
bankAddress: "7bLfrb4fWVYkVpZ9rg7dBUwKRAqLyiivCW4ahMMGcKyS",
|
|
51169
|
+
validatorVoteAccount: "76DafWkJ6pGK2hoD41HjrM4xTBhfKqrDYDazv13n5ir1",
|
|
51170
|
+
tokenAddress: "GT7n9uZbYzHv52YqDBowtZ5ZVW91umaBQTNPFQNeLUpR",
|
|
51171
|
+
tokenName: "Solana Japan Validator",
|
|
51172
|
+
tokenSymbol: "SolJAPAn"
|
|
51173
|
+
},
|
|
51174
|
+
{
|
|
51175
|
+
bankAddress: "6q5DB86DhCBQt5bqzZwgopV8EA96aCnngu5ebR1ooDFq",
|
|
51176
|
+
validatorVoteAccount: "Cue647T8jgwpRSDUb8ttTYx7NiEfJCRZNiiw1qmchXsG",
|
|
51177
|
+
tokenAddress: "EAR6LenhNstHxR9289rWakm82WgLJYvHD7NawfXtuyUx",
|
|
51178
|
+
tokenName: "KIWAMI",
|
|
51179
|
+
tokenSymbol: "KIWAMI"
|
|
51180
|
+
},
|
|
51181
|
+
{
|
|
51182
|
+
bankAddress: "GLSCJ39N82Xo21621jMheinvjQLrBrkG7gzo2C5L1y6y",
|
|
51183
|
+
validatorVoteAccount: "7emL18Bnve7wbYE9Az7vYJjikxN6YPU81igf6rVU5FN8",
|
|
51184
|
+
tokenAddress: "EQuMUgLZArKwWUk6uGPmTGYUgNbfgJrbBaNR7CQyZ5uf",
|
|
51185
|
+
tokenName: "Temporal Topaz",
|
|
51186
|
+
tokenSymbol: "TOPAZ"
|
|
51187
|
+
},
|
|
51188
|
+
{
|
|
51189
|
+
bankAddress: "4irzCCsU53ffh9XB7NxGzbbHjvSR7FTfPbn6KoXkt7kX",
|
|
51190
|
+
validatorVoteAccount: "2iWXwF2Q5W6o7yntV2mkbxncB4rYHnX61y3NU8a8EFMJ",
|
|
51191
|
+
tokenAddress: "14Pets6QpE9iXKkXg8Ri4GcDazRMfWR3guM6LZXnFChc",
|
|
51192
|
+
tokenName: "Bull Moose SOL",
|
|
51193
|
+
tokenSymbol: "bmsSOL"
|
|
51194
|
+
},
|
|
51195
|
+
{
|
|
51196
|
+
bankAddress: "C96do7nkEaaFjHq8jHzPpyPTdJSea5xEGwxDzDSepCzf",
|
|
51197
|
+
validatorVoteAccount: "voteRnv6PBzmiGP8NicWtQiqEJTwKKq2SxtqtdLUJjd",
|
|
51198
|
+
tokenAddress: "3YEDiJ4r4xRGNhq6nudRnkwrdKHG7PAtDim24CjTMtBH",
|
|
51199
|
+
tokenName: "diman",
|
|
51200
|
+
tokenSymbol: "DIMAN"
|
|
51201
|
+
},
|
|
51202
|
+
{
|
|
51203
|
+
bankAddress: "9dZiyG51FBR4BWpAs69XbDpr7GfVAEB1ZB89v38maV36",
|
|
51204
|
+
validatorVoteAccount: "Simpj3KyRQmpRkXuBvCQFS7DBBG6vqw93SkZb9UD1hp",
|
|
51205
|
+
tokenAddress: "77YLpVLQXr2KU66GM2JykbT9g5du7LarWgehbWD3CJaB",
|
|
51206
|
+
tokenName: "SIMPDIGIT",
|
|
51207
|
+
tokenSymbol: "SIMPDIGIT"
|
|
51208
|
+
},
|
|
51209
|
+
{
|
|
51210
|
+
bankAddress: "2foqT8wWzWRduyV37uRdj81DijkNMKzYD3D6JPfir7La",
|
|
51211
|
+
validatorVoteAccount: "48oxpSHQkM4sdXUY9NQ8KnEtebzZbyk8uUT7JRdVQNuf",
|
|
51212
|
+
tokenAddress: "42m7Ygk5VxREdKfcFrsH1HnuoqCke8BcVcxNeywMCfp2",
|
|
51213
|
+
tokenName: "Infinite Lux",
|
|
51214
|
+
tokenSymbol: "LUX"
|
|
51215
|
+
},
|
|
51216
|
+
{
|
|
51217
|
+
bankAddress: "FsdWEJzHXkUXejWnb7c1p9UJtF69hVWQNNoakjoXyRCJ",
|
|
51218
|
+
validatorVoteAccount: "4AUED4uj6nSTuANzaAUnGBPJQRmhpDYDwoWJNkoUUBBW",
|
|
51219
|
+
tokenAddress: "CiyQTfHJ9PbTwC7TGf4pXZk8szcWGJ8TeFhhCuUwybqi",
|
|
51220
|
+
tokenName: "Anagram",
|
|
51221
|
+
tokenSymbol: "ANAGRAM"
|
|
51222
|
+
},
|
|
51223
|
+
{
|
|
51224
|
+
bankAddress: "2hs1pHAzDWGqnn1d8VQkc8bZRfQ45grYvzfau8dnWFUk",
|
|
51225
|
+
validatorVoteAccount: "2NxEEbhqqj1Qptq5LXLbDTP5tLa9f7PqkU8zNgxbGU9P",
|
|
51226
|
+
tokenAddress: "9yQLxEzusZ7QiZNafDNdzbEaTCPuJToGjMhLRJtZbgsd",
|
|
51227
|
+
tokenName: "NANSEN",
|
|
51228
|
+
tokenSymbol: "NANSEN"
|
|
51229
|
+
},
|
|
51230
|
+
{
|
|
51231
|
+
bankAddress: "FCi8unSVCwJd3QkrhTtv6LTTjw1c4zV65D5cG5N1rAG6",
|
|
51232
|
+
validatorVoteAccount: "Va1idkzkB6LEmVFmxWbWU8Ao9qehC62Tjmf68L3uYKj",
|
|
51233
|
+
tokenAddress: "AExKb8oJ6mGPYJUyfiX49DMMi226h2AnWeG1G6neQBEz",
|
|
51234
|
+
tokenName: "VALIDATOR",
|
|
51235
|
+
tokenSymbol: "VALID"
|
|
51236
|
+
},
|
|
51237
|
+
{
|
|
51238
|
+
bankAddress: "HzS8RqaQ5syk6EHbVi7h9rFYN48PpxykUXEs6w9wNfNP",
|
|
51239
|
+
validatorVoteAccount: "sTach38ebT8jnGH8i2D1g8NDAS6An19whVMnSSWPXt4",
|
|
51240
|
+
tokenAddress: "AFDVYBqxADagPfN9DdbrNrf9zZqugub7CV4kUJEUrK6J",
|
|
51241
|
+
tokenName: "Stache Node",
|
|
51242
|
+
tokenSymbol: "STACHE"
|
|
51243
|
+
},
|
|
51244
|
+
{
|
|
51245
|
+
bankAddress: "9Hs4E6ACNw6Hmwjvm1duXzbaWmvXxSxN11agw4updEn1",
|
|
51246
|
+
validatorVoteAccount: "EtMSc3MvcDXUr6ChK5GxyFVwTxYA3zqP5XzjE9jwKvSV",
|
|
51247
|
+
tokenAddress: "ENKFyZQZHzNNSxcKYoaVsNLi2xoGPoStZH4A9xxezjbC",
|
|
51248
|
+
tokenName: "Mad Lads CN",
|
|
51249
|
+
tokenSymbol: "MadLadsCN"
|
|
51250
|
+
},
|
|
51251
|
+
{
|
|
51252
|
+
bankAddress: "4watsWcjTBAwsrZpArwQbnNX4bQ1yeHBxgdbrGT4eMu9",
|
|
51253
|
+
validatorVoteAccount: "EARNynHRWg6GfyJCmrrizcZxARB3HVzcaasvNa8kBS72",
|
|
51254
|
+
tokenAddress: "8fhkWcm2n28JuadzY7mRR8FFDZZfnaPfWgw7pLNVZCbE",
|
|
51255
|
+
tokenName: "Solana Compass Stake",
|
|
51256
|
+
tokenSymbol: "compaStake"
|
|
51257
|
+
},
|
|
51258
|
+
{
|
|
51259
|
+
bankAddress: "9d7MTvcz1VMB1rK6H73quMxkR26dLPz5HDaac2eGRjQx",
|
|
51260
|
+
validatorVoteAccount: "nymsndUdAZyUPpWYz5VEg8Ghj9cFvwTRgciLogpmYaQ",
|
|
51261
|
+
tokenAddress: "FWFeaqpkgDr3ejVSY3HjiUmUg3u9fcr5d66HvimnDLWE",
|
|
51262
|
+
tokenName: "Hypo Nyms",
|
|
51263
|
+
tokenSymbol: "NYMS"
|
|
51264
|
+
},
|
|
51265
|
+
{
|
|
51266
|
+
bankAddress: "6V4vCK3n3JVncfpS16mW8ceLoNPatvu61pKxFmWx8adi",
|
|
51267
|
+
validatorVoteAccount: "BT8LZUvQVwFHRGw2Dwv7UeqDUq7btfjegLpuz5bwgziD",
|
|
51268
|
+
tokenAddress: "9YRS7Stf9dVibTT1M4uVEAuRMcoS4MH1QxqXy9Lssrab",
|
|
51269
|
+
tokenName: "private",
|
|
51270
|
+
tokenSymbol: "private"
|
|
51271
|
+
},
|
|
51272
|
+
{
|
|
51273
|
+
bankAddress: "CK8qRAcmvkDXaqX2S5GkgTCZT5pCz34me1neQhpJYe1Z",
|
|
51274
|
+
validatorVoteAccount: "Ac1beBKixfNdrTAac7GRaTsJTxLyvgGvJjvy4qQfvyfc",
|
|
51275
|
+
tokenAddress: "DLTAbTL5NXhbqX6LX3ie3tf52pdtGpxe2DrZUr1RhgY6",
|
|
51276
|
+
tokenName: "Stronghold",
|
|
51277
|
+
tokenSymbol: "Stronghold"
|
|
51278
|
+
},
|
|
51279
|
+
{
|
|
51280
|
+
bankAddress: "H6CT1aiCgSNw9S6aq38npEhdoN2UPhSKe8Lj9fQqqjuu",
|
|
51281
|
+
validatorVoteAccount: "FREEL1BCzmPpNneC7FHCtBqzeWYrHRbtisFvi4N8XUP9",
|
|
51282
|
+
tokenAddress: "AKFuMoM5rjSpQSL4p6TBoc7D4dmEem9QrHhuSDCBYyZ8",
|
|
51283
|
+
tokenName: "Ross",
|
|
51284
|
+
tokenSymbol: "Ross"
|
|
51285
|
+
},
|
|
51286
|
+
{
|
|
51287
|
+
bankAddress: "G46aHuakgStymbE2WsLbja61mH5UXBPdSdpwf6Ci3saG",
|
|
51288
|
+
validatorVoteAccount: "mnvkHm47ZmRKoSWuQZAfXLRiDPiKCq8PWkMWrp1Wwqe",
|
|
51289
|
+
tokenAddress: "Cq9S5UB9BviPn5yoGkEDk3m7neQag4KJnhPWGyuev9W8",
|
|
51290
|
+
tokenName: "gripto staked sol",
|
|
51291
|
+
tokenSymbol: "GRIPTO"
|
|
51292
|
+
},
|
|
51293
|
+
{
|
|
51294
|
+
bankAddress: "75UmeEMdqVnGn3JHx8yVZEn7viybJ73XYSjhYCYfyhp2",
|
|
51295
|
+
validatorVoteAccount: "4m1PbxzwLdUnEwog3T9UKxgjktgriHgE1CfAhMqDw7Xx",
|
|
51296
|
+
tokenAddress: "432SogPNunjZMneDV6goZ8ZcCQz282GxoSJ4rwqx95pT",
|
|
51297
|
+
tokenName: "kumasol",
|
|
51298
|
+
tokenSymbol: "kumasol"
|
|
51299
|
+
},
|
|
51300
|
+
{
|
|
51301
|
+
bankAddress: "3zk6EmXANYQK12bwy9dySRAM4cT2vT5cDcAB79j8G33B",
|
|
51302
|
+
validatorVoteAccount: "HvsD9L5t62MGv3QBD2K7xjkipGYr9UZN7BtsW8NuSPpg",
|
|
51303
|
+
tokenAddress: "5vmwd6JHDCmX9W2XT1n2QpvYGA2kk4Xf7qWSayDU6caT",
|
|
51304
|
+
tokenName: "ArgenTerraSOL",
|
|
51305
|
+
tokenSymbol: "atSOL"
|
|
51306
|
+
},
|
|
51307
|
+
{
|
|
51308
|
+
bankAddress: "4C2vPweGNpiE6kTEbYvcbUBHNWxrn4ErQYaqWm5zDexx",
|
|
51309
|
+
validatorVoteAccount: "FnAPJkzf19s87sm24Qhv6bHZMZvZ43gjNUBRgjwXpD4v",
|
|
51310
|
+
tokenAddress: "6q4kVnwUpkE3i7W32dqaX6V12pbsrCnMqZ7TWz9yp1m5",
|
|
51311
|
+
tokenName: "BLOCKPORT",
|
|
51312
|
+
tokenSymbol: "BPT"
|
|
51313
|
+
},
|
|
51314
|
+
{
|
|
51315
|
+
bankAddress: "E5hZu5QQ1pRmGvyS4JHGXVQwzdUPaYM4yEiNKr64YzyG",
|
|
51316
|
+
validatorVoteAccount: "nfGcSJkP35SkPa5475iBChmq1UNcj7JE1uQHrrasymm",
|
|
51317
|
+
tokenAddress: "AQpQoJ3tJKGH9Yn8GSzoUsVcHPJjj3xYfQFp9XVr74F6",
|
|
51318
|
+
tokenName: "Test01",
|
|
51319
|
+
tokenSymbol: "TEST01"
|
|
51320
|
+
},
|
|
51321
|
+
{
|
|
51322
|
+
bankAddress: "3VCkXWAmE5DSwYRpqGFnkUz7vvD2RKbhFvrhzLuE8msu",
|
|
51323
|
+
validatorVoteAccount: "abc1zP7ihWsgQW8z5YmfQNqMckJE5Dfx8fwUNMNVNkY",
|
|
51324
|
+
tokenAddress: "BNisp3omkr6Rg5nHESWafjUbeCpGPy6MYq1iRJRgSAsh",
|
|
51325
|
+
tokenName: "ALGO STAKE",
|
|
51326
|
+
tokenSymbol: "ALGO"
|
|
51327
|
+
},
|
|
51328
|
+
{
|
|
51329
|
+
bankAddress: "7BHHMWw3P1AyebLhX9A8wnDeeGy8jgFXqqHuEZt7BVmW",
|
|
51330
|
+
validatorVoteAccount: "8Pep3GmYiijRALqrMKpez92cxvF4YPTzoZg83uXh14pW",
|
|
51331
|
+
tokenAddress: "zBH13AzXYCqHZKS8NGa4KR8zQhWiyvFdDY15nmfrHgS",
|
|
51332
|
+
tokenName: "8Pep",
|
|
51333
|
+
tokenSymbol: "8Pep"
|
|
51334
|
+
},
|
|
51335
|
+
{
|
|
51336
|
+
bankAddress: "9QWUatjtJtc98yts4ufWnmNeaWQRmaaLjFwbK3iMdS47",
|
|
51337
|
+
validatorVoteAccount: "CatzoSMUkTRidT5DwBxAC2pEtnwMBTpkCepHkFgZDiqb",
|
|
51338
|
+
tokenAddress: "98B1NMLYaNJQNxiQGr53vbjNFMNTYFmDqoCgj7qD9Vhm",
|
|
51339
|
+
tokenName: "JUPITER ",
|
|
51340
|
+
tokenSymbol: "JUPITER"
|
|
51341
|
+
},
|
|
51342
|
+
{
|
|
51343
|
+
bankAddress: "5q1wJkGqqRh6mSBtjG8sfjBsgJSGdA2QoXTWv4UQbHGk",
|
|
51344
|
+
validatorVoteAccount: "shft7Fry1js37Hm9wq4dfwcZSp2DyKszeWMvEpjYCQ1",
|
|
51345
|
+
tokenAddress: "C1KwBJZNwUaodUcP5kXqD52NCuZzThNAG2cw3vt5H6iE",
|
|
51346
|
+
tokenName: "BLUESHIFT",
|
|
51347
|
+
tokenSymbol: "SHIFT"
|
|
51348
|
+
},
|
|
51349
|
+
{
|
|
51350
|
+
bankAddress: "FZaHyfg9hmNMKpfUJ474wNKPaPdXMpnJouasKnndECiZ",
|
|
51351
|
+
validatorVoteAccount: "DdCNGDpP7qMgoAy6paFzhhak2EeyCZcgjH7ak5u5v28m",
|
|
51352
|
+
tokenAddress: "PhxXAYTkFZS23ZWvFcz6H6Uq4VnVBMa6hniiAyudjaW",
|
|
51353
|
+
tokenName: "KILN1",
|
|
51354
|
+
tokenSymbol: "KILN1"
|
|
51355
|
+
},
|
|
51356
|
+
{
|
|
51357
|
+
bankAddress: "5CBocarwfJeWGNozGemWktRYSz6kPikRPdfH8ZHSFrsg",
|
|
51358
|
+
validatorVoteAccount: "8zuMRTXThoPTTPLLvaiKiJshLLCqGMt9BdRjjCL19xBc",
|
|
51359
|
+
tokenAddress: "BDsEuxFWznAP5cUCannnfjyjDtTwqN57CkGfDbjx2nNZ",
|
|
51360
|
+
tokenName: "DawnLabs",
|
|
51361
|
+
tokenSymbol: "DawnLabs"
|
|
51362
|
+
},
|
|
51363
|
+
{
|
|
51364
|
+
bankAddress: "9ivswG37QpCUmkPkLMpRZT7PMyP64V9dDpZdteM254ec",
|
|
51365
|
+
validatorVoteAccount: "gaToR246dheK1DGAMEqxMdBJZwU4qFyt7DzhSwAHFWF",
|
|
51366
|
+
tokenAddress: "TjA2rtxoUFzyPVAw35VQGEQnNXiwcmNjKSk29nmkq1P",
|
|
51367
|
+
tokenName: "Valigator Open",
|
|
51368
|
+
tokenSymbol: "Valigator"
|
|
51369
|
+
}
|
|
51370
|
+
];
|
|
51371
|
+
|
|
51372
|
+
// src/services/native-stake/utils/metadata.utils.ts
|
|
51373
|
+
var _metadataMap = null;
|
|
51374
|
+
var _voteAccountByBank = null;
|
|
51375
|
+
function getStakedBankMetadataMap() {
|
|
51376
|
+
if (!_metadataMap) {
|
|
51377
|
+
_metadataMap = /* @__PURE__ */ new Map();
|
|
51378
|
+
for (const entry of STAKED_BANK_METADATA_JSON) {
|
|
51379
|
+
_metadataMap.set(entry.bankAddress, entry);
|
|
51380
|
+
}
|
|
51381
|
+
}
|
|
51382
|
+
return _metadataMap;
|
|
51383
|
+
}
|
|
51384
|
+
function getValidatorVoteAccountByBank() {
|
|
51385
|
+
if (!_voteAccountByBank) {
|
|
51386
|
+
_voteAccountByBank = {};
|
|
51387
|
+
for (const entry of STAKED_BANK_METADATA_JSON) {
|
|
51388
|
+
_voteAccountByBank[entry.bankAddress] = entry.validatorVoteAccount;
|
|
51389
|
+
}
|
|
51390
|
+
}
|
|
51391
|
+
return _voteAccountByBank;
|
|
51392
|
+
}
|
|
50628
51393
|
async function getKaminoMetadata(options) {
|
|
50629
51394
|
const kaminoBanks = options.banks.filter((b) => b.config.assetTag === 3 /* KAMINO */);
|
|
50630
51395
|
const DEFAULT_PUBKEY = PublicKey.default;
|
|
@@ -53073,6 +53838,66 @@ var MarginfiAccountWrapper = class {
|
|
|
53073
53838
|
return this.account.getHealthCheckAccounts(this.client.bankMap, mandatoryBanks, excludedBanks);
|
|
53074
53839
|
}
|
|
53075
53840
|
// ----------------------------------------------------------------------------
|
|
53841
|
+
// Native stake actions
|
|
53842
|
+
// Note: These call standalone action functions directly rather than routing
|
|
53843
|
+
// through this.account because they interact with the SPL stake pool program,
|
|
53844
|
+
// not the marginfi program. No MarginfiAccount state is needed.
|
|
53845
|
+
// ----------------------------------------------------------------------------
|
|
53846
|
+
/**
|
|
53847
|
+
* Creates a transaction to mint LST from a native stake account.
|
|
53848
|
+
*
|
|
53849
|
+
* Converts a native stake account (or a portion of it) into LST tokens
|
|
53850
|
+
* by depositing the stake into the single-validator pool.
|
|
53851
|
+
*
|
|
53852
|
+
* @param amount - SOL amount to convert (in UI units)
|
|
53853
|
+
* @param stakeAccountPk - The stake account to convert
|
|
53854
|
+
* @param validator - The validator vote account
|
|
53855
|
+
*/
|
|
53856
|
+
async makeMintStakedLstTx(amount, stakeAccountPk, validator) {
|
|
53857
|
+
return makeMintStakedLstTx({
|
|
53858
|
+
amount,
|
|
53859
|
+
authority: this.authority,
|
|
53860
|
+
stakeAccountPk,
|
|
53861
|
+
validator,
|
|
53862
|
+
connection: this.client.program.provider.connection,
|
|
53863
|
+
luts: this.client.addressLookupTables
|
|
53864
|
+
});
|
|
53865
|
+
}
|
|
53866
|
+
/**
|
|
53867
|
+
* Creates a transaction to redeem LST tokens back to a native stake account.
|
|
53868
|
+
*
|
|
53869
|
+
* Burns LST tokens and withdraws the underlying stake into a new stake account.
|
|
53870
|
+
*
|
|
53871
|
+
* @param amount - LST amount to redeem (in UI units)
|
|
53872
|
+
* @param validator - The validator vote account
|
|
53873
|
+
*/
|
|
53874
|
+
async makeRedeemStakedLstTx(amount, validator) {
|
|
53875
|
+
return makeRedeemStakedLstTx({
|
|
53876
|
+
amount,
|
|
53877
|
+
authority: this.authority,
|
|
53878
|
+
validator,
|
|
53879
|
+
connection: this.client.program.provider.connection,
|
|
53880
|
+
luts: this.client.addressLookupTables
|
|
53881
|
+
});
|
|
53882
|
+
}
|
|
53883
|
+
/**
|
|
53884
|
+
* Creates a transaction to merge two stake accounts.
|
|
53885
|
+
*
|
|
53886
|
+
* Both accounts must share the same authorized staker/withdrawer and vote account.
|
|
53887
|
+
*
|
|
53888
|
+
* @param sourceStakeAccount - The stake account to merge from (will be consumed)
|
|
53889
|
+
* @param destinationStakeAccount - The stake account to merge into
|
|
53890
|
+
*/
|
|
53891
|
+
async makeMergeStakeAccountsTx(sourceStakeAccount, destinationStakeAccount) {
|
|
53892
|
+
return makeMergeStakeAccountsTx({
|
|
53893
|
+
authority: this.authority,
|
|
53894
|
+
sourceStakeAccount,
|
|
53895
|
+
destinationStakeAccount,
|
|
53896
|
+
connection: this.client.program.provider.connection,
|
|
53897
|
+
luts: this.client.addressLookupTables
|
|
53898
|
+
});
|
|
53899
|
+
}
|
|
53900
|
+
// ----------------------------------------------------------------------------
|
|
53076
53901
|
// Helper methods
|
|
53077
53902
|
// ----------------------------------------------------------------------------
|
|
53078
53903
|
/**
|
|
@@ -53334,7 +54159,6 @@ var Project0Client = class _Project0Client {
|
|
|
53334
54159
|
assetShareMultiplierByBank.set(bank.address.toBase58(), new BigNumber3(1));
|
|
53335
54160
|
break;
|
|
53336
54161
|
case 2 /* STAKED */:
|
|
53337
|
-
assetShareMultiplierByBank.set(bank.address.toBase58(), new BigNumber3(1));
|
|
53338
54162
|
break;
|
|
53339
54163
|
case 0 /* DEFAULT */:
|
|
53340
54164
|
case 1 /* SOL */:
|
|
@@ -53343,6 +54167,56 @@ var Project0Client = class _Project0Client {
|
|
|
53343
54167
|
break;
|
|
53344
54168
|
}
|
|
53345
54169
|
});
|
|
54170
|
+
const stakedBanks = banksArray.filter((b) => b.config.assetTag === 2 /* STAKED */);
|
|
54171
|
+
if (stakedBanks.length > 0) {
|
|
54172
|
+
const metadataMap = getStakedBankMetadataMap();
|
|
54173
|
+
const stakedBankAddresses = [];
|
|
54174
|
+
const poolStakeAddresses = [];
|
|
54175
|
+
const lstMintAddresses = [];
|
|
54176
|
+
for (const bank of stakedBanks) {
|
|
54177
|
+
const metadata = metadataMap.get(bank.address.toBase58());
|
|
54178
|
+
if (!metadata) {
|
|
54179
|
+
assetShareMultiplierByBank.set(bank.address.toBase58(), new BigNumber3(1));
|
|
54180
|
+
continue;
|
|
54181
|
+
}
|
|
54182
|
+
const pool = findPoolAddress(new PublicKey(metadata.validatorVoteAccount));
|
|
54183
|
+
stakedBankAddresses.push(bank.address.toBase58());
|
|
54184
|
+
poolStakeAddresses.push(findPoolStakeAddress(pool));
|
|
54185
|
+
lstMintAddresses.push(findPoolMintAddress(pool));
|
|
54186
|
+
}
|
|
54187
|
+
if (stakedBankAddresses.length > 0) {
|
|
54188
|
+
const allAddresses = [
|
|
54189
|
+
...poolStakeAddresses.map((a) => a.toBase58()),
|
|
54190
|
+
...lstMintAddresses.map((a) => a.toBase58())
|
|
54191
|
+
];
|
|
54192
|
+
const accountInfos = await chunkedGetRawMultipleAccountInfoOrdered(
|
|
54193
|
+
connection,
|
|
54194
|
+
allAddresses
|
|
54195
|
+
);
|
|
54196
|
+
const poolStakeInfos = accountInfos.slice(0, poolStakeAddresses.length);
|
|
54197
|
+
const lstMintInfos = accountInfos.slice(poolStakeAddresses.length);
|
|
54198
|
+
for (let i = 0; i < stakedBankAddresses.length; i++) {
|
|
54199
|
+
const bankAddr = stakedBankAddresses[i];
|
|
54200
|
+
const poolStakeInfo = poolStakeInfos[i];
|
|
54201
|
+
const lstMintInfo = lstMintInfos[i];
|
|
54202
|
+
if (!poolStakeInfo || !lstMintInfo) {
|
|
54203
|
+
assetShareMultiplierByBank.set(bankAddr, new BigNumber3(1));
|
|
54204
|
+
continue;
|
|
54205
|
+
}
|
|
54206
|
+
const stakeLamports = poolStakeInfo.lamports;
|
|
54207
|
+
const supplyBuffer = lstMintInfo.data.slice(36, 44);
|
|
54208
|
+
const lstMintSupply = Number(Buffer.from(supplyBuffer).readBigUInt64LE(0));
|
|
54209
|
+
if (lstMintSupply === 0) {
|
|
54210
|
+
assetShareMultiplierByBank.set(bankAddr, new BigNumber3(1));
|
|
54211
|
+
continue;
|
|
54212
|
+
}
|
|
54213
|
+
const LAMPORTS_PER_SOL5 = 1e9;
|
|
54214
|
+
const adjustedStake = Math.max(stakeLamports - LAMPORTS_PER_SOL5, 0);
|
|
54215
|
+
const multiplier = new BigNumber3(adjustedStake).dividedBy(lstMintSupply);
|
|
54216
|
+
assetShareMultiplierByBank.set(bankAddr, multiplier);
|
|
54217
|
+
}
|
|
54218
|
+
}
|
|
54219
|
+
}
|
|
53346
54220
|
const emodePairs = getEmodePairs(banksArray);
|
|
53347
54221
|
return new _Project0Client(
|
|
53348
54222
|
program,
|
|
@@ -53384,6 +54258,6 @@ var EmodeSettings = class _EmodeSettings {
|
|
|
53384
54258
|
}
|
|
53385
54259
|
};
|
|
53386
54260
|
|
|
53387
|
-
export { ADDRESS_LOOKUP_TABLE_FOR_GROUP, ADDRESS_LOOKUP_TABLE_FOR_SWAP, AccountFlags, AccountType, AssetTag, BUNDLE_TX_SIZE, Balance, Bank, BankConfig, BankConfigFlag, BankVaultType, DEFAULT_ORACLE_MAX_AGE, DISABLED_FLAG, EMPTY_HEALTH_CACHE, EmodeEntryFlags, EmodeFlags, EmodeImpactStatus, EmodeSettings, EmodeTag, FLASHLOAN_ENABLED_FLAG, HOURS_PER_YEAR, HealthCache, HealthCacheFlags, HealthCacheSimulationError, HealthCacheStatus, JUPITER_V6_PROGRAM, JUP_SWAP_LUT_PROGRAM_AUTHORITY_INDEX, LST_MINT, MARGINFI_IDL, MARGINFI_PROGRAM, MARGINFI_PROGRAM_STAGING, MARGINFI_PROGRAM_STAGING_ALT, MARGINFI_SPONSORED_SHARD_ID, MAX_CONFIDENCE_INTERVAL_RATIO, MAX_TX_SIZE, MAX_U64, MPL_METADATA_PROGRAM_ID, MarginRequirementType, MarginfiAccount, MarginfiAccountWrapper, MarginfiGroup, OperationalState, OracleSetup, PDA_BANK_EMISSIONS_AUTH_SEED, PDA_BANK_EMISSIONS_VAULT_SEED, PDA_BANK_FEE_STATE_SEED, PDA_BANK_FEE_VAULT_AUTH_SEED, PDA_BANK_FEE_VAULT_SEED, PDA_BANK_INSURANCE_VAULT_AUTH_SEED, PDA_BANK_INSURANCE_VAULT_SEED, PDA_BANK_LIQUIDITY_VAULT_AUTH_SEED, PDA_BANK_LIQUIDITY_VAULT_SEED, PDA_MARGINFI_ACCOUNT_SEED, PRIORITY_TX_SIZE, PYTH_PRICE_CONF_INTERVALS, PYTH_PUSH_ORACLE_ID, PYTH_SPONSORED_SHARD_ID, PriceBias, Project0Client, RiskTier, SINGLE_POOL_PROGRAM_ID, STAKE_CONFIG_ID, STAKE_PROGRAM_ID, SWB_PRICE_CONF_INTERVALS, SYSTEM_PROGRAM_ID, SYSVAR_CLOCK_ID, SYSVAR_RENT_ID, SYSVAR_STAKE_HISTORY_ID, TRANSFER_ACCOUNT_AUTHORITY_FLAG, TransactionArenaKeyMap, TransactionBuildingError, TransactionBuildingErrorCode, TransactionConfigMap, TransactionType, USDC_DECIMALS, USDC_MINT, WSOL_MINT, ZERO_ORACLE_KEY, accountFlagToBN, addOracleToBanksIx, addTransactionMetadata, adjustPriceComponent, aprToApy, apyToApr, balanceToDto, bankConfigRawToDto, bankConfigToBankConfigRaw, bankMetadataMapToDto, bankMetadataToDto, bankRawToDto, bigNumberToWrappedI80F48, bpsToPercentile, calculateApyFromInterest, calculateInterestFromApy, capConfidenceInterval, categorizePythBanks, checkBatchOracleCrankability, checkMultipleOraclesCrankability, chunkedGetRawMultipleAccountInfoOrdered, chunkedGetRawMultipleAccountInfoOrderedWithNulls, chunkedGetRawMultipleAccountInfos, composeRemainingAccounts, computeAccountValue, computeActiveEmodePairs, computeAssetHealthComponent, computeAssetUsdValue, computeBalanceUsdValue, computeBaseInterestRate, computeClaimedEmissions, computeClosePositionTokenAmount, computeEmodeImpacts, computeFreeCollateralFromBalances, computeFreeCollateralFromCache, computeHealthAccountMetas, computeHealthCacheStatus, computeHealthCheckAccounts, computeHealthComponentsFromBalances, computeHealthComponentsFromCache, computeHealthComponentsWithoutBiasFromBalances, computeInterestRates, computeLiabilityHealthComponent, computeLiabilityUsdValue, computeLiquidationPriceForBank, computeLoopingParams, computeLowestEmodeWeights, computeMaxBorrowForBank, computeMaxLeverage, computeMaxWithdrawForBank, computeNetApy, computeProjectedActiveBalancesNoCpi, computeProjectedActiveBanksNoCpi, computeQuantity, computeQuantityUi, computeRemainingCapacity, computeSmartCrank, computeTotalOutstandingEmissions, computeTvl, computeUsdValue, computeUtilizationRate, convertVoteAccCoeffsToBankCoeffs, createActiveEmodePairFromPairs, createEmptyBalance, decodeAccountRaw, decodeBankRaw, decodeInstruction, decompileV0Transaction, deriveBankEmissionsAuth, deriveBankEmissionsVault, deriveBankFeeVault, deriveBankFeeVaultAuthority, deriveBankInsuranceVault, deriveBankInsuranceVaultAuthority, deriveBankLiquidityVault, deriveBankLiquidityVaultAuthority, deriveFeeState, deriveMarginfiAccount, dtoToBalance, dtoToBank, dtoToBankConfig, dtoToBankConfigRaw, dtoToBankMetadata, dtoToBankMetadataMap, dtoToBankRaw, dtoToEmodeSettings, dtoToEmodeSettingsRaw, dtoToGroup, dtoToHealthCache, dtoToInterestRateConfig, dtoToMarginfiAccount, dtoToOraclePrice, dtoToValidatorStakeGroup, emodeSettingsRawToDto, extractPythOracleKeys, fetchBank, fetchBankIntegrationMetadata, fetchMarginfiAccountAddresses, fetchMarginfiAccountData, fetchMultipleBanks, fetchNativeStakeAccounts, fetchOracleData, fetchProgramForMints, fetchPythOracleData, fetchPythOraclePricesFromAPI, fetchPythOraclePricesFromChain, fetchStakeAccount, fetchStakePoolActiveStates, fetchStakePoolMev, fetchSwbOracleAccountsFromAPI, fetchSwbOracleAccountsFromChain, fetchSwbOracleData, fetchSwbOraclePricesFromAPI, fetchSwbOraclePricesFromCrossbar, findRandomAvailableAccountIndex, freezeBankConfigIx, getAccountKeys, getActiveAccountFlags, getActiveBalances, getActiveEmodeEntryFlags, getActiveEmodeFlags, getActiveHealthCacheFlags, getAssetQuantity, getAssetShares, getAssetWeight, getBalance, getBalanceUsdValueWithPriceBias, getBankVaultAuthority, getBankVaultSeeds, getBirdeyeFallbackPricesByFeedId, getBirdeyePricesForMints, getConfig, getDriftCTokenMultiplier, getDriftMetadata, getDriftStatesDto, getEmodePairs, getHealthCacheStatusDescription, getHealthSimulationTransactions, getJupLendFTokenMultiplier, getJupLendMetadata, getJupLendStatesDto, getJupiterSwapIxsForFlashloan, getKaminoCTokenMultiplier, getKaminoMetadata, getKaminoStatesDto, getLiabilityQuantity, getLiabilityShares, getLiabilityWeight, getOracleSourceFromBank, getOracleSourceFromOracleSetup, getOracleSourceNameFromKey, getPrice, getPriceWithConfidence, getTotalAssetQuantity, getTotalLiabilityQuantity, getTxSize, groupToDto, hasAccountFlag, hasEmodeEntryFlag, hasEmodeFlag, hasHealthCacheFlag, healthCacheToDto, isFlashloan, isV0Tx, isWeightedPrice, isWholePosition, makeAddPermissionlessStakedBankIx, makeBeginFlashLoanIx3 as makeBeginFlashLoanIx, makeBorrowIx3 as makeBorrowIx, makeBorrowTx, 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, makePoolAddBankIx3 as makePoolAddBankIx, makePoolConfigureBankIx3 as makePoolConfigureBankIx, makePriorityFeeIx, makePriorityFeeMicroIx, makePulseHealthIx2 as makePulseHealthIx, makeRefreshKaminoBanksIxs, makeRepayIx3 as makeRepayIx, makeRepayTx, makeRepayWithCollatTx, makeSetupIx, makeSmartCrankSwbFeedIx, makeSwapCollateralTx, makeSwapDebtTx, makeTxPriorityIx, makeUnwrapSolIx, makeUpdateDriftMarketIxs, makeUpdateJupLendRateIxs, makeUpdateSwbFeedIx, makeVersionedTransaction, makeWithdrawEmissionsIx, makeWithdrawIx3 as makeWithdrawIx, makeWithdrawTx, makeWrapSolIxs, mapBrokenFeedsToOraclePrices, mapPythBanksToOraclePrices, mapSwbBanksToOraclePrices, marginfiAccountToDto, nativeToUi, oraclePriceToDto, parseBalanceRaw, parseBankConfigRaw, parseBankRaw, parseEmodeSettingsRaw, parseEmodeTag, parseHealthCacheRaw, parseMarginfiAccountRaw, parseOperationalState, parseOracleSetup, parseOraclePriceData as parsePriceInfo, parseRiskTier, parseRpcPythPriceData, parseSwbOraclePriceData, partitionBanksByCrankability, resolveAmount, serializeBankConfigOpt, serializeInterestRateConfig, serializeOperationalState, serializeOracleSetup, serializeOracleSetupToIndex, serializeRiskTier, shortenAddress, simulateAccountHealthCache, simulateAccountHealthCacheWithFallback, simulateBundle, splitInstructionsToFitTransactions, toBankConfigDto, toBankDto, toBigNumber, toEmodeSettingsDto, toInterestRateConfigDto, toNumber, uiToNative, uiToNativeBigNumber, validatorStakeGroupToDto, wrappedI80F48toBigNumber };
|
|
54261
|
+
export { ADDRESS_LOOKUP_TABLE_FOR_GROUP, ADDRESS_LOOKUP_TABLE_FOR_SWAP, AccountFlags, AccountType, AssetTag, BUNDLE_TX_SIZE, Balance, Bank, BankConfig, BankConfigFlag, BankVaultType, DEFAULT_ORACLE_MAX_AGE, DISABLED_FLAG, EMPTY_HEALTH_CACHE, EmodeEntryFlags, EmodeFlags, EmodeImpactStatus, EmodeSettings, EmodeTag, FLASHLOAN_ENABLED_FLAG, HOURS_PER_YEAR, HealthCache, HealthCacheFlags, HealthCacheSimulationError, HealthCacheStatus, JUPITER_V6_PROGRAM, JUP_SWAP_LUT_PROGRAM_AUTHORITY_INDEX, LST_MINT, MARGINFI_IDL, MARGINFI_PROGRAM, MARGINFI_PROGRAM_STAGING, MARGINFI_PROGRAM_STAGING_ALT, MARGINFI_SPONSORED_SHARD_ID, MAX_CONFIDENCE_INTERVAL_RATIO, MAX_TX_SIZE, MAX_U64, MPL_METADATA_PROGRAM_ID, MarginRequirementType, MarginfiAccount, MarginfiAccountWrapper, MarginfiGroup, OperationalState, OracleSetup, PDA_BANK_EMISSIONS_AUTH_SEED, PDA_BANK_EMISSIONS_VAULT_SEED, PDA_BANK_FEE_STATE_SEED, PDA_BANK_FEE_VAULT_AUTH_SEED, PDA_BANK_FEE_VAULT_SEED, PDA_BANK_INSURANCE_VAULT_AUTH_SEED, PDA_BANK_INSURANCE_VAULT_SEED, PDA_BANK_LIQUIDITY_VAULT_AUTH_SEED, PDA_BANK_LIQUIDITY_VAULT_SEED, PDA_MARGINFI_ACCOUNT_SEED, PRIORITY_TX_SIZE, PYTH_PRICE_CONF_INTERVALS, PYTH_PUSH_ORACLE_ID, PYTH_SPONSORED_SHARD_ID, PriceBias, Project0Client, RiskTier, SINGLE_POOL_PROGRAM_ID, STAKE_CONFIG_ID, STAKE_PROGRAM_ID, SWB_PRICE_CONF_INTERVALS, SYSTEM_PROGRAM_ID, SYSVAR_CLOCK_ID, SYSVAR_RENT_ID, SYSVAR_STAKE_HISTORY_ID, TRANSFER_ACCOUNT_AUTHORITY_FLAG, TransactionArenaKeyMap, TransactionBuildingError, TransactionBuildingErrorCode, TransactionConfigMap, TransactionType, USDC_DECIMALS, USDC_MINT, WSOL_MINT, ZERO_ORACLE_KEY, accountFlagToBN, addOracleToBanksIx, addTransactionMetadata, adjustPriceComponent, aprToApy, apyToApr, balanceToDto, bankConfigRawToDto, bankConfigToBankConfigRaw, bankMetadataMapToDto, bankMetadataToDto, bankRawToDto, bigNumberToWrappedI80F48, bpsToPercentile, calculateApyFromInterest, calculateInterestFromApy, capConfidenceInterval, categorizePythBanks, checkBatchOracleCrankability, checkMultipleOraclesCrankability, chunkedGetRawMultipleAccountInfoOrdered, chunkedGetRawMultipleAccountInfoOrderedWithNulls, chunkedGetRawMultipleAccountInfos, composeRemainingAccounts, computeAccountValue, computeActiveEmodePairs, computeAssetHealthComponent, computeAssetUsdValue, computeBalanceUsdValue, computeBaseInterestRate, computeClaimedEmissions, computeClosePositionTokenAmount, computeEmodeImpacts, computeFreeCollateralFromBalances, computeFreeCollateralFromCache, computeHealthAccountMetas, computeHealthCacheStatus, computeHealthCheckAccounts, computeHealthComponentsFromBalances, computeHealthComponentsFromCache, computeHealthComponentsWithoutBiasFromBalances, computeInterestRates, computeLiabilityHealthComponent, computeLiabilityUsdValue, computeLiquidationPriceForBank, computeLoopingParams, computeLowestEmodeWeights, computeMaxBorrowForBank, computeMaxLeverage, computeMaxWithdrawForBank, computeNetApy, computeProjectedActiveBalancesNoCpi, computeProjectedActiveBanksNoCpi, computeQuantity, computeQuantityUi, computeRemainingCapacity, computeSmartCrank, computeTotalOutstandingEmissions, computeTvl, computeUsdValue, computeUtilizationRate, convertVoteAccCoeffsToBankCoeffs, createActiveEmodePairFromPairs, createEmptyBalance, decodeAccountRaw, decodeBankRaw, decodeInstruction, decompileV0Transaction, deriveBankEmissionsAuth, deriveBankEmissionsVault, deriveBankFeeVault, deriveBankFeeVaultAuthority, deriveBankInsuranceVault, deriveBankInsuranceVaultAuthority, deriveBankLiquidityVault, deriveBankLiquidityVaultAuthority, deriveFeeState, deriveMarginfiAccount, dtoToBalance, dtoToBank, dtoToBankConfig, dtoToBankConfigRaw, dtoToBankMetadata, dtoToBankMetadataMap, dtoToBankRaw, dtoToEmodeSettings, dtoToEmodeSettingsRaw, dtoToGroup, dtoToHealthCache, dtoToInterestRateConfig, dtoToMarginfiAccount, dtoToOraclePrice, dtoToValidatorStakeGroup, emodeSettingsRawToDto, extractPythOracleKeys, fetchBank, fetchBankIntegrationMetadata, fetchMarginfiAccountAddresses, fetchMarginfiAccountData, fetchMultipleBanks, fetchNativeStakeAccounts, fetchOracleData, fetchProgramForMints, fetchPythOracleData, fetchPythOraclePricesFromAPI, fetchPythOraclePricesFromChain, fetchStakeAccount, fetchStakePoolActiveStates, fetchStakePoolMev, fetchSwbOracleAccountsFromAPI, fetchSwbOracleAccountsFromChain, fetchSwbOracleData, fetchSwbOraclePricesFromAPI, fetchSwbOraclePricesFromCrossbar, findRandomAvailableAccountIndex, freezeBankConfigIx, getAccountKeys, getActiveAccountFlags, getActiveBalances, getActiveEmodeEntryFlags, getActiveEmodeFlags, getActiveHealthCacheFlags, getAssetQuantity, getAssetShares, getAssetWeight, getBalance, getBalanceUsdValueWithPriceBias, getBankVaultAuthority, getBankVaultSeeds, getBirdeyeFallbackPricesByFeedId, getBirdeyePricesForMints, getConfig, getDriftCTokenMultiplier, getDriftMetadata, getDriftStatesDto, getEmodePairs, getHealthCacheStatusDescription, getHealthSimulationTransactions, getJupLendFTokenMultiplier, getJupLendMetadata, getJupLendStatesDto, getJupiterSwapIxsForFlashloan, getKaminoCTokenMultiplier, getKaminoMetadata, getKaminoStatesDto, getLiabilityQuantity, getLiabilityShares, getLiabilityWeight, getOracleSourceFromBank, getOracleSourceFromOracleSetup, getOracleSourceNameFromKey, getPrice, getPriceWithConfidence, getStakedBankMetadataMap, getTotalAssetQuantity, getTotalLiabilityQuantity, getTxSize, getValidatorVoteAccountByBank, groupToDto, hasAccountFlag, hasEmodeEntryFlag, hasEmodeFlag, hasHealthCacheFlag, healthCacheToDto, isFlashloan, isV0Tx, isWeightedPrice, isWholePosition, makeAddPermissionlessStakedBankIx, makeBeginFlashLoanIx3 as makeBeginFlashLoanIx, makeBorrowIx3 as makeBorrowIx, makeBorrowTx, 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, makeRefreshKaminoBanksIxs, makeRepayIx3 as makeRepayIx, makeRepayTx, makeRepayWithCollatTx, makeSetupIx, makeSmartCrankSwbFeedIx, makeSwapCollateralTx, makeSwapDebtTx, makeTxPriorityIx, makeUnwrapSolIx, makeUpdateDriftMarketIxs, makeUpdateJupLendRateIxs, makeUpdateSwbFeedIx, makeVersionedTransaction, makeWithdrawEmissionsIx, makeWithdrawIx3 as makeWithdrawIx, makeWithdrawTx, makeWrapSolIxs, mapBrokenFeedsToOraclePrices, mapPythBanksToOraclePrices, mapSwbBanksToOraclePrices, marginfiAccountToDto, nativeToUi, oraclePriceToDto, parseBalanceRaw, parseBankConfigRaw, parseBankRaw, parseEmodeSettingsRaw, parseEmodeTag, parseHealthCacheRaw, parseMarginfiAccountRaw, parseOperationalState, parseOracleSetup, parseOraclePriceData as parsePriceInfo, parseRiskTier, parseRpcPythPriceData, parseSwbOraclePriceData, partitionBanksByCrankability, resolveAmount, serializeBankConfigOpt, serializeInterestRateConfig, serializeOperationalState, serializeOracleSetup, serializeOracleSetupToIndex, serializeRiskTier, shortenAddress, simulateAccountHealthCache, simulateAccountHealthCacheWithFallback, simulateBundle, splitInstructionsToFitTransactions, toBankConfigDto, toBankDto, toBigNumber, toEmodeSettingsDto, toInterestRateConfigDto, toNumber, uiToNative, uiToNativeBigNumber, validatorStakeGroupToDto, wrappedI80F48toBigNumber };
|
|
53388
54262
|
//# sourceMappingURL=index.js.map
|
|
53389
54263
|
//# sourceMappingURL=index.js.map
|