Fix tab-send to send BCH or BTC from address book entry
This commit is contained in:
parent
c9253c44f3
commit
31029bc17a
1 changed files with 10 additions and 1 deletions
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('tabSendController', function($scope, $rootScope, $log, $timeout, $ionicScrollDelegate, addressbookService, profileService, lodash, $state, walletService, incomingData, popupService, platformInfo, bwcError, gettextCatalog, scannerService) {
|
||||
angular.module('copayApp.controllers').controller('tabSendController', function($scope, $rootScope, $log, $timeout, $ionicScrollDelegate, addressbookService, profileService, lodash, $state, walletService, incomingData, popupService, platformInfo, bwcError, gettextCatalog, scannerService, bitcoreCash) {
|
||||
|
||||
var originalList;
|
||||
var CONTACTS_SHOW_LIMIT;
|
||||
|
|
@ -86,6 +86,14 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
|
|||
}
|
||||
}
|
||||
|
||||
var getCoin = function(address) {
|
||||
var cashAddress = bitcoreCash.Address.isValid(address, 'livenet');
|
||||
if (cashAddress) {
|
||||
return 'bch';
|
||||
}
|
||||
return 'btc';
|
||||
};
|
||||
|
||||
var updateContactsList = function(cb) {
|
||||
addressbookService.list(function(err, ab) {
|
||||
if (err) $log.error(err);
|
||||
|
|
@ -100,6 +108,7 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
|
|||
address: k,
|
||||
email: lodash.isObject(v) ? v.email : null,
|
||||
recipientType: 'contact',
|
||||
coin: getCoin(k),
|
||||
getAddress: function(cb) {
|
||||
return cb(null, k);
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue