complete scope data for create wallets
This commit is contained in:
parent
25990e23fe
commit
6ba7b7c655
5 changed files with 110 additions and 187 deletions
|
|
@ -6,12 +6,12 @@
|
|||
</ion-nav-back-button>
|
||||
</ion-nav-bar>
|
||||
|
||||
<ion-content ng-controller="createController" ng-init="personal = true">
|
||||
<ion-content ng-controller="createController" ng-init="personal = true; init()">
|
||||
<div class="row text-center">
|
||||
<div class="col" ng-click="personal = true" ng-style="personal && {'border-bottom': '2px solid'}">
|
||||
<div class="col" ng-click="personal = true; setTotalCopayers(1)" ng-style="personal && {'border-bottom': '2px solid'}">
|
||||
<span class="" translate>Personal Wallet</span>
|
||||
</div>
|
||||
<div class="col" ng-click="personal = false" ng-style="!personal && {'border-bottom': '2px solid'}">
|
||||
<div class="col" ng-click="personal = false; setTotalCopayers(3)" ng-style="!personal && {'border-bottom': '2px solid'}">
|
||||
<span class="" translate>Shared Wallet</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,14 +1,13 @@
|
|||
<form name="setupForm" ng-submit="create.create(setupForm)" novalidate>
|
||||
|
||||
<form name="setupForm" ng-submit="create(setupForm)" novalidate>
|
||||
<div class="card list">
|
||||
<label class="item item-input item-stacked-label">
|
||||
<span class="input-label" translate>Wallet name</span>
|
||||
<input type="text"
|
||||
placeholder="{{'Family vacation funds'|translate}}"
|
||||
ng-model="walletName"
|
||||
ng-model="formData.walletName"
|
||||
ng-required="true"
|
||||
ng-focus="create.formFocus('wallet-name')"
|
||||
ng-blur="create.formFocus(false)">
|
||||
ng-focus="formFocus('wallet-name')"
|
||||
ng-blur="formFocus(false)">
|
||||
</label>
|
||||
|
||||
<ion-toggle ng-model="showAdv" toggle-class="toggle-stable" ng-change="showAdvChange()">
|
||||
|
|
@ -19,74 +18,63 @@
|
|||
<div ng-show="showAdv">
|
||||
<label class="item item-input item-stacked-label">
|
||||
<span class="input-label">Wallet Service URL</span>
|
||||
<input type="text" ng-model="bwsurl" placeholder="https://bws.bitpay.com/bws/api">
|
||||
<input type="text" ng-model="formData.bwsurl" placeholder="https://bws.bitpay.com/bws/api">
|
||||
</label>
|
||||
|
||||
<label class="item item-input item-select">
|
||||
<div class="input-label" translate>
|
||||
Wallet Key
|
||||
</div>
|
||||
<select class="m10t"
|
||||
ng-model="seedSource"
|
||||
ng-options="seed as seed.label for seed in create.seedOptions"
|
||||
ng-change="create.setSeedSource()">
|
||||
</select>
|
||||
<select class="m10t" ng-model="seedSource" ng-options="seed as seed.label for seed in seedOptions"></select>
|
||||
</label>
|
||||
|
||||
<label class="item item-input item-stacked-label" ng-show="create.seedSourceId == 'trezor' || create.seedSourceId == 'ledger'">
|
||||
<label class="item item-input item-stacked-label" ng-show="seedSource.id == 'trezor' || seedSource.id == 'ledger'">
|
||||
<span class="input-label" translate>Account Number</span>
|
||||
<input type="number" id="account" ng-model="account" ignore-mouse-wheel>
|
||||
<input type="number" ng-model="formData.account" ignore-mouse-wheel>
|
||||
</label>
|
||||
|
||||
<div class="card" ng-show="create.seedSourceId=='new' && createPassphrase">
|
||||
<div class="card" ng-show="seedSource.id == 'new' && createPassphrase">
|
||||
<div class="item item-text-wrap" translate>
|
||||
WARNING: The password cannot be recovered. <b>Be sure to write it down</b>. The wallet can not be restored without the password.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label class="item item-input item-stacked-label" ng-show="create.seedSourceId=='new'">
|
||||
<label class="item item-input item-stacked-label" ng-show="seedSource.id == 'new'">
|
||||
<span class="input-label" translate>Add a Password</span>
|
||||
<input type="text"
|
||||
placeholder="{{'Add an optional password to secure the recovery phrase'|translate}}"
|
||||
autocapitalize="off"
|
||||
name="createPassphrase"
|
||||
ng-model="createPassphrase">
|
||||
ng-model="formData.createPassphrase">
|
||||
</label>
|
||||
|
||||
|
||||
<label class="item item-input item-stacked-label" ng-show="create.seedSourceId=='set'">
|
||||
<label class="item item-input item-stacked-label" ng-show="seedSource.id == 'set'">
|
||||
<span class="input-label" translate>Wallet Recovery Phrase</span>
|
||||
<input id="ext-master"
|
||||
placeholder="{{'Enter the recovery phrase (BIP39)'|translate}}"
|
||||
<input placeholder="{{'Enter the recovery phrase (BIP39)'|translate}}"
|
||||
autocapitalize="off"
|
||||
type="text"
|
||||
name="privateKey"
|
||||
ng-model="privateKey">
|
||||
ng-model="formData.privateKey">
|
||||
</label>
|
||||
|
||||
<label class="item item-input item-stacked-label" ng-show="create.seedSourceId=='set'">
|
||||
<label class="item item-input item-stacked-label" ng-show="seedSource.id == 'set'">
|
||||
<span class="input-label" translate>Password</span>
|
||||
<input type="text"
|
||||
placeholder="{{'The recovery phrase could require a password to be imported'|translate}}"
|
||||
autocapitalize="off"
|
||||
name="passphrase"
|
||||
ng-model="passphrase">
|
||||
ng-model="formData.passphrase">
|
||||
</label>
|
||||
|
||||
<label class="item item-input item-stacked-label" ng-show="create.seedSourceId == 'set'">
|
||||
<label class="item item-input item-stacked-label" ng-show="seedSource.id == 'set'">
|
||||
<span class="input-label" translate>Derivation Path</span>
|
||||
<input type="text"
|
||||
placeholder="{{'BIP32 path for address derivation'|translate}}"
|
||||
name="derivationPath"
|
||||
ng-model="derivationPath">
|
||||
ng-model="formData.derivationPath">
|
||||
</label>
|
||||
|
||||
<!-- <ion-toggle ng-show="create.seedSourceId == 'new'" ng-model="testnetEnabled" toggle-class="toggle-positive"> -->
|
||||
<ion-toggle ng-model="testnetEnabled" toggle-class="toggle-positive">
|
||||
Testnet
|
||||
<ion-toggle ng-show="seedSource.id == 'new'" ng-model="formData.testnetEnabled" toggle-class="toggle-positive">
|
||||
<span translate>Testnet</span>
|
||||
</ion-toggle>
|
||||
|
||||
<ion-toggle ng-model="singleAddressEnabled" toggle-class="toggle-positive">
|
||||
<ion-toggle ng-model="formData.singleAddressEnabled" toggle-class="toggle-positive">
|
||||
<span translate>Single Address Wallet</span>
|
||||
<small translate>For audit purposes</small>
|
||||
</ion-toggle>
|
||||
|
|
@ -94,16 +82,7 @@
|
|||
</div> <!-- advanced -->
|
||||
</div> <!-- list -->
|
||||
|
||||
<button type="submit"
|
||||
class="button button-block button-positive"
|
||||
ng-show="totalCopayers != 1" ng-disabled="setupForm.$invalid">
|
||||
<span translate>Create {{requiredCopayers}}-of-{{totalCopayers}} wallet</span>
|
||||
</button>
|
||||
|
||||
<button type="submit"
|
||||
class="button button-block button-positive"
|
||||
ng-show="totalCopayers == 1" ng-disabled="setupForm.$invalid">
|
||||
<button type="submit" class="button button-block button-positive" ng-disabled="setupForm.$invalid">
|
||||
<span translate>Create new wallet</span>
|
||||
</button>
|
||||
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -1,48 +1,42 @@
|
|||
<form name="setupForm" ng-submit="create.create(setupForm)" novalidate>
|
||||
|
||||
<form name="setupForm" ng-submit="create(setupForm)" novalidate>
|
||||
<div class="card list">
|
||||
<label ng-hide="create.hideWalletName" class="item item-input item-stacked-label">
|
||||
<label class="item item-input item-stacked-label">
|
||||
<span class="input-label" translate>Wallet name</span>
|
||||
<input type="text"
|
||||
placeholder="{{'Family vacation funds'|translate}}"
|
||||
name="walletName"
|
||||
ng-model="walletName"
|
||||
ng-model="formData.walletName"
|
||||
ng-required="true"
|
||||
ng-focus="create.formFocus('wallet-name')"
|
||||
ng-blur="create.formFocus(false)">
|
||||
ng-focus="formFocus('wallet-name')"
|
||||
ng-blur="formFocus(false)">
|
||||
</label>
|
||||
|
||||
<label ng-show="totalCopayers != 1" class="item item-input item-stacked-label">
|
||||
<label class="item item-input item-stacked-label">
|
||||
<span class="input-label" translate>Your nickname</span>
|
||||
<input type="text"
|
||||
placeholder="{{'John'|translate}}"
|
||||
name="myName"
|
||||
ng-model="myName"
|
||||
ng-required="totalCopayers != 1"
|
||||
ng-disabled="totalCopayers == 1"
|
||||
ng-focus="create.formFocus('my-name')"
|
||||
ng-blur="create.formFocus(false)">
|
||||
ng-model="formData.myName"
|
||||
ng-required="formData.totalCopayers != 1"
|
||||
ng-disabled="formData.totalCopayers == 1"
|
||||
ng-focus="formFocus('my-name')"
|
||||
ng-blur="formFocus(false)">
|
||||
</label>
|
||||
|
||||
<label ng-show="totalCopayers != 1" class="item item-input item-select">
|
||||
<label class="item item-input item-select">
|
||||
<div class="input-label" translate>
|
||||
Total number of copayers
|
||||
</div>
|
||||
<select class="m10t"
|
||||
ng-model="totalCopayers"
|
||||
ng-options="totalCopayers as totalCopayers for totalCopayers in create.TCValues"
|
||||
ng-change="create.setTotalCopayers(totalCopayers)">
|
||||
<select class="m10t" ng-model="formData.totalCopayers" ng-options="totalCopayers as totalCopayers for totalCopayers in TCValues"
|
||||
ng-change="setTotalCopayers(formData.totalCopayers)">
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<label ng-show="totalCopayers != 1" class="item item-input item-select">
|
||||
<label class="item item-input item-select">
|
||||
<div class="input-label" translate>
|
||||
Required number of signatures
|
||||
</div>
|
||||
<select class="m10t"
|
||||
ng-model="requiredCopayers"
|
||||
ng-options="requiredCopayers as requiredCopayers for requiredCopayers in create.RCValues"
|
||||
ng-disabled="totalCopayers == 1">
|
||||
ng-model="formData.requiredCopayers" ng-options="requiredCopayers as requiredCopayers for requiredCopayers in RCValues"
|
||||
ng-disabled="formData.totalCopayers == 1">
|
||||
</select>
|
||||
</label>
|
||||
|
||||
|
|
@ -52,77 +46,66 @@
|
|||
</ion-toggle>
|
||||
|
||||
<div ng-show="showAdv">
|
||||
|
||||
<label class="item item-input item-stacked-label">
|
||||
<span class="input-label">Wallet Service URL</span>
|
||||
<input type="text" id="bwsurl" name="bwsurl" ng-model="bwsurl">
|
||||
<input type="text" ng-model="formData.bwsurl">
|
||||
</label>
|
||||
|
||||
<label class="item item-input item-select">
|
||||
<div class="input-label" translate>
|
||||
Wallet Key
|
||||
</div>
|
||||
<select class="m10t"
|
||||
ng-model="seedSource"
|
||||
ng-options="seed as seed.label for seed in create.seedOptions"
|
||||
ng-change="create.setSeedSource()">
|
||||
</select>
|
||||
<select class="m10t" ng-model="seedSource" ng-options="seed as seed.label for seed in seedOptions"></select>
|
||||
</label>
|
||||
|
||||
<label class="item item-input item-stacked-label"
|
||||
ng-show="create.seedSourceId == 'trezor' || create.seedSourceId == 'ledger'">
|
||||
<label class="item item-input item-stacked-label" ng-show="seedSource.id == 'trezor' || seedSource.id == 'ledger'">
|
||||
<span class="input-label" translate>Account Number</span>
|
||||
<input type="number" id="account" ng-model="account" ignore-mouse-wheel>
|
||||
<input type="number" ng-model="formData.account" ignore-mouse-wheel>
|
||||
</label>
|
||||
|
||||
<div class="card" ng-show="create.seedSourceId=='new' && createPassphrase">
|
||||
<div class="card" ng-show="seedSource.id =='new' && formData.createPassphrase">
|
||||
<div class="item item-text-wrap" translate>
|
||||
WARNING: The password cannot be recovered. <b>Be sure to write it down</b>. The wallet can not be restored without the password.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label class="item item-input item-stacked-label" ng-show="create.seedSourceId=='new'">
|
||||
<label class="item item-input item-stacked-label" ng-show="seedSource.id == 'new'">
|
||||
<span class="input-label" translate>Add a Password</span>
|
||||
<input type="text"
|
||||
placeholder="{{'Add an optional password to secure the recovery phrase'|translate}}"
|
||||
autocapitalize="off"
|
||||
name="createPassphrase"
|
||||
ng-model="createPassphrase">
|
||||
ng-model="formData.createPassphrase">
|
||||
</label>
|
||||
|
||||
|
||||
<label class="item item-input item-stacked-label" ng-show="create.seedSourceId=='set'">
|
||||
<label class="item item-input item-stacked-label" ng-show="seedSource.id == 'set'">
|
||||
<span class="input-label" translate>Wallet Recovery Phrase</span>
|
||||
<input id="ext-master"
|
||||
placeholder="{{'Enter the recovery phrase (BIP39)'|translate}}"
|
||||
<input placeholder="{{'Enter the recovery phrase (BIP39)'|translate}}"
|
||||
autocapitalize="off"
|
||||
type="text"
|
||||
name="privateKey"
|
||||
ng-model="privateKey">
|
||||
ng-model="formData.privateKey">
|
||||
</label>
|
||||
|
||||
<label class="item item-input item-stacked-label" ng-show="create.seedSourceId=='set'">
|
||||
<label class="item item-input item-stacked-label" ng-show="seedSource.id == 'set'">
|
||||
<span class="input-label" translate>Password</span>
|
||||
<input type="text"
|
||||
placeholder="{{'The recovery phrase could require a password to be imported'|translate}}"
|
||||
autocapitalize="off"
|
||||
name="passphrase"
|
||||
ng-model="passphrase">
|
||||
ng-model="formData.passphrase">
|
||||
</label>
|
||||
|
||||
<label class="item item-input item-stacked-label" ng-show="create.seedSourceId == 'set'">
|
||||
<label class="item item-input item-stacked-label" ng-show="seedSource.id == 'set'">
|
||||
<span class="input-label" translate>Derivation Path</span>
|
||||
<input type="text"
|
||||
placeholder="{{'BIP32 path for address derivation'|translate}}"
|
||||
name="derivationPath"
|
||||
ng-model="derivationPath">
|
||||
ng-model="formData.derivationPath">
|
||||
</label>
|
||||
|
||||
<ion-toggle ng-show="create.seedSourceId == 'new'" ng-model="testnetEnabled" toggle-class="toggle-positive">
|
||||
<ion-toggle ng-show="seedSource.id == 'new'" ng-model="formData.testnetEnabled" toggle-class="toggle-positive">
|
||||
Testnet
|
||||
</ion-toggle>
|
||||
|
||||
<ion-toggle ng-model="singleAddressEnabled" toggle-class="toggle-positive">
|
||||
<ion-toggle ng-model="formData.singleAddressEnabled" toggle-class="toggle-positive">
|
||||
<span translate>Single Address Wallet</span>
|
||||
<small translate>For audit purposes</small>
|
||||
</ion-toggle>
|
||||
|
|
@ -130,16 +113,7 @@
|
|||
</div> <!-- advanced -->
|
||||
</div> <!-- list -->
|
||||
|
||||
<button type="submit"
|
||||
class="button button-block button-positive"
|
||||
ng-show="totalCopayers != 1" ng-disabled="setupForm.$invalid">
|
||||
<span translate>Create {{requiredCopayers}}-of-{{totalCopayers}} wallet</span>
|
||||
<button type="submit" class="button button-block button-positive" ng-disabled="setupForm.$invalid">
|
||||
<span translate>Create {{formData.requiredCopayers}}-of-{{formData.totalCopayers}} wallet</span>
|
||||
</button>
|
||||
|
||||
<button type="submit"
|
||||
class="button button-block button-positive"
|
||||
ng-show="totalCopayers == 1" ng-disabled="setupForm.$invalid">
|
||||
<span translate>Create new wallet</span>
|
||||
</button>
|
||||
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -7,11 +7,6 @@ angular.module('copayApp.controllers').controller('createController',
|
|||
var isCordova = platformInfo.isCordova;
|
||||
var isDevel = platformInfo.isDevel;
|
||||
|
||||
var self = this;
|
||||
var defaults = configService.getDefaults();
|
||||
this.isWindowsPhoneApp = platformInfo.isWP && isCordova;
|
||||
$scope.account = 1;
|
||||
|
||||
/* For compressed keys, m*73 + n*34 <= 496 */
|
||||
var COPAYER_PAIR_LIMITS = {
|
||||
1: 1,
|
||||
|
|
@ -28,96 +23,91 @@ angular.module('copayApp.controllers').controller('createController',
|
|||
12: 1,
|
||||
};
|
||||
|
||||
var defaults = configService.getDefaults();
|
||||
$scope.bwsurl = defaults.bws.url;
|
||||
$scope.derivationPath = derivationPathHelper.default;
|
||||
|
||||
// ng-repeat defined number of times instead of repeating over array?
|
||||
this.getNumber = function(num) {
|
||||
return new Array(num);
|
||||
}
|
||||
$scope.init = function() {
|
||||
$scope.formData = {};
|
||||
var defaults = configService.getDefaults();
|
||||
$scope.formData.account = 1;
|
||||
$scope.formData.bwsurl = defaults.bws.url;
|
||||
$scope.TCValues = lodash.range(2, defaults.limits.totalCopayers + 1);
|
||||
$scope.formData.totalCopayers = defaults.wallet.totalCopayers;
|
||||
$scope.formData.derivationPath = derivationPathHelper.default;
|
||||
$scope.setTotalCopayers(1);
|
||||
updateRCSelect(1);
|
||||
updateSeedSourceSelect(1);
|
||||
};
|
||||
|
||||
$scope.showAdvChange = function() {
|
||||
$ionicScrollDelegate.resize();
|
||||
};
|
||||
|
||||
var updateRCSelect = function(n) {
|
||||
$scope.totalCopayers = n;
|
||||
function updateRCSelect(n) {
|
||||
$scope.formData.totalCopayers = n;
|
||||
var maxReq = COPAYER_PAIR_LIMITS[n];
|
||||
self.RCValues = lodash.range(1, maxReq + 1);
|
||||
$scope.requiredCopayers = Math.min(parseInt(n / 2 + 1), maxReq);
|
||||
$scope.RCValues = lodash.range(1, maxReq + 1);
|
||||
$scope.formData.requiredCopayers = Math.min(parseInt(n / 2 + 1), maxReq);
|
||||
};
|
||||
|
||||
var updateSeedSourceSelect = function(n) {
|
||||
|
||||
self.seedOptions = [{
|
||||
function updateSeedSourceSelect(n) {
|
||||
var seedOptions = [{
|
||||
id: 'new',
|
||||
label: gettext('Random'),
|
||||
}, {
|
||||
id: 'set',
|
||||
label: gettext('Specify Recovery Phrase...'),
|
||||
}];
|
||||
$scope.seedSource = self.seedOptions[0];
|
||||
|
||||
$scope.seedSource = seedOptions[0];
|
||||
|
||||
if (n > 1 && isChromeApp)
|
||||
self.seedOptions.push({
|
||||
seedOptions.push({
|
||||
id: 'ledger',
|
||||
label: 'Ledger Hardware Wallet',
|
||||
});
|
||||
|
||||
if (isChromeApp || isDevel) {
|
||||
self.seedOptions.push({
|
||||
seedOptions.push({
|
||||
id: 'trezor',
|
||||
label: 'Trezor Hardware Wallet',
|
||||
});
|
||||
}
|
||||
$scope.seedOptions = seedOptions;
|
||||
};
|
||||
|
||||
this.TCValues = lodash.range(2, defaults.limits.totalCopayers + 1);
|
||||
$scope.totalCopayers = defaults.wallet.totalCopayers;
|
||||
|
||||
this.setTotalCopayers = function(tc) {
|
||||
$scope.setTotalCopayers = function(tc) {
|
||||
$scope.formData.totalCopayers = tc;
|
||||
updateRCSelect(tc);
|
||||
updateSeedSourceSelect(tc);
|
||||
self.seedSourceId = $scope.seedSource.id;
|
||||
};
|
||||
|
||||
this.setSeedSource = function(src) {
|
||||
self.seedSourceId = $scope.seedSource.id;
|
||||
|
||||
$timeout(function() {
|
||||
$rootScope.$apply();
|
||||
});
|
||||
};
|
||||
|
||||
this.create = function(form) {
|
||||
$scope.create = function(form) {
|
||||
if (form && form.$invalid) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Please enter the required fields'));
|
||||
return;
|
||||
}
|
||||
|
||||
var opts = {
|
||||
m: $scope.requiredCopayers,
|
||||
n: $scope.totalCopayers,
|
||||
name: $scope.walletName,
|
||||
myName: $scope.totalCopayers > 1 ? $scope.myName : null,
|
||||
networkName: $scope.testnetEnabled ? 'testnet' : 'livenet',
|
||||
bwsurl: $scope.bwsurl,
|
||||
singleAddress: $scope.singleAddressEnabled,
|
||||
walletPrivKey: $scope._walletPrivKey, // Only for testing
|
||||
name: $scope.formData.walletName,
|
||||
m: $scope.formData.requiredCopayers,
|
||||
n: $scope.formData.totalCopayers,
|
||||
myName: $scope.formData.totalCopayers > 1 ? $scope.formData.myName : null,
|
||||
networkName: $scope.formData.testnetEnabled ? 'testnet' : 'livenet',
|
||||
bwsurl: $scope.formData.bwsurl,
|
||||
singleAddress: $scope.formData.singleAddressEnabled,
|
||||
walletPrivKey: $scope.formData._walletPrivKey, // Only for testing
|
||||
};
|
||||
var setSeed = self.seedSourceId == 'set';
|
||||
|
||||
var setSeed = $scope.seedSource.id == 'set';
|
||||
if (setSeed) {
|
||||
|
||||
var words = $scope.privateKey || '';
|
||||
var words = $scope.formData.privateKey || '';
|
||||
if (words.indexOf(' ') == -1 && words.indexOf('prv') == 1 && words.length > 108) {
|
||||
opts.extendedPrivateKey = words;
|
||||
} else {
|
||||
opts.mnemonic = words;
|
||||
}
|
||||
opts.passphrase = $scope.passphrase;
|
||||
opts.passphrase = $scope.formData.passphrase;
|
||||
|
||||
var pathData = derivationPathHelper.parse($scope.derivationPath);
|
||||
var pathData = derivationPathHelper.parse($scope.formData.derivationPath);
|
||||
if (!pathData) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Invalid derivation path'));
|
||||
return;
|
||||
|
|
@ -128,7 +118,7 @@ angular.module('copayApp.controllers').controller('createController',
|
|||
opts.derivationStrategy = pathData.derivationStrategy;
|
||||
|
||||
} else {
|
||||
opts.passphrase = $scope.createPassphrase;
|
||||
opts.passphrase = $scope.formData.createPassphrase;
|
||||
}
|
||||
|
||||
if (setSeed && !opts.mnemonic && !opts.extendedPrivateKey) {
|
||||
|
|
@ -136,36 +126,36 @@ angular.module('copayApp.controllers').controller('createController',
|
|||
return;
|
||||
}
|
||||
|
||||
if (self.seedSourceId == 'ledger' || self.seedSourceId == 'trezor') {
|
||||
var account = $scope.account;
|
||||
if ($scope.seedSource.id == 'ledger' || $scope.seedSource.id == 'trezor') {
|
||||
var account = $scope.formData.account;
|
||||
if (!account || account < 1) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Invalid account number'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.seedSourceId == 'trezor')
|
||||
if ($scope.seedSource.id == 'trezor')
|
||||
account = account - 1;
|
||||
|
||||
opts.account = account;
|
||||
ongoingProcess.set('connecting' + self.seedSourceId, true);
|
||||
ongoingProcess.set('connecting' + $scope.seedSource.id, true);
|
||||
|
||||
var src = self.seedSourceId == 'ledger' ? ledger : trezor;
|
||||
var src = $scope.seedSource.id == 'ledger' ? ledger : trezor;
|
||||
|
||||
src.getInfoForNewWallet(opts.n > 1, account, function(err, lopts) {
|
||||
ongoingProcess.set('connecting' + self.seedSourceId, false);
|
||||
ongoingProcess.set('connecting' + $scope.seedSource.id, false);
|
||||
if (err) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), err);
|
||||
return;
|
||||
}
|
||||
opts = lodash.assign(lopts, opts);
|
||||
self._create(opts);
|
||||
_create(opts);
|
||||
});
|
||||
} else {
|
||||
self._create(opts);
|
||||
_create(opts);
|
||||
}
|
||||
};
|
||||
|
||||
this._create = function(opts) {
|
||||
function _create(opts) {
|
||||
ongoingProcess.set('creatingWallet', true);
|
||||
$timeout(function() {
|
||||
|
||||
|
|
@ -182,14 +172,11 @@ angular.module('copayApp.controllers').controller('createController',
|
|||
});
|
||||
|
||||
|
||||
if (self.seedSourceId == 'set') {
|
||||
if ($scope.seedSource.id == 'set') {
|
||||
profileService.setBackupFlag(client.credentials.walletId);
|
||||
}
|
||||
$state.go('tabs.home')
|
||||
});
|
||||
}, 100);
|
||||
}
|
||||
|
||||
updateSeedSourceSelect(1);
|
||||
self.setSeedSource();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -301,7 +301,6 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
})
|
||||
.state('tabs.create', {
|
||||
url: '/create',
|
||||
// abstract: true,
|
||||
templateUrl: 'views/create.html',
|
||||
views: {
|
||||
'tab-home': {
|
||||
|
|
@ -309,22 +308,6 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
},
|
||||
}
|
||||
})
|
||||
// .state('tabs.create.personal', {
|
||||
// url: '/tab-create-personal',
|
||||
// views: {
|
||||
// 'tab-create-personal': {
|
||||
// templateUrl: 'views/tab-create-personal.html',
|
||||
// },
|
||||
// }
|
||||
// })
|
||||
// .state('tabs.create.shared', {
|
||||
// url: '/tab-create-shared',
|
||||
// views: {
|
||||
// 'tab-create-shared': {
|
||||
// templateUrl: 'views/tab-create-shared.html',
|
||||
// },
|
||||
// }
|
||||
// })
|
||||
|
||||
/*
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue