|
|
|
@ -246,16 +246,25 @@ defmodule BlockScoutWeb.API.V2.TransactionView do |
|
|
|
|
} |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
# credo:disable-for-next-line /Complexity/ |
|
|
|
|
def prepare_token_transfer_total(token_transfer) do |
|
|
|
|
case TokensHelper.token_transfer_amount_for_api(token_transfer) do |
|
|
|
|
{:ok, :erc721_instance} -> |
|
|
|
|
%{"token_id" => List.first(token_transfer.token_ids)} |
|
|
|
|
%{"token_id" => token_transfer.token_ids && List.first(token_transfer.token_ids)} |
|
|
|
|
|
|
|
|
|
{:ok, :erc1155_instance, value, decimals} -> |
|
|
|
|
%{"token_id" => List.first(token_transfer.token_ids), "value" => value, "decimals" => decimals} |
|
|
|
|
%{ |
|
|
|
|
"token_id" => token_transfer.token_ids && List.first(token_transfer.token_ids), |
|
|
|
|
"value" => value, |
|
|
|
|
"decimals" => decimals |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
{:ok, :erc1155_instance, values, token_ids, decimals} -> |
|
|
|
|
%{"token_id" => List.first(token_ids), "value" => List.first(values), "decimals" => decimals} |
|
|
|
|
%{ |
|
|
|
|
"token_id" => token_ids && List.first(token_ids), |
|
|
|
|
"value" => values && List.first(values), |
|
|
|
|
"decimals" => decimals |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
{:ok, value, decimals} -> |
|
|
|
|
%{"value" => value, "decimals" => decimals} |
|
|
|
|