|
|
|
@ -37,6 +37,8 @@ thinwalletCtrls.controller('TransactionDetailsCtrl', function ($scope,
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var explorerUrl = config.testnet ? config.testnetExplorerUrl : config.mainnetExplorerUrl;
|
|
|
|
|
|
|
|
|
|
var address = AccountService.getAddress();
|
|
|
|
|
var view_key = AccountService.getViewKey();
|
|
|
|
|
|
|
|
|
@ -53,26 +55,24 @@ thinwalletCtrls.controller('TransactionDetailsCtrl', function ($scope,
|
|
|
|
|
// set data to be shown in the modal window
|
|
|
|
|
$scope.ring_size = data.mixin_no;
|
|
|
|
|
$scope.fee = data.fee;
|
|
|
|
|
$scope.tx_size = Math.round(data.size*1e3) / 1e3;
|
|
|
|
|
$scope.tx_size = Math.round(data.size * 1e3) / 1e3;
|
|
|
|
|
$scope.no_confirmations = data.no_confirmations;
|
|
|
|
|
$scope.tx_height = data.tx_height;
|
|
|
|
|
$scope.tx_pub_key = data.pub_key;
|
|
|
|
|
$scope.timestamp = new Date(data.timestamp * 1000);
|
|
|
|
|
|
|
|
|
|
var total_received = data.total_received;
|
|
|
|
|
var total_sent = data.total_sent;
|
|
|
|
|
|
|
|
|
|
if ((data.spent_outputs || []).length > 0)
|
|
|
|
|
{
|
|
|
|
|
if (view_only === false)
|
|
|
|
|
{
|
|
|
|
|
for (var j = 0; j < data.spent_outputs.length; ++j)
|
|
|
|
|
{
|
|
|
|
|
// filterout wrongly guessed key images by the frontend
|
|
|
|
|
if ((data.spent_outputs || []).length > 0) {
|
|
|
|
|
if (view_only === false) {
|
|
|
|
|
for (var j = 0; j < data.spent_outputs.length; ++j) {
|
|
|
|
|
var key_image = AccountService.cachedKeyImage(
|
|
|
|
|
data.spent_outputs[j].tx_pub_key,
|
|
|
|
|
data.spent_outputs[j].out_index
|
|
|
|
|
);
|
|
|
|
|
if (data.spent_outputs[j].key_image !== key_image)
|
|
|
|
|
{
|
|
|
|
|
if (data.spent_outputs[j].key_image !== key_image) {
|
|
|
|
|
total_sent = new JSBigInt(total_sent).subtract(data.spent_outputs[j].amount);
|
|
|
|
|
data.spent_outputs.splice(j, 1);
|
|
|
|
|
j--;
|
|
|
|
@ -83,11 +83,27 @@ thinwalletCtrls.controller('TransactionDetailsCtrl', function ($scope,
|
|
|
|
|
|
|
|
|
|
$scope.tx_amount = new JSBigInt(total_received || 0).subtract(total_sent || 0).toString();
|
|
|
|
|
|
|
|
|
|
console.log($scope.tx_amount);
|
|
|
|
|
// decrypt payment_id8 which results in using
|
|
|
|
|
// integrated address
|
|
|
|
|
if (data.payment_id.length == 16) {
|
|
|
|
|
if (data.pub_key) {
|
|
|
|
|
var decrypted_payment_id8
|
|
|
|
|
= decrypt_payment_id(data.payment_id,
|
|
|
|
|
data.pub_key,
|
|
|
|
|
AccountService.getViewKey());
|
|
|
|
|
//console.log("decrypted_payment_id8: " + decrypted_payment_id8);
|
|
|
|
|
data.payment_id = decrypted_payment_id8;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$scope.payment_id = data.payment_id;
|
|
|
|
|
|
|
|
|
|
//console.log($scope.tx_amount);
|
|
|
|
|
|
|
|
|
|
}, function(data) {
|
|
|
|
|
$scope.error = 'Failed to get tx detailed from the backend';
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$scope.explorerLink = explorerUrl + "tx/" + tx_hash;
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|