diff --git a/neo b/neo index 7d7c595..8df287e 160000 --- a/neo +++ b/neo @@ -1 +1 @@ -Subproject commit 7d7c59554466e7ee6bdbc09f478ba4c0cbeb604f +Subproject commit 8df287ec3b1bda1f412c2e5e15eb962ff835e231 diff --git a/neo3-gui/neo3-gui.sln b/neo3-gui/neo3-gui.sln index 6c60d55..b09e96f 100644 --- a/neo3-gui/neo3-gui.sln +++ b/neo3-gui/neo3-gui.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29409.12 +# Visual Studio Version 17 +VisualStudioVersion = 17.2.32630.192 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "neo3-gui", "neo3-gui\neo3-gui.csproj", "{2B09B051-9848-4631-81A1-34A81D2E8103}" EndProject @@ -9,6 +9,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "neo", "..\neo\src\neo\neo.c EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "neo3-gui.tests", "neo3-gui.tests\neo3-gui.tests.csproj", "{2F439926-5E57-46FB-979C-43037F95ECC8}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Neo.Json", "..\neo\src\Neo.Json\Neo.Json.csproj", "{88C3A94F-B476-48E3-9205-D92B6FFFFCCF}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -27,6 +29,10 @@ Global {2F439926-5E57-46FB-979C-43037F95ECC8}.Debug|Any CPU.Build.0 = Debug|Any CPU {2F439926-5E57-46FB-979C-43037F95ECC8}.Release|Any CPU.ActiveCfg = Release|Any CPU {2F439926-5E57-46FB-979C-43037F95ECC8}.Release|Any CPU.Build.0 = Release|Any CPU + {88C3A94F-B476-48E3-9205-D92B6FFFFCCF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {88C3A94F-B476-48E3-9205-D92B6FFFFCCF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {88C3A94F-B476-48E3-9205-D92B6FFFFCCF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {88C3A94F-B476-48E3-9205-D92B6FFFFCCF}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/neo3-gui/neo3-gui.tests/JsonConverter_Test.cs b/neo3-gui/neo3-gui.tests/JsonConverter_Test.cs new file mode 100644 index 0000000..261d328 --- /dev/null +++ b/neo3-gui/neo3-gui.tests/JsonConverter_Test.cs @@ -0,0 +1,94 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Neo; +using Neo.SmartContract; +using Neo.VM; +using Neo.VM.Types; + +namespace neo3_gui.tests +{ + [TestClass] + public class JsonConverter_Test + { + [TestMethod] + public void Test() + { + var data = "1234".HexToBytes(); + StackItem item = new ByteString(data); + var json = item.SerializeJson(); + Console.WriteLine(json); + StackItem item2 = json.DeserializeJson(); + Assert.AreEqual(json,item2.SerializeJson()); + + item = new Neo.VM.Types.Buffer(data); + json = item.SerializeJson(); + Console.WriteLine(json); + item2 = json.DeserializeJson(); + Assert.AreEqual(json, item2.SerializeJson()); + + + item = new Integer(20); + json = item.SerializeJson(); + Console.WriteLine(json); + item2 = json.DeserializeJson(); + Assert.AreEqual(json, item2.SerializeJson()); + + + item = true; + json = item.SerializeJson(); + Console.WriteLine(json); + item2 = json.DeserializeJson(); + Assert.AreEqual(json, item2.SerializeJson()); + + + item = new Pointer(data, 1); + json = item.SerializeJson(); + Console.WriteLine(json); + item2 = json.DeserializeJson(); + Assert.AreEqual(json, item2.SerializeJson()); + + + item = StackItem.Null; + json = item.SerializeJson(); + Console.WriteLine(json); + item2 = json.DeserializeJson(); + Assert.AreEqual(json, item2.SerializeJson()); + + + var list = new List() + { + 1, 2, true, false, data,StackItem.Null + }; + item = new Neo.VM.Types.Array(list); + json = item.SerializeJson(); + Console.WriteLine(json); + item2 = json.DeserializeJson(); + Assert.AreEqual(json, item2.SerializeJson()); + + + item = new Neo.VM.Types.Struct(list); + json = item.SerializeJson(); + Console.WriteLine(json); + item2 = json.DeserializeJson(); + Assert.AreEqual(json, item2.SerializeJson()); + + + var map = new Neo.VM.Types.Map(); + map[1] = true; + map[2] = false; + map["a"] = "A"; + map["b"] = StackItem.Null; + + item=map; + json = item.SerializeJson(); + Console.WriteLine(json); + item2 = json.DeserializeJson(); + Assert.AreEqual(json, item2.SerializeJson()); + + } + } +} diff --git a/neo3-gui/neo3-gui/ClientApp/package-lock.json b/neo3-gui/neo3-gui/ClientApp/package-lock.json index 3166736..1868685 100644 --- a/neo3-gui/neo3-gui/ClientApp/package-lock.json +++ b/neo3-gui/neo3-gui/ClientApp/package-lock.json @@ -1,12 +1,12 @@ { "name": "neo-gui", - "version": "1.4.2", + "version": "1.4.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "neo-gui", - "version": "1.4.2", + "version": "1.4.3", "dependencies": { "@testing-library/jest-dom": "^4.2.4", "@testing-library/react": "^9.3.2", diff --git a/neo3-gui/neo3-gui/ClientApp/package.json b/neo3-gui/neo3-gui/ClientApp/package.json index fc3dd35..3970136 100644 --- a/neo3-gui/neo3-gui/ClientApp/package.json +++ b/neo3-gui/neo3-gui/ClientApp/package.json @@ -1,6 +1,6 @@ { "name": "neo-gui", - "version": "1.4.2", + "version": "1.4.3", "private": true, "main": "main.js", "homepage": "./", diff --git a/neo3-gui/neo3-gui/ClientApp/src/components/Advanced/advanced.js b/neo3-gui/neo3-gui/ClientApp/src/components/Advanced/advanced.js index 8f1e201..a3d0c95 100644 --- a/neo3-gui/neo3-gui/ClientApp/src/components/Advanced/advanced.js +++ b/neo3-gui/neo3-gui/ClientApp/src/components/Advanced/advanced.js @@ -60,7 +60,7 @@ class Advanced extends React.Component { {t("advanced.test coin")} diff --git a/neo3-gui/neo3-gui/ClientApp/src/components/Advanced/signature.js b/neo3-gui/neo3-gui/ClientApp/src/components/Advanced/signature.js index bc0e3a7..a78e8e2 100644 --- a/neo3-gui/neo3-gui/ClientApp/src/components/Advanced/signature.js +++ b/neo3-gui/neo3-gui/ClientApp/src/components/Advanced/signature.js @@ -1,14 +1,10 @@ /* eslint-disable */ -import React, { useState, useEffect, useRef,useContext } from 'react'; +import React from 'react'; import 'antd/dist/antd.css'; -import axios from 'axios'; import { Form, Input, Button } from 'antd'; -import { Layout, Row, Col, Tabs, message, PageHeader,Modal } from 'antd'; -import { walletStore } from "../../store/stores"; -import { withRouter } from "react-router-dom"; +import { Layout, Row, Col, Tabs, message, PageHeader, Modal } from 'antd'; import Sync from '../sync'; import "../../static/css/advanced.css"; -import { SwapOutlined, PaperClipOutlined } from '@ant-design/icons'; import { withTranslation, useTranslation } from "react-i18next"; import { Trans } from 'react-i18next'; import { post } from "../../core/request"; @@ -30,14 +26,14 @@ function success(data) {

blockchain.transaction hash:

{data.result}

-
+ ); if (method === 'AppendSignature') { title = (advanced.signature success) content = (
-                    { JSON.stringify(JSON.parse(result), null, 2) }
+                    {JSON.stringify(JSON.parse(result), null, 2)}
                 

); - } + } Modal.success({ width: 650, centered: true, title: title, content: content, - okText:button.ok + okText: button.ok }); } @@ -66,11 +62,11 @@ function error(data) { ); if (data.error.code === 20014) { - title = (wallet.transfer send error 20014); + title = (wallet.transfer send error 20014); content = (
-                    { JSON.stringify(JSON.parse(data.error.message), null, 2) }
+                    {JSON.stringify(JSON.parse(data.error.message), null, 2)}