associatedtokenaccount

package
v0.0.0-...-493e64f Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	Instruction_Create uint8 = iota
	Instruction_CreateIdempotent
)
View Source
const ProgramName = "AssociatedTokenAccount"

Variables

View Source
var InstructionImplDef = bin.NewVariantDefinition(
	bin.Uint8TypeIDEncoding,
	[]bin.VariantType{
		{
			"Create", (*Create)(nil),
		},
		{
			"CreateIdempotent", (*CreateIdempotent)(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 CreateIdempotent

type CreateIdempotent 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 NewCreateIdempotentInstruction

func NewCreateIdempotentInstruction(
	payer solana.PublicKey,
	walletAddress solana.PublicKey,
	splTokenMintAddress solana.PublicKey,
) *CreateIdempotent

func NewCreateIdempotentInstructionBuilder

func NewCreateIdempotentInstructionBuilder() *CreateIdempotent

NewCreateIdempotentInstructionBuilder creates a new `CreateIdempotent` instruction builder.

func (CreateIdempotent) Build

func (inst CreateIdempotent) Build() *Instruction

func (*CreateIdempotent) EncodeToTree

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

func (CreateIdempotent) MarshalWithEncoder

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

func (*CreateIdempotent) SetMint

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

func (*CreateIdempotent) SetPayer

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

func (*CreateIdempotent) SetWallet

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

func (*CreateIdempotent) UnmarshalWithDecoder

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

func (*CreateIdempotent) Validate

func (inst *CreateIdempotent) Validate() error

func (CreateIdempotent) ValidateAndBuild

func (inst CreateIdempotent) 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