chainutils

package
v1.40.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2025 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	P2pPortName = "p2p"
	P2pPort     = 26656

	RpcPortName = "rpc"
	RpcPort     = 26657

	LcdPortName = "lcd"
	LcdPort     = 1317

	GrpcPortName = "grpc"
	GrpcPort     = 9090

	PrometheusPortName = "prometheus"
	PrometheusPort     = 26660

	PrivValPortName = "privvalidator"
	PrivValPort     = 26659

	GenesisFilename = "genesis.json"
)

Variables

This section is empty.

Functions

func AccountAddressFromValidatorAddress

func AccountAddressFromValidatorAddress(valAddr, valPrefix, accPrefix string) (string, error)

func ExtractChainIdFromGenesis

func ExtractChainIdFromGenesis(genesis string) (string, error)

func RetrieveGenesisFromNodeRPC

func RetrieveGenesisFromNodeRPC(url string, sha *string) (string, error)

func RetrieveGenesisFromURL

func RetrieveGenesisFromURL(url string, sha *string) (string, error)

Types

type Account

type Account struct {
	Mnemonic         string
	Address          string
	ValidatorAddress string
}

func AccountFromMnemonic

func AccountFromMnemonic(mnemonic, accPrefix, valPrefix, hdPath string) (*Account, error)

func CreateAccount

func CreateAccount(accPrefix, valPrefix, hdPath string) (*Account, error)

type AccountAssets

type AccountAssets struct {
	Address string
	Assets  []string
}

type App

type App struct {
	NodeSelector map[string]string
	Affinity     *corev1.Affinity
	// contains filtered or unexported fields
}

func NewApp

func NewApp(client *kubernetes.Clientset, scheme *runtime.Scheme, cfg *rest.Config,
	owner metav1.Object, sdkVersion appsv1.SdkVersion, options ...Option) (*App, error)

func (*App) CreateValidator

func (a *App) CreateValidator(
	ctx context.Context,
	pubKey string,
	account *Account,
	nodeInfo *NodeInfo,
	params *Params,
	node string,
) error

func (*App) GenerateConfigFiles

func (a *App) GenerateConfigFiles(ctx context.Context) (map[string]string, error)

func (*App) InitPvcData

func (a *App) InitPvcData(ctx context.Context, pvc *corev1.PersistentVolumeClaim, timeout time.Duration, initCommands ...*InitCommand) error

func (*App) LoadGenesisFromConfigMap

func (a *App) LoadGenesisFromConfigMap(ctx context.Context, configMapName string) (string, error)

func (*App) NewGenesis

func (a *App) NewGenesis(ctx context.Context,
	privkeySecret string,
	account *Account,
	nodeInfo *NodeInfo,
	params *Params,
	initCommands ...*InitCommand,
) (string, error)

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(host string) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) GetBlockHash

func (c *Client) GetBlockHash(ctx context.Context, height int64) (string, error)

func (*Client) GetLatestBlock

func (c *Client) GetLatestBlock(ctx context.Context) (*tmtypes.Block, error)

func (*Client) GetNextUpgrade

func (c *Client) GetNextUpgrade(ctx context.Context) (*upgradetypes.Plan, error)

func (*Client) GetNodeStatus

func (c *Client) GetNodeStatus(ctx context.Context) (*coretypes.ResultStatus, error)

func (*Client) GetValidators

func (c *Client) GetValidators(ctx context.Context) ([]stakingTypes.Validator, error)

func (*Client) IsNodeSyncing

func (c *Client) IsNodeSyncing(ctx context.Context) (bool, error)

func (*Client) NodeInfo

func (c *Client) NodeInfo(ctx context.Context) (*p2p.DefaultNodeInfo, error)

func (*Client) QueryValidator

func (c *Client) QueryValidator(ctx context.Context, address string) (*stakingTypes.Validator, error)

type InitCommand

type InitCommand struct {
	Image   string
	Command []string
	Args    []string
}

type NodeInfo

type NodeInfo struct {
	Moniker  string
	Details  *string
	Website  *string
	Identity *string
}

type Option

type Option func(*App)

func WithAffinityConfig

func WithAffinityConfig(affinity *corev1.Affinity) Option

func WithBinary

func WithBinary(name string) Option

func WithImage

func WithImage(image string) Option

func WithImagePullPolicy

func WithImagePullPolicy(p corev1.PullPolicy) Option

func WithNodeSelector

func WithNodeSelector(selector map[string]string) Option

func WithPriorityClass

func WithPriorityClass(name string) Option

type Params

type Params struct {
	ChainID                 string
	Assets                  []string
	StakeAmount             string
	Accounts                []AccountAssets
	UnbondingTime           string
	VotingPeriod            string
	CommissionMaxChangeRate string
	CommissionMaxRate       string
	CommissionRate          string
	MinSelfDelegation       *string
	GasPrices               string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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