|
| 1 | +package debug |
| 2 | + |
| 3 | +import ( |
| 4 | + "context" |
| 5 | + "time" |
| 6 | + |
| 7 | + "github.com/cosmos/cosmos-sdk/codec" |
| 8 | + sdk "github.com/cosmos/cosmos-sdk/types" |
| 9 | + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" |
| 10 | + |
| 11 | + "github.com/hyperledger-labs/yui-relayer/core" |
| 12 | +) |
| 13 | + |
| 14 | +type Chain struct { |
| 15 | + config ChainConfig |
| 16 | + OriginChain core.Chain |
| 17 | +} |
| 18 | + |
| 19 | +var _ core.Chain = (*Chain)(nil) |
| 20 | + |
| 21 | +func (c *Chain) ChainID() string { |
| 22 | + return c.OriginChain.ChainID() |
| 23 | +} |
| 24 | + |
| 25 | +func (c *Chain) Codec() codec.ProtoCodecMarshaler { |
| 26 | + return c.OriginChain.Codec() |
| 27 | +} |
| 28 | + |
| 29 | +func (c *Chain) GetAddress() (sdk.AccAddress, error) { |
| 30 | + return c.OriginChain.GetAddress() |
| 31 | +} |
| 32 | + |
| 33 | +// SetRelayInfo sets source's path and counterparty's info to the chain |
| 34 | +func (c *Chain) SetRelayInfo(path *core.PathEnd, counterparty *core.ProvableChain, counterpartyPath *core.PathEnd) error { |
| 35 | + return c.OriginChain.SetRelayInfo(path, counterparty, counterpartyPath) |
| 36 | +} |
| 37 | + |
| 38 | +func (c *Chain) Path() *core.PathEnd { |
| 39 | + return c.OriginChain.Path() |
| 40 | +} |
| 41 | + |
| 42 | +func (c *Chain) Init(homePath string, timeout time.Duration, codec codec.ProtoCodecMarshaler, debug bool) error { |
| 43 | + return c.OriginChain.Init(homePath, timeout, codec, debug) |
| 44 | +} |
| 45 | + |
| 46 | +func (c *Chain) SetupForRelay(ctx context.Context) error { |
| 47 | + return c.OriginChain.SetupForRelay(ctx) |
| 48 | +} |
| 49 | + |
| 50 | +// LatestHeight queries the chain for the latest height and returns it |
| 51 | +func (c *Chain) LatestHeight(ctx context.Context) (ibcexported.Height, error) { |
| 52 | + return c.OriginChain.LatestHeight(ctx) |
| 53 | +} |
| 54 | + |
| 55 | +func (c *Chain) Timestamp(ctx context.Context, height ibcexported.Height) (time.Time, error) { |
| 56 | + return c.OriginChain.Timestamp(ctx, height) |
| 57 | +} |
| 58 | + |
| 59 | +func (c *Chain) AverageBlockTime() time.Duration { |
| 60 | + return c.OriginChain.AverageBlockTime() |
| 61 | +} |
| 62 | + |
| 63 | +func (c *Chain) RegisterMsgEventListener(listener core.MsgEventListener) { |
| 64 | + c.OriginChain.RegisterMsgEventListener(listener) |
| 65 | +} |
| 66 | + |
| 67 | +func (c *Chain) SendMsgs(ctx context.Context, msgs []sdk.Msg) ([]core.MsgID, error) { |
| 68 | + return c.OriginChain.SendMsgs(ctx, msgs) |
| 69 | +} |
| 70 | + |
| 71 | +func (c *Chain) GetMsgResult(ctx context.Context, id core.MsgID) (core.MsgResult, error) { |
| 72 | + return c.OriginChain.GetMsgResult(ctx, id) |
| 73 | +} |
0 commit comments