public static string StackItemAsString(StackItem item, bool addQuotes = false)
        {
            if (item.IsArray)
            {
                var s     = new StringBuilder();
                var items = item.GetArray();

                s.Append('[');
                for (int i = 0; i < items.Length; i++)
                {
                    var element = items[i];
                    if (i > 0)
                    {
                        s.Append(',');
                    }
                    s.Append(StackItemAsString(element));
                }
                s.Append(']');
                return(s.ToString());
            }

            if (item is Neo.VM.Types.Boolean)
            {
                return(item.GetBoolean().ToString());
            }

            if (item is Neo.VM.Types.Integer)
            {
                return(item.GetBigInteger().ToString());
            }

            if (item is Neo.VM.Types.InteropInterface)
            {
                return("{InteropInterface}");
            }

            var data = item.GetByteArray();

            if (data == null)
            {
                return("[Null]");
            }

            if (data == null || data.Length == 0)
            {
                return("False");
            }


            return(FormattingUtils.OutputData(data, addQuotes));
        }
        public static string StackItemAsString(StackItem item, bool addQuotes = false, string hintType = null)
        {
            if (item is ICollection)
            {
                var bytes = item.GetByteArray();
                if (bytes != null && bytes.Length == 20)
                {
                    var signatureHash = new UInt160(bytes);
                    return(Crypto.Default.ToAddress(signatureHash));
                }

                var s     = new StringBuilder();
                var items = (ICollection)item;

                s.Append('[');
                int i = 0;
                foreach (StackItem element in items)
                {
                    if (i > 0)
                    {
                        s.Append(',');
                    }
                    s.Append(StackItemAsString(element));

                    i++;
                }
                s.Append(']');


                return(s.ToString());
            }

            if (item is Neo.VM.Types.Boolean && hintType == null)
            {
                return(item.GetBoolean().ToString());
            }

            if (item is Neo.VM.Types.Integer && hintType == null)
            {
                return(item.GetBigInteger().ToString());
            }

            if (item is Neo.VM.Types.InteropInterface)
            {
                return("{InteropInterface}");
            }

            byte[] data = null;

            try {
                data = item.GetByteArray();
            }
            catch
            {
            }

            if ((data == null || data.Length == 0) && hintType == null)
            {
                return("Null");
            }

            return(FormattingUtils.OutputData(data, addQuotes, hintType));
        }