2014-03-26 09:18:42 -03:00
|
|
|
'use strict';
|
|
|
|
|
|
2014-03-28 14:08:14 -04:00
|
|
|
angular.module('copay.send').controller('SendController',
|
2014-04-15 12:17:28 -03:00
|
|
|
function($scope, $rootScope, $location, Network) {
|
2014-03-26 09:18:42 -03:00
|
|
|
$scope.title = 'Send';
|
2014-03-31 12:48:35 -03:00
|
|
|
|
2014-04-15 12:52:28 -03:00
|
|
|
if (!$rootScope.wallet.id) {
|
2014-03-31 12:48:35 -03:00
|
|
|
$location.path('signin');
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-11 13:26:36 -03:00
|
|
|
|
|
|
|
|
$scope.sendTest = function() {
|
2014-04-15 12:52:28 -03:00
|
|
|
var w = $rootScope.wallet;
|
|
|
|
|
var pkr = w.publicKeyRing;
|
|
|
|
|
var txp = w.txProposals;
|
2014-04-11 13:26:36 -03:00
|
|
|
var opts = {remainderOut: { address: pkr.generateAddress(true).toString() }};
|
|
|
|
|
|
|
|
|
|
// From @cmgustavo's wallet
|
2014-04-15 18:23:35 -03:00
|
|
|
w.listUnspent(function (unspentTest) {
|
|
|
|
|
console.log('[send.js.19:unspentTest:]',unspentTest); //TODO
|
|
|
|
|
|
|
|
|
|
txp.create(
|
|
|
|
|
'15q6HKjWHAksHcH91JW23BJEuzZgFwydBt',
|
|
|
|
|
'123456789',
|
|
|
|
|
unspentTest,
|
|
|
|
|
w.privateKey,
|
|
|
|
|
opts
|
|
|
|
|
);
|
2014-04-11 13:26:36 -03:00
|
|
|
console.log('[send.js.29:txp:] READY:',txp); //TODO
|
|
|
|
|
|
2014-04-15 18:23:35 -03:00
|
|
|
Network.storeOpenWallet();
|
|
|
|
|
Network.sendTxProposals();
|
|
|
|
|
$rootScope.$digest;
|
|
|
|
|
|
|
|
|
|
});
|
2014-04-11 13:26:36 -03:00
|
|
|
};
|
2014-03-26 09:18:42 -03:00
|
|
|
});
|