generator

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: MIT Imports: 16 Imported by: ? modules, 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 (
	PkgBinary         = "github.com/gagliardetto/binary"
	PkgSolanaGo       = "github.com/gagliardetto/solana-go"
	PkgSolanaGoText   = "github.com/gagliardetto/solana-go/text"
	PkgAnchorGoErrors = "github.com/smartcontractkit/anchor-go/errors"
	// TODO: use or remove this:
	PkgTreeout        = "github.com/gagliardetto/treeout"
	PkgFormat         = "github.com/gagliardetto/solana-go/text/format"
	PkgGoFuzz         = "github.com/gagliardetto/gofuzz"
	PkgTestifyRequire = "github.com/stretchr/testify/require"
)

Variables

View Source
var Debug = false // Set to true to enable debug logging.
View Source
var Errors = map[int]CustomError{}

Functions

func DecodeCustomError

func DecodeCustomError(rpcErr error) (err error, ok bool)

func DoGroup

func DoGroup(f func(*Group)) *Statement

func DoGroupMultiline

func DoGroupMultiline(f func(*Group)) *Statement

func FormatAccountDiscriminatorName

func FormatAccountDiscriminatorName(exportedAccountName string) string

func FormatEventDiscriminatorName

func FormatEventDiscriminatorName(exportedEventName string) string

func FormatInstructionDiscriminatorName

func FormatInstructionDiscriminatorName(exportedInstructionName string) string

func FormatTupleItemName

func FormatTupleItemName(index int) string

func IDLTypeKind_ToTypeDeclCode

func IDLTypeKind_ToTypeDeclCode(ts idltype.IdlType) *Statement

func IsArray

func IsArray(v idltype.IdlType) bool

func IsBool

func IsBool(v idltype.IdlType) bool

func IsCOption

func IsCOption(v idltype.IdlType) bool

func IsDefined

func IsDefined(v idltype.IdlType) bool

func IsIDLTypeKind

func IsIDLTypeKind(v idltype.IdlType) bool

func IsOption

func IsOption(v idltype.IdlType) bool

func IsVec

func IsVec(v idltype.IdlType) bool

func ListMultiline

func ListMultiline(f func(*Group)) *Statement

func WriteFile

func WriteFile(outDir string, assetFileName string, file *File) error

Types

type CustomError

type CustomError interface {
	Code() int
	Name() string
	Error() string
}

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

func NewGenerator

func NewGenerator(idl *idl.Idl, options *GeneratorOptions) *Generator

func (*Generator) Generate

func (g *Generator) Generate() (*Output, error)

type GeneratorOptions

type GeneratorOptions struct {
	OutputDir   string            // Directory to write the generated code to.
	Package     string            // Package name for the generated code.
	ModPath     string            // Module path for the generated code. E.g. "github.com/gagliardetto/mysolana-program-go"
	ProgramId   *solana.PublicKey // Program ID to use in the generated code.
	ProgramName string            // Name of the program for the generated code.
	SkipGoMod   bool              // If true, skip generating the go.mod file.
}

type Output

type Output struct {
	Files []*OutputFile // List of output files to be generated.
	GoMod []byte        // Go module file content.
}

type OutputFile

type OutputFile struct {
	Name string // Name of the output file.
	File *File
}

Jump to

Keyboard shortcuts

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