types

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2021 License: CC0-1.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMaxConnections = 20
)

Variables

View Source
var (
	HomePath = ""
)

Functions

func BindFlagsLoadViper

func BindFlagsLoadViper(cmd *cobra.Command, _ []string) error

BindFlagsLoadViper binds all flags and read the config into viper

func ConvertValidatorAddressToBech32String

func ConvertValidatorAddressToBech32String(address types.Address) string

ConvertValidatorAddressToBech32String converts the given validator address to its Bech32 string representation

func ConvertValidatorPubKeyToBech32String

func ConvertValidatorPubKeyToBech32String(pubKey tmcrypto.PubKey) (string, error)

ConvertValidatorPubKeyToBech32String converts the given pubKey to a Bech32 string

func DefaultConfigSetup

func DefaultConfigSetup(cfg Config, sdkConfig *sdk.Config)

DefaultConfigSetup represents a handy implementation of SdkConfigSetup that simply setups the prefix inside the configuration

func GetConfigFilePath

func GetConfigFilePath() string

GetConfigFilePath returns the path to the configuration file given the executable name

func Write

func Write(cfg Config, path string) error

Write allows to write the given configuration into the file present at the given path

Types

type Block

type Block struct {
	Height          int64
	Hash            string
	TxNum           int
	TotalGas        uint64
	ProposerAddress string
	Timestamp       time.Time
}

Block contains the data of a single chain block

func NewBlock

func NewBlock(
	height int64, hash string, txNum int, totalGas uint64, proposerAddress string, timestamp time.Time,
) *Block

NewBlock allows to build a new Block instance

func NewBlockFromTmBlock

func NewBlockFromTmBlock(blk *tmctypes.ResultBlock, totalGas uint64) *Block

NewBlockFromTmBlock builds a new Block instance from a given ResultBlock object

type CobraCmdFunc

type CobraCmdFunc func(cmd *cobra.Command, args []string) error

CobraCmdFunc represents a cobra command function

func ConcatCobraCmdFuncs

func ConcatCobraCmdFuncs(fs ...CobraCmdFunc) CobraCmdFunc

ConcatCobraCmdFuncs returns a single function that calls each argument function in sequence RunE, PreRunE, PersistentPreRunE, etc. all have this same signature

type CommitSig

type CommitSig struct {
	Height           int64
	ValidatorAddress string
	VotingPower      int64
	ProposerPriority int64
	Timestamp        time.Time
}

CommitSig contains the data of a single validator commit signature

func NewCommitSig

func NewCommitSig(validatorAddress string, votingPower, proposerPriority, height int64, timestamp time.Time) *CommitSig

NewCommitSig allows to build a new CommitSign object

type Config

type Config interface {
	GetRPCConfig() RPCConfig
	GetGrpcConfig() GrpcConfig
	GetCosmosConfig() CosmosConfig
	GetDatabaseConfig() DatabaseConfig
	GetLoggingConfig() LoggingConfig
	GetParsingConfig() ParsingConfig
	GetPruningConfig() PruningConfig
	GetTelemetryConfig() TelemetryConfig
}

Config represents the configuration to run Juno

var (
	// Cfg represents the configuration to be used during the execution
	Cfg           Config
	HTTPProtocols = regexp.MustCompile("https?://")
)

func DefaultConfigParser

func DefaultConfigParser(configData []byte) (Config, error)

DefaultConfigParser attempts to read and parse a Juno config from the given string bytes. An error reading or parsing the config results in a panic.

func NewConfig

func NewConfig(
	rpcConfig RPCConfig, grpConfig GrpcConfig,
	cosmosConfig CosmosConfig, dbConfig DatabaseConfig,
	loggingConfig LoggingConfig, parsingConfig ParsingConfig,
	pruningConfig PruningConfig, telemetryConfig TelemetryConfig,
) Config

NewConfig builds a new Config instance

func Read

func Read(configPath string, parser ConfigParser) (Config, error)

Read takes the path to a configuration file and returns the properly parsed configuration

type ConfigParser

type ConfigParser = func(fileContents []byte) (Config, error)

ConfigParser represents a function that allows to parse a file contents as a Config object

type CosmosConfig

type CosmosConfig interface {
	GetPrefix() string
	GetModules() []string
}

CosmosConfig contains the data to configure the CosmosConfig SDK

func DefaultCosmosConfig

func DefaultCosmosConfig() CosmosConfig

DefaultCosmosConfig returns the default instance of CosmosConfig

func NewCosmosConfig

func NewCosmosConfig(prefix string, modules []string) CosmosConfig

NewCosmosConfig returns a new CosmosConfig instance

type DatabaseConfig

type DatabaseConfig interface {
	GetName() string
	GetHost() string
	GetPort() int64
	GetUser() string
	GetPassword() string
	GetSSLMode() string
	GetSchema() string
	GetMaxOpenConnections() int
	GetMaxIdleConnections() int
}

DatabaseConfig represents a generic database configuration

func DefaultDatabaseConfig

func DefaultDatabaseConfig() DatabaseConfig

DefaultDatabaseConfig returns the default instance of DatabaseConfig

func NewDatabaseConfig

func NewDatabaseConfig(
	name, host string, port int64, user string, password string,
	sslMode string, schema string,
	maxOpenConnections int, maxIdleConnections int,
) DatabaseConfig

type EncodingConfigBuilder

type EncodingConfigBuilder func() params.EncodingConfig

EncodingConfigBuilder represents a function that is used to return the proper encoding config.

type GrpcConfig

type GrpcConfig interface {
	GetAddress() string
	IsInsecure() bool
}

GrpcConfig contains the configuration of the gRPC endpoint

func DefaultGrpcConfig

func DefaultGrpcConfig() GrpcConfig

DefaultGrpcConfig returns the default instance of a GrpcConfig

func NewGrpcConfig

func NewGrpcConfig(address string, insecure bool) GrpcConfig

NewGrpcConfig allows to build a new GrpcConfig instance

type HeightQueue

type HeightQueue chan int64

HeightQueue is a simple type alias for a (buffered) channel of block heights.

func NewQueue

func NewQueue(size int) HeightQueue

type LoggingConfig

type LoggingConfig interface {
	GetLogLevel() string
	GetLogFormat() string
}

LoggingConfig represents the configuration for the logging part

func DefaultLoggingConfig

func DefaultLoggingConfig() LoggingConfig

DefaultLoggingConfig returns the default LoggingConfig instance

func NewLoggingConfig

func NewLoggingConfig(level, format string) LoggingConfig

NewLoggingConfig returns a new LoggingConfig instance

type Message

type Message struct {
	TxHash    string
	Index     int
	Type      string
	Value     string
	Addresses []string
}

Message represents the data of a single message

func NewMessage

func NewMessage(txHash string, index int, msgType string, value string, addresses []string) *Message

NewMessage allows to build a new Message instance

type ParsingConfig

type ParsingConfig interface {
	GetWorkers() int64
	ShouldParseNewBlocks() bool
	ShouldParseOldBlocks() bool
	ShouldParseGenesis() bool
	GetGenesisFilePath() string
	GetStartHeight() int64
	UseFastSync() bool
}

ParsingConfig represents the configuration of the parsing

func DefaultParsingConfig

func DefaultParsingConfig() ParsingConfig

DefaultParsingConfig returns the default instance of ParsingConfig

func NewParsingConfig

func NewParsingConfig(
	workers int64,
	parseNewBlocks, parseOldBlocks bool,
	parseGenesis bool, genesisFilePath string, startHeight int64, fastSync bool,
) ParsingConfig

NewParsingConfig allows to build a new ParsingConfig instance

type PruningConfig

type PruningConfig interface {
	GetKeepRecent() int64
	GetKeepEvery() int64
	GetInterval() int64
}

PruningConfig contains the configuration of the pruning strategy

func DefaultPruningConfig

func DefaultPruningConfig() PruningConfig

DefaultPruningConfig returns the default PruningConfig instance

func NewPruningConfig

func NewPruningConfig(keepRecent, keepEvery, interval int64) PruningConfig

NewPruningConfig returns a new PruningConfig

type RPCConfig

type RPCConfig interface {
	GetClientName() string
	GetAddress() string
	GetMaxConnections() int
}

RPCConfig contains the configuration of the RPC endpoint

func DefaultRPCConfig

func DefaultRPCConfig() RPCConfig

DefaultRPCConfig returns the default instance of RPCConfig

func NewRPCConfig

func NewRPCConfig(clientName, address string, maxConnections int) RPCConfig

NewRPCConfig allows to build a new RPCConfig instance

type SdkConfigSetup

type SdkConfigSetup func(config Config, sdkConfig *sdk.Config)

SdkConfigSetup represents a method that allows to customize the given sdk.ParsingConfig. This should be used to set custom Bech32 addresses prefixes and other app-related configurations.

type TelemetryConfig

type TelemetryConfig interface {
	IsEnabled() bool
	GetPort() uint
}

TelemetryConfig contains the configuration of the pruning strategy

func DefaultTelemetryConfig

func DefaultTelemetryConfig() TelemetryConfig

DefaultTelemetryConfig returns the default TelemetryConfig instance

func NewTelemetryConfig

func NewTelemetryConfig(enabled bool, port uint) TelemetryConfig

NewTelemetryConfig allows to build a new TelemetryConfig instance

type Tx

type Tx struct {
	*tx.Tx
	*sdk.TxResponse
}

Tx represents an already existing blockchain transaction

func NewTx

func NewTx(txResponse *sdk.TxResponse, tx *tx.Tx) (*Tx, error)

NewTx allows to create a new Tx instance from the given txResponse

func (Tx) FindAttributeByKey

func (tx Tx) FindAttributeByKey(event sdk.StringEvent, attrKey string) (string, error)

FindAttributeByKey searches inside the specified event of the given tx to find the attribute having the given key. If the specified event does not contain a such attribute, returns an error instead.

func (Tx) FindEventByType

func (tx Tx) FindEventByType(index int, eventType string) (sdk.StringEvent, error)

FindEventByType searches inside the given tx events for the message having the specified index, in order to find the event having the given type, and returns it. If no such event is found, returns an error instead.

func (Tx) Successful

func (tx Tx) Successful() bool

Successful tells whether this tx is successful or not

type Validator

type Validator struct {
	ConsAddr   string
	ConsPubKey string
}

Validator contains the data of a single validator

func NewValidator

func NewValidator(consAddr string, consPubKey string) *Validator

NewValidator allows to build a new Validator instance

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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