solanautil

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	USDC         = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
	USDCDecimals = 6
)

Variables

View Source
var ErrTxNotFound = errors.New("tx not found")

Functions

func FindAssociatedTokenAddress added in v0.1.1

func FindAssociatedTokenAddress(owner, mint, programID solana.PublicKey) (solana.PublicKey, uint8, error)

func FormatSOL

func FormatSOL(amount decimal.Decimal) *big.Int

func FormatUnits

func FormatUnits(amount decimal.Decimal, decimals uint8) *big.Int

func GetAccountInfoJSONParsed

func GetAccountInfoJSONParsed(ctx context.Context, solanaRpc *rpc.Client, account solana.PublicKey) (out *rpc.GetAccountInfoResult, err error)

func GetBalance

func GetBalance(ctx context.Context, solanaRpc *rpc.Client, ownerAddress string) (*big.Int, error)

func GetSignatureStatuses

func GetSignatureStatuses(ctx context.Context, solanaRpc *rpc.Client, txHash string) (*rpc.GetSignatureStatusesResult, error)

func GetTokenBalance

func GetTokenBalance(ctx context.Context, solanaRpc *rpc.Client, tokenAddress, ownerAddress string) (*big.Int, uint8, error)

func GetTokenBalanceChanges

func GetTokenBalanceChanges(ctx context.Context, solanaRpc *rpc.Client, hash, ownerAddress string) (map[string]TokenBalanceChange, error)

func GetTokenMeta

func GetTokenMeta(ctx context.Context, solanaRpc *rpc.Client, tokenAddress string) (*token_metadata.Metadata, error)

func GetTokenMint

func GetTokenMint(ctx context.Context, solanaRpc *rpc.Client, tokenAddress string) (*token.Mint, error)

func IsProgramError

func IsProgramError(err error) bool

func NewTransactionFromBase64

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

func ParseSOL

func ParseSOL(value *big.Int) decimal.Decimal

func ParseUnits

func ParseUnits(value *big.Int, decimals uint8) decimal.Decimal

func SignTransaction

func SignTransaction(wallet *solana.Wallet, tx *solana.Transaction) (*solana.Transaction, string, error)

Types

type Extension

type Extension struct {
	Extension string          `json:"extension"`
	State     json.RawMessage `json:"state"`
}

type Info

type Info struct {
	Decimals        int         `json:"decimals"`
	Extensions      []Extension `json:"extensions"`
	FreezeAuthority *string     `json:"freezeAuthority"`
	IsInitialized   bool        `json:"isInitialized"`
	MintAuthority   *string     `json:"mintAuthority"`
	Supply          string      `json:"supply"`
}

type MetadataPointerState

type MetadataPointerState struct {
	Authority       string `json:"authority"`
	MetadataAddress string `json:"metadataAddress"`
}

type Parsed

type Parsed struct {
	Info Info   `json:"info"`
	Type string `json:"type"`
}

type ProgramError

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

func (*ProgramError) Error

func (e *ProgramError) Error() string

type TokenBalanceChange

type TokenBalanceChange struct {
	Pre    decimal.Decimal
	Post   decimal.Decimal
	Change decimal.Decimal
}

type TokenData

type TokenData struct {
	Parsed  Parsed `json:"parsed"`
	Program string `json:"program"`
	Space   int    `json:"space"`
}

type TokenMetadataState

type TokenMetadataState struct {
	AdditionalMetadata []interface{} `json:"additionalMetadata"`
	Mint               string        `json:"mint"`
	Name               string        `json:"name"`
	Symbol             string        `json:"symbol"`
	UpdateAuthority    string        `json:"updateAuthority"`
	URI                string        `json:"uri"`
}

Jump to

Keyboard shortcuts

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