stake

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package stake provides typed instruction builders for the Solana Stake program. Each builder returns a solana.Instruction with the program id, account metas, and encoded data already filled in, so callers can assemble a transaction by simply collecting the instructions they want and passing them to solana.NewMessage.

Index

Constants

This section is empty.

Variables

View Source
var ProgramID = solana.MustPublicKey("Stake11111111111111111111111111111111111111")

ProgramID is the canonical address of the Solana Stake program: Stake11111111111111111111111111111111111111.

Functions

func Authorize

func Authorize(stakeAccount, authority, newAuthority solana.PublicKey, authType StakeAuthorize, custodian *solana.PublicKey) solana.Instruction

Authorize builds a Stake.Authorize instruction that reassigns the staker or withdrawer authority. The current authority must sign. custodian is required only when the account is within its lockup period and the target authority is the withdrawer; pass nil to omit.

func AuthorizeChecked

func AuthorizeChecked(stakeAccount, authority, newAuthority solana.PublicKey, authType StakeAuthorize, custodian *solana.PublicKey) solana.Instruction

AuthorizeChecked builds a Stake.AuthorizeChecked instruction. Unlike Authorize, the new authority must also sign the transaction (preventing the caller from setting an authority they don't control).

func Deactivate

func Deactivate(stakeAccount, staker solana.PublicKey) solana.Instruction

Deactivate builds a Stake.Deactivate instruction.

func Delegate

func Delegate(stakeAccount, voteAccount, staker solana.PublicKey) solana.Instruction

Delegate builds a Stake.DelegateStake instruction.

func Initialize

func Initialize(stakeAccount solana.PublicKey, authorized Authorized, lockup Lockup) solana.Instruction

Initialize builds a Stake.Initialize instruction.

func InitializeChecked

func InitializeChecked(stakeAccount, staker, withdrawer solana.PublicKey) solana.Instruction

InitializeChecked builds a Stake.InitializeChecked instruction. Like Initialize but the withdrawer authority must sign the transaction, making it safe to use when staker ≠ withdrawer.

func Merge

func Merge(destination, source, staker solana.PublicKey) solana.Instruction

Merge builds a Stake.Merge instruction.

func SetLockup

func SetLockup(stakeAccount, authority solana.PublicKey, unixTimestamp *int64, epoch *uint64, custodian *solana.PublicKey) solana.Instruction

SetLockup builds a Stake.SetLockup instruction that modifies the lockup conditions of a stake account. The current withdraw authority (or custodian if still within lockup) must sign. Pass nil for any field to leave it unchanged.

func Split

func Split(stakeAccount, splitStake, staker solana.PublicKey, lamports uint64) solana.Instruction

Split builds a Stake.Split instruction.

func Withdraw

func Withdraw(stakeAccount, destination, withdrawer solana.PublicKey, lamports uint64, custodian *solana.PublicKey) solana.Instruction

Withdraw builds a Stake.Withdraw instruction.

Types

type Authorized

type Authorized struct {
	Staker     solana.PublicKey
	Withdrawer solana.PublicKey
}

Authorized holds the two pubkeys that are permitted to manage a stake account: one for staking operations and one for withdrawals.

type Lockup

type Lockup struct {
	UnixTimestamp int64
	Epoch         uint64
	Custodian     solana.PublicKey
}

Lockup specifies the conditions under which a stake account is locked. Until the unix timestamp and the epoch have both passed, only the custodian may withdraw funds.

type StakeAuthorize

type StakeAuthorize uint32

StakeAuthorize identifies which authority field Authorize changes.

const (
	AuthorizeStaker     StakeAuthorize = 0
	AuthorizeWithdrawer StakeAuthorize = 1
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL