Home Reference Source
import {StakeProgram} from '@solana/web3'
public class | source

StakeProgram

Factory class for transactions to interact with the Stake program

Static Member Summary

Static Public Members
public static get

Public key that identifies the Stake program

public static get

Max space of a Stake account

Static Method Summary

Static Public Methods
public static

authorize(stakeAccount: PublicKey, authorizedPubkey: PublicKey, newAuthorized: PublicKey, stakeAuthorizationType: StakeAuthorizationType): Transaction

Generate a Transaction that authorizes a new PublicKey as Staker or Withdrawer on the Stake account.

public static

createAccount(from: PublicKey, stakeAccount: PublicKey, authorized: Authorized, lockup: Lockup, lamports: number): Transaction

Generate a Transaction that creates a new Stake account

public static

createAccountWithSeed(from: PublicKey, stakeAccount: PublicKey, base: PublicKey, seed: string, authorized: Authorized, lockup: Lockup, lamports: number): Transaction

Generate a Transaction that creates a new Stake account at an address generated with from, a seed, and the Stake programId

public static

deactivate(stakeAccount: PublicKey, authorizedPubkey: PublicKey): Transaction

Generate a Transaction that deactivates Stake tokens.

public static

delegate(stakeAccount: PublicKey, authorizedPubkey: PublicKey, votePubkey: PublicKey): Transaction

Generate a Transaction that delegates Stake tokens to a validator Vote PublicKey.

public static

initialize(stakeAccount: PublicKey, authorized: Authorized, lockup: Lockup): TransactionInstruction

Generate an Initialize instruction to add to a Stake Create transaction

public static

redeemVoteCredits(stakeAccount: PublicKey, votePubkey: PublicKey): Transaction

Generate a Transaction that authorizes a new PublicKey as Staker or Withdrawer on the Stake account.

public static

split(stakeAccount: PublicKey, authorizedPubkey: PublicKey, lamports: number, splitStakePubkey: PublicKey): Transaction

Generate a Transaction that splits Stake tokens into another stake account

public static

withdraw(stakeAccount: PublicKey, withdrawerPubkey: PublicKey, to: PublicKey, lamports: number): Transaction

Generate a Transaction that withdraws deactivated Stake tokens.

Static Public Members

public static get programId: PublicKey source

Public key that identifies the Stake program

public static get space: number source

Max space of a Stake account

Static Public Methods

public static authorize(stakeAccount: PublicKey, authorizedPubkey: PublicKey, newAuthorized: PublicKey, stakeAuthorizationType: StakeAuthorizationType): Transaction source

Generate a Transaction that authorizes a new PublicKey as Staker or Withdrawer on the Stake account.

Params:

NameTypeAttributeDescription
stakeAccount PublicKey
authorizedPubkey PublicKey
newAuthorized PublicKey
stakeAuthorizationType StakeAuthorizationType

Return:

Transaction

public static createAccount(from: PublicKey, stakeAccount: PublicKey, authorized: Authorized, lockup: Lockup, lamports: number): Transaction source

Generate a Transaction that creates a new Stake account

Params:

NameTypeAttributeDescription
from PublicKey
stakeAccount PublicKey
authorized Authorized
lockup Lockup
lamports number

Return:

Transaction

public static createAccountWithSeed(from: PublicKey, stakeAccount: PublicKey, base: PublicKey, seed: string, authorized: Authorized, lockup: Lockup, lamports: number): Transaction source

Generate a Transaction that creates a new Stake account at an address generated with from, a seed, and the Stake programId

Params:

NameTypeAttributeDescription
from PublicKey
stakeAccount PublicKey
base PublicKey
seed string
authorized Authorized
lockup Lockup
lamports number

Return:

Transaction

public static deactivate(stakeAccount: PublicKey, authorizedPubkey: PublicKey): Transaction source

Generate a Transaction that deactivates Stake tokens.

Params:

NameTypeAttributeDescription
stakeAccount PublicKey
authorizedPubkey PublicKey

Return:

Transaction

public static delegate(stakeAccount: PublicKey, authorizedPubkey: PublicKey, votePubkey: PublicKey): Transaction source

Generate a Transaction that delegates Stake tokens to a validator Vote PublicKey. This transaction can also be used to redelegate Stake to a new validator Vote PublicKey.

Params:

NameTypeAttributeDescription
stakeAccount PublicKey
authorizedPubkey PublicKey
votePubkey PublicKey

Return:

Transaction

public static initialize(stakeAccount: PublicKey, authorized: Authorized, lockup: Lockup): TransactionInstruction source

Generate an Initialize instruction to add to a Stake Create transaction

Params:

NameTypeAttributeDescription
stakeAccount PublicKey
authorized Authorized
lockup Lockup

public static redeemVoteCredits(stakeAccount: PublicKey, votePubkey: PublicKey): Transaction source

Generate a Transaction that authorizes a new PublicKey as Staker or Withdrawer on the Stake account.

Params:

NameTypeAttributeDescription
stakeAccount PublicKey
votePubkey PublicKey

Return:

Transaction

public static split(stakeAccount: PublicKey, authorizedPubkey: PublicKey, lamports: number, splitStakePubkey: PublicKey): Transaction source

Generate a Transaction that splits Stake tokens into another stake account

Params:

NameTypeAttributeDescription
stakeAccount PublicKey
authorizedPubkey PublicKey
lamports number
splitStakePubkey PublicKey

Return:

Transaction

public static withdraw(stakeAccount: PublicKey, withdrawerPubkey: PublicKey, to: PublicKey, lamports: number): Transaction source

Generate a Transaction that withdraws deactivated Stake tokens.

Params:

NameTypeAttributeDescription
stakeAccount PublicKey
withdrawerPubkey PublicKey
to PublicKey
lamports number

Return:

Transaction