chain_registry

package
v0.0.0-...-8cda47c Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsHealthyRPC

func IsHealthyRPC(ctx context.Context, endpoint string) error

Types

type AssetList

type AssetList struct {
	Schema  string `json:"$schema"`
	ChainID string `json:"chain_id"`
	Assets  []struct {
		Description string `json:"description"`
		DenomUnits  []struct {
			Denom    string `json:"denom"`
			Exponent int    `json:"exponent"`
		} `json:"denom_units"`
		Base     string `json:"base"`
		Name     string `json:"name"`
		Display  string `json:"display"`
		Symbol   string `json:"symbol"`
		LogoURIs struct {
			Png string `json:"png"`
			Svg string `json:"svg"`
		} `json:"logo_URIs"`
		CoingeckoID string `json:"coingecko_id"`
	} `json:"assets"`
}

type ChainInfo

type ChainInfo struct {
	Schema       string `json:"$schema"`
	ChainName    string `json:"chain_name"`
	Status       string `json:"status"`
	NetworkType  string `json:"network_type"`
	PrettyName   string `json:"pretty_name"`
	ChainID      string `json:"chain_id"`
	Bech32Prefix string `json:"bech32_prefix"`
	DaemonName   string `json:"daemon_name"`
	NodeHome     string `json:"node_home"`
	Genesis      struct {
		GenesisURL string `json:"genesis_url"`
	} `json:"genesis"`
	Slip44   int `json:"slip44"`
	Codebase struct {
		GitRepo            string   `json:"git_repo"`
		RecommendedVersion string   `json:"recommended_version"`
		CompatibleVersions []string `json:"compatible_versions"`
	} `json:"codebase"`
	Peers struct {
		Seeds []struct {
			ID       string `json:"id"`
			Address  string `json:"address"`
			Provider string `json:"provider,omitempty"`
		} `json:"seeds"`
		PersistentPeers []struct {
			ID      string `json:"id"`
			Address string `json:"address"`
		} `json:"persistent_peers"`
	} `json:"peers"`
	Apis struct {
		RPC []struct {
			Address  string `json:"address"`
			Provider string `json:"provider"`
		} `json:"rpc"`
		Rest []struct {
			Address  string `json:"address"`
			Provider string `json:"provider"`
		} `json:"rest"`
	} `json:"apis"`
	// contains filtered or unexported fields
}

func NewChainInfo

func NewChainInfo(log *zap.Logger) ChainInfo

NewChainInfo returns a ChainInfo that is uninitialized other than the provided zap.Logger. Typically, the caller will unmarshal JSON content into the ChainInfo after initialization.

func (ChainInfo) GetAllRPCEndpoints

func (c ChainInfo) GetAllRPCEndpoints() (out []string, err error)

func (ChainInfo) GetAssetList

func (c ChainInfo) GetAssetList() (AssetList, error)

func (ChainInfo) GetPreferredRPCEndpoint

func (c ChainInfo) GetPreferredRPCEndpoint(ctx context.Context, preferredEndpoints []string) (string, error)

func (ChainInfo) GetRPCEndpointWithDomain

func (c ChainInfo) GetRPCEndpointWithDomain(ctx context.Context, preferredDomains []string) (out string, err error)

func (ChainInfo) GetRPCEndpoints

func (c ChainInfo) GetRPCEndpoints(ctx context.Context) (out []string, err error)

func (ChainInfo) GetRandomRPCEndpoint

func (c ChainInfo) GetRandomRPCEndpoint(ctx context.Context) (string, error)

type ChainRegistry

type ChainRegistry interface {
	GetChain(name string) (ChainInfo, error)
	ListChains(ctx context.Context) ([]string, error)
	SourceLink() string
}

func DefaultChainRegistry

func DefaultChainRegistry(log *zap.Logger) ChainRegistry

type CosmosGithubRegistry

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

func NewCosmosGithubRegistry

func NewCosmosGithubRegistry(log *zap.Logger) CosmosGithubRegistry

func (CosmosGithubRegistry) GetChain

func (c CosmosGithubRegistry) GetChain(name string) (ChainInfo, error)

func (CosmosGithubRegistry) ListChains

func (c CosmosGithubRegistry) ListChains(ctx context.Context) ([]string, error)
func (c CosmosGithubRegistry) SourceLink() string

type IbcConfig

type IbcConfig struct {
	Schema string         `json:"$schema"`
	Chain1 IbcConfigChain `json:"chain_1"`
	Chain2 IbcConfigChain `json:"chain_2"`

	Channels []IbcConfigChannelOuter `json:"channels"`
}

Defines IBC connection details between Cosmos chains. From e.g. https://raw.githubusercontent.com/cosmos/chain-registry/master/_IBC/cosmoshub-osmosis.json

type IbcConfigChain

type IbcConfigChain struct {
	ChainName    string `json:"chain_name"`
	ClientId     string `json:"client_id"`
	ConnectionId string `json:"connection_id"`
}

type IbcConfigChannel

type IbcConfigChannel struct {
	ChannelId string `json:"channel_id"`
	PortId    string `json:"port_id"`
}

type IbcConfigChannelOuter

type IbcConfigChannelOuter struct {
	Chain1   IbcConfigChannel `json:"chain_1"`
	Chain2   IbcConfigChannel `json:"chain_2"`
	Ordering string           `json:"ordering"`
	Version  string           `json:"version"`

	Tags struct {
		Status    string `json:"status,omitempty"`
		Preferred bool   `json:"preferred,omitempty"`
		Dex       string `json:"dex,omitempty"`
	} `json:"tags,omitempty"`
}

Jump to

Keyboard shortcuts

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