Documentation ¶
Index ¶
- Variables
- func CreateMnemonic() (string, error)
- func GenerateRandomBytes(n int) ([]byte, error)
- func GenerateRandomString(s int) (string, error)
- func OrderFromString(order string) ibctypes.Order
- func ParseEvents(e string) ([]string, error)
- func PathsSet(chains ...*Chain) bool
- func QueryChannelPair(src, dst *Chain, srcH, dstH int64) (map[string]chanTypes.ChannelResponse, error)
- func QueryClientConsensusStatePair(src, dst *Chain, srcH, dstH, srcClientConsH, dstClientConsH int64) (map[string]clientTypes.ConsensusStateResponse, error)
- func QueryClientStatePair(src, dst *Chain) (map[string]*clientTypes.StateResponse, error)
- func QueryConnectionPair(src, dst *Chain, srcH, dstH int64) (map[string]connTypes.ConnectionResponse, error)
- func QueryLatestHeights(chains ...*Chain) (map[string]int64, error)
- func RandLowerCaseLetterString(length int) string
- func RegisterCodec(cdc *codec.Codec)
- func RunStrategy(src, dst *Chain, strategy Strategy, ordered bool) (func(), error)
- func UpdatesWithHeaders(chains ...*Chain) (map[string]*tmclient.Header, error)
- type Chain
- func (c *Chain) AddPath(clientID, connectionID, channelID, port, order string) error
- func (src *Chain) BroadcastTxCommit(txBytes []byte) (sdk.TxResponse, error)
- func (src *Chain) BuildAndSignTx(msgs []sdk.Msg) ([]byte, error)
- func (src *Chain) BuildAndSignTxWithKey(datagram []sdk.Msg, keyName string) ([]byte, error)
- func (src *Chain) CloseChannel(dst *Chain, to time.Duration) error
- func (src *Chain) CloseChannelStep(dst *Chain) (*RelayMsgs, error)
- func (src *Chain) CreateChannel(dst *Chain, ordered bool, to time.Duration) error
- func (src *Chain) CreateChannelStep(dst *Chain, ordering ibctypes.Order) (*RelayMsgs, error)
- func (src *Chain) CreateClients(dst *Chain) (err error)
- func (src *Chain) CreateConnection(dst *Chain, to time.Duration) error
- func (src *Chain) CreateConnectionStep(dst *Chain) (*RelayMsgs, error)
- func (src *Chain) CreateTestKey() error
- func (c *Chain) DeleteLiteDB() error
- func (c *Chain) ErrCantSetPath(err error) error
- func (c *Chain) ErrPathNotSet() error
- func (src *Chain) Error(err error)
- func (src *Chain) FaucetHandler(fromKey sdk.AccAddress, amount sdk.Coin) func(w http.ResponseWriter, r *http.Request)
- func (c *Chain) ForceInitLite() error
- func (src *Chain) GetAddress() (sdk.AccAddress, error)
- func (c *Chain) GetLatestLiteHeader() (*tmclient.Header, error)
- func (c *Chain) GetLatestLiteHeight() (int64, error)
- func (c *Chain) GetLiteSignedHeaderAtHeight(height int64) (*tmclient.Header, error)
- func (src *Chain) GetRPCPort() string
- func (src *Chain) GetTimeout() time.Duration
- func (src *Chain) GetTrustingPeriod() time.Duration
- func (src *Chain) Init(homePath string, cdc *codecstd.Codec, amino *aminocodec.Codec, ...) error
- func (c *Chain) InitLiteClient(db *dbm.GoLevelDB, trustOpts lite.TrustOptions) (*lite.Client, error)
- func (src *Chain) KeyExists(name string) bool
- func (src *Chain) ListenRPCEmitJSON(tx, block, data bool) func()
- func (c *Chain) LiteClient(db *dbm.GoLevelDB, trustOpts lite.TrustOptions) (*lite.Client, error)
- func (c *Chain) LiteClientWithoutTrust(db *dbm.GoLevelDB) (*lite.Client, error)
- func (src *Chain) Log(s string)
- func (c *Chain) LogFailedTx(res sdk.TxResponse, err error, msgs []sdk.Msg)
- func (c *Chain) LogSuccessTx(res sdk.TxResponse, msgs []sdk.Msg)
- func (src *Chain) MustGetAddress() sdk.AccAddress
- func (c *Chain) NewLiteDB() (db *dbm.GoLevelDB, df func(), err error)
- func (src *Chain) PacketMsg(dst *Chain, xferPacket []byte, timeout, timeoutStamp uint64, seq int64, ...) sdk.Msg
- func (c *Chain) PathSet() bool
- func (src *Chain) Print(toPrint interface{}, text, indent bool) error
- func (c *Chain) QueryABCI(req abci.RequestQuery) (res abci.ResponseQuery, err error)
- func (c *Chain) QueryBalance(keyName string) (sdk.Coins, error)
- func (c *Chain) QueryChannel(height int64) (chanRes chanTypes.ChannelResponse, err error)
- func (c *Chain) QueryChannels(page, limit int) ([]chanTypes.IdentifiedChannel, error)
- func (c *Chain) QueryClientConsensusState(srcHeight, srcClientConsHeight int64) (clientTypes.ConsensusStateResponse, error)
- func (c *Chain) QueryClientState() (*clientTypes.StateResponse, error)
- func (c *Chain) QueryClients(page, limit int) ([]clientExported.ClientState, error)
- func (c *Chain) QueryConnection(height int64) (connTypes.ConnectionResponse, error)
- func (c *Chain) QueryConnectionChannels(connectionID string, page, limit int) ([]chanTypes.IdentifiedChannel, error)
- func (c *Chain) QueryConnections(page, limit int) (conns []connTypes.ConnectionEnd, err error)
- func (c *Chain) QueryConnectionsUsingClient(height int64) (clientConns connTypes.ClientConnectionsResponse, err error)
- func (c *Chain) QueryConsensusState(height int64) (*tmclient.ConsensusState, error)
- func (c *Chain) QueryHeaderAtHeight(height int64) (*tmclient.Header, error)
- func (c *Chain) QueryLatestHeader() (out *tmclient.Header, err error)
- func (c *Chain) QueryLatestHeight() (int64, error)
- func (c *Chain) QueryNextSeqRecv(height int64) (recvRes chanTypes.RecvResponse, err error)
- func (c *Chain) QueryNextSeqSend(height int64) (uint64, error)
- func (c *Chain) QueryPacketAck(height, seq int64) (comRes CommitmentResponse, err error)
- func (c *Chain) QueryPacketCommitment(height, seq int64) (comRes CommitmentResponse, err error)
- func (c *Chain) QueryTx(hashHex string) (sdk.TxResponse, error)
- func (c *Chain) QueryTxs(height uint64, page, limit int, events []string) (*sdk.SearchTxsResult, error)
- func (c *Chain) QueryWithData(p string, d []byte) (byt []byte, i int64, err error)
- func (src *Chain) SendAndPrint(txs []sdk.Msg, text, indent bool) (err error)
- func (src *Chain) SendMsg(datagram sdk.Msg) (sdk.TxResponse, error)
- func (src *Chain) SendMsgWithKey(datagram sdk.Msg, keyName string) (res sdk.TxResponse, err error)
- func (src *Chain) SendMsgs(datagrams []sdk.Msg) (res sdk.TxResponse, err error)
- func (src *Chain) SendPacket(dst *Chain, packetData []byte) error
- func (src *Chain) SendTransferBothSides(dst *Chain, amount sdk.Coin, dstAddr sdk.AccAddress, source bool) error
- func (src *Chain) SendTransferMsg(dst *Chain, amount sdk.Coin, dstAddr sdk.AccAddress, source bool) error
- func (c *Chain) SetPath(p *PathEnd) error
- func (src *Chain) Start() error
- func (src *Chain) StatusErr() error
- func (src *Chain) String() string
- func (src *Chain) Subscribe(query string) (<-chan ctypes.ResultEvent, context.CancelFunc, error)
- func (c *Chain) TrustNodeInitClient(db *dbm.GoLevelDB) (*lite.Client, error)
- func (c *Chain) TrustOptions(height int64, hash []byte) lite.TrustOptions
- func (src *Chain) Update(key, value string) (out *Chain, err error)
- func (c *Chain) UpdateLiteWithHeader() (*tmclient.Header, error)
- func (c *Chain) UpdateLiteWithHeaderHeight(height int64) (*tmclient.Header, error)
- func (src *Chain) UseSDKContext() func()
- func (c *Chain) ValidateTxResult(resTx *ctypes.ResultTx) (err error)
- func (c *Chain) VerifyProof(queryPath string, resp abci.ResponseQuery) error
- func (c *Chain) WaitForNBlocks(n int64) error
- type ChainStatus
- type Chains
- type ChannelStatus
- type ClientStatus
- type CommitmentResponse
- type ConnectionStatus
- type FaucetRequest
- type MsgSendPacket
- type NaiveStrategy
- func (nrs *NaiveStrategy) GetType() string
- func (nrs *NaiveStrategy) HandleEvents(src, dst *Chain, sh *SyncHeaders, events map[string][]string)
- func (nrs *NaiveStrategy) RelayPacketsOrderedChan(src, dst *Chain, sp *RelaySequences, sh *SyncHeaders) error
- func (nrs *NaiveStrategy) RelayPacketsUnorderedChan(src, dst *Chain, sp *RelaySequences, sh *SyncHeaders) error
- func (nrs *NaiveStrategy) UnrelayedSequencesOrdered(src, dst *Chain, sh *SyncHeaders) (*RelaySequences, error)
- func (nrs *NaiveStrategy) UnrelayedSequencesUnordered(src, dst *Chain, sh *SyncHeaders) (*RelaySequences, error)
- type Path
- type PathEnd
- func (src *PathEnd) ChanAck(dstChanState chanTypes.ChannelResponse, signer sdk.AccAddress) sdk.Msg
- func (src *PathEnd) ChanCloseConfirm(dstChanState chanTypes.ChannelResponse, signer sdk.AccAddress) sdk.Msg
- func (src *PathEnd) ChanCloseInit(signer sdk.AccAddress) sdk.Msg
- func (src *PathEnd) ChanConfirm(dstChanState chanTypes.ChannelResponse, signer sdk.AccAddress) sdk.Msg
- func (src *PathEnd) ChanInit(dst *PathEnd, signer sdk.AccAddress) sdk.Msg
- func (src *PathEnd) ChanTry(dst *PathEnd, dstChanState chanTypes.ChannelResponse, signer sdk.AccAddress) sdk.Msg
- func (src *PathEnd) ConnAck(dstConnState connTypes.ConnectionResponse, ...) sdk.Msg
- func (src *PathEnd) ConnConfirm(dstConnState connTypes.ConnectionResponse, signer sdk.AccAddress) sdk.Msg
- func (src *PathEnd) ConnInit(dst *PathEnd, signer sdk.AccAddress) sdk.Msg
- func (src *PathEnd) ConnTry(dst *PathEnd, dstConnState connTypes.ConnectionResponse, ...) sdk.Msg
- func (src *PathEnd) CreateClient(dstHeader *tmclient.Header, trustingPeriod time.Duration, ...) sdk.Msg
- func (src *PathEnd) MsgAck(dst *PathEnd, sequence, timeoutHeight, timeoutStamp uint64, ...) sdk.Msg
- func (src *PathEnd) MsgRecvPacket(dst *PathEnd, sequence, timeoutHeight, timeoutStamp uint64, packetData []byte, ...) sdk.Msg
- func (src *PathEnd) MsgSendPacket(dst *PathEnd, packetData []byte, relativeTimeout, timeoutStamp uint64, ...) sdk.Msg
- func (src *PathEnd) MsgTimeout(dst *PathEnd, packetData []byte, seq, timeout, timeoutStamp uint64, ...) sdk.Msg
- func (src *PathEnd) MsgTransfer(dst *PathEnd, dstHeight uint64, amount sdk.Coins, dstAddr string, ...) sdk.Msg
- func (src *PathEnd) NewPacket(dst *PathEnd, sequence uint64, packetData []byte, ...) chanTypes.Packet
- func (p PathEnd) String() string
- func (src *PathEnd) UpdateClient(dstHeader *tmclient.Header, signer sdk.AccAddress) sdk.Msg
- func (p *PathEnd) Validate() error
- func (p *PathEnd) Vchan() error
- func (p *PathEnd) Vclient() error
- func (p *PathEnd) Vconn() error
- func (p *PathEnd) Vport() error
- func (src *PathEnd) XferPacket(amount sdk.Coins, sender, reciever string) []byte
- type PathStatus
- type Paths
- type RelayMsgs
- type RelaySequences
- type SeqPair
- type SeqPairs
- type Strategy
- type StrategyCfg
- type SyncHeaders
Constants ¶
This section is empty.
Variables ¶
var ErrLiteNotInitialized = errors.New("lite client is not initialized")
ErrLiteNotInitialized returns the cannonical error for a an uninitialized lite client
var ModuleCdc *codec.Codec
Functions ¶
func GenerateRandomBytes ¶
GenerateRandomBytes returns securely generated random bytes. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.
func GenerateRandomString ¶
GenerateRandomString returns a URL-safe, base64 encoded securely generated random string. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.
func OrderFromString ¶ added in v0.5.0
OrderFromString parses a string into a channel order byte
func ParseEvents ¶
ParseEvents takes events in the query format and reutrns
func QueryChannelPair ¶
func QueryChannelPair(src, dst *Chain, srcH, dstH int64) (map[string]chanTypes.ChannelResponse, error)
QueryChannelPair returns a pair of channel responses
func QueryClientConsensusStatePair ¶
func QueryClientConsensusStatePair(src, dst *Chain, srcH, dstH, srcClientConsH, dstClientConsH int64) (map[string]clientTypes.ConsensusStateResponse, error)
QueryClientConsensusStatePair allows for the querying of multiple client states at the same time
func QueryClientStatePair ¶
func QueryClientStatePair(src, dst *Chain) (map[string]*clientTypes.StateResponse, error)
QueryClientStatePair returns a pair of connection responses
func QueryConnectionPair ¶
func QueryConnectionPair(src, dst *Chain, srcH, dstH int64) (map[string]connTypes.ConnectionResponse, error)
QueryConnectionPair returns a pair of connection responses
func QueryLatestHeights ¶
QueryLatestHeights returns the heights of multiple chains at once
func RandLowerCaseLetterString ¶
RandLowerCaseLetterString returns a lowercase letter string of given length
func RegisterCodec ¶ added in v0.3.0
func RunStrategy ¶ added in v0.3.0
RunStrategy runs a given strategy
Types ¶
type Chain ¶
type Chain struct { Key string `yaml:"key" json:"key"` ChainID string `yaml:"chain-id" json:"chain-id"` RPCAddr string `yaml:"rpc-addr" json:"rpc-addr"` AccountPrefix string `yaml:"account-prefix" json:"account-prefix"` Gas uint64 `yaml:"gas,omitempty" json:"gas,omitempty"` GasAdjustment float64 `yaml:"gas-adjustment,omitempty" json:"gas-adjustment,omitempty"` GasPrices string `yaml:"gas-prices,omitempty" json:"gas-prices,omitempty"` DefaultDenom string `yaml:"default-denom,omitempty" json:"default-denom,omitempty"` Memo string `yaml:"memo,omitempty" json:"memo,omitempty"` TrustingPeriod string `yaml:"trusting-period" json:"trusting-period"` // TODO: make these private HomePath string `yaml:"-" json:"-"` PathEnd *PathEnd `yaml:"-" json:"-"` Keybase keys.Keyring `yaml:"-" json:"-"` Client rpcclient.Client `yaml:"-" json:"-"` Cdc *contextualStdCodec `yaml:"-" json:"-"` Amino *contextualAminoCodec `yaml:"-" json:"-"` // contains filtered or unexported fields }
Chain represents the necessary data for connecting to and indentifying a chain and its counterparites
func (*Chain) AddPath ¶
AddPath takes the elements of a path and validates then, setting that path to the chain
func (*Chain) BroadcastTxCommit ¶
func (src *Chain) BroadcastTxCommit(txBytes []byte) (sdk.TxResponse, error)
BroadcastTxCommit takes the marshaled transaction bytes and broadcasts them
func (*Chain) BuildAndSignTx ¶
BuildAndSignTx takes messages and builds, signs and marshals a sdk.Tx to prepare it for broadcast
func (*Chain) BuildAndSignTxWithKey ¶
BuildAndSignTxWithKey allows the user to specify which relayer key will sign the message
func (*Chain) CloseChannel ¶
CloseChannel runs the channel closing messages on timeout until they pass TODO: add max retries or something to this function
func (*Chain) CloseChannelStep ¶
CloseChannelStep returns the next set of messages for closing a channel with given identifiers between chains src and dst. If the closing handshake hasn't started, then CloseChannelStep will begin the handshake on the src chain
func (*Chain) CreateChannel ¶
CreateChannel runs the channel creation messages on timeout until they pass TODO: add max retries or something to this function
func (*Chain) CreateChannelStep ¶
CreateChannelStep returns the next set of messages for creating a channel with given identifiers between chains src and dst. If the handshake hasn't started, then CreateChannelStep will begin the handshake on the src chain
func (*Chain) CreateClients ¶
CreateClients creates clients for src on dst and dst on src given the configured paths
func (*Chain) CreateConnection ¶
CreateConnection runs the connection creation messages on timeout until they pass TODO: add max retries or something to this function
func (*Chain) CreateConnectionStep ¶
CreateConnectionStep returns the next set of messags for creating a channel with the given identifier between chains src and dst. If handshake hasn't started, CreateConnetionStep will start the handshake on src
func (*Chain) CreateTestKey ¶
CreateTestKey creates a key for test chain
func (*Chain) DeleteLiteDB ¶
DeleteLiteDB removes the lite client database on disk, forcing re-initialization
func (*Chain) ErrCantSetPath ¶
ErrCantSetPath returns an error if the path doesn't set properly
func (*Chain) ErrPathNotSet ¶
ErrPathNotSet returns information what identifiers are needed to relay
func (*Chain) FaucetHandler ¶
func (src *Chain) FaucetHandler(fromKey sdk.AccAddress, amount sdk.Coin) func(w http.ResponseWriter, r *http.Request)
FaucetHandler listens for addresses
func (*Chain) ForceInitLite ¶
ForceInitLite forces initialization of the lite client from the configured node
func (*Chain) GetAddress ¶
func (src *Chain) GetAddress() (sdk.AccAddress, error)
GetAddress returns the sdk.AccAddress associated with the configred key
func (*Chain) GetLatestLiteHeader ¶
GetLatestLiteHeader returns the header to be used for client creation
func (*Chain) GetLatestLiteHeight ¶
GetLatestLiteHeight uses the CLI utilities to pull the latest height from a given chain
func (*Chain) GetLiteSignedHeaderAtHeight ¶
GetLiteSignedHeaderAtHeight returns a signed header at a particular height.
func (*Chain) GetRPCPort ¶
GetRPCPort returns the port configured for the chain
func (*Chain) GetTimeout ¶
GetTimeout returns the chain's configured timeout
func (*Chain) GetTrustingPeriod ¶
GetTrustingPeriod returns the trusting period for the chain
func (*Chain) Init ¶
func (src *Chain) Init(homePath string, cdc *codecstd.Codec, amino *aminocodec.Codec, timeout time.Duration, debug bool) error
Init initializes the pieces of a chain that aren't set when it parses a config NOTE: All validation of the chain should happen here.
func (*Chain) InitLiteClient ¶
func (c *Chain) InitLiteClient(db *dbm.GoLevelDB, trustOpts lite.TrustOptions) (*lite.Client, error)
InitLiteClient instantantiates the lite client object and calls update
func (*Chain) ListenRPCEmitJSON ¶
ListenRPCEmitJSON listens for tx and block events from a chain and outputs them as JSON to stdout
func (*Chain) LiteClient ¶
LiteClient initializes the lite client for a given chain.
func (*Chain) LiteClientWithoutTrust ¶
LiteClientWithoutTrust reads the trusted period off of the chain.
func (*Chain) LogFailedTx ¶
LogFailedTx takes the transaction and the messages to create it and logs the appropriate data
func (*Chain) LogSuccessTx ¶
func (c *Chain) LogSuccessTx(res sdk.TxResponse, msgs []sdk.Msg)
LogSuccessTx take the transaction and the messages to create it and logs the appropriate data
func (*Chain) MustGetAddress ¶
func (src *Chain) MustGetAddress() sdk.AccAddress
MustGetAddress used for brevity
func (*Chain) NewLiteDB ¶
NewLiteDB returns a new instance of the liteclient database connection CONTRACT: must close the database connection when done with it (defer df())
func (*Chain) PacketMsg ¶
func (src *Chain) PacketMsg(dst *Chain, xferPacket []byte, timeout, timeoutStamp uint64, seq int64, dstCommitRes CommitmentResponse) sdk.Msg
PacketMsg returns a new MsgPacket for forwarding packets from one chain to another
func (*Chain) Print ¶
Print fmt.Printlns the json or yaml representation of whatever is passed in CONTRACT: The cmd calling this function needs to have the "json" and "indent" flags set TODO: better "text" printing here would be a nice to have
func (*Chain) QueryABCI ¶
func (c *Chain) QueryABCI(req abci.RequestQuery) (res abci.ResponseQuery, err error)
QueryABCI is an affordance for querying the ABCI server associated with a chain Similar to cliCtx.QueryABCI
func (*Chain) QueryBalance ¶
QueryBalance returns the amount of coins in the relayer account
func (*Chain) QueryChannel ¶
func (c *Chain) QueryChannel(height int64) (chanRes chanTypes.ChannelResponse, err error)
QueryChannel returns the channel associated with a channelID
func (*Chain) QueryChannels ¶
func (c *Chain) QueryChannels(page, limit int) ([]chanTypes.IdentifiedChannel, error)
QueryChannels returns all the channels that are registered on a chain
func (*Chain) QueryClientConsensusState ¶
func (c *Chain) QueryClientConsensusState(srcHeight, srcClientConsHeight int64) (clientTypes.ConsensusStateResponse, error)
QueryClientConsensusState retrevies the latest consensus state for a client in state at a given height NOTE: dstHeight is the height from dst that is stored on src, it is needed to construct the appropriate store query
func (*Chain) QueryClientState ¶
func (c *Chain) QueryClientState() (*clientTypes.StateResponse, error)
QueryClientState retrevies the latest consensus state for a client in state at a given height
func (*Chain) QueryClients ¶
func (c *Chain) QueryClients(page, limit int) ([]clientExported.ClientState, error)
QueryClients queries all the clients!
func (*Chain) QueryConnection ¶
func (c *Chain) QueryConnection(height int64) (connTypes.ConnectionResponse, error)
QueryConnection returns the remote end of a given connection
func (*Chain) QueryConnectionChannels ¶
func (c *Chain) QueryConnectionChannels(connectionID string, page, limit int) ([]chanTypes.IdentifiedChannel, error)
QueryConnectionChannels queries the channels associated with a connection
func (*Chain) QueryConnections ¶
func (c *Chain) QueryConnections(page, limit int) (conns []connTypes.ConnectionEnd, err error)
QueryConnections gets any connections on a chain
func (*Chain) QueryConnectionsUsingClient ¶
func (c *Chain) QueryConnectionsUsingClient(height int64) (clientConns connTypes.ClientConnectionsResponse, err error)
QueryConnectionsUsingClient gets any connections that exist between chain and counterparty
func (*Chain) QueryConsensusState ¶
func (c *Chain) QueryConsensusState(height int64) (*tmclient.ConsensusState, error)
QueryConsensusState returns a consensus state for a given chain to be used as a client in another chain, fetches latest height when passed 0 as arg
func (*Chain) QueryHeaderAtHeight ¶
QueryHeaderAtHeight returns the header at a given height
func (*Chain) QueryLatestHeader ¶
QueryLatestHeader returns the latest header from the chain
func (*Chain) QueryLatestHeight ¶
QueryLatestHeight queries the chain for the latest height and returns it
func (*Chain) QueryNextSeqRecv ¶
func (c *Chain) QueryNextSeqRecv(height int64) (recvRes chanTypes.RecvResponse, err error)
QueryNextSeqRecv returns the next seqRecv for a configured channel
func (*Chain) QueryNextSeqSend ¶
QueryNextSeqSend returns the next seqSend for a configured channel
func (*Chain) QueryPacketAck ¶
func (c *Chain) QueryPacketAck(height, seq int64) (comRes CommitmentResponse, err error)
QueryPacketAck returns the packet commitment proof at a given height
func (*Chain) QueryPacketCommitment ¶
func (c *Chain) QueryPacketCommitment(height, seq int64) (comRes CommitmentResponse, err error)
QueryPacketCommitment returns the packet commitment proof at a given height
func (*Chain) QueryTx ¶
func (c *Chain) QueryTx(hashHex string) (sdk.TxResponse, error)
QueryTx takes a transaction hash and returns the transaction
func (*Chain) QueryTxs ¶
func (c *Chain) QueryTxs(height uint64, page, limit int, events []string) (*sdk.SearchTxsResult, error)
QueryTxs returns an array of transactions given a tag
func (*Chain) QueryWithData ¶
QueryWithData satisfies auth.NodeQuerier interface and used for fetching account details
func (*Chain) SendAndPrint ¶
SendAndPrint sends a transaction and prints according to the passed args
func (*Chain) SendMsgWithKey ¶
SendMsgWithKey allows the user to specify which relayer key will sign the message
func (*Chain) SendPacket ¶ added in v0.3.0
SendPacket sends arbitrary bytes from src to dst
func (*Chain) SendTransferBothSides ¶
func (src *Chain) SendTransferBothSides(dst *Chain, amount sdk.Coin, dstAddr sdk.AccAddress, source bool) error
SendTransferBothSides sends a ICS20 packet from src to dst
func (*Chain) SendTransferMsg ¶
func (src *Chain) SendTransferMsg(dst *Chain, amount sdk.Coin, dstAddr sdk.AccAddress, source bool) error
SendTransferMsg initiates an ibs20 transfer from src to dst with the specified args
func (*Chain) Subscribe ¶
func (src *Chain) Subscribe(query string) (<-chan ctypes.ResultEvent, context.CancelFunc, error)
Subscribe returns channel of events given a query
func (*Chain) TrustNodeInitClient ¶
TrustNodeInitClient trusts the configured node and initializes the lite client
func (*Chain) TrustOptions ¶
func (c *Chain) TrustOptions(height int64, hash []byte) lite.TrustOptions
TrustOptions returns lite.TrustOptions given a height and hash
func (*Chain) UpdateLiteWithHeader ¶
UpdateLiteWithHeader calls client.Update and then .
func (*Chain) UpdateLiteWithHeaderHeight ¶ added in v0.5.3
func (*Chain) UseSDKContext ¶
func (src *Chain) UseSDKContext() func()
UseSDKContext uses a custom Bech32 account prefix and returns a restore func
func (*Chain) ValidateTxResult ¶
ValidateTxResult takes a transaction and validates the proof against a stored root of trust
func (*Chain) VerifyProof ¶
func (c *Chain) VerifyProof(queryPath string, resp abci.ResponseQuery) error
VerifyProof performs response proof verification.
func (*Chain) WaitForNBlocks ¶
WaitForNBlocks blocks until the next block on a given chain
type ChainStatus ¶
type ChainStatus struct { Reachable bool `json:"reachable" yaml:"reachable"` Height int64 `json:"height" yaml:"height"` Client *ClientStatus `json:"client" yaml:"client"` Connection *ConnectionStatus `json:"connection" yaml:"connection"` Channel *ChannelStatus `json:"channel" yaml:"channel"` }
ChainStatus is for printing a chain's link status
type Chains ¶
type Chains []*Chain
Chains is a collection of Chain
type ChannelStatus ¶
type ChannelStatus struct { ID string `json:"id,omitempty" yaml:"id,omitempty"` Port string `json:"port,omitempty" yaml:"port,omitempty"` State string `json:"state,omitempty" yaml:"state,omitempty"` Order string `json:"order,omitempty" yaml:"order,omitempty"` }
ChannelStatus is for printing channel status
type ClientStatus ¶
type ClientStatus struct { ID string `json:"id,omitempty" yaml:"id,omitempty"` Height uint64 `json:"height,omitempty" yaml:"height,omitempty"` }
ClientStatus is for printing client status
type CommitmentResponse ¶
type CommitmentResponse struct { Data []byte `json:"data" yaml:"data"` Proof commitmenttypes.MerkleProof `json:"proof,omitempty" yaml:"proof,omitempty"` ProofPath commitmenttypes.MerklePath `json:"proof_path,omitempty" yaml:"proof_path,omitempty"` ProofHeight uint64 `json:"proof_height,omitempty" yaml:"proof_height,omitempty"` }
CommitmentResponse returns the commiment hash along with the proof data NOTE: CommitmentResponse is used to wrap query response from querying PacketCommitment AND PacketAcknowledgement
type ConnectionStatus ¶
type ConnectionStatus struct { ID string `json:"id,omitempty" yaml:"id,omitempty"` State string `json:"state,omitempty" yaml:"state,omitempty"` }
ConnectionStatus is for printing connection status
type FaucetRequest ¶
FaucetRequest represents a request to the facuet
type MsgSendPacket ¶ added in v0.3.0
type MsgSendPacket struct { Packet chanTypes.Packet `json:"packet" yaml:"packet"` Sender sdk.AccAddress `json:"sender" yaml:"sender"` // the sender address }
MsgSendPacket sends an outgoing IBC packet
func NewMsgSendPacket ¶ added in v0.3.0
func NewMsgSendPacket(packet chanTypes.Packet, sender sdk.AccAddress) MsgSendPacket
NewMsgSendPacket returns a new send request
func (MsgSendPacket) GetSignBytes ¶ added in v0.3.0
func (msg MsgSendPacket) GetSignBytes() []byte
GetSignBytes implements sdk.Msg
func (MsgSendPacket) GetSigners ¶ added in v0.3.0
func (msg MsgSendPacket) GetSigners() []sdk.AccAddress
GetSigners implements sdk.Msg
func (MsgSendPacket) Route ¶ added in v0.3.0
func (msg MsgSendPacket) Route() string
Route implements sdk.Msg
func (MsgSendPacket) Type ¶ added in v0.3.0
func (msg MsgSendPacket) Type() string
Type implements sdk.Msg
func (MsgSendPacket) ValidateBasic ¶ added in v0.3.0
func (msg MsgSendPacket) ValidateBasic() error
ValidateBasic implements sdk.Msg
type NaiveStrategy ¶
type NaiveStrategy struct { Ordered bool MaxTxSize uint64 // maximum permitted size of the msgs in a bundled relay transaction MaxMsgLength uint64 // maximum amount of messages in a bundled relay transaction }
NaiveStrategy is an implementation of Strategy.
func (*NaiveStrategy) GetType ¶
func (nrs *NaiveStrategy) GetType() string
GetType implements Strategy
func (*NaiveStrategy) HandleEvents ¶ added in v0.3.0
func (nrs *NaiveStrategy) HandleEvents(src, dst *Chain, sh *SyncHeaders, events map[string][]string)
HandleEvents defines how the relayer will handle block and transaction events as they are emmited
func (*NaiveStrategy) RelayPacketsOrderedChan ¶ added in v0.3.0
func (nrs *NaiveStrategy) RelayPacketsOrderedChan(src, dst *Chain, sp *RelaySequences, sh *SyncHeaders) error
RelayPacketsOrderedChan creates transactions to clear both queues CONTRACT: the SyncHeaders passed in here must be up to date or being kept updated
func (*NaiveStrategy) RelayPacketsUnorderedChan ¶ added in v0.3.0
func (nrs *NaiveStrategy) RelayPacketsUnorderedChan(src, dst *Chain, sp *RelaySequences, sh *SyncHeaders) error
RelayPacketsUnorderedChan creates transactions to relay un-relayed messages
func (*NaiveStrategy) UnrelayedSequencesOrdered ¶ added in v0.3.0
func (nrs *NaiveStrategy) UnrelayedSequencesOrdered(src, dst *Chain, sh *SyncHeaders) (*RelaySequences, error)
UnrelayedSequencesOrdered returns the unrelayed sequence numbers between two chains
func (*NaiveStrategy) UnrelayedSequencesUnordered ¶ added in v0.3.0
func (nrs *NaiveStrategy) UnrelayedSequencesUnordered(src, dst *Chain, sh *SyncHeaders) (*RelaySequences, error)
UnrelayedSequencesUnordered returns the unrelayed sequence numbers between two chains
type Path ¶
type Path struct { Src *PathEnd `yaml:"src" json:"src"` Dst *PathEnd `yaml:"dst" json:"dst"` Strategy *StrategyCfg `yaml:"strategy" json:"strategy"` }
Path represents a pair of chains and the identifiers needed to relay over them
func GenPath ¶
GenPath generates a path with random client, connection and channel identifiers given chainIDs and portIDs
func (*Path) GetStrategy ¶
GetStrategy the strategy defined in the relay messages
func (*Path) MustGetStrategy ¶
MustGetStrategy returns the strategy and panics on error
type PathEnd ¶
type PathEnd struct { ChainID string `yaml:"chain-id,omitempty" json:"chain-id,omitempty"` ClientID string `yaml:"client-id,omitempty" json:"client-id,omitempty"` ConnectionID string `yaml:"connection-id,omitempty" json:"connection-id,omitempty"` ChannelID string `yaml:"channel-id,omitempty" json:"channel-id,omitempty"` PortID string `yaml:"port-id,omitempty" json:"port-id,omitempty"` Order string `yaml:"order,omitempty" json:"order,omitempty"` }
PathEnd represents the local connection identifers for a relay path The path is set on the chain before performing operations
func (*PathEnd) ChanAck ¶
func (src *PathEnd) ChanAck(dstChanState chanTypes.ChannelResponse, signer sdk.AccAddress) sdk.Msg
ChanAck creates a MsgChannelOpenAck
func (*PathEnd) ChanCloseConfirm ¶
func (src *PathEnd) ChanCloseConfirm(dstChanState chanTypes.ChannelResponse, signer sdk.AccAddress) sdk.Msg
ChanCloseConfirm creates a MsgChannelCloseConfirm
func (*PathEnd) ChanCloseInit ¶
func (src *PathEnd) ChanCloseInit(signer sdk.AccAddress) sdk.Msg
ChanCloseInit creates a MsgChannelCloseInit
func (*PathEnd) ChanConfirm ¶
func (src *PathEnd) ChanConfirm(dstChanState chanTypes.ChannelResponse, signer sdk.AccAddress) sdk.Msg
ChanConfirm creates a MsgChannelOpenConfirm
func (*PathEnd) ChanTry ¶
func (src *PathEnd) ChanTry(dst *PathEnd, dstChanState chanTypes.ChannelResponse, signer sdk.AccAddress) sdk.Msg
ChanTry creates a MsgChannelOpenTry
func (*PathEnd) ConnAck ¶
func (src *PathEnd) ConnAck(dstConnState connTypes.ConnectionResponse, dstConsState clientTypes.ConsensusStateResponse, dstCsHeight int64, signer sdk.AccAddress) sdk.Msg
ConnAck creates a MsgConnectionOpenAck NOTE: ADD NOTE ABOUT PROOF HEIGHT CHANGE HERE
func (*PathEnd) ConnConfirm ¶
func (src *PathEnd) ConnConfirm(dstConnState connTypes.ConnectionResponse, signer sdk.AccAddress) sdk.Msg
ConnConfirm creates a MsgConnectionOpenAck NOTE: ADD NOTE ABOUT PROOF HEIGHT CHANGE HERE
func (*PathEnd) ConnTry ¶
func (src *PathEnd) ConnTry(dst *PathEnd, dstConnState connTypes.ConnectionResponse, dstConsState clientTypes.ConsensusStateResponse, dstCsHeight int64, signer sdk.AccAddress) sdk.Msg
ConnTry creates a MsgConnectionOpenTry NOTE: ADD NOTE ABOUT PROOF HEIGHT CHANGE HERE
func (*PathEnd) CreateClient ¶
func (src *PathEnd) CreateClient(dstHeader *tmclient.Header, trustingPeriod time.Duration, signer sdk.AccAddress) sdk.Msg
CreateClient creates an sdk.Msg to update the client on src with consensus state from dst
func (*PathEnd) MsgAck ¶
func (src *PathEnd) MsgAck(dst *PathEnd, sequence, timeoutHeight, timeoutStamp uint64, ack, packetData []byte, proof commitmenttypes.MerkleProof, proofHeight uint64, signer sdk.AccAddress) sdk.Msg
MsgAck creates MsgAck
func (*PathEnd) MsgRecvPacket ¶
func (src *PathEnd) MsgRecvPacket(dst *PathEnd, sequence, timeoutHeight, timeoutStamp uint64, packetData []byte, proof commitmenttypes.MerkleProof, proofHeight uint64, signer sdk.AccAddress) sdk.Msg
MsgRecvPacket creates a MsgPacket
func (*PathEnd) MsgSendPacket ¶ added in v0.3.0
func (src *PathEnd) MsgSendPacket(dst *PathEnd, packetData []byte, relativeTimeout, timeoutStamp uint64, signer sdk.AccAddress) sdk.Msg
MsgSendPacket creates a new arbitrary packet message
func (*PathEnd) MsgTimeout ¶
func (src *PathEnd) MsgTimeout(dst *PathEnd, packetData []byte, seq, timeout, timeoutStamp uint64, proof commitmenttypes.MerkleProof, proofHeight uint64, signer sdk.AccAddress) sdk.Msg
MsgTimeout creates MsgTimeout
func (*PathEnd) MsgTransfer ¶
func (src *PathEnd) MsgTransfer(dst *PathEnd, dstHeight uint64, amount sdk.Coins, dstAddr string, signer sdk.AccAddress) sdk.Msg
MsgTransfer creates a new transfer message
func (*PathEnd) NewPacket ¶
func (src *PathEnd) NewPacket(dst *PathEnd, sequence uint64, packetData []byte, timeoutHeight, timeoutStamp uint64) chanTypes.Packet
NewPacket returns a new packet from src to dist w
func (*PathEnd) UpdateClient ¶
UpdateClient creates an sdk.Msg to update the client on src with data pulled from dst
func (*PathEnd) Validate ¶
Validate returns errors about invalid identifiers as well as unset path variables for the appropriate type
type PathStatus ¶
type PathStatus struct { Chains map[string]*ChainStatus `json:"chains" yaml:"chains"` UnrelayedSeq *RelaySequences `json:"unrelayed-seq" yaml:"unrelayed-seq"` // contains filtered or unexported fields }
PathStatus returns the status of a given path
func QueryPathStatus ¶
func QueryPathStatus(src, dst *Chain, path *Path) (stat *PathStatus, err error)
QueryPathStatus takes both ends of a path and queries all the data about the link
type Paths ¶
Paths represent connection paths between chains
func (Paths) AddForce ¶ added in v0.3.1
AddForce ignores existing paths and overwrites an existing path with that name
type RelayMsgs ¶
type RelayMsgs struct { Src []sdk.Msg Dst []sdk.Msg MaxTxSize uint64 // maximum permitted size of the msgs in a bundled relay transaction MaxMsgLength uint64 // maximum amount of messages in a bundled relay transaction // contains filtered or unexported fields }
RelayMsgs contains the msgs that need to be sent to both a src and dst chain after a given relay round. MaxTxSize and MaxMsgLength are ignored if they are set to zero.
type RelaySequences ¶
type RelaySequences struct { Src []uint64 `json:"src,omitempty" yaml:"src,omitempty"` Dst []uint64 `json:"dst,omitempty" yaml:"dst,omitempty"` }
RelaySequences represents the unrelayed sequence numbers on src and dst
func UnrelayedSequences ¶
func UnrelayedSequences(src, dst *Chain, sh *SyncHeaders) (*RelaySequences, error)
UnrelayedSequences returns the unrelayed sequence numbers between two chains
type SeqPair ¶
type SeqPair struct { sync.Mutex `json:"-" yaml:"-"` Recv uint64 `json:"recv" yaml:"recv"` Send uint64 `json:"send" yaml:"send"` }
SeqPair represents the next recv and send seq from a given channel
type SeqPairs ¶
type SeqPairs struct { sync.Mutex `json:"-" yaml:"-"` Src *SeqPair `json:"src" yaml:"src"` Dst *SeqPair `json:"dst" yaml:"dst"` // contains filtered or unexported fields }
SeqPairs represents the next recv and send seqs from both sides of a given channel
func QueryNextSeqPairs ¶
func QueryNextSeqPairs(src, dst *Chain, sh *SyncHeaders) (*SeqPairs, error)
QueryNextSeqPairs returns a pair of chain's next sequences for the configured channel
func (*SeqPairs) ToRelay ¶
func (sp *SeqPairs) ToRelay() *RelaySequences
ToRelay represents an array of sequence numbers on each chain that need to be relayed
type Strategy ¶
type Strategy interface { GetType() string HandleEvents(src, dst *Chain, sh *SyncHeaders, events map[string][]string) UnrelayedSequencesUnordered(src, dst *Chain, sh *SyncHeaders) (*RelaySequences, error) UnrelayedSequencesOrdered(src, dst *Chain, sh *SyncHeaders) (*RelaySequences, error) RelayPacketsOrderedChan(src, dst *Chain, sp *RelaySequences, sh *SyncHeaders) error RelayPacketsUnorderedChan(src, dst *Chain, sp *RelaySequences, sh *SyncHeaders) error }
Strategy defines
type StrategyCfg ¶
type StrategyCfg struct {
Type string `json:"type" yaml:"type"`
}
StrategyCfg defines which relaying strategy to take for a given path
func NewNaiveStrategy ¶
func NewNaiveStrategy() *StrategyCfg
NewNaiveStrategy returns the proper config for the NaiveStrategy
type SyncHeaders ¶
SyncHeaders is an instance of map[string]*tmclient.Header that can be kept "reasonably up to date" using it's Update method
func NewSyncHeaders ¶
func NewSyncHeaders(chains ...*Chain) (*SyncHeaders, error)
NewSyncHeaders returns a new instance of map[string]*tmclient.Header that can be easily kept "reasonably up to date"
func (*SyncHeaders) GetHeader ¶
func (uh *SyncHeaders) GetHeader(chainID string) *tmclient.Header
GetHeader returns the latest header for a given chainID
func (*SyncHeaders) GetHeight ¶
func (uh *SyncHeaders) GetHeight(chainID string) uint64
GetHeight returns the latest height for a given chainID
func (*SyncHeaders) Update ¶
func (uh *SyncHeaders) Update(c *Chain) error
Update the header for a given chain