utils

package
v0.0.26 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertAnyAddressToBytes

func ConvertAnyAddressToBytes(addr string) ([]byte, error)

convert the 0x and/or cosmos address to raw bytes

func ConvertAnyAddressesToBytes

func ConvertAnyAddressesToBytes[T ByteType](addr ...string) ([]T, error)

return either []byte or common.Address

func ExtractEvmChainID added in v0.0.13

func ExtractEvmChainID(chainID string) (string, error)

Returns evm chainId, e.g. push-chain-42101 -> 42101

func GetAddressPair

func GetAddressPair(addr string) (sdk.AccAddress, common.Address, error)

get address pair returns both the cosmos and the 0x addresses, or an error

func GetEnvRPCOverride

func GetEnvRPCOverride(chain string) string

chain is a CAIP-2 chain identifier, e.g., "eip155:1"

func HexToBytes

func HexToBytes(s string) ([]byte, error)

func IsValidAddress

func IsValidAddress(addr string, at AddressType) bool

IsValidAddress checks if the address is a valid COSMOS, HEX (0x), or EITHER address

func MustConvertCosmosToHex

func MustConvertCosmosToHex(addr string) string

func StringToBigInt

func StringToBigInt(s string) *big.Int

Types

type AddressType

type AddressType int

create an enum for COSMOS, 0x, or EITHER

const (
	COSMOS AddressType = iota
	HEX
	EITHER
)

type ByteType

type ByteType interface {
	[]byte | common.Address
}

Type constraint that allows either []byte or common.Address

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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