counter_prg

package
v0.0.0-...-d662bb3 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const ProgramName = "CounterPrg"

Variables

View Source
var (
	Instruction_Initialize = ag_binary.TypeID([8]byte{175, 175, 109, 31, 13, 152, 155, 237})

	Instruction_Increment = ag_binary.TypeID([8]byte{11, 18, 104, 9, 104, 174, 59, 33})
)
View Source
var CounterDiscriminator = [8]byte{255, 176, 4, 245, 188, 253, 124, 25}
View Source
var InstructionImplDef = ag_binary.NewVariantDefinition(
	ag_binary.AnchorTypeIDEncoding,
	[]ag_binary.VariantType{
		{
			"initialize", (*Initialize)(nil),
		},
		{
			"increment", (*Increment)(nil),
		},
	},
)
View Source
var ProgramID ag_solanago.PublicKey = ag_solanago.MustPublicKeyFromBase58("H2LLvT2tWWPUYvN2hnNK9G6D5k5EppGzanzJFRtdAsdi")

Functions

func InstructionIDToName

func InstructionIDToName(id ag_binary.TypeID) string

InstructionIDToName returns the name of the instruction given its ID.

func SetProgramID

func SetProgramID(pubkey ag_solanago.PublicKey)

Types

type Counter

type Counter struct {
	Count uint64
}

func (Counter) MarshalWithEncoder

func (obj Counter) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error)

func (*Counter) UnmarshalWithDecoder

func (obj *Counter) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error)

type Increment

type Increment struct {

	// [0] = [WRITE] counter
	ag_solanago.AccountMetaSlice `bin:"-"`
}

Increment is the `increment` instruction.

func NewIncrementInstruction

func NewIncrementInstruction(

	counter ag_solanago.PublicKey) *Increment

NewIncrementInstruction declares a new Increment instruction with the provided parameters and accounts.

func NewIncrementInstructionBuilder

func NewIncrementInstructionBuilder() *Increment

NewIncrementInstructionBuilder creates a new `Increment` instruction builder.

func (Increment) Build

func (inst Increment) Build() *Instruction

func (*Increment) EncodeToTree

func (inst *Increment) EncodeToTree(parent ag_treeout.Branches)

func (*Increment) GetCounterAccount

func (inst *Increment) GetCounterAccount() *ag_solanago.AccountMeta

GetCounterAccount gets the "counter" account.

func (Increment) MarshalWithEncoder

func (obj Increment) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error)

func (*Increment) SetCounterAccount

func (inst *Increment) SetCounterAccount(counter ag_solanago.PublicKey) *Increment

SetCounterAccount sets the "counter" account.

func (*Increment) UnmarshalWithDecoder

func (obj *Increment) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error)

func (*Increment) Validate

func (inst *Increment) Validate() error

func (Increment) ValidateAndBuild

func (inst Increment) ValidateAndBuild() (*Instruction, error)

ValidateAndBuild validates the instruction parameters and accounts; if there is a validation error, it returns the error. Otherwise, it builds and returns the instruction.

type Initialize

type Initialize struct {
	Count *uint64

	// [0] = [WRITE, SIGNER] counter
	//
	// [1] = [WRITE, SIGNER] user
	//
	// [2] = [] systemProgram
	ag_solanago.AccountMetaSlice `bin:"-"`
}

Initialize is the `initialize` instruction.

func NewInitializeInstruction

func NewInitializeInstruction(

	count uint64,

	counter ag_solanago.PublicKey,
	user ag_solanago.PublicKey,
	systemProgram ag_solanago.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 ag_treeout.Branches)

func (*Initialize) GetCounterAccount

func (inst *Initialize) GetCounterAccount() *ag_solanago.AccountMeta

GetCounterAccount gets the "counter" account.

func (*Initialize) GetSystemProgramAccount

func (inst *Initialize) GetSystemProgramAccount() *ag_solanago.AccountMeta

GetSystemProgramAccount gets the "systemProgram" account.

func (*Initialize) GetUserAccount

func (inst *Initialize) GetUserAccount() *ag_solanago.AccountMeta

GetUserAccount gets the "user" account.

func (Initialize) MarshalWithEncoder

func (obj Initialize) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error)

func (*Initialize) SetCount

func (inst *Initialize) SetCount(count uint64) *Initialize

SetCount sets the "count" parameter.

func (*Initialize) SetCounterAccount

func (inst *Initialize) SetCounterAccount(counter ag_solanago.PublicKey) *Initialize

SetCounterAccount sets the "counter" account.

func (*Initialize) SetSystemProgramAccount

func (inst *Initialize) SetSystemProgramAccount(systemProgram ag_solanago.PublicKey) *Initialize

SetSystemProgramAccount sets the "systemProgram" account.

func (*Initialize) SetUserAccount

func (inst *Initialize) SetUserAccount(user ag_solanago.PublicKey) *Initialize

SetUserAccount sets the "user" account.

func (*Initialize) UnmarshalWithDecoder

func (obj *Initialize) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error)

func (*Initialize) Validate

func (inst *Initialize) Validate() error

func (Initialize) ValidateAndBuild

func (inst Initialize) ValidateAndBuild() (*Instruction, error)

ValidateAndBuild validates the instruction parameters and accounts; if there is a validation error, it returns the error. Otherwise, it builds and returns the instruction.

type Instruction

type Instruction struct {
	ag_binary.BaseVariant
}

func DecodeInstruction

func DecodeInstruction(accounts []*ag_solanago.AccountMeta, data []byte) (*Instruction, error)

func (*Instruction) Accounts

func (inst *Instruction) Accounts() (out []*ag_solanago.AccountMeta)

func (*Instruction) Data

func (inst *Instruction) Data() ([]byte, error)

func (*Instruction) EncodeToTree

func (inst *Instruction) EncodeToTree(parent ag_treeout.Branches)

func (*Instruction) MarshalWithEncoder

func (inst *Instruction) MarshalWithEncoder(encoder *ag_binary.Encoder) error

func (*Instruction) ProgramID

func (inst *Instruction) ProgramID() ag_solanago.PublicKey

func (*Instruction) TextEncode

func (inst *Instruction) TextEncode(encoder *ag_text.Encoder, option *ag_text.Option) error

func (*Instruction) UnmarshalWithDecoder

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

Jump to

Keyboard shortcuts

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