diff --git a/src/Controller/MainController.php b/src/Controller/MainController.php index e6edb6b..d3b9111 100644 --- a/src/Controller/MainController.php +++ b/src/Controller/MainController.php @@ -370,9 +370,20 @@ class MainController extends AppController { $block = $this->Blocks->find()->select(['confirmations', 'height'])->where(['hash' => $tx->block_hash_id])->first(); $confirmations = $block->confirmations; $inputs = $this->Inputs->find()->where(['transaction_id' => $tx->id])->order(['prevout_n' => 'asc'])->toArray(); - $inputAddresses = $this->Addresses->find()->where(['input_address_id'])->toArray(); + foreach($inputs as $input) { + $inputAddresses = $this->Addresses->find()->where(['id' => 'input_address_id'])->toArray(); + $input->input_addresses = $inputAddresses; + } + $outputs = $this->Outputs->find()->where(['transaction_id' => $tx->id])->order(['vout' => 'asc'])->toArray(); for ($i = 0; $i < count($outputs); $i++) { + $spend_input = $this->Inputs->find()->select(['transaction_hash', 'id'])->where(['id' => $outputs[$i]->spent_by_input_id])->first(); + $outputs[$i]->spend_input = $spend_input; + + $output_address = trim($outputs[$i]->address_list, '[""]'); + $address = $this->Addresses->find()->select(['address'])->where(['address' => $output_address])->first(); + $outputs[$i]->output_addresses = [$address]; + $outputs[$i]->IsClaim = (strpos($outputs[$i]->script_pub_key_asm, 'CLAIM') > -1); $outputs[$i]->IsSupportClaim = (strpos($outputs[$i]->script_pub_key_asm, 'SUPPORT_CLAIM') > -1); $outputs[$i]->IsUpdateClaim = (strpos($outputs[$i]->script_pub_key_asm, 'UPDATE_CLAIM') > -1); diff --git a/src/Template/Main/tx.ctp b/src/Template/Main/tx.ctp index 7372812..92ca341 100644 --- a/src/Template/Main/tx.ctp +++ b/src/Template/Main/tx.ctp @@ -92,14 +92,14 @@ $setAddressIds = []; foreach ($inputs as $in): ?> -
+
is_coinbase): ?>
Block Reward (New Coins)
value)) == 0): ?>
Incomplete data
input_addresses[0]; if (!isset($setAddressIds[$addr->address])): $setAddressIds[$addr->address] = 1; ?> @@ -108,6 +108,7 @@
Amount->format($in->value) ?> LBC from
address ?> (output) + Tag) && strlen(trim($addr->Tag)) > 0): ?>
TagUrl)) > 0): ?>Tag ?>Tag; endif; ?> @@ -134,7 +135,7 @@ -
+
Claim && ($out->IsClaim or $out->IsSupportClaim or $out->IsUpdateClaim)): ?>View IsSupportClaim): ?>
SUPPORT
@@ -142,19 +143,19 @@ IsClaim): ?>
CLAIM
- + value)) == 0): ?>
Incomplete data
output_addresses[0]; - if (!isset($setAddressIds[$addr->Address])): - $setAddressIds[$addr->Address] = 1; ?> - + if (!isset($setAddressIds[$addr->address])): + $setAddressIds[$addr->address] = 1; ?> + -
Amount->format($out['Value']) ?> LBC to
-
address ?> +
Amount->format($out->value) ?> LBC to
+
address ?> - is_spent): ?>(spent)(unspent) + is_spent): ?>(spent)(unspent) Tag) && strlen(trim($addr->Tag)) > 0): ?>