import now working with ledger

Signed-off-by: Matias Alejo Garcia <ematiu@gmail.com>
This commit is contained in:
Matias Alejo Garcia 2015-09-04 21:18:20 -03:00
commit 4d9a477ae5
10 changed files with 148 additions and 47 deletions

View file

@ -25,7 +25,7 @@ angular.module('copayApp.services')
body = gettextCatalog.getString('Copayer already in this wallet');
break;
case 'COPAYER_REGISTERED':
body = gettextCatalog.getString('Copayer already registered');
body = gettextCatalog.getString('Wallet already registered');
break;
case 'COPAYER_VOTED':
body = gettextCatalog.getString('Copayer already voted on this spend proposal');

View file

@ -179,8 +179,9 @@ angular.module('copayApp.services')
}
} else if (opts.extendedPublicKey) {
try {
walletClient.seedFromExternalWalletPublicKey(opts.extendedPublicKey, opts.externalSource, opts.externalIndex, opts.entropySource);
walletClient.seedFromExtendedPublicKey(opts.extendedPublicKey, opts.externalSource, opts.externalIndex, opts.entropySource);
} catch (ex) {
$log.warn(ex);
return cb(gettext('Could not create using the specified extended public key'));
}
} else {
@ -191,7 +192,7 @@ angular.module('copayApp.services')
$log.info('Error creating seed: ' + e.message);
if (e.message.indexOf('language') > 0) {
$log.info('Using default language for mnemonic');
walletClient.seedFromRandomWithMnemonic(network, opts.passphrase);
walletClient.seedFromRandomWithMnemonic(network, opts.passphrase);
} else {
return cb(e);
}
@ -358,6 +359,26 @@ angular.module('copayApp.services')
});
};
root.importExtendedPublicKey = function(opts, cb) {
var walletClient = bwcService.getClient();
$log.debug('Importing Wallet XPubKey');
walletClient.importFromExtendedPublicKey(opts.extendedPublicKey, opts.externalSource, opts.externalIndex, opts.entropySource, function(err) {
if (err) {
// in HW wallets, req key is always the same. They can't addAccess.
if (err.code == 'NOT_AUTHORIZED')
err.code = 'WALLET_DOES_NOT_EXIST';
return bwsError.cb(err, gettext('Could not import'), cb);
}
root._addWalletClient(walletClient, cb);
});
};
root.create = function(opts, cb) {
$log.info('Creating profile');
configService.get(function(err) {