support import

This commit is contained in:
Matias Alejo Garcia 2015-11-04 17:50:05 -03:00
commit 1892d16b92
8 changed files with 63 additions and 36 deletions

View file

@ -17,13 +17,26 @@ angular.module('copayApp.services')
};
root.getAddressPath = function(isMultisig, account) {
var rootPath = isMultisig ? root.MULTISIG_ROOTPATH : root.UNISIG_ROOTPATH;
var rootPath;
if (account) {
rootPath = isMultisig ? root.MULTISIG_ROOTPATH : root.UNISIG_ROOTPATH;
} else {
// Old ledger wallet compat
rootPath = 44;
}
return rootPath + "'/" + root.LIVENET_PATH + "'/" + account + "'";
}
root.getEntropyPath = function(isMultisig, account) {
var rootPath = isMultisig ? root.MULTISIG_ROOTPATH : root.UNISIG_ROOTPATH;
var path = root.ENTROPY_INDEX_PATH + rootPath + "'/" + account + "'";
var path;
if (account) {
var rootPath = isMultisig ? root.MULTISIG_ROOTPATH : root.UNISIG_ROOTPATH;
path = root.ENTROPY_INDEX_PATH + rootPath + "'/" + account + "'";
} else {
// Old ledger wallet compat
path = root.ENTROPY_INDEX_PATH + "0'";
}
return path;
};

View file

@ -5,20 +5,13 @@ angular.module('copayApp.services')
var root = {};
var LEDGER_CHROME_ID = "kkdpmhnladdopljabkgpacgpliggeeaf";
// Ledger magic number to get xPub without user confirmation
root.ENTROPY_INDEX_PATH = "0xb11e/";
root.UNISIG_ROOTPATH = 44;
root.MULTISIG_ROOTPATH = 48;
root.callbacks = {};
root.hasSession = function() {
root._message({
command: "has_session"
});
}
root.getEntropySource = function(isMultisig, account, callback) {
root.getXPubKey(hwWallet.getEntropyPath(isMultisig, account), function(data) {
if (!data.success)

View file

@ -183,6 +183,14 @@ angular.module('copayApp.services')
passphrase: opts.passphrase,
account: opts.account || 0,
});
// </ Nasty
if (opts.fromHardware && opts.n>1) {
walletClient.credentials.derivationStrategy ==
}
// Nasty>
}
} catch (ex) {
$log.info(ex);
return cb(gettext('Could not create: Invalid wallet seed'));
@ -420,7 +428,7 @@ angular.module('copayApp.services')
walletClient.importFromMnemonic(words, {
network: opts.networkName,
passphrase: opts.passphrase,
account: opts.account,
account: opts.account || 0,
}, function(err) {
if (err)
return bwsError.cb(err, gettext('Could not import'), cb);