Documentation
¶
Index ¶
- Constants
- Variables
- func InstructionIDToName(id ag_binary.TypeID) string
- func SetProgramID(pubkey ag_solanago.PublicKey)
- type Counter
- type Increment
- func (inst Increment) Build() *Instruction
- func (inst *Increment) EncodeToTree(parent ag_treeout.Branches)
- func (inst *Increment) GetCounterAccount() *ag_solanago.AccountMeta
- func (obj Increment) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error)
- func (inst *Increment) SetCounterAccount(counter ag_solanago.PublicKey) *Increment
- func (obj *Increment) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error)
- func (inst *Increment) Validate() error
- func (inst Increment) ValidateAndBuild() (*Instruction, error)
- type Initialize
- func (inst Initialize) Build() *Instruction
- func (inst *Initialize) EncodeToTree(parent ag_treeout.Branches)
- func (inst *Initialize) GetCounterAccount() *ag_solanago.AccountMeta
- func (inst *Initialize) GetSystemProgramAccount() *ag_solanago.AccountMeta
- func (inst *Initialize) GetUserAccount() *ag_solanago.AccountMeta
- func (obj Initialize) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error)
- func (inst *Initialize) SetCount(count uint64) *Initialize
- func (inst *Initialize) SetCounterAccount(counter ag_solanago.PublicKey) *Initialize
- func (inst *Initialize) SetSystemProgramAccount(systemProgram ag_solanago.PublicKey) *Initialize
- func (inst *Initialize) SetUserAccount(user ag_solanago.PublicKey) *Initialize
- func (obj *Initialize) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error)
- func (inst *Initialize) Validate() error
- func (inst Initialize) ValidateAndBuild() (*Instruction, error)
- type Instruction
- func (inst *Instruction) Accounts() (out []*ag_solanago.AccountMeta)
- func (inst *Instruction) Data() ([]byte, error)
- func (inst *Instruction) EncodeToTree(parent ag_treeout.Branches)
- func (inst *Instruction) MarshalWithEncoder(encoder *ag_binary.Encoder) error
- func (inst *Instruction) ProgramID() ag_solanago.PublicKey
- func (inst *Instruction) TextEncode(encoder *ag_text.Encoder, option *ag_text.Option) error
- func (inst *Instruction) UnmarshalWithDecoder(decoder *ag_binary.Decoder) error
Constants ¶
const ProgramName = "CounterPrg"
Variables ¶
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}) )
var CounterDiscriminator = [8]byte{255, 176, 4, 245, 188, 253, 124, 25}
var InstructionImplDef = ag_binary.NewVariantDefinition( ag_binary.AnchorTypeIDEncoding, []ag_binary.VariantType{ { "initialize", (*Initialize)(nil), }, { "increment", (*Increment)(nil), }, }, )
var ProgramID ag_solanago.PublicKey = ag_solanago.MustPublicKeyFromBase58("H2LLvT2tWWPUYvN2hnNK9G6D5k5EppGzanzJFRtdAsdi")
Functions ¶
func InstructionIDToName ¶
InstructionIDToName returns the name of the instruction given its ID.
func SetProgramID ¶
func SetProgramID(pubkey ag_solanago.PublicKey)
Types ¶
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 (*Increment) SetCounterAccount ¶
func (inst *Increment) SetCounterAccount(counter ag_solanago.PublicKey) *Increment
SetCounterAccount sets the "counter" account.
func (*Increment) UnmarshalWithDecoder ¶
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 (*Instruction) UnmarshalWithDecoder ¶
func (inst *Instruction) UnmarshalWithDecoder(decoder *ag_binary.Decoder) error