@0dotxyz/p0-ts-sdk 2.1.0 → 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 +895 -19
- 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 +892 -23
- 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 +5 -4
package/dist/index.cjs
CHANGED
|
@@ -15162,9 +15162,48 @@ var MintLayout = bufferLayout.struct([
|
|
|
15162
15162
|
bufferLayoutUtils.publicKey("freezeAuthority")
|
|
15163
15163
|
]);
|
|
15164
15164
|
MintLayout.span;
|
|
15165
|
+
var approveInstructionData = bufferLayout.struct([
|
|
15166
|
+
bufferLayout.u8("instruction"),
|
|
15167
|
+
bufferLayoutUtils.u64("amount")
|
|
15168
|
+
]);
|
|
15169
|
+
function createApproveInstruction(account, delegate, owner, amount, multiSigners = [], programId = TOKEN_PROGRAM_ID) {
|
|
15170
|
+
const keys = addSigners(
|
|
15171
|
+
[
|
|
15172
|
+
{ pubkey: account, isSigner: false, isWritable: true },
|
|
15173
|
+
{ pubkey: delegate, isSigner: false, isWritable: false }
|
|
15174
|
+
],
|
|
15175
|
+
owner,
|
|
15176
|
+
multiSigners
|
|
15177
|
+
);
|
|
15178
|
+
const data = buffer.Buffer.alloc(approveInstructionData.span);
|
|
15179
|
+
approveInstructionData.encode(
|
|
15180
|
+
{
|
|
15181
|
+
instruction: 4 /* Approve */,
|
|
15182
|
+
amount: BigInt(amount)
|
|
15183
|
+
},
|
|
15184
|
+
data
|
|
15185
|
+
);
|
|
15186
|
+
return new web3_js.TransactionInstruction({ keys, programId, data });
|
|
15187
|
+
}
|
|
15165
15188
|
bufferLayout.struct([
|
|
15166
15189
|
bufferLayout.u8("instruction")
|
|
15167
15190
|
]);
|
|
15191
|
+
function createAssociatedTokenAccountInstruction(payer, associatedToken, owner, mint, programId = TOKEN_PROGRAM_ID, associatedTokenProgramId = ASSOCIATED_TOKEN_PROGRAM_ID) {
|
|
15192
|
+
const keys = [
|
|
15193
|
+
{ pubkey: payer, isSigner: true, isWritable: true },
|
|
15194
|
+
{ pubkey: associatedToken, isSigner: false, isWritable: true },
|
|
15195
|
+
{ pubkey: owner, isSigner: false, isWritable: false },
|
|
15196
|
+
{ pubkey: mint, isSigner: false, isWritable: false },
|
|
15197
|
+
{ pubkey: web3_js.SystemProgram.programId, isSigner: false, isWritable: false },
|
|
15198
|
+
{ pubkey: programId, isSigner: false, isWritable: false },
|
|
15199
|
+
{ pubkey: web3_js.SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false }
|
|
15200
|
+
];
|
|
15201
|
+
return new web3_js.TransactionInstruction({
|
|
15202
|
+
keys,
|
|
15203
|
+
programId: associatedTokenProgramId,
|
|
15204
|
+
data: buffer.Buffer.alloc(0)
|
|
15205
|
+
});
|
|
15206
|
+
}
|
|
15168
15207
|
function createAssociatedTokenAccountIdempotentInstruction(payer, associatedToken, owner, mint, programId = TOKEN_PROGRAM_ID, associatedTokenProgramId = ASSOCIATED_TOKEN_PROGRAM_ID) {
|
|
15169
15208
|
return buildAssociatedTokenAccountInstruction(
|
|
15170
15209
|
payer,
|
|
@@ -43379,6 +43418,169 @@ new Fraction(new BN11__default.default(0));
|
|
|
43379
43418
|
function roundNearest(decimal) {
|
|
43380
43419
|
return decimal.toDecimalPlaces(0, Decimal3__default.default.ROUND_HALF_CEIL);
|
|
43381
43420
|
}
|
|
43421
|
+
var SinglePoolInstruction = {
|
|
43422
|
+
initializePool: (voteAccount) => {
|
|
43423
|
+
const pool = findPoolAddress(voteAccount);
|
|
43424
|
+
const stake = findPoolStakeAddress(pool);
|
|
43425
|
+
const mint = findPoolMintAddress(pool);
|
|
43426
|
+
const stakeAuthority = findPoolStakeAuthorityAddress(pool);
|
|
43427
|
+
const mintAuthority = findPoolMintAuthorityAddress(pool);
|
|
43428
|
+
return createTransactionInstruction(
|
|
43429
|
+
SINGLE_POOL_PROGRAM_ID,
|
|
43430
|
+
[
|
|
43431
|
+
{ pubkey: voteAccount, isSigner: false, isWritable: false },
|
|
43432
|
+
{ pubkey: pool, isSigner: false, isWritable: true },
|
|
43433
|
+
{ pubkey: stake, isSigner: false, isWritable: true },
|
|
43434
|
+
{ pubkey: mint, isSigner: false, isWritable: true },
|
|
43435
|
+
{ pubkey: stakeAuthority, isSigner: false, isWritable: false },
|
|
43436
|
+
{ pubkey: mintAuthority, isSigner: false, isWritable: false },
|
|
43437
|
+
{ pubkey: SYSVAR_RENT_ID, isSigner: false, isWritable: false },
|
|
43438
|
+
{ pubkey: SYSVAR_CLOCK_ID, isSigner: false, isWritable: false },
|
|
43439
|
+
{ pubkey: SYSVAR_STAKE_HISTORY_ID, isSigner: false, isWritable: false },
|
|
43440
|
+
{ pubkey: web3_js.STAKE_CONFIG_ID, isSigner: false, isWritable: false },
|
|
43441
|
+
{ pubkey: SYSTEM_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
43442
|
+
{ pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
43443
|
+
{ pubkey: STAKE_PROGRAM_ID, isSigner: false, isWritable: false }
|
|
43444
|
+
],
|
|
43445
|
+
Buffer.from([0 /* InitializePool */])
|
|
43446
|
+
);
|
|
43447
|
+
},
|
|
43448
|
+
initializeOnRamp: (pool) => {
|
|
43449
|
+
const onRamp = findPoolOnRampAddress(pool);
|
|
43450
|
+
const stakeAuthority = findPoolStakeAuthorityAddress(pool);
|
|
43451
|
+
return createTransactionInstruction(
|
|
43452
|
+
SINGLE_POOL_PROGRAM_ID,
|
|
43453
|
+
[
|
|
43454
|
+
{ pubkey: pool, isSigner: false, isWritable: false },
|
|
43455
|
+
{ pubkey: onRamp, isSigner: false, isWritable: true },
|
|
43456
|
+
{ pubkey: stakeAuthority, isSigner: false, isWritable: false },
|
|
43457
|
+
{ pubkey: SYSVAR_RENT_ID, isSigner: false, isWritable: false },
|
|
43458
|
+
{ pubkey: SYSTEM_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
43459
|
+
{ pubkey: STAKE_PROGRAM_ID, isSigner: false, isWritable: false }
|
|
43460
|
+
],
|
|
43461
|
+
Buffer.from([6 /* InitializeOnRamp */])
|
|
43462
|
+
);
|
|
43463
|
+
},
|
|
43464
|
+
depositStake: async (pool, userStakeAccount, userTokenAccount, userLamportAccount) => {
|
|
43465
|
+
const stake = findPoolStakeAddress(pool);
|
|
43466
|
+
const mint = findPoolMintAddress(pool);
|
|
43467
|
+
const stakeAuthority = findPoolStakeAuthorityAddress(pool);
|
|
43468
|
+
const mintAuthority = findPoolMintAuthorityAddress(pool);
|
|
43469
|
+
return createTransactionInstruction(
|
|
43470
|
+
SINGLE_POOL_PROGRAM_ID,
|
|
43471
|
+
[
|
|
43472
|
+
{ pubkey: pool, isSigner: false, isWritable: false },
|
|
43473
|
+
{ pubkey: stake, isSigner: false, isWritable: true },
|
|
43474
|
+
{ pubkey: mint, isSigner: false, isWritable: true },
|
|
43475
|
+
{ pubkey: stakeAuthority, isSigner: false, isWritable: false },
|
|
43476
|
+
{ pubkey: mintAuthority, isSigner: false, isWritable: false },
|
|
43477
|
+
{ pubkey: userStakeAccount, isSigner: false, isWritable: true },
|
|
43478
|
+
{ pubkey: userTokenAccount, isSigner: false, isWritable: true },
|
|
43479
|
+
{ pubkey: userLamportAccount, isSigner: false, isWritable: true },
|
|
43480
|
+
{ pubkey: SYSVAR_CLOCK_ID, isSigner: false, isWritable: false },
|
|
43481
|
+
{ pubkey: SYSVAR_STAKE_HISTORY_ID, isSigner: false, isWritable: false },
|
|
43482
|
+
{ pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
43483
|
+
{ pubkey: STAKE_PROGRAM_ID, isSigner: false, isWritable: false }
|
|
43484
|
+
],
|
|
43485
|
+
Buffer.from([2 /* DepositStake */])
|
|
43486
|
+
);
|
|
43487
|
+
},
|
|
43488
|
+
withdrawStake: async (pool, userStakeAccount, userStakeAuthority, userTokenAccount, tokenAmount) => {
|
|
43489
|
+
const stake = findPoolStakeAddress(pool);
|
|
43490
|
+
const mint = findPoolMintAddress(pool);
|
|
43491
|
+
const stakeAuthority = findPoolStakeAuthorityAddress(pool);
|
|
43492
|
+
const mintAuthority = findPoolMintAuthorityAddress(pool);
|
|
43493
|
+
const rawAmount = BigInt(tokenAmount.multipliedBy(1e9).toString());
|
|
43494
|
+
const data = Buffer.concat([
|
|
43495
|
+
Buffer.from([3 /* WithdrawStake */]),
|
|
43496
|
+
userStakeAuthority.toBuffer(),
|
|
43497
|
+
Buffer.from(new BN11.BN(rawAmount.toString()).toArray("le", 8))
|
|
43498
|
+
]);
|
|
43499
|
+
return createTransactionInstruction(
|
|
43500
|
+
SINGLE_POOL_PROGRAM_ID,
|
|
43501
|
+
[
|
|
43502
|
+
{ pubkey: pool, isSigner: false, isWritable: false },
|
|
43503
|
+
{ pubkey: stake, isSigner: false, isWritable: true },
|
|
43504
|
+
{ pubkey: mint, isSigner: false, isWritable: true },
|
|
43505
|
+
{ pubkey: stakeAuthority, isSigner: false, isWritable: false },
|
|
43506
|
+
{ pubkey: mintAuthority, isSigner: false, isWritable: false },
|
|
43507
|
+
{ pubkey: userStakeAccount, isSigner: false, isWritable: true },
|
|
43508
|
+
{ pubkey: userTokenAccount, isSigner: false, isWritable: true },
|
|
43509
|
+
{ pubkey: SYSVAR_CLOCK_ID, isSigner: false, isWritable: false },
|
|
43510
|
+
{ pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
43511
|
+
{ pubkey: STAKE_PROGRAM_ID, isSigner: false, isWritable: false }
|
|
43512
|
+
],
|
|
43513
|
+
data
|
|
43514
|
+
);
|
|
43515
|
+
},
|
|
43516
|
+
createTokenMetadata: async (pool, payer) => {
|
|
43517
|
+
const mint = findPoolMintAddress(pool);
|
|
43518
|
+
const [mintAuthority, mplAuthority, mplMetadata] = await Promise.all([
|
|
43519
|
+
findPoolMintAuthorityAddress(pool),
|
|
43520
|
+
findPoolMplAuthorityAddress(pool),
|
|
43521
|
+
findMplMetadataAddress(mint)
|
|
43522
|
+
]);
|
|
43523
|
+
return createTransactionInstruction(
|
|
43524
|
+
SINGLE_POOL_PROGRAM_ID,
|
|
43525
|
+
[
|
|
43526
|
+
{ pubkey: pool, isSigner: false, isWritable: false },
|
|
43527
|
+
{ pubkey: mint, isSigner: false, isWritable: false },
|
|
43528
|
+
{ pubkey: mintAuthority, isSigner: false, isWritable: false },
|
|
43529
|
+
{ pubkey: mplAuthority, isSigner: false, isWritable: false },
|
|
43530
|
+
{ pubkey: payer, isSigner: true, isWritable: true },
|
|
43531
|
+
{ pubkey: mplMetadata, isSigner: false, isWritable: true },
|
|
43532
|
+
{ pubkey: MPL_METADATA_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
43533
|
+
{ pubkey: SYSTEM_PROGRAM_ID, isSigner: false, isWritable: false }
|
|
43534
|
+
],
|
|
43535
|
+
Buffer.from([4 /* CreateTokenMetadata */])
|
|
43536
|
+
);
|
|
43537
|
+
},
|
|
43538
|
+
updateTokenMetadata: async (voteAccount, authorizedWithdrawer, tokenName, tokenSymbol, tokenUri = "") => {
|
|
43539
|
+
if (tokenName.length > 32) {
|
|
43540
|
+
throw new Error("maximum token name length is 32 characters");
|
|
43541
|
+
}
|
|
43542
|
+
if (tokenSymbol.length > 10) {
|
|
43543
|
+
throw new Error("maximum token symbol length is 10 characters");
|
|
43544
|
+
}
|
|
43545
|
+
if (tokenUri.length > 200) {
|
|
43546
|
+
throw new Error("maximum token uri length is 200 characters");
|
|
43547
|
+
}
|
|
43548
|
+
const pool = findPoolAddress(voteAccount);
|
|
43549
|
+
const [mint, mplAuthority] = await Promise.all([
|
|
43550
|
+
findPoolMintAddress(pool),
|
|
43551
|
+
findPoolMplAuthorityAddress(pool)
|
|
43552
|
+
]);
|
|
43553
|
+
const mplMetadata = await findMplMetadataAddress(mint);
|
|
43554
|
+
const data = Buffer.concat([
|
|
43555
|
+
Buffer.from([5 /* UpdateTokenMetadata */]),
|
|
43556
|
+
Buffer.from(new Uint32Array([tokenName.length]).buffer),
|
|
43557
|
+
Buffer.from(tokenName),
|
|
43558
|
+
Buffer.from(new Uint32Array([tokenSymbol.length]).buffer),
|
|
43559
|
+
Buffer.from(tokenSymbol),
|
|
43560
|
+
Buffer.from(new Uint32Array([tokenUri.length]).buffer),
|
|
43561
|
+
Buffer.from(tokenUri)
|
|
43562
|
+
]);
|
|
43563
|
+
return createTransactionInstruction(
|
|
43564
|
+
SINGLE_POOL_PROGRAM_ID,
|
|
43565
|
+
[
|
|
43566
|
+
{ pubkey: voteAccount, isSigner: false, isWritable: false },
|
|
43567
|
+
{ pubkey: pool, isSigner: false, isWritable: false },
|
|
43568
|
+
{ pubkey: mplAuthority, isSigner: false, isWritable: false },
|
|
43569
|
+
{ pubkey: authorizedWithdrawer, isSigner: true, isWritable: false },
|
|
43570
|
+
{ pubkey: mplMetadata, isSigner: false, isWritable: true },
|
|
43571
|
+
{ pubkey: MPL_METADATA_PROGRAM_ID, isSigner: false, isWritable: false }
|
|
43572
|
+
],
|
|
43573
|
+
data
|
|
43574
|
+
);
|
|
43575
|
+
}
|
|
43576
|
+
};
|
|
43577
|
+
var createTransactionInstruction = (programId, keys, data) => {
|
|
43578
|
+
return {
|
|
43579
|
+
programId,
|
|
43580
|
+
keys,
|
|
43581
|
+
data
|
|
43582
|
+
};
|
|
43583
|
+
};
|
|
43382
43584
|
var findPda = (baseAddress, prefix, programId = SINGLE_POOL_PROGRAM_ID) => {
|
|
43383
43585
|
const [pda] = web3_js.PublicKey.findProgramAddressSync(
|
|
43384
43586
|
[Buffer.from(prefix), baseAddress.toBuffer()],
|
|
@@ -43389,7 +43591,17 @@ var findPda = (baseAddress, prefix, programId = SINGLE_POOL_PROGRAM_ID) => {
|
|
|
43389
43591
|
var findPoolAddress = (voteAccountAddress) => findPda(voteAccountAddress, "pool");
|
|
43390
43592
|
var findPoolMintAddress = (poolAddress) => findPda(poolAddress, "mint");
|
|
43391
43593
|
var findPoolStakeAddress = (poolAddress) => findPda(poolAddress, "stake");
|
|
43594
|
+
var findPoolStakeAuthorityAddress = (poolAddress) => findPda(poolAddress, "stake_authority");
|
|
43595
|
+
var findPoolMintAuthorityAddress = (poolAddress) => findPda(poolAddress, "mint_authority");
|
|
43596
|
+
var findPoolMplAuthorityAddress = (poolAddress) => findPda(poolAddress, "mpl_authority");
|
|
43392
43597
|
var findPoolOnRampAddress = (poolAddress) => findPda(poolAddress, "onramp");
|
|
43598
|
+
var findMplMetadataAddress = async (poolMintAddress) => {
|
|
43599
|
+
const [pda] = web3_js.PublicKey.findProgramAddressSync(
|
|
43600
|
+
[Buffer.from("metadata"), MPL_METADATA_PROGRAM_ID.toBuffer(), poolMintAddress.toBuffer()],
|
|
43601
|
+
MPL_METADATA_PROGRAM_ID
|
|
43602
|
+
);
|
|
43603
|
+
return pda;
|
|
43604
|
+
};
|
|
43393
43605
|
BigInt(33);
|
|
43394
43606
|
BigInt(200);
|
|
43395
43607
|
BigInt(82);
|
|
@@ -48025,6 +48237,179 @@ async function buildSwapDebtFlashloanTx({
|
|
|
48025
48237
|
}
|
|
48026
48238
|
throw new Error("Failed to build swap debt flashloan tx");
|
|
48027
48239
|
}
|
|
48240
|
+
var SYSVAR_CLOCK_ID2 = new web3_js.PublicKey("SysvarC1ock11111111111111111111111111111111");
|
|
48241
|
+
async function makeMintStakedLstIx(params) {
|
|
48242
|
+
const { amount, authority, stakeAccountPk, validator, connection } = params;
|
|
48243
|
+
const pool = findPoolAddress(validator);
|
|
48244
|
+
const lstMint = findPoolMintAddress(pool);
|
|
48245
|
+
const poolStakeAuth = findPoolStakeAuthorityAddress(pool);
|
|
48246
|
+
const lstAta = getAssociatedTokenAddressSync(lstMint, authority);
|
|
48247
|
+
const [lstAccInfo, stakeAccInfoParsed, rentExemptReserve] = await Promise.all([
|
|
48248
|
+
connection.getAccountInfo(lstAta),
|
|
48249
|
+
connection.getParsedAccountInfo(stakeAccountPk),
|
|
48250
|
+
connection.getMinimumBalanceForRentExemption(web3_js.StakeProgram.space)
|
|
48251
|
+
]);
|
|
48252
|
+
const stakeAccParsed = stakeAccInfoParsed?.value?.data;
|
|
48253
|
+
const amountLamports = Math.round(Number(amount) * web3_js.LAMPORTS_PER_SOL);
|
|
48254
|
+
const stakeAccLamports = Number(stakeAccParsed?.parsed?.info?.stake?.delegation?.stake ?? 0);
|
|
48255
|
+
const isFullStake = amountLamports >= stakeAccLamports;
|
|
48256
|
+
const instructions2 = [];
|
|
48257
|
+
const signers = [];
|
|
48258
|
+
if (!lstAccInfo) {
|
|
48259
|
+
instructions2.push(
|
|
48260
|
+
createAssociatedTokenAccountInstruction(authority, lstAta, authority, lstMint)
|
|
48261
|
+
);
|
|
48262
|
+
}
|
|
48263
|
+
let targetStakePubkey;
|
|
48264
|
+
if (!isFullStake) {
|
|
48265
|
+
const splitStakeAccount = web3_js.Keypair.generate();
|
|
48266
|
+
signers.push(splitStakeAccount);
|
|
48267
|
+
targetStakePubkey = splitStakeAccount.publicKey;
|
|
48268
|
+
instructions2.push(
|
|
48269
|
+
...web3_js.StakeProgram.split(
|
|
48270
|
+
{
|
|
48271
|
+
stakePubkey: stakeAccountPk,
|
|
48272
|
+
authorizedPubkey: authority,
|
|
48273
|
+
splitStakePubkey: splitStakeAccount.publicKey,
|
|
48274
|
+
lamports: amountLamports
|
|
48275
|
+
},
|
|
48276
|
+
rentExemptReserve
|
|
48277
|
+
).instructions
|
|
48278
|
+
);
|
|
48279
|
+
} else {
|
|
48280
|
+
targetStakePubkey = stakeAccountPk;
|
|
48281
|
+
}
|
|
48282
|
+
const [authorizeStakerIx, authorizeWithdrawIx] = await Promise.all([
|
|
48283
|
+
web3_js.StakeProgram.authorize({
|
|
48284
|
+
stakePubkey: targetStakePubkey,
|
|
48285
|
+
authorizedPubkey: authority,
|
|
48286
|
+
newAuthorizedPubkey: poolStakeAuth,
|
|
48287
|
+
stakeAuthorizationType: web3_js.StakeAuthorizationLayout.Staker
|
|
48288
|
+
}).instructions,
|
|
48289
|
+
web3_js.StakeProgram.authorize({
|
|
48290
|
+
stakePubkey: targetStakePubkey,
|
|
48291
|
+
authorizedPubkey: authority,
|
|
48292
|
+
newAuthorizedPubkey: poolStakeAuth,
|
|
48293
|
+
stakeAuthorizationType: web3_js.StakeAuthorizationLayout.Withdrawer
|
|
48294
|
+
}).instructions
|
|
48295
|
+
]);
|
|
48296
|
+
[authorizeStakerIx[0], authorizeWithdrawIx[0]].forEach((ix) => {
|
|
48297
|
+
if (ix) {
|
|
48298
|
+
ix.keys = ix.keys.map((key) => ({
|
|
48299
|
+
...key,
|
|
48300
|
+
isWritable: key.pubkey.equals(SYSVAR_CLOCK_ID2) ? false : key.isWritable
|
|
48301
|
+
}));
|
|
48302
|
+
}
|
|
48303
|
+
});
|
|
48304
|
+
instructions2.push(...authorizeStakerIx, ...authorizeWithdrawIx);
|
|
48305
|
+
const depositStakeIx = await SinglePoolInstruction.depositStake(
|
|
48306
|
+
pool,
|
|
48307
|
+
targetStakePubkey,
|
|
48308
|
+
lstAta,
|
|
48309
|
+
authority
|
|
48310
|
+
);
|
|
48311
|
+
instructions2.push(depositStakeIx);
|
|
48312
|
+
return { instructions: instructions2, keys: signers };
|
|
48313
|
+
}
|
|
48314
|
+
async function makeMintStakedLstTx(params) {
|
|
48315
|
+
const { connection, luts, blockhash: providedBlockhash } = params;
|
|
48316
|
+
const { instructions: instructions2, keys } = await makeMintStakedLstIx(params);
|
|
48317
|
+
const blockhash = providedBlockhash ?? (await connection.getLatestBlockhash("confirmed")).blockhash;
|
|
48318
|
+
const message = new web3_js.TransactionMessage({
|
|
48319
|
+
payerKey: params.authority,
|
|
48320
|
+
recentBlockhash: blockhash,
|
|
48321
|
+
instructions: instructions2
|
|
48322
|
+
}).compileToV0Message(luts);
|
|
48323
|
+
const tx = new web3_js.VersionedTransaction(message);
|
|
48324
|
+
return addTransactionMetadata(tx, {
|
|
48325
|
+
signers: keys,
|
|
48326
|
+
addressLookupTables: luts,
|
|
48327
|
+
type: "DEPOSIT_STAKE" /* DEPOSIT_STAKE */
|
|
48328
|
+
});
|
|
48329
|
+
}
|
|
48330
|
+
async function makeRedeemStakedLstIx(params) {
|
|
48331
|
+
const { amount, authority, validator, connection } = params;
|
|
48332
|
+
const pool = findPoolAddress(validator);
|
|
48333
|
+
const lstMint = findPoolMintAddress(pool);
|
|
48334
|
+
const mintAuthority = findPoolMintAuthorityAddress(pool);
|
|
48335
|
+
const lstAta = getAssociatedTokenAddressSync(lstMint, authority);
|
|
48336
|
+
const rentExemption = await connection.getMinimumBalanceForRentExemption(
|
|
48337
|
+
web3_js.StakeProgram.space
|
|
48338
|
+
);
|
|
48339
|
+
const stakeAmount = new BigNumber3__default.default(new BigNumber3__default.default(amount).toString());
|
|
48340
|
+
const instructions2 = [];
|
|
48341
|
+
const signers = [];
|
|
48342
|
+
const stakeAccount = web3_js.Keypair.generate();
|
|
48343
|
+
signers.push(stakeAccount);
|
|
48344
|
+
instructions2.push(
|
|
48345
|
+
web3_js.SystemProgram.createAccount({
|
|
48346
|
+
fromPubkey: authority,
|
|
48347
|
+
newAccountPubkey: stakeAccount.publicKey,
|
|
48348
|
+
lamports: rentExemption,
|
|
48349
|
+
space: web3_js.StakeProgram.space,
|
|
48350
|
+
programId: web3_js.StakeProgram.programId
|
|
48351
|
+
})
|
|
48352
|
+
);
|
|
48353
|
+
instructions2.push(
|
|
48354
|
+
createApproveInstruction(
|
|
48355
|
+
lstAta,
|
|
48356
|
+
mintAuthority,
|
|
48357
|
+
authority,
|
|
48358
|
+
BigInt(stakeAmount.multipliedBy(1e9).toFixed(0))
|
|
48359
|
+
)
|
|
48360
|
+
);
|
|
48361
|
+
const withdrawStakeIx = await SinglePoolInstruction.withdrawStake(
|
|
48362
|
+
pool,
|
|
48363
|
+
stakeAccount.publicKey,
|
|
48364
|
+
authority,
|
|
48365
|
+
lstAta,
|
|
48366
|
+
stakeAmount
|
|
48367
|
+
);
|
|
48368
|
+
instructions2.push(withdrawStakeIx);
|
|
48369
|
+
return { instructions: instructions2, keys: signers };
|
|
48370
|
+
}
|
|
48371
|
+
async function makeRedeemStakedLstTx(params) {
|
|
48372
|
+
const { connection, luts, blockhash: providedBlockhash } = params;
|
|
48373
|
+
const { instructions: instructions2, keys } = await makeRedeemStakedLstIx(params);
|
|
48374
|
+
const blockhash = providedBlockhash ?? (await connection.getLatestBlockhash("confirmed")).blockhash;
|
|
48375
|
+
const message = new web3_js.TransactionMessage({
|
|
48376
|
+
payerKey: params.authority,
|
|
48377
|
+
recentBlockhash: blockhash,
|
|
48378
|
+
instructions: instructions2
|
|
48379
|
+
}).compileToV0Message(luts);
|
|
48380
|
+
const tx = new web3_js.VersionedTransaction(message);
|
|
48381
|
+
return addTransactionMetadata(tx, {
|
|
48382
|
+
signers: keys,
|
|
48383
|
+
addressLookupTables: luts,
|
|
48384
|
+
type: "WITHDRAW_STAKE" /* WITHDRAW_STAKE */
|
|
48385
|
+
});
|
|
48386
|
+
}
|
|
48387
|
+
async function makeMergeStakeAccountsTx(params) {
|
|
48388
|
+
const {
|
|
48389
|
+
authority,
|
|
48390
|
+
sourceStakeAccount,
|
|
48391
|
+
destinationStakeAccount,
|
|
48392
|
+
connection,
|
|
48393
|
+
luts,
|
|
48394
|
+
blockhash: providedBlockhash
|
|
48395
|
+
} = params;
|
|
48396
|
+
const mergeIx = web3_js.StakeProgram.merge({
|
|
48397
|
+
stakePubkey: destinationStakeAccount,
|
|
48398
|
+
sourceStakePubKey: sourceStakeAccount,
|
|
48399
|
+
authorizedPubkey: authority
|
|
48400
|
+
}).instructions;
|
|
48401
|
+
const blockhash = providedBlockhash ?? (await connection.getLatestBlockhash("confirmed")).blockhash;
|
|
48402
|
+
const message = new web3_js.TransactionMessage({
|
|
48403
|
+
payerKey: authority,
|
|
48404
|
+
recentBlockhash: blockhash,
|
|
48405
|
+
instructions: mergeIx
|
|
48406
|
+
}).compileToV0Message(luts);
|
|
48407
|
+
const tx = new web3_js.VersionedTransaction(message);
|
|
48408
|
+
return addTransactionMetadata(tx, {
|
|
48409
|
+
addressLookupTables: luts,
|
|
48410
|
+
type: "MERGE_STAKE_ACCOUNTS" /* MERGE_STAKE_ACCOUNTS */
|
|
48411
|
+
});
|
|
48412
|
+
}
|
|
48028
48413
|
|
|
48029
48414
|
// src/services/account/services/account-simulation.service.ts
|
|
48030
48415
|
async function simulateAccountHealthCacheWithFallback(params) {
|
|
@@ -49075,7 +49460,12 @@ async function makeUpdateSwbFeedIx(props) {
|
|
|
49075
49460
|
seen.add(key);
|
|
49076
49461
|
return true;
|
|
49077
49462
|
});
|
|
49078
|
-
const
|
|
49463
|
+
const dummyWallet = {
|
|
49464
|
+
publicKey: props.feePayer,
|
|
49465
|
+
signTransaction: async (tx) => tx,
|
|
49466
|
+
signAllTransactions: async (txs) => txs
|
|
49467
|
+
};
|
|
49468
|
+
const swbProgram = await onDemand.AnchorUtils.loadProgramFromConnection(props.connection, dummyWallet);
|
|
49079
49469
|
const pullFeedInstances = uniqueOracles.map((oracle) => {
|
|
49080
49470
|
const pullFeed = new onDemand.PullFeed(swbProgram, oracle.key);
|
|
49081
49471
|
return pullFeed;
|
|
@@ -49086,21 +49476,11 @@ async function makeUpdateSwbFeedIx(props) {
|
|
|
49086
49476
|
const crossbarClient = new common.CrossbarClient(
|
|
49087
49477
|
process.env.NEXT_PUBLIC_SWITCHBOARD_CROSSSBAR_API || "https://integrator-crossbar.prod.mrgn.app"
|
|
49088
49478
|
);
|
|
49089
|
-
const gatewayUrls = await crossbarClient.fetchGateways("mainnet");
|
|
49090
|
-
if (!gatewayUrls || gatewayUrls.length === 0) {
|
|
49091
|
-
throw new Error(`No gateways available for mainnet`);
|
|
49092
|
-
}
|
|
49093
|
-
const gatewayUrl = gatewayUrls[0];
|
|
49094
|
-
if (!gatewayUrl) {
|
|
49095
|
-
throw new Error(`Invalid gateway URL received formainnet`);
|
|
49096
|
-
}
|
|
49097
|
-
const gateway = new onDemand.Gateway(swbProgram, gatewayUrl);
|
|
49098
49479
|
const [pullIx, luts] = await onDemand.PullFeed.fetchUpdateManyIx(swbProgram, {
|
|
49099
49480
|
feeds: pullFeedInstances,
|
|
49100
|
-
gateway: gateway.gatewayUrl,
|
|
49101
49481
|
numSignatures: 1,
|
|
49102
|
-
|
|
49103
|
-
|
|
49482
|
+
crossbarClient,
|
|
49483
|
+
payer: props.feePayer
|
|
49104
49484
|
});
|
|
49105
49485
|
return { instructions: pullIx, luts };
|
|
49106
49486
|
}
|
|
@@ -49440,18 +49820,15 @@ var fetchPythOracleData = async (banks, opts) => {
|
|
|
49440
49820
|
bankOraclePriceMap: /* @__PURE__ */ new Map()
|
|
49441
49821
|
};
|
|
49442
49822
|
}
|
|
49443
|
-
pythStakedCollateralBanks.map((bank) => [
|
|
49444
|
-
opts.validatorVoteAccountByBank?.[bank.address.toBase58()] ?? "",
|
|
49445
|
-
bank.mint.toBase58()
|
|
49446
|
-
]);
|
|
49447
|
-
const priceCoeffByBank = {};
|
|
49448
49823
|
const combinedPythBanks = [
|
|
49449
49824
|
...pythPushBanks,
|
|
49825
|
+
...pythStakedCollateralBanks,
|
|
49450
49826
|
...pythPushKaminosBanks,
|
|
49451
49827
|
...driftPythPullBanks,
|
|
49452
49828
|
...solendPythPullBanks,
|
|
49453
49829
|
...juplendPythPullBanks
|
|
49454
49830
|
];
|
|
49831
|
+
const priceCoeffByBank = {};
|
|
49455
49832
|
const pythOracleKeys = extractPythOracleKeys(combinedPythBanks);
|
|
49456
49833
|
const uniquePythOracleKeys = Array.from(new Set(pythOracleKeys));
|
|
49457
49834
|
let oraclePrices;
|
|
@@ -50656,6 +51033,389 @@ function dtoToValidatorStakeGroup(validatorStakeGroupDto) {
|
|
|
50656
51033
|
}))
|
|
50657
51034
|
};
|
|
50658
51035
|
}
|
|
51036
|
+
|
|
51037
|
+
// src/services/native-stake/utils/metadata.data.ts
|
|
51038
|
+
var STAKED_BANK_METADATA_JSON = [
|
|
51039
|
+
{
|
|
51040
|
+
bankAddress: "8g5qG6PVygcVSXV1cJnjXaD1yhrDwcWAMQCY2wR9VuAf",
|
|
51041
|
+
validatorVoteAccount: "CooLbbZy5Xmdt7DiHPQ3ss2uRXawnTXXVgpMS8E8jDzr",
|
|
51042
|
+
tokenAddress: "BADo3D6nMtGnsAaTv3iEes8mMcq92TuFoBWebFe8kzeA",
|
|
51043
|
+
tokenName: "Cavey Cool",
|
|
51044
|
+
tokenSymbol: "COOL"
|
|
51045
|
+
},
|
|
51046
|
+
{
|
|
51047
|
+
bankAddress: "BuCckNm1djpp3vZVhvh1CrrniirY6sr2hwUmeP5kTcGz",
|
|
51048
|
+
validatorVoteAccount: "mrgn4t2JabSgvGnrCaHXMvz8ocr4F52scsxJnkQMQsQ",
|
|
51049
|
+
tokenAddress: "FUyAyVbYrMfiaN1QEQYFZTuBNzW5EJf3jWzjjymGqKLv",
|
|
51050
|
+
tokenName: "Project 0 Meridian",
|
|
51051
|
+
tokenSymbol: "MERIDIAN"
|
|
51052
|
+
},
|
|
51053
|
+
{
|
|
51054
|
+
bankAddress: "Hco1P3dGRXz3ZGFvMkbDgghZQy47Tp7vp7koSYRvP6nm",
|
|
51055
|
+
validatorVoteAccount: "mrgn6ETrBDM8mjjYN8rbVwFqVwF8z6rtmvGLbdGuVUU",
|
|
51056
|
+
tokenAddress: "A4B5MGQvcZCUqeiUEAB4ckZ2tvH2UmEg31vF7TiERDkH",
|
|
51057
|
+
tokenName: "MRGN 3",
|
|
51058
|
+
tokenSymbol: "MRGN3"
|
|
51059
|
+
},
|
|
51060
|
+
{
|
|
51061
|
+
bankAddress: "EPh2abWP8DusPH8myWnECAAeQUZgAz927aMbmwXt3eRY",
|
|
51062
|
+
validatorVoteAccount: "mrgn2vsZ5EJ8YEfAMNPXmRux7th9cNfBasQ1JJvVwPn",
|
|
51063
|
+
tokenAddress: "6Mt7tBWLUJfDxqCFTsjoRXF9wD55g4Lhs5nAyYp244pX",
|
|
51064
|
+
tokenName: "Project 0 Horizon",
|
|
51065
|
+
tokenSymbol: "HORIZON"
|
|
51066
|
+
},
|
|
51067
|
+
{
|
|
51068
|
+
bankAddress: "6wjAwhnxTMEzHk8NNHVXgkx1jSrb6TX1bC17j3S56FfB",
|
|
51069
|
+
validatorVoteAccount: "3N7s9zXMZ4QqvHQR15t5GNHyqc89KduzMP7423eWiD5g",
|
|
51070
|
+
tokenAddress: "DKPvRV4dxUejjGpr2XwFmzZbbbTD7vx9Jmt1kk43n4d5",
|
|
51071
|
+
tokenName: "Binance",
|
|
51072
|
+
tokenSymbol: "BINANCE"
|
|
51073
|
+
},
|
|
51074
|
+
{
|
|
51075
|
+
bankAddress: "J9tksvZEDSwtNtZ6yxYjWDDkzhPbwDMnihU61NkFG9FE",
|
|
51076
|
+
validatorVoteAccount: "he1iusunGwqrNtafDtLdhsUQDFvo13z9sUa36PauBtk",
|
|
51077
|
+
tokenAddress: "2k79y8CApbU9jAvWhLS2j6uRbaVjpLJTUzstBTho9vGq",
|
|
51078
|
+
tokenName: "Helius",
|
|
51079
|
+
tokenSymbol: "HELIUS"
|
|
51080
|
+
},
|
|
51081
|
+
{
|
|
51082
|
+
bankAddress: "Dfr6Sf44ftecaJaoJMzFQABdkt3CEHfBwut1WyacRzaE",
|
|
51083
|
+
validatorVoteAccount: "SLaYv7tCwetrFGbPCRnqpHswG5qqKino78EYpbGF7xY",
|
|
51084
|
+
tokenAddress: "Vsw4JT33S7bLbhjySMMyrP3JKvTAcNi9WG5Doekrmgg",
|
|
51085
|
+
tokenName: "Solayer",
|
|
51086
|
+
tokenSymbol: "SOLAYER"
|
|
51087
|
+
},
|
|
51088
|
+
{
|
|
51089
|
+
bankAddress: "BZAm4qGscR8gg5bmWrEq6BTofgaZPbg7Fwfa7rFghEXL",
|
|
51090
|
+
validatorVoteAccount: "J1to3PQfXidUUhprQWgdKkQAMWPJAEqSJ7amkBDE9qhF",
|
|
51091
|
+
tokenAddress: "6B8hZSupE5mcACmjzozP6C1DR2uaCCtmrGqcYWC6SBCc",
|
|
51092
|
+
tokenName: "Bonk",
|
|
51093
|
+
tokenSymbol: "BONK"
|
|
51094
|
+
},
|
|
51095
|
+
{
|
|
51096
|
+
bankAddress: "3UrMZ26NRKu2y6c2dPE7gZVHwEmhpwKLcWACg3tjCVEt",
|
|
51097
|
+
validatorVoteAccount: "J2nUHEAgZFRyuJbFjdqPrAa9gyWDuc7hErtDQHPhsYRp",
|
|
51098
|
+
tokenAddress: "9M7oMo4oL6RDPG7WbAX3Zz4dPzbMgpiCzwrQPMwG4Wgq",
|
|
51099
|
+
tokenName: "Phantom",
|
|
51100
|
+
tokenSymbol: "PHANTOM"
|
|
51101
|
+
},
|
|
51102
|
+
{
|
|
51103
|
+
bankAddress: "8c269gkonvATm93nviuYiriCQ829f7ypx3aScYDR1YoQ",
|
|
51104
|
+
validatorVoteAccount: "D3QPJm7BDzzPeRG51YZSEz3LfV7GvFNu9NkcibzURxuj",
|
|
51105
|
+
tokenAddress: "8hXCCQmYFcDhU5Mkuvyixp2Q11sbyQComkceSSh3GY4a",
|
|
51106
|
+
tokenName: "Starke Finance",
|
|
51107
|
+
tokenSymbol: "STARKE"
|
|
51108
|
+
},
|
|
51109
|
+
{
|
|
51110
|
+
bankAddress: "37tiA2NTF6YCt85XzCidPo9ZVpuqkkmfVJCYQ5Yx5Uhs",
|
|
51111
|
+
validatorVoteAccount: "SBLZib4npE7svxFA7AsD3ytdQAfYNb39c8zsU82AA2E",
|
|
51112
|
+
tokenAddress: "96rXgCFy1Er49169XoKHkeLiKC2k4bTy1641q1TVrMm2",
|
|
51113
|
+
tokenName: "SolBlaze Validator",
|
|
51114
|
+
tokenSymbol: "SOLBLAZE"
|
|
51115
|
+
},
|
|
51116
|
+
{
|
|
51117
|
+
bankAddress: "J9trpcrVdFjVNg6VFrdF1XPGgjftQKZhbbWsxertdv9V",
|
|
51118
|
+
validatorVoteAccount: "FACqsS19VScz8oo2YhdMg35EsAy6xsCZ9Y58eJXGv8QJ",
|
|
51119
|
+
tokenAddress: "AH6fxpHS2gtMtJgBy8y8pEAPkqyop2pSugF6REs9NaTp",
|
|
51120
|
+
tokenName: "Lantern",
|
|
51121
|
+
tokenSymbol: "LNTRN"
|
|
51122
|
+
},
|
|
51123
|
+
{
|
|
51124
|
+
bankAddress: "EGTfrYiuWpPPZ4yfY9tCxnK6QMkY7pzVie9DxK772iGe",
|
|
51125
|
+
validatorVoteAccount: "EfnywDKqArxK6N6FS9ctsuzNdxfx3pzfXEQE5EevQ1SV",
|
|
51126
|
+
tokenAddress: "FcXEwHku68ZquqtSj1eSWS1SVWkhAZSyb4usfpiuEJAL",
|
|
51127
|
+
tokenName: "PROJECT SUPER",
|
|
51128
|
+
tokenSymbol: "SUPER"
|
|
51129
|
+
},
|
|
51130
|
+
{
|
|
51131
|
+
bankAddress: "A5e7UTE3g11ZfKgftqRCvxAgcDuFGyeDjMka96zJWSWe",
|
|
51132
|
+
validatorVoteAccount: "3ZUQekqiZoybB57y49eqtvSaoonqDwuNbeqEGwN88JkQ",
|
|
51133
|
+
tokenAddress: "F1XPjtpsEy23Q7po4JkWjp1jkDZcvFYSrqD8TR1YL3EF",
|
|
51134
|
+
tokenName: "Paws",
|
|
51135
|
+
tokenSymbol: "PAWS"
|
|
51136
|
+
},
|
|
51137
|
+
{
|
|
51138
|
+
bankAddress: "91jkdp4cF8vCDhjwude3SGSGrmVWFk5vTAtR6fsGVAfy",
|
|
51139
|
+
validatorVoteAccount: "gangtRyGPTvYWb8K3xS2feJQaCks4iJ7rytFUPtVqSY",
|
|
51140
|
+
tokenAddress: "6ZS7ZVDw91BVAC8gsz3SZBSeVeF2GtXtL2BHK31Kvyjm",
|
|
51141
|
+
tokenName: "Lotus Validator",
|
|
51142
|
+
tokenSymbol: "LOTUS"
|
|
51143
|
+
},
|
|
51144
|
+
{
|
|
51145
|
+
bankAddress: "72BS34HkCgq8RWQR7kuVVmiJMtKqSxG4CHX6ZXpSCwg7",
|
|
51146
|
+
validatorVoteAccount: "oRAnGeU5h8h2UkvbfnE5cjXnnAa4rBoaxmS4kbFymSe",
|
|
51147
|
+
tokenAddress: "9yF8pXctzicum2P73uuk4Dhqf2MVz6tzRAe8THGXCJcp",
|
|
51148
|
+
tokenName: "Orangefin Ventures",
|
|
51149
|
+
tokenSymbol: "ORANGEFIN"
|
|
51150
|
+
},
|
|
51151
|
+
{
|
|
51152
|
+
bankAddress: "8F4DsU3NMFunUxBZkWrpYR8zwhAfoAt7QuiEPMtyhWvX",
|
|
51153
|
+
validatorVoteAccount: "3xjfK9C9YNcta8MvK1US4sQ3bc6DEjoJoR3qLExGf9xE",
|
|
51154
|
+
tokenAddress: "Akib1NYJzzh9HkiDH41S2LUefUmR1bKsk65xgqUcW5C5",
|
|
51155
|
+
tokenName: "pico\u{1F644}.sol",
|
|
51156
|
+
tokenSymbol: "PICO"
|
|
51157
|
+
},
|
|
51158
|
+
{
|
|
51159
|
+
bankAddress: "GdtggomQth6cxuYPdiVhBbcX7VC9rnDDwLMfxipxE2Po",
|
|
51160
|
+
validatorVoteAccount: "oPaLTmyvoUhW26QCMwLA5JNUeBYy72PDpFoXQF8SeX4",
|
|
51161
|
+
tokenAddress: "C71A3W7g5XALUNwTDWTwHX3qhfypaYZ41aNZjBpcaC9D",
|
|
51162
|
+
tokenName: "Temporal Opal",
|
|
51163
|
+
tokenSymbol: "OPAL"
|
|
51164
|
+
},
|
|
51165
|
+
{
|
|
51166
|
+
bankAddress: "5sJCKePwAhyD3mzrzLRDM2PkFMc85nnvvarxHLsvWvpg",
|
|
51167
|
+
validatorVoteAccount: "9jYFwBfbjYmvasFbJyES9apLJDTkwtbgSDRWanHEvcRw",
|
|
51168
|
+
tokenAddress: "Hj69K1WbnfZFipLbrzdxgGhDqCR47q48bN5nUHt6xQZo",
|
|
51169
|
+
tokenName: "WATCHTOWER",
|
|
51170
|
+
tokenSymbol: "WATCHTOWER"
|
|
51171
|
+
},
|
|
51172
|
+
{
|
|
51173
|
+
bankAddress: "3F3QXT3BtkegaBfFjn2odKLurFYLHJHJ99xKV2TRTvrk",
|
|
51174
|
+
validatorVoteAccount: "6JfBwvcz5QUKQJ37BMKTLrf968DDJBtwoZLw19aHwFtQ",
|
|
51175
|
+
tokenAddress: "8FqX86cQofBHReetZgxrxxvzN4iqMVsj2hbiv7pj2h73",
|
|
51176
|
+
tokenName: "Spectrum Staking",
|
|
51177
|
+
tokenSymbol: "SPECTRUM"
|
|
51178
|
+
},
|
|
51179
|
+
{
|
|
51180
|
+
bankAddress: "CFmvdtEPQJPVqS1QRkeRcdQm2itAPk6k8hSJbmt88Sjc",
|
|
51181
|
+
validatorVoteAccount: "Haz7b47sZBpxh9SwggGndN3fAyNQ1S949BPdxWXS3ab6",
|
|
51182
|
+
tokenAddress: "38ZUTefZnKSUJU3wxpUe3xpiw2j5WQPnmzSTNbS1JqLA",
|
|
51183
|
+
tokenName: "Temporal Emerald",
|
|
51184
|
+
tokenSymbol: "EMERALD"
|
|
51185
|
+
},
|
|
51186
|
+
{
|
|
51187
|
+
bankAddress: "CmBDHSVuodmUnanbBVFvY9cauLeosbdFQn9bJANMVYUG",
|
|
51188
|
+
validatorVoteAccount: "mintrNtxN3PhAB45Pt41XqyKghTTpqcoBkQTZqh96iR",
|
|
51189
|
+
tokenAddress: "GxGmv7s7s2co3pLZukns946fr5zmR8c5buWRD9prGd6v",
|
|
51190
|
+
tokenName: "Hanabi Staking",
|
|
51191
|
+
tokenSymbol: "haSOLmrgn"
|
|
51192
|
+
},
|
|
51193
|
+
{
|
|
51194
|
+
bankAddress: "7bLfrb4fWVYkVpZ9rg7dBUwKRAqLyiivCW4ahMMGcKyS",
|
|
51195
|
+
validatorVoteAccount: "76DafWkJ6pGK2hoD41HjrM4xTBhfKqrDYDazv13n5ir1",
|
|
51196
|
+
tokenAddress: "GT7n9uZbYzHv52YqDBowtZ5ZVW91umaBQTNPFQNeLUpR",
|
|
51197
|
+
tokenName: "Solana Japan Validator",
|
|
51198
|
+
tokenSymbol: "SolJAPAn"
|
|
51199
|
+
},
|
|
51200
|
+
{
|
|
51201
|
+
bankAddress: "6q5DB86DhCBQt5bqzZwgopV8EA96aCnngu5ebR1ooDFq",
|
|
51202
|
+
validatorVoteAccount: "Cue647T8jgwpRSDUb8ttTYx7NiEfJCRZNiiw1qmchXsG",
|
|
51203
|
+
tokenAddress: "EAR6LenhNstHxR9289rWakm82WgLJYvHD7NawfXtuyUx",
|
|
51204
|
+
tokenName: "KIWAMI",
|
|
51205
|
+
tokenSymbol: "KIWAMI"
|
|
51206
|
+
},
|
|
51207
|
+
{
|
|
51208
|
+
bankAddress: "GLSCJ39N82Xo21621jMheinvjQLrBrkG7gzo2C5L1y6y",
|
|
51209
|
+
validatorVoteAccount: "7emL18Bnve7wbYE9Az7vYJjikxN6YPU81igf6rVU5FN8",
|
|
51210
|
+
tokenAddress: "EQuMUgLZArKwWUk6uGPmTGYUgNbfgJrbBaNR7CQyZ5uf",
|
|
51211
|
+
tokenName: "Temporal Topaz",
|
|
51212
|
+
tokenSymbol: "TOPAZ"
|
|
51213
|
+
},
|
|
51214
|
+
{
|
|
51215
|
+
bankAddress: "4irzCCsU53ffh9XB7NxGzbbHjvSR7FTfPbn6KoXkt7kX",
|
|
51216
|
+
validatorVoteAccount: "2iWXwF2Q5W6o7yntV2mkbxncB4rYHnX61y3NU8a8EFMJ",
|
|
51217
|
+
tokenAddress: "14Pets6QpE9iXKkXg8Ri4GcDazRMfWR3guM6LZXnFChc",
|
|
51218
|
+
tokenName: "Bull Moose SOL",
|
|
51219
|
+
tokenSymbol: "bmsSOL"
|
|
51220
|
+
},
|
|
51221
|
+
{
|
|
51222
|
+
bankAddress: "C96do7nkEaaFjHq8jHzPpyPTdJSea5xEGwxDzDSepCzf",
|
|
51223
|
+
validatorVoteAccount: "voteRnv6PBzmiGP8NicWtQiqEJTwKKq2SxtqtdLUJjd",
|
|
51224
|
+
tokenAddress: "3YEDiJ4r4xRGNhq6nudRnkwrdKHG7PAtDim24CjTMtBH",
|
|
51225
|
+
tokenName: "diman",
|
|
51226
|
+
tokenSymbol: "DIMAN"
|
|
51227
|
+
},
|
|
51228
|
+
{
|
|
51229
|
+
bankAddress: "9dZiyG51FBR4BWpAs69XbDpr7GfVAEB1ZB89v38maV36",
|
|
51230
|
+
validatorVoteAccount: "Simpj3KyRQmpRkXuBvCQFS7DBBG6vqw93SkZb9UD1hp",
|
|
51231
|
+
tokenAddress: "77YLpVLQXr2KU66GM2JykbT9g5du7LarWgehbWD3CJaB",
|
|
51232
|
+
tokenName: "SIMPDIGIT",
|
|
51233
|
+
tokenSymbol: "SIMPDIGIT"
|
|
51234
|
+
},
|
|
51235
|
+
{
|
|
51236
|
+
bankAddress: "2foqT8wWzWRduyV37uRdj81DijkNMKzYD3D6JPfir7La",
|
|
51237
|
+
validatorVoteAccount: "48oxpSHQkM4sdXUY9NQ8KnEtebzZbyk8uUT7JRdVQNuf",
|
|
51238
|
+
tokenAddress: "42m7Ygk5VxREdKfcFrsH1HnuoqCke8BcVcxNeywMCfp2",
|
|
51239
|
+
tokenName: "Infinite Lux",
|
|
51240
|
+
tokenSymbol: "LUX"
|
|
51241
|
+
},
|
|
51242
|
+
{
|
|
51243
|
+
bankAddress: "FsdWEJzHXkUXejWnb7c1p9UJtF69hVWQNNoakjoXyRCJ",
|
|
51244
|
+
validatorVoteAccount: "4AUED4uj6nSTuANzaAUnGBPJQRmhpDYDwoWJNkoUUBBW",
|
|
51245
|
+
tokenAddress: "CiyQTfHJ9PbTwC7TGf4pXZk8szcWGJ8TeFhhCuUwybqi",
|
|
51246
|
+
tokenName: "Anagram",
|
|
51247
|
+
tokenSymbol: "ANAGRAM"
|
|
51248
|
+
},
|
|
51249
|
+
{
|
|
51250
|
+
bankAddress: "2hs1pHAzDWGqnn1d8VQkc8bZRfQ45grYvzfau8dnWFUk",
|
|
51251
|
+
validatorVoteAccount: "2NxEEbhqqj1Qptq5LXLbDTP5tLa9f7PqkU8zNgxbGU9P",
|
|
51252
|
+
tokenAddress: "9yQLxEzusZ7QiZNafDNdzbEaTCPuJToGjMhLRJtZbgsd",
|
|
51253
|
+
tokenName: "NANSEN",
|
|
51254
|
+
tokenSymbol: "NANSEN"
|
|
51255
|
+
},
|
|
51256
|
+
{
|
|
51257
|
+
bankAddress: "FCi8unSVCwJd3QkrhTtv6LTTjw1c4zV65D5cG5N1rAG6",
|
|
51258
|
+
validatorVoteAccount: "Va1idkzkB6LEmVFmxWbWU8Ao9qehC62Tjmf68L3uYKj",
|
|
51259
|
+
tokenAddress: "AExKb8oJ6mGPYJUyfiX49DMMi226h2AnWeG1G6neQBEz",
|
|
51260
|
+
tokenName: "VALIDATOR",
|
|
51261
|
+
tokenSymbol: "VALID"
|
|
51262
|
+
},
|
|
51263
|
+
{
|
|
51264
|
+
bankAddress: "HzS8RqaQ5syk6EHbVi7h9rFYN48PpxykUXEs6w9wNfNP",
|
|
51265
|
+
validatorVoteAccount: "sTach38ebT8jnGH8i2D1g8NDAS6An19whVMnSSWPXt4",
|
|
51266
|
+
tokenAddress: "AFDVYBqxADagPfN9DdbrNrf9zZqugub7CV4kUJEUrK6J",
|
|
51267
|
+
tokenName: "Stache Node",
|
|
51268
|
+
tokenSymbol: "STACHE"
|
|
51269
|
+
},
|
|
51270
|
+
{
|
|
51271
|
+
bankAddress: "9Hs4E6ACNw6Hmwjvm1duXzbaWmvXxSxN11agw4updEn1",
|
|
51272
|
+
validatorVoteAccount: "EtMSc3MvcDXUr6ChK5GxyFVwTxYA3zqP5XzjE9jwKvSV",
|
|
51273
|
+
tokenAddress: "ENKFyZQZHzNNSxcKYoaVsNLi2xoGPoStZH4A9xxezjbC",
|
|
51274
|
+
tokenName: "Mad Lads CN",
|
|
51275
|
+
tokenSymbol: "MadLadsCN"
|
|
51276
|
+
},
|
|
51277
|
+
{
|
|
51278
|
+
bankAddress: "4watsWcjTBAwsrZpArwQbnNX4bQ1yeHBxgdbrGT4eMu9",
|
|
51279
|
+
validatorVoteAccount: "EARNynHRWg6GfyJCmrrizcZxARB3HVzcaasvNa8kBS72",
|
|
51280
|
+
tokenAddress: "8fhkWcm2n28JuadzY7mRR8FFDZZfnaPfWgw7pLNVZCbE",
|
|
51281
|
+
tokenName: "Solana Compass Stake",
|
|
51282
|
+
tokenSymbol: "compaStake"
|
|
51283
|
+
},
|
|
51284
|
+
{
|
|
51285
|
+
bankAddress: "9d7MTvcz1VMB1rK6H73quMxkR26dLPz5HDaac2eGRjQx",
|
|
51286
|
+
validatorVoteAccount: "nymsndUdAZyUPpWYz5VEg8Ghj9cFvwTRgciLogpmYaQ",
|
|
51287
|
+
tokenAddress: "FWFeaqpkgDr3ejVSY3HjiUmUg3u9fcr5d66HvimnDLWE",
|
|
51288
|
+
tokenName: "Hypo Nyms",
|
|
51289
|
+
tokenSymbol: "NYMS"
|
|
51290
|
+
},
|
|
51291
|
+
{
|
|
51292
|
+
bankAddress: "6V4vCK3n3JVncfpS16mW8ceLoNPatvu61pKxFmWx8adi",
|
|
51293
|
+
validatorVoteAccount: "BT8LZUvQVwFHRGw2Dwv7UeqDUq7btfjegLpuz5bwgziD",
|
|
51294
|
+
tokenAddress: "9YRS7Stf9dVibTT1M4uVEAuRMcoS4MH1QxqXy9Lssrab",
|
|
51295
|
+
tokenName: "private",
|
|
51296
|
+
tokenSymbol: "private"
|
|
51297
|
+
},
|
|
51298
|
+
{
|
|
51299
|
+
bankAddress: "CK8qRAcmvkDXaqX2S5GkgTCZT5pCz34me1neQhpJYe1Z",
|
|
51300
|
+
validatorVoteAccount: "Ac1beBKixfNdrTAac7GRaTsJTxLyvgGvJjvy4qQfvyfc",
|
|
51301
|
+
tokenAddress: "DLTAbTL5NXhbqX6LX3ie3tf52pdtGpxe2DrZUr1RhgY6",
|
|
51302
|
+
tokenName: "Stronghold",
|
|
51303
|
+
tokenSymbol: "Stronghold"
|
|
51304
|
+
},
|
|
51305
|
+
{
|
|
51306
|
+
bankAddress: "H6CT1aiCgSNw9S6aq38npEhdoN2UPhSKe8Lj9fQqqjuu",
|
|
51307
|
+
validatorVoteAccount: "FREEL1BCzmPpNneC7FHCtBqzeWYrHRbtisFvi4N8XUP9",
|
|
51308
|
+
tokenAddress: "AKFuMoM5rjSpQSL4p6TBoc7D4dmEem9QrHhuSDCBYyZ8",
|
|
51309
|
+
tokenName: "Ross",
|
|
51310
|
+
tokenSymbol: "Ross"
|
|
51311
|
+
},
|
|
51312
|
+
{
|
|
51313
|
+
bankAddress: "G46aHuakgStymbE2WsLbja61mH5UXBPdSdpwf6Ci3saG",
|
|
51314
|
+
validatorVoteAccount: "mnvkHm47ZmRKoSWuQZAfXLRiDPiKCq8PWkMWrp1Wwqe",
|
|
51315
|
+
tokenAddress: "Cq9S5UB9BviPn5yoGkEDk3m7neQag4KJnhPWGyuev9W8",
|
|
51316
|
+
tokenName: "gripto staked sol",
|
|
51317
|
+
tokenSymbol: "GRIPTO"
|
|
51318
|
+
},
|
|
51319
|
+
{
|
|
51320
|
+
bankAddress: "75UmeEMdqVnGn3JHx8yVZEn7viybJ73XYSjhYCYfyhp2",
|
|
51321
|
+
validatorVoteAccount: "4m1PbxzwLdUnEwog3T9UKxgjktgriHgE1CfAhMqDw7Xx",
|
|
51322
|
+
tokenAddress: "432SogPNunjZMneDV6goZ8ZcCQz282GxoSJ4rwqx95pT",
|
|
51323
|
+
tokenName: "kumasol",
|
|
51324
|
+
tokenSymbol: "kumasol"
|
|
51325
|
+
},
|
|
51326
|
+
{
|
|
51327
|
+
bankAddress: "3zk6EmXANYQK12bwy9dySRAM4cT2vT5cDcAB79j8G33B",
|
|
51328
|
+
validatorVoteAccount: "HvsD9L5t62MGv3QBD2K7xjkipGYr9UZN7BtsW8NuSPpg",
|
|
51329
|
+
tokenAddress: "5vmwd6JHDCmX9W2XT1n2QpvYGA2kk4Xf7qWSayDU6caT",
|
|
51330
|
+
tokenName: "ArgenTerraSOL",
|
|
51331
|
+
tokenSymbol: "atSOL"
|
|
51332
|
+
},
|
|
51333
|
+
{
|
|
51334
|
+
bankAddress: "4C2vPweGNpiE6kTEbYvcbUBHNWxrn4ErQYaqWm5zDexx",
|
|
51335
|
+
validatorVoteAccount: "FnAPJkzf19s87sm24Qhv6bHZMZvZ43gjNUBRgjwXpD4v",
|
|
51336
|
+
tokenAddress: "6q4kVnwUpkE3i7W32dqaX6V12pbsrCnMqZ7TWz9yp1m5",
|
|
51337
|
+
tokenName: "BLOCKPORT",
|
|
51338
|
+
tokenSymbol: "BPT"
|
|
51339
|
+
},
|
|
51340
|
+
{
|
|
51341
|
+
bankAddress: "E5hZu5QQ1pRmGvyS4JHGXVQwzdUPaYM4yEiNKr64YzyG",
|
|
51342
|
+
validatorVoteAccount: "nfGcSJkP35SkPa5475iBChmq1UNcj7JE1uQHrrasymm",
|
|
51343
|
+
tokenAddress: "AQpQoJ3tJKGH9Yn8GSzoUsVcHPJjj3xYfQFp9XVr74F6",
|
|
51344
|
+
tokenName: "Test01",
|
|
51345
|
+
tokenSymbol: "TEST01"
|
|
51346
|
+
},
|
|
51347
|
+
{
|
|
51348
|
+
bankAddress: "3VCkXWAmE5DSwYRpqGFnkUz7vvD2RKbhFvrhzLuE8msu",
|
|
51349
|
+
validatorVoteAccount: "abc1zP7ihWsgQW8z5YmfQNqMckJE5Dfx8fwUNMNVNkY",
|
|
51350
|
+
tokenAddress: "BNisp3omkr6Rg5nHESWafjUbeCpGPy6MYq1iRJRgSAsh",
|
|
51351
|
+
tokenName: "ALGO STAKE",
|
|
51352
|
+
tokenSymbol: "ALGO"
|
|
51353
|
+
},
|
|
51354
|
+
{
|
|
51355
|
+
bankAddress: "7BHHMWw3P1AyebLhX9A8wnDeeGy8jgFXqqHuEZt7BVmW",
|
|
51356
|
+
validatorVoteAccount: "8Pep3GmYiijRALqrMKpez92cxvF4YPTzoZg83uXh14pW",
|
|
51357
|
+
tokenAddress: "zBH13AzXYCqHZKS8NGa4KR8zQhWiyvFdDY15nmfrHgS",
|
|
51358
|
+
tokenName: "8Pep",
|
|
51359
|
+
tokenSymbol: "8Pep"
|
|
51360
|
+
},
|
|
51361
|
+
{
|
|
51362
|
+
bankAddress: "9QWUatjtJtc98yts4ufWnmNeaWQRmaaLjFwbK3iMdS47",
|
|
51363
|
+
validatorVoteAccount: "CatzoSMUkTRidT5DwBxAC2pEtnwMBTpkCepHkFgZDiqb",
|
|
51364
|
+
tokenAddress: "98B1NMLYaNJQNxiQGr53vbjNFMNTYFmDqoCgj7qD9Vhm",
|
|
51365
|
+
tokenName: "JUPITER ",
|
|
51366
|
+
tokenSymbol: "JUPITER"
|
|
51367
|
+
},
|
|
51368
|
+
{
|
|
51369
|
+
bankAddress: "5q1wJkGqqRh6mSBtjG8sfjBsgJSGdA2QoXTWv4UQbHGk",
|
|
51370
|
+
validatorVoteAccount: "shft7Fry1js37Hm9wq4dfwcZSp2DyKszeWMvEpjYCQ1",
|
|
51371
|
+
tokenAddress: "C1KwBJZNwUaodUcP5kXqD52NCuZzThNAG2cw3vt5H6iE",
|
|
51372
|
+
tokenName: "BLUESHIFT",
|
|
51373
|
+
tokenSymbol: "SHIFT"
|
|
51374
|
+
},
|
|
51375
|
+
{
|
|
51376
|
+
bankAddress: "FZaHyfg9hmNMKpfUJ474wNKPaPdXMpnJouasKnndECiZ",
|
|
51377
|
+
validatorVoteAccount: "DdCNGDpP7qMgoAy6paFzhhak2EeyCZcgjH7ak5u5v28m",
|
|
51378
|
+
tokenAddress: "PhxXAYTkFZS23ZWvFcz6H6Uq4VnVBMa6hniiAyudjaW",
|
|
51379
|
+
tokenName: "KILN1",
|
|
51380
|
+
tokenSymbol: "KILN1"
|
|
51381
|
+
},
|
|
51382
|
+
{
|
|
51383
|
+
bankAddress: "5CBocarwfJeWGNozGemWktRYSz6kPikRPdfH8ZHSFrsg",
|
|
51384
|
+
validatorVoteAccount: "8zuMRTXThoPTTPLLvaiKiJshLLCqGMt9BdRjjCL19xBc",
|
|
51385
|
+
tokenAddress: "BDsEuxFWznAP5cUCannnfjyjDtTwqN57CkGfDbjx2nNZ",
|
|
51386
|
+
tokenName: "DawnLabs",
|
|
51387
|
+
tokenSymbol: "DawnLabs"
|
|
51388
|
+
},
|
|
51389
|
+
{
|
|
51390
|
+
bankAddress: "9ivswG37QpCUmkPkLMpRZT7PMyP64V9dDpZdteM254ec",
|
|
51391
|
+
validatorVoteAccount: "gaToR246dheK1DGAMEqxMdBJZwU4qFyt7DzhSwAHFWF",
|
|
51392
|
+
tokenAddress: "TjA2rtxoUFzyPVAw35VQGEQnNXiwcmNjKSk29nmkq1P",
|
|
51393
|
+
tokenName: "Valigator Open",
|
|
51394
|
+
tokenSymbol: "Valigator"
|
|
51395
|
+
}
|
|
51396
|
+
];
|
|
51397
|
+
|
|
51398
|
+
// src/services/native-stake/utils/metadata.utils.ts
|
|
51399
|
+
var _metadataMap = null;
|
|
51400
|
+
var _voteAccountByBank = null;
|
|
51401
|
+
function getStakedBankMetadataMap() {
|
|
51402
|
+
if (!_metadataMap) {
|
|
51403
|
+
_metadataMap = /* @__PURE__ */ new Map();
|
|
51404
|
+
for (const entry of STAKED_BANK_METADATA_JSON) {
|
|
51405
|
+
_metadataMap.set(entry.bankAddress, entry);
|
|
51406
|
+
}
|
|
51407
|
+
}
|
|
51408
|
+
return _metadataMap;
|
|
51409
|
+
}
|
|
51410
|
+
function getValidatorVoteAccountByBank() {
|
|
51411
|
+
if (!_voteAccountByBank) {
|
|
51412
|
+
_voteAccountByBank = {};
|
|
51413
|
+
for (const entry of STAKED_BANK_METADATA_JSON) {
|
|
51414
|
+
_voteAccountByBank[entry.bankAddress] = entry.validatorVoteAccount;
|
|
51415
|
+
}
|
|
51416
|
+
}
|
|
51417
|
+
return _voteAccountByBank;
|
|
51418
|
+
}
|
|
50659
51419
|
async function getKaminoMetadata(options) {
|
|
50660
51420
|
const kaminoBanks = options.banks.filter((b) => b.config.assetTag === 3 /* KAMINO */);
|
|
50661
51421
|
const DEFAULT_PUBKEY = web3_js.PublicKey.default;
|
|
@@ -53104,6 +53864,66 @@ var MarginfiAccountWrapper = class {
|
|
|
53104
53864
|
return this.account.getHealthCheckAccounts(this.client.bankMap, mandatoryBanks, excludedBanks);
|
|
53105
53865
|
}
|
|
53106
53866
|
// ----------------------------------------------------------------------------
|
|
53867
|
+
// Native stake actions
|
|
53868
|
+
// Note: These call standalone action functions directly rather than routing
|
|
53869
|
+
// through this.account because they interact with the SPL stake pool program,
|
|
53870
|
+
// not the marginfi program. No MarginfiAccount state is needed.
|
|
53871
|
+
// ----------------------------------------------------------------------------
|
|
53872
|
+
/**
|
|
53873
|
+
* Creates a transaction to mint LST from a native stake account.
|
|
53874
|
+
*
|
|
53875
|
+
* Converts a native stake account (or a portion of it) into LST tokens
|
|
53876
|
+
* by depositing the stake into the single-validator pool.
|
|
53877
|
+
*
|
|
53878
|
+
* @param amount - SOL amount to convert (in UI units)
|
|
53879
|
+
* @param stakeAccountPk - The stake account to convert
|
|
53880
|
+
* @param validator - The validator vote account
|
|
53881
|
+
*/
|
|
53882
|
+
async makeMintStakedLstTx(amount, stakeAccountPk, validator) {
|
|
53883
|
+
return makeMintStakedLstTx({
|
|
53884
|
+
amount,
|
|
53885
|
+
authority: this.authority,
|
|
53886
|
+
stakeAccountPk,
|
|
53887
|
+
validator,
|
|
53888
|
+
connection: this.client.program.provider.connection,
|
|
53889
|
+
luts: this.client.addressLookupTables
|
|
53890
|
+
});
|
|
53891
|
+
}
|
|
53892
|
+
/**
|
|
53893
|
+
* Creates a transaction to redeem LST tokens back to a native stake account.
|
|
53894
|
+
*
|
|
53895
|
+
* Burns LST tokens and withdraws the underlying stake into a new stake account.
|
|
53896
|
+
*
|
|
53897
|
+
* @param amount - LST amount to redeem (in UI units)
|
|
53898
|
+
* @param validator - The validator vote account
|
|
53899
|
+
*/
|
|
53900
|
+
async makeRedeemStakedLstTx(amount, validator) {
|
|
53901
|
+
return makeRedeemStakedLstTx({
|
|
53902
|
+
amount,
|
|
53903
|
+
authority: this.authority,
|
|
53904
|
+
validator,
|
|
53905
|
+
connection: this.client.program.provider.connection,
|
|
53906
|
+
luts: this.client.addressLookupTables
|
|
53907
|
+
});
|
|
53908
|
+
}
|
|
53909
|
+
/**
|
|
53910
|
+
* Creates a transaction to merge two stake accounts.
|
|
53911
|
+
*
|
|
53912
|
+
* Both accounts must share the same authorized staker/withdrawer and vote account.
|
|
53913
|
+
*
|
|
53914
|
+
* @param sourceStakeAccount - The stake account to merge from (will be consumed)
|
|
53915
|
+
* @param destinationStakeAccount - The stake account to merge into
|
|
53916
|
+
*/
|
|
53917
|
+
async makeMergeStakeAccountsTx(sourceStakeAccount, destinationStakeAccount) {
|
|
53918
|
+
return makeMergeStakeAccountsTx({
|
|
53919
|
+
authority: this.authority,
|
|
53920
|
+
sourceStakeAccount,
|
|
53921
|
+
destinationStakeAccount,
|
|
53922
|
+
connection: this.client.program.provider.connection,
|
|
53923
|
+
luts: this.client.addressLookupTables
|
|
53924
|
+
});
|
|
53925
|
+
}
|
|
53926
|
+
// ----------------------------------------------------------------------------
|
|
53107
53927
|
// Helper methods
|
|
53108
53928
|
// ----------------------------------------------------------------------------
|
|
53109
53929
|
/**
|
|
@@ -53365,7 +54185,6 @@ var Project0Client = class _Project0Client {
|
|
|
53365
54185
|
assetShareMultiplierByBank.set(bank.address.toBase58(), new BigNumber3__default.default(1));
|
|
53366
54186
|
break;
|
|
53367
54187
|
case 2 /* STAKED */:
|
|
53368
|
-
assetShareMultiplierByBank.set(bank.address.toBase58(), new BigNumber3__default.default(1));
|
|
53369
54188
|
break;
|
|
53370
54189
|
case 0 /* DEFAULT */:
|
|
53371
54190
|
case 1 /* SOL */:
|
|
@@ -53374,6 +54193,56 @@ var Project0Client = class _Project0Client {
|
|
|
53374
54193
|
break;
|
|
53375
54194
|
}
|
|
53376
54195
|
});
|
|
54196
|
+
const stakedBanks = banksArray.filter((b) => b.config.assetTag === 2 /* STAKED */);
|
|
54197
|
+
if (stakedBanks.length > 0) {
|
|
54198
|
+
const metadataMap = getStakedBankMetadataMap();
|
|
54199
|
+
const stakedBankAddresses = [];
|
|
54200
|
+
const poolStakeAddresses = [];
|
|
54201
|
+
const lstMintAddresses = [];
|
|
54202
|
+
for (const bank of stakedBanks) {
|
|
54203
|
+
const metadata = metadataMap.get(bank.address.toBase58());
|
|
54204
|
+
if (!metadata) {
|
|
54205
|
+
assetShareMultiplierByBank.set(bank.address.toBase58(), new BigNumber3__default.default(1));
|
|
54206
|
+
continue;
|
|
54207
|
+
}
|
|
54208
|
+
const pool = findPoolAddress(new web3_js.PublicKey(metadata.validatorVoteAccount));
|
|
54209
|
+
stakedBankAddresses.push(bank.address.toBase58());
|
|
54210
|
+
poolStakeAddresses.push(findPoolStakeAddress(pool));
|
|
54211
|
+
lstMintAddresses.push(findPoolMintAddress(pool));
|
|
54212
|
+
}
|
|
54213
|
+
if (stakedBankAddresses.length > 0) {
|
|
54214
|
+
const allAddresses = [
|
|
54215
|
+
...poolStakeAddresses.map((a) => a.toBase58()),
|
|
54216
|
+
...lstMintAddresses.map((a) => a.toBase58())
|
|
54217
|
+
];
|
|
54218
|
+
const accountInfos = await chunkedGetRawMultipleAccountInfoOrdered(
|
|
54219
|
+
connection,
|
|
54220
|
+
allAddresses
|
|
54221
|
+
);
|
|
54222
|
+
const poolStakeInfos = accountInfos.slice(0, poolStakeAddresses.length);
|
|
54223
|
+
const lstMintInfos = accountInfos.slice(poolStakeAddresses.length);
|
|
54224
|
+
for (let i = 0; i < stakedBankAddresses.length; i++) {
|
|
54225
|
+
const bankAddr = stakedBankAddresses[i];
|
|
54226
|
+
const poolStakeInfo = poolStakeInfos[i];
|
|
54227
|
+
const lstMintInfo = lstMintInfos[i];
|
|
54228
|
+
if (!poolStakeInfo || !lstMintInfo) {
|
|
54229
|
+
assetShareMultiplierByBank.set(bankAddr, new BigNumber3__default.default(1));
|
|
54230
|
+
continue;
|
|
54231
|
+
}
|
|
54232
|
+
const stakeLamports = poolStakeInfo.lamports;
|
|
54233
|
+
const supplyBuffer = lstMintInfo.data.slice(36, 44);
|
|
54234
|
+
const lstMintSupply = Number(Buffer.from(supplyBuffer).readBigUInt64LE(0));
|
|
54235
|
+
if (lstMintSupply === 0) {
|
|
54236
|
+
assetShareMultiplierByBank.set(bankAddr, new BigNumber3__default.default(1));
|
|
54237
|
+
continue;
|
|
54238
|
+
}
|
|
54239
|
+
const LAMPORTS_PER_SOL5 = 1e9;
|
|
54240
|
+
const adjustedStake = Math.max(stakeLamports - LAMPORTS_PER_SOL5, 0);
|
|
54241
|
+
const multiplier = new BigNumber3__default.default(adjustedStake).dividedBy(lstMintSupply);
|
|
54242
|
+
assetShareMultiplierByBank.set(bankAddr, multiplier);
|
|
54243
|
+
}
|
|
54244
|
+
}
|
|
54245
|
+
}
|
|
53377
54246
|
const emodePairs = getEmodePairs(banksArray);
|
|
53378
54247
|
return new _Project0Client(
|
|
53379
54248
|
program,
|
|
@@ -53646,9 +54515,11 @@ exports.getOracleSourceFromOracleSetup = getOracleSourceFromOracleSetup;
|
|
|
53646
54515
|
exports.getOracleSourceNameFromKey = getOracleSourceNameFromKey;
|
|
53647
54516
|
exports.getPrice = getPrice;
|
|
53648
54517
|
exports.getPriceWithConfidence = getPriceWithConfidence;
|
|
54518
|
+
exports.getStakedBankMetadataMap = getStakedBankMetadataMap;
|
|
53649
54519
|
exports.getTotalAssetQuantity = getTotalAssetQuantity;
|
|
53650
54520
|
exports.getTotalLiabilityQuantity = getTotalLiabilityQuantity;
|
|
53651
54521
|
exports.getTxSize = getTxSize;
|
|
54522
|
+
exports.getValidatorVoteAccountByBank = getValidatorVoteAccountByBank;
|
|
53652
54523
|
exports.groupToDto = groupToDto;
|
|
53653
54524
|
exports.hasAccountFlag = hasAccountFlag;
|
|
53654
54525
|
exports.hasEmodeEntryFlag = hasEmodeEntryFlag;
|
|
@@ -53688,11 +54559,16 @@ exports.makeKaminoDepositTx = makeKaminoDepositTx;
|
|
|
53688
54559
|
exports.makeKaminoWithdrawIx = makeKaminoWithdrawIx3;
|
|
53689
54560
|
exports.makeKaminoWithdrawTx = makeKaminoWithdrawTx;
|
|
53690
54561
|
exports.makeLoopTx = makeLoopTx;
|
|
54562
|
+
exports.makeMergeStakeAccountsTx = makeMergeStakeAccountsTx;
|
|
54563
|
+
exports.makeMintStakedLstIx = makeMintStakedLstIx;
|
|
54564
|
+
exports.makeMintStakedLstTx = makeMintStakedLstTx;
|
|
53691
54565
|
exports.makePoolAddBankIx = makePoolAddBankIx3;
|
|
53692
54566
|
exports.makePoolConfigureBankIx = makePoolConfigureBankIx3;
|
|
53693
54567
|
exports.makePriorityFeeIx = makePriorityFeeIx;
|
|
53694
54568
|
exports.makePriorityFeeMicroIx = makePriorityFeeMicroIx;
|
|
53695
54569
|
exports.makePulseHealthIx = makePulseHealthIx2;
|
|
54570
|
+
exports.makeRedeemStakedLstIx = makeRedeemStakedLstIx;
|
|
54571
|
+
exports.makeRedeemStakedLstTx = makeRedeemStakedLstTx;
|
|
53696
54572
|
exports.makeRefreshKaminoBanksIxs = makeRefreshKaminoBanksIxs;
|
|
53697
54573
|
exports.makeRepayIx = makeRepayIx3;
|
|
53698
54574
|
exports.makeRepayTx = makeRepayTx;
|