Next address after receive funds
This commit is contained in:
parent
959707f3b7
commit
fe8dcd2f94
4 changed files with 48 additions and 20 deletions
|
|
@ -29,16 +29,6 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
});
|
||||
};
|
||||
|
||||
// // RECEIVE
|
||||
// // Check address
|
||||
// root.isUsed(wallet.walletId, balance.byAddress, function(err, used) {
|
||||
// if (used) {
|
||||
// $log.debug('Address used. Creating new');
|
||||
// $rootScope.$emit('Local/AddressIsUsed');
|
||||
// }
|
||||
// });
|
||||
//
|
||||
|
||||
var _signWithLedger = function(wallet, txp, cb) {
|
||||
$log.info('Requesting Ledger Chrome app to sign the transaction');
|
||||
|
||||
|
|
@ -231,6 +221,17 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
cache.alternativeName = config.settings.alternativeName;
|
||||
cache.alternativeIsoCode = config.settings.alternativeIsoCode;
|
||||
|
||||
// Check address
|
||||
root.isAddressUsed(wallet, balance.byAddress, function(err, used) {
|
||||
if (used) {
|
||||
$log.debug('Address used. Creating new');
|
||||
// Force new address
|
||||
root.getAddress(wallet, true, function(err, addr) {
|
||||
$log.debug('New address: ', addr);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
rateService.whenAvailable(function() {
|
||||
|
||||
var totalBalanceAlternative = rateService.toFiat(cache.totalBalanceSat, cache.alternativeIsoCode);
|
||||
|
|
@ -760,12 +761,13 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
});
|
||||
};
|
||||
|
||||
root.isUsed = function(wallet, byAddress, cb) {
|
||||
// Check address
|
||||
root.isAddressUsed = function(wallet, byAddress, cb) {
|
||||
storageService.getLastAddress(wallet.id, function(err, addr) {
|
||||
var used = lodash.find(byAddress, {
|
||||
address: addr
|
||||
});
|
||||
return cb(null, used);
|
||||
return cb(err, used);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue