Documentation
¶
Index ¶
- func Abs[T constraints.Integer](x T) T
- func AbsDiff[T constraints.Integer](x T, y T) T
- func AttachLabelToAddress(address common.Address, label string) string
- func CheckContextDone(ctx context.Context) bool
- func ConstrainIntegerToBitLength(b *big.Int, signed bool, bitLength int) *big.Int
- func ConstrainIntegerToBounds(b *big.Int, min *big.Int, max *big.Int) *big.Int
- func CopyChainConfig(config *params.ChainConfig) (*params.ChainConfig, error)
- func CopyDirectory(sourcePath string, targetPath string, recursively bool) error
- func CopyFile(sourcePath string, targetPath string) error
- func CreateFile(path string, fileName string) (*os.File, error)
- func DeleteDirectory(directoryPath string) error
- func GetFileNameWithoutExtension(filePath string) string
- func GetFilePathWithoutExtension(filePath string) string
- func GetIntegerConstraints(signed bool, bitLength int) (*big.Int, *big.Int)
- func GetPrivateKey(b []byte) (*ecdsa.PrivateKey, error)
- func HexStringToAddress(addressHexString string) (common.Address, error)
- func HexStringsToAddresses(addressHexStrings []string) ([]common.Address, error)
- func IsLinuxEnvironment() bool
- func IsMacOSEnvironment() bool
- func IsWindowsEnvironment() bool
- func MakeDirectory(dirToMake string) error
- func Max[T constraints.Ordered](x T, y T) T
- func MessageToTransaction(msg *core.Message) *types.Transaction
- func Min[T constraints.Ordered](x T, y T) T
- func MoveFile(sourcePath string, targetPath string) error
- func PermutationsWithRepetition[T any](choices []T, n int) [][]T
- func RunCommandWithOutputAndError(command *exec.Cmd) ([]byte, []byte, []byte, error)
- func SlicePointersToValues[T any](x []*T) []T
- func SliceSelect[T any, K any](x []T, f func(x T) K) []K
- func SliceValuesToPointers[T any](x []T) []*T
- func SliceWhere[T any](x []T, f func(x T) bool) []T
- func TrimLeadingZeroesFromAddress(address common.Address) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Abs ¶
func Abs[T constraints.Integer](x T) T
Abs provides a way of taking the absolute value of an integer
func AbsDiff ¶
func AbsDiff[T constraints.Integer](x T, y T) T
AbsDiff provides a way of taking the absolute difference between two integers
func AttachLabelToAddress ¶ added in v1.0.0
AttachLabelToAddress appends a human-readable label to an address for console-output. If a label is not-provided, the address is returned back. Note that this function also trims any leading zeroes from the address to clean it up for console output. TODO: Maybe we allow the user to determine whether they want to trim the address of leading zeroes?
func CheckContextDone ¶
CheckContextDone checks if a provided context has indicated it is done, and returns a boolean indicating if it is.
func ConstrainIntegerToBitLength ¶
ConstrainIntegerToBitLength takes a provided big integer, signed indicator, and bit length and ensures that the provided integer is represented in those bounds. In effect, this simulates overflow and underflow. Returns the constrained integer.
func ConstrainIntegerToBounds ¶
ConstrainIntegerToBounds takes a provided big integer and minimum/maximum bounds (inclusive) and ensures that the provided integer is represented in those bounds. In effect, this simulates overflow and underflow. Returns the constrained integer.
func CopyChainConfig ¶
func CopyChainConfig(config *params.ChainConfig) (*params.ChainConfig, error)
CopyChainConfig takes a chain configuration and creates a copy. Returns the copy of the chain configuration, or an error if one occurs.
func CopyDirectory ¶
CopyDirectory copies a directory from a source path to a destination path. If recursively, all subdirectories will be copied. If not, only files within the directory will be copied. Returns an error if one occurs.
func CopyFile ¶
CopyFile copies a file from a source path to a destination path. File permissions are retained. Returns an error if one occurs.
func CreateFile ¶ added in v0.1.1
CreateFile will create a file at the given path and file name combination. If the path is the empty string, the file will be created in the current working directory
func DeleteDirectory ¶
DeleteDirectory deletes a directory at the provided path. Returns an error if one occurred.
func GetFileNameWithoutExtension ¶
GetFileNameWithoutExtension obtains a filename without the extension. This does not contain any preceding directory paths.
func GetFilePathWithoutExtension ¶
GetFilePathWithoutExtension obtains a file path without the extension. This retains all preceding directory paths.
func GetIntegerConstraints ¶
GetIntegerConstraints takes a given signed indicator and bit length for a prospective integer and determines the minimum/maximum value boundaries. Returns the minimum and maximum value for the provided integer properties. Minimums and maximums are inclusive.
func GetPrivateKey ¶ added in v0.1.1
func GetPrivateKey(b []byte) (*ecdsa.PrivateKey, error)
GetPrivateKey will return a private key object given a byte slice. Only slices between lengths 1 and 32 (inclusive) are valid.
func HexStringToAddress ¶
HexStringToAddress converts a hex string (with or without the "0x" prefix) to a common.Address. Returns the parsed address, or an error if one occurs during conversion.
func HexStringsToAddresses ¶
HexStringsToAddresses converts hex strings (with or without the "0x" prefix) to common.Address objects. Returns the parsed address, or an error if one occurs during conversion.
func IsLinuxEnvironment ¶
func IsLinuxEnvironment() bool
IsLinuxEnvironment returns a boolean indicating whether the current execution environment is a Linux platform.
func IsMacOSEnvironment ¶
func IsMacOSEnvironment() bool
IsMacOSEnvironment returns a boolean indicating whether the current execution environment is a macOS platform.
func IsWindowsEnvironment ¶
func IsWindowsEnvironment() bool
IsWindowsEnvironment returns a boolean indicating whether the current execution environment is a Windows platform.
func MakeDirectory ¶
MakeDirectory creates a directory at the given path, including any parent directories which do not exist. Returns an error, if one occurred.
func Max ¶
func Max[T constraints.Ordered](x T, y T) T
Max provides generic support for various integer types to be compared and the maximum of two values returned. Returns the maximum of the two values provided.
func MessageToTransaction ¶
func MessageToTransaction(msg *core.Message) *types.Transaction
MessageToTransaction derives a types.Transaction from a types.Message.
func Min ¶
func Min[T constraints.Ordered](x T, y T) T
Min provides generic support for various integer types to be compared and the minimum of two values returned. Returns the minimum of the two values provided.
func MoveFile ¶ added in v0.1.7
MoveFile will move a given file from the source path to the target path. Returns an error if one occured.
func PermutationsWithRepetition ¶ added in v0.1.2
PermutationsWithRepetition will take in an array and an integer, n, where n represents how many items need to be selected from the array. The function returns an array of all permutations of size n
func RunCommandWithOutputAndError ¶
RunCommandWithOutputAndError runs a given exec.Cmd and returns the stdout, stderr, and combined output as bytes, or an error if one occurred.
func SlicePointersToValues ¶
func SlicePointersToValues[T any](x []*T) []T
SlicePointersToValues takes a slice of pointers and returns a slice of values de-referenced from them.
func SliceSelect ¶
SliceSelect provides a way of querying a specific element from a slice's elements into a slice of its own.
func SliceValuesToPointers ¶
func SliceValuesToPointers[T any](x []T) []*T
SliceValuesToPointers takes a slice of values and returns a slice of pointers to them.
func SliceWhere ¶
SliceWhere provides a way of querying specific elements which fit some criteria into a new slice.
func TrimLeadingZeroesFromAddress ¶ added in v1.0.0
TrimLeadingZeroesFromAddress removes the leading zeroes from an address for readability and returns it as a string Example: sender=0x0000000000000000000000000000000000030000 becomes sender=0x30000 when shown on console
Types ¶
This section is empty.