fix conflicts
This commit is contained in:
commit
b95af5e53a
31 changed files with 1393 additions and 544 deletions
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copay.header').controller('HeaderController',
|
||||
function($scope, $rootScope, $location, Network) {
|
||||
function($scope, $rootScope, $location, walletFactory) {
|
||||
$scope.menu = [{
|
||||
'title': 'Home',
|
||||
'icon': 'fi-home',
|
||||
|
|
@ -35,15 +35,13 @@ angular.module('copay.header').controller('HeaderController',
|
|||
return false;
|
||||
};
|
||||
|
||||
$scope.init = function() {
|
||||
$rootScope.isLogged = false;
|
||||
};
|
||||
|
||||
$scope.signout = function() {
|
||||
Network.disconnect(function() {
|
||||
var w = $rootScope.wallet;
|
||||
if (w) {
|
||||
w.disconnect();
|
||||
delete $rootScope['wallet'];
|
||||
$location.path('signin');
|
||||
$rootScope.$digest();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.clearFlashMessage = function() {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copay.peer').controller('PeerController',
|
||||
function($scope, $rootScope, $location, $routeParams, Network) {
|
||||
function($scope, $rootScope, $location, $routeParams) {
|
||||
|
||||
$scope.init = function() {
|
||||
//Network.connect($rootScope.masterId);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copay.send').controller('SendController',
|
||||
function($scope, $rootScope, $location, Network) {
|
||||
function($scope, $rootScope, $location) {
|
||||
$scope.title = 'Send';
|
||||
|
||||
if (!$rootScope.wallet.id) {
|
||||
|
|
@ -11,27 +11,8 @@ angular.module('copay.send').controller('SendController',
|
|||
|
||||
$scope.sendTest = function() {
|
||||
var w = $rootScope.wallet;
|
||||
var pkr = w.publicKeyRing;
|
||||
var txp = w.txProposals;
|
||||
var opts = {remainderOut: { address: pkr.generateAddress(true).toString() }};
|
||||
|
||||
// From @cmgustavo's wallet
|
||||
w.listUnspent(function (unspentTest) {
|
||||
console.log('[send.js.19:unspentTest:]',unspentTest); //TODO
|
||||
|
||||
txp.create(
|
||||
'15q6HKjWHAksHcH91JW23BJEuzZgFwydBt',
|
||||
'123456789',
|
||||
unspentTest,
|
||||
w.privateKey,
|
||||
opts
|
||||
);
|
||||
console.log('[send.js.29:txp:] READY:',txp); //TODO
|
||||
|
||||
Network.storeOpenWallet();
|
||||
Network.sendTxProposals();
|
||||
$rootScope.$digest;
|
||||
|
||||
});
|
||||
w.createTx( '15q6HKjWHAksHcH91JW23BJEuzZgFwydBt', '12345',function() {
|
||||
$rootScope.$digest();
|
||||
});
|
||||
};
|
||||
});
|
||||
|
|
|
|||
48
js/controllers/setup.js
Normal file
48
js/controllers/setup.js
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copay.setup').controller('SetupController',
|
||||
function($scope, $rootScope, $location, walletFactory) {
|
||||
|
||||
$scope.loading = false;
|
||||
|
||||
$scope.totalCopayers = config.wallet.totalCopayers;
|
||||
$scope.TCValues = [];
|
||||
for (var n = 1; n <= config.limits.totalCopayers; n++)
|
||||
$scope.TCValues.push(n);
|
||||
|
||||
var updateRCSelect = function(n) {
|
||||
$scope.requiredCopayers = parseInt(Math.min(n / 2 + 1, config.limits.mPlusN-n));
|
||||
$scope.RCValues = [];
|
||||
for (var m = 1; m <= n; m++) {
|
||||
if (n + m <= config.limits.mPlusN) {
|
||||
$scope.RCValues.push(m);
|
||||
}
|
||||
}
|
||||
};
|
||||
updateRCSelect($scope.totalCopayers);
|
||||
|
||||
$scope.$watch('totalCopayers', function(tc) {
|
||||
updateRCSelect(tc);
|
||||
})
|
||||
|
||||
$scope.create = function(totalCopayers, requiredCopayers) {
|
||||
$scope.loading = true;
|
||||
var opts = {
|
||||
requiredCopayers: requiredCopayers,
|
||||
totalCopayers: totalCopayers
|
||||
};
|
||||
var w = walletFactory.create(opts);
|
||||
w.on('created', function(){
|
||||
$location.path('peer');
|
||||
$rootScope.wallet = w;
|
||||
$rootScope.$digest();
|
||||
});
|
||||
w.on('openError', function(){
|
||||
$scope.loading = false;
|
||||
$rootScope.flashMessage = {type:'error', message: 'Wallet not found'};
|
||||
$location.path('signin');
|
||||
});
|
||||
w.netStart();
|
||||
};
|
||||
|
||||
});
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copay.signin').controller('SigninController',
|
||||
function($scope, $rootScope, $location, Network) {
|
||||
function($scope, $rootScope, $location, walletFactory) {
|
||||
|
||||
// var peerData = Storage.get($rootScope.walletId, 'peerData');
|
||||
// $rootScope.peerId = peerData ? peerData.peerId : null;
|
||||
|
|
@ -10,55 +10,68 @@ angular.module('copay.signin').controller('SigninController',
|
|||
$scope.selectedWalletId = false;
|
||||
|
||||
$scope.listWalletIds = function() {
|
||||
return copay.Wallet.factory.getWalletIds();
|
||||
return walletFactory.getWalletIds();
|
||||
};
|
||||
|
||||
var _setupUxHandlers = function(w) {
|
||||
w.on('created', function() {
|
||||
$location.path('peer');
|
||||
$rootScope.wallet = w;
|
||||
$rootScope.$digest();
|
||||
});
|
||||
w.on('refresh', function() {
|
||||
|
||||
console.log('[signin.js.23] RECEIVED REFRESH'); //TODO
|
||||
$rootScope.$digest();
|
||||
});
|
||||
|
||||
w.on('openError', function(){
|
||||
$scope.loading = false;
|
||||
$rootScope.flashMessage = {type:'error', message: 'Wallet not found'};
|
||||
$location.path('signin');
|
||||
});
|
||||
};
|
||||
|
||||
$scope.create = function() {
|
||||
$scope.loading = true;
|
||||
|
||||
Network.createWallet();
|
||||
Network.init(function() {
|
||||
$location.path('peer');
|
||||
$rootScope.$digest();
|
||||
});
|
||||
$location.path('setup');
|
||||
};
|
||||
|
||||
$scope.open = function(walletId) {
|
||||
$scope.loading = true;
|
||||
|
||||
Network.openWallet(walletId);
|
||||
|
||||
if ($rootScope.wallet && $rootScope.wallet.id) {
|
||||
Network.init(function() {
|
||||
$location.path('peer');
|
||||
$rootScope.$digest();
|
||||
});
|
||||
}
|
||||
else {
|
||||
$scope.loading = false;
|
||||
$rootScope.flashMessage = {type:'error', message: 'Wallet not found'};
|
||||
$location.path('signin');
|
||||
}
|
||||
var w = walletFactory.open(walletId);
|
||||
_setupUxHandlers(w);
|
||||
w.netStart();
|
||||
};
|
||||
|
||||
$scope.join = function(cid) {
|
||||
console.log('[signin.js.42:join:]'); //TODO
|
||||
$scope.loading = true;
|
||||
|
||||
if (cid) {
|
||||
Network.init(function() {
|
||||
Network.connect(cid,
|
||||
function() {
|
||||
$location.path('peer');
|
||||
$rootScope.$digest();
|
||||
}, function() {
|
||||
$rootScope.flashMessage = { message: 'Connection refussed', type: 'error'};
|
||||
$location.path('home');
|
||||
$rootScope.$digest();
|
||||
});
|
||||
});
|
||||
}
|
||||
walletFactory.connectTo(cid, function(w) {
|
||||
console.log('[signin.js.50]'); //TODO
|
||||
_setupUxHandlers(w);
|
||||
w.netStart();
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// if (cid) {
|
||||
// var w = walletFactory.(walletId);
|
||||
//TODO
|
||||
// Network.init(null, function() {
|
||||
// Network.connect(cid,
|
||||
// function() {
|
||||
// $location.path('peer');
|
||||
// $rootScope.$digest();
|
||||
// }, function() {
|
||||
// $rootScope.flashMessage = { message: 'Connection refussed', type: 'error'};
|
||||
// $location.path('home');
|
||||
// $rootScope.$digest();
|
||||
// });
|
||||
// });
|
||||
// }
|
||||
|
||||
// if (peerData && peerData.peerId && peerData.connectedPeers.length > 0) {
|
||||
// $rootScope.peerId = peerData.peerId;
|
||||
// $scope.join(peerData.connectedPeers);
|
||||
|
|
|
|||
|
|
@ -24,4 +24,11 @@ angular.module('copay.transactions').controller('TransactionsController',
|
|||
];
|
||||
|
||||
$scope.txsoutput = $rootScope.wallet.getTxProposals();
|
||||
|
||||
$scope.sign = function (ntxid) {
|
||||
var w = $rootScope.wallet;
|
||||
var ret = w.sign(ntxid);
|
||||
console.log('[transactions.js.28:ret:]',ret); //TODO
|
||||
$scope.txsoutput = $rootScope.wallet.getTxProposals();
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue