"uuid": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz",
- "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==",
- "dev": true
+ "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA=="
},
"v-click-outside-x": {
"version": "3.0.3",
"iview": "^3.0.0",
"moment": "^2.22.2",
"qrcodejs2": "0.0.2",
+ "uuid": "^3.3.2",
"vue": "^2.5.11",
"vue-i18n": "^8.2.1",
"vue-loading-overlay": "^3.0.1",
cn: cn
};
-function getLang(str) {
- let lang = localStorage.lang;
+function getLang(str, lang) {
if (sdkLang[lang] && sdkLang[lang][str]) {
return sdkLang[lang][str];
}
return str;
}
-export default getLang;
\ No newline at end of file
+export default getLang;
<script>
import { getLanguage } from "@/assets/language"
+import { mapGetters } from 'vuex'
+
const CLASS_CN = "form-item-content form-item-content-cn";
const CLASS_EN = "form-item-content form-item-content-en"
export default {
}
return CLASS_CN;
},
+ ...mapGetters([
+ 'language'
+ ])
},
methods: {
open() {
- this.i18n = getLanguage();
+ this.i18n = getLanguage(this.language);
this.show = true;
this.passwd = "";
},
}
}
};
-</script>
\ No newline at end of file
+</script>
width: 12px; /* To account for extra width from rotating. */
}
.v-select .open-indicator:before {
- border-color: rgb(255, 255, 255);
+ border-color: grey;
border-style: solid;
border-width: 3px 3px 0 0;
content: '';
import bytom from './bytom'
+import uuid from 'uuid'
+
let account = {
setupNet: bytom.setupNet
account.create = function(accountAlias, keyAlias, passwd, success, error) {
let retPromise = new Promise((resolve, reject) => {
+ if(!keyAlias){
+ keyAlias = `${accountAlias}-key-${uuid.v4()}`
+ }
bytom.keys
.create(keyAlias, passwd)
.then(res => {
.listAccountUseServer()
.then(accounts => {
Promise.all(accounts.map(async (account) => {
- const balances = await this.balance(account.guid)
- account.balances = balances
+ try{
+ const balances = await this.balance(account.guid)
+ account.balances = balances
+ }catch (e) {
+ return e
+ }
})).then(()=>{
resolve(accounts)
+ }).catch(error=>{
+ throw error
})
})
.catch(error => {
import {store} from "./store/store";
import * as Actions from "./store/constants";
-Vue.use(VueI18n)
-const i18n = new VueI18n({
- fallbackLocale: 'en',
- locale: getLanguage(),
- messages
-})
-Vue.use(i18n)
-Vue.use(vuescroll)
-Vue.use(VueRouter)
-Vue.use(MenuPage)
-Vue.use(Loading)
-Vue.use(Dialog, i18n)
-Vue.component('v-select', vSelect)
-Vue.prototype.$vuescrollConfig = {
- mode: 'pure-native',
- bar: {
- keepShow: true,
- background: '#c9c9c9'
+store.dispatch(Actions.LOAD_BYTOM).then(() => {
+ Vue.use(VueI18n)
+ const i18n = new VueI18n({
+ fallbackLocale: 'en',
+ locale: getLanguage(store.getters.language),
+ messages
+ })
+ Vue.use(i18n)
+ Vue.use(vuescroll)
+ Vue.use(VueRouter)
+ Vue.use(MenuPage)
+ Vue.use(Loading)
+ Vue.use(Dialog, i18n)
+ Vue.component('v-select', vSelect)
+
+ Vue.prototype.$vuescrollConfig = {
+ mode: 'pure-native',
+ bar: {
+ keepShow: true,
+ background: '#c9c9c9'
+ }
}
-}
-Vue.filter('moment', function(value, formatString) {
- formatString = formatString || 'YYYY-MM-DD HH:mm:ss'
- return moment(value * 1000).format(formatString)
-})
+ Vue.filter('moment', function(value, formatString) {
+ formatString = formatString || 'YYYY-MM-DD HH:mm:ss'
+ return moment(value * 1000).format(formatString)
+ })
-const RouterConfig = {
- routes: Routers
-}
-const router = new VueRouter(RouterConfig)
-router.beforeEach((to, from, next) => {
- // wallet init
- if (localStorage.login == undefined && to.name == 'home') {
- next({ name: 'welcome-creation' })
- return
+ const RouterConfig = {
+ routes: Routers
}
+ const router = new VueRouter(RouterConfig)
+ router.beforeEach((to, from, next) => {
+ // wallet init
+ if (store.getters.login == undefined && to.name == 'home') {
+ next({ name: 'welcome-creation' })
+ return
+ }
- next()
-})
-
-store.dispatch(Actions.LOAD_BYTOM).then(() => {
+ next()
+ })
new Vue({
el: '#app',
i18n: i18n,
import messages, { getLanguage } from '@/assets/language'
import '@/assets/style.css'
-Vue.use(VueI18n)
-const i18n = new VueI18n({
- fallbackLocale: 'en',
- locale: getLanguage(),
- messages
-})
-Vue.use(i18n)
-Vue.use(vuescroll)
-Vue.use(VueRouter)
-Vue.use(Loading)
-Vue.use(Dialog, i18n)
-Vue.component('v-select', vSelect)
-Vue.filter('moment', function(value, formatString) {
- formatString = formatString || 'YYYY-MM-DD HH:mm:ss'
- return moment(value * 1000).format(formatString)
-})
-Vue.prototype.$vuescrollConfig = {
- mode: 'pure-native',
- bar: {
- keepShow: true,
- background: '#c9c9c9'
- }
-}
-
-const RouterConfig = {
- routes: Routers
-}
-const router = new VueRouter(RouterConfig)
store.dispatch(Actions.LOAD_BYTOM).then(() => {
+ Vue.use(VueI18n)
+ const i18n = new VueI18n({
+ fallbackLocale: 'en',
+ locale: getLanguage(store.getters.language),
+ messages
+ })
+ Vue.use(i18n)
+ Vue.use(vuescroll)
+ Vue.use(VueRouter)
+ Vue.use(Loading)
+ Vue.use(Dialog, i18n)
+ Vue.component('v-select', vSelect)
+ Vue.filter('moment', function(value, formatString) {
+ formatString = formatString || 'YYYY-MM-DD HH:mm:ss'
+ return moment(value * 1000).format(formatString)
+ })
+ Vue.prototype.$vuescrollConfig = {
+ mode: 'pure-native',
+ bar: {
+ keepShow: true,
+ background: '#c9c9c9'
+ }
+ }
+
+ const RouterConfig = {
+ routes: Routers
+ }
+ const router = new VueRouter(RouterConfig)
new Vue({
el: '#app',
i18n: i18n,
import Bytom from '../utils/Bytom'
import InternalMessage from '../messages/internal'
import * as InternalMessageTypes from '../messages/types'
+import account from "../models/account";
export const actions = {
[Actions.SET_BYTOM]:({commit}, bytom) => commit(Actions.SET_BYTOM, bytom),
})
},
- // [Actions.IMPORT_BYTOM]:({dispatch}, {imported, seed}) => {
- // return new Promise(async (resolve, reject) => {
- //
- // const bytom = Bytom.fromJson(imported);
- //
- // await Promise.all(PluginRepository.signatureProviders().map(async plugin => {
- // const network = await plugin.getEndorsedNetwork();
- //
- // bytom.settings.networks = bytom.settings.networks.filter(_network => _network.unique() !== network.unique());
- // bytom.settings.networks.push(network);
- // }));
- //
- // bytom.meta = new Meta();
- //
- // InternalMessage.payload(InternalMessageTypes.SET_SEED, seed).send().then(() => {
- // dispatch(Actions.UPDATE_STORED_BYTOM, bytom).then(_bytom => {
- // resolve();
- // })
- // });
- // })
- // },
+ [Actions.IMPORT_BYTOM]:({state, commit, dispatch}) => {
+ return new Promise(async (resolve, reject) => {
+ const bytom = Bytom.fromJson(state.bytom);
+ bytom.settings.network = 'mainnet';
+ account.setupNet('mainnet')
+ account.list().then(accounts => {
+ bytom.accountList = accounts;
+ if (accounts.length > 0) {
+ bytom.currentAccount = accounts[0];
+ }
+
+ bytom.settings.login = true
+ dispatch(Actions.UPDATE_STORED_BYTOM, bytom).then(_bytom => {
+ dispatch(Actions.SET_BYTOM, Bytom.fromJson(_bytom));
+ resolve();
+ })
+ })
- [Actions.CREATE_NEW_BYTOM]:({state, commit, dispatch}, network, currentAccount) => {
+ })
+ },
+
+ [Actions.CREATE_NEW_BYTOM]:({state, commit, dispatch}, network) => {
return new Promise(async (resolve, reject) => {
const bytom = Bytom.fromJson(state.bytom);
bytom.settings.network = network;
- bytom.currentAccount = currentAccount
+ account.setupNet(network)
+ account.list().then(accounts => {
+ bytom.accountList = accounts;
+ if (accounts.length > 0) {
+ bytom.currentAccount = accounts[0];
+ }
- dispatch(Actions.UPDATE_STORED_BYTOM, bytom).then(_bytom => {
- dispatch(Actions.SET_BYTOM, Bytom.fromJson(_bytom));
- resolve();
+ bytom.settings.login = true
+ dispatch(Actions.UPDATE_STORED_BYTOM, bytom).then(_bytom => {
+ dispatch(Actions.SET_BYTOM, Bytom.fromJson(_bytom));
+ resolve();
+ })
+ })
+
+ })
+ },
+
+ [Actions.CREATE_NEW_BYTOM_ACCOUNT]:({state, commit, dispatch}, currentAccount) => {
+ return new Promise(async (resolve, reject) => {
+ const bytom = Bytom.fromJson(state.bytom);
+ account.setupNet(bytom.settings.network)
+ account.list().then(accounts => {
+ bytom.accountList = accounts;
+ bytom.currentAccount = currentAccount;
+
+ dispatch(Actions.UPDATE_STORED_BYTOM, bytom).then(_bytom => {
+ dispatch(Actions.SET_BYTOM, Bytom.fromJson(_bytom));
+ resolve();
+ })
})
+
})
},
export const IS_UNLOCKED = 'isUnlocked';
export const UPDATE_STORED_BYTOM = 'updateStoredBytom';
export const CREATE_NEW_BYTOM = 'createNewBytom';
+export const CREATE_NEW_BYTOM_ACCOUNT = 'createNewAccount';
export const IMPORT_BYTOM = 'importBytom';
export const SET_AUTO_LOCK = 'setAutoLock';
export const LOCK = 'lock';
accountList:state => state.bytom.accountList,
net:state => state.bytom.settings.network,
language:state => state.bytom.settings.language,
+ login:state => state.bytom.settings.login,
// FOR PROMPTS ONLY
messages:state => state.prompt.data.messages || [],
accountBalance: function () {
let balance
const balances = this.currentAccount.balances
- if(balances.length >0 ){
+ if(balances && balances.length >0 ){
const balanceObject = balances.filter(b => b.asset === BTM)[0]
balance = balanceObject.balance/Math.pow(10,balanceObject.decimals)
}
import modalPasswd from "@/components/modal-passwd";
import getLang from "@/assets/language/sdk";
import { LocalStream } from 'extension-streams';
+import { mapGetters } from 'vuex'
export default {
components: {
password:''
};
},
+ computed: {
+ ...mapGetters([
+ 'language'
+ ])
+ },
methods: {
transfer: function () {
if (this.password == "") {
.catch(error => {
loader.hide();
this.$dialog.show({
- body: getLang(error.message)
+ body: getLang(error.message, this.language)
});
});
}
}
},
calculateBalance: function (balances) {
- if( balances.length>0 ){
+ if(balances && balances.length>0 ){
const balanceObject = balances.filter(b => b.asset === BTM)[0]
const balance = balanceObject.balance/Math.pow(10,balanceObject.decimals)
return balance
<input type="text" v-model="formItem.accAlias">
</div>
</div>
- <div class="form-item">
- <label class="form-item-label">{{ $t('createAccount.keyAlias') }}</label>
- <div class="form-item-content">
- <input type="text" v-model="formItem.keyAlias">
- </div>
- </div>
+
<div class="form-item">
<label class="form-item-label">{{ $t('createAccount.keyPassword') }}</label>
<div class="form-item-content">
<script>
import account from "@/models/account";
+import * as Actions from '@/store/constants';
+import { mapActions, mapState } from 'vuex'
+
export default {
name: "",
components: {},
tips: ""
};
},
+ computed: {
+ ...mapState([
+ 'bytom'
+ ]),
+ },
methods: {
create: function () {
if (this.formItem.accAlias == "") {
});
return;
}
- if (this.formItem.keyAlias == "") {
- this.$dialog.show({
- body: this.$t("createAccount.inputKey")
- });
- return;
- }
+
if (this.formItem.passwd1 == "") {
this.$dialog.show({
body: this.$t("createAccount.inputPass")
onCancel: this.onCancel
});
- account.create(this.formItem.accAlias, this.formItem.keyAlias, this.formItem.passwd1).then(res => {
+ account.create(this.formItem.accAlias, null, this.formItem.passwd1).then(account => {
+ this[Actions.CREATE_NEW_BYTOM_ACCOUNT](account).then(()=>{
loader.hide();
- console.log("bytom.Account.create", res);
- this.$router.push({ name: "home", params: { selectedAccount: res } });
+ this.$router.push('/');
+ })
+
}).catch(err => {
console.log(err);
loader.hide();
body: err.message
});
});
- }
+ },
+ ...mapActions([
+ Actions.CREATE_NEW_BYTOM_ACCOUNT,
+ ])
},
mounted() { }
};
account.setupNet(val.value);
bytom.currentAccount = {}
- account.list().then(accounts => {
- bytom.accountList = accounts;
- if (accounts.length > 0) {
- bytom.currentAccount = accounts[0];
- }
+ account.list()
+ .then(accounts => {
- this[Actions.UPDATE_STORED_BYTOM](bytom)
- }).catch(errors=>{
+ bytom.accountList = accounts;
+ if (accounts.length > 0) {
+ bytom.currentAccount = accounts[0];
+ }
+
+ this[Actions.UPDATE_STORED_BYTOM](bytom)
+ })
+ .catch((errors) =>{
bytom.accountList =[]
this[Actions.UPDATE_STORED_BYTOM](bytom)
})
<tr>
<td colspan="2"><div class="divider"></div></td>
</tr>
- <tr :key="index" v-for="(input, index) in transaction.inputs">
+ <tr :key="'input'+index" v-for="(input, index) in transaction.inputs">
<td class="label">{{ $t('transactionDetail.sendAddress') }}{{transaction.inputs.length > 1 ? index+1 : ''}}</td>
<td class="value">{{input.address}}<span v-if="input.address == selfAddress"> {{ $t('transactionDetail.myAddress') }}</span></td>
</tr>
- <tr :key="index" v-for="(output, index) in transaction.outputs">
+ <tr :key="'output'+ index" v-for="(output, index) in transaction.outputs">
<td class="label">{{ $t('transactionDetail.receiveAddress') }}{{transaction.outputs.length > 1 ? index+1 : ''}}</td>
<td class="value">{{output.address}}<span v-if="output.address == selfAddress"> {{ $t('transactionDetail.myAddress') }}</span></td>
</tr>
/*}*/
.v-select{
- height: 28px;
- width: 160px;
- background: white;
- border-radius: 15px;
+ height: 32px;
+ width: 100%;
+ background: rgba(247,247,247,1);
font-size: 14px;
margin: auto;
- padding-left: 20px;
+ border-bottom: 1px solid #E0E0E0;
+ /*padding-left: 20px;*/
}
.tabs{
<div class="bg-image">
</div>
<div class="topbar">
- <div v-if="activeTab === 'register'" class="topbar-middle">
- <v-select class="v-select" v-bind:colorBlack="true" :clearable="false" v-model="selected" :options="nets"></v-select>
- </div>
+ <!--<div v-if="activeTab === 'register'" class="topbar-middle">-->
+ <!--<v-select class="v-select" v-bind:colorBlack="true" :clearable="false" v-model="selected" :options="nets"></v-select>-->
+ <!--</div>-->
<a href="http://github.com/bycoinio/Bystore" target="_blank"><i class="iconfont icon-github"></i></a>
</div>
<div class="header">
<div v-if="activeTab === 'register'" >
<div class="form panel">
<div class="form-item">
- <label :class="formItemLabel">{{ $t('createAccount.accountAlias') }}</label>
+ <label :class="formItemLabel">network</label>
<div :class="formItemContent">
- <input type="text" v-model="formItem.accAlias" autofocus>
+ <v-select class="v-select" v-bind:colorBlack="true" :clearable="false" v-model="selected" :options="nets"></v-select>
</div>
</div>
- <div class="form-item">
- <label :class="formItemLabel">{{ $t('createAccount.keyAlias') }}</label>
+ <div class="form-item">
+ <label :class="formItemLabel">{{ $t('createAccount.accountAlias') }}</label>
<div :class="formItemContent">
- <input type="text" v-model="formItem.keyAlias">
+ <input type="text" v-model="formItem.accAlias" autofocus>
</div>
</div>
+ <!--<div class="form-item">-->
+ <!--<label :class="formItemLabel">{{ $t('createAccount.keyAlias') }}</label>-->
+ <!--<div :class="formItemContent">-->
+ <!--<input type="text" v-model="formItem.keyAlias">-->
+ <!--</div>-->
+ <!--</div>-->
<div class="form-item">
<label :class="formItemLabel">{{ $t('createAccount.keyPassword') }}</label>
<div :class="formItemContent">
import { getLanguage } from '@/assets/language'
import getLang from "../../assets/language/sdk";
import { mapActions, mapGetters, mapState } from 'vuex'
+import * as Actions from '@/store/constants';
let mainNet = null;
let testNet = null;
selected: mainNet,
formItem: {
accAlias: "",
- keyAlias: "",
+ // keyAlias: "",
passwd1: "",
passwd2: "",
checked: false
});
return;
}
- if (this.formItem.keyAlias == "") {
- this.$dialog.show({
- body: this.$t("createAccount.inputKey")
- });
- return;
- }
if (this.formItem.passwd1 == "") {
this.$dialog.show({
body: this.$t("createAccount.inputPass")
canCancel: true,
onCancel: this.onCancel
});
- account.create(this.formItem.accAlias, this.formItem.keyAlias, this.formItem.passwd1).then(res => {
- localStorage.login = true;
+ account.create(this.formItem.accAlias, null, this.formItem.passwd1).then(currentAccount => {
+ // localStorage.login = true;
+ this[Actions.CREATE_NEW_BYTOM](this.selected.value).then(() =>{
loader.hide();
this.formItem = {};
this.$router.push('/');
+ });
}).catch(err => {
loader.hide();
this.$dialog.show({
return;
}
account.restore(this.restore.fileTxt).then(res => {
- localStorage.login = true;
- this.$router.push('/');
+ // localStorage.login = true;
+ this[Actions.IMPORT_BYTOM]().then(() =>{
+ this.$router.push('/');
+ });
}).catch(error => {
this.$dialog.show({
- body: getLang(error.message)
+ body: getLang(error.message, this.language)
});
});
- }
+ },
+ ...mapActions([
+ Actions.CREATE_NEW_BYTOM,
+ Actions.IMPORT_BYTOM,
+ ])
},
watch: {
selected: function (value) {
- localStorage.bytomNet = value.value;
account.setupNet(value.value);
}
},
mainNet = { label: this.$t('main.mainNet'), value: "mainnet" };
testNet = { label: this.$t('main.testNet'), value: "testnet" };
soloNet = { label: this.$t('main.soloNet'), value: "solonet" };
- vaporTestnet = { label: this.$t('main.vaporTestnet'), value: "vaporTestnet" };
- this.nets = [mainNet, testNet,vaporTestnet];
+ // vaporTestnet = { label: this.$t('main.vaporTestnet'), value: "vaporTestnet" };
+ this.nets = [mainNet, testNet,soloNet];
if (this.net != undefined) {
if (this.net == "mainnet") {
this.selected = mainNet;
this.selected = testNet;
} else if (this.net == "solonet") {
this.selected = soloNet;
- } else if (this.net == "vaporTestnet") {
- this.selected = vaporTestnet;
}
+
+ // else if (this.net == "vaporTestnet") {
+ // this.selected = vaporTestnet;
+ // }
} else {
this.selected = mainNet;
}