mirror of
https://github.com/jwinterm/Wownero-Light-Wallet.git
synced 2026-12-01 11:54:01 +01:00
So much wallets
This commit is contained in:
+3
-2
@@ -31,7 +31,7 @@ export class Config {
|
||||
{"address": "node.wownero.com:34568", "location": "Montreal, Canada", "region": "US"},
|
||||
{"address": "localhost:34568", 'location': "", "region": "*"}
|
||||
],
|
||||
"wallet_path": ""
|
||||
"wallets": []
|
||||
});
|
||||
|
||||
fs.writeFileSync(this._path_cfg, JSON.stringify(data));
|
||||
@@ -69,7 +69,8 @@ export class Config {
|
||||
return;
|
||||
}
|
||||
|
||||
this.data.wallet_path = path;
|
||||
const name = path.split('/').pop();
|
||||
this.data.wallets.push({ name, path });
|
||||
this.save();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
</button>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
||||
<a v-on:click="openWallet" class="dropdown-item" href="#">Browse</a>
|
||||
<a v-on:click="openLastWallet" v-if="cfg_wallet_path !== ''" class="dropdown-item" href="#">{{cfg_wallet_path_name}}</a>
|
||||
<a v-on:click="openLastWallet" v-for="item in cfg_wallet_names" class="dropdown-item" href="#">{{item}}</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -118,13 +118,9 @@
|
||||
}
|
||||
});
|
||||
},
|
||||
openLastWallet(){
|
||||
if(!this.cfg_wallet_path || this.cfg_wallet_path === ''){
|
||||
alert('Invalid wallet path?!');
|
||||
return;
|
||||
}
|
||||
|
||||
this.$store.commit('addWalletPath', this.cfg_wallet_path);
|
||||
openLastWallet(event){
|
||||
const selectedWallet = this.cfg_wallets.find(i => i.name === event.currentTarget.text);
|
||||
this.$store.commit('addWalletPath', selectedWallet.path);
|
||||
this.$store.commit('showPassword', {
|
||||
'message': 'Enter wallet password'
|
||||
});
|
||||
@@ -192,12 +188,11 @@
|
||||
selected_node(){
|
||||
return this.$store.getters.cfg.node;
|
||||
},
|
||||
cfg_wallet_path(){
|
||||
return this.$store.getters.cfg.wallet_path;
|
||||
cfg_wallets(){
|
||||
return this.$store.getters.cfg.wallets;
|
||||
},
|
||||
cfg_wallet_path_name(){
|
||||
let path = require("path");
|
||||
return path.basename(this.cfg_wallet_path);
|
||||
cfg_wallet_names(){
|
||||
return this.$store.getters.cfg.wallets.map(i => i.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,12 +67,20 @@
|
||||
this.create_wallet(wallet_name, wallet_pass);
|
||||
}
|
||||
},
|
||||
wallet_exists (name) {
|
||||
return !!this.wallets.find(i => i.name === name);
|
||||
},
|
||||
create_wallet (name, password) {
|
||||
this.clearMatrixMsg();
|
||||
this.showMatrixMsg('GENERATING NEW WALLET')
|
||||
if (this.wallet_exists(name)) {
|
||||
console.log('Wallet exists!')
|
||||
// @TODO check if wallet with same name exists no matter the path
|
||||
} else {
|
||||
this.clearMatrixMsg();
|
||||
this.showMatrixMsg('GENERATING NEW WALLET');
|
||||
|
||||
this.$store.commit('appState', "create_wallet");
|
||||
ipcRenderer.send('rpc_create_wallet', {name: name, password: password})
|
||||
this.$store.commit('appState', "create_wallet");
|
||||
ipcRenderer.send('rpc_create_wallet', {name: name, password: password})
|
||||
}
|
||||
},
|
||||
showMatrixMsg(msg){
|
||||
let obj = jQuery('.teh_matrix span.centered');
|
||||
@@ -179,6 +187,9 @@
|
||||
},
|
||||
walletCreating(){
|
||||
return this.$store.state.wallet_creating;
|
||||
},
|
||||
wallets() {
|
||||
return this.$store.getters.cfg.wallets;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ export default new Vuex.Store({
|
||||
cfg: {
|
||||
"node": "",
|
||||
"nodes": [],
|
||||
"wallet_path": ""
|
||||
"wallets": []
|
||||
},
|
||||
created_wallet: {}, // only used when creating wallets
|
||||
appState: "", // not really used
|
||||
@@ -69,6 +69,10 @@ export default new Vuex.Store({
|
||||
if(data.hasOwnProperty('wallet_path')){
|
||||
cfg.wallet_path = data.wallet_path;
|
||||
}
|
||||
|
||||
if(data.hasOwnProperty('wallets')){
|
||||
cfg.wallets = data.wallets;
|
||||
}
|
||||
},
|
||||
appState(state, data){
|
||||
state.appState = data;
|
||||
|
||||
Reference in New Issue
Block a user