solana

package
v0.0.0-...-a21560b Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertLamportToSol

func ConvertLamportToSol[T Number](lamports T) *big.Float

func CreateQR

func CreateQR(address string, amount float64) (string, error)

CreateQR is a function that creates a QR code for a given address and amount

func CreateSoloQR

func CreateSoloQR(address string) (string, error)

CreateSoloQR is a function that creates a QR code for a given address and returns the base64 representation

Types

type Client

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

func NewClient

func NewClient(ctx context.Context) *Client

func (Client) CreateMTransactions

func (c Client) CreateMTransactions(ctx context.Context, tb []*TransactionBundle, payer *walletPair, simulate bool) (*solana.Signature, error)

CreateMTransactions creates multiple atomic transactions that are bundled together If one of the transactions fails, the entire bundle fails

func (Client) CreateTransaction

func (c Client) CreateTransaction(ctx context.Context, from *walletPair, to string, amount float64, simulate bool) (*solana.Signature, error)

CreateTransaction creates a singly atomic transaction

func (Client) CreateWallet

func (Client) CreateWallet() *walletPair

CreateWallet create a new wallet

func (Client) FromFile

func (c Client) FromFile(path string) (*walletPair, error)

FromFile decodes a wallet from a file

func (Client) GetConfirmations

func (c Client) GetConfirmations(ctx context.Context, txID string) (int16, error)

GetConfirmations returns the number of confirmations

func (Client) GetTransaction

func (c Client) GetTransaction(ctx context.Context, txID string) (*ledgerResult, error)

GetTransaction returns the raw transaction

func (Client) ListenForTX

func (c Client) ListenForTX(ctx context.Context, address string, callback func(*ws.LogResult) bool, event ...rpc.CommitmentType) error

ListenForEvent listens for a solana event

func (Client) RequestAirdrop

func (c Client) RequestAirdrop(ctx context.Context, w *walletPair) (*solana.Signature, error)

RequestAirdrop requests an airdrop used for testing

func (Client) SendAllBalance

func (c Client) SendAllBalance(ctx context.Context, from *walletPair, to string, simulate bool) (*solana.Signature, error)

SendAllBalance sends the entire balance of a wallet

func (Client) SimulateTransaction

func (c Client) SimulateTransaction(ctx context.Context, tx *solana.Transaction) (*simulationResult, error)

SimulateTransaction simulates a transaction

func (Client) WalletBalance

func (c Client) WalletBalance(ctx context.Context, address string) (*big.Float, error)

WalletBalance returns the balance of a wallet in SOL

type Number

type Number interface {
	constraints.Integer | constraints.Float
}

type TransactionBundle

type TransactionBundle struct {
	From   *walletPair
	To     string  // address
	Amount float64 // in SOL
}

Jump to

Keyboard shortcuts

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