Documentation
¶
Index ¶
- Constants
- Variables
- func SetProgramID(pubkey solana.PublicKey)
- type Authorized
- type Deactivate
- func (inst Deactivate) Build() *Instruction
- func (inst *Deactivate) EncodeToTree(parent treeout.Branches)
- func (inst *Deactivate) GetClockSysvar() *solana.AccountMeta
- func (inst *Deactivate) GetStakeAccount() *solana.AccountMeta
- func (inst *Deactivate) GetStakeAuthority() *solana.AccountMeta
- func (inst *Deactivate) SetClockSysvar(clockSysvar solana.PublicKey) *Deactivate
- func (inst *Deactivate) SetStakeAccount(stakeAccount solana.PublicKey) *Deactivate
- func (inst *Deactivate) SetStakeAuthority(stakeAuthority solana.PublicKey) *Deactivate
- func (inst *Deactivate) Validate() error
- type DelegateStake
- func (inst DelegateStake) Build() *Instruction
- func (inst *DelegateStake) EncodeToTree(parent treeout.Branches)
- func (inst *DelegateStake) GetClockSysvar() *solana.AccountMeta
- func (inst *DelegateStake) GetConfigAccount() *solana.AccountMeta
- func (inst *DelegateStake) GetStakeAccount() *solana.AccountMeta
- func (inst *DelegateStake) GetStakeAuthority() *solana.AccountMeta
- func (inst *DelegateStake) GetStakeHistorySysvar() *solana.AccountMeta
- func (inst *DelegateStake) GetVoteAccount() *solana.AccountMeta
- func (inst *DelegateStake) SetClockSysvar(clockSysVarAcc solana.PublicKey) *DelegateStake
- func (inst *DelegateStake) SetConfigAccount(stakeConfigAcc solana.PublicKey) *DelegateStake
- func (inst *DelegateStake) SetStakeAccount(stakeAccount solana.PublicKey) *DelegateStake
- func (inst *DelegateStake) SetStakeAuthority(stakeAuthority solana.PublicKey) *DelegateStake
- func (inst *DelegateStake) SetStakeHistorySysvar(stakeHistorySysVarAcc solana.PublicKey) *DelegateStake
- func (inst *DelegateStake) SetVoteAccount(voteAcc solana.PublicKey) *DelegateStake
- func (inst *DelegateStake) Validate() error
- type Initialize
- func (inst Initialize) Build() *Instruction
- func (inst *Initialize) EncodeToTree(parent treeout.Branches)
- func (inst *Initialize) GetRentSysvarAccount() *solana.AccountMeta
- func (inst *Initialize) GetStakeAccount() *solana.AccountMeta
- func (inst *Initialize) MarshalWithEncoder(encoder *bin.Encoder) error
- func (inst *Initialize) SetCustodian(custodian solana.PublicKey) *Initialize
- func (inst *Initialize) SetLockupEpoch(epoch uint64) *Initialize
- func (inst *Initialize) SetLockupTimestamp(unixTimestamp int64) *Initialize
- func (inst *Initialize) SetRentSysvarAccount(rentSysvar solana.PublicKey) *Initialize
- func (inst *Initialize) SetStakeAccount(stakeAccount solana.PublicKey) *Initialize
- func (inst *Initialize) SetStaker(staker solana.PublicKey) *Initialize
- func (inst *Initialize) SetWithdrawer(withdrawer solana.PublicKey) *Initialize
- func (inst *Initialize) UnmarshalWithDecoder(dec *bin.Decoder) error
- func (inst *Initialize) Validate() error
- type Instruction
- func (inst *Instruction) Accounts() (out []*solana.AccountMeta)
- func (inst *Instruction) Data() ([]byte, error)
- func (inst *Instruction) EncodeToTree(parent treeout.Branches)
- func (inst Instruction) MarshalWithEncoder(encoder *bin.Encoder) error
- func (inst *Instruction) ProgramID() solana.PublicKey
- func (inst *Instruction) TextEncode(encoder *text.Encoder, option *text.Option) error
- func (inst *Instruction) UnmarshalWithDecoder(decoder *bin.Decoder) error
- type Lockup
- type Split
- func (inst Split) Build() *Instruction
- func (inst *Split) EncodeToTree(parent treeout.Branches)
- func (inst *Split) GetNewStakeAccount() *solana.AccountMeta
- func (inst *Split) GetStakeAccount() *solana.AccountMeta
- func (inst *Split) GetStakeAuthority() *solana.AccountMeta
- func (inst *Split) MarshalWithEncoder(encoder *bin.Encoder) error
- func (inst *Split) SetLamports(lamports uint64) *Split
- func (inst *Split) SetNewStakeAccount(voteAcc solana.PublicKey) *Split
- func (inst *Split) SetStakeAccount(stakeAccount solana.PublicKey) *Split
- func (inst *Split) SetStakeAuthority(stakeAuthority solana.PublicKey) *Split
- func (inst *Split) UnmarshalWithDecoder(dec *bin.Decoder) error
- func (inst *Split) Validate() error
- type Withdraw
- func (inst Withdraw) Build() *Instruction
- func (inst *Withdraw) EncodeToTree(parent treeout.Branches)
- func (inst *Withdraw) GetClockSysvar() *solana.AccountMeta
- func (inst *Withdraw) GetRecipientAccount() *solana.AccountMeta
- func (inst *Withdraw) GetStakeAccount() *solana.AccountMeta
- func (inst *Withdraw) GetStakeHistorySysvar() *solana.AccountMeta
- func (inst *Withdraw) GetWithdrawAuthority() *solana.AccountMeta
- func (inst *Withdraw) MarshalWithEncoder(encoder *bin.Encoder) error
- func (inst *Withdraw) SetClockSysvar(clockSysvar solana.PublicKey) *Withdraw
- func (inst *Withdraw) SetLamports(lamports uint64) *Withdraw
- func (inst *Withdraw) SetRecipientAccount(recipient solana.PublicKey) *Withdraw
- func (inst *Withdraw) SetStakeAccount(stakeAccount solana.PublicKey) *Withdraw
- func (inst *Withdraw) SetStakeHistorySysvar(historySysvar solana.PublicKey) *Withdraw
- func (inst *Withdraw) SetWithdrawAuthority(withdrawAuthority solana.PublicKey) *Withdraw
- func (inst *Withdraw) UnmarshalWithDecoder(dec *bin.Decoder) error
- func (inst *Withdraw) Validate() error
Constants ¶
const ( // Initializes a new stake account Instruction_Initialize uint32 = iota // Authorize a key to manage stake or withdrawal Instruction_Authorize // Delegate a stake account to a validator vote account Instruction_DelegateStake // Split an active stake account into a new stake account Instruction_Split // Withdraw unstaked lamports from the stake account Instruction_Withdraw // Deactivates the stake in the account Instruction_Deactivate )
const ProgramName = "Stake"
Variables ¶
var InstructionImplDef = bin.NewVariantDefinition( bin.Uint32TypeIDEncoding, []bin.VariantType{ { "Initialize", (*Initialize)(nil), }, { "Authorize", nil, }, { "DelegateStake", (*DelegateStake)(nil), }, { "Split", (*Split)(nil), }, { "Withdraw", (*Withdraw)(nil), }, { "Deactivate", (*Deactivate)(nil), }, }, )
var ProgramID solana.PublicKey = solana.StakeProgramID
Functions ¶
func SetProgramID ¶
func SetProgramID(pubkey solana.PublicKey)
Types ¶
type Authorized ¶
type Authorized struct {
// Address that will own the stake account
Staker *ag_solanago.PublicKey
// Address that is permitted to with from the stake account
Withdrawer *ag_solanago.PublicKey
}
func (*Authorized) MarshalWithEncoder ¶
func (auth *Authorized) MarshalWithEncoder(encoder *bin.Encoder) error
func (*Authorized) UnmarshalWithDecoder ¶
func (auth *Authorized) UnmarshalWithDecoder(dec *bin.Decoder) error
func (*Authorized) Validate ¶
func (auth *Authorized) Validate() error
type Deactivate ¶
type Deactivate struct {
// [0] = [WRITE] Stake Account
// ··········· Delegated stake account to be deactivated
//
// [1] = [] Clock Sysvar
// ··········· The Clock Sysvar Account
//
// [2] = [SIGNER] Stake Authority
// ··········· Stake authority
//
solana.AccountMetaSlice `bin:"-" borsh_skip:"true"`
}
func NewDeactivateInstruction ¶
func NewDeactivateInstruction( stakeAccount solana.PublicKey, stakeAuthority solana.PublicKey, ) *Deactivate
NewDeactivateInstruction declares a new Deactivate instruction with the provided parameters and accounts.
func NewDeactivateInstructionBuilder ¶
func NewDeactivateInstructionBuilder() *Deactivate
NewDeactivateInstructionBuilder creates a new `Deactivate` instruction builder.
func (Deactivate) Build ¶
func (inst Deactivate) Build() *Instruction
func (*Deactivate) EncodeToTree ¶
func (inst *Deactivate) EncodeToTree(parent treeout.Branches)
func (*Deactivate) GetClockSysvar ¶
func (inst *Deactivate) GetClockSysvar() *solana.AccountMeta
func (*Deactivate) GetStakeAccount ¶
func (inst *Deactivate) GetStakeAccount() *solana.AccountMeta
func (*Deactivate) GetStakeAuthority ¶
func (inst *Deactivate) GetStakeAuthority() *solana.AccountMeta
func (*Deactivate) SetClockSysvar ¶
func (inst *Deactivate) SetClockSysvar(clockSysvar solana.PublicKey) *Deactivate
func (*Deactivate) SetStakeAccount ¶
func (inst *Deactivate) SetStakeAccount(stakeAccount solana.PublicKey) *Deactivate
func (*Deactivate) SetStakeAuthority ¶
func (inst *Deactivate) SetStakeAuthority(stakeAuthority solana.PublicKey) *Deactivate
func (*Deactivate) Validate ¶
func (inst *Deactivate) Validate() error
type DelegateStake ¶
type DelegateStake struct {
// [0] = [WRITE SIGNER] StakeAccount
// ··········· Stake account getting initialized
//
// [1] = [] Vote Account
// ··········· The validator vote account being delegated to
//
// [2] = [] Clock Sysvar
// ··········· The Clock Sysvar Account
//
// [3] = [] Stake History Sysvar
// ··········· The Stake History Sysvar Account
//
// [4] = [] Stake Config Account
// ··········· The Stake Config Account
//
// [5] = [WRITE SIGNER] Stake Authoriy
// ··········· The Stake Authority
//
solana.AccountMetaSlice `bin:"-" borsh_skip:"true"`
}
func NewDelegateStakeInstruction ¶
func NewDelegateStakeInstruction( validatorVoteAccount solana.PublicKey, stakeAuthority solana.PublicKey, stakeAccount solana.PublicKey, ) *DelegateStake
NewDelegateStakeInstruction declares a new DelegateStake instruction with the provided parameters and accounts.
func NewDelegateStakeInstructionBuilder ¶
func NewDelegateStakeInstructionBuilder() *DelegateStake
NewDelegateStakeInstructionBuilder creates a new `DelegateStake` instruction builder.
func (DelegateStake) Build ¶
func (inst DelegateStake) Build() *Instruction
func (*DelegateStake) EncodeToTree ¶
func (inst *DelegateStake) EncodeToTree(parent treeout.Branches)
func (*DelegateStake) GetClockSysvar ¶
func (inst *DelegateStake) GetClockSysvar() *solana.AccountMeta
func (*DelegateStake) GetConfigAccount ¶
func (inst *DelegateStake) GetConfigAccount() *solana.AccountMeta
func (*DelegateStake) GetStakeAccount ¶
func (inst *DelegateStake) GetStakeAccount() *solana.AccountMeta
func (*DelegateStake) GetStakeAuthority ¶
func (inst *DelegateStake) GetStakeAuthority() *solana.AccountMeta
func (*DelegateStake) GetStakeHistorySysvar ¶
func (inst *DelegateStake) GetStakeHistorySysvar() *solana.AccountMeta
func (*DelegateStake) GetVoteAccount ¶
func (inst *DelegateStake) GetVoteAccount() *solana.AccountMeta
func (*DelegateStake) SetClockSysvar ¶
func (inst *DelegateStake) SetClockSysvar(clockSysVarAcc solana.PublicKey) *DelegateStake
func (*DelegateStake) SetConfigAccount ¶
func (inst *DelegateStake) SetConfigAccount(stakeConfigAcc solana.PublicKey) *DelegateStake
func (*DelegateStake) SetStakeAccount ¶
func (inst *DelegateStake) SetStakeAccount(stakeAccount solana.PublicKey) *DelegateStake
func (*DelegateStake) SetStakeAuthority ¶
func (inst *DelegateStake) SetStakeAuthority(stakeAuthority solana.PublicKey) *DelegateStake
func (*DelegateStake) SetStakeHistorySysvar ¶
func (inst *DelegateStake) SetStakeHistorySysvar(stakeHistorySysVarAcc solana.PublicKey) *DelegateStake
func (*DelegateStake) SetVoteAccount ¶
func (inst *DelegateStake) SetVoteAccount(voteAcc solana.PublicKey) *DelegateStake
func (*DelegateStake) Validate ¶
func (inst *DelegateStake) Validate() error
type Initialize ¶
type Initialize struct {
// Authorization settings for stake account
Authorized *Authorized
// Lockup settings for stake account
Lockup *Lockup
// [0] = [WRITE SIGNER] StakeAccount
// ··········· Stake account getting initialized
//
// [1] = [] RentSysvar
// ··········· RentSysvar account
//
solana.AccountMetaSlice `bin:"-" borsh_skip:"true"`
}
func NewInitializeInstruction ¶
func NewInitializeInstruction( staker solana.PublicKey, withdrawer solana.PublicKey, stakeAccount solana.PublicKey, ) *Initialize
NewInitializeInstruction declares a new Initialize instruction with the provided parameters and accounts.
func NewInitializeInstructionBuilder ¶
func NewInitializeInstructionBuilder() *Initialize
NewInitializeInstructionBuilder creates a new `Initialize` instruction builder.
func (Initialize) Build ¶
func (inst Initialize) Build() *Instruction
func (*Initialize) EncodeToTree ¶
func (inst *Initialize) EncodeToTree(parent treeout.Branches)
func (*Initialize) GetRentSysvarAccount ¶
func (inst *Initialize) GetRentSysvarAccount() *solana.AccountMeta
func (*Initialize) GetStakeAccount ¶
func (inst *Initialize) GetStakeAccount() *solana.AccountMeta
func (*Initialize) MarshalWithEncoder ¶
func (inst *Initialize) MarshalWithEncoder(encoder *bin.Encoder) error
func (*Initialize) SetCustodian ¶
func (inst *Initialize) SetCustodian(custodian solana.PublicKey) *Initialize
func (*Initialize) SetLockupEpoch ¶
func (inst *Initialize) SetLockupEpoch(epoch uint64) *Initialize
func (*Initialize) SetLockupTimestamp ¶
func (inst *Initialize) SetLockupTimestamp(unixTimestamp int64) *Initialize
func (*Initialize) SetRentSysvarAccount ¶
func (inst *Initialize) SetRentSysvarAccount(rentSysvar solana.PublicKey) *Initialize
Rent sysvar account
func (*Initialize) SetStakeAccount ¶
func (inst *Initialize) SetStakeAccount(stakeAccount solana.PublicKey) *Initialize
Stake account account
func (*Initialize) SetStaker ¶
func (inst *Initialize) SetStaker(staker solana.PublicKey) *Initialize
func (*Initialize) SetWithdrawer ¶
func (inst *Initialize) SetWithdrawer(withdrawer solana.PublicKey) *Initialize
func (*Initialize) UnmarshalWithDecoder ¶
func (inst *Initialize) UnmarshalWithDecoder(dec *bin.Decoder) error
func (*Initialize) Validate ¶
func (inst *Initialize) Validate() error
type Instruction ¶
type Instruction struct {
bin.BaseVariant
}
func DecodeInstruction ¶
func DecodeInstruction(accounts []*solana.AccountMeta, data []byte) (*Instruction, error)
func (*Instruction) Accounts ¶
func (inst *Instruction) Accounts() (out []*solana.AccountMeta)
func (*Instruction) Data ¶
func (inst *Instruction) Data() ([]byte, error)
func (*Instruction) EncodeToTree ¶
func (inst *Instruction) EncodeToTree(parent treeout.Branches)
func (Instruction) MarshalWithEncoder ¶
func (inst Instruction) MarshalWithEncoder(encoder *bin.Encoder) error
func (*Instruction) ProgramID ¶
func (inst *Instruction) ProgramID() solana.PublicKey
func (*Instruction) TextEncode ¶
func (*Instruction) UnmarshalWithDecoder ¶
func (inst *Instruction) UnmarshalWithDecoder(decoder *bin.Decoder) error
type Lockup ¶
type Lockup struct {
// UnixTimestamp at which this stake will allow withdrawal, unless the transaction is signed by the custodian
UnixTimestamp *int64
// Epoch height at which this stake will allow withdrawal, unless the transaction is signed by the custodian
Epoch *uint64
// Custodian signature on a transaction exempts the operation from lockup constraints
Custodian *ag_solanago.PublicKey
}
func (*Lockup) MarshalWithEncoder ¶
func (*Lockup) UnmarshalWithDecoder ¶
type Split ¶
type Split struct {
// Amount to split to new stake account
Lamports *uint64
// [0] = [WRITE] Stake Account
// ··········· Stake account to be split; must be in the Initialized or Stake state
//
// [1] = [WRITE] New Stake Account
// ··········· Uninitialized stake account that will take the split-off amount
//
// [2] = [SIGNER] Stake Authority
// ··········· Stake authority
//
solana.AccountMetaSlice `bin:"-" borsh_skip:"true"`
}
func NewSplitInstruction ¶
func NewSplitInstruction( lamports uint64, stakeAccount solana.PublicKey, newStakeAccount solana.PublicKey, stakeAuthority solana.PublicKey, ) *Split
NewSplitInstruction declares a new Split instruction with the provided parameters and accounts.
func NewSplitInstructionBuilder ¶
func NewSplitInstructionBuilder() *Split
NewSplitInstructionBuilder creates a new `Split` instruction builder.
func (Split) Build ¶
func (inst Split) Build() *Instruction
func (*Split) EncodeToTree ¶
func (*Split) GetNewStakeAccount ¶
func (inst *Split) GetNewStakeAccount() *solana.AccountMeta
func (*Split) GetStakeAccount ¶
func (inst *Split) GetStakeAccount() *solana.AccountMeta
func (*Split) GetStakeAuthority ¶
func (inst *Split) GetStakeAuthority() *solana.AccountMeta
func (*Split) MarshalWithEncoder ¶
func (*Split) SetLamports ¶
func (*Split) SetNewStakeAccount ¶
func (*Split) SetStakeAccount ¶
func (*Split) SetStakeAuthority ¶
func (*Split) UnmarshalWithDecoder ¶
type Withdraw ¶
type Withdraw struct {
// Withdraw unstaked lamports from the stake account
Lamports *uint64
// [0] = [WRITE] Stake Account
// ··········· Stake account from which to withdraw
//
// [1] = [WRITE] Recipient Account
// ··········· Recipient account
//
// [2] = [] Clock Sysvar
// ··········· The Clock Sysvar Account
//
// [3] = [] Stake History Sysvar
// ··········· The Stake History Sysvar Account
//
// [4] = [SIGNER] Withdraw Authority
// ··········· Withdraw authority
//
// OPTIONAL:
// [5] = [SIGNER] Lockup authority
// ··········· If before lockup expiration
solana.AccountMetaSlice `bin:"-" borsh_skip:"true"`
}
func NewWithdrawInstruction ¶
func NewWithdrawInstruction( lamports uint64, stakeAccount solana.PublicKey, recipient solana.PublicKey, withdrawAuthority solana.PublicKey, ) *Withdraw
NewWithdrawInstruction declares a new Withdraw instruction with the provided parameters and accounts.
func NewWithdrawInstructionBuilder ¶
func NewWithdrawInstructionBuilder() *Withdraw
NewWithdrawInstructionBuilder creates a new `Withdraw` instruction builder.
func (Withdraw) Build ¶
func (inst Withdraw) Build() *Instruction
func (*Withdraw) EncodeToTree ¶
func (*Withdraw) GetClockSysvar ¶
func (inst *Withdraw) GetClockSysvar() *solana.AccountMeta
func (*Withdraw) GetRecipientAccount ¶
func (inst *Withdraw) GetRecipientAccount() *solana.AccountMeta
func (*Withdraw) GetStakeAccount ¶
func (inst *Withdraw) GetStakeAccount() *solana.AccountMeta
func (*Withdraw) GetStakeHistorySysvar ¶
func (inst *Withdraw) GetStakeHistorySysvar() *solana.AccountMeta
func (*Withdraw) GetWithdrawAuthority ¶
func (inst *Withdraw) GetWithdrawAuthority() *solana.AccountMeta