add bws settings in join wallet
This commit is contained in:
parent
de0a06235f
commit
a75bbe6e45
2 changed files with 28 additions and 6 deletions
|
|
@ -77,6 +77,13 @@
|
||||||
</a>
|
</a>
|
||||||
<div ng-show="join.hideAdv" class="row">
|
<div ng-show="join.hideAdv" class="row">
|
||||||
<div class="large-12 columns">
|
<div class="large-12 columns">
|
||||||
|
|
||||||
|
<label for="bws" class="oh">
|
||||||
|
<span translate>Specify Bitcore Wallet Service URL
|
||||||
|
<input type="text" id="bwsurl" type="text" name="bwsurl" ng-model="bwsurl">
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
<label for="hw-ledger" class="oh" ng-show="index.isChromeApp">
|
<label for="hw-ledger" class="oh" ng-show="index.isChromeApp">
|
||||||
<span translate>Use Ledger hardware wallet</span>
|
<span translate>Use Ledger hardware wallet</span>
|
||||||
<switch id="hw-ledger" name="hwLedger" ng-model="hwLedger" class="green right m5t m10b"></switch>
|
<switch id="hw-ledger" name="hwLedger" ng-model="hwLedger" class="green right m5t m10b"></switch>
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,12 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('joinController',
|
angular.module('copayApp.controllers').controller('joinController',
|
||||||
function($scope, $rootScope, $timeout, go, notification, profileService, isCordova, $modal, gettext, lodash, ledger, trezor) {
|
function($scope, $rootScope, $timeout, go, notification, profileService, configService, isCordova, $modal, gettext, lodash, ledger, trezor) {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
var defaults = configService.getDefaults();
|
||||||
|
var defaults = configService.getDefaults();
|
||||||
|
$scope.bwsurl = defaults.bws.url;
|
||||||
|
|
||||||
this.onQrCodeScanned = function(data) {
|
this.onQrCodeScanned = function(data) {
|
||||||
$scope.secret = data;
|
$scope.secret = data;
|
||||||
|
|
@ -24,7 +27,7 @@ angular.module('copayApp.controllers').controller('joinController',
|
||||||
}
|
}
|
||||||
|
|
||||||
var setSeed = form.setSeed.$modelValue;
|
var setSeed = form.setSeed.$modelValue;
|
||||||
if (setSeed) {
|
if (setSeed) {
|
||||||
var words = form.privateKey.$modelValue;
|
var words = form.privateKey.$modelValue;
|
||||||
if (words.indexOf(' ') == -1 && words.indexOf('prv') == 1 && words.length > 108) {
|
if (words.indexOf(' ') == -1 && words.indexOf('prv') == 1 && words.length > 108) {
|
||||||
opts.extendedPrivateKey = words;
|
opts.extendedPrivateKey = words;
|
||||||
|
|
@ -40,10 +43,10 @@ angular.module('copayApp.controllers').controller('joinController',
|
||||||
this.error = gettext('Please enter the wallet seed');
|
this.error = gettext('Please enter the wallet seed');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (form.hwLedger.$modelValue || form.hwTrezor.$modelValue) {
|
if (form.hwLedger.$modelValue || form.hwTrezor.$modelValue) {
|
||||||
self.hwWallet = form.hwLedger.$modelValue ? 'Ledger' : 'TREZOR';
|
self.hwWallet = form.hwLedger.$modelValue ? 'Ledger' : 'TREZOR';
|
||||||
var src= form.hwLedger.$modelValue ? ledger : trezor;
|
var src = form.hwLedger.$modelValue ? ledger : trezor;
|
||||||
|
|
||||||
var account = 0;
|
var account = 0;
|
||||||
src.getInfoForNewWallet(account, function(err, lopts) {
|
src.getInfoForNewWallet(account, function(err, lopts) {
|
||||||
|
|
@ -72,7 +75,19 @@ angular.module('copayApp.controllers').controller('joinController',
|
||||||
}
|
}
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
var fc = profileService.focusedClient;
|
var fc = profileService.focusedClient;
|
||||||
if ( fc.isComplete() && (opts.mnemonic || opts.externalSource || opts.extendedPrivateKey)) {
|
|
||||||
|
var opts_ = {
|
||||||
|
bws: {}
|
||||||
|
};
|
||||||
|
|
||||||
|
opts_.bws[fc.credentials.walletId] = $scope.bwsurl;
|
||||||
|
configService.set(opts_, function(err) {
|
||||||
|
if (err) console.log(err);
|
||||||
|
$scope.$emit('Local/BWSUpdated');
|
||||||
|
applicationService.restart();
|
||||||
|
});
|
||||||
|
|
||||||
|
if (fc.isComplete() && (opts.mnemonic || opts.externalSource || opts.extendedPrivateKey)) {
|
||||||
$rootScope.$emit('Local/WalletImported', fc.credentials.walletId);
|
$rootScope.$emit('Local/WalletImported', fc.credentials.walletId);
|
||||||
} else {
|
} else {
|
||||||
go.walletHome();
|
go.walletHome();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue