Skip to content

Commit

Permalink
Merge pull request #187 from MickWang/master
Browse files Browse the repository at this point in the history
 fix refund amount error; update ui
  • Loading branch information
MickWang authored Aug 7, 2019
2 parents cb4ef92 + fc8c336 commit 1423b7f
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 15 deletions.
8 changes: 6 additions & 2 deletions src/common/lang/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ export default {
passError: 'Password error',
ontidNotExist: 'The ONT ID to import does not exist on the blockchain',
keystoreImport: 'ONT ID Keystore Import',
invalidKeystore: 'The keysotre you input is invalid.'
invalidKeystore: 'The keystore you input is invalid.',
ontidExist: 'The identity already exists in local.',
importSuccess: 'Import Identity succeessfully!'
},

wallets: {
Expand Down Expand Up @@ -626,7 +628,9 @@ Within their 50% share each consensus node will receive their share according to
initPosInLock: "Locked",
initPosRedeemable: 'Claimable',
noClaimbleInitPos: 'No claimble ONT.',
redeemInitPosOk: 'Redeem'
redeemInitPosOk: 'Redeem',
hasClaimableInitPos: 'You have redeemable init pos. Plase redeem this part first.',
noClaimbleToRefund: 'No redeemable ONT to refund.'
},
exchange: {
exchange: 'Exchange',
Expand Down
8 changes: 6 additions & 2 deletions src/common/lang/zh.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ export default {
passError: '密码错误',
ontidNotExist: '要导入的ONT ID不存在于区块链上',
keystoreImport: '导入ONT ID Keystore',
invalidKeystore: '您输入的keystore不正确。'
invalidKeystore: '您输入的keystore不正确。',
ontidExist: '要导入的ONT ID本地已存在。',
importSuccess: '导入ONT ID成功。'
},

wallets: {
Expand Down Expand Up @@ -621,7 +623,9 @@ export default {
initPosInLock: "锁定中",
initPosRedeemable: '可提取',
noClaimbleInitPos: '没有可提取的初始质押。',
redeemInitPosOk: '确认提取'
redeemInitPosOk: '确认提取',
hasClaimableInitPos: '您还有可提取的初始质押。请先提取该部分ONT。',
noClaimbleToRefund: '没有可提取的ONT。无法提款。'
},
exchange: {
exchange: 'Exchange',
Expand Down
4 changes: 2 additions & 2 deletions src/core/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,13 @@ export function getTokenBalanceUrl(token_type, address) {

export function validateKeystorePath(path) {
const system = os.platform();
if(system.indexOf('win') > -1) {
if(system.indexOf('win') > -1 && system !== 'darwin') {
const files = fs.readdirSync(path)
if(files && files.indexOf('resources') > -1 && files.indexOf('OWallet.exe') > -1) {
return false;
}
const cwd = process.cwd();
if(path && (path === cwd || path.indexOf(cwd) > -1)) {
if(path && cwd !== '/' && (path === cwd || path.indexOf(cwd) > -1)) {
return false;
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/components/Identitys.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ import IdentityView from './Identitys/IdentityView'
.div-create-wallet {
width: 24.63rem;
height: 13.19rem;
margin-right: 3.75rem;
margin-right: 1.75rem;
margin-left:1.75rem;
margin-bottom: 2.75rem;
}
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/components/Identitys/Import/BasicInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,12 @@ import { getRestClient, formatScryptParams } from '../../../../core/utils';
dbService.insert(wallet, function (err, newDoc) {
if (err) {
console.log(err)
that.$message.warning('The identity already exists in local.')
that.$message.warning(that.$t('importIdentity.ontidExist'))
that.$store.dispatch('hideLoadingModals')
return;
}
that.$message.success('Import Identity succeessfully!')
that.$message.success(that.$t('importIdentity.importSuccess'))
that.$router.push({name: 'Identitys'})
})
},
Expand Down
18 changes: 14 additions & 4 deletions src/renderer/components/Node/NodeStake/NodeStakeInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@
<p class="font-medium-black" for="">{{$t('nodeStake.stakeQuantity')}}</p>
<p>{{current_peer.initPos}}</p>
</div>
<!-- NODE_HIDE -->
<div class="initPos-btns" v-if="showPosBtn">
<!-- 只有成为节点后可以操作初始质押部分 -->
<div class="initPos-btns" v-if="detail.status === 8">
<a-button class="add-initPos-btn" @click="handleAddInitPos">{{$t('nodeMgmt.addInitPos')}}</a-button>
<a-button class="add-initPos-btn" @click="handleReduceInitPos"
v-if="current_peer.initPos> detail.commitmentquantity"
Expand All @@ -134,7 +134,7 @@
:disabled="refundClicked">{{$t('nodeStake.refund')}}</a-button>
<a-button @click="handleQuitNode" class="btn-next" v-if="detail.status ===8">{{$t('nodeStake.quitNode')}}</a-button>
<a-button @click="handleNewStake" class="btn-next" v-if="detail.status ===6 || detail.status ===1">{{$t('nodeStake.newStake')}}</a-button>

</div>
</div>

Expand Down Expand Up @@ -441,17 +441,27 @@ export default {
},
handleRefund() {
if(this.authorizationInfo && this.authorizationInfo.claimableVal === 0) {
this.$message.warning(this.$t('nodeMgmt.noClaimbleToRefund'))
return;
}
const userAddr = new Crypto.Address(this.stakeWallet.address);
const peerPubkeys = [this.detail.publickey]
// const withdrawList = [this.detail.stakequantity]
// Fix:节点质押部分可能会增加或减少,退款应该用initPos;
const withdrawList = [this.current_peer.initPos]
// Fix2: 退款都可以用可提取部分
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;
},
handleQuitNode() {
//Fixme:退出节点前先把可提取初始质押提取出来。
if(this.authorizationInfo && this.authorizationInfo.claimableVal > 0) {
this.$message.warning(this.$t('nodeMgmt.hasClaimableInitPos'))
return;
}
const userAddr = new Crypto.Address(this.stakeWallet.address);
const peerPubkey = this.detail.publickey;
const payer = userAddr;
Expand Down
5 changes: 3 additions & 2 deletions src/renderer/components/Wallets.vue
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,10 @@
.normalWallet,
.div-create-wallet {
width: 23.63rem;
width: 24.63rem;
height: 13.19rem;
margin-right: 3.75rem;
margin-right: 1.75rem;
margin-left:1.75rem;
margin-bottom: 2.75rem;
}
Expand Down
1 change: 1 addition & 0 deletions src/renderer/store/modules/NodeAuthorization.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ const actions = {
item.detailUrl = NODE_DETAIL + item.peerPubkey;
// matchNodeName(item)
})
console.log(JSON.stringify(list))

commit('UPDATE_NODE_LIST', {list});
dispatch('hideLoadingModals')
Expand Down

0 comments on commit 1423b7f

Please sign in to comment.