Deactivate Solana
The deactivate
namespace contains method used for deactivation of the user stake account. The unique method to the deactivate
namespace is:
deactivate(address, stakeAccountPublicKey)
: Deactivate user stake account.
Deactivate Code Example
ts
// Import SDK
import { Solana } from '@everstake/wallet-sdk';
// You can get Stake Account Public Key and all user delegations.
// User wallet address.
const address = 'exampleCnpYVG5ukLQsfusLqMGFRm5kJwcNhVdA3NS94';
// Get all user delegations.
const getDelegations = await Solana.getDelegations(address);
// User Stake Account Public Key, which should be deactivated
const stakeAccountPublicKey =
getDelegations.result[0].data.pubkey
|| 'AidgPiAZMLbqtNdGzt5CfBbtMjvFugnCcr116PXpCCnm';
// deactivateResp - return Raw Transaction
const deactivateResp = await Solana.deactivate(
address,
stakeAccountPublicKey
);
console.log(deactivateResp); // Raw Transaction Object