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>
</label>
</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> <!-- 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.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.canSign && !index.isPrivKeyExternal"
src="img/icon-read-only-white.svg">

View File

@ -330,12 +330,15 @@
</button>
</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="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>
<a ng-show="!home.blockUx && !home.generatingAddress" ng-click="home.setAddress(true)" translate>Generate new address</a>
</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>

View File

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

View File

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

View File

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

View File

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

View File

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