rpcclient

package
v0.13.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*solrpc.Client

	DeployerKey sollib.PrivateKey
}

Client is a wrapper around the solana RPC client that provides additional functionality such as sending transactions with lookup tables and handling retries.

func New

func New(client *solrpc.Client, deployerKey sollib.PrivateKey) *Client

New creates a new Client instance with the provided Solana RPC client and deployer's private key.

func (*Client) SendAndConfirmTx

func (c *Client) SendAndConfirmTx(
	ctx context.Context,
	instructions []sollib.Instruction,
	opts ...SendOpt,
) (*solrpc.GetTransactionResult, error)

SendAndConfirmTx builds, signs, sends, and confirms a transaction using the given instructions. It applies any provided options for retries and transaction modification, fetches the latest blockhash, signs with the deployer's key, and waits for the transaction to be confirmed.

type SendOpt

type SendOpt func(*sendConfig)

SendOpt is a functional option type that allows for configuring Send operations.

func WithRetry

func WithRetry(attempts uint, delay time.Duration) SendOpt

WithRetry sets the number of retry attempts and the delay between retries for sending transactions.

func WithTxModifiers

func WithTxModifiers(modifiers ...TxModifier) SendOpt

WithTxModifiers allows adding transaction modifiers to the send configuration.

type TxModifier

type TxModifier func(tx *sollib.Transaction, signers map[sollib.PublicKey]sollib.PrivateKey) error

TxModifier is a dynamic function used to flexibly add components to a transaction such as additional signers, and compute budget parameters

func AddSigners

func AddSigners(additionalSigners ...sollib.PrivateKey) TxModifier

AddSigners adds additional signers to the signers map for signing the transaction.

func WithComputeUnitLimit

func WithComputeUnitLimit(v fees.ComputeUnitLimit) TxModifier

WithComputeUnitLimit sets the total compute unit limit for a transaction. The Solana network default is 200K units, with a maximum of 1.4M units. Note: Signature verification may consume varying compute units depending on the number of signatures.

func WithComputeUnitPrice

func WithComputeUnitPrice(v fees.ComputeUnitPrice) TxModifier

WithComputeUnitPrice sets the compute unit price for a transaction.

The compute unit price is the price per compute unit, in micro-lamports. This is useful for customizing transaction fees or prioritization in Solana-based workflows.

Jump to

Keyboard shortcuts

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