chains

package
v0.2.11 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package chains provides static metadata for known EVM-compatible chains.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainCurrency

type ChainCurrency struct {
	Name     string `json:"name"`
	Symbol   string `json:"symbol"`
	Decimals int    `json:"decimals"`
}

ChainCurrency describes a chain's native currency.

type ChainENS

type ChainENS struct {
	Registry string `json:"registry"`
}

ChainENS holds ENS registry information for a chain.

type ChainExplorer

type ChainExplorer struct {
	Name     string `json:"name"`
	URL      string `json:"url"`
	Standard string `json:"standard"` // EIP3091
}

ChainExplorer describes a block explorer for a chain.

type ChainFeature

type ChainFeature struct {
	Name string `json:"name"`
}

ChainFeature represents a feature supported by a chain (e.g. EIP155, EIP1559).

type ChainInfo

type ChainInfo struct {
	Name           string           `json:"name"`
	Chain          string           `json:"chain"`
	Icon           string           `json:"icon"`
	RPC            []string         `json:"rpc"`
	Features       []*ChainFeature  `json:"features"`
	Faucets        []string         `json:"faucets"`
	NativeCurrency *ChainCurrency   `json:"nativeCurrency"`
	InfoURL        string           `json:"infoURL"`
	ShortName      string           `json:"shortName"`
	ChainId        uint64           `json:"chainId"`
	NetworkId      uint64           `json:"networkId"`
	Slip44         int              `json:"slip44,omitempty"`
	ENS            *ChainENS        `json:"ens"`
	Explorers      []*ChainExplorer `json:"explorers"`
}

ChainInfo holds metadata for an EVM-compatible chain.

func Get

func Get(id uint64) *ChainInfo

Get returns the ChainInfo for the given chain ID, or nil if unknown. Results are cached after the first lookup.

func (*ChainInfo) ExplorerURL

func (ci *ChainInfo) ExplorerURL() string

ExplorerURL returns the URL of the chain's first block explorer, or an empty string if none.

func (*ChainInfo) HasFeature

func (ci *ChainInfo) HasFeature(feat string) bool

HasFeature reports whether the chain supports the named feature.

func (*ChainInfo) TransactionUrl

func (ci *ChainInfo) TransactionUrl(txHash string) string

TransactionUrl returns a URL to view the given transaction hash on the chain's first explorer. Returns an empty string if no explorer is configured.

Jump to

Keyboard shortcuts

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