Documentation
¶
Overview ¶
Package validator provides zero-dependency format and Memo/Destination Tag validation for cryptocurrency addresses across major blockchain networks.
Supported network families include Bitcoin (Bech32/Bech32m and Base58), EVM-compatible networks (Ethereum, Base, Arbitrum, BNB Chain, Polygon), Solana, Tron, XRP Ledger, Stellar, TON, and Litecoin.
For practical cross-chain transfer rules, wrong-network prevention, and Memo/Destination Tag handling, see:
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUnsupportedNetwork = errors.New("unsupported network")
ErrUnsupportedNetwork is returned when a network identifier is not recognized.
Functions ¶
func SupportsMemo ¶
SupportsMemo reports whether the given network uses a Memo, Destination Tag, or Comment for custodial or exchange deposits.
func ValidateMemo ¶
ValidateMemo checks whether memo is structurally valid for net. An empty memo is accepted because self-custody wallets typically do not require one.
Types ¶
type Network ¶
type Network string
Network identifies a blockchain network family for address validation.
const ( NetworkBitcoin Network = "bitcoin" NetworkEthereum Network = "ethereum" NetworkBase Network = "base" NetworkArbitrum Network = "arbitrum" NetworkBNB Network = "bnb" NetworkPolygon Network = "polygon" NetworkSolana Network = "solana" NetworkTron Network = "tron" NetworkXRP Network = "xrp" NetworkStellar Network = "stellar" NetworkTON Network = "ton" NetworkLitecoin Network = "litecoin" )
type ValidationResult ¶
type ValidationResult struct {
Valid bool
Network Network
Address string
MemoOptional bool
MemoNote string
Error string
}
ValidationResult describes the outcome of validating an address and optional memo/tag.
func ValidateAddress ¶
func ValidateAddress(net Network, addr string) ValidationResult
ValidateAddress checks whether addr matches the expected address format for net.