utils

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// DeltaHeight is the amount of blocks in the future that the upgrade will be scheduled.
	DeltaHeight = 10
)

Variables

This section is empty.

Functions

func ExecuteBinaryCmd

func ExecuteBinaryCmd(bin *Binary, args BinaryCmdArgs) (string, error)

ExecuteBinaryCmd executes a shell command and returns the output and error.

func GetCodec

func GetCodec() (*codec.ProtoCodec, bool)

GetCodec returns the codec to be used for the client.

func GetCurrentHeight

func GetCurrentHeight(bin *Binary) (int, error)

GetCurrentHeight returns the current block height of the node.

func GetEventsFromTxResponse

func GetEventsFromTxResponse(cdc *codec.ProtoCodec, out string) ([]sdk.StringEvent, error)

GetEventsFromTxResponse unpacks the transaction response into the corresponding SDK type and returns the events.

func GetTxEvents

func GetTxEvents(bin *Binary, out string) ([]sdk.StringEvent, error)

GetTxEvents returns the transaction events associated with the transaction, whose hash is contained in the given output from a transaction command.

It tries to get the transaction hash from the output and then waits for the transaction to be included in a block. It then returns the transaction events.

func GetTxHashFromTxResponse

func GetTxHashFromTxResponse(cdc *codec.ProtoCodec, out string) (string, error)

GetTxHashFromTxResponse parses the transaction hash from the given response.

func ParseDelegationsFromResponse

func ParseDelegationsFromResponse(cdc *codec.ProtoCodec, out string) ([]stakingtypes.Delegation, error)

ParseDelegationsFromResponse parses the delegations from the given response.

func Wait

func Wait(seconds int)

Wait waits for the specified amount of seconds.

Types

type Account

type Account struct {
	Name        string                    `json:"name"`
	Type        string                    `json:"type"`
	Address     string                    `json:"address"`
	PubKey      string                    `json:"pubkey"`
	Delegations []stakingtypes.Delegation `json:"delegations"`
}

Account is the type for a single account.

func FilterAccountsWithDelegations

func FilterAccountsWithDelegations(bin *Binary) ([]Account, error)

FilterAccountsWithDelegations filters the given list of accounts for those, which are used for staking.

func ParseAccountsFromOut

func ParseAccountsFromOut(out string) ([]Account, error)

ParseAccountsFromOut parses the keys from the given output from the keys list command.

type Binary

type Binary struct {
	// Cdc is the codec to be used for the client.
	Cdc *codec.ProtoCodec
	// Home is the home directory of the binary.
	Home string
	// Appd is the name of the binary to be executed, e.g. "evmosd".
	Appd string
	// Accounts are the accounts stored in the local keyring.
	Accounts []Account
	// Logger is a logger to be used within all commands.
	Logger zerolog.Logger
}

Binary is a struct to hold the necessary information to execute commands using a Cosmos SDK-based binary.

func NewBinary

func NewBinary(home, appd string, logger zerolog.Logger) (*Binary, error)

NewBinary returns a new Binary instance.

func NewEvmosTestingBinary

func NewEvmosTestingBinary() (*Binary, error)

NewEvmosTestingBinary returns a new Binary instance with the default home and appd setup for the Evmos local node testing setup.

func (*Binary) GetAccounts

func (bin *Binary) GetAccounts() error

GetAccounts is a method to retrieve the binaries keys from the configured keyring backend and stores it in the Binary struct.

type BinaryCmdArgs

type BinaryCmdArgs struct {
	Subcommand  []string
	Home        string
	From        string
	UseDefaults bool
	Quiet       bool
}

BinaryCmdArgs are the arguments passed to be executed with the Evmos binary.

Jump to

Keyboard shortcuts

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