Documentation
¶
Overview ¶
Copyright (C) 2024, Ava Labs, Inc. All rights reserved. See the file LICENSE for licensing terms.
Index ¶
- func AddressToNodeID(nodeID common.Address) ids.NodeID
- func Any[T any](input []T, f func(T) bool) bool
- func AppendSlices[T any](slices ...[]T) []T
- func Belongs[T comparable](input []T, elem T) bool
- func BytesToHex(b []byte) string
- func ConvertAvaxToWei(avax float64) *big.Int
- func ConvertNanoAvaxToWei(nanoAvax int64) *big.Int
- func DecodeError(abiStr string, err error) error
- func FetchRPC(url string, method string, params string) (string, error)
- func FetchRPCGJSON(url string, method string, params string) (*gjson.Result, error)
- func Filter[T any](input []T, f func(T) bool) []T
- func Find[T any](input []T, f func(T) bool) *T
- func HexOrCB58ToID(s string) (ids.ID, error)
- func HexToBytes(s string) []byte
- func IsNil(v interface{}) bool
- func Map[T, U any](input []T, f func(T) U) []U
- func MapWithError[T, U any](input []T, f func(T) (U, error)) ([]U, error)
- func ParseNodeID(nodeID string) (ids.NodeID, error)
- func ParsePrivateKey(pkStr string) (avaKey *secp256k1.PrivateKey, ethKey *ecdsa.PrivateKey, err error)
- func ParsePrivateKeyToAddresses(privateKeyStr string, network string) (string, string, error)
- func RandomBLS() (*bls.LocalSigner, *signer.ProofOfPossession, error)
- func RandomID() (ids.ID, error)
- func RandomNodeID() (ids.NodeID, error)
- func RegisterL1ValidatorToJSON(m *message.RegisterL1Validator) ([]byte, error)
- func RemoveFromSlice[T comparable](input []T, toRemove T) []T
- func Unique[T comparable](arr []T) []T
- func ValidateBLSKeys(blsPubKey string, blsPop string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddressToNodeID ¶ added in v0.2.0
Given nodeID in [20]bytes address format, return the [20]byte ids.NodeID format
func AppendSlices ¶ added in v0.2.0
func AppendSlices[T any](slices ...[]T) []T
AppendSlices appends multiple slices into a single slice.
func Belongs ¶ added in v0.2.0
func Belongs[T comparable](input []T, elem T) bool
func BytesToHex ¶ added in v0.2.0
returns the hexadecimal string representation of the bytes b, prefixed with "0x".
func ConvertAvaxToWei ¶ added in v0.2.0
func ConvertNanoAvaxToWei ¶ added in v0.2.0
func DecodeError ¶ added in v0.2.0
DecodeError decodes an error from an ABI string and an error. usage: err = DecodeError(abiStr, err)
func FetchRPCGJSON ¶
func HexOrCB58ToID ¶ added in v0.2.0
Converts a '0x'-prefixed hex string or cb58-encoded string to an ID.
func HexToBytes ¶ added in v0.2.0
returns the bytes represented by the hexadecimal string s, may be prefixed with "0x".
func IsNil ¶ added in v0.2.0
func IsNil(v interface{}) bool
Safe nil checking on an interface, that does not panic
func MapWithError ¶ added in v0.2.0
func ParseNodeID ¶ added in v0.2.0
Given nodeID in either 0x123 or NodeID-123 format, return the [20]byte ids.NodeID format
func ParsePrivateKey ¶ added in v0.2.0
func ParsePrivateKey(pkStr string) (avaKey *secp256k1.PrivateKey, ethKey *ecdsa.PrivateKey, err error)
Support PrivateKey-(cb58) or hex string with optional 0x prefix
func ParsePrivateKeyToAddresses ¶ added in v0.2.0
Parse a private key and return the ava and eth addresses network is the network name (mainnet, fuji, etc)
func RandomBLS ¶ added in v0.2.0
func RandomBLS() (*bls.LocalSigner, *signer.ProofOfPossession, error)
func RandomNodeID ¶ added in v0.2.0
func RegisterL1ValidatorToJSON ¶ added in v0.2.0
func RegisterL1ValidatorToJSON(m *message.RegisterL1Validator) ([]byte, error)
Better JSON output for RegisterL1Validator
func RemoveFromSlice ¶ added in v0.2.0
func RemoveFromSlice[T comparable](input []T, toRemove T) []T
func Unique ¶ added in v0.2.0
func Unique[T comparable](arr []T) []T
func ValidateBLSKeys ¶ added in v0.2.0
Types ¶
This section is empty.