util

package
v1.0.6-testnet Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertToHashSlice

func ConvertToHashSlice(ss []string) []types.Hash

ConvertToHashSlice convert string slice to hash slice

func ConvertToNumberedEpoch

func ConvertToNumberedEpoch(cfx sdk.ClientOperator, epoch *types.Epoch) (*types.Epoch, error)

ConvertToNumberedEpoch converts named epoch to numbered epoch if necessary

func GetShortIdOfHash

func GetShortIdOfHash(hash string) uint64

func GetSummaryOfBlock

func GetSummaryOfBlock(block *types.Block) *types.BlockSummary

func IsEip155Tx

func IsEip155Tx(tx *web3goTypes.TransactionDetail) bool

IsEip155Tx check if the EVM transaction is compliant to EIP155

func IsEmptyBlock

func IsEmptyBlock(block *types.Block) bool

IsEmptyBlock checks if block contains any executed transaction(s)

func IsInterfaceValNil

func IsInterfaceValNil(i interface{}) bool

Helper function to check if interface value is nil, since "i == nil" checks nil interface case only. Refer to https://mangatmodi.medium.com/go-check-nil-interface-the-right-way-d142776edef1 for more details.

func IsLegacyEthTx

func IsLegacyEthTx(tx *web3goTypes.TransactionDetail) bool

IsLegacyEthTx check if the EVM transaction is legacy (pre EIP155)

func IsSuccessEthTx

func IsSuccessEthTx(tx *web3goTypes.TransactionDetail) bool

IsSuccessEthTx check if the EVM transaction is success

func IsTxExecutedInBlock

func IsTxExecutedInBlock(tx *types.Transaction) bool

func IsValidHashStr

func IsValidHashStr(hashStr string) bool

IsValidHashStr validates if the search (block/tx) hash contains the right characters and in the right length.

func IsZeroHash

func IsZeroHash(hash *common.Hash) bool

func MaxInt

func MaxInt(a, b int) int

func MaxUint64

func MaxUint64(a, b uint64) uint64

func MinInt

func MinInt(a, b int) int

func MinUint32

func MinUint32(a, b uint32) uint32

func MinUint64

func MinUint64(a, b uint64) uint64

func MustMarshalJson

func MustMarshalJson(v interface{}) []byte

func MustMarshalRLP

func MustMarshalRLP(v interface{}) []byte

func MustUnmarshalJson

func MustUnmarshalJson(data []byte, v interface{})

func MustUnmarshalRLP

func MustUnmarshalRLP(data []byte, v interface{})

func NormalizeEthBlockNumber

func NormalizeEthBlockNumber(
	w3c *web3go.Client, blockNum *rpc.BlockNumber, hardforkBlockNumber rpc.BlockNumber,
) (*rpc.BlockNumber, error)

NormalizeEthBlockNumber normalizes ETH block number to be positive if necessary

func RandUint64

func RandUint64(limit uint64) uint64

func StripLogExtraFieldsForRPC

func StripLogExtraFieldsForRPC(logs []types.Log)

StripLogExtraFields strips extra unnecessary fields from logs to comply with fullnode rpc

Types

type ConcurrentMap

type ConcurrentMap struct {
	sync.Map
	// contains filtered or unexported fields
}

func (*ConcurrentMap) LoadOrStoreFn

func (m *ConcurrentMap) LoadOrStoreFn(
	key interface{}, factory func(k interface{}) interface{},
) (actual interface{}, loaded bool)

func (*ConcurrentMap) LoadOrStoreFnErr

func (m *ConcurrentMap) LoadOrStoreFnErr(
	key interface{}, factory func(k interface{}) (interface{}, error),
) (actual interface{}, loaded bool, err error)

Directories

Path Synopsis
rpc

Jump to

Keyboard shortcuts

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