solana

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTransactionFromBase64

func NewTransactionFromBase64(txStr string) (solana.Transaction, error)

NewTransactionFromBase64 deserializes a transaction from a base64 string.

Types

type Client

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

func NewClient

func NewClient(
	wallet Wallet,
	rpcEndpoint string,
	opts ...ClientOption,
) (Client, error)

func (Client) CheckSignature

func (e Client) CheckSignature(ctx context.Context, tx TxID) (bool, error)

CheckSignature checks if a transaction with the given signature has been confirmed on-chain

func (Client) SendTransactionOnChain

func (e Client) SendTransactionOnChain(ctx context.Context, txBase64 string) (TxID, error)

SendTransactionOnChain sends on-chain a transaction

type ClientOption

type ClientOption func(*Client) error

ClientOption is a function that allows to specify options for the client

func WithClientRPC

func WithClientRPC(clientRPC ClientRPC) ClientOption

WithClientRPC sets the Solana client RPC for the engine

func WithMaxRetries

func WithMaxRetries(maxRetries uint) ClientOption

WithMaxRetries sets the maximum number of retries for the engine when sending a transaction on-chain

type ClientRPC

type ClientRPC interface {
	SendTransactionWithOpts(
		ctx context.Context,
		transaction *solana.Transaction,
		opts rpc.TransactionOpts,
	) (signature solana.Signature, err error)
	GetLatestBlockhash(
		ctx context.Context,
		commitment rpc.CommitmentType,
	) (out *rpc.GetLatestBlockhashResult, err error)
	GetSignatureStatuses(
		ctx context.Context,
		searchTransactionHistory bool,
		transactionSignatures ...solana.Signature,
	) (out *rpc.GetSignatureStatusesResult, err error)
}

type TxID

type TxID string

type Wallet

type Wallet struct {
	*solana.Wallet
}

Wallet is a wrapper around a solana.Wallet

func NewWalletFromPrivateKeyBase58

func NewWalletFromPrivateKeyBase58(privateKey string) (Wallet, error)

func (Wallet) SignTransaction

func (w Wallet) SignTransaction(tx solana.Transaction) (solana.Transaction, error)

SignTransaction signs a transaction with the wallet's private key.

Jump to

Keyboard shortcuts

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