Documentation
¶
Index ¶
- func AddressToNodeID(address common.Address) int64
- func DeriveAddress(pk ecdsa.PublicKey) common.Address
- func DeriveAddressFromECDSAPrivateKey(pk *ecdsa.PrivateKey) (common.Address, error)
- func DeriveAddressFromECDSAPrivateKeyString(key string) (common.Address, error)
- func EncodeString(str string) ([]byte, error)
- func Filter[A any](coll []A, criteria func(i A) bool) []A
- func Find[A any](coll []*A, criteria func(i *A) bool) *A
- func Flatten[A any](coll [][]A) []A
- func Map[A any, B any](coll []A, mapper func(i A, index uint64) B) []B
- func Reduce[A any, B any](coll []A, processor func(accum B, next A) B, initialState B) B
- func StringToECDSAPrivateKey(pk string) (*ecdsa.PrivateKey, error)
- func ValidateAppID(appID string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddressToNodeID ¶
AddressToNodeID converts an Ethereum address into a deterministic node ID. The node ID is derived from the keccak256 hash of the address, matching the on-chain encoding. If n = 1,000,000 (# of operators): probability of collision ≈ 5.4 × 10^-8 (≈ 1 in 1.9 × 10^7)
func DeriveAddressFromECDSAPrivateKey ¶
func DeriveAddressFromECDSAPrivateKey(pk *ecdsa.PrivateKey) (common.Address, error)
func EncodeString ¶
func Filter ¶
Filter creates a new slice containing only the elements from the input slice that satisfy the provided criteria function.
Type Parameters:
- A: The type of elements in the slice
Parameters:
- coll: The input slice to filter
- criteria: Function that determines whether an element should be included
Returns:
- []A: A new slice containing only the elements that satisfy the criteria
func Find ¶
Find returns the first element in a slice that satisfies the provided criteria function. If no element satisfies the criteria, nil is returned.
Type Parameters:
- A: The type of elements in the slice
Parameters:
- coll: The input slice to search
- criteria: Function that determines whether an element matches
Returns:
- *A: Pointer to the first matching element, or nil if no match is found
func Flatten ¶
func Flatten[A any](coll [][]A) []A
Flatten combines multiple slices into a single slice.
Type Parameters:
- A: The type of elements in the slices
Parameters:
- coll: A slice of slices to flatten
Returns:
- []A: A new slice containing all elements from all input slices
func Map ¶
Map applies a transformation function to each element of a slice and returns a new slice with the transformed values. This is a generic implementation of the map higher-order function.
Type Parameters:
- A: The type of elements in the input slice
- B: The type of elements in the output slice
Parameters:
- coll: The input slice to transform
- mapper: Function that transforms each element and receives the element's index
Returns:
- []B: A new slice containing the transformed elements
func Reduce ¶
Reduce applies a function against an accumulator and each element in the slice to reduce it to a single value.
Type Parameters:
- A: The type of elements in the input slice
- B: The type of the accumulated result
Parameters:
- coll: The input slice to reduce
- processor: Function that combines the accumulator with each element
- initialState: The initial value of the accumulator
Returns:
- B: The final accumulated value
func StringToECDSAPrivateKey ¶
func StringToECDSAPrivateKey(pk string) (*ecdsa.PrivateKey, error)
func ValidateAppID ¶
ValidateAppID validates that an application ID meets minimum requirements AppID must be at least 5 characters long
Types ¶
This section is empty.