add address list
This commit is contained in:
parent
7a63bfcc72
commit
7e7fedc402
3 changed files with 80 additions and 23 deletions
|
|
@ -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();
|
||||
});
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue