diff --git a/src/common/lang/en.js b/src/common/lang/en.js
index 381ebfe..5aab708 100644
--- a/src/common/lang/en.js
+++ b/src/common/lang/en.js
@@ -49,6 +49,17 @@ export default {
contractHash: 'Contract hash: '
},
+ FormField: {
+ label: 'name',
+ password: 'password',
+ passwordConfirmation: 'password confirmation',
+ mnemonic: 'mnemonic',
+ privateKey: 'private key',
+ oldPassword: 'old password',
+ newPassword: 'new password',
+ newPasswordConfirmation: 'new password confirmation'
+ },
+
TopNav: {
new: 'New',
edit: 'Edit'
@@ -610,7 +621,12 @@ Within their 50% share each consensus node will receive their share according to
profitONG: 'This is the transaction fee profit you have made. This will update at the beginning of each new consensus round.',
getProfitPart: 'Already receiving profit portion',
newStakePart: 'New stake portion',
- claimableONT: 'Claimable ONT'
+ claimableONT: 'Claimable ONT',
+ redeemInitPos: 'Redeem Init Pos',
+ initPosInLock: "Locked",
+ initPosRedeemable: 'Claimable',
+ noClaimbleInitPos: 'No claimble ONT.',
+ redeemInitPosOk: 'Redeem'
},
exchange: {
exchange: 'Exchange',
diff --git a/src/common/lang/zh.js b/src/common/lang/zh.js
index d54ba12..da53f65 100644
--- a/src/common/lang/zh.js
+++ b/src/common/lang/zh.js
@@ -49,6 +49,17 @@ export default {
contractHash: '合约哈希:'
},
+ FormField: {
+ label: '名称',
+ password: '密码',
+ passwordConfirmation: '确认密码',
+ mnemonic: '助记词',
+ privateKey: '私钥',
+ oldPassword: '旧密码',
+ newPassword: '新密码',
+ newPasswordConfirmation: '确认新的密码'
+ },
+
TopNav: {
new: '新建',
edit: '编辑'
@@ -605,7 +616,12 @@ export default {
profitONG: '这是您已获得的交易费收益。该收益会在每轮共识周期开始时更新。',
getProfitPart: '产生收益中',
newStakePart: '新的质押',
- claimableONT: '可提取ONT'
+ claimableONT: '可提取ONT',
+ redeemInitPos: '提取初始质押',
+ initPosInLock: "锁定中",
+ initPosRedeemable: '可提取',
+ noClaimbleInitPos: '没有可提取的初始质押。',
+ redeemInitPosOk: '确认提取'
},
exchange: {
exchange: 'Exchange',
diff --git a/src/core/consts.js b/src/core/consts.js
index 72f3cb5..f6472ec 100644
--- a/src/core/consts.js
+++ b/src/core/consts.js
@@ -79,4 +79,22 @@ export const PAX_API = {
export const PAX_SC_HASH = {
MAIN: '6bbc07bae862db0d7867e4e5b1a13c663e2b4bc8',
TEST: 'b06f8eaf757030c7a944ce2a072017bde1e72308'
-}
\ No newline at end of file
+}
+
+export const VALIDATE_DICTIONARY = {
+ zh: {
+ messages: {
+ required: (field, val) => `字段 ${field} 是必填项`,
+ min: (field, val) => `字段 ${field} 的长度不能少于${val[0]}`,
+ length: (field, val) => `字段 ${field} 的长度必须是${val[0]}`
+ },
+ attributes: {
+ password: '密码',
+ name: '名称',
+ label: '名称',
+ rePassword: '确认密码',
+ keystore: 'keystore',
+ keystorePassword: ''
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/renderer/App.vue b/src/renderer/App.vue
index 8b1fe1f..0b5a09d 100644
--- a/src/renderer/App.vue
+++ b/src/renderer/App.vue
@@ -183,6 +183,7 @@
.v-validate-span-errors {
color: red;
font-size: 12px;
+ display: block;
}
.refresh-icon {
diff --git a/src/renderer/components/Identitys/Create/BasicInfo.vue b/src/renderer/components/Identitys/Create/BasicInfo.vue
index 5d228c0..30d5529 100644
--- a/src/renderer/components/Identitys/Create/BasicInfo.vue
+++ b/src/renderer/components/Identitys/Create/BasicInfo.vue
@@ -2,7 +2,7 @@
{{ errors.first('label') }}
@@ -12,7 +12,7 @@
{{ errors.first('password') }}
{{ errors.first('rePassword') }}
diff --git a/src/renderer/components/Identitys/Import/BasicInfo.vue b/src/renderer/components/Identitys/Import/BasicInfo.vue
index 416373d..5da6d89 100644
--- a/src/renderer/components/Identitys/Import/BasicInfo.vue
+++ b/src/renderer/components/Identitys/Import/BasicInfo.vue
@@ -13,12 +13,12 @@
aria-labelledby="import-identity-keystore-pills-tab">
{{ errors.first('keystore') }}
{{ errors.first('keystorePassword') }}
diff --git a/src/renderer/components/JsonWallet/Create/BasicInfo.vue b/src/renderer/components/JsonWallet/Create/BasicInfo.vue
index 339cb2b..db844fb 100644
--- a/src/renderer/components/JsonWallet/Create/BasicInfo.vue
+++ b/src/renderer/components/JsonWallet/Create/BasicInfo.vue
@@ -12,7 +12,7 @@
{{ errors.first('password') }}
{{ errors.first('rePassword') }}
diff --git a/src/renderer/components/JsonWallet/Import/BasicInfo.vue b/src/renderer/components/JsonWallet/Import/BasicInfo.vue
index 5559bf2..a56ff47 100644
--- a/src/renderer/components/JsonWallet/Import/BasicInfo.vue
+++ b/src/renderer/components/JsonWallet/Import/BasicInfo.vue
@@ -155,7 +155,10 @@
-
+
+
{{ errors.first('wifLabel') }}
{{ errors.first('wif') }}
{{ errors.first('wifPassword') }}
{{ errors.first('pk') }}
{{ errors.first('pkPassword') }}
{{ errors.first('pkRePassword') }}
@@ -197,7 +200,7 @@
{{$t('importJsonWallet.importFirstDefault')}}
-
{{ errors.first('datLabel') }}
{{ datPath }}
@@ -205,7 +208,7 @@
{{ errors.first('datPassword') }}
@@ -215,16 +218,16 @@
{{ errors.first('mnemonic') }}
{{ errors.first('mnemonicPassword') }}
{{ errors.first('mnemonicRePassword') }}
@@ -322,6 +325,7 @@
})
} else if (this.tabName === 'wif') {
this.$validator.validateAll({
+ wifLabel: this.wifLabel,
wif: this.wif,
wifPassword: this.wifPassword,
wifRePassword: this.wifRePassword
diff --git a/src/renderer/components/JsonWallet/View/Details.vue b/src/renderer/components/JsonWallet/View/Details.vue
index 2f4e2a2..4863e19 100644
--- a/src/renderer/components/JsonWallet/View/Details.vue
+++ b/src/renderer/components/JsonWallet/View/Details.vue
@@ -63,21 +63,21 @@
diff --git a/src/renderer/components/Node/NodeAuthorize/NodeList.vue b/src/renderer/components/Node/NodeAuthorize/NodeList.vue
index 327960d..ea05f76 100644
--- a/src/renderer/components/Node/NodeAuthorize/NodeList.vue
+++ b/src/renderer/components/Node/NodeAuthorize/NodeList.vue
@@ -53,6 +53,12 @@
font-size:18px;
cursor: pointer;
}
+.node-name {
+ /* color: #227EEC !important; */
+}
+.node-name:hover {
+ color: #227EEC !important;
+}
-
@@ -159,10 +165,16 @@ export default {
//loop to fetch data
// this.$store.dispatch('showLoadingModals');
this.requesting = true;
- this.$store.dispatch('fetchAllSortedNodeList').then(res => {
- this.pagination.total = res.length;
- this.fetchList()
- })
+ const net = localStorage.getItem('net')
+ if(net === 'TEST_NET') {
+ this.$store.dispatch('fetchAllSortedNodeList').then(res => {
+ this.pagination.total = res.length;
+ this.fetchList()
+ })
+ } else {
+ this.fetchList()
+ }
+
this.$store.dispatch('fetchBlockCountdown')
this.intervalId = setInterval(()=>{
// this.$store.dispatch('fetchNodeList')
@@ -199,11 +211,12 @@ export default {
},
fetchList() {
this.requesting = true;
- this.$store.dispatch('fetchNodeList', {
+ this.$store.dispatch('fetchNodeListNew', {
pageSize: this.pagination.pageSize,
pageNum: this.pagination.current - 1
}).then(res => {
this.requesting = false;
+ this.pagination.total = res;
})
},
showProportionTip() {
diff --git a/src/renderer/components/Node/NodeStake/NodeStakeInfo.vue b/src/renderer/components/Node/NodeStake/NodeStakeInfo.vue
index 28bae15..8b58b56 100644
--- a/src/renderer/components/Node/NodeStake/NodeStakeInfo.vue
+++ b/src/renderer/components/Node/NodeStake/NodeStakeInfo.vue
@@ -46,7 +46,7 @@
}
.initPos-btns {
margin:10px auto;
- width:540px;
+ width:640px;
}
.initPos-btns button {
margin-right: 20px;
@@ -119,7 +119,8 @@
{{$t('nodeMgmt.addInitPos')}}
{{$t('nodeMgmt.reduceInitPos')}}
+ >{{$t('nodeMgmt.reduceInitPos')}}
+ {this.redeemPosVisible = true;}">{{$t('nodeMgmt.redeemInitPos')}}
+
+
+
{{$t('nodeMgmt.initPosInLock')}}: {{authorizationInfo.locked}} ONT
+
{{$t('nodeMgmt.initPosRedeemable')}}: {{authorizationInfo.claimable}} ONT
+
+
+
{
this.$store.dispatch("fetchStakeDetail", this.stakeIdentity.ontid);
this.$store.dispatch('fetchPeerItem', this.detail.publickey);
this.$store.dispatch('fetchPosLimit')
+ this.$store.dispatch('fetchAuthorizationInfo',
+ {pk: this.detail.publickey, address: this.stakeWallet.address}
+ )
}, this.interval);
this.intervalId = intervalId
},
@@ -259,7 +281,8 @@ export default {
status3: state => state.NodeStake.status3,
current: state => state.NodeStake.current,
statusTip: state => state.NodeStake.statusTip,
- btnText: state => state.NodeStake.btnText
+ btnText: state => state.NodeStake.btnText,
+ authorizationInfo: state => state.NodeAuthorization.authorizationInfo
})
},
methods: {
@@ -512,6 +535,24 @@ export default {
},
handleReducePosCancel() {
this.reducePosVisible = false;
+ },
+ handleRedeemPosOk() {
+ if(this.authorizationInfo && this.authorizationInfo.claimableVal === 0) {
+ this.$message.warning(this.$t('nodeMgmt.noClaimbleInitPos'))
+ return;
+ }
+ this.redeemPosVisible = false;
+ const userAddr = new Crypto.Address(this.stakeWallet.address);
+ const peerPubkeys = [this.detail.publickey]
+ const withdrawList = [this.authorizationInfo.claimableVal]
+ const payer = userAddr
+ const tx = GovernanceTxBuilder.makeWithdrawTx(userAddr, peerPubkeys, withdrawList, payer, GAS_PRICE, GAS_LIMIT)
+ this.tx = tx;
+ this.walletPassModal = true;
+ this.isDelegateSendTx = false;
+ },
+ handleRedeemPosCancel() {
+ this.redeemPosVisible = false;
}
}
};
diff --git a/src/renderer/main.js b/src/renderer/main.js
index 7d42c02..4c1dfa2 100644
--- a/src/renderer/main.js
+++ b/src/renderer/main.js
@@ -15,10 +15,17 @@ import VueClipboard from 'vue-clipboard2'
VueClipboard.config.autoSetContainer = true // add this line
Vue.use(VueClipboard)
-import VeeValidate from 'vee-validate'
-Vue.use(VeeValidate)
-
import i18n from '../common/lang'
+import VeeValidate from 'vee-validate'
+import { VALIDATE_DICTIONARY } from '../core/consts'
+import validationMessages from 'vee-validate/dist/locale/en';
+Vue.use(VeeValidate, {
+ i18n,
+ dictionary: {
+ en: validationMessages,
+ zh: VALIDATE_DICTIONARY.zh
+ }
+})
import service from '../core/utils'
Vue.prototype.httpService = service;
diff --git a/src/renderer/store/modules/NodeAuthorization.js b/src/renderer/store/modules/NodeAuthorization.js
index f43a175..f463ffc 100644
--- a/src/renderer/store/modules/NodeAuthorization.js
+++ b/src/renderer/store/modules/NodeAuthorization.js
@@ -378,11 +378,50 @@ const actions = {
commit('UPDATE_NODE_LIST', {list});
dispatch('hideLoadingModals')
- return list;
+ return list.length;
} catch(err) {
console.log(err)
dispatch('hideLoadingModals')
- return [];
+ return 0;
+ }
+ },
+
+ async fetchNodeListNew({commit, dispatch}, {pageSize, pageNum}) {
+ const net = localStorage.getItem('net')
+ if(net === 'TEST_NET') {
+ return dispatch('fetchNodeList', {pageSize, pageNum})
+ } else {
+ try {
+ const url = 'https://explorer.ont.io/v2/nodes/current-stakes'
+ const res = await axios.get(url)
+ console.log(res)
+ if(res.data.code === 0 && res.data.result) {
+ const result = res.data.result;
+ const total = result.length;
+ const list = result.slice(pageNum * pageSize, (pageNum + 1) * pageSize).map(item => {
+ item.rank = item.node_rank;
+ item.nodeProportion = item.node_proportion;
+ item.currentStake = numeral(item.current_stake).format('0,0');
+ item.process = item.progress;
+ item.maxAuthorize = item.max_authorize;
+ item.maxAuthorizeStr = numeral(item.max_authorize).format('0,0')
+ item.totalPos = item.total_pos;
+ item.initPos = item.init_pos;
+ item.pk = item.public_key;
+ item.detailUrl = item.detail_url;
+ item.totalPosStr = numeral(item.totalPos).format('0,0')
+ return item;
+ })
+ commit('UPDATE_NODE_LIST', {list})
+ return total;
+ } else {
+ return 0;
+ }
+ }catch(err) {
+ console.log(err)
+ dispatch('hideLoadingModals')
+ return 0;
+ }
}
},
async fetchBlockCountdown({commit}) {
diff --git a/src/renderer/store/modules/NodeStake.js b/src/renderer/store/modules/NodeStake.js
index ed552ab..02d3b58 100644
--- a/src/renderer/store/modules/NodeStake.js
+++ b/src/renderer/store/modules/NodeStake.js
@@ -3,9 +3,16 @@ import en from '../../../common/lang/en'
import zh from '../../../common/lang/zh'
import {ONT_PASS_NODE, ONT_PASS_NODE_PRD, ONT_PASS_URL} from '../../../core/consts'
const state = {
- detail: '',
- stakeWallet: '',
- stakeIdentity:'',
+ detail: {
+ publickey: ''
+ },
+ stakeWallet: {
+ address: '',
+ key: ''
+ },
+ stakeIdentity: {
+ ontid: ''
+ },
status1: '',
status2: '',
status3: '',