Fixing few tx types

This commit is contained in:
Vamsi Krishna B 2022-06-05 20:16:48 +05:30
parent f8b35c6396
commit 3e33fc9999
1 changed files with 49 additions and 1 deletions

View File

@ -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