ethproviders

package
v1.24.12 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: LGPL-3.0, MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainInfo

type ChainInfo struct {
	ID   uint64 `json:"id"` // TODO: switch to *big.Int
	Name string `json:"name"`
}

type Config

type Config map[string]NetworkConfig

func (Config) AuthChain

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

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

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

type NetworkConfig

type NetworkConfig struct {
	ID  uint64 `toml:"id" json:"id"`
	URL string `toml:"url" json:"url"`

	WSEnabled bool   `toml:"ws_enabled" json:"wsEnabled"`
	WSURL     string `toml:"ws_url" json:"wsUrl"`

	AuthChain bool `toml:"auth_chain" json:"authChain"`
	Testnet   bool `toml:"testnet" json:"testnet"`
	Disabled  bool `toml:"disabled" json:"disabled"`
}

type Providers

type Providers struct {
	// contains filtered or unexported fields
}

func NewProviders

func NewProviders(cfg Config, optJwtToken ...string) (*Providers, error)

func (*Providers) ChainList

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

func (*Providers) FindChain

func (p *Providers) FindChain(chainHandle string) (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) ProviderMap

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

Jump to

Keyboard shortcuts

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