types

package
v0.0.0-...-a08de0b Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2022 License: CC0-1.0 Imports: 17 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
	Balance   uint64
	Code      []byte
	Keys      []AccountKeyList
	Contracts []byte
}

func NewAccount

func NewAccount(account flow.Account) (Account, error)

type AccountKeyList

type AccountKeyList struct {
	Address        string
	Index          int
	Weight         int
	Revoked        bool
	SigAlgo        string
	HashAlgo       string
	PublicKey      string
	SequenceNumber uint64
}

func NewAccountKeyList

func NewAccountKeyList(
	address string,
	index int,
	weight int,
	revoked bool,
	sigAlgo string,
	hashAlgo string,
	publicKey string,
	sequenceNumber uint64) AccountKeyList

AccountKeyList allows to build a new AccountKeyList

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

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 flowjuno 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 CutPercentage

type CutPercentage struct {
	CutPercentage uint64
	Height        int64
}

func NewCutPercentage

func NewCutPercentage(
	cutPercentage uint64,
	height int64) CutPercentage

CutPercentage allows to build a new CutPercentage

type DatabaseConfig

type DatabaseConfig interface {
	GetName() string
	GetHost() string
	GetPort() int64
	GetUser() string
	GetPassword() string
	GetSSLMode() string
	GetSchema() string
	GetMaxOpenConnections() int
	GetMaxIdleConnections() int
	GetPartitionSize() 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, partitionSize int,
) DatabaseConfig

type DelegatorAccount

type DelegatorAccount struct {
	Address         string
	DelegatorId     int64
	DelegatorNodeId string
}

func NewDelegatorAccount

func NewDelegatorAccount(address string, delegatorId int64, delegatorNodeId string) DelegatorAccount

type DelegatorInfo

type DelegatorInfo struct {
	DelegatorInfo DelegatorNodeInfo
	Height        uint64
	NodeId        string
	DelegatorID   uint32
}

func NewDelegatorInfo

func NewDelegatorInfo(
	delegatorInfo DelegatorNodeInfo,
	height uint64,
	nodeId string,
	delegatorID uint32) DelegatorInfo

DelegatorInfo allows to build a new DelegatorInfo

type DelegatorInfoFromAddress

type DelegatorInfoFromAddress struct {
	DelegatorInfo DelegatorNodeInfo
	Height        int64
	Address       string
}

func NewDelegatorInfoFromAddress

func NewDelegatorInfoFromAddress(
	delegatorInfo DelegatorNodeInfo,
	height int64,
	address string) DelegatorInfoFromAddress

DelegatorInfoFromAddress allows to build a new DelegatorInfoFromAddress

type DelegatorNodeInfo

type DelegatorNodeInfo struct {
	Id                       uint32
	NodeID                   string
	TokensCommitted          uint64
	TokensStaked             uint64
	TokensUnstaking          uint64
	TokensRewarded           uint64
	TokensUnstaked           uint64
	TokensRequestedToUnstake uint64
}

func DelegatorNodeInfoArrayFromCadence

func DelegatorNodeInfoArrayFromCadence(value cadence.Value) ([]DelegatorNodeInfo, error)

func DelegatorNodeInfoFromCadence

func DelegatorNodeInfoFromCadence(value cadence.Value) (DelegatorNodeInfo, error)

func NewDelegatorNodeInfo

func NewDelegatorNodeInfo(id uint32,
	nodeID string,
	tokensCommitted uint64,
	tokensStaked uint64,
	tokensUnstaking uint64,
	tokensRewarded uint64,
	tokensUnstaked uint64,
	tokensRequestedToUnstake uint64) DelegatorNodeInfo

func (DelegatorNodeInfo) Equal

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 LockedAccount

type LockedAccount struct {
	Address       string
	LockedAddress string
}

func NewLockedAccount

func NewLockedAccount(
	address string,
	lockedAddress string,
) LockedAccount

LockedAccount allows to build a new LockedAccount

type LockedAccountBalance

type LockedAccountBalance struct {
	LockedAddress string
	Balance       uint64
	UnlockLimit   uint64
	Height        uint64
}

func NewLockedAccountBalance

func NewLockedAccountBalance(lockedAddress string, balance, unlockLimit uint64, height uint64) LockedAccountBalance

type LockedAccountDelegator

type LockedAccountDelegator struct {
	LockedAddress string
	NodeId        string
	DelegatorId   uint64
}

func NewLockedAccountDelegator

func NewLockedAccountDelegator(lockedAddress string,
	nodeId string, delegatorId uint64) LockedAccountDelegator

LockedAccount allows to build a new LockedAccount

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

type NodeCommittedTokens struct {
	NodeId          string
	CommittedTokens uint64
	Height          int64
}

func NewNodeCommittedTokens

func NewNodeCommittedTokens(
	nodeId string,
	committedTokens uint64,
	height int64) NodeCommittedTokens

NodeCommittedTokens allows to build a new NodeCommittedTokens

type NodeInfoFromAddress

type NodeInfoFromAddress struct {
	Address  string
	NodeInfo StakerNodeInfo
	Height   int64
}

func NewNodeInfoFromAddress

func NewNodeInfoFromAddress(
	address string,
	nodeInfo StakerNodeInfo,
	height int64) NodeInfoFromAddress

NodeInfoFromNodeIDs allows to build a new NodeInfoFromNodeIDs

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

type StakerAccount struct {
	Address        string
	StakerNodeId   string
	StakerNodeInfo StakerNodeInfo
}

func NewStakerAccount

func NewStakerAccount(address, stakerNodeId string, stakerNodeInfo StakerNodeInfo) StakerAccount

type StakerNodeId

type StakerNodeId struct {
	Address string
	NodeId  string
}

func NewStakerNodeId

func NewStakerNodeId(
	address string,
	nodeId string) StakerNodeId

StakerNodeId allows to build a new StakerNodeId

func (StakerNodeId) Equal

func (v StakerNodeId) Equal(w StakerNodeId) bool

Equal tells whether v and w represent the same rows

type StakerNodeInfo

type StakerNodeInfo struct {
	Id                string
	Role              uint8
	NetworkingAddress string
	NetworkingKey     string
	StakingKey        string
	TokensStaked      uint64
	TokensCommitted   uint64
	TokensUnstaking   uint64
	TokensUnstaked    uint64
	TokensRewarded    uint64

	Delegators               []uint32
	DelegatorIDCounter       uint32
	TokensRequestedToUnstake uint64
	InitialWeight            uint64
}

func NewStakerNodeInfo

func NewStakerNodeInfo(id string, role uint8, networkingAddress string, networkingKey string,
	stakingKey string, tokensStaked uint64, tokensCommitted uint64,
	tokensUnstaking uint64, tokensUnstaked uint64, tokensRewarded uint64,
	delegators []uint32, delegatorIDCounter uint32, tokensRequestedToUnstake uint64,
	initialWeight uint64) StakerNodeInfo

func NewStakerNodeInfoArrayFromCadence

func NewStakerNodeInfoArrayFromCadence(value cadence.Value) ([]StakerNodeInfo, error)

func NewStakerNodeInfoFromCadence

func NewStakerNodeInfoFromCadence(value cadence.Value) (StakerNodeInfo, error)

NewNodeOperatorInfoFromInterface create a NodeOperatorInfo from []interface{}

func (StakerNodeInfo) Equals

func (w StakerNodeInfo) Equals(v StakerNodeInfo) bool

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 {
	Name  string      `yaml:"name"`
	Units []TokenUnit `yaml:"units"`
}

Token represents a valid token inside the chain

func NewToken

func NewToken(name string, units []TokenUnit) Token

type TokenPrice

type TokenPrice struct {
	UnitName  string
	Price     float64
	MarketCap int64
	Timestamp time.Time
}

TokenPrice represents the price at a given moment in time of a token unit

func NewTokenPrice

func NewTokenPrice(unitName string, price float64, marketCap int64, timestamp time.Time) TokenPrice

NewTokenPrice returns a new TokenPrice instance containing the given data

type TokenUnit

type TokenUnit struct {
	Denom    string   `yaml:"denom"`
	Exponent int      `yaml:"exponent"`
	Aliases  []string `yaml:"aliases,omitempty"`
	PriceID  string   `yaml:"price_id,omitempty"`
}

TokenUnit represents a unit of a token

func NewTokenUnit

func NewTokenUnit(denom string, exponent int, aliases []string, priceID string) TokenUnit

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 {
	Height        uint64
	TransactionID string

	//Transaction Details
	Script             []byte
	Arguments          [][]byte
	ReferenceBlockID   string
	GasLimit           uint64
	ProposalKey        string
	Payer              string
	Authorizers        []string
	PayloadSignatures  []byte
	EnvelopeSignatures []byte
}

func NewTx

func NewTx(height uint64, transactionID string,
	script []byte, arguments [][]byte, referenceBlockID string,
	gasLimit uint64, proposalKey string, payer string, authorizers []string, payloadSignatures []byte,
	envelopeSignatures []byte) Tx

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