BTM0011:'Keystore文件格式错误。',
BTM0012:'Keystore已存在请勿重复导入。',
BTM0013:'钱包名称的汉字最大长度为7。',
- BTM0014:'钱包名称的最大长度为9。'
+ BTM0014:'钱包名称的最大长度为9。',
+ BTM3000:'密码错误。',
+ BTM3001:'无效密钥派生规则。' ,
+ BTM3002:'无法支持解析至PBKDF2。',
+ BTM3003:'请输入密码。',
+ BTM3004:'不支持多个keystore文件导入',
+ BTM3005:'助记词长度错误',
+ BTM3006:'助记词无效',
+
+ BTM3100:'输入不能为空',
+ BTM3101:'无效data类型。',
+ BTM3102:'无效Boolean类型。',
},
successMsg:{
createWallet:{
},
transfer: {
address: 'Address',
- quantity: 'Amount',
+ bytomAddress:'Bytom address (start with bm)',
+ vaporAddress:'Vapor address (start with vp)',
+ quantity: ' Amount',
fee: 'Fee',
+ available:'Available:',
feeType: 'Standard',
send: 'Send transaction',
confirmPassword: 'password',
BTM0011:'Keystore file format error.',
BTM0012:'Keystore already exist.',
BTM0013:'The max length of chinese char is 7.',
- BTM0014:'The max length of wallet alias is 9.'
+ BTM0014:'The max length of wallet alias is 9.',
+ BTM3000:'Key derivation failed - possibly wrong password',
+ BTM3001:'Unsupported key derivation scheme' ,
+ BTM3002:'Unsupported parameters to PBKDF2',
+ BTM3003:'No password given.',
+ BTM3004:'do not support multiple keystore imported.',
+ BTM3005:'mnemonic length error',
+ BTM3006:'mnemonic is invalid',
+
+ BTM3100:'Input args are empty',
+ BTM3101:'Invalid data type.',
+ BTM3102:'Invalid Boolean argument'
},
successMsg:{
createWallet:{
description: 'Bytom Wallet Chrome extension.',
version: '3.0.1',
author: 'Bytom frontend, zhitinglin',
- web_accessible_resources: ['js/inject.js', 'wasm/main.wasm'],
+ web_accessible_resources: ['js/inject.js'],
browser_action: {
default_popup: 'pages/popup.html',
default_icon: 'icons/logo.png'
import Bytom from 'bytom-js-sdk'
import { networksJS as networks} from '../utils/constants'
-var bytom = new Bytom(networks, chrome.runtime.getURL('wasm/main.wasm'))
+var bytom = new Bytom(networks)
bytom.sdk.networks = function() {
return bytom.getNetType()
this.$router.push({ name: RouteNames.BACKUP_MNEMONIC })
})
}
- catch (e){
- this.$toast.error(
- e.message || e
- );
+ catch (error){
+ let e = error
+ if (error.code){
+ e = this.$t(`error.${error.code}`)
+ }else if(error.message){
+ e = error.message
+ }
+ this.$toast.error(e);
}
},
import _ from 'lodash';
import { Number as Num } from "@/utils/Number"
import BigNumber from "bignumber.js"
+import getLang from "@/assets/language/sdk";
const EnterActive = 'animated faster fadeInLeft';
this[Actions.UPDATE_STORED_BYTOM](bytom).then(()=>{
this.setupRefreshTimer()
})
- }).catch(e =>{
- this.$toast.error(
- e.message ||e
- );
+ }).catch(error =>{
+ let e = error
+ if (error.code){
+ e = this.$t(`error.${error.code}`)
+ }else if(error.message){
+ e = getLang(error.message, this.language)
+ }
+ this.$toast.error(e);
})
}else{
this[Actions.UPDATE_STORED_BYTOM](bytom).then(()=>{
}).catch(error => {
loader.hide();
- this.$toast.error(
- getLang(error.message) || error.message || error
- );
+ let e = error
+ if (error.code){
+ e = this.$t(`error.${error.code}`)
+ }else if(error.message){
+ e = getLang(error.message)
+ }
+ this.$toast.error(e);
});
} else if(this.prompt.data.type ==='transfer'){
transaction.transfer(this.transaction, this.password, this.address, this).then(result => {
}).catch(error => {
loader.hide();
- this.$toast.error(
- getLang(error.message) || error.message || error
- );
+ let e = error
+ if (error.code){
+ e = this.$t(`error.${error.code}`)
+ }else if(error.message){
+ e = getLang(error.message)
+ }
+ this.$toast.error(e);
});
} else if(this.prompt.data.type ==='signTransaction'){
const data = this.prompt.data.value
}).catch(error => {
loader.hide();
- this.$toast.error(
- getLang(error.message) || error.message || error
- );
+ let e = error
+ if (error.code){
+ e = this.$t(`error.${error.code}`)
+ }else if(error.message){
+ e = getLang(error.message)
+ }
+ this.$toast.error(e);
});
}
}).catch(error => {
loader.hide();
- this.$toast.error( getLang(error.message));
+ let e = error
+ if (error.code){
+ e = this.$t(`error.${error.code}`)
+ }else if(error.message){
+ e = getLang(error.message)
+ }
+ this.$toast.error(e);
});
}
else{
}).catch(error => {
loader.hide();
- this.$toast.error(
- getLang(error.message, this.language)
- );
+
+ let e = error
+ if (error.code){
+ e = this.$t(`error.${error.code}`)
+ }else if(error.message){
+ e = getLang(error.message, this.language)
+ }
+ this.$toast.error(e);
});
},
...mapActions([
try{
account.isAliasValid(this.formItem.accAlias, this)
- }catch (e){
- this.$toast.error(
- e.message || e
- );
+ }catch (error){
+ let e = error
+ if (error.code){
+ e = this.$t(`error.${error.code}`)
+ }else if(error.message){
+ e = error.message
+ }
+ this.$toast.error(e);
this.$refs['accAlias'].focus();
return;
}
loader.hide();
this.formItem = {};
this.$router.push('/mnemonic');
- }).catch(err => {
+ }).catch(error => {
loader.hide();
- this.$toast.error(
- err.message || err
- )
+ let e = error
+ if (error.code){
+ e = this.$t(`error.${error.code}`)
+ }else if(error.message){
+ e = error.message
+ }
+ this.$toast.error(e)
});
}
},
try{
account.isValidMnemonic(mnemonic)
- }catch (e){
- this.$toast.error(
- e.message || e
- );
+ }catch (error){
+ let e = error
+ if (error.code){
+ e = this.$t(`error.${error.code}`)
+ }else if(error.message){
+ e = error.message
+ }
+ this.$toast.error(e)
return
}
}).then(() => {
this.$router.push('/restore-password');
});
- }catch (e){
- this.$toast.error(
- e.message || e
- );
+ }catch (error){
+ let e = error
+ if (error.code){
+ e = this.$t(`error.${error.code}`)
+ }else if(error.message){
+ e = error.message
+ }
+ this.$toast.error(e)
return
}
}).then(() => {
this.$router.push('/restore-password');
});
- }catch (e){
- this.$toast.error(
- e.message || e
- );
+ }catch (error){
+ let e = error
+ if (error.code){
+ e = this.$t(`error.${error.code}`)
+ }else if(error.message){
+ e = error.message
+ }
+ this.$toast.error(e)
return
}
const mnemonic = account.decryptMnemonic(vault, this.passwd, this)
this[Actions.SET_MNEMONIC](mnemonic)
}
- catch (e){
- this.$toast.error(
- e.message || e
- );
+ catch (error){
+ let e = error
+ if (error.code){
+ e = this.$t(`error.${error.code}`)
+ }else if(error.message){
+ e = error.message
+ }
+ this.$toast.error(e)
}
},
...mapActions([
try{
account.isAliasValid(accountAlias, this)
- }catch (e){
- this.$toast.error(
- e.message || e
- );
+ }catch (error){
+ let e = error
+ if (error.code){
+ e = this.$t(`error.${error.code}`)
+ }else if(error.message){
+ e = error.message
+ }
+ this.$toast.error( e );
this.$refs['accAlias'].focus();
return;
}
this.formItem = {};
this[Actions.CLEAR_DATA]()
this[Actions.PUSH_ALERT](this.$t("successMsg.restoreWallet"))
- }).catch(err => {
+ }).catch(error => {
loader.hide();
- this.$toast.error(
- err.message || err
- )
+ let e = error
+ if (error.code){
+ e = this.$t(`error.${error.code}`)
+ }else if(error.message){
+ e = error.message
+ }
+ this.$toast.error(e)
});
}else if(keystore){
//restore by keystore
this.formItem = {};
this[Actions.CLEAR_DATA]()
this[Actions.PUSH_ALERT](this.$t("successMsg.restoreWallet"))
- }).catch(err => {
+ }).catch(error => {
loader.hide();
- this.$toast.error(
- err.message || err
- )
+ let e = error
+ if (error.code){
+ e = this.$t(`error.${error.code}`)
+ }else if(error.message){
+ e = error.message
+ }
+ this.$toast.error(e)
});
}
account.createAccount(this).then(() => {
loader.hide();
this[Actions.PUSH_ALERT](this.$t("successMsg.createWallet"))
- }).catch(err => {
- loader.hide();
- this.$toast.error(
- err.message || err
- )
+ }).catch(error => {
+ let e = error
+ if (error.code){
+ e = this.$t(`error.${error.code}`)
+ }else if(error.message){
+ e = error.message
+ }
+ this.$toast.error(e)
});
},
updateMnemonicList(index){