|
|
@ -9,7 +9,7 @@ defmodule BlockScoutWeb.API.RPC.AddressView do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def render("balance.json", %{addresses: [address]}) do |
|
|
|
def render("balance.json", %{addresses: [address]}) do |
|
|
|
RPCView.render("show.json", data: "#{address.fetched_coin_balance.value}") |
|
|
|
RPCView.render("show.json", data: "#{balance(address)}") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def render("balance.json", assigns) do |
|
|
|
def render("balance.json", assigns) do |
|
|
@ -21,7 +21,7 @@ defmodule BlockScoutWeb.API.RPC.AddressView do |
|
|
|
Enum.map(addresses, fn address -> |
|
|
|
Enum.map(addresses, fn address -> |
|
|
|
%{ |
|
|
|
%{ |
|
|
|
"account" => "#{address.hash}", |
|
|
|
"account" => "#{address.hash}", |
|
|
|
"balance" => "#{address.fetched_coin_balance.value}" |
|
|
|
"balance" => "#{balance(address)}" |
|
|
|
} |
|
|
|
} |
|
|
|
end) |
|
|
|
end) |
|
|
|
|
|
|
|
|
|
|
@ -157,4 +157,10 @@ defmodule BlockScoutWeb.API.RPC.AddressView do |
|
|
|
"symbol" => token.symbol |
|
|
|
"symbol" => token.symbol |
|
|
|
} |
|
|
|
} |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
defp balance(address) do |
|
|
|
|
|
|
|
balance = address.fetched_coin_balance && address.fetched_coin_balance.value |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
balance || 0 |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|