mirror of https://github.com/BTCPrivate/copay.git
support import
This commit is contained in:
parent
de8551812b
commit
1892d16b92
|
@ -160,7 +160,22 @@
|
|||
</label>
|
||||
</div>
|
||||
|
||||
<div ng-show="create.seedSourceId == 'set' || create.seedSourceId == 'new'">
|
||||
<div ng-show="create.seedSourceId == 'set'">
|
||||
<label class="oh"><span translate>Account</span>
|
||||
<select class="m10t" ng-model="accountForSeed" ng-options="externalIndex as externalIndex for externalIndex in create.accountValuesForSeed">
|
||||
</select>
|
||||
</label>
|
||||
<div class="oh text-gray line-b size-12 p10b m20b"><span translate>Multiple accounts can be derived from the same seed. Specify which account to use</div>
|
||||
</div>
|
||||
|
||||
<div class="oh" ng-show="create.seedSourceId == 'set' && privateKey.split(' ').length>20 && totalCopayers != 1">
|
||||
<label for="fromHardware">
|
||||
<span translate>Hardware Wallet?</span>
|
||||
<switch id="fromHardware" name="fromHardware" ng-model="fromHardware" class="green right m5t m10b"></switch>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="oh" ng-show="(create.seedSourceId == 'set' || create.seedSourceId == 'new') && ! fromHardware">
|
||||
<label for="network-name" >
|
||||
<span translate>Testnet</span>
|
||||
<switch id="network-name" name="isTestnet" ng-model="isTestnet" class="green right m5t m10b"></switch>
|
||||
|
|
|
@ -76,6 +76,14 @@
|
|||
<switch id="network-name" name="isTestnet" ng-model="isTestnet" class="green right m5t m10b"></switch>
|
||||
</label>
|
||||
|
||||
<div>
|
||||
<label class="oh"><span translate>BIP44 Account</span>
|
||||
<select class="m10t" ng-model="accountForSeed" ng-options="externalIndex as externalIndex for externalIndex in import.accountValuesForSeed">
|
||||
</select>
|
||||
</label>
|
||||
<div class="oh text-gray line-b size-12 p10b m20b"><span translate>Multiple accounts can be derived from the same seed. Specify which account to import</div>
|
||||
</div>
|
||||
|
||||
<label for="passphrase" class="oh"><span translate>Passphrase</span> <small translate>Wallet Seed could require a passphrase to be imported</small>
|
||||
<div class="input">
|
||||
<input type="password" class="form-control" placeholder="{{'Seed passphrase'|translate}}"
|
||||
|
|
|
@ -25,6 +25,8 @@ angular.module('copayApp.controllers').controller('createController',
|
|||
|
||||
var defaults = configService.getDefaults();
|
||||
$scope.bwsurl = defaults.bws.url;
|
||||
self.accountValuesForSeed = lodash.range(0, 100);
|
||||
$scope.accountForSeed = 0;
|
||||
|
||||
// ng-repeat defined number of times instead of repeating over array?
|
||||
this.getNumber = function(num) {
|
||||
|
@ -48,8 +50,7 @@ angular.module('copayApp.controllers').controller('createController',
|
|||
label: gettext('Specify Seed...'),
|
||||
}];
|
||||
$scope.seedSource = self.seedOptions[0];
|
||||
// TODO
|
||||
// if (!isChromeApp) return;
|
||||
if (!isChromeApp) return;
|
||||
|
||||
if (n > 1)
|
||||
self.seedOptions.push({
|
||||
|
@ -76,11 +77,7 @@ angular.module('copayApp.controllers').controller('createController',
|
|||
|
||||
this.setSeedSource = function(src) {
|
||||
self.seedSourceId = $scope.seedSource.id;
|
||||
|
||||
if (self.seedSourceId == 'ledger')
|
||||
self.accountValues = lodash.range(0, 99);
|
||||
else
|
||||
self.accountValues = lodash.range(1, 100);
|
||||
self.accountValues = lodash.range(1, 100);
|
||||
|
||||
$timeout(function() {
|
||||
$rootScope.$apply();
|
||||
|
@ -98,7 +95,9 @@ angular.module('copayApp.controllers').controller('createController',
|
|||
name: form.walletName.$modelValue,
|
||||
myName: $scope.totalCopayers > 1 ? form.myName.$modelValue : null,
|
||||
networkName: form.isTestnet.$modelValue ? 'testnet' : 'livenet',
|
||||
bwsurl: $scope.bwsurl
|
||||
bwsurl: $scope.bwsurl,
|
||||
account: $scope.accountForSeed || 0,
|
||||
use48: $scope.fromHardware,
|
||||
};
|
||||
var setSeed = self.seedSourceId =='set';
|
||||
if (setSeed) {
|
||||
|
@ -118,7 +117,6 @@ angular.module('copayApp.controllers').controller('createController',
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
if (self.seedSourceId == 'ledger' || self.seedSourceId == 'trezor') {
|
||||
var account = $scope.account;
|
||||
if (!account) {
|
||||
|
|
|
@ -7,6 +7,8 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
var reader = new FileReader();
|
||||
var defaults = configService.getDefaults();
|
||||
$scope.bwsurl = defaults.bws.url;
|
||||
$scope.accountForSeed = 0;
|
||||
self.accountValuesForSeed = lodash.range(0, 100);
|
||||
|
||||
window.ignoreMobilePause = true;
|
||||
$scope.$on('$destroy', function() {
|
||||
|
@ -17,8 +19,7 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
|
||||
var updateSeedSourceSelect = function() {
|
||||
self.seedOptions = [];
|
||||
// TODO
|
||||
// if (!isChromeApp) return;
|
||||
if (!isChromeApp) return;
|
||||
|
||||
self.seedOptions.push({
|
||||
id: 'ledger',
|
||||
|
@ -193,6 +194,7 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
|
||||
opts.passphrase = form.passphrase.$modelValue || null;
|
||||
opts.networkName = form.isTestnet.$modelValue ? 'testnet' : 'livenet';
|
||||
opts.account = $scope.accountForSeed;
|
||||
|
||||
_importMnemonic(words, opts);
|
||||
};
|
||||
|
@ -256,11 +258,7 @@ angular.module('copayApp.controllers').controller('importController',
|
|||
this.setSeedSource = function() {
|
||||
if (!$scope.seedSource) return;
|
||||
self.seedSourceId = $scope.seedSource.id;
|
||||
|
||||
if (self.seedSourceId == 'ledger')
|
||||
self.accountValues = lodash.range(0, 99);
|
||||
else
|
||||
self.accountValues = lodash.range(1, 100);
|
||||
self.accountValues = lodash.range(1, 100);
|
||||
|
||||
$timeout(function() {
|
||||
$rootScope.$apply();
|
||||
|
|
|
@ -23,9 +23,7 @@ angular.module('copayApp.controllers').controller('joinController',
|
|||
label: gettext('Specify Seed...'),
|
||||
}];
|
||||
$scope.seedSource = self.seedOptions[0];
|
||||
|
||||
// TODO
|
||||
// if (!isChromeApp) return;
|
||||
if (!isChromeApp) return;
|
||||
|
||||
self.seedOptions.push({
|
||||
id: 'ledger',
|
||||
|
@ -40,11 +38,7 @@ angular.module('copayApp.controllers').controller('joinController',
|
|||
|
||||
this.setSeedSource = function(src) {
|
||||
self.seedSourceId = $scope.seedSource.id;
|
||||
|
||||
if (self.seedSourceId == 'ledger')
|
||||
self.accountValues = lodash.range(0, 99);
|
||||
else
|
||||
self.accountValues = lodash.range(1, 100);
|
||||
self.accountValues = lodash.range(1, 100);
|
||||
|
||||
$timeout(function() {
|
||||
$rootScope.$apply();
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue