From 54bdeb60a100857a0d5307f0626f01cdcb05752e Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 19 Oct 2020 12:22:46 +0300 Subject: [PATCH] [#22] Support string type in stack parameter converter Set type of stack parameter to StringType in type-switch statement of toStackParameter function. Signed-off-by: Leonard Lyubich --- pkg/morph/client/client.go | 2 ++ pkg/morph/client/client_test.go | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/pkg/morph/client/client.go b/pkg/morph/client/client.go index bf24cd831..1e4e0c0b3 100644 --- a/pkg/morph/client/client.go +++ b/pkg/morph/client/client.go @@ -162,6 +162,8 @@ func toStackParameter(value interface{}) (sc.Parameter, error) { result.Type = sc.ArrayType result.Value = arr + case string: + result.Type = sc.StringType default: return result, errors.Errorf("chain/client: unsupported parameter %v", value) } diff --git a/pkg/morph/client/client_test.go b/pkg/morph/client/client_test.go index cffe1201d..f1b1f6bb3 100644 --- a/pkg/morph/client/client_test.go +++ b/pkg/morph/client/client_test.go @@ -20,6 +20,10 @@ func TestToStackParameter(t *testing.T) { value: int64(100), expType: sc.IntegerType, }, + { + value: "hello world", + expType: sc.StringType, + }, } for _, item := range items {