Heex + API for blocchaininfo
This commit is contained in:
parent
b5bd4b5bf3
commit
1cee6135d4
|
@ -155,4 +155,12 @@ defmodule ZcashExplorerWeb.PageController do
|
|||
def blockchain_info(conn, _params) do
|
||||
render(conn, "blockchain_info.html", page_title: "Zcash Blockchain Info")
|
||||
end
|
||||
|
||||
def blockchain_info_api(conn, _params) do
|
||||
{:ok, info} = Cachex.get(:app_cache, "metrics")
|
||||
{:ok, %{"build" => build}} = Cachex.get(:app_cache, "info")
|
||||
info = Map.put(info, "build", build)
|
||||
json(conn, info)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -49,7 +49,7 @@ defmodule ZcashExplorerWeb.Router do
|
|||
|
||||
scope "/", ZcashExplorerWeb do
|
||||
pipe_through :api
|
||||
|
||||
get "/api/v1/blockchain-info", PageController, :blockchain_info_api
|
||||
post "/api/vk/:hostname", PageController, :vk_from_zecwalletcli
|
||||
end
|
||||
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
<div class="col-span-3 md:col-span-1 lg:col-span-1 sm:col-span-3">
|
||||
<div class="bg-white px-4 py-5 shadow rounded-lg sm:px-6 sticky top-10">
|
||||
|
||||
<h2 id="technical-details" class="font-medium text-gray-900">Details for the Zcash address:
|
||||
</h2>
|
||||
<h2 id="technical-details" class="font-medium text-gray-900">Details for the Zcash address:
|
||||
</h2>
|
||||
<p class="mt-1 text-lg leading-6 max-w-2xl text-gray-500 font-mono break-words">
|
||||
<%= @address %>
|
||||
</p>
|
||||
<div class="px-0">
|
||||
<img src='data:image/png;base64, <%= @qr %>' atl="QR code for the Zcash address <%= @address %>"/>
|
||||
<img src={'data:image/png;base64, #{ @qr }'} atl={"QR code for the Zcash address #{ @address }"}/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
@ -55,15 +55,13 @@
|
|||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-span-3 md:col-span-2 lg:col-span-2 sm:col-span-3
|
||||
">
|
||||
<div class="bg-white px-4 py-5 shadow rounded-lg sm:px-6">
|
||||
<div class="bg-white px-4 py-5 shadow rounded-lg sm:px-6">
|
||||
<div class="bg-white lg:min-w-0 lg:flex-1">
|
||||
<h2 class="text-2xl tracking-tight font-extrabold text-gray-900 sm:text-2xl md:text-2xl">
|
||||
<span class="block xl:inline">Transactions using Z addresses are</span>
|
||||
|
@ -71,9 +69,7 @@
|
|||
<span class="block text-indigo-600 inline">Private.</span>
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
|
@ -146,6 +146,8 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
</div>
|
||||
</section>
|
|
@ -19,12 +19,15 @@
|
|||
<%= for block <- @blocks_data do %>
|
||||
<tr class="hover:bg-indigo-50">
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-indigo-600 hover:text-indigo-500">
|
||||
<a href='/blocks/<%= block["height"] %>'>
|
||||
|
||||
<a href={'/blocks/#{block["height"]}'}>
|
||||
|
||||
<%= block["height"] %>
|
||||
</td>
|
||||
</a>
|
||||
</td>
|
||||
|
||||
<td class="px-4 py-4 whitespace-nowrap text-sm font-medium text-gray-500">
|
||||
<a href='/blocks/<%= block["hash"] %>'>
|
||||
<a href={'/blocks/#{block["hash"] }'}>
|
||||
<%= block["hash"] %>
|
||||
</a>
|
||||
</td>
|
||||
|
@ -42,6 +45,7 @@
|
|||
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
@ -51,13 +55,13 @@
|
|||
<div class="flex-1 flex justify-between sm:justify-end">
|
||||
|
||||
<%= if !@disable_previous do %>
|
||||
<a href='/blocks?date=<%= @previous %>' class="relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50">
|
||||
<a href={'/blocks?date=#{@previous}'} class="relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50">
|
||||
Previous
|
||||
</a>
|
||||
<% end %>
|
||||
|
||||
<%= if !@disable_next do %>
|
||||
<a href="/blocks?date=<%= @next %>" class="ml-3 relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50">
|
||||
<a href={'/blocks?date=#{@next}'} class="ml-3 relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50">
|
||||
Next
|
||||
</a>
|
||||
<% end %>
|
|
@ -31,7 +31,8 @@
|
|||
<dt class="text-sm font-medium text-gray-500">
|
||||
Miner
|
||||
</dt>
|
||||
<a href='/address/<%= mined_by(@block_data.tx) %>'>
|
||||
|
||||
<a href={'/address/#{mined_by(@block_data.tx)}'}>
|
||||
<dd class="mt-1 text-sm text-indigo-600 hover:text-indigo-500 break-words">
|
||||
<%= mined_by @block_data.tx %>
|
||||
</dd>
|
||||
|
@ -150,7 +151,7 @@
|
|||
</dd>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</dl>
|
||||
</div>
|
||||
</section>
|
||||
<div class="space-y-6 lg:col-start-1 lg:col-span-4">
|
||||
|
@ -188,7 +189,8 @@
|
|||
<%= @block_data.height %>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-indigo-600 hover:text-indigo-500">
|
||||
<a href='/transactions/<%= transaction.txid %>'>
|
||||
<a href={'/transactions/#{transaction.txid}'}>
|
||||
|
||||
<%= transaction.txid %>
|
||||
</a>
|
||||
</td>
|
|
@ -83,7 +83,7 @@
|
|||
Block Id
|
||||
</dt>
|
||||
<dd class="mt-1 text-sm text-gray-900 break-words">
|
||||
<a href='/blocks/<%= @tx.blockhash %>'>
|
||||
<a href={'/blocks/#{@tx.height}'}>
|
||||
<%= @tx.height %>
|
||||
</a>
|
||||
</dd>
|
||||
|
@ -217,7 +217,10 @@ Inputs (<%= vin_count(@tx.vin) %>)
|
|||
|
||||
<li class="pl-3 pr-4 py-3 flex items-center justify-between text-sm hover:bg-indigo-50">
|
||||
<div class="w-0 flex-1 flex items-center">
|
||||
<a href='/address/<%= input.address %>'>
|
||||
|
||||
|
||||
<a href={'/address/#{input.address}'}>
|
||||
|
||||
<span class="flex-1 w-0 break-all">
|
||||
<%= input.address %>
|
||||
</span>
|
||||
|
@ -263,29 +266,33 @@ Inputs (<%= vin_count(@tx.vin) %>)
|
|||
Outputs (<%= vout_count(@tx.vout) %>)
|
||||
|
||||
<div class="py-3">
|
||||
|
||||
<%= if vout_count(@tx.vout) > 0 do %>
|
||||
|
||||
<dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2 py-2">
|
||||
<ul class="border border-gray-200 rounded-md divide-y divide-gray-200">
|
||||
<%= for op <- @tx.vout do %>
|
||||
<%= for address <- op.scriptPubKey.addresses do %>
|
||||
|
||||
<li class="pl-2 pr-4 py-3 flex items-center justify-between text-sm hover:bg-indigo-50">
|
||||
<a href='/address/<%= address %>'>
|
||||
|
||||
<div class="w-0 flex-1 flex items-center">
|
||||
<a href={'/address/#{address }'}>
|
||||
<span class="flex-1 w-0 break-all">
|
||||
<%= address %>
|
||||
<%= address %>
|
||||
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="ml-4 flex-shrink-0 font-medium text-indigo-600 hover:text-indigo-500 break-words">
|
||||
<%= format_zec op.value %>
|
||||
</div>
|
||||
<div class="ml-4 flex-shrink-0 font-medium text-indigo-600 hover:text-indigo-500 break-words">
|
||||
<%= format_zec op.value %>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
||||
</dd>
|
||||
</dd>
|
||||
<% end %>
|
||||
|
||||
<%= if ZcashExplorerWeb.BlockView.tx_type(@tx) == "shielding" do %>
|
||||
|
@ -303,4 +310,5 @@ Outputs (<%= vout_count(@tx.vout) %>)
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</main>
|
Loading…
Reference in New Issue