diff --git a/usecase/model/icaauth/msg_register_account.go b/usecase/model/icaauth/msg_register_account.go index 046c3d0b..467840aa 100644 --- a/usecase/model/icaauth/msg_register_account.go +++ b/usecase/model/icaauth/msg_register_account.go @@ -15,8 +15,14 @@ type MsgRegisterAccount struct { Version string `mapstructure:"version" json:"version"` } -type RawMsgRegisterAccount struct { +type RawChainmainMsgRegisterAccount struct { Owner string `mapstructure:"owner" json:"owner"` ConnectionID string `mapstructure:"connectionId" json:"connectionId"` Version string `mapstructure:"version" json:"version"` } + +type RawMsgRegisterAccount struct { + Owner string `mapstructure:"owner" json:"owner"` + ConnectionID string `mapstructure:"connection_id" json:"connection_id"` + Version string `mapstructure:"version" json:"version"` +} diff --git a/usecase/parser/icaauth/msg.go b/usecase/parser/icaauth/msg.go index 890bb904..b655b1c1 100644 --- a/usecase/parser/icaauth/msg.go +++ b/usecase/parser/icaauth/msg.go @@ -118,15 +118,15 @@ func ParseChainmainMsgSubmitTx( func ParseChainmainMsgRegisterAccount( parserParams utils.CosmosParserParams, ) ([]command.Command, []string) { - var rawMsg icaauth_model.RawMsgRegisterAccount + var rawMsg icaauth_model.RawChainmainMsgRegisterAccount if err := mapstructure_utils.DefaultMapstructureDecoder.Decode(parserParams.Msg, &rawMsg); err != nil { - panic(fmt.Errorf("error decoding RawMsgRegisterAccount: %v", err)) + panic(fmt.Errorf("error decoding RawChainmainMsgRegisterAccount: %v", err)) } var msgRegisterAccount icaauth_model.MsgRegisterAccount msg, err := json.Marshal(rawMsg) if err != nil { - panic(fmt.Errorf("error json marshalling RawMsgRegisterAccount: %v", err)) + panic(fmt.Errorf("error json marshalling RawChainmainMsgRegisterAccount: %v", err)) } err = json.Unmarshal(msg, &msgRegisterAccount) @@ -284,10 +284,22 @@ func ParseMsgRegisterAccount( panic(fmt.Errorf("error decoding RawMsgRegisterAccount: %v", err)) } + rawMsgRegisterAccount, err := json.MarshalIndent(icaauth_model.RawChainmainMsgRegisterAccount(rawMsg), "", " ") + if err != nil { + panic(fmt.Errorf("error json marshalling RawChainmainMsgRegisterAccount: %v", err)) + } + + var rawChainmainMsgRegisterAccount icaauth_model.RawChainmainMsgRegisterAccount + err = json.Unmarshal(rawMsgRegisterAccount, &rawChainmainMsgRegisterAccount) + if err != nil { + panic(fmt.Errorf("error json unmarshalling RawChainmainMsgRegisterAccount: %v", err)) + } + var msgRegisterAccount icaauth_model.MsgRegisterAccount - msg, err := json.Marshal(rawMsg) + var msg []byte + msg, err = json.Marshal(rawChainmainMsgRegisterAccount) if err != nil { - panic(fmt.Errorf("error json marshalling RawMsgRegisterAccount: %v", err)) + panic(fmt.Errorf("error json marshalling RawChainmainMsgRegisterAccount: %v", err)) } err = json.Unmarshal(msg, &msgRegisterAccount) diff --git a/usecase/parser/msg_register_account_test.go b/usecase/parser/msg_register_account_test.go index 51f904fe..5cf165b7 100644 --- a/usecase/parser/msg_register_account_test.go +++ b/usecase/parser/msg_register_account_test.go @@ -28,7 +28,7 @@ var _ = Describe("ParseMsgCommands", func() { "msgIndex": 0, "params": { "owner": "tcro1np7ztcfeycqwhj0nr8hxfu0lfjz27telqx53ra", - "connectionId": "", + "connectionId": "connection-18", "version": "", "portId": "icacontroller-tcro1np7ztcfeycqwhj0nr8hxfu0lfjz27telqx53ra", "channelId": "channel-48",