mirror of
https://github.com/hanzo-labs/arcadia.git
synced 2026-10-30 18:55:41 +00:00
34 lines
1002 B
JavaScript
34 lines
1002 B
JavaScript
'use strict';
|
|
var mainPopCtrl = function($scope, $sce) {
|
|
$scope.allWallets = [];
|
|
$scope.allWatchOnly = [];
|
|
$scope.setAllWallets = function() {
|
|
cxFuncs.getWalletsArr(function(wlts) {
|
|
$scope.allWallets = wlts;
|
|
$scope.updateBalance('allWallets');
|
|
});
|
|
cxFuncs.getWatchOnlyArr(function(wlts) {
|
|
$scope.allWatchOnly = wlts;
|
|
$scope.updateBalance('allWatchOnly');
|
|
$scope.$apply();
|
|
});
|
|
};
|
|
$scope.updateBalance = function(varWal) {
|
|
for (var i = 0; i < $scope[varWal].length; i++) {
|
|
$scope.setBalance($scope[varWal][i].addr, i, varWal);
|
|
}
|
|
};
|
|
$scope.setBalance = function(address, id, varWal) {
|
|
ajaxReq.getBalance(address, function(data) {
|
|
if (data.error) {
|
|
$scope[varWal][id].balance = data.msg;
|
|
} else {
|
|
$scope[varWal][id].balance = etherUnits.toEther(data.data.balance, 'wei');
|
|
$scope[varWal][id].balanceR = new BigNumber($scope[varWal][id].balance).toPrecision(5);
|
|
}
|
|
});
|
|
};
|
|
$scope.setAllWallets();
|
|
};
|
|
module.exports = mainPopCtrl;
|