From 9d713f08d3962279102988205ac38110ac272533 Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Thu, 31 Aug 2023 00:36:30 +0200 Subject: [PATCH 1/9] add encoding parameter to cli --- .../host/client/cli/tx.go | 34 ++++++++++++------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/modules/apps/27-interchain-accounts/host/client/cli/tx.go b/modules/apps/27-interchain-accounts/host/client/cli/tx.go index d3902d35f9a..03efc8c3757 100644 --- a/modules/apps/27-interchain-accounts/host/client/cli/tx.go +++ b/modules/apps/27-interchain-accounts/host/client/cli/tx.go @@ -2,16 +2,19 @@ package cli import ( "encoding/json" + "errors" "fmt" "github.com/cosmos/gogoproto/proto" "github.com/spf13/cobra" + "golang.org/x/exp/slices" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" + "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" ) @@ -21,13 +24,13 @@ const ( func generatePacketDataCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "generate-packet-data [message]", - Short: "Generates protobuf encoded ICA packet data.", - Long: `generate-packet-data accepts a message string and serializes it using protobuf -into packet data which is outputted to stdout. It can be used in conjunction with send-tx" -which submits pre-built packet data containing messages to be executed on the host chain. -`, - Example: fmt.Sprintf(`%s tx interchain-accounts host generate-packet-data '{ + Use: "generate-packet-data [encoding] [message]", + Short: "Generates protobuf or proto3 JSON encoded ICA packet data.", + Long: `generate-packet-data accepts a message string and serializes it (depending on the +encoding parameter) using protobuf or proto3 JSON into packet data which is outputted to stdout. +It can be used in conjunction with send-tx which submits pre-built packet data containing messages +to be executed on the host chain.`, + Example: fmt.Sprintf(`%s tx interchain-accounts host generate-packet-data proto3 '{ "@type":"/cosmos.bank.v1beta1.MsgSend", "from_address":"cosmos15ccshhmp0gsx29qpqq6g4zmltnnvgmyu9ueuadh9y2nc5zj0szls5gtddz", "to_address":"cosmos10h9stc5v6ntgeygf5xf945njqq5h32r53uquvw", @@ -40,7 +43,7 @@ which submits pre-built packet data containing messages to be executed on the ho }' --memo memo -%s tx interchain-accounts host generate-packet-data '[{ +%s tx interchain-accounts host generate-packet-data proto3 '[{ "@type":"/cosmos.bank.v1beta1.MsgSend", "from_address":"cosmos15ccshhmp0gsx29qpqq6g4zmltnnvgmyu9ueuadh9y2nc5zj0szls5gtddz", "to_address":"cosmos10h9stc5v6ntgeygf5xf945njqq5h32r53uquvw", @@ -74,7 +77,12 @@ which submits pre-built packet data containing messages to be executed on the ho return err } - packetDataBytes, err := generatePacketData(cdc, []byte(args[0]), memo) + encoding := args[0] + if !slices.Contains([]string{types.EncodingProtobuf, types.EncodingProto3JSON}, encoding) { + return errors.New(fmt.Sprintf("unsupported encoding type: %s", encoding)) + } + + packetDataBytes, err := generatePacketData(cdc, []byte(args[0]), memo, encoding) if err != nil { return err } @@ -91,13 +99,13 @@ which submits pre-built packet data containing messages to be executed on the ho // generatePacketData takes in message bytes and a memo and serializes the message into an // instance of InterchainAccountPacketData which is returned as bytes. -func generatePacketData(cdc *codec.ProtoCodec, msgBytes []byte, memo string) ([]byte, error) { +func generatePacketData(cdc *codec.ProtoCodec, msgBytes []byte, memo string, encoding string) ([]byte, error) { protoMessages, err := convertBytesIntoProtoMessages(cdc, msgBytes) if err != nil { return nil, err } - return generateIcaPacketDataFromProtoMessages(cdc, protoMessages, memo) + return generateIcaPacketDataFromProtoMessages(cdc, protoMessages, memo, encoding) } // convertBytesIntoProtoMessages returns a list of proto messages from bytes. The bytes can be in the form of a single @@ -129,8 +137,8 @@ func convertBytesIntoProtoMessages(cdc *codec.ProtoCodec, msgBytes []byte) ([]pr } // generateIcaPacketDataFromProtoMessages generates ica packet data as bytes from a given set of proto encoded sdk messages and a memo. -func generateIcaPacketDataFromProtoMessages(cdc *codec.ProtoCodec, sdkMessages []proto.Message, memo string) ([]byte, error) { - icaPacketDataBytes, err := icatypes.SerializeCosmosTx(cdc, sdkMessages, icatypes.EncodingProtobuf) +func generateIcaPacketDataFromProtoMessages(cdc *codec.ProtoCodec, sdkMessages []proto.Message, memo string, encoding string) ([]byte, error) { + icaPacketDataBytes, err := icatypes.SerializeCosmosTx(cdc, sdkMessages, encoding) if err != nil { return nil, err } From 74e46d058a1d4449fd3a159730f2e9322612cd21 Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Thu, 31 Aug 2023 00:40:15 +0200 Subject: [PATCH 2/9] updated docs --- docs/apps/interchain-accounts/client.md | 6 +++--- modules/apps/27-interchain-accounts/host/client/cli/tx.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/apps/interchain-accounts/client.md b/docs/apps/interchain-accounts/client.md index 868aeaeb4e4..f9a212e8c69 100644 --- a/docs/apps/interchain-accounts/client.md +++ b/docs/apps/interchain-accounts/client.md @@ -84,16 +84,16 @@ simd tx interchain-accounts host --help ##### `generate-packet-data` -The `generate-packet-data` command allows users to generate protobuf encoded interchain accounts packet data for input message(s). The packet data can then be used with the controller submodule's [`send-tx` command](#send-tx). +The `generate-packet-data` command allows users to generate protobuf or proto3 JSON encoded interchain accounts packet data for input message(s). The packet data can then be used with the controller submodule's [`send-tx` command](#send-tx). The encoding parameter must be either `proto3` or `proto3json`. ```shell -simd tx interchain-accounts host generate-packet-data [message] +simd tx interchain-accounts host generate-packet-data [encoding] [message] ``` Example: ```shell -simd tx interchain-accounts host generate-packet-data '[{ +simd tx interchain-accounts host generate-packet-data proto3 '[{ "@type":"/cosmos.bank.v1beta1.MsgSend", "from_address":"cosmos15ccshhmp0gsx29qpqq6g4zmltnnvgmyu9ueuadh9y2nc5zj0szls5gtddz", "to_address":"cosmos10h9stc5v6ntgeygf5xf945njqq5h32r53uquvw", diff --git a/modules/apps/27-interchain-accounts/host/client/cli/tx.go b/modules/apps/27-interchain-accounts/host/client/cli/tx.go index 03efc8c3757..cdfb9a9e2a3 100644 --- a/modules/apps/27-interchain-accounts/host/client/cli/tx.go +++ b/modules/apps/27-interchain-accounts/host/client/cli/tx.go @@ -29,7 +29,7 @@ func generatePacketDataCmd() *cobra.Command { Long: `generate-packet-data accepts a message string and serializes it (depending on the encoding parameter) using protobuf or proto3 JSON into packet data which is outputted to stdout. It can be used in conjunction with send-tx which submits pre-built packet data containing messages -to be executed on the host chain.`, +to be executed on the host chain. The encoding parameter must be equal to either "proto3" o "proto3json".`, Example: fmt.Sprintf(`%s tx interchain-accounts host generate-packet-data proto3 '{ "@type":"/cosmos.bank.v1beta1.MsgSend", "from_address":"cosmos15ccshhmp0gsx29qpqq6g4zmltnnvgmyu9ueuadh9y2nc5zj0szls5gtddz", From 4408c36cec79ce30b4f4cd41476f2201a1b72eb2 Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Thu, 31 Aug 2023 23:10:38 +0200 Subject: [PATCH 3/9] testing encoding parameter of cli --- .../host/client/cli/tx.go | 4 +- .../host/client/cli/tx_test.go | 60 ++++++++++--------- 2 files changed, 33 insertions(+), 31 deletions(-) diff --git a/modules/apps/27-interchain-accounts/host/client/cli/tx.go b/modules/apps/27-interchain-accounts/host/client/cli/tx.go index cdfb9a9e2a3..8ef0c0c19e2 100644 --- a/modules/apps/27-interchain-accounts/host/client/cli/tx.go +++ b/modules/apps/27-interchain-accounts/host/client/cli/tx.go @@ -63,7 +63,7 @@ to be executed on the host chain. The encoding parameter must be equal to either "amount": "1000" } }]'`, version.AppName, version.AppName), - Args: cobra.ExactArgs(1), + Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) if err != nil { @@ -82,7 +82,7 @@ to be executed on the host chain. The encoding parameter must be equal to either return errors.New(fmt.Sprintf("unsupported encoding type: %s", encoding)) } - packetDataBytes, err := generatePacketData(cdc, []byte(args[0]), memo, encoding) + packetDataBytes, err := generatePacketData(cdc, []byte(args[1]), memo, encoding) if err != nil { return err } diff --git a/modules/apps/27-interchain-accounts/host/client/cli/tx_test.go b/modules/apps/27-interchain-accounts/host/client/cli/tx_test.go index f9c4c0a4d71..9d31ceb3884 100644 --- a/modules/apps/27-interchain-accounts/host/client/cli/tx_test.go +++ b/modules/apps/27-interchain-accounts/host/client/cli/tx_test.go @@ -101,44 +101,46 @@ func TestGeneratePacketData(t *testing.T) { }, } - for _, tc := range tests { - tc := tc - ir := codectypes.NewInterfaceRegistry() - if tc.registerInterfaceFn != nil { - tc.registerInterfaceFn(ir) - } + encodings := []string{icatypes.EncodingProtobuf, icatypes.EncodingProto3JSON} + for _, encoding := range encodings { + for _, tc := range tests { + tc := tc + ir := codectypes.NewInterfaceRegistry() + if tc.registerInterfaceFn != nil { + tc.registerInterfaceFn(ir) + } - cdc := codec.NewProtoCodec(ir) + cdc := codec.NewProtoCodec(ir) - t.Run(tc.name, func(t *testing.T) { - bz, err := generatePacketData(cdc, []byte(tc.message), tc.memo) + t.Run(fmt.Sprintf("%s with %s encoding", tc.name, encoding), func(t *testing.T) { + bz, err := generatePacketData(cdc, []byte(tc.message), tc.memo, encoding) - if tc.expectedPass { - require.NoError(t, err) - require.NotNil(t, bz) + if tc.expectedPass { + require.NoError(t, err) + require.NotNil(t, bz) - packetData := icatypes.InterchainAccountPacketData{} - err = cdc.UnmarshalJSON(bz, &packetData) - require.NoError(t, err) + packetData := icatypes.InterchainAccountPacketData{} + err = cdc.UnmarshalJSON(bz, &packetData) + require.NoError(t, err) - require.Equal(t, icatypes.EXECUTE_TX, packetData.Type) - require.Equal(t, tc.memo, packetData.Memo) + require.Equal(t, icatypes.EXECUTE_TX, packetData.Type) + require.Equal(t, tc.memo, packetData.Memo) - data := packetData.Data - // cli tx commands always use protobuf encoding - messages, err := icatypes.DeserializeCosmosTx(cdc, data, icatypes.EncodingProtobuf) + data := packetData.Data + messages, err := icatypes.DeserializeCosmosTx(cdc, data, encoding) - require.NoError(t, err) - require.NotNil(t, messages) + require.NoError(t, err) + require.NotNil(t, messages) - if tc.assertionFn != nil { - tc.assertionFn(t, messages) + if tc.assertionFn != nil { + tc.assertionFn(t, messages) + } + } else { + require.Error(t, err) + require.Nil(t, bz) } - } else { - require.Error(t, err) - require.Nil(t, bz) - } - }) + }) + } } } From 12bffb9ec0e46b49d8556e4ad15c87af4e7fa969 Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Fri, 1 Sep 2023 09:27:41 +0200 Subject: [PATCH 4/9] linter fixes --- modules/apps/27-interchain-accounts/host/client/cli/tx.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/apps/27-interchain-accounts/host/client/cli/tx.go b/modules/apps/27-interchain-accounts/host/client/cli/tx.go index 8ef0c0c19e2..607eb785b3b 100644 --- a/modules/apps/27-interchain-accounts/host/client/cli/tx.go +++ b/modules/apps/27-interchain-accounts/host/client/cli/tx.go @@ -2,7 +2,6 @@ package cli import ( "encoding/json" - "errors" "fmt" "github.com/cosmos/gogoproto/proto" @@ -14,7 +13,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" - "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" ) @@ -78,8 +76,8 @@ to be executed on the host chain. The encoding parameter must be equal to either } encoding := args[0] - if !slices.Contains([]string{types.EncodingProtobuf, types.EncodingProto3JSON}, encoding) { - return errors.New(fmt.Sprintf("unsupported encoding type: %s", encoding)) + if !slices.Contains([]string{icatypes.EncodingProtobuf, icatypes.EncodingProto3JSON}, encoding) { + return fmt.Errorf("unsupported encoding type: %s", encoding) } packetDataBytes, err := generatePacketData(cdc, []byte(args[1]), memo, encoding) From afafeea53a18da76319af73d34dc6f588d583027 Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Fri, 1 Sep 2023 10:45:46 +0200 Subject: [PATCH 5/9] review feedback --- docs/apps/interchain-accounts/client.md | 4 +-- .../host/client/cli/tx.go | 27 ++++++++++++------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/docs/apps/interchain-accounts/client.md b/docs/apps/interchain-accounts/client.md index f9a212e8c69..29648be690c 100644 --- a/docs/apps/interchain-accounts/client.md +++ b/docs/apps/interchain-accounts/client.md @@ -84,10 +84,10 @@ simd tx interchain-accounts host --help ##### `generate-packet-data` -The `generate-packet-data` command allows users to generate protobuf or proto3 JSON encoded interchain accounts packet data for input message(s). The packet data can then be used with the controller submodule's [`send-tx` command](#send-tx). The encoding parameter must be either `proto3` or `proto3json`. +The `generate-packet-data` command allows users to generate protobuf or proto3 JSON encoded interchain accounts packet data for input message(s). The packet data can then be used with the controller submodule's [`send-tx` command](#send-tx). The `--encoding` flag can be uesd to specify the encoding format (value must be either `proto3` or `proto3json`); if not specified, the default will be `proto3`. The `--memo` flag can be used to include a memo string in the interchain accounts packet data. ```shell -simd tx interchain-accounts host generate-packet-data [encoding] [message] +simd tx interchain-accounts host generate-packet-data [message] ``` Example: diff --git a/modules/apps/27-interchain-accounts/host/client/cli/tx.go b/modules/apps/27-interchain-accounts/host/client/cli/tx.go index 607eb785b3b..792bda77ab2 100644 --- a/modules/apps/27-interchain-accounts/host/client/cli/tx.go +++ b/modules/apps/27-interchain-accounts/host/client/cli/tx.go @@ -17,18 +17,20 @@ import ( ) const ( - memoFlag string = "memo" + memoFlag string = "memo" + encodingFlag string = "encoding" ) func generatePacketDataCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "generate-packet-data [encoding] [message]", + Use: "generate-packet-data [message]", Short: "Generates protobuf or proto3 JSON encoded ICA packet data.", Long: `generate-packet-data accepts a message string and serializes it (depending on the encoding parameter) using protobuf or proto3 JSON into packet data which is outputted to stdout. It can be used in conjunction with send-tx which submits pre-built packet data containing messages -to be executed on the host chain. The encoding parameter must be equal to either "proto3" o "proto3json".`, - Example: fmt.Sprintf(`%s tx interchain-accounts host generate-packet-data proto3 '{ +to be executed on the host chain. The default encoding format is protobuf is none is specified; +otherwise the encoding flag can be sued in combination with either "proto3" or "proto3json".`, + Example: fmt.Sprintf(`%s tx interchain-accounts host generate-packet-data '{ "@type":"/cosmos.bank.v1beta1.MsgSend", "from_address":"cosmos15ccshhmp0gsx29qpqq6g4zmltnnvgmyu9ueuadh9y2nc5zj0szls5gtddz", "to_address":"cosmos10h9stc5v6ntgeygf5xf945njqq5h32r53uquvw", @@ -38,10 +40,10 @@ to be executed on the host chain. The encoding parameter must be equal to either "amount": "1000" } ] -}' --memo memo +}' --memo memo --encoding proto3json -%s tx interchain-accounts host generate-packet-data proto3 '[{ +%s tx interchain-accounts host generate-packet-data '[{ "@type":"/cosmos.bank.v1beta1.MsgSend", "from_address":"cosmos15ccshhmp0gsx29qpqq6g4zmltnnvgmyu9ueuadh9y2nc5zj0szls5gtddz", "to_address":"cosmos10h9stc5v6ntgeygf5xf945njqq5h32r53uquvw", @@ -61,7 +63,7 @@ to be executed on the host chain. The encoding parameter must be equal to either "amount": "1000" } }]'`, version.AppName, version.AppName), - Args: cobra.ExactArgs(2), + Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) if err != nil { @@ -75,12 +77,16 @@ to be executed on the host chain. The encoding parameter must be equal to either return err } - encoding := args[0] + encoding, err := cmd.Flags().GetString(encodingFlag) + if err != nil { + return err + } + if !slices.Contains([]string{icatypes.EncodingProtobuf, icatypes.EncodingProto3JSON}, encoding) { return fmt.Errorf("unsupported encoding type: %s", encoding) } - packetDataBytes, err := generatePacketData(cdc, []byte(args[1]), memo, encoding) + packetDataBytes, err := generatePacketData(cdc, []byte(args[0]), memo, encoding) if err != nil { return err } @@ -91,7 +97,8 @@ to be executed on the host chain. The encoding parameter must be equal to either }, } - cmd.Flags().String(memoFlag, "", "an optional memo to be included in the interchain account packet data") + cmd.Flags().String(memoFlag, "", "an optional memo to be included in the interchain accounts packet data") + cmd.Flags().String(encodingFlag, "", "optional encoding format of the messages in the interchain accounts packet data") return cmd } From f834dd0e8cfbaa237dfd1bfaf06ba4c502879135 Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Fri, 1 Sep 2023 10:51:30 +0200 Subject: [PATCH 6/9] Update client.md --- docs/apps/interchain-accounts/client.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/apps/interchain-accounts/client.md b/docs/apps/interchain-accounts/client.md index 29648be690c..83e10a73bf7 100644 --- a/docs/apps/interchain-accounts/client.md +++ b/docs/apps/interchain-accounts/client.md @@ -93,7 +93,7 @@ simd tx interchain-accounts host generate-packet-data [message] Example: ```shell -simd tx interchain-accounts host generate-packet-data proto3 '[{ +simd tx interchain-accounts host generate-packet-data '[{ "@type":"/cosmos.bank.v1beta1.MsgSend", "from_address":"cosmos15ccshhmp0gsx29qpqq6g4zmltnnvgmyu9ueuadh9y2nc5zj0szls5gtddz", "to_address":"cosmos10h9stc5v6ntgeygf5xf945njqq5h32r53uquvw", From 5bbe95c5bae34a5825cf7976613485718c5b5717 Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Fri, 1 Sep 2023 10:52:15 +0200 Subject: [PATCH 7/9] typos --- modules/apps/27-interchain-accounts/host/client/cli/tx.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/apps/27-interchain-accounts/host/client/cli/tx.go b/modules/apps/27-interchain-accounts/host/client/cli/tx.go index 792bda77ab2..7e76b6c848d 100644 --- a/modules/apps/27-interchain-accounts/host/client/cli/tx.go +++ b/modules/apps/27-interchain-accounts/host/client/cli/tx.go @@ -28,8 +28,8 @@ func generatePacketDataCmd() *cobra.Command { Long: `generate-packet-data accepts a message string and serializes it (depending on the encoding parameter) using protobuf or proto3 JSON into packet data which is outputted to stdout. It can be used in conjunction with send-tx which submits pre-built packet data containing messages -to be executed on the host chain. The default encoding format is protobuf is none is specified; -otherwise the encoding flag can be sued in combination with either "proto3" or "proto3json".`, +to be executed on the host chain. The default encoding format is protobuf if none is specified; +otherwise the encoding flag can be used in combination with either "proto3" or "proto3json".`, Example: fmt.Sprintf(`%s tx interchain-accounts host generate-packet-data '{ "@type":"/cosmos.bank.v1beta1.MsgSend", "from_address":"cosmos15ccshhmp0gsx29qpqq6g4zmltnnvgmyu9ueuadh9y2nc5zj0szls5gtddz", From 96c8137611a9d423c4a112715b0bb03f54765c6c Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Tue, 5 Sep 2023 09:05:12 +0200 Subject: [PATCH 8/9] Update modules/apps/27-interchain-accounts/host/client/cli/tx.go Co-authored-by: Damian Nolan --- modules/apps/27-interchain-accounts/host/client/cli/tx.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/apps/27-interchain-accounts/host/client/cli/tx.go b/modules/apps/27-interchain-accounts/host/client/cli/tx.go index 7e76b6c848d..fb381e0aea5 100644 --- a/modules/apps/27-interchain-accounts/host/client/cli/tx.go +++ b/modules/apps/27-interchain-accounts/host/client/cli/tx.go @@ -97,7 +97,7 @@ otherwise the encoding flag can be used in combination with either "proto3" or " }, } - cmd.Flags().String(memoFlag, "", "an optional memo to be included in the interchain accounts packet data") + cmd.Flags().String(memoFlag, "", "optional memo to be included in the interchain accounts packet data") cmd.Flags().String(encodingFlag, "", "optional encoding format of the messages in the interchain accounts packet data") return cmd } From 458cf7dda6735b54a93f19d706c68e8da3cd27fd Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Tue, 5 Sep 2023 09:08:05 +0200 Subject: [PATCH 9/9] address review feedback --- modules/apps/27-interchain-accounts/host/client/cli/tx.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/apps/27-interchain-accounts/host/client/cli/tx.go b/modules/apps/27-interchain-accounts/host/client/cli/tx.go index fb381e0aea5..da9c24c7537 100644 --- a/modules/apps/27-interchain-accounts/host/client/cli/tx.go +++ b/modules/apps/27-interchain-accounts/host/client/cli/tx.go @@ -6,13 +6,13 @@ import ( "github.com/cosmos/gogoproto/proto" "github.com/spf13/cobra" - "golang.org/x/exp/slices" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/version" + "github.com/cosmos/ibc-go/v7/internal/collections" icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" ) @@ -82,7 +82,7 @@ otherwise the encoding flag can be used in combination with either "proto3" or " return err } - if !slices.Contains([]string{icatypes.EncodingProtobuf, icatypes.EncodingProto3JSON}, encoding) { + if !collections.Contains(encoding, []string{icatypes.EncodingProtobuf, icatypes.EncodingProto3JSON}) { return fmt.Errorf("unsupported encoding type: %s", encoding) }