utils

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2025 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bech32DelegatorAddressToEvmAddress added in v0.16.0

func Bech32DelegatorAddressToEvmAddress(bech32DelegatorAddress string) (string, error)

func Bech32ValidatorAddressToEvmAddress added in v0.16.0

func Bech32ValidatorAddressToEvmAddress(bech32ValidatorAddress string) (string, error)

func CmpPubKeyToBech32ConsAddress added in v0.16.0

func CmpPubKeyToBech32ConsAddress(hexCmpPubKey string) (sdk.ConsAddress, error)

func EvmAddressToBech32AccAddress added in v0.16.0

func EvmAddressToBech32AccAddress(evmAddress string) (sdk.AccAddress, error)

func EvmAddressToBech32ValAddress added in v0.16.0

func EvmAddressToBech32ValAddress(evmAddress string) (sdk.ValAddress, error)

func QueryMapToVal

func QueryMapToVal(query url.Values, val any) error

QueryMapToVal implements an all-in-one decoder to decode requests' query parameters to structured value.

func WrapTypeAny

WrapTypeAny implements a wrap function for variables with type Any to become UnpackInterfacesMessage, which is meant to unpack values packed within Any's using the AnyUnpacker.

Types

type AutoSimpleInterfaceWrapFunc

type AutoSimpleInterfaceWrapFunc[T any] func(typ *T, r *http.Request) (resp any, err error)

type HTTPError

type HTTPError struct {
	// contains filtered or unexported fields
}

func NewHTTPError

func NewHTTPError(errorCode uint32, err string) *HTTPError

func WrapHTTPError

func WrapHTTPError(err error) *HTTPError

func WrapHTTPErrorWithCode

func WrapHTTPErrorWithCode(errorCode uint32, err error) *HTTPError

func (HTTPError) Unwrap

func (e HTTPError) Unwrap() error

type RespFunc

type RespFunc func(w http.ResponseWriter, r *http.Request)

func AutoWrap

func AutoWrap[T any](codec *codec.LegacyAmino, api AutoSimpleInterfaceWrapFunc[T]) RespFunc

AutoWrap implements a response encoder for requests with query paramenters.

func SimpleWrap

func SimpleWrap(codec *codec.LegacyAmino, api SimpleWrapFunc) RespFunc

SimpleWrap implements a response encoder for requests without any query paramenter.

type Response

type Response struct {
	Code  int             `json:"code"`
	Msg   json.RawMessage `json:"msg"`
	Error string          `json:"error"`
}

type SimpleWrapFunc

type SimpleWrapFunc func(r *http.Request) (resp any, err error)

Jump to

Keyboard shortcuts

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