diff --git a/bitcoin-cash-js/index.js b/bitcoin-cash-js/index.js
index faf6d510d..27680866c 100644
--- a/bitcoin-cash-js/index.js
+++ b/bitcoin-cash-js/index.js
@@ -17,7 +17,7 @@ bitcoinCashJsModule.provider('bitcoinCashJsService', function() {
return {
'legacy': result.toString(),
'bitpay': result.toString(BitpayFormat),
- 'cashaddr': result.toString(CashAddrFormat)
+ 'cashaddr': result.toString(CashAddrFormat).replace('bitcoincash:', '')
};
}
diff --git a/src/js/controllers/tab-receive.js b/src/js/controllers/tab-receive.js
index 6677aa26d..031def614 100644
--- a/src/js/controllers/tab-receive.js
+++ b/src/js/controllers/tab-receive.js
@@ -1,8 +1,11 @@
'use strict';
-angular.module('copayApp.controllers').controller('tabReceiveController', function($rootScope, $scope, $timeout, $log, $ionicModal, $state, $ionicHistory, $ionicPopover, storageService, platformInfo, walletService, profileService, configService, lodash, gettextCatalog, popupService, bwcError) {
+angular.module('copayApp.controllers').controller('tabReceiveController', function($rootScope, $scope, $timeout, $log, $ionicModal, $state, $ionicHistory, $ionicPopover, storageService, platformInfo, walletService, profileService, configService, lodash, gettextCatalog, popupService, bwcError, bitcoinCashJsService) {
var listeners = [];
+ $scope.bchAddressType = 'cashaddr';
+ var bchAddresses = {};
+
$scope.isCordova = platformInfo.isCordova;
$scope.isNW = platformInfo.isNW;
@@ -25,13 +28,24 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
popupService.showAlert(err);
}
- $scope.addr = addr;
+ if ($scope.wallet.coin == 'bch') {
+ bchAddresses = bitcoinCashJsService.translateAddresses(addr);
+ $scope.addr = bchAddresses[$scope.bchAddressType];
+ } else {
+ $scope.addr = addr;
+ }
+
$timeout(function() {
$scope.$apply();
}, 10);
});
};
+ $scope.displayAddress = function(type) {
+ $scope.bchAddressType = type;
+ $scope.addr = bchAddresses[$scope.bchAddressType];
+ }
+
$scope.goCopayers = function() {
$ionicHistory.removeBackView();
$ionicHistory.nextViewOptions({
diff --git a/www/views/tab-receive.html b/www/views/tab-receive.html
index bb7206ad7..1e25c0a72 100644
--- a/www/views/tab-receive.html
+++ b/www/views/tab-receive.html
@@ -40,6 +40,21 @@