ethproviders

package
v1.35.7 Latest Latest
Warning

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

Go to latest
Published: May 10, 2025 License: LGPL-3.0, MIT Imports: 4 Imported by: 2

Documentation

Index

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

func (Config) AuthChain deprecated

func (n Config) AuthChain() (NetworkConfig, bool)

Deprecated: no longer required.

func (Config) GetByID

func (n Config) GetByID(id uint64) (NetworkConfig, bool)

func (Config) GetByName

func (n Config) GetByName(name string) (NetworkConfig, bool)

func (Config) TestAuthChain deprecated

func (n Config) TestAuthChain() (NetworkConfig, bool)

Deprecated: no longer required.

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"`

	// AuthChain marks the chain as an auth chain.
	// Deprecated: no longer required.
	AuthChain bool `toml:"auth_chain" json:"authChain"`

	// 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 NewProviders

func NewProviders(cfg Config, opts ...ethrpc.Option) (*Providers, error)

func (*Providers) ChainList

func (p *Providers) ChainList() []ChainInfo

func (*Providers) FindChain

func (p *Providers) FindChain(chainHandle string, optSkipTestnets ...bool) (uint64, ChainInfo, error)

func (*Providers) Get

func (p *Providers) Get(chainHandle string) *ethrpc.Provider

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) GetAuthChain

func (p *Providers) GetAuthChain() *ethrpc.Provider

func (*Providers) GetAuthProvider

func (p *Providers) GetAuthProvider() *ethrpc.Provider

func (*Providers) GetByChainID

func (p *Providers) GetByChainID(chainID uint64) *ethrpc.Provider

func (*Providers) GetByChainName

func (p *Providers) GetByChainName(chainName string) *ethrpc.Provider

func (*Providers) GetTestAuthChain

func (p *Providers) GetTestAuthChain() *ethrpc.Provider

func (*Providers) GetTestnetAuthProvider

func (p *Providers) GetTestnetAuthProvider() *ethrpc.Provider

func (*Providers) LookupAuthProviderByChainID

func (p *Providers) LookupAuthProviderByChainID(chainID uint64) *ethrpc.Provider

func (*Providers) MainnetChainIDs added in v1.33.0

func (p *Providers) MainnetChainIDs() []uint64

func (*Providers) MainnetChainList added in v1.33.0

func (p *Providers) MainnetChainList() []ChainInfo

func (*Providers) MainnetStringChainIDs added in v1.33.0

func (p *Providers) MainnetStringChainIDs() []string

func (*Providers) ProviderMap

func (p *Providers) ProviderMap() map[uint64]*ethrpc.Provider

func (*Providers) TestnetChainIDs added in v1.33.0

func (p *Providers) TestnetChainIDs() []uint64

func (*Providers) TestnetChainList added in v1.33.0

func (p *Providers) TestnetChainList() []ChainInfo

func (*Providers) TestnetStringChainIDs added in v1.33.0

func (p *Providers) TestnetStringChainIDs() []string

Jump to

Keyboard shortcuts

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