setup

package
v0.0.0-...-3cdce6e Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2023 License: MIT Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Eventually

func Eventually(condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) error

func GetBalance

func GetBalance(chain *Client, address string) (sdk.Coins, error)

func IBCTransferTokens

func IBCTransferTokens(chain1, chain2 *Client, chain2Addr string, amount int) error

IBCTransferTokens will transfer chain native token from chain1 to chain2 at given address

func InstantiateContract

func InstantiateContract(chain *Client, codeID uint64, label string, initMsg []byte, funds ...sdk.Coin) (map[uint64]string, error)

func JustContracts

func JustContracts(provider, consumer, configFile, wasmContractPath string, wasmContractGZipped bool) error

func MeshSecurity

func MeshSecurity(provider, consumer, configFile, wasmContractPath string, wasmContractGZipped bool) (*ProviderClient, *ConsumerClient, error)

func Querier

func Querier(chain *Client) func(contract string, query Query) map[string]any

func SmartQuery

func SmartQuery(chain *Client, contractAddr string, queryMsg interface{}, response interface{}) error

SmartQuery This will serialize the query message and submit it to the contract. The response is parsed into the provided interface. Usage: SmartQuery(addr, QueryMsg{Foo: 1}, &response)

func StoreCode

func StoreCode(chain *Client, byteCode []byte) (wasmtypes.MsgStoreCodeResponse, error)

todo

func StoreCodeFile

func StoreCodeFile(chain *Client, filename string) (wasmtypes.MsgStoreCodeResponse, error)

Types

type Chain

type Chain struct {
	Name          string  `name:"name" json:"name" yaml:"name"`
	Type          string  `name:"type" json:"type" yaml:"type"`
	NumValidators int     `name:"num-validators" json:"num_validators" yaml:"numValidators"`
	Ports         Port    `name:"ports" json:"ports" yaml:"ports"`
	Upgrade       Upgrade `name:"upgrade" json:"upgrade" yaml:"upgrade"`
}

func (*Chain) GetRESTAddr

func (c *Chain) GetRESTAddr() string

func (*Chain) GetRPCAddr

func (c *Chain) GetRPCAddr() string

type ChainClient

type ChainClient struct {
	Logger *zap.Logger
	Config *Config

	Address     string
	ChainID     string
	ChainConfig *lens.ChainClientConfig
	Client      *lens.ChainClient
}

func NewChainClient

func NewChainClient(logger *zap.Logger, config *Config, chainID string) (*ChainClient, error)

func (*ChainClient) CreateRandWallet

func (c *ChainClient) CreateRandWallet(keyName string) (string, error)

func (*ChainClient) CreateWallet

func (c *ChainClient) CreateWallet(keyName, mnemonic string) (string, error)

func (*ChainClient) CreditFromFaucet

func (c *ChainClient) CreditFromFaucet(address string) error

func (*ChainClient) CustomSendMsg

func (c *ChainClient) CustomSendMsg(ctx context.Context, keyName string, msg sdk.Msg, memo string) (*sdk.TxResponse, error)

func (*ChainClient) CustomSendMsgs

func (c *ChainClient) CustomSendMsgs(ctx context.Context, keyName string, msgs []sdk.Msg, memo string) (*sdk.TxResponse, error)

CustomSendMsgs wraps the msgs in a StdTx, signs and sends it. An error is returned if there was an issue sending the transaction. A successfully sent, but failed transaction will not return an error. If a transaction is successfully sent, the result of the execution of that transaction will be logged. A boolean indicating if a transaction was successfully sent and executed successfully is returned.

func (*ChainClient) GetChainAssets

func (c *ChainClient) GetChainAssets() ([]*pb.ChainAsset, error)

GetChainAssets fetches the assets from chain registry at `/chains/{chain-id}/assets` endpoint

func (*ChainClient) GetChainDenom

func (c *ChainClient) GetChainDenom() (string, error)

func (*ChainClient) GetChainID

func (c *ChainClient) GetChainID() string

func (*ChainClient) GetChainKeys

func (c *ChainClient) GetChainKeys() (*pb.Keys, error)

GetChainKeys fetches keys from the chain registry at `/chains/{chain-id}/keys` endpoint

func (*ChainClient) GetChainRegistry

func (c *ChainClient) GetChainRegistry() (*pb.ChainRegistry, error)

GetChainRegistry fetches the chain registry from the registry at `/chains/{chain-id}` endpoint

func (*ChainClient) GetGenesisMnemonic

func (c *ChainClient) GetGenesisMnemonic() (string, error)

GetGenesisMnemonic fetches the mnemonic from GetChainKeys and returns the first mnemonic in genesis list

func (*ChainClient) GetHeight

func (c *ChainClient) GetHeight() (int64, error)

func (*ChainClient) GetIBCChannel

func (c *ChainClient) GetIBCChannel(chain2 string) (*pb.ChannelData, error)

func (*ChainClient) GetIBCInfo

func (c *ChainClient) GetIBCInfo(chain2 string) (*pb.IBCData, error)

func (*ChainClient) GetRPCAddr

func (c *ChainClient) GetRPCAddr() string

func (*ChainClient) GetStatus

func (c *ChainClient) GetStatus() (*coretypes.ResultStatus, error)

func (*ChainClient) Initialize

func (c *ChainClient) Initialize() error

func (*ChainClient) MustGetChainDenom

func (c *ChainClient) MustGetChainDenom() string

func (*ChainClient) SendMsg

func (c *ChainClient) SendMsg(ctx context.Context, msg sdk.Msg, memo string) (*sdk.TxResponse, error)

func (*ChainClient) SendMsgs

func (c *ChainClient) SendMsgs(ctx context.Context, msgs []sdk.Msg, memo string) (*sdk.TxResponse, error)

SendMsgs wraps the msgs in a StdTx, signs and sends it. An error is returned if there was an issue sending the transaction. A successfully sent, but failed transaction will not return an error. If a transaction is successfully sent, the result of the execution of that transaction will be logged. A boolean indicating if a transaction was successfully sent and executed successfully is returned.

type ChainClients

type ChainClients []*ChainClient

func NewChainClients

func NewChainClients(logger *zap.Logger, config *Config) (ChainClients, error)

func (ChainClients) GetChainClient

func (cc ChainClients) GetChainClient(chainID string) (*ChainClient, error)

GetChainClient returns a chain client pointer for the given chain id

type Client

type Client struct {
	Logger *zap.Logger
	Config *Config

	Name           string
	Address        string
	ChainID        string
	Denom          string
	StarshipClient *ChainClient
	ChainConfig    *lens.ChainClientConfig
	Client         *lens.ChainClient
}

func NewClient

func NewClient(name string, logger *zap.Logger, starshipClient *ChainClient, modulesBasics []module.AppModuleBasic) (*Client, error)

func (*Client) CreateRandWallet

func (c *Client) CreateRandWallet(keyName string) (string, error)

func (*Client) CreateWallet

func (c *Client) CreateWallet(keyName, mnemonic string) (string, error)

func (*Client) GetChainDenom

func (c *Client) GetChainDenom() (string, error)

func (*Client) GetChainID

func (c *Client) GetChainID() string

func (*Client) GetHeight

func (c *Client) GetHeight() (int64, error)

func (*Client) GetIBCChannel

func (c *Client) GetIBCChannel(chain2 string) (*pb.ChannelData, error)

func (*Client) GetIBCInfo

func (c *Client) GetIBCInfo(chain2 string) (*pb.IBCData, error)

GetIBCInfo will fetch Fetch IBC info from chain registry

func (*Client) Initialize

func (c *Client) Initialize() error

func (*Client) StakeTokens

func (c *Client) StakeTokens(valAddr string, amount int, denom string) error

StakeTokens self stakes tokens from the client address

func (*Client) WaitForHeight

func (c *Client) WaitForHeight(t *testing.T, height int64)

WaitForHeight will wait till the Chain reaches the block height

func (*Client) WaitForTx

func (c *Client) WaitForTx(t *testing.T, txHex string)

WaitForTx will wait for the tx to complete, fail if not able to find tx

type CmdRunner

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

CmdRunner will help you to run admin commands on

func NewCmdRunner

func NewCmdRunner(logger *zap.Logger, config *Config) (*CmdRunner, error)

func (*CmdRunner) GetPodFromName

func (c *CmdRunner) GetPodFromName(name string) (string, error)

GetPodFromName will return the full pod name from a given name by querying the kubernetes cluster for the given name

func (*CmdRunner) RunExec

func (c *CmdRunner) RunExec(name string, cmd string) (string, error)

RunExec runs an exec command directly inside the container we specify. One can either provide the full container name, or just the `name` as defined in the config file.

type Config

type Config struct {
	Chains   []*Chain   `name:"chains" json:"chains" yaml:"chains"`
	Relayers []*Relayer `name:"relayers" json:"relayers" yaml:"relayers"`
	Explorer *Feature   `name:"explorer" json:"explorer" yaml:"explorer"`
	Registry *Feature   `name:"registry" json:"registry" yaml:"registry"`
}

Config is the struct for the config.yaml setup file todo: move this to a more common place, outside just tests todo: can be moved to proto defination

func (*Config) GetChain

func (c *Config) GetChain(chainId string) *Chain

GetChain returns the Chain object pointer for the given chain id

func (*Config) HasChainId

func (c *Config) HasChainId(chainId string) bool

HasChainId returns true if chain id found in list of chains

type ConsumerClient

type ConsumerClient struct {
	Chain     *Client
	Contracts *ConsumerContract
	// contains filtered or unexported fields
}

func NewConsumerClient

func NewConsumerClient(chain *Client, wasmContractPath string, wasmContractGZipped bool) *ConsumerClient

func (*ConsumerClient) BootstrapContracts

func (p *ConsumerClient) BootstrapContracts(remoteDenom string) (*ConsumerContract, error)

func (*ConsumerClient) ExecNewEpoch

func (p *ConsumerClient) ExecNewEpoch()

func (*ConsumerClient) MustExecGovProposal

func (p *ConsumerClient) MustExecGovProposal(msg *types.MsgSetVirtualStakingMaxCap)

MustExecGovProposal submit and vote yes on proposal

func (*ConsumerClient) QueryMaxCap

func (*ConsumerClient) StoreContracts

func (p *ConsumerClient) StoreContracts() ([]uint64, error)

type ConsumerContract

type ConsumerContract struct {
	Staking   string
	PriceFeed string
	Converter string
}

type Feature

type Feature struct {
	Enabled bool   `name:"enabled" json:"enabled" yaml:"enabled"`
	Image   string `name:"image" json:"image" yaml:"image"`
	Ports   Port   `name:"ports" json:"ports" yaml:"ports"`
}

func (*Feature) GetRESTAddr

func (f *Feature) GetRESTAddr() string

func (*Feature) GetRPCAddr

func (f *Feature) GetRPCAddr() string

type HighLowType

type HighLowType struct {
	High, Low int
}

func ParseHighLow

func ParseHighLow(a any) HighLowType

type Port

type Port struct {
	Rest    int `name:"rest" json:"rest" yaml:"rest"`
	Rpc     int `name:"rpc" json:"rpc" yaml:"rpc"`
	Grpc    int `name:"grpc" json:"grpc" yaml:"grpc"`
	Exposer int `name:"exposer" json:"exposer" yaml:"exposer"`
	Faucet  int `name:"faucet" json:"faucet" yaml:"faucet"`
}

type ProviderClient

type ProviderClient struct {
	Chain     *Client
	Contracts *ProviderContracts
	// contains filtered or unexported fields
}

func NewProviderClient

func NewProviderClient(chain *Client, wasmContractPath string, wasmContractGZipped bool) *ProviderClient

func (*ProviderClient) BootstrapContracts

func (p *ProviderClient) BootstrapContracts(connId, portID, rewardDenom string) (*ProviderContracts, error)

func (ProviderClient) MustExecExtStaking

func (p ProviderClient) MustExecExtStaking(payload string, funds ...sdk.Coin) (*sdk.TxResponse, error)

func (ProviderClient) MustExecVault

func (p ProviderClient) MustExecVault(payload string, funds ...sdk.Coin) (*sdk.TxResponse, error)

func (ProviderClient) MustFailExecVault

func (p ProviderClient) MustFailExecVault(payload string, funds ...sdk.Coin) error

func (ProviderClient) QueryExtStaking

func (p ProviderClient) QueryExtStaking(q Query) map[string]any

func (ProviderClient) QueryVault

func (p ProviderClient) QueryVault(q Query) map[string]any

func (ProviderClient) QueryVaultFreeBalance

func (p ProviderClient) QueryVaultFreeBalance() int

func (*ProviderClient) StoreContracts

func (p *ProviderClient) StoreContracts() ([]uint64, error)

type ProviderContracts

type ProviderContracts struct {
	Vault                 string
	NativeStakingContract string
	ExternalStaking       string
}

type Query

type Query map[string]map[string]any

type Relayer

type Relayer struct {
	Name     string   `name:"name" json:"name" yaml:"name"`
	Type     string   `name:"type" json:"type" yaml:"type"`
	Replicas int      `name:"replicas" json:"replicas" yaml:"replicas"`
	Chains   []string `name:"chains" json:"chains" yaml:"chains"`
}

type Upgrade

type Upgrade struct {
	Enabled  bool   `name:"eanbled" json:"enabled" yaml:"enabled"`
	Type     string `name:"type" json:"type" yaml:"type"`
	Genesis  string `name:"genesis" json:"genesis" yaml:"genesis"`
	Upgrades []struct {
		Name    string `name:"name" json:"name" yaml:"name"`
		Version string `name:"version" json:"version" yaml:"version"`
	} `name:"upgrades" json:"upgrades" yaml:"upgrades"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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