utils

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnknownLogLevel = errors.New("unknown log level (known: debug, info, warn, error)")
View Source
var ErrUnknownNetwork = errors.New("unknown network (known: mainnet, goerli, goerli2, integration)")

Functions

func DataDir

func DataDir(operatingSystem, userDataDir, homeDir string) string

func DefaultDataDir

func DefaultDataDir() (string, error)

func Flatten added in v0.4.0

func Flatten[T any](slices ...[]T) []T

func Gzip64Decode added in v0.4.0

func Gzip64Decode(data string) ([]byte, error)

func Gzip64Encode added in v0.4.0

func Gzip64Encode(data []byte) (string, error)

func HexToFelt added in v0.2.1

func HexToFelt(t testing.TB, hex string) *felt.Felt

Types

type LogLevel

type LogLevel int
const (
	DEBUG LogLevel = iota
	INFO
	WARN
	ERROR
)

func (*LogLevel) Set added in v0.2.1

func (l *LogLevel) Set(s string) error

func (LogLevel) String

func (l LogLevel) String() string

func (*LogLevel) Type added in v0.2.1

func (l *LogLevel) Type() string

func (*LogLevel) UnmarshalText added in v0.2.1

func (l *LogLevel) UnmarshalText(text []byte) error

type Logger

type Logger interface {
	SimpleLogger
	pebble.Logger
}

type Network

type Network int
const (
	MAINNET Network = iota + 1
	GOERLI
	GOERLI2
	INTEGRATION
)

func (Network) ChainID added in v0.2.1

func (n Network) ChainID() *felt.Felt

func (Network) ChainIDString added in v0.4.0

func (n Network) ChainIDString() string

func (Network) CoreContractAddress added in v0.4.0

func (n Network) CoreContractAddress() (common.Address, error)

func (Network) DefaultL1ChainID added in v0.4.0

func (n Network) DefaultL1ChainID() *big.Int

func (Network) FeederURL added in v0.4.0

func (n Network) FeederURL() string

FeederURL returns URL for read commands

func (Network) GatewayURL added in v0.4.0

func (n Network) GatewayURL() string

GatewayURL returns URL for write commands

func (*Network) Set added in v0.2.1

func (n *Network) Set(s string) error

func (Network) String

func (n Network) String() string

func (*Network) Type added in v0.2.1

func (n *Network) Type() string

func (*Network) UnmarshalText added in v0.2.1

func (n *Network) UnmarshalText(text []byte) error

type SimpleLogger

type SimpleLogger interface {
	Debugw(msg string, keysAndValues ...any)
	Infow(msg string, keysAndValues ...any)
	Warnw(msg string, keysAndValues ...any)
	Errorw(msg string, keysAndValues ...any)
}

type ZapLogger

type ZapLogger struct {
	*zap.SugaredLogger
}

func NewNopZapLogger

func NewNopZapLogger() *ZapLogger

func NewZapLogger

func NewZapLogger(logLevel LogLevel, colour bool) (*ZapLogger, error)

func (*ZapLogger) Warningf

func (l *ZapLogger) Warningf(msg string, args ...any)

Jump to

Keyboard shortcuts

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