utils

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2025 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfirmAction

func ConfirmAction(skipConfirmation bool, message string) bool

ConfirmAction prompts the user to confirm an action

func DecodeHexWithPrefix

func DecodeHexWithPrefix(hexStr string) ([]byte, error)

DecodeHexWithPrefix decodes a hex string with 0x prefix

func FormatBasisPointsToPercent

func FormatBasisPointsToPercent(basisPoints *big.Int) string

FormatBasisPointsToPercent formats basis points as a percentage string with % symbol

func FormatWeiToEther

func FormatWeiToEther(wei *big.Int) string

FormatWeiToEther formats Wei to MITO for display

func GetAddressFromPrivateKey

func GetAddressFromPrivateKey(privKey string) (string, error)

GetAddressFromPrivateKey returns the address corresponding to a private key

func IncreaseFee

func IncreaseFee(value *big.Int, fee *big.Int) *big.Int

IncreaseFee adds the fee amount to the transaction value

func LoadPrivateKeyFromPrivValidatorKey

func LoadPrivateKeyFromPrivValidatorKey(keyfilePath string) (*ecdsa.PrivateKey, error)

LoadPrivateKeyFromPrivValidatorKey loads a private key from cosmos priv_validator_key.json file

func ParsePercentageToBasisPoints

func ParsePercentageToBasisPoints(value string) (*big.Int, error)

ParsePercentageToBasisPoints parses a percentage string (with % sign) into basis points (1% = 100 basis points)

func ParseValue

func ParseValue(value string) (*big.Int, error)

ParseValue parses a string into a big.Int value

func ParseValueAsWei

func ParseValueAsWei(value string) (*big.Int, error)

ParseValueAsWei parses a decimal string (e.g. "1.5") into wei units (multiplied by 10^18)

func ValidateAddress

func ValidateAddress(addr string) (common.Address, error)

ValidateAddress validates that the provided string is a valid Ethereum address

Types

This section is empty.

Jump to

Keyboard shortcuts

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