Update Coinbase from tab-home
This commit is contained in:
parent
163f1bf913
commit
1a7f66273e
2 changed files with 17 additions and 2 deletions
|
|
@ -181,7 +181,7 @@ angular.module('copayApp.services').factory('coinbaseService', function($http, $
|
|||
if (lodash.isEmpty(credentials.CLIENT_ID)) {
|
||||
return cb('Coinbase is Disabled');
|
||||
}
|
||||
$log.debug('Init Token...');
|
||||
$log.debug('Trying to initialise Coinbase...');
|
||||
|
||||
storageService.getCoinbaseToken(credentials.NETWORK, function(err, accessToken) {
|
||||
if (err || !accessToken) return cb();
|
||||
|
|
@ -478,6 +478,10 @@ angular.module('copayApp.services').factory('coinbaseService', function($http, $
|
|||
|
||||
root.getPendingTransactions = function(coinbasePendingTransactions) {
|
||||
root.init(function(err, data) {
|
||||
if (err || lodash.isEmpty(data)) {
|
||||
if (err) $log.error(err);
|
||||
return;
|
||||
}
|
||||
var accessToken = data.accessToken;
|
||||
var accountId = data.accountId;
|
||||
storageService.getCoinbaseTxs(credentials.NETWORK, function(err, txs) {
|
||||
|
|
@ -550,6 +554,13 @@ angular.module('copayApp.services').factory('coinbaseService', function($http, $
|
|||
});
|
||||
};
|
||||
|
||||
root.updatePendingTransactions = lodash.throttle(function() {
|
||||
$log.debug('Updating pending transactions...');
|
||||
root.setCredentials();
|
||||
var pendingTransactions = { data: {} };
|
||||
root.getPendingTransactions(pendingTransactions);
|
||||
}, 20000);
|
||||
|
||||
var _updateTxs = function(coinbasePendingTransactions) {
|
||||
storageService.getCoinbaseTxs(credentials.NETWORK, function(err, txs) {
|
||||
txs = txs ? JSON.parse(txs) : {};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue