-
Notifications
You must be signed in to change notification settings - Fork 0
/
node.go
46 lines (42 loc) · 974 Bytes
/
node.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
40
41
42
43
44
45
46
package node
import (
. "github.com/bianjieai/chain-parser/common-parser/modules"
. "github.com/bianjieai/chain-parser/iritamod-parser/modules"
"github.com/cosmos/cosmos-sdk/types"
)
type NodeClient struct {
}
func NewClient() NodeClient {
return NodeClient{}
}
func (nft NodeClient) HandleTxMsg(v types.Msg) (MsgDocInfo, bool) {
var (
msgDocInfo MsgDocInfo
)
ok := true
switch msg := v.(type) {
case *MsgNodeCreate:
docMsg := DocMsgCreateValidator{}
msgDocInfo = docMsg.HandleTxMsg(msg)
break
case *MsgNodeUpdate:
docMsg := DocMsgUpdateValidator{}
msgDocInfo = docMsg.HandleTxMsg(msg)
break
case *MsgNodeRemove:
docMsg := DocMsgRemoveValidator{}
msgDocInfo = docMsg.HandleTxMsg(msg)
break
case *MsgNodeGrant:
docMsg := DocMsgGrantNode{}
msgDocInfo = docMsg.HandleTxMsg(msg)
break
case *MsgNodeRevoke:
docMsg := DocMsgRevokeNode{}
msgDocInfo = docMsg.HandleTxMsg(msg)
break
default:
ok = false
}
return msgDocInfo, ok
}