From 3e33fc9999dabaf6e6e300616441d2035643402b Mon Sep 17 00:00:00 2001 From: Vamsi Krishna B Date: Sun, 5 Jun 2022 20:16:48 +0530 Subject: [PATCH] Fixing few tx types --- .../views/transaction_view.ex | 50 ++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/lib/zcash_explorer_web/views/transaction_view.ex b/lib/zcash_explorer_web/views/transaction_view.ex index 40dfb3d..f179cb5 100644 --- a/lib/zcash_explorer_web/views/transaction_view.ex +++ b/lib/zcash_explorer_web/views/transaction_view.ex @@ -24,6 +24,29 @@ defmodule ZcashExplorerWeb.TransactionView do "" end + def get_shielded_pool_label(tx) + when tx.vjoinsplit != nil and + length(tx.vjoinsplit) == 0 and + length(tx.vin) == 0 and + length(tx.vout) == 0 and + length(tx.vShieldedOutput) > 0 and + length(tx.vShieldedSpend) == 0 and + tx.valueBalance < 0.0 and + tx.version == 5 do + "Transferred from/to shielded pool" + end + + def get_shielded_pool_label(tx) + when tx.vjoinsplit != nil and + length(tx.vjoinsplit) == 0 and + length(tx.vin) == 0 and + length(tx.vout) > 0 and + length(tx.vShieldedOutput) == 0 and + length(tx.vShieldedSpend) == 0 and + tx.valueBalance == 0.0 do + "Transferred from shielded pool" + end + def get_shielded_pool_label(tx) when tx.vjoinsplit != nil and length(tx.vjoinsplit) == 0 and @@ -108,10 +131,23 @@ defmodule ZcashExplorerWeb.TransactionView do length(tx.vjoinsplit) == 0 and length(tx.vin) == 0 and length(tx.vout) == 0 and + length(tx.vShieldedOutput) > 0 and + length(tx.vShieldedSpend) == 0 and + tx.valueBalance < 0.0 and + tx.version == 5 do + 0 + end + + # + def get_shielded_pool_value(tx) + when tx.vjoinsplit != nil and + length(tx.vjoinsplit) == 0 and + length(tx.vin) == 0 and + length(tx.vout) > 0 and length(tx.vShieldedOutput) == 0 and length(tx.vShieldedSpend) == 0 and tx.valueBalance == 0.0 do - 0.0 + Map.get(tx, :vjoinsplit) |> Enum.reduce(0, fn x, acc -> Map.get(x, :vpub_old) + acc end) end # 0 feed tx ( not legacy ) @@ -255,6 +291,18 @@ defmodule ZcashExplorerWeb.TransactionView do fee |> format_zec() end + def unknown_tx_fees(tx) + when tx.vjoinsplit != nil and + tx.version == 5 and + length(tx.vjoinsplit) == 0 and + length(tx.vin) == 0 and + length(tx.vout) > 0 and + length(tx.vShieldedOutput) == 0 and + length(tx.vShieldedSpend) == 0 and + tx.valueBalance == 0.0 do + "¯\\_(ツ)_/¯" + end + def unknown_tx_fees(tx) when tx.vjoinsplit != nil and length(tx.vjoinsplit) == 0 and