Documentation ¶
Index ¶
- func ConvertToHashSlice(ss []string) []types.Hash
- func ConvertToNumberedEpoch(cfx sdk.ClientOperator, epoch *types.Epoch) (*types.Epoch, error)
- func GetShortIdOfHash(hash string) uint64
- func GetSummaryOfBlock(block *types.Block) *types.BlockSummary
- func IsEip155Tx(tx *web3goTypes.TransactionDetail) bool
- func IsEmptyBlock(block *types.Block) bool
- func IsInterfaceValNil(i interface{}) bool
- func IsLegacyEthTx(tx *web3goTypes.TransactionDetail) bool
- func IsSuccessEthTx(tx *web3goTypes.TransactionDetail) bool
- func IsTxExecutedInBlock(tx *types.Transaction) bool
- func IsValidHashStr(hashStr string) bool
- func IsZeroHash(hash *common.Hash) bool
- func MaxInt(a, b int) int
- func MaxUint64(a, b uint64) uint64
- func MinInt(a, b int) int
- func MinUint32(a, b uint32) uint32
- func MinUint64(a, b uint64) uint64
- func MustMarshalJson(v interface{}) []byte
- func MustMarshalRLP(v interface{}) []byte
- func MustUnmarshalJson(data []byte, v interface{})
- func MustUnmarshalRLP(data []byte, v interface{})
- func NormalizeEthBlockNumber(w3c *web3go.Client, blockNum *rpc.BlockNumber, ...) (*rpc.BlockNumber, error)
- func RandUint64(limit uint64) uint64
- func StripLogExtraFieldsForRPC(logs []types.Log)
- type ConcurrentMap
- type ExpirableLruCache
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertToHashSlice ¶
ConvertToHashSlice convert string slice to hash slice
func ConvertToNumberedEpoch ¶
ConvertToNumberedEpoch converts named epoch to numbered epoch if necessary
func GetShortIdOfHash ¶
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 ¶
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 ¶
IsValidHashStr validates if the search (block/tx) hash contains the right characters and in the right length.
func IsZeroHash ¶
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 StripLogExtraFieldsForRPC ¶
StripLogExtraFields strips extra unnecessary fields from logs to comply with fullnode rpc
Types ¶
type ConcurrentMap ¶
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)
type ExpirableLruCache ¶
type ExpirableLruCache struct {
// contains filtered or unexported fields
}
ExpirableLruCache naive implementation of LRU cache with fixed TTL expiration duration. This cache uses a lazy eviction policy, by which the expired entry will be purged when it's being looked up.
func NewExpirableLruCache ¶
func NewExpirableLruCache(size int, ttl time.Duration) *ExpirableLruCache
func (*ExpirableLruCache) Add ¶
func (c *ExpirableLruCache) Add(key, value interface{}) bool
Add adds a value to the cache. Returns true if an eviction occurred.
func (*ExpirableLruCache) Get ¶
func (c *ExpirableLruCache) Get(key interface{}) (interface{}, bool)
Get looks up a key's value from the cache. Will purge the entry and return nil if the entry expired.