-
Notifications
You must be signed in to change notification settings - Fork 751
Expand file tree
/
Copy pathmodule.go
More file actions
73 lines (64 loc) · 2.1 KB
/
module.go
File metadata and controls
73 lines (64 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package api
import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
channeltypesv2 "github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types"
)
// IBCModule defines an interface that implements all the callbacks
// that modules must define as specified in IBC Protocol V2.
type IBCModule interface {
// OnSendPacket is executed when a packet is being sent from sending chain.
// this callback is provided with the source and destination IDs, the signer, the packet sequence and the packet data
// for this specific application.
OnSendPacket(
ctx context.Context,
sourceClient string,
destinationClient string,
sequence uint64,
payload channeltypesv2.Payload,
signer sdk.AccAddress,
) error
OnRecvPacket(
ctx context.Context,
sourceClient string,
destinationClient string,
sequence uint64,
payload channeltypesv2.Payload,
relayer sdk.AccAddress,
) channeltypesv2.RecvPacketResult
// OnTimeoutPacket is executed when a packet has timed out on the receiving chain.
OnTimeoutPacket(
ctx context.Context,
sourceClient string,
destinationClient string,
sequence uint64,
payload channeltypesv2.Payload,
relayer sdk.AccAddress,
) error
// OnAcknowledgementPacket is executed when a packet gets acknowledged
OnAcknowledgementPacket(
ctx context.Context,
sourceClient string,
destinationClient string,
sequence uint64,
acknowledgement []byte,
payload channeltypesv2.Payload,
relayer sdk.AccAddress,
) error
}
type WriteAcknowledgementWrapper interface {
// WriteAcknowledgement writes the acknowledgement for an async acknowledgement
WriteAcknowledgement(
ctx context.Context,
srcClientID string,
sequence uint64,
ack channeltypesv2.Acknowledgement,
) error
}
// PacketDataUnmarshaler defines an optional interface which allows a middleware
// to request the packet data to be unmarshaled by the base application.
type PacketDataUnmarshaler interface {
// UnmarshalPacketData unmarshals the packet data into a concrete type
// the payload is provided and the packet data interface is returned
UnmarshalPacketData(payload channeltypesv2.Payload) (interface{}, error)
}