Documentation
¶
Index ¶
- func IsHealthyRPC(ctx context.Context, endpoint string) error
- type AssetList
- type ChainInfo
- func (c ChainInfo) GetAllRPCEndpoints() (out []string, err error)
- func (c ChainInfo) GetAssetList(ctx context.Context, testnet bool, name string) (AssetList, error)
- func (c ChainInfo) GetBackupRPCEndpoints(ctx context.Context, forceAdd bool, primaryRPC string, count uint64) ([]string, error)
- func (c ChainInfo) GetChainConfig(ctx context.Context, forceAdd, testnet bool, name string) (*cosmos.CosmosProviderConfig, error)
- func (c ChainInfo) GetRPCEndpoints(ctx context.Context) (out []string, err error)
- func (c ChainInfo) GetRandomRPCEndpoint(ctx context.Context, forceAdd bool) (string, error)
- type ChainRegistry
- type CosmosGithubRegistry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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"`
}
AssetList describes the various chain asset metadata found in the cosmos chain registry.
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"`
SigningAlgorithm string `json:"signing-algorithm"`
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"`
MaxGasAmount uint64 `json:"max_gas_amount"`
ExtraCodecs []string `json:"extra_codecs"`
ExtensionOptions []provider.ExtensionOption `json:"extension_options"`
Fees struct {
FeeTokens []struct {
Denom string `json:"denom"`
LowGasPrice float64 `json:"low_gas_price"`
} `json:"fee_tokens"`
} `json:"fees"`
// contains filtered or unexported fields
}
ChainInfo describes the canonical chain metadata found in the cosmos chain registry.
func NewChainInfo ¶
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 ¶
GetAllRPCEndpoints returns a slice of strings representing the available RPC endpoints found in the cosmos chain registry for this particular chain.
func (ChainInfo) GetAssetList ¶
GetAssetList returns the asset metadata from the cosmos chain registry for this particular chain.
func (ChainInfo) GetBackupRPCEndpoints ¶
func (c ChainInfo) GetBackupRPCEndpoints(ctx context.Context, forceAdd bool, primaryRPC string, count uint64) ([]string, error)
GetBackupRPCEndpoints returns a slice of strings to be used as fallback, backup RPC endpoints. forceAdd will force the use of all available RPC endpoints, regardless of health.
func (ChainInfo) GetChainConfig ¶
func (c ChainInfo) GetChainConfig(ctx context.Context, forceAdd, testnet bool, name string) (*cosmos.CosmosProviderConfig, error)
GetChainConfig returns a CosmosProviderConfig composed from the details found in the cosmos chain registry for this particular chain.
func (ChainInfo) GetRPCEndpoints ¶
GetRPCEndpoints returns a slice of strings representing the healthy available RPC endpoints found in the cosmos chain registry for this particular chain.
type ChainRegistry ¶
type ChainRegistry interface {
GetChain(ctx context.Context, testnet bool, name string) (ChainInfo, error)
ListChains(ctx context.Context) ([]string, error)
SourceLink() string
}
ChainRegistry is a slim interface that can be implemented to interact with a repository of chain info/metadata.
func DefaultChainRegistry ¶
func DefaultChainRegistry(log *zap.Logger) ChainRegistry
DefaultChainRegistry initializes a new instance of CosmosGithubRegistry for interacting with the Cosmos chain registry.
type CosmosGithubRegistry ¶
type CosmosGithubRegistry struct {
// contains filtered or unexported fields
}
CosmosGithubRegistry provides an API for interacting with the Cosmos chain registry. See: https://github.com/cosmos/chain-registry
func NewCosmosGithubRegistry ¶
func NewCosmosGithubRegistry(log *zap.Logger) CosmosGithubRegistry
NewCosmosGithubRegistry initializes a new instance of CosmosGithubRegistry.
func (CosmosGithubRegistry) GetChain ¶
func (c CosmosGithubRegistry) GetChain(ctx context.Context, testnet bool, name string) (ChainInfo, error)
GetChain attempts to fetch ChainInfo for the specified chain name from the cosmos chain registry.
func (CosmosGithubRegistry) ListChains ¶
func (c CosmosGithubRegistry) ListChains(ctx context.Context) ([]string, error)
ListChains attempts to connect to GitHub and get the tree object for the cosmos chain registry. It then builds a slice of chain names using the entries in the tree.
func (CosmosGithubRegistry) SourceLink ¶
func (c CosmosGithubRegistry) SourceLink() string
SourceLink returns the string representation of the cosmos chain registry URL.