Documentation
¶
Overview ¶
Copyright (C) 2025, Lux Industries Inc. All rights reserved. See the file LICENSE for licensing terms.
Copyright (C) 2025, Lux Industries Inc. All rights reserved. See the file LICENSE for licensing terms.
Copyright (C) 2023, Lux Industries Inc. All rights reserved. See the file LICENSE for licensing terms.
Copyright (C) 2025, Lux Industries Inc. All rights reserved. See the file LICENSE for licensing terms.
Copyright (C) 2022, Lux Industries Inc. All rights reserved. See the file LICENSE for licensing terms.
Copyright (C) 2020-2025, Lux Industries Inc. All rights reserved. See the file LICENSE for licensing terms.
Copyright (C) 2025, Lux Industries, Inc. All rights reserved. See the file LICENSE for licensing terms.
Copyright (C) 2025, Lux Industries Inc. All rights reserved. See the file LICENSE for licensing terms.
Copyright (C) 2022, Lux Industries Inc. All rights reserved. See the file LICENSE for licensing terms.
Copyright (C) 2025, Lux Industries, Inc. All rights reserved. See the file LICENSE for licensing terms.
Copyright (C) 2025, Lux Industries, Inc. All rights reserved. See the file LICENSE for licensing terms.
Copyright (C) 2025, Lux Industries, Inc. All rights reserved. See the file LICENSE for licensing terms.
Copyright (C) 2025, Lux Industries Inc. All rights reserved. See the file LICENSE for licensing terms.
Index ¶
- func AddSingleQuotes(s []string) []string
- func AppendSlices[T any](slices ...[]T) []T
- func Belongs[T comparable](input []T, elem T) bool
- func ByteSliceIsSubnetEvmGenesis(bytes []byte) bool
- func CleanupString(s string) string
- func CleanupStrings(s []string) []string
- func CombineSCPPath(host, path string) string
- func DirExists(dirName string) bool
- func ExpandHome(path string) string
- func FileExists(filename string) bool
- func FindErrorLogs(rootDirs ...string)
- func FormatAmount(amount *big.Int, decimals uint8) string
- func GetAPIContext() (context.Context, context.CancelFunc)
- func GetAPILargeContext() (context.Context, context.CancelFunc)
- func GetBlockchainIDFromAlias(endpoint string, alias string) (ids.ID, error)
- func GetBlockchainTx(endpoint string, blockchainID ids.ID) (interface{}, error)
- func GetCLIVersion() string
- func GetChainID(genesisData []byte) (*big.Int, error)
- func GetDefaultBlockchainAirdropKeyName(blockchainName string) string
- func GetIPPort(uri string) (netip.AddrPort, error)
- func GetJSONKey[T any](m map[string]interface{}, key string) (T, error)
- func GetKeyNames(keyDir string, includeEwoq bool) ([]string, error)
- func GetL1ValidatorUptimeSeconds(rpcURL string, nodeID ids.NodeID) (uint64, error)
- func GetNetworkBalance(address ids.ShortID, network models.Network) (uint64, error)
- func GetNodeParams(nodeDir string) (ids.NodeID, []byte, []byte, error)
- func GetRemainingValidationTime(networkEndpoint string, nodeID ids.NodeID, subnetID ids.ID, ...) (time.Duration, error)
- func GetSCPCommandString(certFilePath string, sourceIP, sourcePath string, destIP, destPath string, ...) (string, error)
- func GetSCPTargetPath(ip, path string) string
- func GetSHA256FromDisk(binPath string) (string, error)
- func GetSSHConnectionString(publicIP, certFilePath string) string
- func GetTimedContext(timeout time.Duration) (context.Context, context.CancelFunc)
- func GetUserIPAddress() (string, error)
- func HandleTracking(cmd *cobra.Command, app interface{}, flags map[string]string)
- func HandleUserMetricsPreference(app interface{}) error
- func IsSSHAgentAvailable() bool
- func IsSSHAgentIdentityValid(identity string) (bool, error)
- func IsSSHPubKey(pubkey string) bool
- func IsValidIP(ipStr string) bool
- func IsValidIPPort(ipPortPair string) bool
- func IsValidURL(urlString string) bool
- func ListSSHAgentIdentities() ([]string, error)
- func Map[T, U any](input []T, f func(T) U) []U
- func NetworkIDFromGenesis(genesis []byte) (uint32, error)
- func NewBlsSecretKeyBytes() ([]byte, error)
- func PointersSlice[T any](values []T) []*T
- func PrintMetricsOptOutPrompt()
- func ReadJSON(path string, v interface{}) error
- func ReadSSHAgentIdentityPublicKey(identityName string) (string, error)
- func Retry[T any](fn func() (T, error), maxAttempts int, retryInterval time.Duration) (T, error)
- func RetryWithContextGen[T any](ctxGen func() (context.Context, context.CancelFunc), ...) (T, error)
- func SearchSHA256File(file []byte, toSearch string) (string, error)
- func SplitComaSeparatedInt(s string) []int
- func SplitComaSeparatedString(s string) []string
- func SplitLuxgoRPCURI(requestURI string) (string, string, error)
- func SplitSCPPath(path string) (string, string)
- func SplitStringWithQuotes(str string, r rune) []string
- func ToBLSPoP(keyBytes []byte) ([]byte, []byte, error)
- func ToNodeID(certBytes []byte) (ids.NodeID, error)
- func TrackMetrics(command *cobra.Command, flags map[string]string)
- func TrimHexa(s string) string
- func Uint32Sort(arr []uint32)
- func Unique[T comparable](arr []T) []T
- func ValidateJSON(path string) ([]byte, error)
- func WrapContext[T any](f func() (T, error)) func(context.Context) (T, error)
- func WriteJSON(path string, v interface{}) error
- type Account
- type SubnetEvmGenesis
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddSingleQuotes ¶
AddSingleQuotes adds single quotes to each string in the given slice.
func AppendSlices ¶
func AppendSlices[T any](slices ...[]T) []T
AppendSlices appends multiple slices into a single slice.
func Belongs ¶
func Belongs[T comparable](input []T, elem T) bool
func ByteSliceIsSubnetEvmGenesis ¶
ByteSliceIsSubnetEvmGenesis checks if a byte slice is a SubnetEVM genesis
func CleanupString ¶
Cleans up a string by trimming \r and \n characters.
func CleanupStrings ¶
CleanupStrings cleans up a slice of strings by trimming \r and \n characters.
func CombineSCPPath ¶
CombineSCPPath combines the given host and path into a single item for scp.
func FindErrorLogs ¶
func FindErrorLogs(rootDirs ...string)
FindErrorLogs is a utility function, we will NOT do error handling, as this is supposed to be called during error handling itself we don't want to make it even more complex
func FormatAmount ¶
Formats an amount of base units as a string representing the amount in the given denomination. (i.e. An amount of 54321 with a decimals value of 3 results in the stirng "54.321")
func GetAPIContext ¶
func GetAPIContext() (context.Context, context.CancelFunc)
Context for API requests
func GetAPILargeContext ¶
func GetAPILargeContext() (context.Context, context.CancelFunc)
Context for API requests with large timeout
func GetBlockchainIDFromAlias ¶
GetBlockchainIDFromAlias gets a blockchain ID from its alias on the network
func GetBlockchainTx ¶
GetBlockchainTx retrieves a blockchain transaction from the network
func GetCLIVersion ¶
func GetCLIVersion() string
func GetChainID ¶
GetChainID extracts the chain ID from genesis data
func GetDefaultBlockchainAirdropKeyName ¶
GetDefaultBlockchainAirdropKeyName returns the default key name for blockchain airdrops
func GetJSONKey ¶
GetJSONKey retrieves a value from a map by key and returns it as the specified type
func GetKeyNames ¶
GetKeyNames returns a list of key names
func GetL1ValidatorUptimeSeconds ¶
GetL1ValidatorUptimeSeconds returns the uptime of the L1 validator
func GetNetworkBalance ¶
GetNetworkBalance returns the balance of an address on the P-chain
func GetNodeParams ¶
GetNodeParams returns node id, bls public key and bls proof of possession
func GetSCPCommandString ¶
func GetSCPCommandString(certFilePath string, sourceIP, sourcePath string, destIP, destPath string, recursive, withCompression bool) (string, error)
GetSCPCommandString returns the SCP command string for the given source and destination paths.
func GetSCPTargetPath ¶
GetSCPTargetPath returns the target path for the given source path and target directory.
func GetSHA256FromDisk ¶
func GetSSHConnectionString ¶
GetSSHConnectionString returns the SSH connection string for the given public IP and certificate file path.
func GetTimedContext ¶
Timed Context
func GetUserIPAddress ¶
GetUserIPAddress retrieves the IP address of the user.
func HandleTracking ¶
func HandleUserMetricsPreference ¶
func HandleUserMetricsPreference(app interface{}) error
func IsSSHAgentAvailable ¶
func IsSSHAgentAvailable() bool
IsSSHAgentAvailable checks if the SSH agent is available.
func IsSSHAgentIdentityValid ¶
func IsSSHPubKey ¶
IsSSHPubKey checks if the given string is a valid SSH public key.
func IsValidIPPort ¶
IsValidIPPort checks if an string IP:port pair is valid.
func ListSSHAgentIdentities ¶
ListSSHAgentIdentities returns a list of SSH identities from ssh-agent.
func NetworkIDFromGenesis ¶
NetworkIDFromGenesis returns the network ID in the given genesis
func NewBlsSecretKeyBytes ¶
func PointersSlice ¶
func PointersSlice[T any](values []T) []*T
PointersSlice converts a slice of values to a slice of pointers
func PrintMetricsOptOutPrompt ¶
func PrintMetricsOptOutPrompt()
func Retry ¶
Retry retries the given function until it succeeds or the maximum number of attempts is reached.
func RetryWithContextGen ¶
func RetryWithContextGen[T any]( ctxGen func() (context.Context, context.CancelFunc), fn func(context.Context) (T, error), maxAttempts int, retryInterval time.Duration, ) (T, error)
RetryWithContext retries the given function until it succeeds or the maximum number of attempts is reached. For each retry, it generates a fresh context to be used on the call
func SplitComaSeparatedInt ¶
SplitComaSeparatedInt splits a comma-separated string into a slice of integers.
func SplitComaSeparatedString ¶
SplitComaSeparatedString splits and trims a comma-separated string into a slice of strings.
func SplitLuxgoRPCURI ¶
SplitRPCURI splits the RPC URI into `endpoint` and `chain`. Reverse operation of `fmt.Sprintf("%s/ext/bc/%s", endpoint, chain)`. returns the `uri` and `chain` as strings, or an error if the request URI is invalid.
func SplitSCPPath ¶
SplitSCPPath splits the given path into host and path.
func SplitStringWithQuotes ¶
SplitStringWithQuotes split string with a rune comma ignore quoted
func Uint32Sort ¶
func Uint32Sort(arr []uint32)
func Unique ¶
func Unique[T comparable](arr []T) []T
Unique returns a new slice containing only the unique elements from the input slice.
func ValidateJSON ¶
ValidateJSON takes a json string and returns it's byte representation if it contains valid JSON
func WrapContext ¶
WrapContext adds a context based timeout to a given function
Types ¶
type Account ¶
type Account struct {
Balance *big.Int `json:"balance"`
Code []byte `json:"code,omitempty"`
Storage map[string]string `json:"storage,omitempty"`
Nonce uint64 `json:"nonce,omitempty"`
}
Account represents an account in the genesis allocation
type SubnetEvmGenesis ¶
type SubnetEvmGenesis struct {
Config map[string]interface{} `json:"config"`
Alloc map[string]Account `json:"alloc"`
Timestamp uint64 `json:"timestamp,omitempty"`
GasLimit uint64 `json:"gasLimit"`
Difficulty string `json:"difficulty,omitempty"`
MixHash string `json:"mixHash,omitempty"`
Coinbase string `json:"coinbase,omitempty"`
Number string `json:"number,omitempty"`
GasUsed string `json:"gasUsed,omitempty"`
ParentHash string `json:"parentHash,omitempty"`
}
SubnetEvmGenesis represents a subnet EVM genesis configuration
func ByteSliceToSubnetEvmGenesis ¶
func ByteSliceToSubnetEvmGenesis(bytes []byte) (*SubnetEvmGenesis, error)
ByteSliceToSubnetEvmGenesis converts a byte slice to a SubnetEVM genesis