@ignitionfi/spl-stake-pool 1.1.25 → 1.1.26
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.browser.cjs.js +10 -23
- package/dist/index.browser.cjs.js.map +1 -1
- package/dist/index.browser.esm.js +10 -23
- package/dist/index.browser.esm.js.map +1 -1
- package/dist/index.cjs.js +10 -23
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +10 -23
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +10 -23
- package/dist/index.iife.js.map +1 -1
- package/dist/index.iife.min.js +1 -1
- package/dist/index.iife.min.js.map +1 -1
- package/dist/instructions.d.ts +2 -3
- package/package.json +1 -1
- package/src/instructions.ts +9 -25
- package/src/utils/stake.ts +3 -3
package/dist/index.iife.js
CHANGED
|
@@ -22013,7 +22013,7 @@ var solanaStakePool = (function (exports, node_buffer) {
|
|
|
22013
22013
|
const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint);
|
|
22014
22014
|
const validatorListAcc = await connection.getAccountInfo(stakePool.validatorList);
|
|
22015
22015
|
const validatorList = ValidatorListLayout.decode(validatorListAcc === null || validatorListAcc === void 0 ? void 0 : validatorListAcc.data);
|
|
22016
|
-
if (!(validatorList === null || validatorList === void 0 ? void 0 : validatorList.validators) || (validatorList === null || validatorList === void 0 ? void 0 : validatorList.validators.length)
|
|
22016
|
+
if (!(validatorList === null || validatorList === void 0 ? void 0 : validatorList.validators) || (validatorList === null || validatorList === void 0 ? void 0 : validatorList.validators.length) === 0) {
|
|
22017
22017
|
throw new Error('No accounts found');
|
|
22018
22018
|
}
|
|
22019
22019
|
const minBalanceForRentExemption = await connection.getMinimumBalanceForRentExemption(StakeProgram.space);
|
|
@@ -22068,9 +22068,9 @@ var solanaStakePool = (function (exports, node_buffer) {
|
|
|
22068
22068
|
denominator: fee.denominator,
|
|
22069
22069
|
};
|
|
22070
22070
|
for (const type of ['preferred', 'active', 'transient', 'reserve']) {
|
|
22071
|
-
const filteredAccounts = accounts.filter(a => a.type
|
|
22071
|
+
const filteredAccounts = accounts.filter(a => a.type === type);
|
|
22072
22072
|
for (const { stakeAddress, voteAddress, lamports } of filteredAccounts) {
|
|
22073
|
-
if (lamports.lte(minBalance) && type
|
|
22073
|
+
if (lamports.lte(minBalance) && type === 'transient') {
|
|
22074
22074
|
continue;
|
|
22075
22075
|
}
|
|
22076
22076
|
let availableForWithdrawal = calcPoolTokensForDeposit(stakePool, lamports);
|
|
@@ -22845,38 +22845,25 @@ var solanaStakePool = (function (exports, node_buffer) {
|
|
|
22845
22845
|
/**
|
|
22846
22846
|
* Creates a transaction instruction to withdraw SOL from a deactivated user stake account using a Fogo session.
|
|
22847
22847
|
* The stake account must be fully deactivated (inactive).
|
|
22848
|
-
* User receives full stake balance (payer's rent contribution compensates for reduced split).
|
|
22849
22848
|
*/
|
|
22850
22849
|
static withdrawFromStakeAccountWithSession(params) {
|
|
22851
|
-
|
|
22852
|
-
const
|
|
22853
|
-
|
|
22854
|
-
|
|
22855
|
-
|
|
22856
|
-
const data = new Uint8Array(17);
|
|
22857
|
-
data[0] = 30; // instruction discriminator (WithdrawFromStakeAccountWithSession = 30)
|
|
22858
|
-
// Write lamports as u64 little-endian (bytes 1-8)
|
|
22859
|
-
const lamportsBigInt = isFullWithdrawal ? U64_MAX : params.lamports;
|
|
22860
|
-
for (let i = 0; i < 8; i++) {
|
|
22861
|
-
data[1 + i] = Number((lamportsBigInt >> BigInt(i * 8)) & BigInt(0xff));
|
|
22862
|
-
}
|
|
22863
|
-
// Write userStakeSeed as u64 little-endian (bytes 9-16)
|
|
22864
|
-
const seedBigInt = BigInt(params.userStakeSeed);
|
|
22865
|
-
for (let i = 0; i < 8; i++) {
|
|
22866
|
-
data[9 + i] = Number((seedBigInt >> BigInt(i * 8)) & BigInt(0xff));
|
|
22867
|
-
}
|
|
22868
|
-
// Account order matches Rust: stake_account, recipient, clock, stake_history, session_signer
|
|
22850
|
+
const type = STAKE_POOL_INSTRUCTION_LAYOUTS.WithdrawFromStakeAccountWithSession;
|
|
22851
|
+
const data = encodeData(type, {
|
|
22852
|
+
lamports: params.lamports,
|
|
22853
|
+
userStakeSeed: params.userStakeSeed,
|
|
22854
|
+
});
|
|
22869
22855
|
const keys = [
|
|
22870
22856
|
{ pubkey: params.userStakeAccount, isSigner: false, isWritable: true },
|
|
22871
22857
|
{ pubkey: params.userWallet, isSigner: false, isWritable: true },
|
|
22872
22858
|
{ pubkey: SYSVAR_CLOCK_PUBKEY, isSigner: false, isWritable: false },
|
|
22873
22859
|
{ pubkey: SYSVAR_STAKE_HISTORY_PUBKEY, isSigner: false, isWritable: false },
|
|
22874
22860
|
{ pubkey: params.sessionSigner, isSigner: true, isWritable: false },
|
|
22861
|
+
{ pubkey: StakeProgram.programId, isSigner: false, isWritable: false },
|
|
22875
22862
|
];
|
|
22876
22863
|
return new TransactionInstruction({
|
|
22877
22864
|
programId: params.programId,
|
|
22878
22865
|
keys,
|
|
22879
|
-
data
|
|
22866
|
+
data,
|
|
22880
22867
|
});
|
|
22881
22868
|
}
|
|
22882
22869
|
/**
|