txproposal comuninication between peers. Still WIP

This commit is contained in:
Matias Alejo Garcia 2014-04-11 13:26:36 -03:00
commit 333ecb352a
12 changed files with 282 additions and 124 deletions

View file

@ -5,6 +5,9 @@ angular.module('copay.header').controller('HeaderController',
$scope.menu = [{
'title': 'Home',
'link': '#/home'
}, {
'title': 'Copayers',
'link': '#/peer'
}, {
'title': 'Transactions',
'link': '#/transactions'

View file

@ -1,11 +1,43 @@
'use strict';
angular.module('copay.send').controller('SendController',
function($scope, $rootScope, $location) {
function($scope, $rootScope, $location, Network, Storage) {
$scope.title = 'Send';
if (!$rootScope.peerId) {
$location.path('signin');
}
$scope.sendTest = function() {
var pkr = $rootScope.publicKeyRing;
var txp = $rootScope.txProposals;
var opts = {remainderOut: { address: pkr.generateAddress(true).toString() }};
// From @cmgustavo's wallet
var unspentTest = [{
"txid": "2ac165fa7a3a2b535d106a0041c7568d03b531e58aeccdd3199d7289ab12cfc1",
"vout": 1,
"amount": 10,
"confirmations":7
}];
unspentTest[0].address = pkr.generateAddress(false).toString();
unspentTest[0].scriptPubKey = pkr.getScriptPubKeyHex(false);
console.log('[send.js.29:txp:] BEFORE',txp); //TODO
txp.create(
'15q6HKjWHAksHcH91JW23BJEuzZgFwydBt',
'123456789',
unspentTest,
$rootScope.privateKey,
opts
);
console.log('[send.js.29:txp:] READY:',txp); //TODO
Network.storeOpenWallet();
Network.sendTxProposals();
$rootScope.$digest;
};
});

View file

@ -25,6 +25,7 @@ angular.module('copay.signin').controller('SigninController',
$scope.open = function(walletId) {
$scope.loading = true;
console.log('[signin.js.28:walletId:]',walletId); //TODO
if (Network.openWallet(walletId)) {
Network.init(function() {
$location.path('peer');