diff --git a/src/js/controllers/addresses.js b/src/js/controllers/addresses.js index c83279f84..ff7fd636b 100644 --- a/src/js/controllers/addresses.js +++ b/src/js/controllers/addresses.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('addressesController', function($scope, $log, $stateParams, $state, $timeout, $ionicHistory, $ionicScrollDelegate, popupService, gettextCatalog, ongoingProcess, lodash, profileService, walletService, bwcError, platformInfo, appConfigService, txFormatService, feeService) { +angular.module('copayApp.controllers').controller('addressesController', function($scope, $log, $stateParams, $state, $timeout, $ionicHistory, $ionicScrollDelegate, popupService, gettextCatalog, ongoingProcess, lodash, profileService, walletService, bwcError, platformInfo, appConfigService, txFormatService, feeService, bitcoinCashJsService) { var UNUSED_ADDRESS_LIMIT = 5; var BALANCE_ADDRESS_LIMIT = 5; var withBalance, cachedWallet; @@ -58,6 +58,19 @@ angular.module('copayApp.controllers').controller('addressesController', functio }; $scope.allAddresses = $scope.noBalance.concat(withBalance); + if ($scope.wallet.coin == 'bch') { + lodash.each($scope.allAddresses, function(a) { + a.translatedAddresses = bitcoinCashJsService.translateAddresses(a.address); + }); + + var cashaddrDate = new Date(2018, 0, 15); + var currentDate = new Date(); + + $scope.addressType = { + type: currentDate >= cashaddrDate ? 'cashaddr' : 'legacy' + }; + } + cachedWallet = $scope.wallet.id; $scope.loading = false; $log.debug('Addresses cached for Wallet:', cachedWallet); diff --git a/www/views/addresses.html b/www/views/addresses.html index d59846e06..da5d78ef0 100644 --- a/www/views/addresses.html +++ b/www/views/addresses.html @@ -37,6 +37,17 @@ +