Documentation ¶
Index ¶
- Constants
- Variables
- func InstructionIDToName(id uint8) string
- func SetProgramID(pubkey common.PublicKey)
- 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) SetAuthority(authority common.PublicKey) *Initialize
- func (obj *Initialize) SetMintAccount(mint common.PublicKey, multiSigners ...common.PublicKey) *Initialize
- func (obj *Initialize) SetProgramId(programId common.PublicKey) *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 TransferHook
- type TransferHookAccount
- type Update
- func (obj *Update) Build() *Instruction
- func (obj *Update) EncodeToTree(parent treeout.Branches)
- func (obj *Update) GetAuthorityAccount() *common.AccountMeta
- func (obj *Update) GetMintAccount() *common.AccountMeta
- func (obj *Update) MarshalWithEncoder(encoder *binary.Encoder) (err error)
- func (obj *Update) SetAuthorityAccount(authority common.PublicKey, multiSigners ...common.PublicKey) *Update
- func (obj *Update) SetMintAccount(mint common.PublicKey) *Update
- func (obj *Update) SetProgramId(programId common.PublicKey) *Update
- func (obj *Update) UnmarshalWithDecoder(decoder *binary.Decoder) (err error)
- func (obj *Update) Validate() error
- func (obj *Update) ValidateAndBuild() (*Instruction, error)
Constants ¶
const ProgramName = "transfer_hook"
const TRANSFER_HOOK_ACCOUNT_SIZE = 1
const TRANSFER_HOOK_SIZE = 64
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 Initialize ¶
type Initialize struct { // The public key for the account that can update the program id Authority *common.PublicKey // The program id that performs logic during transfers ProgramId *common.PublicKey // [0] = [WRITE] mint `The mint to initialize` common.AccountMetaSlice `bin:"-"` // contains filtered or unexported fields }
Initialize Instruction
func NewInitializeInstruction ¶
func NewInitializeInstruction( authority common.PublicKey, programId common.PublicKey, mint common.PublicKey, ) *Initialize
NewInitializeInstruction
Parameters:
authority: The public key for the account that can update the program id programId: The program id that performs logic during transfers 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) SetAuthority ¶
func (obj *Initialize) SetAuthority(authority common.PublicKey) *Initialize
SetAuthority sets the "authority" parameter.
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
SetProgramId sets the "programId" 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 TransferHook ¶
type TransferHook struct { // Authority that can set the transfer hook program id Authority common.PublicKey // Program that authorizes the transfer ProgramId common.PublicKey }
TransferHook Struct
func (*TransferHook) MarshalWithEncoder ¶
func (obj *TransferHook) MarshalWithEncoder(encoder *binary.Encoder) (err error)
func (*TransferHook) UnmarshalWithDecoder ¶
func (obj *TransferHook) UnmarshalWithDecoder(decoder *binary.Decoder) (err error)
type TransferHookAccount ¶
type TransferHookAccount struct { // Flag to indicate that the account is in the middle of a transfer Transferring bool }
TransferHookAccount Struct Indicates that the tokens from this account belong to a mint with a transfer hook
func (*TransferHookAccount) MarshalWithEncoder ¶
func (obj *TransferHookAccount) MarshalWithEncoder(encoder *binary.Encoder) (err error)
func (*TransferHookAccount) UnmarshalWithDecoder ¶
func (obj *TransferHookAccount) UnmarshalWithDecoder(decoder *binary.Decoder) (err error)
type Update ¶
type Update struct { // The program id that performs logic during transfers ProgramId *common.PublicKey // [0] = [WRITE] mint `The mint.` // [1] = [SIGNER] authority `The transfer hook authority.` common.AccountMetaSlice `bin:"-"` // contains filtered or unexported fields }
Update Instruction
func NewUpdateInstruction ¶
func NewUpdateInstruction( programId common.PublicKey, mint common.PublicKey, authority common.PublicKey, ) *Update
NewUpdateInstruction
Parameters:
programId: The program id that performs logic during transfers mint: The mint. authority: The transfer hook 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) GetAuthorityAccount ¶
func (obj *Update) GetAuthorityAccount() *common.AccountMeta
GetAuthorityAccount gets the "authority" parameter. The transfer hook authority.
func (*Update) GetMintAccount ¶
func (obj *Update) GetMintAccount() *common.AccountMeta
GetMintAccount gets the "mint" parameter. The mint.
func (*Update) MarshalWithEncoder ¶
func (*Update) SetAuthorityAccount ¶
func (obj *Update) SetAuthorityAccount(authority common.PublicKey, multiSigners ...common.PublicKey) *Update
SetAuthorityAccount sets the "authority" parameter. The transfer hook authority.
func (*Update) SetMintAccount ¶
SetMintAccount sets the "mint" parameter. The mint.
func (*Update) SetProgramId ¶
SetProgramId sets the "programId" 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.