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 ¶
- Variables
- func Authorize(stakeAccount, authority, newAuthority solana.PublicKey, ...) solana.Instruction
- func AuthorizeChecked(stakeAccount, authority, newAuthority solana.PublicKey, ...) solana.Instruction
- func Deactivate(stakeAccount, staker solana.PublicKey) solana.Instruction
- func Delegate(stakeAccount, voteAccount, staker solana.PublicKey) solana.Instruction
- func Initialize(stakeAccount solana.PublicKey, authorized Authorized, lockup Lockup) solana.Instruction
- func InitializeChecked(stakeAccount, staker, withdrawer solana.PublicKey) solana.Instruction
- func Merge(destination, source, staker solana.PublicKey) solana.Instruction
- func SetLockup(stakeAccount, authority solana.PublicKey, unixTimestamp *int64, epoch *uint64, ...) solana.Instruction
- func Split(stakeAccount, splitStake, staker solana.PublicKey, lamports uint64) solana.Instruction
- func Withdraw(stakeAccount, destination, withdrawer solana.PublicKey, lamports uint64, ...) solana.Instruction
- type Authorized
- type Lockup
- type StakeAuthorize
Constants ¶
This section is empty.
Variables ¶
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.
Types ¶
type Authorized ¶
Authorized holds the two pubkeys that are permitted to manage a stake account: one for staking operations and one for withdrawals.
type Lockup ¶
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 )