diff --git a/src-electron/main-process/modules/wallet-rpc.js b/src-electron/main-process/modules/wallet-rpc.js
index 96ff33f..3bcca14 100644
--- a/src-electron/main-process/modules/wallet-rpc.js
+++ b/src-electron/main-process/modules/wallet-rpc.js
@@ -272,7 +272,12 @@ export class WalletRPC {
break;
case "create_wallet":
- this.createWallet(params.name, params.password, params.language);
+ this.createWallet(
+ params.name,
+ params.password,
+ params.language,
+ params.hardware_wallet
+ );
break;
case "restore_wallet":
@@ -509,13 +514,20 @@ export class WalletRPC {
});
}
- createWallet(filename, password, language) {
+ isHardwareWallet(filename) {
+ let hwfile = path.join(this.wallet_dir, filename + ".hwdev.txt");
+ return fs.existsSync(hwfile);
+ }
+
+ createWallet(filename, password, language, hardware_wallet) {
// Reset the status error
this.sendGateway("reset_wallet_error");
this.sendRPC("create_wallet", {
filename,
password,
- language
+ language,
+ hardware_wallet: !!hardware_wallet,
+ device_label: hardware_wallet ? "hardware_wallet" : undefined
}).then(data => {
if (data.hasOwnProperty("error")) {
this.sendGateway("set_wallet_error", { status: data.error });
@@ -702,6 +714,14 @@ export class WalletRPC {
errorOnExist: true
});
}
+
+ if (fs.existsSync(import_path + ".hwdev.txt")) {
+ fs.copySync(
+ import_path + ".hwdev.txt",
+ destination + ".hwdev.txt",
+ fs.constants.COPYFILE_EXCL
+ );
+ }
} catch (e) {
this.sendGateway("set_wallet_error", {
status: {
@@ -794,6 +814,10 @@ export class WalletRPC {
}
}
+ if (this.isHardwareWallet(filename)) {
+ wallet.info.hardware_wallet = true;
+ }
+
this.saveWallet().then(() => {
let address_txt_path = path.join(
this.wallet_dir,
@@ -810,7 +834,11 @@ export class WalletRPC {
this.sendGateway("set_wallet_data", wallet);
- this.startHeartbeat();
+ if (this.isHardwareWallet(filename)) {
+ this.startHeartbeat(10);
+ } else {
+ this.startHeartbeat();
+ }
});
}
@@ -840,6 +868,12 @@ export class WalletRPC {
});
}
+ const hardware_wallet_file = path.join(
+ this.wallet_dir,
+ filename + ".hwdev.txt"
+ );
+ const hardware_wallet = fs.existsSync(hardware_wallet_file);
+
// store hash of the password so we can check against it later when requesting private keys, or for sending txs
this.wallet_state.password_hash = crypto
.pbkdf2Sync(password, this.auth[2], 1000, 64, "sha512")
@@ -847,10 +881,20 @@ export class WalletRPC {
this.wallet_state.name = filename;
this.wallet_state.open = true;
- this.startHeartbeat();
+ if (hardware_wallet) {
+ this.startHeartbeat(10);
+ } else {
+ this.startHeartbeat();
+ }
this.purchasedNames = {};
+ this.sendGateway("set_wallet_data", {
+ info: {
+ hardware_wallet
+ }
+ });
+
// Check if we have a view only wallet by querying the spend key
this.sendRPC("query_key", { key_type: "spend_key" }).then(data => {
if (data.hasOwnProperty("error") || !data.hasOwnProperty("result")) {
@@ -867,17 +911,17 @@ export class WalletRPC {
});
}
- startHeartbeat() {
+ startHeartbeat(multiplier = 1) {
clearInterval(this.heartbeat);
this.heartbeat = setInterval(() => {
this.heartbeatAction();
- }, 5000);
+ }, 5000 * multiplier);
this.heartbeatAction(true);
clearInterval(this.onsHeartbeat);
this.onsHeartbeat = setInterval(() => {
this.updateLocalONSRecords();
- }, 30 * 1000); // Every 30 seconds
+ }, 30 * 1000 * multiplier); // Every 30 seconds
this.updateLocalONSRecords();
}
@@ -1701,6 +1745,9 @@ export class WalletRPC {
// send address and tx fees before sending
// isSweepAll refers to if it's the sweep from service nodes page
transfer(password, amount, address, priority, isSweepAll) {
+ console.log(
+ "TODO sean remove this - wallet: " + JSON.stringify(this.wallet)
+ );
const cryptoCallback = (err, password_hash) => {
if (err) {
this.sendGateway("set_tx_status", {
@@ -2682,7 +2729,7 @@ export class WalletRPC {
return;
}
- // Exclude all files without a keys extension
+ // Exclude all files without keys
if (path.extname(filename) !== ".keys") return;
const wallet_name = path.parse(filename).name;
@@ -2691,7 +2738,8 @@ export class WalletRPC {
let wallet_data = {
name: wallet_name,
address: null,
- password_protected: null
+ password_protected: null,
+ hardware_wallet: false
};
if (
@@ -2720,6 +2768,12 @@ export class WalletRPC {
}
}
+ if (
+ fs.existsSync(path.join(this.wallet_dir, wallet_name + ".hwdev.txt"))
+ ) {
+ wallet_data.hardware_wallet = true;
+ }
+
wallets.list.push(wallet_data);
} catch (e) {
// Something went wrong
diff --git a/src/components/wallet_list_item.vue b/src/components/wallet_list_item.vue
new file mode 100644
index 0000000..d2feb66
--- /dev/null
+++ b/src/components/wallet_list_item.vue
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+
+
+ {{ wallet.name }}
+ {{
+ wallet.address
+ }}
+
+
+
+
+
+
+
+
diff --git a/src/i18n/en-us.js b/src/i18n/en-us.js
index 8a509d9..6ab1210 100644
--- a/src/i18n/en-us.js
+++ b/src/i18n/en-us.js
@@ -516,6 +516,8 @@ export default {
"Purchase or update an ONS record. If you purchase a name, it may take a minute or two for it to show up in the list.",
onsDescription:
"Here you can find all the ONS names owned by this wallet. Decrypting a record you own will return the name and value of that ONS record.",
+ hardwareWallet: "Hardware wallet",
+ hardwareWallets: "Hardware wallets",
loadingSettings: "Loading settings",
oxenBalance: "Balance",
lokinetNameDescription:
@@ -545,6 +547,7 @@ export default {
recentIncomingTransactionsToAddress:
"Recent incoming transactions to this address",
recentTransactionsWithAddress: "Recent transactions with this address",
+ regularWallets: "Regular wallets",
rescanModalDescription:
"Select full rescan or rescan of spent outputs only.",
saveSeedWarning: "Please copy and save these in a secure location!",
diff --git a/src/pages/wallet-select/create.vue b/src/pages/wallet-select/create.vue
index 3b3dc21..276babc 100644
--- a/src/pages/wallet-select/create.vue
+++ b/src/pages/wallet-select/create.vue
@@ -50,12 +50,32 @@
/>
-
+
+
+
+
+
+
+
+
+
+
+
@@ -88,7 +108,8 @@ export default {
name: "",
language: languageOptions[0].value,
password: "",
- password_confirm: ""
+ password_confirm: "",
+ hardware_wallet: false
},
languageOptions
};
diff --git a/src/pages/wallet-select/index.vue b/src/pages/wallet-select/index.vue
index 32d7efd..b4890f0 100644
--- a/src/pages/wallet-select/index.vue
+++ b/src/pages/wallet-select/index.vue
@@ -1,7 +1,7 @@
-
-
+
+