solana

package
v0.52.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: MIT Imports: 17 Imported by: 21

Documentation

Index

Constants

View Source
const (
	ProgramIDPrefix      = "Program Id: "
	BufferIDPrefix       = "Buffer: "
	SolDefaultCommitment = solrpc.CommitmentConfirmed
)

Variables

This section is empty.

Functions

func AddressToBytes added in v0.44.0

func AddressToBytes(address string) ([]byte, error)

AddressToBytes converts a Solana address string to bytes. Solana addresses are base58-encoded public keys (32 bytes).

Types

type AddressConverter added in v0.44.0

type AddressConverter struct{}

AddressConverter implements address conversion for Solana chains. This struct implements the AddressConverter strategy interface.

func (AddressConverter) ConvertToBytes added in v0.44.0

func (s AddressConverter) ConvertToBytes(address string) ([]byte, error)

ConvertToBytes converts a Solana address string to bytes.

func (AddressConverter) Supports added in v0.44.0

func (s AddressConverter) Supports(family string) bool

Supports returns true if this converter supports the given chain family.

type Chain

type Chain struct {
	Selector uint64

	// RPC client
	Client *solrpc.Client
	URL    string
	WSURL  string
	// TODO: raw private key for now, need to replace with a more secure way
	DeployerKey *sollib.PrivateKey

	// SendAndConfim provides a utility function to send a transaction and waits for confirmation.
	// Options can be passed to modify the transaction such as setting additional signers or
	// modifying compute unit limits.
	SendAndConfirm func(
		ctx context.Context, instructions []sollib.Instruction, opts ...rpcclient.TxModifier,
	) error

	// Legacy: Use SendAndConfirm instead. This function will be removed in the future.
	// Confirm is a legacy function that sends a transaction and waits for confirmation.
	Confirm func(instructions []sollib.Instruction, opts ...solCommonUtil.TxModifier) error

	// deploy uses the solana CLI which needs a keyfile
	KeypairPath  string
	ProgramsPath string
}

Chain represents a Solana chain.

func (Chain) ChainSelector

func (c Chain) ChainSelector() uint64

ChainSelector returns the chain selector of the chain

func (Chain) CloseBuffers

func (c Chain) CloseBuffers(logger logger.Logger, buffer string) error

func (Chain) DeployProgram

func (c Chain) DeployProgram(logger logger.Logger, programInfo ProgramInfo, isUpgrade bool, overallocate bool) (string, error)

Overallocate should be set when deploying any program that may eventually be owned by timelock Overallocate is mutually exclusive with isUpgrade

func (Chain) Family added in v0.5.1

func (c Chain) Family() string

Family returns the family of the chain

func (Chain) GetAccountDataBorshInto

func (c Chain) GetAccountDataBorshInto(ctx context.Context, pubkey sollib.PublicKey, accountState interface{}) error

func (Chain) Name

func (c Chain) Name() string

Name returns the name of the chain

func (Chain) String

func (c Chain) String() string

String returns chain name and selector "<name> (<selector>)"

type ProgramInfo

type ProgramInfo struct {
	Name  string
	Bytes int
}

ProgramInfo contains information about a Solana program.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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