chainId

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2022 License: MIT Imports: 3 Imported by: 6

README

Chain ids

Read the chain list from DefiLlama/chainlist

To get all chains' latest info: GetLatestChainIdsMap()(Testnets not included.)

Documentation

Index

Constants

View Source
const (
	ArbitrumChainName  string = "arbitrum"
	AvalancheChainName string = "avalanche"
	// Deprecated: Spelling mistake, use BinanceSmartChainName instead.
	BinanaceSmartChainName string = "binance"
	BinanceSmartChainName  string = "binance"
	EthereumChainName      string = "ethereum"
	FantomChainName        string = "fantom"
	GoerliChainName        string = "goerli"
	HecoChainName          string = "heco"
	OkChainName            string = "okexchain"
	OptimismChainName      string = "optimism"
	PolygonChainName       string = "polygon"
	TerraChainName         string = "terra"
	XDaiChainName          string = "xdai"
)

Commonly used chains.

Variables

Map chain id to chain name.

Map chain name to chain id.

View Source
var ChainTokenSymbolList = map[string]string{
	EthereumChainName:     "eth",
	OptimismChainName:     "eth",
	BinanceSmartChainName: "bnb",
	OkChainName:           "okt",
	XDaiChainName:         "xdai",
	HecoChainName:         "ht",
	PolygonChainName:      "matic",
	FantomChainName:       "ftm",
	ArbitrumChainName:     "eth",
	AvalancheChainName:    "avax",
}

Map chain name to chain token symbol.

Functions

func GetLatestChainIdsMap

func GetLatestChainIdsMap() (Id2NameMap map[int]string, Name2IdMap map[string]int, err error)

Chain ids given by defillama/chainlist.

ChainList: https://chainlist.org.

Types

type Chain

type Chain struct {
	Id     int    // chain id
	Name   string // chain name
	Symbol string // chain token symbol
}

Jump to

Keyboard shortcuts

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