interchaintest

package module
v0.0.0-...-4c51b1d Latest Latest
Warning

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

Go to latest
Published: May 1, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FaucetAccountKeyName = "faucet"
)

Variables

This section is empty.

Functions

func DockerSetup

DockerSetup returns a new Docker Client and the ID of a configured network, associated with t.

If any part of the setup fails, t.Fatal is called.

func GetAndFundTestUserWithMnemonic

func GetAndFundTestUserWithMnemonic(
	ctx context.Context,
	keyNamePrefix, mnemonic string,
	amount math.Int,
	chain types.Chain,
) (types.Wallet, error)

GetAndFundTestUserWithMnemonic restores a user using the given mnemonic and funds it with the native chain denom. The caller should wait for some blocks to complete before the funds will be accessible.

func GetAndFundTestUsers

func GetAndFundTestUsers(
	t *testing.T,
	ctx context.Context,
	keyNamePrefix string,
	amount math.Int,
	chains ...types.Chain,
) []types.Wallet

GetAndFundTestUsers generates and funds chain users with the native chain denom. The caller should wait for some blocks to complete before the funds will be accessible.

func NewChain

func NewChain(log *zap.Logger, testName string, client *client.Client, networkID string, spec *ChainSpec) (types.Chain, error)

NewChain creates a single chain based on the provided ChainSpec. This is a simpler alternative to using NewBuiltinChainFactory when only a single chain is needed.

Example:

chain := interchaintest.NewChain(logger, t.Name(), client, networkID, &interchaintest.ChainSpec{
	Name:          "celestia",
	ChainName:     "celestia",
	Version:       "v4.0.0-rc1",
	NumValidators: &numValidators,
	NumFullNodes:  &numFullNodes,
	Config: ibc.Config{
		Type:                "cosmos",
		ChainID:             "celestia",
		// ... other config options
	},
})

Types

type ChainSpec

type ChainSpec struct {
	// Name is the name of the built-in config to use as a basis for this chain spec.
	// Required unless every other field is set.
	Name string

	// ChainName sets the Name of the embedded ibc.Config, i.e. the name of the chain.
	ChainName string

	// Version of the docker image to use.
	// Must be set.
	Version string

	// NoHostMount is a pointers in ChainSpec
	// so zero-overrides can be detected from omitted overrides.
	NoHostMount *bool

	// Embedded Config to allow for simple JSON definition of a ChainSpec.
	types.Config

	// How many validators and how many full nodes to use
	// when instantiating the chain.
	// If unspecified, NumValidators defaults to 2 and NumFullNodes defaults to 1.
	NumValidators, NumFullNodes *int
}

ChainSpec is a wrapper around a types.Config that allows callers to easily reference one of the built-in chain configs and optionally provide overrides for some settings.

Directories

Path Synopsis
chain
cosmos
Package cosmos provides an implementation of ibc.Chain backed by Cosmos-based blockchains.
Package cosmos provides an implementation of ibc.Chain backed by Cosmos-based blockchains.
Package dockerutil contains helpers for interacting with Docker containers.
Package dockerutil contains helpers for interacting with Docker containers.
testutil

Jump to

Keyboard shortcuts

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