Added View Raw TX JSON

This commit is contained in:
Vamsi Krishna B 2022-06-03 15:05:46 +05:30
parent 4c6de231ac
commit 71a91900ad
3 changed files with 23 additions and 0 deletions

View File

@ -6,4 +6,13 @@ defmodule ZcashExplorerWeb.TransactionController do
tx_data = Zcashex.Transaction.from_map(tx)
render(conn, "tx.html", tx: tx_data, page_title: "Zcash Transaction #{txid}")
end
def get_raw_transaction(conn, %{"txid" => txid}) do
{:ok, tx} = Zcashex.getrawtransaction(txid, 1)
data = Poison.encode!(tx, pretty: true)
conn
|> put_resp_content_type("application/json")
|> send_resp(200, data)
end
end

View File

@ -53,6 +53,7 @@ defmodule ZcashExplorerWeb.Router do
pipe_through :api
get "/api/v1/blockchain-info", PageController, :blockchain_info_api
post "/api/vk/:hostname", PageController, :vk_from_zecwalletcli
get "/transactions/:txid/raw", TransactionController, :get_raw_transaction
end
# Other scopes may use custom stacks.

View File

@ -197,6 +197,19 @@
</dd>
</div>
<div class="sm:col-span-1">
<dt class="text-sm font-medium text-gray-500">
Raw TX
</dt>
<dd class="mt-1 text-sm text-gray-900">
<a href={'/transactions/#{@tx.txid}/raw'}>
<span class="flex-1 w-0 break-all">
JSON
</span>
</a>
</dd>
</div>
</dl>
</div>
</div>