-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
pathEnd.go
39 lines (34 loc) · 1.02 KB
/
pathEnd.go
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
package relayer
import (
"strings"
chantypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
)
// PathEnd represents the local connection identifiers for a relay path
// The path is set on the chain before performing operations
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"`
}
// OrderFromString parses a string into a channel order byte
func OrderFromString(order string) chantypes.Order {
switch strings.ToUpper(order) {
case "UNORDERED":
return chantypes.UNORDERED
case "ORDERED":
return chantypes.ORDERED
default:
return chantypes.NONE
}
}
// StringFromOrder returns the string representation of a channel order.
func StringFromOrder(order chantypes.Order) string {
switch order {
case chantypes.UNORDERED:
return "unordered"
case chantypes.ORDERED:
return "ordered"
default:
return ""
}
}