idl

package
v0.104.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: MIT Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	InstructionCreate       uint8 = iota // One-time initializer for creating the program's IDL account.
	InstructionCreateBuffer              // Creates a new IDL account buffer. Can be called several times.
	InstructionWrite                     // Appends the given data to the end of the IDL account buffer.
	InstructionSetBuffer                 // Sets a new data buffer for the IdlAccount.
	InstructionSetAuthority              // Sets a new authority on the IdlAccount.
	InstructionClose                     // Closes the IDL PDA account.
	InstructionResize                    // Increases account size for accounts that need over 10kb.
)
View Source
const ProgramName = "AnchorIDL"

Variables

View Source
var Discriminator = []byte{64, 244, 188, 120, 167, 233, 105, 10}

Discriminator is the fixed 8-byte Anchor discriminator that identifies IDL instructions.

View Source
var InstructionImplDef = ag_binary.NewVariantDefinition(
	ag_binary.Uint8TypeIDEncoding,
	[]ag_binary.VariantType{
		{Name: "create", Type: (*IDLCreate)(nil)},
		{Name: "create_buffer", Type: (*IDLCreateBuffer)(nil)},
		{Name: "write", Type: (*IDLWrite)(nil)},
		{Name: "set_buffer", Type: (*IDLSetBuffer)(nil)},
		{Name: "set_authority", Type: (*IDLSetAuthority)(nil)},
		{Name: "close", Type: (*IDLClose)(nil)},
		{Name: "resize", Type: (*IDLResize)(nil)},
	},
)

ProgramID is a zero sentinel since IDL instructions are sent to the target program rather than a dedicated IDL program address.

Functions

func IsInstruction

func IsInstruction(data []byte) bool

IsInstruction reports whether data starts with the IDL instruction discriminator.

Types

type IDLClose

type IDLClose struct{}

func (*IDLClose) UnmarshalWithDecoder

func (inst *IDLClose) UnmarshalWithDecoder(decoder *ag_binary.Decoder) error

type IDLCreate

type IDLCreate struct{ DataLen uint64 }

IDLCreate instruction

func (*IDLCreate) UnmarshalWithDecoder

func (inst *IDLCreate) UnmarshalWithDecoder(decoder *ag_binary.Decoder) error

type IDLCreateBuffer

type IDLCreateBuffer struct{}

func (*IDLCreateBuffer) UnmarshalWithDecoder

func (inst *IDLCreateBuffer) UnmarshalWithDecoder(decoder *ag_binary.Decoder) error

type IDLResize

type IDLResize struct{ DataLen uint64 }

func (*IDLResize) UnmarshalWithDecoder

func (inst *IDLResize) UnmarshalWithDecoder(decoder *ag_binary.Decoder) error

type IDLSetAuthority

type IDLSetAuthority struct{ NewAuthority ag_solanago.PublicKey }

func (*IDLSetAuthority) UnmarshalWithDecoder

func (inst *IDLSetAuthority) UnmarshalWithDecoder(decoder *ag_binary.Decoder) error

type IDLSetBuffer

type IDLSetBuffer struct{}

func (*IDLSetBuffer) UnmarshalWithDecoder

func (inst *IDLSetBuffer) UnmarshalWithDecoder(decoder *ag_binary.Decoder) error

type IDLWrite

type IDLWrite struct{ Data []byte }

func (*IDLWrite) UnmarshalWithDecoder

func (inst *IDLWrite) UnmarshalWithDecoder(decoder *ag_binary.Decoder) error

type Instruction

type Instruction struct {
	ag_binary.BaseVariant
}

func DecodeInstruction

func DecodeInstruction(accounts []*ag_solanago.AccountMeta, data []byte) (*Instruction, error)

DecodeInstruction decodes a Solana IDL instruction from the given accounts and data. The data must start with the 8-byte IDL discriminator followed by a 1-byte instruction type.

func (*Instruction) Accounts

func (inst *Instruction) Accounts() (out []*ag_solanago.AccountMeta)

func (*Instruction) Data

func (inst *Instruction) Data() ([]byte, error)

func (*Instruction) MarshalWithEncoder

func (inst *Instruction) MarshalWithEncoder(encoder *ag_binary.Encoder) error

func (*Instruction) ProgramID

func (inst *Instruction) ProgramID() ag_solanago.PublicKey

func (*Instruction) UnmarshalWithDecoder

func (inst *Instruction) UnmarshalWithDecoder(decoder *ag_binary.Decoder) error

Jump to

Keyboard shortcuts

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