helpers

package
v0.0.0-...-d09159b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BigIntFromString

func BigIntFromString(s string) (*big.Int, error)

func Contains

func Contains[T comparable](value T, sliceB []T) bool

Contains checks if the slice contains the given value.

func ExpandScientificNotation

func ExpandScientificNotation(s string) (string, error)

func GetBlockExplorerTxLinkInfo

func GetBlockExplorerTxLinkInfo(chainId int, txHash string) string

func GetenvSafe

func GetenvSafe(key string) string

func HasDuplicates

func HasDuplicates[T comparable](slice []T) bool

HasDuplicates checks if the provided slice contains any duplicate elements. It accepts a slice of any comparable type and returns true if there are duplicates, otherwise it returns false.

func IsScientificNotation

func IsScientificNotation(s string) bool

IsScientificNotation checks if the string is in scientific notation (like 1e+18).

func IsSubset

func IsSubset[T comparable](sliceA, sliceB []T) bool

IsSubset checks if all elements of sliceA are also present in sliceB. It returns true if sliceA is a subset of sliceB, otherwise it returns false.

func PrettyPrintStruct

func PrettyPrintStruct(v interface{})
func PrintBlockExplorerTxLink(chainId int, txHash string)

func SimplifyValue

func SimplifyValue(input string, decimalPlaces int) string

func Sleep

func Sleep()

Sleep is a helper function that enables free accounts to stay within their limit of 1 request per second

Types

type NoOpPrinter

type NoOpPrinter struct{}

func (NoOpPrinter) Printf

func (n NoOpPrinter) Printf(format string, a ...interface{})

type Printer

type Printer interface {
	Printf(format string, a ...interface{})
}

type StdOutPrinter

type StdOutPrinter struct{}

StdOutPrinter is a Printer that writes to standard output.

func (StdOutPrinter) Printf

func (p StdOutPrinter) Printf(format string, a ...interface{})

Directories

Path Synopsis
consts

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL