mirror of https://github.com/BTCPrivate/copay.git
parse output TX to show before signing (WIP)
This commit is contained in:
parent
5eca1a63c2
commit
1954978202
|
@ -237,8 +237,8 @@ missing. Ask your copayers to join your session: <b>{{$root.wallet.network.peerI
|
||||||
<div class="transactions" data-ng-controller="TransactionsController">
|
<div class="transactions" data-ng-controller="TransactionsController">
|
||||||
<div class="row" ng-show='$root.wallet.publicKeyRing.isComplete()'>
|
<div class="row" ng-show='$root.wallet.publicKeyRing.isComplete()'>
|
||||||
<div class="large-12 columns">
|
<div class="large-12 columns">
|
||||||
<h3>Pending Transactions <small>({{txsoutput.length}})</small></h3>
|
<h3>Pending Transactions <small>({{txs.length}})</small></h3>
|
||||||
<div class="panel pending" ng-repeat="txp in txsoutput">
|
<div class="panel pending" ng-repeat="txp in txs">
|
||||||
{{txp}}
|
{{txp}}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<p class="large-5 columns"> Address 1</p>
|
<p class="large-5 columns"> Address 1</p>
|
||||||
|
|
|
@ -15,7 +15,7 @@ angular.module('copay.send').controller('SendController',
|
||||||
|
|
||||||
$scope.sendTest = function() {
|
$scope.sendTest = function() {
|
||||||
var w = $rootScope.wallet;
|
var w = $rootScope.wallet;
|
||||||
w.createTx( '15q6HKjWHAksHcH91JW23BJEuzZgFwydBt', '12345',function() {
|
w.createTx( 'mimoZNLcP2rrMRgdeX5PSnR7AjCqQveZZ4', '12345',function() {
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,25 +6,35 @@ angular.module('copay.transactions').controller('TransactionsController',
|
||||||
|
|
||||||
$scope.oneAtATime = true;
|
$scope.oneAtATime = true;
|
||||||
|
|
||||||
|
var _updateTxs = function() {
|
||||||
|
var inT = $rootScope.wallet.getTxProposals();
|
||||||
|
var ts = [];
|
||||||
|
inT.forEach(function(i){
|
||||||
|
var b =i.txp.builder;
|
||||||
|
var tx = b.build();
|
||||||
|
var one = {
|
||||||
|
valueOutSat: b.valueOutSat,
|
||||||
|
feeSat: b.feeSat,
|
||||||
|
};
|
||||||
|
var outs = [];
|
||||||
|
var bitcore = require('bitcore');
|
||||||
|
tx.outs.forEach(function(o) {
|
||||||
|
var s = o.getScript();
|
||||||
|
var aStr = bitcore.Address.fromScript(s, config.networkName).toString();
|
||||||
|
outs.push({address: aStr, value: bitcore.util.valueToBigInt(o.getValue())});
|
||||||
|
});
|
||||||
|
one.outs = outs;
|
||||||
|
ts.push(one);
|
||||||
|
});
|
||||||
|
$scope.txs = ts;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
if (!$rootScope.wallet || !$rootScope.wallet.id) {
|
if (!$rootScope.wallet || !$rootScope.wallet.id) {
|
||||||
$location.path('signin');
|
$location.path('signin');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$scope.txsinput = [
|
_updateTxs();
|
||||||
{
|
|
||||||
fromAddr: "n3zUqNR7Bbbc4zJhPVj1vG2Lx66K3Xhzvb",
|
|
||||||
toAddr: "msvv2mDfE298s7boXwALq4Dqv77K3TWRZ1",
|
|
||||||
amount: 23.9982
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fromAddr: "my9wnLwwUrwpNfEgSrWY62ymEGf1edKf4J",
|
|
||||||
toAddr: "monCusNiDuptf68rtr58hEjKpJt6cW6zwS",
|
|
||||||
amount: 2.22
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
$scope.txsoutput = $rootScope.wallet.getTxProposals();
|
|
||||||
|
|
||||||
var socket = Socket($scope);
|
var socket = Socket($scope);
|
||||||
socket.on('connect', controllerUtils.handleTransactionByAddress($scope));
|
socket.on('connect', controllerUtils.handleTransactionByAddress($scope));
|
||||||
}
|
}
|
||||||
|
@ -33,6 +43,7 @@ angular.module('copay.transactions').controller('TransactionsController',
|
||||||
var w = $rootScope.wallet;
|
var w = $rootScope.wallet;
|
||||||
var ret = w.sign(ntxid);
|
var ret = w.sign(ntxid);
|
||||||
console.log('[transactions.js.28:ret:]',ret); //TODO
|
console.log('[transactions.js.28:ret:]',ret); //TODO
|
||||||
$scope.txsoutput = $rootScope.wallet.getTxProposals();
|
$rootScope.flashMessage = {type:'success', message: 'Transactions SEND! : ' + ret};
|
||||||
|
_updateTxs();
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
@ -109,8 +109,6 @@ Insight.prototype._request = function(options, callback) {
|
||||||
|
|
||||||
if (options.method === 'POST') {
|
if (options.method === 'POST') {
|
||||||
request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
||||||
request.setRequestHeader('Content-length', options.data.length);
|
|
||||||
request.setRequestHeader('Connection', 'close');
|
|
||||||
request.send(options.data);
|
request.send(options.data);
|
||||||
} else {
|
} else {
|
||||||
request.send(null);
|
request.send(null);
|
||||||
|
|
Loading…
Reference in New Issue