Documentation ¶
Index ¶
- Constants
- Variables
- func ChainIdToString(chainId *proto.ChainId) string
- func ContextWithLogger(ctx context.Context, log *slog.Logger) context.Context
- func EitherSlice[T any](a, b []T) []T
- func EitherStr(a, b string) string
- func FixField[T any](raw map[string]any, path []string, fix func(*T) error) error
- func FixJsonFields(input []byte, ignoreMissing bool, fixes ...any) ([]byte, error)
- func FixerHexStripLeadingZeros(s *string) error
- func FixerZeroHash(s *string) error
- func FixerZeroUint64(s *string) error
- func Hex2Int(hexStr string) (uint64, error)
- func Hex2Uint64OrZero(hexStr string) uint64
- func LabelsToMap(labels []any) map[string]string
- func LoggerFromContext(ctx context.Context, args ...any) *slog.Logger
- func StringToChainId(chainId string) *proto.ChainId
- func TrimLeftStrZeros(s string) string
- type Config
- type ErrFieldNotExist
- type UInt64HexString
Constants ¶
View Source
const CONTEXT_KEY_CHAINID = "chain"
View Source
const CONTEXT_KEY_LOGGER = "logger"
Variables ¶
View Source
var MAINNET = "MAINNET"
Functions ¶
func ChainIdToString ¶
func ContextWithLogger ¶ added in v0.0.6
func EitherSlice ¶ added in v0.0.6
func EitherSlice[T any](a, b []T) []T
func FixJsonFields ¶ added in v0.0.6
FixJsonFields applies a series of fixes to the JSON fields in the input byte slice. To inject into UnmarshalJSON method of wrapper struct It takes a variadic number of fixes, where each fix is a pair of path and fix function. The path is a slice of strings representing the path to the field in the JSON structure. If ignoreMissing is set to true, the function will ignore fields that do not exist in the JSON structure. The function returns the modified JSON byte slice and an error if any occurred during the fixing process.
func FixerHexStripLeadingZeros ¶ added in v0.0.6
func FixerZeroHash ¶ added in v0.0.6
func FixerZeroUint64 ¶ added in v0.0.6
func Hex2Uint64OrZero ¶
func LabelsToMap ¶ added in v0.0.6
func LoggerFromContext ¶ added in v0.0.6
func StringToChainId ¶
func TrimLeftStrZeros ¶ added in v0.0.6
Types ¶
type ErrFieldNotExist ¶ added in v0.0.6
type ErrFieldNotExist struct {
Path []string
}
func (*ErrFieldNotExist) Error ¶ added in v0.0.6
func (e *ErrFieldNotExist) Error() string
type UInt64HexString ¶
type UInt64HexString uint64
func (UInt64HexString) AsNumber ¶
func (v UInt64HexString) AsNumber() uint64
func (UInt64HexString) MarshalJSON ¶
func (v UInt64HexString) MarshalJSON() ([]byte, error)
func (*UInt64HexString) UnmarshalJSON ¶
func (v *UInt64HexString) UnmarshalJSON(data []byte) error
Click to show internal directories.
Click to hide internal directories.