Skip to content
This repository has been archived by the owner on Jan 5, 2021. It is now read-only.

Add dpath var for easy migration #283

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion interface/elements/msc-introduction/msc-introduction.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ var platform = os.platform();
var ethers = require('ethers');
var zxcvbn = require('zxcvbn');
var request = require("request");
var dpath = "m/44'/60'/0'/0/0"; // defined according to SLIP-044

if (process.env.APPDATA != undefined && process.env.APPDATA.includes("Settings")) { //hack for XP
var introduction = process.env.APPDATA.slice(0, -17) + '\\AppData\\Roaming\\Musicoin\\introduction.intro';
Expand Down Expand Up @@ -148,7 +149,7 @@ Polymer({
// It's important to show Notification before mnemonic generation, otherwise we would see alert first
new Notification(document.querySelector("msc-introduction").echo('profileJS_createNewMnemonicAccount_Notification'), mnemonicNotification);
var mnemonic = ethers.HDNode.entropyToMnemonic(ethers.utils.randomBytes(16));
var wallet = new ethers.Wallet.fromMnemonic(mnemonic);
var wallet = new ethers.Wallet.fromMnemonic(mnemonic, dpath);
wallet.encrypt(password1, {
scrypt: {
N: 262144
Expand Down
7 changes: 5 additions & 2 deletions interface/elements/msc-profile-view/msc-profile-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ var ethers = require('ethers');
var zxcvbn = require('zxcvbn');
var QRCode = require('qrcode');
var jsQR = require("jsqr");
var dpath = "m/44'/60'/0'/0/0"; // defined according to SLIP-044

Polymer({
is: 'msc-profile-view',
Expand Down Expand Up @@ -844,7 +845,8 @@ Polymer({
var password = document.getElementById('mnemonicPassword').value;
var mnemonic = (document.getElementById('mnemonic').value).toLowerCase();
if (password.length > 0 && password.length < 65 && zxcvbn(password).score >= 2) {
var wallet = new ethers.Wallet.fromMnemonic(mnemonic);
var wallet = new ethers.Wallet.fromMnemonic(mnemonic, dpath);
// from Musicoin Wallet v1.5, all wallets will follow SLIP-044
wallet.encrypt(password, {
scrypt: {
N: 262144
Expand Down Expand Up @@ -907,7 +909,7 @@ Polymer({
// It's important to show Notification before mnemonic generation, otherwise we would see alert first
new Notification(document.querySelector("msc-profile-view").echo('profileJS_createNewMnemonicAccount_Notification'), mnemonicNotification);
var mnemonic = ethers.HDNode.entropyToMnemonic(ethers.utils.randomBytes(16));
var wallet = new ethers.Wallet.fromMnemonic(mnemonic);
var wallet = new ethers.Wallet.fromMnemonic(mnemonic, dpath);
wallet.encrypt(password1, {
scrypt: {
N: 262144
Expand Down Expand Up @@ -980,6 +982,7 @@ Polymer({
ethers.Wallet.fromEncryptedWallet(accountFile, password).then(function(wallet) {
if (wallet.address = account) fs.unlinkSync((String(pathOfAccount)));
}).catch(function(err) {
console.log("Expected bug");
alert(err);
});
document.getElementById('sourceAccountRemove').value = "";
Expand Down