@glamsystems/glam-sdk 0.1.35 → 0.1.36
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/index.cjs.js +2 -1
- package/index.esm.js +2 -1
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -19505,7 +19505,8 @@ class StakingClient {
|
|
|
19505
19505
|
const { programId: stakePoolProgram, poolMint, withdrawAuthority, feeAccount, tokenProgramId: tokenProgram, validatorList, reserveStake } = await this.getStakePoolAccountData(stakePool);
|
|
19506
19506
|
const poolTokensFrom = this.base.getVaultAta(poolMint, tokenProgram);
|
|
19507
19507
|
// The reserve stake account should NOT be used for withdrawals unless we have no other options.
|
|
19508
|
-
|
|
19508
|
+
// And only active validator stake accounts should be used.
|
|
19509
|
+
const validatorStakeCandidates = (await getStakeAccountsWithStates(this.base.provider.connection, withdrawAuthority)).filter((s)=>!s.address.equals(reserveStake) && s.state === "active");
|
|
19509
19510
|
const validatorStakeAccount = validatorStakeCandidates.length === 0 ? reserveStake : validatorStakeCandidates[0].address;
|
|
19510
19511
|
const [stakeAccount, createStakeAccountIx] = await this.createStakeAccount(glamSigner);
|
|
19511
19512
|
const postInstructions = deactivate ? [
|
package/index.esm.js
CHANGED
|
@@ -19485,7 +19485,8 @@ class StakingClient {
|
|
|
19485
19485
|
const { programId: stakePoolProgram, poolMint, withdrawAuthority, feeAccount, tokenProgramId: tokenProgram, validatorList, reserveStake } = await this.getStakePoolAccountData(stakePool);
|
|
19486
19486
|
const poolTokensFrom = this.base.getVaultAta(poolMint, tokenProgram);
|
|
19487
19487
|
// The reserve stake account should NOT be used for withdrawals unless we have no other options.
|
|
19488
|
-
|
|
19488
|
+
// And only active validator stake accounts should be used.
|
|
19489
|
+
const validatorStakeCandidates = (await getStakeAccountsWithStates(this.base.provider.connection, withdrawAuthority)).filter((s)=>!s.address.equals(reserveStake) && s.state === "active");
|
|
19489
19490
|
const validatorStakeAccount = validatorStakeCandidates.length === 0 ? reserveStake : validatorStakeCandidates[0].address;
|
|
19490
19491
|
const [stakeAccount, createStakeAccountIx] = await this.createStakeAccount(glamSigner);
|
|
19491
19492
|
const postInstructions = deactivate ? [
|