diff --git a/pkg/vm/stack.go b/pkg/vm/stack.go index f5f93287d..e2256c422 100644 --- a/pkg/vm/stack.go +++ b/pkg/vm/stack.go @@ -6,7 +6,6 @@ import ( "fmt" "math/big" - "github.com/nspcc-dev/neo-go/pkg/smartcontract" "github.com/nspcc-dev/neo-go/pkg/vm/stackitem" ) @@ -405,18 +404,15 @@ func (s *Stack) ToArray() []stackitem.Item { return items } -// ToContractParameters converts Stack to slice of smartcontract.Parameter. -func (s *Stack) ToContractParameters() []smartcontract.Parameter { - items := make([]smartcontract.Parameter, 0, s.Len()) - s.IterBack(func(e *Element) { - // Each item is independent. - seen := make(map[stackitem.Item]bool) - items = append(items, smartcontract.ParameterFromStackItem(e.value, seen)) - }) - return items -} - // MarshalJSON implements JSON marshalling interface. func (s *Stack) MarshalJSON() ([]byte, error) { - return json.Marshal(s.ToContractParameters()) + items := s.ToArray() + arr := make([]json.RawMessage, len(items)) + for i := range items { + data, err := stackitem.ToJSONWithTypes(items[i]) + if err == nil { + arr[i] = data + } + } + return json.Marshal(arr) } diff --git a/pkg/vm/vm.go b/pkg/vm/vm.go index dcef4e0e5..a1cd02358 100644 --- a/pkg/vm/vm.go +++ b/pkg/vm/vm.go @@ -321,7 +321,7 @@ func (v *VM) Stack(n string) string { if n == "estack" { s = v.estack } - b, _ := json.MarshalIndent(s.ToContractParameters(), "", " ") + b, _ := json.MarshalIndent(s, "", " ") return string(b) }