We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cd0c331 commit b23698bCopy full SHA for b23698b
3 files changed
explorer/lib/explorer_web/components/batches_table.ex
@@ -38,7 +38,12 @@ defmodule ExplorerWeb.BatchesTable do
38
<%= "N/A" %>
39
<% end %>
40
<.tooltip>
41
- ~= <%= EthConverter.wei_to_eth(batch.fee_per_proof, 6) %> ETH
+ <%= case EthConverter.wei_to_eth(batch.fee_per_proof, 6) do %>
42
+ <% nil -> %>
43
+ <%= "N/A" %>
44
+ <% eth -> %>
45
+ <%= "~= #{eth} ETH" %>
46
+ <% end %>
47
</.tooltip>
48
</:col>
49
explorer/lib/explorer_web/live/eth_converter.ex
@@ -31,7 +31,11 @@ defmodule EthConverter do
31
|> wei_to_eth(decimal_places)
32
end
33
34
- def wei_to_usd(wei, decimal_places \\ 0) do
+ def wei_to_usd(wei, decimal_places \\ 0)
35
+
36
+ def wei_to_usd(nil, _), do: {:error, "nil value"}
37
+ def wei_to_usd(wei, decimal_places) do
with eth_amount <- wei_to_eth(wei, 18),
{:ok, eth_price} <- get_eth_price_usd() do
usd_value =
@@ -43,8 +47,11 @@ defmodule EthConverter do
50
+ def wei_to_usd_sf(wei, significant_figures \\ 3)
51
+ def wei_to_usd_sf(nil, _), do: {:error, "nil value"}
52
53
# rounds to significant figures, instead of decimal places
- def wei_to_usd_sf(wei, significant_figures \\ 3) do
54
+ def wei_to_usd_sf(wei, significant_figures) do
55
56
57
explorer/lib/explorer_web/live/pages/batch/index.html.heex
@@ -39,7 +39,7 @@
</h3>
<p><%= @current_batch.amount_of_proofs %></p>
</div>
- <div :if={@current_batch.fee_per_proof != 0} class="flex flex-col sm:flex-row">
+ <div :if={!is_nil(@current_batch.fee_per_proof)} class="flex flex-col sm:flex-row">
<h3>
Fee per Proof:
0 commit comments