solutil

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2025 License: GPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Version = "stable"

Functions

func AwaitConfirmedTransaction

func AwaitConfirmedTransaction(ctx context.Context, cl *rpc.Client, txSig solana.Signature) (*rpc.GetTransactionResult, error)

AwaitConfirmedTransaction waits for a transaction to be confirmed.

func Deploy

func Deploy(ctx context.Context, cl *rpc.Client, composeDir string, program Program) (*rpc.GetTransactionResult, error)

Deploy deploys a program to the localhost compose network using hte default keypair. It returns the confirmed transaction result or an error.

func FillHash

func FillHash(
	orderID [32]byte,
	srcChainID uint64,
	destChainID uint64,
	fillDeadline uint32,
	callTarget common.Address,
	callSelector [4]byte,
	callValue *big.Int,
	callParams []byte,
	expenseSpender common.Address,
	expenseToken common.Address,
	expenseAmount *big.Int,
) (common.Hash, error)

FillHash returns the fill hash for the given parameters.

func GetAccountDataInto

func GetAccountDataInto(ctx context.Context, cl *rpc.Client, address solana.PublicKey, val any) (*rpc.GetAccountInfoResult, error)

GetAccountDataInto retrieves account data and decodes it into the provided value. It uses commitment level of "confirmed".

func RandomU96

func RandomU96() bin.Uint128

RandomU96 generates a random 96-bit unsigned integer of type bin.Uint128.

func Send

func Send(ctx context.Context, cl *rpc.Client, opts ...func(*sendOpts)) (solana.Signature, error)

func SendSimple

func SendSimple(ctx context.Context, cl *rpc.Client, privkey solana.PrivateKey, instrs ...solana.Instruction) (solana.Signature, error)

func Start

func Start(ctx context.Context, composeDir string, programs ...Program) (*rpc.Client, solana.PrivateKey, func(), error)

Start starts a genesis solana node and returns a client, a funded private key and a stop function or an error. The dir parameter is the location of the docker compose.

func Stream

func Stream(ctx context.Context, cl *rpc.Client, req StreamReq, callback StreamCallback) error

func U128

func U128(i *big.Int) (bin.Uint128, error)

U128 returns the big int as a solana binary uint128.

func WithInstructions

func WithInstructions(instrs ...solana.Instruction) func(*sendOpts)

func WithPrivateKeys

func WithPrivateKeys(privkeys ...solana.PrivateKey) func(*sendOpts)

func WrapRPCError

func WrapRPCError(err error, endpoint string, attrs ...any) error

Types

type Program

type Program struct {
	Name         string
	SharedObject []byte // Compiled BPF shared object
	KeyPairJSON  []byte
}

Program represents a Solana executable program (smart contract).

func (Program) KeyPairFile

func (p Program) KeyPairFile() string

func (Program) MustPrivateKey

func (p Program) MustPrivateKey() solana.PrivateKey

func (Program) MustPublicKey

func (p Program) MustPublicKey() solana.PublicKey

func (Program) SOFile

func (p Program) SOFile() string

type StreamCallback

type StreamCallback func(ctx context.Context, sig *rpc.TransactionSignature) error

type StreamReq

type StreamReq struct {
	FromSlot   *uint64          // Inclusive if not nil
	AfterSig   solana.Signature // Exclusive
	Account    solana.PublicKey
	Commitment rpc.CommitmentType
}

Jump to

Keyboard shortcuts

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