|
|
@ -6,17 +6,25 @@ defmodule BlockScoutWeb.AddressTokenBalanceController do |
|
|
|
|
|
|
|
|
|
|
|
def index(conn, %{"address_id" => address_hash_string} = params) do |
|
|
|
def index(conn, %{"address_id" => address_hash_string} = params) do |
|
|
|
with true <- ajax?(conn), |
|
|
|
with true <- ajax?(conn), |
|
|
|
{:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), |
|
|
|
{:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string) do |
|
|
|
{:ok, false} <- AccessHelpers.restricted_access?(address_hash_string, params) do |
|
|
|
|
|
|
|
token_balances = |
|
|
|
token_balances = |
|
|
|
address_hash |
|
|
|
address_hash |
|
|
|
|> Chain.fetch_last_token_balances() |
|
|
|
|> Chain.fetch_last_token_balances() |
|
|
|
|> Market.add_price() |
|
|
|
|> Market.add_price() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case AccessHelpers.restricted_access?(address_hash_string, params) do |
|
|
|
|
|
|
|
{:ok, false} -> |
|
|
|
conn |
|
|
|
conn |
|
|
|
|> put_status(200) |
|
|
|
|> put_status(200) |
|
|
|
|> put_layout(false) |
|
|
|
|> put_layout(false) |
|
|
|
|> render("_token_balances.html", token_balances: token_balances) |
|
|
|
|> render("_token_balances.html", token_balances: token_balances) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_ -> |
|
|
|
|
|
|
|
conn |
|
|
|
|
|
|
|
|> put_status(200) |
|
|
|
|
|
|
|
|> put_layout(false) |
|
|
|
|
|
|
|
|> render("_token_balances.html", token_balances: []) |
|
|
|
|
|
|
|
end |
|
|
|
else |
|
|
|
else |
|
|
|
_ -> |
|
|
|
_ -> |
|
|
|
not_found(conn) |
|
|
|
not_found(conn) |
|
|
|