relayer

package
v0.0.0-...-d298eb8 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: Apache-2.0 Imports: 19 Imported by: 1

Documentation

Index

Constants

View Source
const (
	TransferPort      = "transfer"
	TransferVersion   = "ics20-1"
	OrderingUnordered = "ORDER_UNORDERED"
	OrderingOrdered   = "ORDER_ORDERED"
)

Variables

View Source
var ErrLinkedPath = errors.New("path already linked")

ErrLinkedPath indicates that an IBC path is already liked.

Functions

func PathID

func PathID(srcChainID, dstChainID string) string

PathID creates path name from chain ids.

Types

type Account

type Account struct {
	// Address of the account.
	Address string `json:"address"`
}

Account represents an account in relayer.

type Chain

type Chain struct {
	// ID is id of the chain.
	ID string
	// contains filtered or unexported fields
}

Chain represents a chain in relayer.

func (*Chain) Config

func (c *Chain) Config() relayerconfig.Chain

func (*Chain) Connect

func (c *Chain) Connect(dst *Chain, options ...ChannelOption) (id string, err error)

Connect connects dst chain to c chain and creates a path in between in offline mode. it returns the path id on success otherwise, returns with a non-nil error.

func (*Chain) EnsureChainSetup

func (c *Chain) EnsureChainSetup(ctx context.Context) error

EnsureChainSetup sets up the new or existing chain.

func (*Chain) TryRetrieve

func (c *Chain) TryRetrieve(ctx context.Context) (sdk.Coins, error)

TryRetrieve tries to receive some coins to the account and returns the total balance.

type ChannelOption

type ChannelOption func(*channelOptions)

ChannelOption is used to configure relayer IBC connection.

func Ordered

func Ordered() ChannelOption

Ordered sets the new channel as ordered.

func SourcePort

func SourcePort(port string) ChannelOption

SourcePort configures the source port of the new channel.

func SourceVersion

func SourceVersion(version string) ChannelOption

SourceVersion configures the source version of the new channel.

func TargetPort

func TargetPort(port string) ChannelOption

TargetPort configures the target port of the new channel.

func TargetVersion

func TargetVersion(version string) ChannelOption

TargetVersion configures the target version of the new channel.

type Option

type Option func(*Chain)

Option is used to configure Chain.

func WithAddressPrefix

func WithAddressPrefix(addressPrefix string) Option

WithAddressPrefix configures the account key prefix used on the chain.

func WithClientID

func WithClientID(clientID string) Option

WithClientID configures the chain client id.

func WithFaucet

func WithFaucet(address string) Option

WithFaucet provides a faucet address for chain to get tokens from. when it isn't provided.

func WithGasLimit

func WithGasLimit(limit int64) Option

WithGasLimit gives the gas limit to use to send ibc transactions to the chain.

func WithGasPrice

func WithGasPrice(gasPrice string) Option

WithGasPrice gives the gas price to use to send ibc transactions to the chain.

type Relayer

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

Relayer is an IBC relayer.

func New

New creates a new IBC relayer and uses ca to access accounts.

func (Relayer) GetPath

func (r Relayer) GetPath(_ context.Context, id string) (relayerconf.Path, error)

GetPath returns a path by its id.

func (r Relayer) Link(
	ctx context.Context,
	conf relayerconf.Config,
	pathID string,
) (relayerconf.Config, error)

Link links chain path to each other.

func (Relayer) LinkPaths

func (r Relayer) LinkPaths(
	ctx context.Context,
	pathIDs ...string,
) error

LinkPaths links all chains that has a path from config file to each other. paths are optional and acts as a filter to only link some chains. calling Link multiple times for the same paths does not have any side effects.

func (Relayer) ListPaths

func (r Relayer) ListPaths(_ context.Context) ([]relayerconf.Path, error)

ListPaths list all the paths.

func (Relayer) NewChain

func (r Relayer) NewChain(accountName, rpcAddress string, options ...Option) (
	*Chain, cosmosaccount.Account, error,
)

NewChain creates a new chain on relayer or uses the existing matching chain.

func (Relayer) Start

func (r Relayer) Start(
	ctx context.Context,
	conf relayerconf.Config,
	pathID string,
	postExecute func(path relayerconf.Config) error,
) error

Start relays packets for linked path until ctx is canceled.

func (Relayer) StartPaths

func (r Relayer) StartPaths(ctx context.Context, pathIDs ...string) error

StartPaths relays packets for linked paths from config file until ctx is canceled.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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