WIP: Ref topup. Fix sendmax
This commit is contained in:
parent
dbd137f0a4
commit
36b64bdfa7
5 changed files with 241 additions and 190 deletions
|
|
@ -45,8 +45,7 @@ angular.module('copayApp.services').factory('ongoingProcess', function($log, $ti
|
|||
'cancelingGiftCard': 'Canceling Gift Card...',
|
||||
'creatingGiftCard': 'Creating Gift Card...',
|
||||
'buyingGiftCard': 'Buying Gift Card...',
|
||||
'topup': gettext('Top up in progress...'),
|
||||
'creatingInvoice': gettext('Creating invoice...')
|
||||
'topup': gettext('Top up in progress...')
|
||||
};
|
||||
|
||||
root.clear = function() {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ angular.module('copayApp.services').service('sendMaxService', function(feeServic
|
|||
*
|
||||
*/
|
||||
this.getInfo = function(wallet, cb) {
|
||||
feeService.getCurrentFeeRate(wallet.credentials.network, null, function(err, feePerKb) {
|
||||
feeService.getCurrentFeeRate(wallet.credentials.network, function(err, feePerKb) {
|
||||
if (err) return cb(err);
|
||||
|
||||
var config = configService.getSync().wallet;
|
||||
|
|
|
|||
|
|
@ -23,6 +23,26 @@ angular.module('copayApp.services').factory('txFormatService', function($filter,
|
|||
return root.formatAmount(satoshis) + ' ' + config.unitName;
|
||||
};
|
||||
|
||||
root.formatToCode = function(satoshis, code, cb) {
|
||||
if (isNaN(satoshis)) return;
|
||||
var val = function() {
|
||||
var v1 = rateService.toFiat(satoshis, code);
|
||||
if (!v1) return null;
|
||||
|
||||
return v1.toFixed(2);
|
||||
};
|
||||
|
||||
// Async version
|
||||
if (cb) {
|
||||
rateService.whenAvailable(function() {
|
||||
return cb(val());
|
||||
});
|
||||
} else {
|
||||
if (!rateService.isAvailable()) return null;
|
||||
return val();
|
||||
};
|
||||
};
|
||||
|
||||
root.formatToUSD = function(satoshis, cb) {
|
||||
if (isNaN(satoshis)) return;
|
||||
var val = function() {
|
||||
|
|
@ -181,8 +201,8 @@ angular.module('copayApp.services').factory('txFormatService', function($filter,
|
|||
}
|
||||
|
||||
return {
|
||||
amount: amount,
|
||||
currency: currency,
|
||||
amount: amount,
|
||||
currency: currency,
|
||||
alternativeIsoCode: alternativeIsoCode,
|
||||
amountSat: amountSat,
|
||||
amountUnitStr: amountUnitStr
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue