Handle NotLoaded

pull/9062/head
Lymarenko Lev 11 months ago
parent 0db3a3173f
commit 1ba76320a3
  1. 15
      apps/explorer/lib/explorer/microservice_interfaces/bens.ex

@ -273,7 +273,12 @@ defmodule Explorer.MicroserviceInterfaces.BENS do
from_address_hash: from_address_hash, from_address_hash: from_address_hash,
token_transfers: token_transfers token_transfers: token_transfers
}) do }) do
token_transfers_addresses = List.flatten(Enum.map(token_transfers, &item_to_address_hash_strings/1)) token_transfers_addresses =
case token_transfers do
%NotLoaded{} -> []
_ -> List.flatten(Enum.map(token_transfers, &item_to_address_hash_strings/1))
end
[to_string(to_address_hash), to_string(from_address_hash)] ++ token_transfers_addresses [to_string(to_address_hash), to_string(from_address_hash)] ++ token_transfers_addresses
end end
@ -327,12 +332,18 @@ defmodule Explorer.MicroserviceInterfaces.BENS do
} = tx, } = tx,
names names
) do ) do
token_transfers =
case tx.token_transfers do
%NotLoaded{} -> %NotLoaded{}
token_transfers -> Enum.map(token_transfers, &put_ens_name_to_item(&1, names))
end
%Transaction{ %Transaction{
tx tx
| to_address: alter_address(tx.to_address, to_address_hash, names), | to_address: alter_address(tx.to_address, to_address_hash, names),
created_contract_address: alter_address(tx.created_contract_address, created_contract_address_hash, names), created_contract_address: alter_address(tx.created_contract_address, created_contract_address_hash, names),
from_address: alter_address(tx.from_address, from_address_hash, names), from_address: alter_address(tx.from_address, from_address_hash, names),
token_transfers: Enum.map(tx.token_transfers, &put_ens_name_to_item(&1, names)) token_transfers: token_transfers
} }
end end

Loading…
Cancel
Save