diff --git a/neo3-gui/neo3-gui/ClientApp/public/locales/en/translation.json b/neo3-gui/neo3-gui/ClientApp/public/locales/en/translation.json
index 6c09ef8..266a95a 100644
--- a/neo3-gui/neo3-gui/ClientApp/public/locales/en/translation.json
+++ b/neo3-gui/neo3-gui/ClientApp/public/locales/en/translation.json
@@ -111,7 +111,8 @@
"transaction info": "Transaction Info",
"transactions": "Transactions",
"unconfirmed transactions": "Unconfirmed Transactions",
- "witness": "Witness"
+ "witness": "Witness",
+ "search input-invalid": "input block is not exist"
},
"button": {
"cancel": "Cancel",
@@ -194,11 +195,12 @@
"please input password": "Please input password",
"please select file location": "Please select file location",
"search": {
- "chain-hint": "Pelese input height",
+ "chain-hint": "Please input height or hash",
"check again": "Please check input",
"hash unexist": "The hash not exist,please check again",
"hash-hint": "Pelese input hash",
- "height unexist": "The height not exist,please check again"
+ "height unexist": "The height not exist,please check again",
+ "asset-search-hint": "please input asset hash"
},
"select account": "Select Address",
"select path": "Select Path",
diff --git a/neo3-gui/neo3-gui/ClientApp/public/locales/zh/translation.json b/neo3-gui/neo3-gui/ClientApp/public/locales/zh/translation.json
index d53fb59..c62c9a0 100644
--- a/neo3-gui/neo3-gui/ClientApp/public/locales/zh/translation.json
+++ b/neo3-gui/neo3-gui/ClientApp/public/locales/zh/translation.json
@@ -111,7 +111,8 @@
"transaction info": "交易信息",
"transactions": "交易列表",
"unconfirmed transactions": "待确认交易",
- "witness": "见证人"
+ "witness": "见证人",
+ "search input-invalid": "查询的区块不存在"
},
"button": {
"cancel": "取消",
@@ -194,11 +195,12 @@
"please input password": "请输入密码",
"please select file location": "请选择文件存储位置",
"search": {
- "chain-hint": "输入需要查找的 height",
+ "chain-hint": "输入需要查找的高度或Hash",
"check again": "请检查输入是否正确",
"hash unexist": "该合约hash不存在,请查证后再输入",
"hash-hint": "输入需要查找的脚本散列",
- "height unexist": "该高度不存在,请查证后再输入"
+ "height unexist": "该高度不存在,请查证后再输入",
+ "asset-search-hint": "请输入资产Hash"
},
"select account": "选择地址",
"select path": "选择路径",
diff --git a/neo3-gui/neo3-gui/ClientApp/src/components/Chain/asset.js b/neo3-gui/neo3-gui/ClientApp/src/components/Chain/asset.js
index 624eca5..9835dad 100644
--- a/neo3-gui/neo3-gui/ClientApp/src/components/Chain/asset.js
+++ b/neo3-gui/neo3-gui/ClientApp/src/components/Chain/asset.js
@@ -14,6 +14,7 @@ import Sync from "../sync";
import { withTranslation, useTranslation } from "react-i18next";
import { postAsync } from "../../core/request";
import "../../static/css/chain.css";
+import AssetSearch from "./assetSearch";
export default function ChainAsset() {
const { Content } = Layout;
@@ -78,6 +79,7 @@ export default function ChainAsset() {
/>
+
diff --git a/neo3-gui/neo3-gui/ClientApp/src/components/Chain/assetSearch.js b/neo3-gui/neo3-gui/ClientApp/src/components/Chain/assetSearch.js
new file mode 100644
index 0000000..de49469
--- /dev/null
+++ b/neo3-gui/neo3-gui/ClientApp/src/components/Chain/assetSearch.js
@@ -0,0 +1,92 @@
+/* eslint-disable */
+import React from "react";
+import "antd/dist/antd.css";
+import { Input, message } from "antd";
+import Topath from "../Common/topath";
+import { ArrowRightOutlined, SearchOutlined } from "@ant-design/icons";
+import { withTranslation } from "react-i18next";
+import { postAsync } from "../../core/request";
+
+@withTranslation()
+class AssetSearch extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ size: "default",
+ path: "",
+ disabled: false,
+ cname: "search-content",
+ };
+ }
+ addClass = (e) => {
+ this.stopPropagation(e);
+ this.setState({
+ cname: "search-content height-sea show-child",
+ disabled: true,
+ });
+ document.addEventListener("click", this.removeClass);
+ };
+ removeClass = () => {
+ if (this.state.disabled) {
+ this.setState({
+ cname: "search-content height-sea",
+ disabled: false,
+ });
+ }
+ document.removeEventListener("click", this.removeClass);
+ setTimeout(
+ () =>
+ this.setState({
+ cname: "search-content",
+ disabled: false,
+ }),
+ 500
+ );
+ };
+ stopPropagation(e) {
+ e.nativeEvent.stopImmediatePropagation();
+ }
+ searchAsset = async () => {
+ const { t } = this.props;
+ let hash = this.refs.sinput.input.value.trim();
+ if (!hash || hash.length != 42) {
+ message.info(t("search.check again"));
+ return;
+ }
+ let response = await postAsync("GetContract", {
+ contractHash: hash,
+ });
+ if (response.msgType === -1) {
+ message.info(t("search.check again"));
+ return;
+ }
+ this.setState({ topath: "/chain/asset:" + hash });
+ };
+ render = () => {
+ const { t } = this.props;
+ return (
+
+ );
+ };
+}
+
+export default AssetSearch;
diff --git a/neo3-gui/neo3-gui/ClientApp/src/components/Chain/blockdetail.js b/neo3-gui/neo3-gui/ClientApp/src/components/Chain/blockdetail.js
index c1c6ca4..b22e69e 100644
--- a/neo3-gui/neo3-gui/ClientApp/src/components/Chain/blockdetail.js
+++ b/neo3-gui/neo3-gui/ClientApp/src/components/Chain/blockdetail.js
@@ -16,7 +16,8 @@ export default function BlockDetail() {
const [height, setHeight] = useState(0);
const [blockdetail, setBlockDetail] = useState({});
const [translist, setTransList] = useState([]);
- let blockHeight = Number(location.pathname.split(":").pop());
+ let identity = location.pathname.split(":").pop();
+ let blockHeight = Number(identity);
useEffect(() => {
postAsync("GetBlock", { index: blockHeight })
.then(function (data) {
@@ -25,9 +26,6 @@ export default function BlockDetail() {
return;
}
setBlockDetail(data.result);
- })
- .catch(function (error) {
- console.log(error);
});
postAsync("QueryTransactions", { blockHeight: blockHeight, limit: 500, })
@@ -37,9 +35,6 @@ export default function BlockDetail() {
return;
}
setTransList(msg.result.list);
- })
- .catch(function (error) {
- console.log(error);
});
}, [height]);
return (
diff --git a/neo3-gui/neo3-gui/ClientApp/src/components/Chain/chain.js b/neo3-gui/neo3-gui/ClientApp/src/components/Chain/chain.js
index b356ad7..7501a77 100644
--- a/neo3-gui/neo3-gui/ClientApp/src/components/Chain/chain.js
+++ b/neo3-gui/neo3-gui/ClientApp/src/components/Chain/chain.js
@@ -12,10 +12,9 @@ import {
Button,
PageHeader,
} from "antd";
-import Chainsearch from "./searcharea";
+import Chainsearch from "./chainSearch";
import Sync from "../sync";
import { withTranslation } from "react-i18next";
-
import "../../static/css/contract.css";
import { postAsync } from "../../core/request";
diff --git a/neo3-gui/neo3-gui/ClientApp/src/components/Chain/searcharea.js b/neo3-gui/neo3-gui/ClientApp/src/components/Chain/chainSearch.js
similarity index 80%
rename from neo3-gui/neo3-gui/ClientApp/src/components/Chain/searcharea.js
rename to neo3-gui/neo3-gui/ClientApp/src/components/Chain/chainSearch.js
index aa36060..0427ea2 100644
--- a/neo3-gui/neo3-gui/ClientApp/src/components/Chain/searcharea.js
+++ b/neo3-gui/neo3-gui/ClientApp/src/components/Chain/chainSearch.js
@@ -1,7 +1,6 @@
/* eslint-disable */
import React from "react";
import "antd/dist/antd.css";
-import axios from "axios";
import { Input, message } from "antd";
import Topath from "../Common/topath";
import { ArrowRightOutlined, SearchOutlined } from "@ant-design/icons";
@@ -49,19 +48,24 @@ class Chainsearch extends React.Component {
}
searchChain = async () => {
const { t } = this.props;
- let _height = Number(this.refs.sinput.input.value.trim());
- if (!_height && _height != 0) {
+ let input = this.refs.sinput.input.value.trim();
+ let blockHeight = 0;
+ let blockHash = null;
+ if (input.length == 66) {
+ blockHash = input
+ } else {
+ blockHeight = Number(input);
+ }
+ if (!input) {
message.info(t("search.check again"));
return;
}
- let response = await postAsync("GetBlock", {
- index: _height,
- });
+ let response = !blockHash ? (await postAsync("GetBlock", { index: blockHeight })) : (await postAsync("GetBlockByHash", { hash: blockHash }));
if (response.msgType === -1) {
- message.info(t("blockchain.height unexist"));
+ message.info(t("blockchain.search input-invalid"));
return;
}
- this.setState({ topath: "/chain/detail:" + _height });
+ this.setState({ topath: "/chain/detail:" + response.result.blockHeight });
};
render = () => {
const { t } = this.props;
diff --git a/neo3-gui/neo3-gui/ClientApp/src/components/Chain/hashdetail.js b/neo3-gui/neo3-gui/ClientApp/src/components/Chain/hashdetail.js
deleted file mode 100644
index 8e53eb1..0000000
--- a/neo3-gui/neo3-gui/ClientApp/src/components/Chain/hashdetail.js
+++ /dev/null
@@ -1,115 +0,0 @@
-/* eslint-disable */
-//just test replace wallet//
-import React from 'react';
-import { Link } from 'react-router-dom';
-import { Layout, Row, Col, message, List, Typography, PageHeader } from 'antd';
-import Sync from '../sync';
-import { postAsync } from '../../core/request';
-
-const { Content } = Layout;
-
-class Blockdetail extends React.Component {
- constructor(props) {
- super(props);
- this.state = {
- blockdetail: {},
- hash: "",
- witness: "",
- nonce: 0,
- };
- }
- componentDidMount() {
- let _h = location.pathname.split(":").pop();
- this.setHash(_h)();
- this.setState({
- local: location.pathname
- })
- }
- getAllblock = async () => {
- let _hash = this.state.hash;
- let response = await postAsync("GetBlockByHash", {
- "hash": _hash
- });
- if (response.msgType === -1) {
- message.error("查询失败,该hash错误");
- return;
- }
- this.setState({
- blockdetail: response.result,
- witness: response.result.witness.scriptHash,
- nonce: response.result.consensusData.nonce,
- translist: response.result.transactions
- });
- }
- setHash = (h) => {
- return () => {
- this.setState({
- hash: h
- }, () => this.getAllblock());
- }
- }
- render() {
- const { blockdetail, witness, nonce, translist, local } = this.state;
- return (
-
-
-
-
-
-
-
-
Hash: {blockdetail.blockHash}
-
-
-
- - 高度:{blockdetail.blockHeight}
- - 时间戳:{blockdetail.blockTime}
- - 网络费:{blockdetail.networkFee ? blockdetail.networkFee : '--'}
- - 确认数:{blockdetail.confirmations}
-
-
-
-
- - 大小:{blockdetail.blockHeight}
- - 随机数:{nonce}
- - 系统费:{blockdetail.networkFee ? blockdetail.networkFee : '--'}
- - 见证人:{witness}
-
-
-
-
-
-
-
-
-
- 交易hash数量时间}
- footer={}
- itemLayout="horizontal"
- dataSource={translist}
- className="font-s"
- renderItem={item => (
-
- {item.txId}}
- description={
-
- From:{item.transfers[0].fromAddress ? item.transfers[0].fromAddress : "--"}
- To:{item.transfers[0].toAddress ? item.transfers[0].toAddress : "--"}
-
}
- />
- {item.blockTime}
- {item.transfers[0].amount}{item.transfers[0].symbol}
-
- )}
- />
-
-
-
-
- );
- }
-}
-
-export default Blockdetail;
\ No newline at end of file
diff --git a/neo3-gui/neo3-gui/ClientApp/src/components/Common/dataConverter.js b/neo3-gui/neo3-gui/ClientApp/src/components/Common/dataConverter.js
index 3730a92..3d9fb13 100644
--- a/neo3-gui/neo3-gui/ClientApp/src/components/Common/dataConverter.js
+++ b/neo3-gui/neo3-gui/ClientApp/src/components/Common/dataConverter.js
@@ -48,6 +48,15 @@ class DataConverter {
return Buffer.from(hexString, "hex").toString("base64");
}
+
+ /**
+ * input: 'Y6OYnLSplXGqADltPHFV+upAmLo=',output:'63a3989cb4a99571aa00396d3c7155faea4098ba'
+ * @param {*} base64String
+ */
+ fromBase64String(base64String) {
+ return Buffer.from(base64String, "base64").toString("hex");
+ }
+
/**
* Encode hex string to utf8 string,input:'7472616e73666572',output:'transfer'
* @param {*} hexString
diff --git a/neo3-gui/neo3-gui/ClientApp/src/components/Common/menudown.js b/neo3-gui/neo3-gui/ClientApp/src/components/Common/menudown.js
index 81118f9..c045fc0 100644
--- a/neo3-gui/neo3-gui/ClientApp/src/components/Common/menudown.js
+++ b/neo3-gui/neo3-gui/ClientApp/src/components/Common/menudown.js
@@ -4,7 +4,6 @@ import { observer, inject } from "mobx-react";
import { withRouter } from "react-router-dom";
import "antd/dist/antd.css";
import { message, Modal, Radio } from "antd";
-import axios from "axios";
import { Addressdetail, Changepass, Setting } from "./menuaction";
import {
ReadOutlined,
diff --git a/neo3-gui/neo3-gui/ClientApp/src/components/Common/parameterInput.js b/neo3-gui/neo3-gui/ClientApp/src/components/Common/parameterInput.js
new file mode 100644
index 0000000..b3f18d5
--- /dev/null
+++ b/neo3-gui/neo3-gui/ClientApp/src/components/Common/parameterInput.js
@@ -0,0 +1,165 @@
+import React from "react";
+import { Input, PageHeader, Modal, Select, Row, Col, Form, message, Button, } from "antd";
+import DataConverter from "./dataConverter";
+
+
+class ParameterInput extends React.Component {
+ constructor(props) {
+ super(props);
+ this.dataConverter = new DataConverter();
+ //select type
+ // let type = this.props.type;
+ this.initComponentModel();
+ console.log("init ParameterInput", this.props);
+ this.state = {
+ options: this.options || [],
+ };
+ }
+
+ initComponentModel = () => {
+ const { type } = this.props;
+ switch (type) {
+ case "ByteArray":
+ this.options = ["HexString", "ByteArray", "String", "Integer"];
+ // if (value) {
+ // this.hexValue = this.dataConverter.toBase64String(value);
+ // if (value.length == 40) {
+ // this.options.push("Hash160");
+ // this.options.push("Address");
+ // }
+ // if (value.length == 64) {
+ // this.options.push("Hash256");
+ // }
+ // }
+ break;
+ case "Hash160":
+ this.options = ["Hash160", "Address"];
+ // if (value) {
+ // this.hexValue = value;
+ // }
+ break;
+ case "String":
+ this.options = ["ByteArray", "String"];
+ // if (value) {
+ // this.hexValue = this.dataConverter.fromUtf8String(value);
+ // }
+ break;
+ case "Integer":
+ this.options = ["ByteArray", "Integer"];
+ // if (value) {
+ // let hexInt = BigInt(value).toString(16);
+ // if (hexInt.startsWith("-")) {
+ // //unsupport negative number
+ // return;
+ // }
+ // if (hexInt.length & 1) {
+ // hexInt = "0" + hexInt;
+ // }
+ // this.hexValue = this.dataConverter.reverseHexString(hexInt);
+ // }
+ break;
+ case "Any":
+ this.options = ["HexString", "ByteArray", "String", "Integer", "Hash160", "Address", "Array"];
+ break;
+ default:
+ this.options = [type];
+ break;
+ }
+ };
+
+ // setValue = (val) => {
+ // this.setState({ value: val });
+ // };
+
+ // onChangeType = (e) => {
+ // const { type } = this.props;
+ // const newType = e;
+ // if (!this.hexValue) {
+ // return;
+ // }
+ // switch (newType) {
+ // case "Address":
+ // this.value = this.dataConverter.toAddress(this.hexValue);
+ // break;
+ // case "ByteArray":
+ // this.value = this.hexValue;
+ // break;
+ // case "Hash160":
+ // case "Hash256":
+ // this.value = "0x" + this.dataConverter.reverseHexString(this.hexValue);
+ // break;
+ // case "Base64":
+ // this.value = this.dataConverter.toBase64String(this.hexValue);
+ // break;
+ // case "String":
+ // this.value = this.dataConverter.toUtf8String(this.hexValue);
+ // break;
+ // case "Integer":
+ // this.value = this.dataConverter.toBigInt(this.hexValue).toString(10);
+ // break;
+ // }
+ // this.type = newType;
+ // this.setValue(this.value);
+ // }
+
+ // onChangeValue = (e) => {
+ // let type = this.type;
+ // let value = e.currentTarget.value;
+ // if (!value) {
+ // this.hexValue = null;
+ // return;
+ // }
+ // switch (type) {
+ // case "ByteArray":
+ // this.hexValue = this.dataConverter.fromBase64String(value);
+ // break;
+ // case "Hash160":
+ // case "Hash256":
+ // this.hexValue = this.dataConverter.reverseHexString(value.replace('0x', ''));
+ // break;
+ // case "String":
+ // this.hexValue = this.dataConverter.fromUtf8String(value);
+ // break;
+ // case "Integer":
+ // this.hexValue = value.toString(16);
+ // break;
+ // case "Address":
+ // let scriptHash = this.dataConverter.toScriptHash(value);
+ // this.hexValue = this.dataConverter.reverseHexString(scriptHash.replace('0x', ''));
+ // break;
+ // }
+ // console.log(e);
+ // }
+
+ render = () => {
+ const { name, type } = this.props;
+ const { options } = this.state;
+ return (
+ {name}} >
+
+
+
+
+
+
+
+
+
+ );
+ };
+}
+
+export default ParameterInput;
\ No newline at end of file
diff --git a/neo3-gui/neo3-gui/ClientApp/src/components/Common/searcharea.js b/neo3-gui/neo3-gui/ClientApp/src/components/Common/searcharea.js
index 18e47e6..db7b045 100644
--- a/neo3-gui/neo3-gui/ClientApp/src/components/Common/searcharea.js
+++ b/neo3-gui/neo3-gui/ClientApp/src/components/Common/searcharea.js
@@ -2,7 +2,6 @@
import React, { useState } from "react";
import "antd/dist/antd.css";
import { useHistory } from "react-router-dom";
-import axios from "axios";
import { Input, message } from "antd";
import Topath from "../Common/topath";
import { post, postAsync } from "../../core/request";
diff --git a/neo3-gui/neo3-gui/ClientApp/src/components/Contract/invoke.js b/neo3-gui/neo3-gui/ClientApp/src/components/Contract/invoke.js
index c76b453..eea1345 100644
--- a/neo3-gui/neo3-gui/ClientApp/src/components/Contract/invoke.js
+++ b/neo3-gui/neo3-gui/ClientApp/src/components/Contract/invoke.js
@@ -21,8 +21,11 @@ import { SwapOutlined } from "@ant-design/icons";
import { withRouter } from "react-router-dom";
import { withTranslation } from "react-i18next";
import DynamicArray from "./dynamicArray";
-import { post } from "../../core/request";
+import { post, postAsync } from "../../core/request";
import { MinusSquareOutlined, PlusOutlined } from "@ant-design/icons";
+import ParameterInput from "../Common/parameterInput";
+import { createRef } from "react";
+import FormItem from "antd/lib/form/FormItem";
const { Option } = Select;
@@ -42,47 +45,33 @@ const typeOption = ["ByteArray", "Address", "Hash160"];
class Contractinvoke extends React.Component {
constructor(props) {
super(props);
+ this.myForm = createRef();
this.state = {
size: 'default',
- path:"",
- disabled:false,
- visible: false,
- modal:false,
- loading:false,
- methods:[],
- params:[],
- methodselect:""
- };
- }
- toHome = () =>{
- location.href=location.origin;
- }
- showDrawer = () => {
- this.setState({
- visible: true,
- });
+ path: "",
+ disabled: false,
+ visible: false,
+ modal: false,
+ loading: false,
+ methods: [],
+ params: [],
+ methodselect: ""
};
- onClose = () => {
- this.setState({
- visible: false,
- });
- };
- showDetail = () =>{
- this.searchContract(res=>{
- this.refs.formRef.resetFields()
- this.setState({
- hash:res.contractHash,
- methods:res.manifest.abi.methods,
- params:[],
- tresult:""
- })
- this.refs.formRef.setFieldsValue({
- guihash:this.state.hash
- })
- });
- console.log(this.refs.formRef);
+ }
+ toHome = () => {
+ location.href = location.origin;
+ }
+ showDrawer = () => {
+ this.setState({
+ visible: true,
+ });
+ };
+ onClose = () => {
+ this.setState({
+ visible: false,
+ });
};
- searchContract = (callback) => {
+ searchContract = async () => {
const { t } = this.props;
let _hash = this.refs.sinput.input.value.trim();
if (!_hash) {
@@ -90,33 +79,42 @@ class Contractinvoke extends React.Component {
return;
}
this.setState({ loading: true });
- var _this = this;
var params = { contractHash: _hash };
- post("GetContract", params)
- .then(function (response) {
- var _data = response.data;
- _this.setState({loading:false});
- if(_data.msgType === -1){
- _this.setState({
- methods: [],
- params: [],
- tresult: "",
- });
- _this.refs.formRef.resetFields();
- _this.refs.formRef.setFieldsValue({
- guihash: _hash,
- });
- message.info(t("contract.search fail"));
- return;
- }else if(_data.msgType === 3){
- callback(_data.result)
- }
- })
- .catch(function (error) {
- console.log(error);
+ let response = await postAsync("GetContract", params);
+ this.setState({ loading: false });
+ if (response.msgType === -1) {
+ this.setState({
+ methods: [],
+ params: [],
+ tresult: "",
+ });
+ this.myForm.current.resetFields();
+ this.myForm.current.setFieldsValue({
+ guihash: _hash,
});
+ message.info(t("contract.search fail"));
+ return;
+ }
+
+ let result = response.result;
+ this.myForm.current.resetFields()
+ this.setState({
+ hash: result.contractHash,
+ methods: result.manifest.abi.methods,
+ params: [],
+ tresult: ""
+ })
+ this.myForm.current.setFieldsValue({
+ guihash: this.state.hash
+ })
+ // callback(response.result);
};
showPara = (e) => {
+ this.myForm.current.resetFields();
+ this.myForm.current.setFieldsValue({
+ guihash: this.state.hash,
+ guimethod: e,
+ });
this.setState({
params: this.state.methods[e].parameters,
methodselect: this.state.methods[e],
@@ -124,7 +122,6 @@ class Contractinvoke extends React.Component {
};
makeParams = (data) => {
let method = this.state.methodselect;
-
let _params = {
contractHash: this.state.hash,
method: method.name,
@@ -136,44 +133,44 @@ class Contractinvoke extends React.Component {
let inside = new Array();
this.state.params.map((item, index) => {
//深拷贝
- let _item = JSON.parse(JSON.stringify(item));
+ let parameterItem = JSON.parse(JSON.stringify(item));
+ let value = data[parameterItem.name];
- let _type = method.parameters[index].type.toLowerCase();
- _item.value = data[_item.name];
+ //检测字符串中是否包含两种类型值
+ // if (_type.search(/(hash160)|(bytearray)/g) !== -1 && typeof _item.value === "object") {
+ // _item.type = _item.value.type;
+ // _item.value = _item.value.value;
+ // }
- //检测字符串中是否包含两种类型值
- if(_type.search(/(hash160)|(bytearray)/g) !== -1 && typeof _item.value === "object"){
- _item.type = _item.value.type;
- _item.value = _item.value.string;
- }
+ if (value.type === 'Array') {
+ value.value = JSON.parse(value.value);
+ }
+ if (value.type) {
+ parameterItem.type = value.type;
+ parameterItem.value = value.value;
+ } else {
+ parameterItem.value = value;
+ }
- if(_type === 'any'){
- _item.type = 'String';
- _item.value = _item.value;
- }
-
- if(_type === 'array'){
- _item.value = JSON.parse(_item.value);
- }
- inside = inside.concat(_item);
- })
- if(inside) _params.parameters = inside;
+ inside = inside.concat(parameterItem);
+ })
+ if (inside) _params.parameters = inside;
//构造consigners
let cosigners = new Array();
data.cosigners
? data.cosigners.map((item) => {
- let _list = {};
- _list.account = item;
- cosigners = cosigners.concat(_list);
- })
+ let _list = {};
+ _list.account = item;
+ cosigners = cosigners.concat(_list);
+ })
: null;
if (cosigners) _params.cosigners = cosigners;
return _params;
};
onFill = () => {
- this.refs.formRef.setFieldsValue({
+ this.myForm.current.setFieldsValue({
tresult: this.state.tresult,
});
};
@@ -185,7 +182,7 @@ class Contractinvoke extends React.Component {
},
this.onFill()
);
- this.refs.formRef
+ this.myForm.current
.validateFields()
.then((data) => {
let params = this.makeParams(data);
@@ -216,7 +213,7 @@ class Contractinvoke extends React.Component {
},
_this.onFill()
);
- _this.refs.formRef.resetFields();
+ _this.myForm.current.resetFields();
Modal.success({
title: t("contract.invoke contract"),
@@ -233,56 +230,50 @@ class Contractinvoke extends React.Component {
});
});
};
- invokeContract = (params, callback) => {
+
+ invokeContract = async (params, callback) => {
const { t } = this.props;
- post("InvokeContract", params)
- .then(function (res) {
- var _data = res.data;
- if (_data.msgType === -1) {
- Modal.error({
- title: t("contract.fail title"),
- width: 600,
- content: (
-
-
- {t("error code")}: {_data.error.code}
-
-
- {t("error msg")}: {_data.error.message}
-
-
- ),
- okText: t("button.ok"),
- });
- return;
- } else if (_data.msgType === 3) {
- callback(_data);
- }
- })
- .catch(function (error) {
- console.log(error);
- });
- }
- handleCancel = () => {
- this.setState({
- modal: false,
- });
- };
- makeArray = () =>{
- this.setState({
- modal: true
+ let response = await postAsync("InvokeContract", params);
+ if (response.msgType === -1) {
+ Modal.error({
+ title: t("contract.fail title"),
+ width: 600,
+ content: (
+
+
+ {t("error code")}: {response.error.code}
+
+
+ {t("error msg")}: {response.error.message}
+
+
+ ),
+ okText: t("button.ok"),
});
+ return;
}
- handleparam = (val) =>{
- if(val.length <= 0) return "";
- this.handleCancel()
- return JSON.stringify(val);
- }
- onOk = () => {
- form.submit();
- };
- render = () =>{
- const {methods,params,disabled} = this.state;
+ callback(response);
+ }
+ handleCancel = () => {
+ this.setState({
+ modal: false,
+ });
+ };
+ makeArray = () => {
+ this.setState({
+ modal: true
+ });
+ }
+ handleparam = (val) => {
+ if (val.length <= 0) return "";
+ this.handleCancel()
+ return JSON.stringify(val);
+ }
+ onOk = () => {
+ form.submit();
+ };
+ render = () => {
+ const { methods, params, disabled } = this.state;
const accounts = this.props.walletStore.accountlist;
const { t } = this.props;
return (
@@ -302,7 +293,7 @@ class Contractinvoke extends React.Component {
{/* */}
-
+
-
-
-
-
-
-
-
-
-
-
{t('contract.test result')}
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
{t('contract.test result')}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
);
};
}
diff --git a/neo3-gui/neo3-gui/ClientApp/src/components/Contract/searcharea.js b/neo3-gui/neo3-gui/ClientApp/src/components/Contract/searcharea.js
index d206af2..6aa7f2b 100644
--- a/neo3-gui/neo3-gui/ClientApp/src/components/Contract/searcharea.js
+++ b/neo3-gui/neo3-gui/ClientApp/src/components/Contract/searcharea.js
@@ -1,7 +1,6 @@
/* eslint-disable */
import React from "react";
import "antd/dist/antd.css";
-import axios from "axios";
import { Input, message } from "antd";
import Topath from "../Common/topath";
import { ArrowRightOutlined, SearchOutlined } from "@ant-design/icons";
diff --git a/neo3-gui/neo3-gui/ClientApp/src/components/Transaction/searcharea.js b/neo3-gui/neo3-gui/ClientApp/src/components/Transaction/searcharea.js
index 9a9c946..79a2ce6 100644
--- a/neo3-gui/neo3-gui/ClientApp/src/components/Transaction/searcharea.js
+++ b/neo3-gui/neo3-gui/ClientApp/src/components/Transaction/searcharea.js
@@ -1,7 +1,6 @@
/* eslint-disable */
import React from "react";
import "antd/dist/antd.css";
-import axios from "axios";
import { Input, message } from "antd";
import Topath from "../Common/topath";
import { ArrowRightOutlined, SearchOutlined } from "@ant-design/icons";
diff --git a/neo3-gui/neo3-gui/ClientApp/src/components/Transaction/transaction.js b/neo3-gui/neo3-gui/ClientApp/src/components/Transaction/transaction.js
index 1a7ee48..b6694aa 100644
--- a/neo3-gui/neo3-gui/ClientApp/src/components/Transaction/transaction.js
+++ b/neo3-gui/neo3-gui/ClientApp/src/components/Transaction/transaction.js
@@ -9,7 +9,6 @@ import Searcharea from './searcharea'
import { SwapRightOutlined } from '@ant-design/icons';
import { postAsync } from "../../core/request"
-const { Content } = Layout;
@withTranslation()
@inject("walletStore")
@observer
@@ -50,14 +49,16 @@ class Transaction extends React.Component {
_params.blockHeight = Number(_hash);
this.setState({ params: _params })
this.allset(_params);
- } else if (page === "addressdetail") {
- _params.address = Number(_hash);
- this.setState({
- params: _params,
- local: "/wallet/transaction:"
- })
- this.nepset(_params);
- } else if (page === "assetdetail") {
+ }
+ // else if (page === "addressdetail") {
+ // _params.address = Number(_hash);
+ // this.setState({
+ // params: _params,
+ // local: "/wallet/transaction:"
+ // })
+ // this.nepset(_params);
+ // }
+ else if (page === "assetdetail") {
_params.asset = _hash;
this.setState({ params: _params })
this.nepset(_params);
diff --git a/neo3-gui/neo3-gui/ClientApp/src/components/Wallet/trans.js b/neo3-gui/neo3-gui/ClientApp/src/components/Wallet/trans.js
index 7abb665..97fcf0e 100644
--- a/neo3-gui/neo3-gui/ClientApp/src/components/Wallet/trans.js
+++ b/neo3-gui/neo3-gui/ClientApp/src/components/Wallet/trans.js
@@ -3,7 +3,6 @@ import { Layout, Row, Col, Tabs } from "antd";
import Transaction from "../Transaction/transaction";
import Untransaction from "../Transaction/untransaction";
import Sync from "../sync";
-import Searcharea, { Searchtttt } from "../Common/searcharea";
import { withTranslation } from "react-i18next";
import { ArrowLeftOutlined } from "@ant-design/icons";
@@ -31,8 +30,8 @@ class Wallettrans extends React.Component {
}
- // }
+ // tabBarExtraContent={}
+ // }
>
diff --git a/neo3-gui/neo3-gui/ClientApp/src/core/request.js b/neo3-gui/neo3-gui/ClientApp/src/core/request.js
index eecd81f..924b43f 100644
--- a/neo3-gui/neo3-gui/ClientApp/src/core/request.js
+++ b/neo3-gui/neo3-gui/ClientApp/src/core/request.js
@@ -34,7 +34,7 @@ const postAsync = async (method, params) => {
try {
let response = await request(method, params);
if (response.status !== 200) {
- let error = new Error("Response Error!");
+ let error = new Error("Http Error!");
error.response = response;
throw error;
}
diff --git a/neo3-gui/neo3-gui/ClientApp/src/router/router.js b/neo3-gui/neo3-gui/ClientApp/src/router/router.js
index fd6512e..7dee2ab 100644
--- a/neo3-gui/neo3-gui/ClientApp/src/router/router.js
+++ b/neo3-gui/neo3-gui/ClientApp/src/router/router.js
@@ -1,12 +1,11 @@
import React from 'react';
-import {BrowserRouter, Route , Switch,Redirect} from 'react-router-dom';
+import { BrowserRouter, Route, Switch, Redirect } from 'react-router-dom';
import Home from '../components/home'
import Sync from '../components/sync';
import Chain from '../components/Chain/chain';
import Chainlayout from '../components/Chain/chainlayout';
import BlockDetail from '../components/Chain/blockdetail';
-import Blockhashdetail from '../components/Chain/hashdetail';
import Chaintrans from '../components/Chain/trans';
import ChainAsset from '../components/Chain/asset';
import AssetDetail from '../components/Chain/assetdetail';
@@ -44,14 +43,13 @@ import { Layout } from 'antd';
const BasicRoute = () => (
-
-
+
+
-
+
-
@@ -60,8 +58,8 @@ const BasicRoute = () => (
-
-
+
+
@@ -72,7 +70,7 @@ const BasicRoute = () => (
-
+
@@ -82,7 +80,7 @@ const BasicRoute = () => (
-
+
diff --git a/neo3-gui/neo3-gui/Common/Consoles/MainService.cs b/neo3-gui/neo3-gui/Common/Consoles/MainService.cs
index b111df8..70f049f 100644
--- a/neo3-gui/neo3-gui/Common/Consoles/MainService.cs
+++ b/neo3-gui/neo3-gui/Common/Consoles/MainService.cs
@@ -27,8 +27,7 @@
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
-using ECCurve = Neo.Cryptography.ECC.ECCurve;
-using ECPoint = Neo.Cryptography.ECC.ECPoint;
+
namespace Neo.Common.Consoles
{
@@ -84,21 +83,59 @@ public virtual async Task Start(string[] args)
throw;
}
- using (IEnumerator blocksBeingImported = GetBlocksFromFile().GetEnumerator())
+ Task.Run(ImportAndStartNode);
+
+ //NeoSystem.StartNode(new ChannelsConfig
+ //{
+ // Tcp = new IPEndPoint(IPAddress.Any, CliSettings.Default.P2P.Port),
+ // WebSocket = new IPEndPoint(IPAddress.Any, CliSettings.Default.P2P.WsPort),
+ // MinDesiredConnections = CliSettings.Default.P2P.MinDesiredConnections,
+ // MaxConnections = CliSettings.Default.P2P.MaxConnections,
+ // MaxConnectionsPerAddress = CliSettings.Default.P2P.MaxConnectionsPerAddress
+ //});
+ //if (CliSettings.Default.UnlockWallet.IsActive)
+ //{
+ // try
+ // {
+ // OpenWallet(CliSettings.Default.UnlockWallet.Path, CliSettings.Default.UnlockWallet.Password);
+ // }
+ // catch (FileNotFoundException)
+ // {
+ // Console.WriteLine($"Warning: wallet file \"{CliSettings.Default.UnlockWallet.Path}\" not found.");
+ // }
+ // catch (CryptographicException)
+ // {
+ // Console.WriteLine($"failed to open file \"{CliSettings.Default.UnlockWallet.Path}\"");
+ // }
+ //}
+ }
+
+ private async Task ImportAndStartNode()
+ {
+ await ImportBlocks();
+ await StartNode();
+ }
+
+
+ public async Task ImportBlocks()
+ {
+ using IEnumerator blocksBeingImported = GetBlocksFromFile().GetEnumerator();
+ while (true)
{
- while (true)
+ List blocksToImport = new List();
+ for (int i = 0; i < 10; i++)
{
- List blocksToImport = new List();
- for (int i = 0; i < 10; i++)
- {
- if (!blocksBeingImported.MoveNext()) break;
- blocksToImport.Add(blocksBeingImported.Current);
- }
- if (blocksToImport.Count == 0) break;
- await NeoSystem.Blockchain.Ask(new Blockchain.Import { Blocks = blocksToImport });
- if (NeoSystem is null) return;
+ if (!blocksBeingImported.MoveNext()) break;
+ blocksToImport.Add(blocksBeingImported.Current);
}
+ if (blocksToImport.Count == 0) break;
+ await NeoSystem.Blockchain.Ask(new Blockchain.Import { Blocks = blocksToImport });
+ if (NeoSystem is null) return;
}
+ }
+
+ public async Task StartNode()
+ {
NeoSystem.StartNode(new ChannelsConfig
{
Tcp = new IPEndPoint(IPAddress.Any, CliSettings.Default.P2P.Port),
@@ -107,22 +144,6 @@ public virtual async Task Start(string[] args)
MaxConnections = CliSettings.Default.P2P.MaxConnections,
MaxConnectionsPerAddress = CliSettings.Default.P2P.MaxConnectionsPerAddress
});
- if (CliSettings.Default.UnlockWallet.IsActive)
- {
- try
- {
- OpenWallet(CliSettings.Default.UnlockWallet.Path, CliSettings.Default.UnlockWallet.Password);
- }
- catch (FileNotFoundException)
- {
- Console.WriteLine($"Warning: wallet file \"{CliSettings.Default.UnlockWallet.Path}\" not found.");
- }
- catch (CryptographicException)
- {
- Console.WriteLine($"failed to open file \"{CliSettings.Default.UnlockWallet.Path}\"");
- }
-
- }
}
public void Stop()
diff --git a/neo3-gui/neo3-gui/Common/Storage/SQLiteModules/SQLiteContext.cs b/neo3-gui/neo3-gui/Common/Storage/SQLiteModules/SQLiteContext.cs
index e5ed255..75eeb16 100644
--- a/neo3-gui/neo3-gui/Common/Storage/SQLiteModules/SQLiteContext.cs
+++ b/neo3-gui/neo3-gui/Common/Storage/SQLiteModules/SQLiteContext.cs
@@ -96,7 +96,7 @@ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
DataSource = _filename
};
optionsBuilder.UseSqlite(sb.ToString());
- optionsBuilder.UseLoggerFactory(LoggerFactory.Create(b => b.AddConsole()));
+ //optionsBuilder.UseLoggerFactory(LoggerFactory.Create(b => b.AddConsole()));
}
diff --git a/neo3-gui/neo3-gui/Common/Storage/TrackDB.cs b/neo3-gui/neo3-gui/Common/Storage/TrackDB.cs
index f5cbab4..b2a33e3 100644
--- a/neo3-gui/neo3-gui/Common/Storage/TrackDB.cs
+++ b/neo3-gui/neo3-gui/Common/Storage/TrackDB.cs
@@ -347,11 +347,11 @@ public PageList QueryTransactions(TransactionFilter filter, boo
///
- /// Paged by Transactions
+ /// Query Transfers Paged by Transactions
///
///
///
- public PageList QueryNep5Transactions(TransferFilter filter)
+ public PageList QueryTransfersPagedByTx(TransferFilter filter)
{
var query = BuildQuery(filter);
var pageList = new PageList();
@@ -371,7 +371,7 @@ public PageList QueryNep5Transactions(TransferFilter filter)
///
- /// Paged by transfer
+ /// Query Transfers Paged by transfer
///
///
///
diff --git a/neo3-gui/neo3-gui/GuiStarter.cs b/neo3-gui/neo3-gui/GuiStarter.cs
index 95ef171..51314b2 100644
--- a/neo3-gui/neo3-gui/GuiStarter.cs
+++ b/neo3-gui/neo3-gui/GuiStarter.cs
@@ -4,38 +4,32 @@
using System.Text;
using System.Threading;
using System.Threading.Tasks;
-using Akka.Actor;
-using Microsoft.Extensions.Configuration;
-using Neo.Common;
using Neo.Common.Analyzers;
using Neo.Common.Consoles;
using Neo.Common.Scanners;
using Neo.Common.Utility;
-using Neo.Ledger;
-using Neo.Network.P2P.Payloads;
+
namespace Neo
{
public class GuiStarter : MainService
{
+ public readonly ExecuteResultScanner ExecuteResultScanner;
+ public readonly ExecuteResultLogTracker ExecuteResultLogTracker;
+ private Task _scanTask;
+
public GuiStarter()
{
ExecuteResultLogTracker = new ExecuteResultLogTracker();
ExecuteResultScanner = new ExecuteResultScanner();
}
-
public override async Task Start(string[] args)
{
await base.Start(args);
- Task.Run(() => ExecuteResultScanner.Start());
+ _scanTask = Task.Factory.StartNew(() => ExecuteResultScanner.Start(), TaskCreationOptions.LongRunning);
UnconfirmedTransactionCache.RegisterBlockPersistEvent(this.NeoSystem);
}
- public readonly ExecuteResultScanner ExecuteResultScanner;
-
- public readonly ExecuteResultLogTracker ExecuteResultLogTracker;
-
-
}
}
diff --git a/neo3-gui/neo3-gui/Services/ApiServices/ContractApiService.cs b/neo3-gui/neo3-gui/Services/ApiServices/ContractApiService.cs
index 805e15c..23c0e3f 100644
--- a/neo3-gui/neo3-gui/Services/ApiServices/ContractApiService.cs
+++ b/neo3-gui/neo3-gui/Services/ApiServices/ContractApiService.cs
@@ -388,11 +388,16 @@ public static ContractParameter JsonToContractParameter(JsonElement json)
{
return parameter;
}
- var value = jsonValue.GetString();
if (type == "Address")
{
parameter.Type = ContractParameterType.Hash160;
- parameter.Value = value.ToScriptHash();
+ parameter.Value = jsonValue.GetString().ToScriptHash();
+ return parameter;
+ }
+ if (type == "HexString")
+ {
+ parameter.Type = ContractParameterType.ByteArray;
+ parameter.Value = jsonValue.GetString().HexToBytes();
return parameter;
}
@@ -401,25 +406,25 @@ public static ContractParameter JsonToContractParameter(JsonElement json)
{
case ContractParameterType.Signature:
case ContractParameterType.ByteArray:
- parameter.Value = Convert.FromBase64String(value);
+ parameter.Value = Convert.FromBase64String(jsonValue.GetString());
break;
case ContractParameterType.Boolean:
parameter.Value = jsonValue.GetBoolean();
break;
case ContractParameterType.Integer:
- parameter.Value = BigInteger.Parse(value);
+ parameter.Value = BigInteger.Parse(jsonValue.GetString());
break;
case ContractParameterType.Hash160:
- parameter.Value = UInt160.Parse(value);
+ parameter.Value = UInt160.Parse(jsonValue.GetString());
break;
case ContractParameterType.Hash256:
- parameter.Value = UInt256.Parse(value);
+ parameter.Value = UInt256.Parse(jsonValue.GetString());
break;
case ContractParameterType.PublicKey:
- parameter.Value = ECPoint.Parse(value, ECCurve.Secp256r1);
+ parameter.Value = ECPoint.Parse(jsonValue.GetString(), ECCurve.Secp256r1);
break;
case ContractParameterType.String:
- parameter.Value = value;
+ parameter.Value = jsonValue.GetString();
break;
case ContractParameterType.Array:
parameter.Value = jsonValue.EnumerateArray().Select(JsonToContractParameter).ToList();
diff --git a/neo3-gui/neo3-gui/Services/ApiServices/TransactionApiService.cs b/neo3-gui/neo3-gui/Services/ApiServices/TransactionApiService.cs
index 8c21356..6f542ba 100644
--- a/neo3-gui/neo3-gui/Services/ApiServices/TransactionApiService.cs
+++ b/neo3-gui/neo3-gui/Services/ApiServices/TransactionApiService.cs
@@ -154,7 +154,7 @@ public async Task