From d35b7b05ee38839e542dde847ec7e0c0dabf0f10 Mon Sep 17 00:00:00 2001 From: ALPAC-4 Date: Thu, 30 Nov 2023 10:51:12 +0900 Subject: [PATCH 1/2] fix: view function --- x/move/client/cli/query.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/x/move/client/cli/query.go b/x/move/client/cli/query.go index d0a651ed..1dc4847e 100644 --- a/x/move/client/cli/query.go +++ b/x/move/client/cli/query.go @@ -273,18 +273,18 @@ func GetCmdTableEntries() *cobra.Command { func GetCmdQueryEntryFunction() *cobra.Command { bech32PrefixAccAddr := sdk.GetConfig().GetBech32AccountAddrPrefix() cmd := &cobra.Command{ - Use: "execute [module owner] [module name] [function name]", - Short: "Get entry function execution result", + Use: "view [module owner] [module name] [function name]", + Short: "Get view function execution result", Long: strings.TrimSpace( fmt.Sprintf(` -Get an entry function execution result - -Supported types : u8, u16, u32, u64, u128, u256, bool, string, address, raw, vector +Get an view function execution result +Supported types : u8, u16, u32, u64, u128, u256, bool, string, address, raw_hex, raw_base64, + vector, option, decimal128, decimal256, fixed_point32, fixed_point64 Example of args: address:0x1 bool:true u8:0 string:hello vector:a,b,c,d Example: -$ %s query move execute \ +$ %s query move view \ %s1lwjmdnks33xwnmfayc64ycprww49n33mtm92ne \ BasicCoin \ getBalance \ @@ -320,15 +320,15 @@ $ %s query move execute \ return err } - argTypes, args := parseArguments(flagArgs) - if len(argTypes) != len(args) { + moveArgTypes, moveArgs := parseArguments(flagArgs) + if len(moveArgTypes) != len(moveArgs) { return fmt.Errorf("invalid argument format len(types) != len(args)") } - serializer := NewSerializer() bcsArgs := [][]byte{} - for i := range argTypes { - bcsArg, err := BcsSerializeArg(argTypes[i], args[i], serializer) + for i := range moveArgTypes { + serializer := NewSerializer() + bcsArg, err := BcsSerializeArg(moveArgTypes[i], moveArgs[i], serializer) if err != nil { return err } From d47ae48b92186f6ec924a9ab12f9611ddf3cc4e2 Mon Sep 17 00:00:00 2001 From: ALPAC-4 Date: Thu, 30 Nov 2023 11:32:20 +0900 Subject: [PATCH 2/2] fix address serialzier --- x/move/client/cli/utils.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/x/move/client/cli/utils.go b/x/move/client/cli/utils.go index defb7247..29836c91 100644 --- a/x/move/client/cli/utils.go +++ b/x/move/client/cli/utils.go @@ -91,7 +91,16 @@ func BcsSerializeArg(argType string, arg string, s serde.Serializer) ([]byte, er if err != nil { return nil, err } - return accAddr.BcsSerialize(); + err = s.IncreaseContainerDepth() + if err != nil { + return nil, err + } + for _, item := range(accAddr) { + if err := s.SerializeU8(item); err != nil { return nil, err } + } + s.DecreaseContainerDepth() + + return s.GetBytes(), nil case "string": if err := s.SerializeStr(arg); err != nil {