chains

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultConfigPath

func DefaultConfigPath() string

Types

type ChainConfig

type ChainConfig struct {
	ID             string            `json:"id"`
	Name           string            `json:"name"`
	NameZh         string            `json:"name_zh"`
	Type           ChainType         `json:"type"`
	IsTestnet      bool              `json:"is_testnet"`
	Status         string            `json:"status"`
	Icon           string            `json:"icon"`
	Color          string            `json:"color"`
	NativeCurrency NativeCurrency    `json:"native_currency"`
	ExplorerURL    string            `json:"explorer_url"`
	BlockTime      int               `json:"block_time"`
	NetworkMagic   uint32            `json:"network_magic"`
	ChainID        uint64            `json:"chain_id"`
	RPCUrls        []string          `json:"rpc_urls"`
	WSUrls         []string          `json:"ws_urls"`
	Contracts      map[string]string `json:"contracts"`
	Metadata       map[string]any    `json:"metadata"`
}

func (ChainConfig) Contract

func (c ChainConfig) Contract(name string) string

func (ChainConfig) Validate

func (c ChainConfig) Validate() error

type ChainType

type ChainType string
const (
	ChainTypeNeoN3 ChainType = "neo-n3"
	ChainTypeEVM   ChainType = "evm"
)

type Config

type Config struct {
	Chains []ChainConfig `json:"chains"`
}

func LoadConfig

func LoadConfig() (*Config, error)

func LoadConfigFromBytes

func LoadConfigFromBytes(data []byte) (*Config, error)

func LoadConfigFromPath

func LoadConfigFromPath(path string) (*Config, error)

func (*Config) ActiveChains

func (c *Config) ActiveChains() []ChainConfig

func (*Config) GetChain

func (c *Config) GetChain(id string) (*ChainConfig, bool)

func (*Config) Validate

func (c *Config) Validate() error

type NativeCurrency

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

Jump to

Keyboard shortcuts

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