Documentation
¶
Overview ¶
Package chains defines chain-agnostic clients for reading chain state.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
ChainID() string
// TxPacketEvents reads every packet event emitted by txHash.
TxPacketEvents(ctx context.Context, txHash []byte) ([]v2.PacketEvent, error)
// TxHeight returns the height txHash was included at.
TxHeight(ctx context.Context, txHash []byte) (uint64, error)
// SubscribeSendPackets streams send packet events for clientIDs to the out
// channel as the chain emits them.
SubscribeSendPackets(ctx context.Context, clientIDs []string, out chan<- v2.PacketEvent) (v2.Subscription, error)
// IsPacketReceived reports whether a packet receipt exists on the
// destination chain.
IsPacketReceived(ctx context.Context, destClientID string, sequence uint64) (bool, error)
// IsPacketCommitted reports whether the packet commitment still exists on
// the source chain; the commitment is deleted once the packet is acked or
// timed out.
IsPacketCommitted(ctx context.Context, sourceClientID string, sequence uint64) (bool, error)
// LatestPacketSequence returns the highest sequence ever assigned on
// sourceClientID at height. Sequences in use are 1..N, so zero means nothing
// has been sent on the client.
LatestPacketSequence(ctx context.Context, sourceClientID string, height uint64) (uint64, error)
// PacketCommitments returns the subset of sequences whose packet commitment
// is still live on the source chain at height. It is all or nothing: an
// absent commitment means the packet settled, so a partial result would
// write off outstanding packets and any failure returns an error instead.
PacketCommitments(ctx context.Context, sourceClientID string, sequences []uint64, height uint64) ([]uint64, error)
// FindSendPackets returns the send packet events for sequences on
// sourceClientID. Sequences whose event cannot be found are omitted rather
// than errored, since a pruned log index is not a reason to fail the rest.
FindSendPackets(ctx context.Context, sourceClientID string, sequences []uint64) ([]v2.PacketEvent, error)
FindRecvTx(ctx context.Context, destClientID string, sequence uint64) (*v2.Tx, error)
FindAckTx(ctx context.Context, sourceClientID string, sequence uint64) (*v2.Tx, error)
FindTimeoutTx(ctx context.Context, sourceClientID string, sequence uint64) (*v2.Tx, error)
// PacketRelayExecuted reports whether an ack or timeout transaction emitted
// the corresponding router event for this packet.
PacketRelayExecuted(
ctx context.Context,
txHash string,
kind v2.RelayKind,
sequence uint64,
sourceClientID string,
destClientID string,
) (bool, error)
// PacketWriteAckStatus extracts the write acknowledgement status for a
// packet from its recv transaction.
PacketWriteAckStatus(
ctx context.Context,
recvTxHash string,
sequence uint64,
sourceClientID string,
destClientID string,
) (v2.WriteAckStatus, error)
// WaitForChain blocks until the chain's latest block time catches up to
// the current time.
WaitForChain(ctx context.Context) error
// GetBlockHeader returns the header at height, used by the attestor to
// read block timestamps for state attestations.
GetBlockHeader(ctx context.Context, height uint64) (v2.BlockHeader, error)
// GetCommitment reads the IBC commitment stored at pathHash at height,
// used by the attestor to independently verify packet/ack/receipt claims.
GetCommitment(ctx context.Context, height uint64, pathHash [32]byte) ([32]byte, error)
// GetCounterparty returns the client ID this chain's router has
// registered as clientID's on-chain counterparty.
GetCounterparty(ctx context.Context, clientID string) (string, error)
// GetAttestationSet returns clientID's on-chain attestor addresses and
// minimum required signature count.
GetAttestationSet(ctx context.Context, clientID string) (addresses []string, minRequiredSigs uint8, err error)
}
Client provides chain state queries.
type ClientSet ¶
type ClientSet struct {
// contains filtered or unexported fields
}
ClientSet holds the chain clients for all configured chains.
func NewClientSet ¶
Click to show internal directories.
Click to hide internal directories.