types

package
v0.0.0-...-cdf0fd8 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: CC0-1.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

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 Account

type Account struct {
	Address  string `json:"address"`
	Balance  string `json:"balance"`
	Nonce    int    `json:"nonce"`
	Shard    int    `json:"shard"`
	ScamInfo struct {
	} `json:"scamInfo"`
	Code                     string `json:"code"`
	CodeHash                 string `json:"codeHash"`
	RootHash                 string `json:"rootHash"`
	TxCount                  int    `json:"txCount"`
	ScrCount                 int    `json:"scrCount"`
	Username                 string `json:"username"`
	DeveloperReward          string `json:"developerReward"`
	OwnerAddress             string `json:"ownerAddress"`
	DeployedAt               int    `json:"deployedAt"`
	IsUpgradeable            bool   `json:"isUpgradeable"`
	IsReadable               bool   `json:"isReadable"`
	IsPayable                bool   `json:"isPayable"`
	IsPayableBySmartContract bool   `json:"isPayableBySmartContract"`
}

type AccountContract

type AccountContract struct {
	Address      string `json:"address"`
	DeployTxHash string `json:"deployTxHash"`
	Timestamp    int    `json:"timestamp"`
}

type Action

type Action struct {
	Category    string `json:"category"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Arguments   []byte `json:"arguments"`
}

type Block

type Block struct {
	Hash          string
	Epoch         int64
	Nonce         int64
	PrevHash      string
	Proposer      int64
	PubKeyBitmap  string
	Round         int64
	Shard         int64
	Size          int64
	SizeTxs       int64
	StateRootHash string
	TimeStamp     int64
	TxCount       int64
	GasConsumed   int64
	GasRefunded   int64
	GasPenalized  int64
	MaxGasLimit   int64

	MiniBlocksHashes      []string
	Validators            []int64
	NotarizedBlocksHashes []string
}

Block contains the data of a single chain block

func NewBlock

func NewBlock(
	hash string,
	epoch int64,
	nonce int64,
	prevHash string,
	proposer int64,
	pubKeyBitmap string,
	round int64,
	shard int64,
	size int64,
	sizeTxs int64,
	stateRootHash string,
	timeStamp int64,
	txCount int64,
	gasConsumed int64,
	gasRefunded int64,
	gasPenalized int64,
	maxGasLimit int64) Block

Block allows to build a new Block

func (Block) Equal

func (v Block) Equal(w Block) bool

Equal tells whether v and w represent the same rows

type BlockTime

type BlockTime struct {
	Height    int64
	BlockTime float64
}

func NewBlockTime

func NewBlockTime(
	height int64,
	blockTime float64) BlockTime

BlockTime allows to build a new BlockTime

func (BlockTime) Equal

func (v BlockTime) Equal(w BlockTime) bool

Equal tells whether v and w represent the same rows

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 Collection

type Collection struct {
	Height         uint64
	Id             string
	Processed      bool
	TransactionIds []flow.Identifier
}

func NewCollection

func NewCollection(
	height uint64,
	id string,
	processed bool,
	transactionIds []flow.Identifier) Collection

Collection allows to build a new Collection

func (Collection) Equal

func (v Collection) Equal(w Collection) bool

Equal tells whether v and w represent the same rows

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 egldjuno

var (
	// Cfg represents the configuration to be used during the execution
	Cfg Config
)

func DefaultConfigParser

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

DefaultConfigParser attempts to read and parse a egldjuno 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
	GetGenesisHeight() uint64
}

CosmosConfig contains the data to configure the CosmosConfig SDK

func NewCosmosConfig

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

NewCosmosConfig returns a new CosmosConfig instance

type CurrentTable

type CurrentTable struct {
	Height int64
	Table  []string
}

func NewCurrentTable

func NewCurrentTable(
	height int64,
	table []string) CurrentTable

CurrentTable allows to build a new CurrentTable

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 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 Event

type Event struct {
	//Transaction Result Event
	Height           int
	Type             string
	TransactionID    string
	TransactionIndex int
	EventIndex       int
	Value            cadence.Event
}

func NewEvent

func NewEvent(height int, t string, transactionID string, transactionIndex int, eventIndex int,
	value cadence.Event) Event

type Genesis

type Genesis struct {
	Time          time.Time
	InitialHeight int64
	ChainId       string
}

Genesis contains the useful information about the genesis

func NewGenesis

func NewGenesis(startTime time.Time, initialHeight int64, chainId string) *Genesis

NewGenesis allows to build a new Genesis instance

func (*Genesis) Equal

func (g *Genesis) Equal(other *Genesis) bool

Equal returns true iff g and other contain the same data

type GrpcConfig

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

GrpcConfig contains the configuration of the gRPC endpoint

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 NewLoggingConfig

func NewLoggingConfig(level, format string) LoggingConfig

NewLoggingConfig returns a new LoggingConfig instance

type NFT

type NFT struct {
	Identifier string   `json:"identifier"`
	Collection string   `json:"collection"`
	Attributes string   `json:"attributes"`
	Nonce      int      `json:"nonce"`
	Type       string   `json:"type"`
	Name       string   `json:"name"`
	Creator    string   `json:"creator"`
	Royalties  int      `json:"royalties"`
	Uris       []string `json:"uris"`
	URL        string   `json:"url"`
	Media      []struct {
		URL          string `json:"url"`
		OriginalURL  string `json:"originalUrl"`
		ThumbnailURL string `json:"thumbnailUrl"`
		FileType     string `json:"fileType"`
		FileSize     int    `json:"fileSize"`
	} `json:"media"`
	IsWhitelistedStorage bool `json:"isWhitelistedStorage"`
	Metadata             struct {
	} `json:"metadata"`
	ScamInfo struct {
		Type string `json:"type"`
		Info string `json:"info"`
	} `json:"scamInfo"`
	Balance string `json:"balance"`
	Ticker  string `json:"ticker"`
}

type NodeTotalCommitment

type NodeTotalCommitment struct {
	NodeId          string
	TotalCommitment uint64
	Height          int64
}

func NewNodeTotalCommitment

func NewNodeTotalCommitment(
	nodeId string,
	totalCommitment uint64,
	height int64) NodeTotalCommitment

NodeTotalCommitment allows to build a new NodeTotalCommitment

func (NodeTotalCommitment) Equal

Equal tells whether v and w represent the same rows

type NodeTotalCommitmentWithoutDelegators

type NodeTotalCommitmentWithoutDelegators struct {
	NodeId                           string
	TotalCommitmentWithoutDelegators uint64
	Height                           int64
}

func NewNodeTotalCommitmentWithoutDelegators

func NewNodeTotalCommitmentWithoutDelegators(
	nodeId string,
	totalCommitmentWithoutDelegators uint64,
	height int64) NodeTotalCommitmentWithoutDelegators

NodeTotalCommitmentWithoutDelegators allows to build a new NodeTotalCommitmentWithoutDelegators

func (NodeTotalCommitmentWithoutDelegators) Equal

Equal tells whether v and w represent the same rows

type NodeUnstakingTokens

type NodeUnstakingTokens struct {
	NodeId         string
	TokenUnstaking uint64
	Height         int64
}

func NewNodeUnstakingTokens

func NewNodeUnstakingTokens(
	nodeId string,
	tokenUnstaking uint64,
	height int64) NodeUnstakingTokens

NodeUnstakingTokens allows to build a new NodeUnstakingTokens

func (NodeUnstakingTokens) Equal

Equal tells whether v and w represent the same rows

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 NewParsingConfig

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

type ProposedTable

type ProposedTable struct {
	Height        int64
	ProposedTable []string
}

func NewProposedTable

func NewProposedTable(
	height int64,
	proposedTable []string) ProposedTable

ProposedTable allows to build a new ProposedTable

type PruningConfig

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

PruningConfig contains the configuration of the pruning strategy

func NewPruningConfig

func NewPruningConfig(keepRecent, keepEvery, interval int64) PruningConfig

NewPruningConfig returns a new PruningConfig

type RPCConfig

type RPCConfig interface {
	GetClientName() string
	GetAddress() string
	GetContracts() string
}

RPCConfig contains the configuration of the RPC endpoint

func NewRPCConfig

func NewRPCConfig(clientName, address, contracts string) RPCConfig

NewRPCConfig allows to build a new RPCConfig instance

type SCResult

type SCResult struct {
	Hash           string `json:"hash"`
	Timestamp      int    `json:"timestamp"`
	Nonce          int    `json:"nonce"`
	GasLimit       int    `json:"gasLimit"`
	GasPrice       int    `json:"gasPrice"`
	Value          string `json:"value"`
	Sender         string `json:"sender"`
	Receiver       string `json:"receiver"`
	RelayedValue   string `json:"relayedValue"`
	Data           string `json:"data"`
	PrevTxHash     string `json:"prevTxHash"`
	OriginalTxHash string `json:"originalTxHash"`
	CallType       string `json:"callType"`
	Logs           struct {
		Address string   `json:"address"`
		Events  []string `json:"events"`
	} `json:"logs"`
	ReturnMessage struct {
	} `json:"returnMessage"`
}

type SdkConfigSetup

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

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

type SmartContractResult

type SmartContractResult struct {
	Hash           string  `json:"hash"`
	Timestamp      int     `json:"timestamp"`
	Nonce          int     `json:"nonce"`
	GasLimit       int     `json:"gasLimit"`
	GasPrice       int     `json:"gasPrice"`
	Value          string  `json:"value"`
	Sender         string  `json:"sender"`
	Receiver       string  `json:"receiver"`
	Data           string  `json:"data"`
	PrevTxHash     string  `json:"prevTxHash"`
	OriginalTxHash string  `json:"originalTxHash"`
	CallType       string  `json:"callType"`
	RelayedValue   *string `json:"relayedValue"`
	Logs           []byte  `json:"logs"`
	ReturnMessage  []byte  `json:"returnMessage"`
}

func NewSmartContractResult

func NewSmartContractResult(
	txHash string,
	hash string,
	timestamp int,
	nonce int,
	gasLimit int,
	gasPrice int,
	value string,
	sender string,
	receiver string,
	relayedValue string,
	data string,
	prevTxHash string,
	originalTxHash string,
	callType string,
	logs []byte,
	returnMessage []byte) SmartContractResult

SmartContractResult allows to build a new SmartContractResult

func (SmartContractResult) Equal

Equal tells whether v and w represent the same rows

type StakeRequirements

type StakeRequirements struct {
	Height      int64
	Role        uint8
	Requirement uint64
}

func NewStakeRequirements

func NewStakeRequirements(
	height int64,
	role uint8,
	requirement uint64) StakeRequirements

StakeRequirements allows to build a new StakeRequirements

func (StakeRequirements) Equal

Equal tells whether v and w represent the same rows

type StakingTable

type StakingTable struct {
	Height       int64
	StakingTable []string
}

func NewStakingTable

func NewStakingTable(
	height int64,
	stakingTable []string) StakingTable

StakingTable allows to build a new StakingTable

type TelemetryConfig

type TelemetryConfig interface {
	GetEnabled() bool
	GetPort() int64
}

PruningConfig contains the configuration of the pruning strategy

func NewTelemetryConfig

func NewTelemetryConfig(enabled bool, port int64) TelemetryConfig

type Token

type Token struct {
	Identifier     string `json:"identifier"`
	Name           string `json:"name"`
	Ticker         string `json:"ticker"`
	Owner          string `json:"owner"`
	Minted         string `json:"minted"`
	Burnt          string `json:"burnt"`
	Decimals       int    `json:"decimals"`
	IsPaused       bool   `json:"isPaused"`
	CanUpgrade     bool   `json:"canUpgrade"`
	CanMint        bool   `json:"canMint"`
	CanBurn        bool   `json:"canBurn"`
	CanChangeOwner bool   `json:"canChangeOwner"`
	CanPause       bool   `json:"canPause"`
	CanFreeze      bool   `json:"canFreeze"`
	CanWipe        bool   `json:"canWipe"`
	Balance        string `json:"balance"`
}

type TokenBalance

type TokenBalance struct {
	Address    string
	Identifier string
	Balance    string
}

func NewTokenBalance

func NewTokenBalance(
	address string,
	identifier string,
	balance string) TokenBalance

TokenBalance allows to build a new TokenBalance

func (TokenBalance) Equal

func (v TokenBalance) Equal(w TokenBalance) bool

Equal tells whether v and w represent the same rows

type TotalStake

type TotalStake struct {
	Height     int64
	TotalStake uint64
}

func NewTotalStake

func NewTotalStake(
	height int64,
	totalStake uint64) TotalStake

TotalStake allows to build a new TotalStake

func (TotalStake) Equal

func (v TotalStake) Equal(w TotalStake) bool

Equal tells whether v and w represent the same rows

type TotalStakeByType

type TotalStakeByType struct {
	Height     int64
	Role       int8
	TotalStake uint64
}

func NewTotalStakeByType

func NewTotalStakeByType(
	height int64,
	role int8,
	totalStake uint64) TotalStakeByType

TotalStake allows to build a new TotalStake

func (TotalStakeByType) Equal

Equal tells whether v and w represent the same rows

type TransactionResult

type TransactionResult struct {
	TransactionId string
	Status        string
	Error         string
}

func NewTransactionResult

func NewTransactionResult(
	transactionId string,
	status string,
	error string) TransactionResult

TransactionResult allows to build a new TransactionResult

func (TransactionResult) Equal

Equal tells whether v and w represent the same rows

type Tx

type Tx struct {
	TxHash              string
	GasLimit            int64
	GasPrice            int64
	GasUsed             int64
	MiniBlockHash       string
	Nonce               int64
	Receiver            string
	ReceiverShard       int64
	Round               int64
	Sender              string
	SenderShard         int64
	Signature           string
	Status              string
	Value               string
	Fee                 string
	Timestamp           int64
	Data                string
	SmartContractResult []SmartContractResult `json:"results"`
}

func NewTx

func NewTx(
	txHash string,
	gasLimit int64,
	gasPrice int64,
	gasUsed int64,
	miniBlockHash string,
	nonce int64,
	receiver string,
	receiverShard int64,
	round int64,
	sender string,
	senderShard int64,
	signature string,
	status string,
	value string,
	fee string,
	timestamp int64,
	data string) Tx

Transaction allows to build a new Transaction

func (Tx) Equal

func (v Tx) Equal(w Tx) bool

Equal tells whether v and w represent the same rows

func (Tx) Successful

func (tx Tx) Successful() bool

Successful tells whether this tx is successful or not

type Txs

type Txs []Tx

Tx represents an already existing blockchain transaction

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

type WeeklyPayout

type WeeklyPayout struct {
	Height int64
	Payout uint64
}

func NewWeeklyPayout

func NewWeeklyPayout(
	height int64,
	payout uint64) WeeklyPayout

WeeklyPayout allows to build a new WeeklyPayout

func (WeeklyPayout) Equal

func (v WeeklyPayout) Equal(w WeeklyPayout) bool

Equal tells whether v and w represent the same rows

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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