solana

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

Package solana reads a Solana wallet (Phantom, Solflare, Ledger…) from its public address: SOL and SPL token history and balances. Nothing is signed and no secret is needed.

Data comes from the public JSON-RPC (api.mainnet-beta.solana.com): getSignaturesForAddress lists the transactions of the address and of each of its token accounts (an incoming token transfer often does not mention the owner, only its token account), getTransaction (jsonParsed) gives the balances before and after each one, and the owner's movements are their difference. Unknown token mints are named by Jupiter's token API.

Limits of this first version:

  • a swap shows as its legs (a Withdrawal of what was sent and a Deposit of what was received, same TxID), not as a Trade;
  • tokens Jupiter does not list as verified are skipped as spam, and well-known symbols (SOL, USDC, USDT…) only count from their canonical mint, so a counterfeit "USDC" airdrop is ignored;
  • staking rewards (credited to stake accounts at epoch boundaries, not by a transaction) and SOL held in stake accounts are not read;
  • SOL locked as rent in token accounts is not part of the balance: its payment shows as a Withdrawal, its refund on close as a Deposit.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cfg source.Config) (source.Source, error)

New builds the connector from its settings.

func Valid

func Valid(s string) bool

Valid reports whether s is a Solana address: base58 for exactly 32 bytes (Bitcoin and Tron base58check addresses decode to 25).

Types

type Source

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

Source is a configured wallet.

func (*Source) Activities

func (s *Source) Activities(ctx context.Context, f source.Fetch) error

func (*Source) Balances

func (s *Source) Balances(ctx context.Context) ([]model.Balance, error)

func (*Source) State

func (s *Source) State() []byte

func (*Source) Test

func (s *Source) Test(ctx context.Context) error

Test checks the RPC answers for the address.

Jump to

Keyboard shortcuts

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