From be12a87d67bdc14115fed6fb7ab26919fab61301 Mon Sep 17 00:00:00 2001 From: Carlton N Hanna Date: Tue, 12 Sep 2023 22:19:00 -0600 Subject: [PATCH] move wasm structs to type... still needs some reworking to correct json --- x/ibchooks/types/types.go | 20 ++++++++++++++++++++ x/ibchooks/wasm_hook.go | 24 ++---------------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/x/ibchooks/types/types.go b/x/ibchooks/types/types.go index 8ea65e4afa..df766920c8 100644 --- a/x/ibchooks/types/types.go +++ b/x/ibchooks/types/types.go @@ -85,6 +85,26 @@ func UnmarshalIBCAck(bz []byte) (*IBCAck, error) { return &ack, nil } +type IbcAck struct { + Channel string `json:"channel"` + Sequence uint64 `json:"sequence"` + Ack string `json:"ack"` + Success string `json:"success"` +} + +type IbcLifecycleCompleteSuccess struct { + IbcAck IbcAck `json:"ibc_ack"` +} + +type IbcTimeout struct { + Channel string `json:"channel"` + Sequence uint64 `json:"sequence"` +} + +type IbcLifecycleComplete struct { + IbcTimeout IbcTimeout `json:"ibc_timeout"` +} + type MarkerMemo struct { Marker MarkerPayload `json:"marker"` } diff --git a/x/ibchooks/wasm_hook.go b/x/ibchooks/wasm_hook.go index e0c05fbd25..2c6e5cd9a3 100644 --- a/x/ibchooks/wasm_hook.go +++ b/x/ibchooks/wasm_hook.go @@ -336,8 +336,8 @@ func (h WasmHooks) OnAcknowledgementPacketOverride(im IBCMiddleware, ctx sdktype // This should never match anything, but we want to satisfy the github code scanning flag. sanitizedSourceChannel := strings.ReplaceAll(packet.SourceChannel, "\"", "") - ibcLifecycleComplete := IbcLifecycleCompleteSuccess{ - IbcAck{ + ibcLifecycleComplete := types.IbcLifecycleCompleteSuccess{ + IbcAck: types.IbcAck{ Channel: sanitizedSourceChannel, Sequence: packet.Sequence, Ack: string(ackAsJSON), @@ -362,17 +362,6 @@ func (h WasmHooks) OnAcknowledgementPacketOverride(im IBCMiddleware, ctx sdktype return nil } -type IbcAck struct { - Channel string `json:"channel"` - Sequence uint64 `json:"sequence"` - Ack string `json:"ack"` - Success string `json:"success"` -} - -type IbcLifecycleCompleteSuccess struct { - IbcAck IbcAck `json:"ibc_ack"` -} - func (h WasmHooks) OnTimeoutPacketOverride(im IBCMiddleware, ctx sdktypes.Context, packet channeltypes.Packet, relayer sdktypes.AccAddress) error { err := im.App.OnTimeoutPacket(ctx, packet, relayer) if err != nil { @@ -422,15 +411,6 @@ func (h WasmHooks) OnTimeoutPacketOverride(im IBCMiddleware, ctx sdktypes.Contex return nil } -type IbcTimeout struct { - Channel string `json:"channel"` - Sequence uint64 `json:"sequence"` -} - -type IbcLifecycleComplete struct { - IbcTimeout IbcTimeout `json:"ibc_timeout"` -} - // NewEmitErrorAcknowledgement creates a new error acknowledgement after having emitted an event with the // details of the error. func NewEmitErrorAcknowledgement(ctx sdktypes.Context, err error, errorContexts ...string) channeltypes.Acknowledgement {