Documentation
¶
Index ¶
- Constants
- func ClearCache()
- func EvmChainByEvmChainID(ctx context.Context, evmChainID uint64, opts ...Option) (chain_selectors.Chain, bool, error)
- func EvmChainBySelector(ctx context.Context, sel uint64, opts ...Option) (chain_selectors.Chain, bool, error)
- func EvmChainIdFromName(ctx context.Context, name string, opts ...Option) (uint64, error)
- func EvmChainIdToChainSelector(ctx context.Context, opts ...Option) (map[uint64]uint64, error)
- func GetChainDetailsByChainIDAndFamily(ctx context.Context, chainID string, family string, opts ...Option) (chain_selectors.ChainDetails, error)
- func IsEvm(ctx context.Context, chainSel uint64, opts ...Option) (bool, error)
- type ChainDetailsWithMetadata
- type Config
- type Option
Constants ¶
const ( // DefaultGitHubRawURL is the default URL for the all_selectors.yml file on GitHub main branch DefaultGitHubRawURL = "https://raw.githubusercontent.com/smartcontractkit/chain-selectors/main/all_selectors.yml" // DefaultRemoteFetchTimeout is the default timeout for remote HTTP requests DefaultRemoteFetchTimeout = 10 * time.Second // DefaultCacheTTL is the default time-to-live for cached remote data DefaultCacheTTL = 5 * time.Minute )
Variables ¶
This section is empty.
Functions ¶
func ClearCache ¶
func ClearCache()
ClearCache clears the remote data cache, forcing the next remote call to fetch fresh data
func EvmChainByEvmChainID ¶
func EvmChainByEvmChainID(ctx context.Context, evmChainID uint64, opts ...Option) (chain_selectors.Chain, bool, error)
EvmChainByEvmChainID fetches chain data from GitHub and returns the EVM chain for a given EVM chain ID
func EvmChainBySelector ¶
func EvmChainBySelector(ctx context.Context, sel uint64, opts ...Option) (chain_selectors.Chain, bool, error)
EvmChainBySelector fetches chain data from GitHub and returns the EVM chain for a given selector
func EvmChainIdFromName ¶
EvmChainIdFromName fetches chain data from GitHub and returns the EVM chain ID for a given chain name
func EvmChainIdToChainSelector ¶
EvmChainIdToChainSelector fetches chain data from GitHub and returns a map of EVM chain ID to chain selector
func GetChainDetailsByChainIDAndFamily ¶
func GetChainDetailsByChainIDAndFamily(ctx context.Context, chainID string, family string, opts ...Option) (chain_selectors.ChainDetails, error)
GetChainDetailsByChainIDAndFamily fetches chain data from GitHub and returns chain details for a given chain ID and family
Types ¶
type ChainDetailsWithMetadata ¶
type ChainDetailsWithMetadata struct {
chain_selectors.ChainDetails
Family string
ChainID string
}
ChainDetailsWithMetadata extends ChainDetails with additional metadata
func GetChainDetailsBySelector ¶
func GetChainDetailsBySelector(ctx context.Context, selector uint64, opts ...Option) (ChainDetailsWithMetadata, error)
GetChainDetailsBySelector fetches chain data from GitHub and returns chain details for a given selector
type Config ¶
type Config struct {
// URL is the raw GitHub URL to fetch the all_selectors.yml file
// If empty, DefaultGitHubRawURL will be used
URL string
// Timeout for the HTTP request
// If zero, DefaultRemoteFetchTimeout will be used
Timeout time.Duration
// CacheTTL is the time-to-live for cached remote data
// If zero, no caching will be used (always fetch fresh data)
CacheTTL time.Duration
}
Config holds configuration for remote API calls
type Option ¶
type Option func(*Config)
Option is a functional option for configuring remote API calls
func WithCacheTTL ¶
WithCacheTTL sets the cache time-to-live. Default is 5 minutes. Set to 0 to disable caching (always fetch fresh data).
func WithTimeout ¶
WithTimeout sets the HTTP request timeout. If not provided, DefaultRemoteFetchTimeout will be used.