-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/neo3-gui/neo3-gui/ClientApp/src/components/Advanced/noderole.js b/neo3-gui/neo3-gui/ClientApp/src/components/Advanced/noderole.js
index 4273123d..e31d38be 100644
--- a/neo3-gui/neo3-gui/ClientApp/src/components/Advanced/noderole.js
+++ b/neo3-gui/neo3-gui/ClientApp/src/components/Advanced/noderole.js
@@ -1,7 +1,6 @@
/* eslint-disable */
import React from 'react';
import 'antd/dist/antd.css';
-import axios from 'axios';
import {
Checkbox,
PageHeader,
@@ -11,14 +10,16 @@ import {
Col,
Form,
Select,
- Button,
- message} from 'antd';
+ Button,
+ message
+} from 'antd';
import { Layout } from 'antd';
import Sync from '../sync';
import { observer, inject } from "mobx-react";
import { withRouter } from "react-router-dom";
import { withTranslation } from "react-i18next";
import "../../static/css/advanced.css";
+import { postAsync } from '../../core/request';
const { Option } = Select;
const { Content } = Layout;
@@ -31,29 +32,17 @@ class Advancednoderole extends React.Component {
super(props);
this.state = {
size: 'default',
- rolelist: [{type:4,role:"StateValidator"},{type:8,role:"Oracle"}],
+ rolelist: [{ type: 4, role: "StateValidator" }, { type: 8, role: "Oracle" }],
};
}
- onRole = fieldsValue =>{
+ onRole = async (fieldsValue) => {
const { t } = this.props;
- console.log(fieldsValue);
+ console.log(fieldsValue);
- axios.post('http://localhost:8081', {
- "id": "1",
- "method": "GetNodesByRole",
- "params":{
- "role":parseInt(fieldsValue.role)
- }
- })
- .then(function (response) {
- var _data = response.data;
- console.log(_data);
- return;
- })
- .catch(function (error) {
- console.log(error);
- console.log("error");
+ let response = await postAsync("GetNodesByRole", {
+ "role": parseInt(fieldsValue.role)
});
+ console.log(response);
}
render = () => {
const { t } = this.props;
@@ -64,43 +53,43 @@ class Advancednoderole extends React.Component {
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
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 624eca55..9835dad1 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 00000000..de49469a
--- /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 c1c6ca4d..b22e69e0 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 249a7e28..7501a77a 100644
--- a/neo3-gui/neo3-gui/ClientApp/src/components/Chain/chain.js
+++ b/neo3-gui/neo3-gui/ClientApp/src/components/Chain/chain.js
@@ -12,12 +12,11 @@ import {
Button,
PageHeader,
} from "antd";
-import axios from "axios";
-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";
const { Content } = Layout;
@@ -44,40 +43,26 @@ class Chain extends React.Component {
blocklist: res.result,
lastblock: res.result[res.result.length - 1].blockHeight - 1,
},
- () => {}
+ () => { }
);
});
}
- getBlock = (callback) => {
+ getBlock = async (callback) => {
console.log(this.state.lastblock);
let _params = this.state.lastblock
? {
- limit: 50,
- height: this.state.lastblock,
- }
+ limit: 50,
+ height: this.state.lastblock,
+ }
: {
- limit: 50,
- };
- axios
- .post("http://localhost:8081", {
- id: "51",
- method: "GetLastBlocks",
- params: _params,
- })
- .then(function (response) {
- var _data = response.data;
- console.log(_data);
- if (_data.msgType === -1) {
- message.error("查询失败");
- return;
- } else {
- callback(_data);
- }
- })
- .catch(function (error) {
- console.log(error);
- console.log("error");
- });
+ limit: 50,
+ };
+ let response = await postAsync("GetLastBlocks", _params);
+ if (response.msgType < 0) {
+ message.error("Query fail!");
+ return;
+ }
+ callback(response)
};
loadMore = () => {
this.setState({
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 73%
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 359a7ace..0427ea2c 100644
--- a/neo3-gui/neo3-gui/ClientApp/src/components/Chain/searcharea.js
+++ b/neo3-gui/neo3-gui/ClientApp/src/components/Chain/chainSearch.js
@@ -1,11 +1,11 @@
/* 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";
import { withTranslation } from "react-i18next";
+import { postAsync } from "../../core/request";
@withTranslation()
class Chainsearch extends React.Component {
@@ -46,38 +46,26 @@ class Chainsearch extends React.Component {
stopPropagation(e) {
e.nativeEvent.stopImmediatePropagation();
}
- searchChain = () => {
+ searchChain = async () => {
const { t } = this.props;
- let _this = this;
-
- 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;
}
-
- axios
- .post("http://localhost:8081", {
- id: "1111",
- method: "GetBlock",
- params: {
- index: _height,
- },
- })
- .then(function (response) {
- var _data = response.data;
- console.log(_data);
- if (_data.msgType === -1) {
- message.info(t("blockchain.height unexist"));
- return;
- } else {
- _this.setState({ topath: "/chain/detail:" + _height });
- }
- })
- .catch(function (error) {
- console.log(error);
- console.log("error");
- });
+ let response = !blockHash ? (await postAsync("GetBlock", { index: blockHeight })) : (await postAsync("GetBlockByHash", { hash: blockHash }));
+ if (response.msgType === -1) {
+ message.info(t("blockchain.search input-invalid"));
+ return;
+ }
+ 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 2efed744..00000000
--- a/neo3-gui/neo3-gui/ClientApp/src/components/Chain/hashdetail.js
+++ /dev/null
@@ -1,129 +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 axios from 'axios';
-import Intitle from '../Common/intitle';
-import Sync from '../sync';
-
-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 = () =>{
- var _this = this;
- let _hash = this.state.hash;
- axios.post('http://localhost:8081', {
- "id":"1111",
- "method": "GetBlockByHash",
- "params": {
- "hash": _hash
- }
- })
- .then(function (response) {
- var _data = response.data;
- console.log(_data);
- if(_data.msgType === -1){
- message.error("查询失败,该hash错误");
- return;
- }
- _this.setState({
- blockdetail:_data.result,
- witness:_data.result.witness.scriptHash,
- nonce:_data.result.consensusData.nonce,
- translist:_data.result.transactions
- })
- })
- .catch(function (error) {
- console.log(error);
- console.log("error");
- });
- }
- 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={