utils

package
v0.0.0-...-8b5660e Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeMessageHash

func ComputeMessageHash(payloadType uint32, payload []byte, nonce *big.Int) (common.Hash, error)

func ConvertBigIntToUint256

func ConvertBigIntToUint256(b *big.Int) *uint256.Int

func ConvertHashToYuHash

func ConvertHashToYuHash(hash common.Hash) (yu_common.Hash, error)

func ConvertStringToStringArray

func ConvertStringToStringArray(s string) []string

ConvertStringToStringArray takes a string with values separated by commas and returns a slice of strings

func GenerateNonce

func GenerateNonce() *big.Int

func GetBlockNumber

func GetBlockNumber(ctx context.Context, client *ethclient.Client, confirmations uint64) (uint64, error)

func GetBlocksInRange

func GetBlocksInRange(ctx context.Context, cli *ethclient.Client, start, end uint64) ([]*types.Block, error)

GetBlocksInRange gets a batch of blocks for a block range [start, end] inclusive.

func GetRdoBlockNumber

func GetRdoBlockNumber(ctx context.Context, client *rdoclient.Client, confirmations uint64) (uint64, error)

func GetRdoBlocksInRange

func GetRdoBlocksInRange(ctx context.Context, cli *rdoclient.Client, start, end uint64) ([]*rdoclient.RdoBlock, error)

GetBlocksInRange gets a batch of blocks for a block range [start, end] inclusive.

func LoadPrivateKey

func LoadPrivateKey(envFilePath string, envPramName string) (string, error)

func Loop

func Loop(ctx context.Context, period time.Duration, f func())

Loop Run the f func periodically.

func NowUTC

func NowUTC() time.Time

func ObjToJson

func ObjToJson(obj interface{}) string

func UnpackLog

func UnpackLog(c *abi.ABI, out interface{}, event string, log types.Log) error

UnpackLog unpacks a retrieved log into the provided output structure. @todo: add unit test.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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