package
0.0.0-20220308083446-f387b464c92d
Repository: https://github.com/weijun-sh/gethscan-server.git
Documentation: pkg.go.dev
# Functions
AbsolutePath returns datadir + filename, or filename if it is absolute.
BigFromUint64 new big int from uint64 value.
BigToAddress returns Address with byte values of b.
BigToHash sets byte representation of b to hash.
BigUint64 big to uint64 and an overflow flag.
Bytes2Hex returns the hexadecimal encoding of d.
BytesToAddress returns Address with value b.
BytesToHash sets b to hash.
CopyBytes returns an exact copy of the provided bytes.
CurrentDir current directory.
ExecuteDir returns the execute directory.
FileExist checks if a file exists at filePath.
FromHex returns the bytes represented by the hexadecimal string s.
GetBigInt get big int from data[start:start+size].
GetBigIntFromStr new big int from string.
GetData get data[start:start+size] (won't out of index range), and right padding the bytes to size long.
GetIntFromStr get int from string.
GetUint64 get uint64 from data[start:start+size].
GetUint64FromStr get uint64 from string.
GetUnprefixedHex returns (unprefixed hex, is hex string flag, if has uppercase hexadecimal).
HasHexPrefix validates str begins with '0x' or '0X'.
Hex2Bytes returns the bytes represented by the hexadecimal string str.
Hex2BytesFixed returns bytes of a specified fixed length flen.
HexToAddress returns Address with byte values of s.
HexToHash sets byte representation of s to hash.
IsEqualIgnoreCase returns if s1 and s2 are equal ignore case.
IsHex validates whether each byte is valid hexadecimal string.
IsHexAddress verifies whether a string can represent a valid hex-encoded Ethereum address or not.
IsHexCharacter returns bool of c being a valid hexadecimal.
IsUpperHexCharacter returns bool of c being a valid uppercase hexadecimal.
Keccak256Hash calc keccak hash.
LeftPadBytes zero-pads slice to the left up to length l.
MakeName creates a node name that follows the ethereum convention for such names.
MarshalBigInt marshalls big int into text string for consistent encoding.
MaxUint64 get maximum calue of x and y.
MinUint64 get minimum value of x and y.
MustMarshalBigInt marshalls big int into text string for consistent encoding.
MustUnmarshalBigInt unmarshalls string from *big.Int.
NewMixedcaseAddress constructor (mainly for testing).
NewMixedcaseAddressFromString is mainly meant for unit-testing.
Now returns timestamp of the point of calling.
NowMilli returns now timestamp in miliseconds.
NowMilliStr returns now timestamp in miliseconds of string format.
NowStr returns now timestamp of string format.
RightPadBytes zero-pads slice to the right up to length l.
ToHex returns the hex representation of b, prefixed with '0x'.
ToJSONString to json string.
UnmarshalBigInt unmarshalls string from *big.Int.
# Constants
AddressLength is the expected length of the address.
HashLength is the expected length of the hash.
# Variables
Common big integers often used.
Common big integers often used.
Common big integers often used.
Common big integers often used.
Common big integers often used.
Common big integers often used.
Common big integers often used.
Common big integers often used.
EmptyHash empty hash.
# Structs
MixedcaseAddress retains the original string, which may or may not be correctly checksummed.
# Type aliases
Address represents the 20 byte address of an Ethereum account.
Hash represents the 32 byte Keccak256 hash of arbitrary data.
StorageSize is a wrapper around a float value that supports user friendly formatting.
UnprefixedAddress allows marshaling an Address without 0x prefix.
UnprefixedHash allows marshaling a Hash without 0x prefix.