handle a new type of tx

This commit is contained in:
Vamsi Krishna B 2022-06-01 00:55:58 +05:30
parent 73b170595c
commit 4c6de231ac
2 changed files with 34 additions and 1 deletions

View File

@ -4,7 +4,6 @@ defmodule ZcashExplorerWeb.TransactionController do
def get_transaction(conn, %{"txid" => txid}) do
{:ok, tx} = Zcashex.getrawtransaction(txid, 1)
tx_data = Zcashex.Transaction.from_map(tx)
IO.inspect(tx_data)
render(conn, "tx.html", tx: tx_data, page_title: "Zcash Transaction #{txid}")
end
end

View File

@ -24,6 +24,17 @@ 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 do
"Transferred from/to shielded pool"
end
def get_shielded_pool_label(tx)
when tx.vjoinsplit != nil and
length(tx.vjoinsplit) == 0 and
@ -91,6 +102,18 @@ defmodule ZcashExplorerWeb.TransactionView do
"Transferred from shielded pool"
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
end
# 0 feed tx ( not legacy )
def get_shielded_pool_value(tx)
when tx.vjoinsplit != nil and
@ -232,6 +255,17 @@ defmodule ZcashExplorerWeb.TransactionView do
fee |> format_zec()
end
def unknown_tx_fees(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
"¯\\_(ツ)_/¯"
end
def unknown_tx_fees(tx)
when tx.vjoinsplit != nil and
length(tx.vjoinsplit) == 0 and