Documentation ¶
Index ¶
- Constants
- func ChainHome(launchID uint64) (path string)
- func IsChainHomeExist(launchID uint64) (path string, ok bool, err error)
- func SetSPNConfig(config Config, path string) error
- type Binary
- type BinaryCacheList
- type Chain
- func (c Chain) AccountBalance() sdk.Coins
- func (c Chain) AppTOMLPath() (string, error)
- func (c Chain) BinaryName() (name string, err error)
- func (c *Chain) Build(ctx context.Context, cacheStorage cache.Storage) (binaryName string, err error)
- func (c *Chain) CacheBinary(launchID uint64) error
- func (c Chain) ChainID() (string, error)
- func (c Chain) CheckConfigVersion() error
- func (c Chain) CheckRequestChangeParam(ctx context.Context, module, param string, value []byte) error
- func (c Chain) ConfigTOMLPath() (string, error)
- func (c Chain) DefaultGentxPath() (path string, err error)
- func (c Chain) GenesisPath() (path string, err error)
- func (c Chain) GentxsPath() (path string, err error)
- func (c Chain) Home() (path string, err error)
- func (c Chain) ID() (string, error)
- func (c *Chain) ImportAccount(ctx context.Context, name string) (string, error)
- func (c *Chain) Init(ctx context.Context, cacheStorage cache.Storage) error
- func (c Chain) InitAccount(ctx context.Context, v chain.Validator, accountName string) (string, error)
- func (c Chain) IsAccountBalanceFixed() bool
- func (c Chain) IsHomeDirExist() (ok bool, err error)
- func (c Chain) Name() string
- func (c Chain) NodeID(ctx context.Context) (string, error)
- func (c Chain) Prepare(ctx context.Context, cacheStorage cache.Storage, ...) error
- func (c *Chain) SPNConfigPath() (string, error)
- func (c Chain) SetHome(home string)
- func (c Chain) SimulateRequests(ctx context.Context, cacheStorage cache.Storage, ...) (err error)
- func (c Chain) SourceHash() string
- func (c Chain) SourceURL() string
- type Config
- type Option
- type SourceOption
- type TunneledPeer
Constants ¶
const ( SPNCacheDirectory = "spn" BinaryCacheDirectory = "binary-cache" BinaryCacheFilename = "checksums.yml" )
const (
HTTPTunnelChisel = "chisel"
)
const SPNConfigFile = "spn.yml"
Variables ¶
This section is empty.
Functions ¶
func IsChainHomeExist ¶
IsChainHomeExist checks if a home with the provided launchID already exist.
func SetSPNConfig ¶
Types ¶
type Binary ¶
Binary associates launch id with build hash where build hash is sha256(binary, source)..
type BinaryCacheList ¶
type BinaryCacheList struct {
CachedBinaries []Binary `yaml:"cached_binaries"`
}
func (*BinaryCacheList) Set ¶
func (l *BinaryCacheList) Set(launchID uint64, buildHash string)
type Chain ¶
type Chain struct {
// contains filtered or unexported fields
}
Chain represents a network blockchain and lets you interact with its source code and binary.
func New ¶
func New(ctx context.Context, ar cosmosaccount.Registry, source SourceOption, options ...Option) (*Chain, error)
New initializes a network blockchain from source and options.
func (Chain) AccountBalance ¶
func (Chain) AppTOMLPath ¶
func (Chain) BinaryName ¶
func (*Chain) Build ¶
func (c *Chain) Build(ctx context.Context, cacheStorage cache.Storage) (binaryName string, err error)
Build builds chain sources, also checks if source was already built.
func (*Chain) CacheBinary ¶
CacheBinary caches last built chain binary associated with launch id.
func (Chain) CheckConfigVersion ¶
CheckConfigVersion checks that the config version is the latest.
func (Chain) CheckRequestChangeParam ¶
func (c Chain) CheckRequestChangeParam( ctx context.Context, module, param string, value []byte, ) error
CheckRequestChangeParam builds the genesis for the chain from the launch approved requests.
func (Chain) ConfigTOMLPath ¶
func (Chain) DefaultGentxPath ¶
func (Chain) GenesisPath ¶
func (Chain) GentxsPath ¶
func (*Chain) ImportAccount ¶
ImportAccount imports an account from Starport into the chain. we first export the account into a temporary key file and import it with the chain CLI.
func (*Chain) Init ¶
Init initializes blockchain by building the binaries and running the init command, creates the initial genesis of the chain, and sets up a validator key.
func (Chain) InitAccount ¶
func (c Chain) InitAccount(ctx context.Context, v chain.Validator, accountName string) (string, error)
InitAccount initializes an account for the blockchain and issue a gentx in config/gentx/gentx.json.
func (Chain) IsAccountBalanceFixed ¶
func (Chain) IsHomeDirExist ¶
func (Chain) Prepare ¶
func (c Chain) Prepare( ctx context.Context, cacheStorage cache.Storage, gi networktypes.GenesisInformation, rewardsInfo networktypes.Reward, spnChainID string, lastBlockHeight, consumerUnbondingTime int64, ) error
Prepare prepares the chain to be launched from genesis information.
func (*Chain) SPNConfigPath ¶
func (Chain) SimulateRequests ¶
func (c Chain) SimulateRequests( ctx context.Context, cacheStorage cache.Storage, gi networktypes.GenesisInformation, reqs []networktypes.Request, ) (err error)
SimulateRequests simulates the genesis creation and the start of the network from the provided requests.
func (Chain) SourceHash ¶
type Config ¶
type Config struct {
TunneledPeers []TunneledPeer `json:"tunneled_peers" yaml:"tunneled_peers"`
}
func GetSPNConfig ¶
type Option ¶
type Option func(*Chain)
Option sets other initialization options.
func CheckDependencies ¶
func CheckDependencies() Option
CheckDependencies checks that cached Go dependencies of the chain have not been modified since they were downloaded. Dependencies are checked by running `go mod verify`.
func CollectEvents ¶
CollectEvents collects events from the chain.
func WithGenesisFromConfig ¶
WithGenesisFromConfig provides a config file for the initial genesis of the chain blockchain.
func WithGenesisFromURL ¶
WithGenesisFromURL provides a genesis url for the initial genesis of the chain blockchain.
func WithKeyringBackend ¶
func WithKeyringBackend(keyringBackend chaincmd.KeyringBackend) Option
WithKeyringBackend provides the keyring backend to use to initialize the blockchain.
type SourceOption ¶
type SourceOption func(*Chain)
SourceOption sets the source for blockchain.
func SourceLaunch ¶
func SourceLaunch(launch networktypes.ChainLaunch) SourceOption
SourceLaunch returns a source option for initializing a chain from a launch.
func SourceRemote ¶
func SourceRemote(url string) SourceOption
SourceRemote sets the default branch on a remote as source for the blockchain.
func SourceRemoteBranch ¶
func SourceRemoteBranch(url, branch string) SourceOption
SourceRemoteBranch sets the branch on a remote as source for the blockchain.
func SourceRemoteHash ¶
func SourceRemoteHash(url, hash string) SourceOption
SourceRemoteHash uses a remote hash as source for the blockchain.
func SourceRemoteTag ¶
func SourceRemoteTag(url, tag string) SourceOption
SourceRemoteTag sets the tag on a remote as source for the blockchain.
type TunneledPeer ¶
type TunneledPeer struct { // Name represents tunnel type e.g. "chisel" Name string `json:"name" yaml:"name"` // Address represents http address of the tunnel e.g. "https://tendermint-starport-i5e75cplx02.ws-eu31.gitpod.io/" Address string `json:"address" yaml:"address"` // NodeID tendermint node id of the node behind the tunnel e.g. "e6a59e37b2761f26a21c9168f78a7f2b07c120c7" NodeID string `json:"node_id" yaml:"node_id"` // LocalPort specifies port which has to be used for local tunnel client LocalPort string `json:"local_port" yaml:"local_port"` }
TunneledPeer represents http tunnel to a peer which can't be reached via regular tcp connection.