Merge pull request #4289 from gabrielbazan7/feat/SingleAddressWallet

allow single address wallet for auditable reasons
This commit is contained in:
Matias Alejo Garcia 2016-06-07 16:49:48 -03:00
commit 492c4c967f
8 changed files with 23 additions and 7 deletions

View file

@ -159,6 +159,13 @@
</ion-toggle> </ion-toggle>
</label> </label>
</div> </div>
<div class="oh" ng-show="create.seedSourceId == 'new'">
<label for="single-address" class="dbi">
<span translate>Single Address Wallet</span> <small translate>For audit purposes</small>
<ion-toggle ng-model="singleAddressEnabled" toggle-class="toggle-balanced" class="bct">
</ion-toggle>
</label>
</div>
</div> <!-- columns --> </div> <!-- columns -->
</div> <!-- advanced --> </div> <!-- advanced -->

View file

@ -1,5 +1,6 @@
<span ng-show="index.isShared" class="size-12"><span translate>{{index.m}}-of-{{index.n}}</span></span> <span ng-show="index.isShared" class="size-12"><span translate>{{index.m}}-of-{{index.n}}</span></span>
<span ng-show="index.isSingleAddress" class="size-12"><span translate>Auditable</span></span>
<img style="height:0.6em; margin-right: 1px;" ng-show="index.network != 'livenet'" src="img/icon-testnet-white.svg"> <img style="height:0.6em; margin-right: 1px;" ng-show="index.network != 'livenet'" src="img/icon-testnet-white.svg">
<img style="height:0.6em; margin-right: 1px;" ng-show="!index.canSign && !index.isPrivKeyExternal" <img style="height:0.6em; margin-right: 1px;" ng-show="!index.canSign && !index.isPrivKeyExternal"
src="img/icon-read-only-white.svg"> src="img/icon-read-only-white.svg">

View file

@ -330,12 +330,15 @@
</button> </button>
</div> </div>
</div> </div>
<div class="row m10t" ng-show="home.addr" > <div class="row m10t" ng-show="home.addr">
<div class="large-12 columns"> <div class="large-12 columns">
<div class="line-t size-10 text-gray m10b p10t"> <div class="line-t size-10 text-gray m10b p10t" ng-show="!index.isSingleAddress">
<span translate> Share this wallet address to receive payments. To protect your privacy, new addresses are generated automatically once you use them.</span> <span translate> Share this wallet address to receive payments. To protect your privacy, new addresses are generated automatically once you use them.</span>
<a ng-show="!home.blockUx && !home.generatingAddress" ng-click="home.setAddress(true)" translate>Generate new address</a> <a ng-show="!home.blockUx && !home.generatingAddress" ng-click="home.setAddress(true)" translate>Generate new address</a>
</div> </div>
<div class="line-t size-10 text-gray m10b p10t" ng-show="index.isSingleAddress">
<span translate> Share this wallet address to receive payments</span>.
</div>
</div> </div>
</div> </div>
</div> </div>

View file

@ -100,6 +100,7 @@ angular.module('copayApp.controllers').controller('createController',
myName: $scope.totalCopayers > 1 ? $scope.myName : null, myName: $scope.totalCopayers > 1 ? $scope.myName : null,
networkName: $scope.testnetEnabled ? 'testnet' : 'livenet', networkName: $scope.testnetEnabled ? 'testnet' : 'livenet',
bwsurl: $scope.bwsurl, bwsurl: $scope.bwsurl,
singleAddress: $scope.singleAddressEnabled,
walletPrivKey: $scope._walletPrivKey, // Only for testing walletPrivKey: $scope._walletPrivKey, // Only for testing
}; };
var setSeed = self.seedSourceId == 'set'; var setSeed = self.seedSourceId == 'set';

View file

@ -137,6 +137,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
$timeout(function() { $timeout(function() {
$rootScope.$apply(); $rootScope.$apply();
self.hasProfile = true; self.hasProfile = true;
self.isSingleAddress = false;
self.noFocusedWallet = false; self.noFocusedWallet = false;
self.onGoingProcess = {}; self.onGoingProcess = {};
@ -304,6 +305,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
if (err) { if (err) {
self.updateError = bwsError.msg(err, gettext('Could not update Wallet')); self.updateError = bwsError.msg(err, gettext('Could not update Wallet'));
} else { } else {
self.isSingleAddress = !!ret.wallet.singleAddress;
if (!opts.quiet) if (!opts.quiet)
self.setOngoingProcess('scanning', ret.wallet.scanStatus == 'running'); self.setOngoingProcess('scanning', ret.wallet.scanStatus == 'running');
} }

View file

@ -28,7 +28,7 @@ angular.module('copayApp.controllers').controller('sidebarController',
if (selectedWalletId == currentWalletId) return; if (selectedWalletId == currentWalletId) return;
self.walletSelection = false; self.walletSelection = false;
profileService.setAndStoreFocus(selectedWalletId, function() {}); profileService.setAndStoreFocus(selectedWalletId, function() {});
$ionicScrollDelegate.$getByHandle('transactions').scrollTop(); $ionicScrollDelegate.scrollTop();
}; };
self.toggleWalletSelection = function() { self.toggleWalletSelection = function() {

View file

@ -303,6 +303,7 @@ angular.module('copayApp.services')
walletClient.createWallet(name, myName, opts.m, opts.n, { walletClient.createWallet(name, myName, opts.m, opts.n, {
network: opts.networkName, network: opts.networkName,
singleAddress: opts.singleAddress,
walletPrivKey: opts.walletPrivKey, walletPrivKey: opts.walletPrivKey,
}, function(err, secret) { }, function(err, secret) {
if (err) return bwsError.cb(err, gettext('Error creating wallet'), cb); if (err) return bwsError.cb(err, gettext('Error creating wallet'), cb);
@ -352,8 +353,8 @@ angular.module('copayApp.services')
// check if exist // check if exist
if (lodash.find(root.profile.credentials, { if (lodash.find(root.profile.credentials, {
'walletId': walletData.walletId 'walletId': walletData.walletId
})) { })) {
return cb(gettext('Cannot join the same wallet more that once')); return cb(gettext('Cannot join the same wallet more that once'));
} }
} catch (ex) { } catch (ex) {

View file

@ -99,12 +99,12 @@ describe('createController', function() {
}, },
}; // TODO: Read from file }; // TODO: Read from file
beforeEach(function(done){ beforeEach(function(done) {
mocks.init(fixtures, 'createController', {}, done); mocks.init(fixtures, 'createController', {}, done);
}) })
afterEach(function(done){ afterEach(function(done) {
mocks.clear({}, done); mocks.clear({}, done);
}); });
@ -125,6 +125,7 @@ describe('createController', function() {
scope.walletName = 'A test wallet'; scope.walletName = 'A test wallet';
scope.isTestnet = false; scope.isTestnet = false;
scope.bwsurl = null; scope.bwsurl = null;
scope.isSingleAddress = false;
scope.privateKey = 'legal winner thank year wave sausage worth useful legal winner thank yellow'; scope.privateKey = 'legal winner thank year wave sausage worth useful legal winner thank yellow';
scope._walletPrivKey = 'Kz4CFSTgLzoYfMkt97BTBotUbZYXjMts6Ej9HbVfCf5oLmun1BXy'; scope._walletPrivKey = 'Kz4CFSTgLzoYfMkt97BTBotUbZYXjMts6Ej9HbVfCf5oLmun1BXy';