Documentation
¶
Index ¶
- type ChainInfo
- type Config
- type NetworkConfig
- type Providers
- func (p *Providers) ChainList() []ChainInfo
- func (p *Providers) FindChain(chainHandle string, optSkipTestnets ...bool) (uint64, ChainInfo, error)
- func (p *Providers) Get(chainHandle string) *ethrpc.Provider
- func (p *Providers) GetByChainID(chainID uint64) *ethrpc.Provider
- func (p *Providers) GetByChainName(chainName string) *ethrpc.Provider
- func (p *Providers) MainnetChainIDs() []uint64
- func (p *Providers) MainnetChainList() []ChainInfo
- func (p *Providers) MainnetStringChainIDs() []string
- func (p *Providers) ProviderMap() map[uint64]*ethrpc.Provider
- func (p *Providers) TestnetChainIDs() []uint64
- func (p *Providers) TestnetChainList() []ChainInfo
- func (p *Providers) TestnetStringChainIDs() []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChainInfo ¶
type ChainInfo struct {
// ID is the globally unique chain ID. See https://chainlist.wtf
ID uint64 `json:"id"`
// Name is the canonical name of the chain. See https://docs.sequence.xyz
Name string `json:"name"`
// Testnet is true if the chain is a testnet.
Testnet bool `json:"testnet"`
}
type Config ¶
type Config map[string]NetworkConfig
type NetworkConfig ¶
type NetworkConfig struct {
// ID is the globally unique chain ID. See https://chainlist.wtf
ID uint64 `toml:"id" json:"id"`
// URL is the URL for the blockchain node JSON-RPC endpoint
URL string `toml:"url" json:"url"`
// WSEnabled marks the chain to support websocket connections.
// NOTE: you may leave `WSURL` empty and it will use the `URL`
// of the node as the WSURL by default. Or you can set `WSURL` to
// another URL for websocket connections
WSEnabled bool `toml:"ws_enabled" json:"wsEnabled"`
// WSURL is the URL for the websocket. You must also set `WSEnabled`
// to `true`
WSURL string `toml:"ws_url" json:"wsUrl"`
// Testnet marks the chain as a testnet.
Testnet bool `toml:"testnet" json:"testnet"`
// Disabled marks the chain as disabled, and will not be included
// in the list of providers at runtime.
Disabled bool `toml:"disabled" json:"disabled"`
}
type Providers ¶
type Providers struct {
// contains filtered or unexported fields
}
func (*Providers) Get ¶
Get is a helper method which will allow you to fetch the provider for a chain by either the chain canonical name, or by the chain canonical id. This works because at the time of configuring the providers list in `NewProviders` we assign the name and string-id to the byName mapping.
func (*Providers) GetByChainName ¶
func (*Providers) MainnetChainIDs ¶ added in v1.33.0
func (*Providers) MainnetChainList ¶ added in v1.33.0
func (*Providers) MainnetStringChainIDs ¶ added in v1.33.0
func (*Providers) TestnetChainIDs ¶ added in v1.33.0
func (*Providers) TestnetChainList ¶ added in v1.33.0
func (*Providers) TestnetStringChainIDs ¶ added in v1.33.0
Click to show internal directories.
Click to hide internal directories.