registry

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2023 License: Apache-2.0 Imports: 12 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoChainFoundForChainID = errors.New("no chain found for chain ID")
	ErrNoStakingTokenFound    = errors.New("no staking tokens found in registry")
	ErrNoFeeTokenFound        = errors.New("no fee tokens found in registry")
	ErrNoMatchingAsset        = errors.New("no matching asset found")
	ErrNoMatchingDenom        = errors.New("no matching denom found")
)

Functions

func NewChainRegistryClient added in v1.0.12

func NewChainRegistryClient(log *log.Logger) *chainRegistryClient

NewRegistryClient makes a new default registry client.

Types

type APIAddress

type APIAddress struct {
	Address  string `json:"address"`
	Provider string `json:"provider"`
}

type APIs

type APIs struct {
	RPC  []APIAddress `json:"rpc"`
	Rest []APIAddress `json:"rest"`
	GRPC []APIAddress `json:"grpc"`
}

type Asset added in v1.1.0

type Asset struct {
	Description string       `json:"description"`
	DenomUnits  []DenomUnit  `json:"denom_units"`
	Base        string       `json:"base"`
	Name        string       `json:"name"`
	Display     string       `json:"display"`
	Symbol      string       `json:"symbol"`
	LogoURIs    LogoURIs     `json:"logo_URIs"`
	CoingeckoID string       `json:"coingecko_id"`
	Images      []ImageLinks `json:"images"`
}

func (*Asset) ExtractDenomByUnit added in v1.1.0

func (a *Asset) ExtractDenomByUnit(needleDenomUnit string) (*DenomUnit, error)

type AssetList added in v1.1.0

type AssetList struct {
	Schema    string  `json:"$schema"`
	ChainName string  `json:"chain_name"`
	Assets    []Asset `json:"assets"`
}

func (*AssetList) ExtractAssetByBaseSymbol added in v1.1.0

func (al *AssetList) ExtractAssetByBaseSymbol(baseAssetSymbol string) (*Asset, error)

func (*AssetList) OneToken added in v1.1.0

func (al *AssetList) OneToken(baseAssetSymbol string) (*sdk.Coin, error)

Get a single token, given a base symbol. Ex. 1 JUNO = sdk.Coin{ denom: "ujuno", amount: "1_000_000" }

type Binaries

type Binaries struct {
	LinuxAmd64   string `json:"linux/amd64"`
	LinuxArm64   string `json:"linux/arm64"`
	DarwinAmd64  string `json:"darwin/amd64"`
	DarwinArm64  string `json:"darwin/arm64"`
	WindowsAmd64 string `json:"windows/amd64"`
}

type ChainInfo

type ChainInfo struct {
	ChainName    string     `json:"chain_name"`
	Status       string     `json:"status"`
	NetworkType  string     `json:"network_type"`
	Website      string     `json:"website"`
	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"`
	KeyAlgos     []string   `json:"key_algos"`
	Slip44       int        `json:"slip44"`
	Fees         Fee        `json:"fees"`
	Staking      Staking    `json:"staking"`
	Codebase     Codebase   `json:"codebase"`
	LogoURIs     LogoURIs   `json:"logo_URIs"`
	Peers        Peers      `json:"peers"`
	APIs         APIs       `json:"apis"`
	Explorers    []Explorer `json:"explorers"`
}

func (*ChainInfo) FeeDenom added in v1.0.12

func (ci *ChainInfo) FeeDenom() (string, error)

func (*ChainInfo) FeeToken added in v1.0.12

func (ci *ChainInfo) FeeToken() (*FeeToken, error)

func (*ChainInfo) MinGasFee added in v1.0.12

func (ci *ChainInfo) MinGasFee() (float64, error)

func (*ChainInfo) StakingDenom added in v1.0.12

func (ci *ChainInfo) StakingDenom() (string, error)

type ChainRegistryClient added in v1.0.12

type ChainRegistryClient interface {
	// Cosmos Chain Registry
	AllChainNames(ctx context.Context) ([]string, error)
	ChainNameForChainID(ctx context.Context, targetChainID string, refreshCache bool) (string, error)
	ChainInfo(ctx context.Context, chainName string) (*ChainInfo, error)
	AssetList(ctx context.Context, chainName string) (*AssetList, error)

	// Restake Validator Registry
	Validator(ctx context.Context, targetValidator string) (*Validator, error)
}

func NewRetryableChainRegistryClient added in v1.0.12

func NewRetryableChainRegistryClient(attempts uint, delay time.Duration, chainRegistryClient ChainRegistryClient, logger *log.Logger) (ChainRegistryClient, error)

NewRetryableChainRegistryClient returns a new retryableChainRegistryClient

type Codebase

type Codebase struct {
	GitRepo            string    `json:"git_repo"`
	RecommendedVersion string    `json:"recommended_version"`
	CompatibleVersions []string  `json:"compatible_versions"`
	Binaries           Binaries  `json:"binaries"`
	Genesis            Genesis   `json:"genesis"`
	Versions           []Version `json:"versions"`
}

type Commission added in v1.0.12

type Commission struct {
	Rate float64 `json:"rate"`
}

type Delegations added in v1.0.12

type Delegations struct {
	TotalTokens        string  `json:"total_tokens"`
	TotalCount         int     `json:"total_count"`
	TotalTokensDisplay float64 `json:"total_tokens_display"`
	TotalUSD           float64 `json:"total_usd"`
}

type DenomUnit added in v1.1.0

type DenomUnit struct {
	Denom    string `json:"denom"`
	Exponent int    `json:"exponent"`
}

type Description added in v1.0.12

type Description struct {
	Moniker         string `json:"moniker"`
	Identity        string `json:"identity"`
	Website         string `json:"website"`
	SecurityContact string `json:"security_contact"`
	Details         string `json:"details"`
}

type Explorer

type Explorer struct {
	Kind        string `json:"kind"`
	URL         string `json:"url"`
	TxPage      string `json:"tx_page"`
	AccountPage string `json:"account_page,omitempty"`
}

type Fee

type Fee struct {
	FeeTokens []FeeToken `json:"fee_tokens"`
}

type FeeToken

type FeeToken struct {
	Denom string `json:"denom"`

	FixedMinGasPrice float64 `json:"fixed_min_gas_price"`
	LowGasPrice      float64 `json:"low_gas_price"`
	AverageGasPrice  float64 `json:"average_gas_price"`
	HighGasPrice     float64 `json:"high_gas_price"`
}

type Genesis

type Genesis struct {
	GenesisURL string `json:"genesis_url"`
}
type ImageLinks struct {
	Png string `json:"png"`
	Svg string `json:"svg"`
}

type LogoURIs

type LogoURIs struct {
	PNG string `json:"png"`
	SVG string `json:"svg"`
}

type MissedBlocksPeriods added in v1.0.12

type MissedBlocksPeriods struct {
	Blocks int `json:"blocks"`
	Missed int `json:"missed"`
}

type Peer

type Peer struct {
	ID       string `json:"id"`
	Address  string `json:"address"`
	Provider string `json:"provider,omitempty"`
}

type Peers

type Peers struct {
	Seeds           []Seed `json:"seeds"`
	PersistentPeers []Peer `json:"persistent_peers"`
}

type Response added in v1.0.12

type Response struct {
	Validators []Validator `json:"validators"`
}

type Restake added in v1.0.12

type Restake struct {
	Address       string      `json:"address"`
	MinimumReward json.Number `json:"minimum_reward"`
}

type RestakeInfo added in v1.0.12

type RestakeInfo struct {
	Name        string      `json:"name"`
	Restake     Restake     `json:"restake"`
	Moniker     string      `json:"moniker"`
	Identity    string      `json:"identity"`
	Address     string      `json:"address"`
	Active      bool        `json:"active"`
	Jailed      bool        `json:"jailed"`
	Status      string      `json:"status"`
	Delegations Delegations `json:"delegations"`
	Description Description `json:"description"`
	Commission  Commission  `json:"commission"`
	Rank        int         `json:"rank"`
	Slashes     []Slashes   `json:"slashes"`
	Image       string      `json:"image"`
}

type Seed

type Seed struct {
	ID       string `json:"id"`
	Address  string `json:"address"`
	Provider string `json:"provider,omitempty"`
}

type Slashes added in v1.0.12

type Slashes struct {
	ValidatorPeriod string `json:"validator_period"`
	Fraction        string `json:"fraction"`
}

type Staking

type Staking struct {
	StakingTokens []Token `json:"staking_tokens"`
}

type Token

type Token struct {
	Denom string `json:"denom"`
}

type Validator added in v1.0.12

type Validator struct {
	Path       string        `json:"path"`
	Name       string        `json:"name"`
	Identity   string        `json:"identity"`
	TotalUSD   float64       `json:"total_usd"`
	TotalUsers int           `json:"total_users"`
	Chains     []RestakeInfo `json:"chains"`
}

type Version

type Version struct {
	Name               string   `json:"name"`
	RecommendedVersion string   `json:"recommended_version"`
	CompatibleVersions []string `json:"compatible_versions"`
	Binaries           Binaries `json:"binaries"`
}

Jump to

Keyboard shortcuts

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