associatedtokenaccount

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const ProgramName = "AssociatedTokenAccount"

Variables

View Source
var InstructionImplDef = bin.NewVariantDefinition(
	bin.NoTypeIDEncoding,
	[]bin.VariantType{
		{
			"Create", (*Create)(nil),
		},
	},
)

Functions

func SetProgramID

func SetProgramID(pubkey solana.PublicKey)

Types

type Create

type Create struct {
	Payer  solana.PublicKey `bin:"-" borsh_skip:"true"`
	Wallet solana.PublicKey `bin:"-" borsh_skip:"true"`
	Mint   solana.PublicKey `bin:"-" borsh_skip:"true"`

	// [0] = [WRITE, SIGNER] Payer
	// ··········· Funding account
	//
	// [1] = [WRITE] AssociatedTokenAccount
	// ··········· Associated token account address to be created
	//
	// [2] = [] Wallet
	// ··········· Wallet address for the new associated token account
	//
	// [3] = [] TokenMint
	// ··········· The token mint for the new associated token account
	//
	// [4] = [] SystemProgram
	// ··········· System program ID
	//
	// [5] = [] TokenProgram
	// ··········· SPL token program ID
	//
	// [6] = [] SysVarRent
	// ··········· SysVarRentPubkey
	solana.AccountMetaSlice `bin:"-" borsh_skip:"true"`
}

func NewCreateInstruction

func NewCreateInstruction(
	payer solana.PublicKey,
	walletAddress solana.PublicKey,
	splTokenMintAddress solana.PublicKey,
) *Create

func NewCreateInstructionBuilder

func NewCreateInstructionBuilder() *Create

NewCreateInstructionBuilder creates a new `Create` instruction builder.

func (Create) Build

func (inst Create) Build() *Instruction

func (*Create) EncodeToTree

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

func (Create) MarshalWithEncoder

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

func (*Create) SetMint

func (inst *Create) SetMint(mint solana.PublicKey) *Create

func (*Create) SetPayer

func (inst *Create) SetPayer(payer solana.PublicKey) *Create

func (*Create) SetWallet

func (inst *Create) SetWallet(wallet solana.PublicKey) *Create

func (*Create) UnmarshalWithDecoder

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

func (*Create) Validate

func (inst *Create) Validate() error

func (Create) ValidateAndBuild

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

ValidateAndBuild validates the instruction accounts. If there is a validation error, return the error. Otherwise, build and return the instruction.

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

Jump to

Keyboard shortcuts

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