diff --git a/src/js/controllers/addresses.js b/src/js/controllers/addresses.js index 1425ac50f..24129da76 100644 --- a/src/js/controllers/addresses.js +++ b/src/js/controllers/addresses.js @@ -1,6 +1,37 @@ 'use strict'; -angular.module('copayApp.controllers').controller('addressesController', function($scope, $stateParams, profileService, walletService) { +angular.module('copayApp.controllers').controller('addressesController', function($scope, $stateParams, $timeout, $ionicScrollDelegate, ongoingProcess, lodash, profileService, walletService) { + var ADDRESS_LIMIT = 5; $scope.wallet = profileService.getWallet($stateParams.walletId); + $scope.showInfo = false; + $scope.$on("$ionicView.beforeEnter", function(event, data) { + // $scope.unusedAddresses = getUnusedAddreses(); No backend support TODO + $scope.unusedAddresses = [{ + createdOn: 1479138140, + address: "0m9sad00810m0m1d2192d9u12d9", + path: 'xpub/0/1' + }]; + + ongoingProcess.set('extractingWalletInfo', true); + walletService.getMainAddresses($scope.wallet, ADDRESS_LIMIT, function(err, addresses) { + ongoingProcess.set('extractingWalletInfo', false); + $scope.addresses = lodash.map(addresses, function(addr) { + return { + createdOn: addr.createdOn, + address: addr.address, + path: addr.path.replace(/^m/g, 'xpub') + }; + }); + + console.log($scope.addresses); + }); + }); + + $scope.showInformation = function() { + $timeout(function() { + $scope.showInfo = !$scope.showInfo; + $ionicScrollDelegate.resize(); + }); + }; }); diff --git a/src/js/services/walletService.js b/src/js/services/walletService.js index 3e5da9097..f9b898b2b 100644 --- a/src/js/services/walletService.js +++ b/src/js/services/walletService.js @@ -773,6 +773,17 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim }); }; + root.getMainAddresses = function(wallet, limit, cb) { + var opts = {}; + opts.reverse = true; + if (limit) opts.limit = limit; + + wallet.getMainAddresses(opts, function(err, addresses) { + if (err) return cb(err); + return cb(null, addresses); + }); + }; + root.getAddress = function(wallet, forceNew, cb) { storageService.getLastAddress(wallet.id, function(err, addr) { if (err) return cb(err); diff --git a/www/views/addresses.html b/www/views/addresses.html index ad66c733b..a4be58d2a 100644 --- a/www/views/addresses.html +++ b/www/views/addresses.html @@ -1,4 +1,4 @@ - + {{'Wallet Addresses' | translate}} @@ -6,30 +6,45 @@ -
-
- Translation Credits -
-
kinoshitajonaJapanese
-
KirvxFrench
-
saschadGerman
-
cmgustavo83Spanish
-
RussianNeuroMancerRussian
-
HostFatItalian
-
xm2hiChinese
-
Pirx1618Polish
-
mareksipCzech
+
+
-
-

- We’re always looking for translation contributions! You can make corrections or help to make this app available in your native language by joining our community on Crowdin. - -

- - Don't see your language on Crowdin? Contact the Owner on Crowdin! We'd love to support your language. - + +
+ Each bitcoin wallet can generate billions of addresses from your 12-word backup. A new address is automatically generated and shown each time your recive a payment. Why? +
+ +
+ It's a good idea to avoid reusing addresses-this both protects your privacy and keeps your bitcoins secure against hypothetical attacks by quantum computers. Hide +
+ +
+
+ Unused Addresses + +
+ +
+
+ {{uAddr.address}} + + {{uAddr.path}} {{uAddr.createdOn * 1000 | amDateFormat:'MMMM Do YYYY, hh:mm a'}} + +
+
+ +
+ Not unused addresses available +
+ +
+ Addresses With Balance +
+ +
+ {{addr.address}} +
{{addr.balanceStr}}
+