Documentation ¶
Index ¶
- Constants
- Variables
- func InstructionIDToName(id uint8) string
- func SetProgramID(pubkey common.PublicKey)
- type DefaultAccountState
- type Initialize
- func (obj *Initialize) Build() *Instruction
- func (obj *Initialize) EncodeToTree(parent treeout.Branches)
- func (obj *Initialize) GetMintAccount() *common.AccountMeta
- func (obj *Initialize) MarshalWithEncoder(encoder *binary.Encoder) (err error)
- func (obj *Initialize) SetMintAccount(mint common.PublicKey, multiSigners ...common.PublicKey) *Initialize
- func (obj *Initialize) SetProgramId(programId *common.PublicKey) *Initialize
- func (obj *Initialize) SetState(state spltoken2022.AccountState) *Initialize
- func (obj *Initialize) UnmarshalWithDecoder(decoder *binary.Decoder) (err error)
- func (obj *Initialize) Validate() error
- func (obj *Initialize) ValidateAndBuild() (*Instruction, error)
- type Instruction
- func (obj *Instruction) Accounts() (out []*common.AccountMeta)
- func (obj *Instruction) Data() ([]byte, error)
- func (obj *Instruction) EncodeToTree(parent treeout.Branches)
- func (obj *Instruction) MarshalWithEncoder(encoder *binary.Encoder) error
- func (obj *Instruction) ProgramID() common.PublicKey
- func (obj *Instruction) TextEncode(encoder *text.Encoder, option *text.Option) error
- func (obj *Instruction) UnmarshalWithDecoder(decoder *binary.Decoder) error
- type Update
- func (obj *Update) Build() *Instruction
- func (obj *Update) EncodeToTree(parent treeout.Branches)
- func (obj *Update) GetMintAccount() *common.AccountMeta
- func (obj *Update) GetMintAuthorityAccount() *common.AccountMeta
- func (obj *Update) MarshalWithEncoder(encoder *binary.Encoder) (err error)
- func (obj *Update) SetMintAccount(mint common.PublicKey) *Update
- func (obj *Update) SetMintAuthorityAccount(mintAuthority common.PublicKey, multiSigners ...common.PublicKey) *Update
- func (obj *Update) SetProgramId(programId *common.PublicKey) *Update
- func (obj *Update) SetState(state spltoken2022.AccountState) *Update
- func (obj *Update) UnmarshalWithDecoder(decoder *binary.Decoder) (err error)
- func (obj *Update) Validate() error
- func (obj *Update) ValidateAndBuild() (*Instruction, error)
Constants ¶
const DEFAULT_ACCOUNT_STATE_SIZE = 1
const ProgramName = "default_account_state"
Variables ¶
var ( Instruction_Initialize uint8 = 0 Instruction_Update uint8 = 1 )
var InstructionImplDef = binary.NewVariantDefinition(binary.Uint8TypeIDEncoding, []binary.VariantType{ { "initialize", (*Initialize)(nil), }, { "update", (*Update)(nil), }, })
var ProgramID common.PublicKey = common.MustPublicKeyFromBase58("11111111111111111111111111111111")
Functions ¶
func InstructionIDToName ¶
InstructionIDToName returns the name of the instruction given its ID.
func SetProgramID ¶
Types ¶
type DefaultAccountState ¶
type DefaultAccountState struct { // Default Account::state in which new Accounts should be initialized State spltoken2022.AccountState }
DefaultAccountState Struct
func (*DefaultAccountState) MarshalWithEncoder ¶
func (obj *DefaultAccountState) MarshalWithEncoder(encoder *binary.Encoder) (err error)
func (*DefaultAccountState) UnmarshalWithDecoder ¶
func (obj *DefaultAccountState) UnmarshalWithDecoder(decoder *binary.Decoder) (err error)
type Initialize ¶
type Initialize struct { State *spltoken2022.AccountState // [0] = [WRITE] mint `The mint to initialize.` common.AccountMetaSlice `bin:"-"` // contains filtered or unexported fields }
Initialize Instruction
func NewInitializeInstruction ¶
func NewInitializeInstruction( state spltoken2022.AccountState, mint common.PublicKey, ) *Initialize
NewInitializeInstruction
Parameters:
state: mint: The mint to initialize.
func NewInitializeInstructionBuilder ¶
func NewInitializeInstructionBuilder() *Initialize
NewInitializeInstructionBuilder creates a new `Initialize` instruction builder.
func (*Initialize) Build ¶
func (obj *Initialize) Build() *Instruction
func (*Initialize) EncodeToTree ¶
func (obj *Initialize) EncodeToTree(parent treeout.Branches)
func (*Initialize) GetMintAccount ¶
func (obj *Initialize) GetMintAccount() *common.AccountMeta
GetMintAccount gets the "mint" parameter. The mint to initialize.
func (*Initialize) MarshalWithEncoder ¶
func (obj *Initialize) MarshalWithEncoder(encoder *binary.Encoder) (err error)
func (*Initialize) SetMintAccount ¶
func (obj *Initialize) SetMintAccount(mint common.PublicKey, multiSigners ...common.PublicKey) *Initialize
SetMintAccount sets the "mint" parameter. The mint to initialize.
func (*Initialize) SetProgramId ¶
func (obj *Initialize) SetProgramId(programId *common.PublicKey) *Initialize
func (*Initialize) SetState ¶
func (obj *Initialize) SetState(state spltoken2022.AccountState) *Initialize
SetState sets the "state" parameter.
func (*Initialize) UnmarshalWithDecoder ¶
func (obj *Initialize) UnmarshalWithDecoder(decoder *binary.Decoder) (err error)
func (*Initialize) Validate ¶
func (obj *Initialize) Validate() error
func (*Initialize) ValidateAndBuild ¶
func (obj *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 { binary.BaseVariant // contains filtered or unexported fields }
func DecodeInstruction ¶
func DecodeInstruction(accounts []*common.AccountMeta, data []byte) (*Instruction, error)
func (*Instruction) Accounts ¶
func (obj *Instruction) Accounts() (out []*common.AccountMeta)
func (*Instruction) Data ¶
func (obj *Instruction) Data() ([]byte, error)
func (*Instruction) EncodeToTree ¶
func (obj *Instruction) EncodeToTree(parent treeout.Branches)
func (*Instruction) MarshalWithEncoder ¶
func (obj *Instruction) MarshalWithEncoder(encoder *binary.Encoder) error
func (*Instruction) ProgramID ¶
func (obj *Instruction) ProgramID() common.PublicKey
func (*Instruction) TextEncode ¶
func (*Instruction) UnmarshalWithDecoder ¶
func (obj *Instruction) UnmarshalWithDecoder(decoder *binary.Decoder) error
type Update ¶
type Update struct { State *spltoken2022.AccountState // [0] = [WRITE] mint `The mint.` // [1] = [SIGNER] mintAuthority `The mint freeze authority.` common.AccountMetaSlice `bin:"-"` // contains filtered or unexported fields }
Update Instruction
func NewUpdateInstruction ¶
func NewUpdateInstruction( state spltoken2022.AccountState, mint common.PublicKey, mintAuthority common.PublicKey, ) *Update
NewUpdateInstruction
Parameters:
state: mint: The mint. mintAuthority: The mint freeze authority.
func NewUpdateInstructionBuilder ¶
func NewUpdateInstructionBuilder() *Update
NewUpdateInstructionBuilder creates a new `Update` instruction builder.
func (*Update) Build ¶
func (obj *Update) Build() *Instruction
func (*Update) EncodeToTree ¶
func (*Update) GetMintAccount ¶
func (obj *Update) GetMintAccount() *common.AccountMeta
GetMintAccount gets the "mint" parameter. The mint.
func (*Update) GetMintAuthorityAccount ¶
func (obj *Update) GetMintAuthorityAccount() *common.AccountMeta
GetMintAuthorityAccount gets the "mintAuthority" parameter. The mint freeze authority.
func (*Update) MarshalWithEncoder ¶
func (*Update) SetMintAccount ¶
SetMintAccount sets the "mint" parameter. The mint.
func (*Update) SetMintAuthorityAccount ¶
func (obj *Update) SetMintAuthorityAccount(mintAuthority common.PublicKey, multiSigners ...common.PublicKey) *Update
SetMintAuthorityAccount sets the "mintAuthority" parameter. The mint freeze authority.
func (*Update) SetState ¶
func (obj *Update) SetState(state spltoken2022.AccountState) *Update
SetState sets the "state" parameter.
func (*Update) UnmarshalWithDecoder ¶
func (*Update) ValidateAndBuild ¶
func (obj *Update) 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.