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 9f7c8c67..ee2ec2e7 100644 --- a/neo3-gui/neo3-gui/ClientApp/public/locales/en/translation.json +++ b/neo3-gui/neo3-gui/ClientApp/public/locales/en/translation.json @@ -28,24 +28,39 @@ "next": "Next", "ok": "OK", "prev": "Prev", - "send": "Send" + "send": "Send", + "search":"Search" }, + "input":{ + "required":"This input is required.", + "checked":"Please confirm all input." + }, + "address book":"Address", "byte": "Byte", "bytes": "Bytes", "confirm count": "Confirmations", "contract": "Contract", "contract page": { "deploy contract": "Deploy Contract", - "deploy contract nav": "Deploy Contract", + "deploy contract nav": "Deploy", "deploy success": "Deploy successfully, please wait for confirmation", - "invoke contract nav": "Invoke Contract", + "invoke contract": "Invoke Contract", + "invoke contract nav": "Invoke", "invoke fail title": "Invoke failed, please check and retry", - "invoke result": "Invoke Result", "please select file path": "Please select file path", "search contract": "Search Contract", - "search contract nav": "Search Contract", + "search contract nav": "Search", "select {file} path title": "Select {{file}} file", - "test invoke": "Test Invoke" + "test deploy": "Test Deploy", + "test invoke": "Test Invoke", + "test result": "Test Result", + "search fail": "Please check the hash and try again", + "search input check": "Please fill the hash", + "choose account":"Choose account", + "cosigners":"Cosigners", + "invoke method":"Invoke method", + "select method":"Select method", + "parameters":"Parameters" }, "copyright": "Copyright", "count": "Count", @@ -90,6 +105,7 @@ "unconfirmed transactions": "Unconfirmed Transactions", "verification script": "Verification Script", "wallet": "Wallet", + "open wallet first": "Please open wallet", "wallet page": { "accounts nav": "Accounts", "assets": "Assets", @@ -134,8 +150,14 @@ "transfer asset": "Asset", "transfer nav": "Transfer", "transfer send success": "Send Success", + "transfer send error":"Send failed, please try again later", "transfer warning": "Safety tip: Do not transfer money to strangers easily.Please confirm the receiving account, transfer amount and asset type carefully.Please carefully identify assets with the same name to avoid being cheated.Do not transfer money to the receiving account (address) of other blockchain.", "wallet opened": "Wallet is opened" }, + "transaction page":{ + "confirmed":"Confirmed", + "unconfirmed":"Unconfirmed" + }, + "transaction list":"Transaction list", "witness": "Witness" } 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 5215daca..408699a3 100644 --- a/neo3-gui/neo3-gui/ClientApp/public/locales/zh/translation.json +++ b/neo3-gui/neo3-gui/ClientApp/public/locales/zh/translation.json @@ -28,8 +28,14 @@ "next": "下一步", "ok": "确认", "prev": "上一步", - "send": "发送" + "send": "发送", + "search":"搜索" }, + "input":{ + "required":"该输入框为必填项", + "checked":"请确认已经输入完毕" + }, + "address book":"地址簿", "byte": "字节", "bytes": "字节", "confirm count": "确认数", @@ -38,14 +44,23 @@ "deploy contract": "部署合约", "deploy contract nav": "部署合约", "deploy success": "交易发送成功,请等待区块确认", + "invoke contract": "调用合约", "invoke contract nav": "调用合约", - "invoke fail title": "运行失败,请检查后再尝试", - "invoke result": "运行结果", "please select file path": "请选择文件后再试", "search contract": "搜索合约", "search contract nav": "搜索合约", "select {file} path title": "选择需要的{{file}}文件", - "test invoke": "试运行" + "test deploy": "试运行", + "test invoke": "试运行", + "test result": "运行结果", + "search fail": "请正确输入需要查找的hash", + "search input check": "请输入后再试", + "choose account":"选择账户", + "cosigners":"附加签名", + "fail title": "运行失败,请检查后再尝试", + "invoke method":"调用方法", + "select method":"选择方法", + "parameters":"参数列表" }, "copyright": "保留所有权利", "count": "数量", @@ -90,6 +105,7 @@ "unconfirmed transactions": "待确认交易", "verification script": "验证脚本", "wallet": "钱包", + "open wallet first": "请先打开钱包", "wallet page": { "accounts nav": "账户列表", "assets": "资产列表", @@ -134,8 +150,14 @@ "transfer asset": "发送资产", "transfer nav": "转账", "transfer send success": "交易发送成功", + "transfer send error":"交易发送失败,请检查后再试", "transfer warning": "安全提示:请勿轻易向陌生人转账。请仔细确认收款账户、转账金额、资产类型。请仔细辨别相同资产名称的资产,避免被骗。请勿向其它区块链的收款账户(地址)转账。", "wallet opened": "钱包文件已打开" }, + "transaction page":{ + "confirmed":"已完成", + "unconfirmed":"待确认" + }, + "transaction list":"交易列表", "witness": "见证人" } diff --git a/neo3-gui/neo3-gui/ClientApp/src/components/Advanced/advancedlayout.js b/neo3-gui/neo3-gui/ClientApp/src/components/Advanced/advancedlayout.js new file mode 100644 index 00000000..9cd0518f --- /dev/null +++ b/neo3-gui/neo3-gui/ClientApp/src/components/Advanced/advancedlayout.js @@ -0,0 +1,64 @@ +/* eslint-disable */ +import React from 'react'; +import 'antd/dist/antd.css'; +import '../../static/css/menu.css' +import '../../static/css/wallet.css' +import { Layout, Menu, Icon } from 'antd'; +import { Link } from 'react-router-dom'; +import MenuDown from '../Common/menudown' +import { + HomeOutlined, + RadiusUpleftOutlined +} from '@ant-design/icons'; +import { withTranslation } from 'react-i18next'; + + + +const { Sider } = Layout; +const { SubMenu } = Menu; + +@withTranslation() +class Advancedlayout extends React.Component { + constructor(props) { + super(props); + this.state = { + size: 'default' + }; + } + render = () => { + const { t } = this.props; + return ( +
+ + + + {t("home page")} + + + + {t("blockchain")} + + } + > + {t("blockchain page.blocks nav")} + {t("blockchain page.transactions nav")} + {t("blockchain page.asset nav")} + + + + +
+ ); + } +} + +export default Advancedlayout; \ No newline at end of file diff --git a/neo3-gui/neo3-gui/ClientApp/src/components/Chain/assetdetail.js b/neo3-gui/neo3-gui/ClientApp/src/components/Chain/assetdetail.js index f6f2ec46..223bfac8 100644 --- a/neo3-gui/neo3-gui/ClientApp/src/components/Chain/assetdetail.js +++ b/neo3-gui/neo3-gui/ClientApp/src/components/Chain/assetdetail.js @@ -7,9 +7,11 @@ import axios from 'axios'; import Intitle from '../Common/intitle'; import Transaction from '../Transaction/transaction'; import Sync from '../sync'; +import { withTranslation } from 'react-i18next'; const { Content } = Layout; +@withTranslation() class Assetdetail extends React.Component{ constructor(props){ super(props); @@ -28,7 +30,7 @@ class Assetdetail extends React.Component{ }) } getAsset = () =>{ - console.log("数据暂无") + // console.log("数据暂无") // var _this = this; // let _height = this.state.height; // axios.post('http://localhost:8081', { @@ -66,6 +68,7 @@ class Assetdetail extends React.Component{ } render(){ const {blockdetail,witness,nonce} = this.state; + const { t } = this.props; return ( @@ -98,7 +101,7 @@ class Assetdetail extends React.Component{ */} - + ); diff --git a/neo3-gui/neo3-gui/ClientApp/src/components/Common/addressdetail.js b/neo3-gui/neo3-gui/ClientApp/src/components/Common/addressdetail.js index 5bc1852c..7d28ba3b 100644 --- a/neo3-gui/neo3-gui/ClientApp/src/components/Common/addressdetail.js +++ b/neo3-gui/neo3-gui/ClientApp/src/components/Common/addressdetail.js @@ -2,6 +2,9 @@ //just test replace wallet// import React from 'react'; import axios from 'axios'; + +import { observer, inject } from "mobx-react"; +import { withRouter } from "react-router-dom"; import {Link} from 'react-router-dom'; import { Layout, Row, Col, Modal,List, Button,Typography, message } from 'antd'; import Sync from '../sync'; @@ -9,6 +12,7 @@ import Intitle from '../Common/intitle'; import Transaction from '../Transaction/transaction'; import '../../static/css/wallet.css'; import Topath from '../Common/topath'; +import { withTranslation } from 'react-i18next'; import { CloseCircleOutlined } from '@ant-design/icons'; @@ -16,6 +20,10 @@ import { const { confirm } = Modal; const { Content } = Layout; +@withTranslation() +@inject("walletStore") +@observer +@withRouter class Addressdetail extends React.Component{ constructor(props){ super(props); @@ -28,74 +36,28 @@ class Addressdetail extends React.Component{ }; } componentDidMount() { - this.checkAddress(); - this.getBalances(); - } - checkAddress = () =>{ - let _add = location.pathname.split(":").pop(); - this.setState({address:_add}) - } - getBalances = () =>{ - var _this = this; - let _add = location.pathname.split(":").pop(); - axios.post('http://localhost:8081', { - "id":"51", - "method": "GetAddressBalance", - "params":{ - // "addresses":[_add] - } - }) - .then(function (response) { - var _data = response.data; - console.log(_data); - console.log(response); - if(_data.msgType === -1){ - console.log(_data); - return; - }else{ - if(_data.result.length>0){ - _this.setState({ - addresslist:_data.result, - }) - } - } - console.log(_this.state) - }) - .catch(function (error) { - console.log(error); - console.log("error"); - }); } render = () =>{ - const { addresslist,address } = this.state; + const accounts = this.props.walletStore.accountlist; + const { t } = this.props; return ( - - - - - - - - {address}} - footer={} - itemLayout="horizontal" - dataSource={addresslist.balances} - renderItem={item => ( - - - {item.symbol} - {item.balance} - - - )} - /> -
- -
- -
-
+
+

{t("address book")}

+ +
+

NeoGUI @ 2020 Neo-Project {t("copyright")}

+
+
); } } 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 08a73a06..25edf0f1 100644 --- a/neo3-gui/neo3-gui/ClientApp/src/components/Common/dataConverter.js +++ b/neo3-gui/neo3-gui/ClientApp/src/components/Common/dataConverter.js @@ -28,7 +28,7 @@ class DataConverter { */ toScriptHash(address){ var bytes= bs58check.decode(address); - return "0x"+ this.reverseHexString(Buffer.from(bytes).toString("hex").slice(2)); + return "0x"+ Buffer.from(bytes).toString("hex").slice(2); } @@ -42,8 +42,6 @@ class DataConverter { } return hexString.match(/../g).reverse().join(""); } - } - export default DataConverter; \ No newline at end of file diff --git a/neo3-gui/neo3-gui/ClientApp/src/components/Common/datatrans.js b/neo3-gui/neo3-gui/ClientApp/src/components/Common/datatrans.js index 7a075583..8fd13ddc 100644 --- a/neo3-gui/neo3-gui/ClientApp/src/components/Common/datatrans.js +++ b/neo3-gui/neo3-gui/ClientApp/src/components/Common/datatrans.js @@ -29,7 +29,10 @@ class Datatrans extends React.Component { outhexstr: "", outhash: "", outbighash: "", - outbigadd: "" + outbigadd: "", + outlittlehash:"", + outlittleadd:"", + outhexnum:"" }; } convert = new DataConvert(); @@ -109,7 +112,7 @@ class Datatrans extends React.Component { var inbighash = document.getElementById("inBigHash").value.replace(/(^\s*)|(\s*$)/g, ""); if (inbighash) { if(inbighash.substr(0, 2)=="0x")inbighash = inbighash.slice(2); - if(inbighash.length!=40){alert("Illegal Format Script Hash!");return;} + if(inbighash.length!=40){message.error("输入的格式错误,请检查后再试");return;} let _address= this.convert.toAddress(inbighash); _this.setState({ outbighash: _address @@ -117,15 +120,59 @@ class Datatrans extends React.Component { } var inbigadd = document.getElementById("inBigAddress").value.replace(/(^\s*)|(\s*$)/g, ""); if (inbigadd) { - // if(inbigadd.length!=34){message.error("输入的格式错误,请检查后再试");return;} - let _hash = this.convert.reverseHexString("NhVvgdk458V1SceGsvMbqChsbSFBtGvdXF"); + if(inbigadd.length!=34){message.error("输入的格式错误,请检查后再试");return;} + let _hash = this.convert.toScriptHash(inbigadd); console.log(_hash) + _this.setState({ + outbigadd: _hash + }) } } - addTrans = () =>{ - let address= this.convert.toAddress("NfxTs1w2q9PqkQmExYgsqQzpXDTg4QcuqX"); - + littleTrans = () =>{ + var _this = this; + var inlittlehash = document.getElementById("inLittleHash").value.replace(/(^\s*)|(\s*$)/g, ""); + if (inlittlehash) { + if(inlittlehash.substr(0, 2)=="0x")inlittlehash = inlittlehash.slice(2); + if(inlittlehash.length!=40){message.error("Hash (Little)的格式错误,请检查后再试");return;} + let _little = this.convert.reverseHexString(inlittlehash); + let _address= this.convert.toAddress(_little); + _this.setState({ + outlittlehash: _address + }) + } + var inlittleadd = document.getElementById("inLittleAdd").value.replace(/(^\s*)|(\s*$)/g, ""); + if (inlittleadd) { + if(inlittleadd.length!=34){message.error("Address 的格式错误,请检查后再试");return;} + let _hash = this.convert.toScriptHash(inlittleadd); + _hash = this.convert.reverseHexString(_hash); + _this.setState({ + outlittleadd: _hash + }) + } } + // numTrans = () =>{ + // var _this = this; + // var inhexnum = document.getElementById("inHexNum").value.replace(/(^\s*)|(\s*$)/g, ""); + // if (inhexnum) { + // // if(inhexnum.substr(0, 2)=="0x")inhexnum = inhexnum.slice(2); + // // if(inhexnum.length!=40){message.error("Hash (Little)的格式错误,请检查后再试");return;} + // let _num = this.convert.toNumber(inhexnum); + // console.log(_num) + // if(!_num) {message.error("Hash (Little)的格式错误,请检查后再试");return;} + // _this.setState({ + // outhexnum: _num + // }) + // } + // var inlittleadd = document.getElementById("inLittleAdd").value.replace(/(^\s*)|(\s*$)/g, ""); + // if (inlittleadd) { + // if(inlittleadd.length!=34){message.error("Address 的格式错误,请检查后再试");return;} + // let _hash = this.convert.toScriptHash(inlittleadd); + // _hash = this.convert.reverseHexString(_hash); + // _this.setState({ + // outlittleadd: _hash + // },() => {this.state}) + // } + // } render() { return (

Script Hash (Big-endian Little-endian)

- + {this.state.outhash}

@@ -166,43 +213,43 @@ class Datatrans extends React.Component {

  • Address (big endian) Script Hash

    - + {this.state.outbighash}

    - - {this.state.outbigadd}
    + + {this.state.outbigadd}

  • - {/*
  • +
  • Address (little endian) Hex String

    - - transfer
    + + {this.state.outlittlehash}

    - -
    + + {this.state.outlittleadd}

    - +

  • -
  • + {/*
  • Number Hex Number

    - transfer
    + {this.state.outhexnum}


    - +

  • */} 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 c3e79b61..5afa79d2 100644 --- a/neo3-gui/neo3-gui/ClientApp/src/components/Common/menudown.js +++ b/neo3-gui/neo3-gui/ClientApp/src/components/Common/menudown.js @@ -7,7 +7,10 @@ import { message } from 'antd'; import { Modal, Button } from 'antd'; import axios from 'axios'; import { Radio } from 'antd'; +import Addressdetail from './addressdetail'; +import Setting from './setting'; import { + ReadOutlined, LogoutOutlined, SettingOutlined } from '@ant-design/icons'; @@ -24,23 +27,13 @@ class menuDown extends React.Component { constructor(props) { super(props); this.state = { - showPass: false + showPass: false, + title:"设置", }; } componentDidMount() { this.showPass(); } - - switchLang = (lng) => { - const { t, i18n } = this.props; - console.log("current lang:", Config.Language) - if (Config.Language === lng) { - return; - } - Config.Language = lng; - i18n.changeLanguage(lng); - } - showPass = () => { let _path = location.href.search(/wallet/g); if (_path <= -1) return; @@ -53,15 +46,15 @@ class menuDown extends React.Component { "id": "1234", "method": "CloseWallet" }) - .then(() => { - message.success(t("wallet page.close wallet success"), 2); - this.props.walletStore.logout(); - this.props.history.push('/'); - }) - .catch(function (error) { - console.log(error); - console.log("error"); - }); + .then(() => { + message.success(t("wallet page.close wallet success"), 2); + this.props.walletStore.logout(); + this.props.history.push('/'); + }) + .catch(function (error) { + console.log(error); + console.log("error"); + }); } showModal = () => { this.setState({ @@ -74,6 +67,20 @@ class menuDown extends React.Component { visible: false, }); }; + getInset = (ele) => { + const { t } = this.props; + return () =>{ + this.setState({showElem: false}) + switch(ele){ + case 0:this.setState({title:t("address book"),children: });break; + case 1:this.setState({title:t("settings"),children: });break; + default:this.setState({title:t("settings"),children: });break; + } + this.setState({ + visible: true, + }); + } + } openUrl(url) { return () => { shell.openExternal(url); @@ -81,28 +88,26 @@ class menuDown extends React.Component { } render() { const walletOpen = this.props.walletStore.isOpen; - const { t, i18n } = this.props; + const { t } = this.props; return (
    -

    {t("network setting")}

    -

    - - {t("mainnet")} - {t("testnet")} - -

    - -

    {t("language setting")}

    - - this.switchLang("zh")}>中文 - this.switchLang("en")}>English - - -

    {t("about")}

    - {/*

    更新完成,请重新启动Neo-GUI

    */} -

    {t("current version")} 1.0.1

    - -

    -

    NeoGUI @ 2020 Neo-Project {t("copyright")}

    -

    - {/* 查看帮助 */} - {t("report issues")} - Neo{t("official website")} -

    -

    + {this.state.children}
    ) diff --git a/neo3-gui/neo3-gui/ClientApp/src/components/Common/setting.js b/neo3-gui/neo3-gui/ClientApp/src/components/Common/setting.js new file mode 100644 index 00000000..e9bad786 --- /dev/null +++ b/neo3-gui/neo3-gui/ClientApp/src/components/Common/setting.js @@ -0,0 +1,94 @@ +/* eslint-disable */ +//just test replace wallet// +import React from 'react'; +import axios from 'axios'; +import {Link} from 'react-router-dom'; +import { Layout, Row, Col, Modal,List, Button,Typography, message } from 'antd'; + +import { observer, inject } from "mobx-react"; + +import { withRouter } from "react-router-dom"; +import Sync from '../sync'; +import { Radio } from 'antd'; +import Intitle from '../Common/intitle'; +import Transaction from '../Transaction/transaction'; +import '../../static/css/wallet.css'; +import Topath from '../Common/topath'; +import { withTranslation } from 'react-i18next'; +import Config from "../../config"; +import { + LogoutOutlined, + SettingOutlined +} from '@ant-design/icons'; + +import { + CloseCircleOutlined +} from '@ant-design/icons'; + +const { shell } = window.electron; +const { confirm } = Modal; +const { Content } = Layout; + +@withTranslation() +@inject("walletStore") +@observer +@withRouter +class Setting extends React.Component{ + constructor(props){ + super(props); + this.state = { + size: 'default', + address:"", + addresslist:[], + iconLoading:false, + gas:0, + }; + } + + switchLang = (lng) => { + const { t, i18n } = this.props; + console.log("current lang:", Config.Language) + if (Config.Language === lng) { + return; + } + Config.Language = lng; + i18n.changeLanguage(lng); + } + openUrl (url) { + return ()=>{ + shell.openExternal(url); + } + } + render = () =>{ + const { addresslist,address } = this.state; + const { t, i18n } = this.props; + return ( +
    +

    {t("network setting")}

    + + {t("mainnet")} + {t("testnet")} + + +

    {t("language setting")}

    + + this.switchLang("zh")}>中文 + this.switchLang("en")}>English + + +

    {t("about")}

    +

    {t("current version")} 1.0.1

    + +
    +

    NeoGUI @ 2020 Neo-Project {t("copyright")}

    +

    + {t("report issues")} + Neo{t("official website")} +

    +
    +
    + ); + } +} + +export default Setting; \ No newline at end of file diff --git a/neo3-gui/neo3-gui/ClientApp/src/components/Contract/contract.js b/neo3-gui/neo3-gui/ClientApp/src/components/Contract/contract.js index 2da3b035..473ef585 100644 --- a/neo3-gui/neo3-gui/ClientApp/src/components/Contract/contract.js +++ b/neo3-gui/neo3-gui/ClientApp/src/components/Contract/contract.js @@ -16,7 +16,6 @@ import { import { withTranslation } from "react-i18next"; - const { Content } = Layout; const { SubMenu } = Menu; @@ -30,11 +29,7 @@ class Contract extends React.Component { show: false }; } - toHome = () => { - } - toPage = (e) => { - } - visi = () => { + visi = () =>{ this.setState({ show: !this.state.show, }); diff --git a/neo3-gui/neo3-gui/ClientApp/src/components/Contract/contractlayout.js b/neo3-gui/neo3-gui/ClientApp/src/components/Contract/contractlayout.js index 86ba967d..8a09bec1 100644 --- a/neo3-gui/neo3-gui/ClientApp/src/components/Contract/contractlayout.js +++ b/neo3-gui/neo3-gui/ClientApp/src/components/Contract/contractlayout.js @@ -90,6 +90,7 @@ class Contractlayout extends React.Component { {!walletOpen ? ( @@ -97,13 +98,13 @@ class Contractlayout extends React.Component { } > - + { t('contract page.search contract nav') } - + { t('contract page.deploy contract nav') } - + { t('contract page.invoke contract nav') } diff --git a/neo3-gui/neo3-gui/ClientApp/src/components/Contract/deploy.js b/neo3-gui/neo3-gui/ClientApp/src/components/Contract/deploy.js index e37ed323..17c68835 100644 --- a/neo3-gui/neo3-gui/ClientApp/src/components/Contract/deploy.js +++ b/neo3-gui/neo3-gui/ClientApp/src/components/Contract/deploy.js @@ -147,30 +147,30 @@ class Contractdeploy extends React.Component { "method": "DeployContract", "params": params }) - .then(function (response) { - var _data = response.data; - if (_data.msgType === -1) { - let res = _data.error; - Modal.error({ - title: t('contract page.invoke fail title'), - width: 400, - content: ( -
    -

    {t('error code')}: {res.code}

    -

    {t('error msg')}: {res.message}

    -
    - ), - okText: t("button.ok") - }); - return; - } else if (_data.msgType === 3) { - callback(_data); - } - }) - .catch(function (error) { - console.log(error); - console.log("error"); - }); + .then(function (response) { + var _data = response.data; + if (_data.msgType === -1) { + let res = _data.error; + Modal.error({ + title: t('contract page.fail title'), + width: 400, + content: ( +
    +

    {t('error code')}: {res.code}

    +

    {t('error msg')}: {res.message}

    +
    + ), + okText: t("button.ok") + }); + return; + } else if (_data.msgType === 3) { + callback(_data); + } + }) + .catch(function (error) { + console.log(error); + console.log("error"); + }); } render = () => { const { t } = this.props; @@ -213,11 +213,11 @@ class Contractdeploy extends React.Component {
    -

    {t('contract page.invoke result')}

    +

    {t('contract page.test result')}