|
1 | 1 | package icaauth |
2 | 2 |
|
3 | 3 | import ( |
| 4 | + "encoding/hex" |
4 | 5 | "encoding/json" |
5 | 6 | "fmt" |
6 | 7 |
|
@@ -67,7 +68,21 @@ func ParseChainmainMsgSubmitTx( |
67 | 68 | packetData = sendPacketEvent.MustGetAttributeByKey("packet_data") |
68 | 69 | } |
69 | 70 | if sendPacketEvent.HasAttribute("packet_data_hex") { |
70 | | - packetData = sendPacketEvent.MustGetAttributeByKey("packet_data_hex") |
| 71 | + packetDataHex := sendPacketEvent.MustGetAttributeByKey("packet_data_hex") |
| 72 | + |
| 73 | + var packetDataBytes []byte |
| 74 | + packetDataBytes, err := hex.DecodeString(packetDataHex) |
| 75 | + |
| 76 | + var fungiblePacketData *ibc_model.FungibleTokenPacketData |
| 77 | + if err == nil { |
| 78 | + if err = json.Unmarshal(packetDataBytes, &fungiblePacketData); err != nil { |
| 79 | + parserParams.Logger.Warnf("error unmarshalling packet data hex") |
| 80 | + } |
| 81 | + } |
| 82 | + |
| 83 | + var fungiblePacketDataBytes []byte |
| 84 | + fungiblePacketDataBytes, err = json.Marshal(fungiblePacketData) |
| 85 | + packetData = string(fungiblePacketDataBytes) |
71 | 86 | } |
72 | 87 | if sendPacketEvent.HasAttribute("packet_timeout_height") { |
73 | 88 | packetTimeoutHeight = sendPacketEvent.MustGetAttributeByKey("packet_timeout_height") |
@@ -231,7 +246,21 @@ func ParseMsgSubmitTx( |
231 | 246 | packetData = sendPacketEvent.MustGetAttributeByKey("packet_data") |
232 | 247 | } |
233 | 248 | if sendPacketEvent.HasAttribute("packet_data_hex") { |
234 | | - packetData = sendPacketEvent.MustGetAttributeByKey("packet_data_hex") |
| 249 | + packetDataHex := sendPacketEvent.MustGetAttributeByKey("packet_data_hex") |
| 250 | + |
| 251 | + var packetDataBytes []byte |
| 252 | + packetDataBytes, err := hex.DecodeString(packetDataHex) |
| 253 | + |
| 254 | + var fungiblePacketData *ibc_model.FungibleTokenPacketData |
| 255 | + if err == nil { |
| 256 | + if err = json.Unmarshal(packetDataBytes, &fungiblePacketData); err != nil { |
| 257 | + parserParams.Logger.Warnf("error unmarshalling packet data hex") |
| 258 | + } |
| 259 | + } |
| 260 | + |
| 261 | + var fungiblePacketDataBytes []byte |
| 262 | + fungiblePacketDataBytes, err = json.Marshal(fungiblePacketData) |
| 263 | + packetData = string(fungiblePacketDataBytes) |
235 | 264 | } |
236 | 265 | if sendPacketEvent.HasAttribute("packet_timeout_height") { |
237 | 266 | packetTimeoutHeight = sendPacketEvent.MustGetAttributeByKey("packet_timeout_height") |
|
0 commit comments