util

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2020 License: MIT Imports: 26 Imported by: 2

Documentation

Index

Constants

View Source
const (
	NEXT int = -1
	BACK int = -2
)
View Source
const (
	ETH_ADDR                  string = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
	MAX_ADDR                  string = "0xffffffffffffffffffffffffffffffffffffffff"
	MIN_ADDR                  string = "0x00000000000000ffffffffffffffffffffffffff"
	ETHEREUM_MAINNET_NODE_VAR string = "ETHEREUM_MAINNET_NODE"
	ETHEREUM_ROPSTEN_NODE_VAR string = "ETHEREUM_ROPSTEN_NODE"
	TOMO_MAINNET_NODE_VAR     string = "TOMO_MAINNET_NODE"
	ETHEREUM_KOVAN_NODE_VAR   string = "ETHEREUM_KOVAN_NODE"
	ETHEREUM_RINKEBY_NODE_VAR string = "ETHEREUM_RINKEBY_NODE"
)

Variables

This section is empty.

Functions

func AnalyzeAndPrint added in v0.0.9

func AnalyzeAndPrint(
	reader *reader.EthReader,
	analyzer *txanalyzer.TxAnalyzer,
	tx string,
	network string,
	forceERC20ABI bool,
	customABI string)

func AnalyzeMethodCallAndPrint added in v0.0.9

func AnalyzeMethodCallAndPrint(analyzer *txanalyzer.TxAnalyzer, abi *abi.ABI, data []byte, network string)

func CalculateTimeDurationFromBlock added in v0.0.9

func CalculateTimeDurationFromBlock(network string, from, to uint64) time.Duration

func ConvertParamStrToFixedByteType added in v0.0.15

func ConvertParamStrToFixedByteType(name string, t abi.Type, strs []string, network string) (interface{}, error)

func ConvertParamStrToType added in v0.0.10

func ConvertParamStrToType(name string, t abi.Type, str string, network string) (interface{}, error)

func ConvertToAddress added in v0.0.10

func ConvertToAddress(str string) (common.Address, error)

func ConvertToBig added in v0.0.10

func ConvertToBig(str string, network string) (*big.Int, error)

func ConvertToBool added in v0.0.10

func ConvertToBool(str string) (bool, error)

func ConvertToBytes added in v0.0.10

func ConvertToBytes(str string) ([]byte, error)

func ConvertToFixedBytes added in v0.0.10

func ConvertToFixedBytes(str string, size int) (interface{}, error)

func ConvertToHash added in v0.0.10

func ConvertToHash(str string) (common.Hash, error)

func ConvertToInt added in v0.0.10

func ConvertToInt(str string, size int) (interface{}, error)

func ConvertToIntOrBig added in v0.0.10

func ConvertToIntOrBig(str string, size int, network string) (interface{}, error)

func ConvertToString added in v0.0.10

func ConvertToString(str string) (string, error)

func ConvertToUint added in v0.0.10

func ConvertToUint(str string, size int) (interface{}, error)

func ConvertToUintOrBig added in v0.0.10

func ConvertToUintOrBig(str string, size int, network string) (interface{}, error)

func DisplayBroadcastedTx added in v0.0.9

func DisplayBroadcastedTx(t *types.Transaction, broadcasted bool, err error, network string)

func DisplayValues added in v0.0.11

func DisplayValues(values []string, network string) string

func DisplayWaitAnalyze

func DisplayWaitAnalyze(reader *reader.EthReader, t *types.Transaction, broadcasted bool, err error, network string, forceERC20ABI bool, customABI string)

func EthAnalyzer added in v0.0.6

func EthAnalyzer(network string) (*txanalyzer.TxAnalyzer, error)

func EthBroadcaster added in v0.0.9

func EthBroadcaster(network string) (*broadcaster.Broadcaster, error)

func EthReader

func EthReader(network string) (*reader.EthReader, error)

func EthTxMonitor added in v0.0.9

func EthTxMonitor(network string) (*monitor.TxMonitor, error)

func GetABI

func GetABI(addr string, network string) (*abi.ABI, error)

func GetABIFromBytes added in v0.0.17

func GetABIFromBytes(abiBytes []byte) (*abi.ABI, error)

func GetABIFromString added in v0.0.17

func GetABIFromString(abiStr string) (*abi.ABI, error)

func GetABIStringFromFile added in v0.0.17

func GetABIStringFromFile(filepath string) (string, error)

func GetABIStringFromURL added in v0.0.17

func GetABIStringFromURL(url string) (string, error)

func GetAddressFromString added in v0.0.9

func GetAddressFromString(str string) (addr string, name string, err error)

func GetERC20Decimal added in v0.0.2

func GetERC20Decimal(addr string, network string) (int64, error)

func GetMatchingAddress added in v0.0.17

func GetMatchingAddress(str string) (addr string, name string, err error)

func GetMatchingAddresses added in v0.0.17

func GetMatchingAddresses(str string) (addrs []string, names []string, scores []int)

func GetNodes added in v0.0.9

func GetNodes(network string) (map[string]string, error)

func IsAddress

func IsAddress(addr string) bool

func IsERC20 added in v0.0.11

func IsERC20(addr string, network string) (bool, error)

func IsGnosisMultisig

func IsGnosisMultisig(a *abi.ABI) (bool, error)

func ParamToBigInt added in v0.0.2

func ParamToBigInt(param string) (*big.Int, error)

func PathToAddress

func PathToAddress(path string) (string, error)

func PrintGnosis added in v0.0.9

func PrintGnosis(result *txanalyzer.GnosisResult)

func PromptArray added in v0.0.10

func PromptArray(input abi.Argument, prefill string, network string) (interface{}, error)

func PromptFilePath added in v0.0.10

func PromptFilePath(prompter string) string

func PromptIndex added in v0.0.9

func PromptIndex(prompter string, min, max int) int

func PromptInput added in v0.0.10

func PromptInput(prompter string) string

func PromptInputWithValidation added in v0.0.10

func PromptInputWithValidation(prompter string, validator StringValidator) string

func PromptItemInList added in v0.0.10

func PromptItemInList(prompter string, options []string) string

func PromptNonArray added in v0.0.10

func PromptNonArray(input abi.Argument, prefill string, network string) (interface{}, error)

func PromptNumber added in v0.0.10

func PromptNumber(prompter string, validator NumberValidator, network string) *big.Int

func PromptParam added in v0.0.10

func PromptParam(input abi.Argument, prefill string, network string) (interface{}, error)

func PromptPercentageBps added in v0.0.10

func PromptPercentageBps(prompter string, upbound int64, network string) *big.Int

func ReadCustomABI added in v0.0.16

func ReadCustomABI(addr string, pathOrAddress string, network string) (a *abi.ABI, err error)

func ReadCustomABIString added in v0.0.17

func ReadCustomABIString(addr string, pathOrAddress string, network string) (str string, err error)

func ReadableNumber added in v0.0.14

func ReadableNumber(value string) string

func ScanForAddresses

func ScanForAddresses(para string) []string

func ScanForTxs

func ScanForTxs(para string) []string

func ValueToAmountAndCurrency

func ValueToAmountAndCurrency(value string) (float64, string, error)

Split value by space, if the lowercase of first element is 'all', the amount will be -1, indicating a balance query is needed else, parses the first element to float64 as the amount. Join whats left by space and trim by space, if it is empty, interpret it as ETH. Error will not be nil if it fails to proceed all of above steps.

func VerboseAddress

func VerboseAddress(addr string, network string) string

func VerboseValues added in v0.0.11

func VerboseValues(values []string, network string) []string

Types

type NumberValidator added in v0.0.10

type NumberValidator func(number *big.Int) error

type StringValidator added in v0.0.10

type StringValidator func(st string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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