types

package
v0.0.0-...-64579b1 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2025 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	Name     string `json:"name"`
	Writable bool   `json:"writable,omitempty"`
	Signer   bool   `json:"signer,omitempty"`
	Address  string `json:"address,omitempty"`
	PDA      *PDA   `json:"pda,omitempty"`
}

Account represents an account in the IDL

type Arg

type Arg struct {
	Name string      `json:"name"`
	Type interface{} `json:"type"`
}

Arg represents an argument in the IDL

type Error

type Error struct {
	Code int    `json:"code"`
	Name string `json:"name"`
	Msg  string `json:"msg"`
}

Error represents an error in the IDL

type Field

type Field struct {
	Name string      `json:"name"`
	Type interface{} `json:"type"`
}

Field represents a field in a type in the IDL

type IDL

type IDL struct {
	Address      string        `json:"address"`
	Metadata     Metadata      `json:"metadata"`
	Instructions []Instruction `json:"instructions"`
	Accounts     []Account     `json:"accounts"`
	Errors       []Error       `json:"errors"`
	Types        []Type        `json:"types"`
}

IDL represents the interface definition language for a Solana program more info: https://solana.com/hi/docs/programs/anchor/idl

func (IDL) GetDiscriminator

func (i IDL) GetDiscriminator(name string) [8]byte

GetDiscriminator returns the discriminator from the instruction name

type Instruction

type Instruction struct {
	Name          string    `json:"name"`
	Discriminator [8]byte   `json:"discriminator"`
	Accounts      []Account `json:"accounts"`
	Args          []Arg     `json:"args"`
}

Instruction represents a single instruction in the IDL

type Metadata

type Metadata struct {
	Name        string `json:"name"`
	Version     string `json:"version"`
	Spec        string `json:"spec"`
	Description string `json:"description"`
}

Metadata represents the metadata of the IDL

type PDA

type PDA struct {
	Seeds []Seed `json:"seeds"`
}

PDA represents a program-derived address in the IDL

type Seed

type Seed struct {
	Kind  string `json:"kind"`
	Value []byte `json:"value,omitempty"`
}

Seed represents a seed in the PDA

type Type

type Type struct {
	Name string    `json:"name"`
	Type TypeField `json:"type"`
}

Type represents a type in the IDL

type TypeField

type TypeField struct {
	Kind   string  `json:"kind"`
	Fields []Field `json:"fields"`
}

TypeField represents a field in a type in the IDL

Jump to

Keyboard shortcuts

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