utils

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: GPL-3.0 Imports: 6 Imported by: 39

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPrefix

func AddPrefix(value string) string

Add a 0x prefix to a hex string if not present

func DecodeHex

func DecodeHex(value string) ([]byte, error)

Convert a hex-encoded string to a byte array, removing the 0x prefix if present

func EncodeHexWithPrefix

func EncodeHexWithPrefix(value []byte) string

Encode bytes to a hex string with a 0x prefix

func GenerateRandomPassword

func GenerateRandomPassword() (string, error)

Generates a random password

func IsWalletReady

func IsWalletReady(status wallet.WalletStatus) bool

Check if the node wallet is ready for transacting

func RemovePrefix

func RemovePrefix(value string) string

Remove a 0x prefix from a hex string if present

func SleepWithCancel added in v0.2.0

func SleepWithCancel(ctx context.Context, duration time.Duration) bool

Sleeps for the specified time, but can break out if the provided context is cancelled. Returns true if the context is cancelled, false if it's not and the full period was slept.

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