Documentation
¶
Index ¶
- func AddCustomRPC(cfg *config.Config, chainID int, chainName, endpoint string, readOnly bool) error
- func AddPublicRPCs(cfg *config.Config, chainID int, chainName string, endpoints []RPCEndpoint, ...) error
- func DefaultChainListFetcher() ([]byte, error)
- func Delete(cfg *config.Config, u *ui.UI, deploymentIdentifier string) error
- func DeregisterERPCUpstream(cfg *config.Config, networkType, id string) error
- func GetERPCStatus(cfg *config.Config) (podStatus string, upstreamCounts map[int]int, err error)
- func Install(cfg *config.Config, u *ui.UI, network string, overrides map[string]string, ...) error
- func List(cfg *config.Config, u *ui.UI) error
- func ListInstanceIDs(cfg *config.Config) ([]string, error)
- func RegisterERPCUpstream(cfg *config.Config, networkType, id string) error
- func RemovePublicRPCs(cfg *config.Config, chainID int) error
- func ResolveChainID(nameOrID string) (int, string, error)
- func ResolveInstance(cfg *config.Config, args []string) (identifier string, remaining []string, err error)
- func SortByQuality(endpoints []RPCEndpoint)
- func Sync(cfg *config.Config, u *ui.UI, deploymentIdentifier string) error
- func SyncAll(cfg *config.Config, u *ui.UI) error
- type ChainEntry
- type ChainListFetcher
- type RPCEndpoint
- type RPCNetworkInfo
- type RPCUpstreamInfo
- type TemplateField
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddCustomRPC ¶ added in v0.8.1
AddCustomRPC adds a single custom RPC endpoint for a chain to the eRPC ConfigMap. Uses the "custom-" prefix to distinguish from ChainList-sourced upstreams. When readOnly is true, eth_sendRawTransaction and eth_sendTransaction are blocked.
func AddPublicRPCs ¶ added in v0.8.1
func AddPublicRPCs(cfg *config.Config, chainID int, chainName string, endpoints []RPCEndpoint, readOnly bool) error
AddPublicRPCs adds ChainList RPCs for a chain to the eRPC ConfigMap. When readOnly is true, eth_sendRawTransaction and eth_sendTransaction are blocked.
func DefaultChainListFetcher ¶ added in v0.8.1
DefaultChainListFetcher fetches from the real ChainList API.
func DeregisterERPCUpstream ¶
DeregisterERPCUpstream removes a previously registered local upstream from the eRPC ConfigMap.
func GetERPCStatus ¶ added in v0.8.1
GetERPCStatus returns eRPC pod status and upstream counts.
func Install ¶
func Install(cfg *config.Config, u *ui.UI, network string, overrides map[string]string, force bool) error
Install creates a network configuration by executing Go templates and saving to config directory
func ListInstanceIDs ¶ added in v0.8.1
ListInstanceIDs returns all installed network deployment identifiers (as "network/id" strings) by walking the networks directory on disk.
func RegisterERPCUpstream ¶
RegisterERPCUpstream reads the deployed network's RPC endpoint and adds it as an upstream in the eRPC ConfigMap. The local node becomes the primary upstream (group: "primary") with automatic fallback to existing remote upstreams.
func RemovePublicRPCs ¶ added in v0.8.1
RemovePublicRPCs removes all ChainList RPCs for a chain from the eRPC ConfigMap.
func ResolveChainID ¶ added in v0.8.1
ResolveChainID converts a chain name or numeric string to a chain ID. Returns the chain ID and the resolved name (for display).
func ResolveInstance ¶ added in v0.8.1
func ResolveInstance(cfg *config.Config, args []string) (identifier string, remaining []string, err error)
ResolveInstance determines which network deployment to target based on how many deployments are installed:
- 0 deployments: returns an error prompting the user to install one
- 1 deployment: auto-selects it, returns args unchanged
- 2+ deployments: expects args[0] to be a known "network/id" identifier; consumes it from args and returns the rest. Errors if no match.
func SortByQuality ¶ added in v0.8.1
func SortByQuality(endpoints []RPCEndpoint)
SortByQuality sorts RPC endpoints by tracking quality. Preference: tracking=none > tracking=limited > tracking=unknown > anything else.
Types ¶
type ChainEntry ¶ added in v0.8.1
type ChainEntry struct {
Name string `json:"name"`
Chain string `json:"chain"`
ChainID int `json:"chainId"`
RPC []any `json:"rpc"` // mix of strings and objects
}
ChainEntry represents a single chain entry from the ChainList API.
type ChainListFetcher ¶ added in v0.8.1
ChainListFetcher abstracts the HTTP fetch so tests can inject fixtures.
type RPCEndpoint ¶ added in v0.8.1
type RPCEndpoint struct {
URL string `json:"url"`
Tracking string `json:"tracking"` // "none", "limited", or "yes"
}
RPCEndpoint represents a single RPC endpoint from ChainList.
func FetchChainListRPCs ¶ added in v0.8.1
func FetchChainListRPCs(chainID int, fetcher ChainListFetcher) ([]RPCEndpoint, string, error)
FetchChainListRPCs fetches RPCs for a given chain ID from ChainList, filters for free/public HTTPS endpoints, and returns up to maxRPCs sorted by quality (tracking=none preferred over tracking=limited).
func FilterFreeRPCs ¶ added in v0.8.1
func FilterFreeRPCs(endpoints []RPCEndpoint) []RPCEndpoint
FilterFreeRPCs filters RPC endpoints to only include free, HTTPS, non-tracking endpoints.
func ParseAndFilterRPCs ¶ added in v0.8.1
func ParseAndFilterRPCs(data []byte, chainID, maxRPCs int) ([]RPCEndpoint, string, error)
ParseAndFilterRPCs parses ChainList JSON, finds the chain, filters and sorts RPCs. Exported for testing.
type RPCNetworkInfo ¶ added in v0.8.1
type RPCNetworkInfo struct {
ChainID int
Alias string
Upstreams []RPCUpstreamInfo
}
RPCNetworkInfo represents a network (chain) configured in eRPC.
func ListRPCNetworks ¶ added in v0.8.1
func ListRPCNetworks(cfg *config.Config) ([]RPCNetworkInfo, error)
ListRPCNetworks reads the eRPC ConfigMap and returns configured networks with their upstreams.
type RPCUpstreamInfo ¶ added in v0.8.1
RPCUpstreamInfo represents an upstream in the eRPC config for display.
type TemplateField ¶
type TemplateField struct {
Name string
DefaultValue string
FlagName string // CLI flag name derived from field name
Description string // Human-readable description from @description
EnumValues []string // Valid enum values from @enum
Required bool // Whether this field is required (no default value)
}
TemplateField represents a template field with its configuration
func ParseTemplateFields ¶
func ParseTemplateFields(networkName string) ([]TemplateField, error)
ParseTemplateFields extracts template fields from an embedded network values file Uses Go template parsing to identify field references and their annotations