Skip to content

Commit

Permalink
fix: fix unmarshalling of packet data in send tx CLI
Browse files Browse the repository at this point in the history
* fix error messages

* Update tx.go

* fix unmarshalling
  • Loading branch information
Carlos Rodriguez authored Dec 5, 2022
1 parent 7adae35 commit 4d13768
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,16 @@ appropriate relative timeoutTimestamp must be provided with flag {relative-packe
// attempt to unmarshal ica msg data argument
var icaMsgData icatypes.InterchainAccountPacketData
msgContentOrFileName := args[1]
if err := cdc.UnmarshalInterfaceJSON([]byte(msgContentOrFileName), &icaMsgData); err != nil {
if err := cdc.UnmarshalJSON([]byte(msgContentOrFileName), &icaMsgData); err != nil {

// check for file path if JSON input is not provided
contents, err := os.ReadFile(msgContentOrFileName)
if err != nil {
return fmt.Errorf("neither JSON input nor path to .json file for client state were provided: %w", err)
return fmt.Errorf("neither JSON input nor path to .json file for packet data with messages were provided: %w", err)
}

if err := cdc.UnmarshalInterfaceJSON(contents, &icaMsgData); err != nil {
return fmt.Errorf("error unmarshalling client state file: %w", err)
if err := cdc.UnmarshalJSON(contents, &icaMsgData); err != nil {
return fmt.Errorf("error unmarshalling packet data with messages file: %w", err)
}
}

Expand Down

0 comments on commit 4d13768

Please sign in to comment.