-
Notifications
You must be signed in to change notification settings - Fork 5
/
client_upgrade.go
47 lines (39 loc) · 1.36 KB
/
client_upgrade.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
package ibc
import (
cdc "github.com/kaifei-bianjie/msg-parser/codec"
. "github.com/kaifei-bianjie/msg-parser/modules"
"github.com/kaifei-bianjie/msg-parser/utils"
)
type DocMsgUpgradeClient struct {
ClientId string `bson:"client_id"`
ClientState string `bson:"client_state"`
ConsensusState string `bson:"consensus_state"`
ProofUpgradeClient string `bson:"proof_upgrade_client"`
ProofUpgradeConsensusState string `bson:"proof_upgrade_consensus_state"`
Signer string `bson:"signer"`
}
func (m *DocMsgUpgradeClient) GetType() string {
return MsgTypeUpgradeClient
}
func (m *DocMsgUpgradeClient) BuildMsg(v interface{}) {
msg := v.(*MsgUpgradeClient)
m.Signer = msg.Signer
m.ClientId = msg.ClientId
m.ClientState = ConvertAny(msg.ClientState)
m.ConsensusState = ConvertAny(msg.ConsensusState)
m.ProofUpgradeClient = utils.MarshalJsonIgnoreErr(msg.ProofUpgradeClient)
m.ProofUpgradeConsensusState = utils.MarshalJsonIgnoreErr(msg.ProofUpgradeConsensusState)
}
func (m *DocMsgUpgradeClient) HandleTxMsg(v SdkMsg) MsgDocInfo {
var (
addrs []string
msg MsgUpgradeClient
)
data, _ := cdc.GetMarshaler().MarshalJSON(v)
cdc.GetMarshaler().UnmarshalJSON(data, &msg)
addrs = append(addrs, msg.Signer)
handler := func() (Msg, []string) {
return m, addrs
}
return CreateMsgDocInfo(v, handler)
}