From 545e8fb8b0dd15d2853c7e1bda7f68d0ffe7cfc9 Mon Sep 17 00:00:00 2001 From: Shuai Date: Fri, 19 Aug 2022 14:44:25 +0800 Subject: [PATCH] v3.4.0 --- neo | 2 +- neo3-gui/neo3-gui.sln | 10 +- neo3-gui/neo3-gui.tests/JsonConverter_Test.cs | 94 +++ neo3-gui/neo3-gui/ClientApp/package-lock.json | 4 +- neo3-gui/neo3-gui/ClientApp/package.json | 2 +- .../src/components/Advanced/advanced.js | 2 +- .../src/components/Advanced/signature.js | 168 +++--- .../ClientApp/src/components/Chain/asset.js | 2 +- .../src/components/Chain/assetdetail.js | 2 +- .../Common/Analyzers/BlockAnalyzer.cs | 4 +- .../neo3-gui/Common/Consoles/MainService.cs | 567 ------------------ .../neo3-gui/Common/Json/JObjectConverter.cs | 18 +- .../Common/Json/StackItemConverter.cs | 335 +++++++++++ neo3-gui/neo3-gui/Common/JsonRpcMiddleware.cs | 3 +- .../Common/Storage/ExecuteResultInfo.cs | 10 +- .../Storage/LevelDBModules/LevelDbContext.cs | 3 +- .../SQLiteModules/Nep5TransferEntity.cs | 1 + .../Storage/SQLiteModules/SQLiteContext.cs | 3 +- .../SQLiteModules/TransactionEntity.cs | 1 - neo3-gui/neo3-gui/Common/Storage/TrackDB.cs | 267 ++++----- neo3-gui/neo3-gui/Common/WebSocketExecutor.cs | 2 +- .../neo3-gui/Common/WebSocketHubMiddleware.cs | 2 +- neo3-gui/neo3-gui/Helpers.cs | 140 +++-- .../Contracts/InvokeContractParameterModel.cs | 7 +- neo3-gui/neo3-gui/Models/JStackItem.cs | 62 +- .../Models/Transactions/TransactionModel.cs | 1 - .../Services/ApiServices/BlockApiService.cs | 9 +- .../ApiServices/ContractApiService.cs | 53 +- .../Services/ApiServices/GovernanceService.cs | 3 - .../ApiServices/TransactionApiService.cs | 11 +- .../Services/ApiServices/VerifyApiService.cs | 1 - .../Services/ApiServices/WalletApiService.cs | 8 +- neo3-gui/neo3-gui/config.private.json | 2 +- neo3-gui/neo3-gui/neo3-gui.csproj | 6 +- 34 files changed, 817 insertions(+), 988 deletions(-) create mode 100644 neo3-gui/neo3-gui.tests/JsonConverter_Test.cs create mode 100644 neo3-gui/neo3-gui/Common/Json/StackItemConverter.cs diff --git a/neo b/neo index 7d7c5955..8df287ec 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 6c60d558..b09e96ff 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 00000000..261d328e --- /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 3166736d..18686856 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 fc3dd351..39701365 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 8f1e2012..a3d0c950 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 bc0e3a78..a78e8e27 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)}