-
Notifications
You must be signed in to change notification settings - Fork 0
/
gov.go
50 lines (45 loc) · 1.46 KB
/
gov.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
47
48
49
50
package gov
import (
. "github.com/bianjieai/chain-parser/common-parser/modules"
. "github.com/bianjieai/chain-parser/cosmosmod-parser/modules"
govv1 "github.com/bianjieai/chain-parser/cosmosmod-parser/modules/gov/v1"
govv1beta1 "github.com/bianjieai/chain-parser/cosmosmod-parser/modules/gov/v1beta1"
sdk "github.com/cosmos/cosmos-sdk/types"
)
type GovClient struct {
}
func NewClient() GovClient {
return GovClient{}
}
func (gov GovClient) HandleTxMsg(v sdk.Msg) (MsgDocInfo, bool) {
switch msg := v.(type) {
case *MsgSubmitProposal:
docMsg := govv1beta1.DocTxMsgSubmitProposal{}
return docMsg.HandleTxMsg(msg), true
case *MsgVote:
docMsg := govv1beta1.DocTxMsgVote{}
return docMsg.HandleTxMsg(msg), true
case *MsgDeposit:
docMsg := govv1beta1.DocTxMsgDeposit{}
return docMsg.HandleTxMsg(msg), true
case *MsgVoteWeighted:
docMsg := govv1beta1.DocTxMsgVoteWeighted{}
return docMsg.HandleTxMsg(msg), true
case *MsgExecLegacyContent:
docMsg := govv1.DocTxMsgExecLegacyContent{}
return docMsg.HandleTxMsg(msg), true
case *MsgSubmitProposalV1:
docMsg := govv1.DocTxMsgSubmitProposalV1{}
return docMsg.HandleTxMsg(msg), true
case *MsgVoteV1:
docMsg := govv1.DocTxMsgVoteV1{}
return docMsg.HandleTxMsg(msg), true
case *MsgDepositV1:
docMsg := govv1.DocTxMsgDepositV1{}
return docMsg.HandleTxMsg(msg), true
case *MsgVoteWeightedV1:
docMsg := govv1.DocTxMsgVoteWeightedV1{}
return docMsg.HandleTxMsg(msg), true
}
return MsgDocInfo{}, false
}