vote

package
v0.0.0-...-aac4122 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const ProgramName = "Vote"

Variables

View Source
var InstructionImplDef = bin.NewVariantDefinition(
	bin.Uint32TypeIDEncoding,
	[]bin.VariantType{
		{
			"InitializeAccount", (*InitializeAccount)(nil),
		},
		{
			"Authorize", (*Authorize)(nil),
		},
		{
			"Vote", (*Vote)(nil),
		},
		{
			"Withdraw", (*Withdraw)(nil),
		},
	},
)
View Source
var ProgramID solana.PublicKey = solana.VoteProgramID

Functions

func SetProgramID

func SetProgramID(pubkey solana.PublicKey)

Types

type Authorize

type Authorize struct {

	// [0] = [WRITE] VoteAccount
	// ··········· Unitialized vote account
	//
	// [1] = [] SysVarClock
	// ··········· Clock sysvar
	//
	// [2] = [SIGNER] Authority
	// ··········· Vote or withdraw authority
	solana.AccountMetaSlice `bin:"-" borsh_skip:"true"`
}

type InitializeAccount

type InitializeAccount struct {

	// [0] = [WRITE] VoteAccount
	// ··········· Vote account to vote with
	//
	// [1] = [] SysVarSlotHashes
	// ··········· Slot hashes sysvar
	//
	// [2] = [] SysVarClock
	// ··········· Clock sysvar
	//
	// [3] = [SIGNER] VoteAuthority
	// ··········· New validator identity (node_pubkey)
	solana.AccountMetaSlice `bin:"-" borsh_skip:"true"`
}

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 (inst *Instruction) TextEncode(encoder *text.Encoder, option *text.Option) error

func (*Instruction) UnmarshalWithDecoder

func (inst *Instruction) UnmarshalWithDecoder(decoder *bin.Decoder) error

type Vote

type Vote struct {
	Slots     []uint64
	Hash      solana.Hash
	Timestamp *int64

	// [0] = [WRITE] VoteAccount
	// ··········· Vote account to vote with
	//
	// [1] = [] SysVarSlotHashes
	// ··········· Slot hashes sysvar
	//
	// [2] = [] SysVarClock
	// ··········· Clock sysvar
	//
	// [3] = [SIGNER] VoteAuthority
	// ··········· Vote authority
	solana.AccountMetaSlice `bin:"-" borsh_skip:"true"`
}

func (*Vote) EncodeToTree

func (inst *Vote) EncodeToTree(parent treeout.Branches)

func (*Vote) UnmarshalWithDecoder

func (v *Vote) UnmarshalWithDecoder(dec *bin.Decoder) error

func (*Vote) Validate

func (inst *Vote) Validate() error

type Withdraw

type Withdraw struct {
	// Number of lamports to withdraw from the vote account
	Lamports *uint64

	// [0] = [WRITE] VoteAccount
	// ··········· Vote account to withdraw from
	//
	// [1] = [WRITE] ToAccount
	// ··········· Account to receive the funds
	//
	// [2] = [WRITE SIGNER] AuthorizedWithdrawerPubkey
	// ··········· Account authorized to do the witdraw
	//
	solana.AccountMetaSlice `bin:"-" borsh_skip:"true"`
}

func NewWithdrawInstruction

func NewWithdrawInstruction(

	lamports uint64,

	voteAccount solana.PublicKey,
	recipientAccount solana.PublicKey,
	withdrawAuthAccount 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) EncodeToTree

func (inst *Withdraw) EncodeToTree(parent treeout.Branches)

func (*Withdraw) MarshalWithEncoder

func (inst *Withdraw) MarshalWithEncoder(encoder *bin.Encoder) error

func (*Withdraw) SetLamports

func (inst *Withdraw) SetLamports(lamports uint64) *Withdraw

Number of lamports to transfer to the recipient account

func (*Withdraw) SetRecipientAccount

func (inst *Withdraw) SetRecipientAccount(recipientAccount solana.PublicKey) *Withdraw

Recipient account

func (*Withdraw) SetVoteAccount

func (inst *Withdraw) SetVoteAccount(voteAccount solana.PublicKey) *Withdraw

Vote account

func (*Withdraw) SetWithdrawAuthorityAccount

func (inst *Withdraw) SetWithdrawAuthorityAccount(withdrawAccount solana.PublicKey) *Withdraw

Withdraw authority account

func (*Withdraw) UnmarshalWithDecoder

func (v *Withdraw) UnmarshalWithDecoder(dec *bin.Decoder) error

func (*Withdraw) Validate

func (inst *Withdraw) Validate() error

Jump to

Keyboard shortcuts

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