Skip to content

Commit

Permalink
Merge pull request #257 from ontio/dev
Browse files Browse the repository at this point in the history
fix transfer for ope4
  • Loading branch information
liuqiang1357 committed Oct 22, 2020
2 parents f1f09c5 + 49d3541 commit de5a119
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "owallet",
"homepage": "http://ont.io",
"version": "v0.9.26",
"version": "v0.9.27",
"author": "Ontology Foundation Ltd. <devops@ont.io>",
"description": "OWallet is a comprehensive Ontology desktop wallet",
"license": "Apache-2.0",
Expand Down
7 changes: 3 additions & 4 deletions src/components/SharedWallet/Transfer/SendAsset.vue
Expand Up @@ -142,11 +142,10 @@ export default {
if(this.asset === 'ONT' && !varifyPositiveInt(this.amount)) {
this.validAmount = false;
return;
}
else if(this.asset === 'ONG' && !varifyOngValue(this.amount)) {
} else if(this.asset === 'ONG' && !varifyOngValue(this.amount)) {
this.validAmount = false;
return;
} else if (!varifyOpe4Value(this.amount, this.decimal)) {
} else if (this.asset !== 'ONT' && this.asset !== 'ONG' && !varifyOpe4Value(this.amount, this.decimal)) {
this.validAmount = false;
return;
}
Expand Down Expand Up @@ -188,7 +187,6 @@ export default {
this.amount = this.balance.ont;
} else if(this.asset === 'ONG'){
this.amount = (new BigNumber(this.balance.ong).minus(this.gas)).toString();
this.validateAmount()
} else {
for(let i=0; i<this.oep4s.length; i++){
if(this.oep4s[i].symbol === this.asset) {
Expand All @@ -197,6 +195,7 @@ export default {
}
}
}
this.validateAmount();
},
cancel() {
this.$store.commit('CLEAR_CURRENT_TRANSFER')
Expand Down
8 changes: 6 additions & 2 deletions src/core/utils.js
Expand Up @@ -50,8 +50,12 @@ export function varifyOngValue(value) {
}

export function varifyOpe4Value(value, decimal) {
if (!new RegExp(`^[0-9]+(\\.[0-9]{1,${decimal}})?$`).test(value)) {
return false;
if (decimal > 0) {
if (!new RegExp(`^[0-9]+(\\.[0-9]{1,${decimal}})?$`).test(value)) {
return false;
}
} else {
return varifyPositiveInt(value);
}
return true;
}
Expand Down

0 comments on commit de5a119

Please sign in to comment.