From 1ba76320a3f64a8c25dcc7568f1e8d379def84f8 Mon Sep 17 00:00:00 2001 From: Lymarenko Lev Date: Tue, 26 Dec 2023 18:03:31 +0700 Subject: [PATCH] Handle NotLoaded --- .../lib/explorer/microservice_interfaces/bens.ex | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/apps/explorer/lib/explorer/microservice_interfaces/bens.ex b/apps/explorer/lib/explorer/microservice_interfaces/bens.ex index 02e42b24cf..e70c2606e7 100644 --- a/apps/explorer/lib/explorer/microservice_interfaces/bens.ex +++ b/apps/explorer/lib/explorer/microservice_interfaces/bens.ex @@ -273,7 +273,12 @@ defmodule Explorer.MicroserviceInterfaces.BENS do from_address_hash: from_address_hash, token_transfers: token_transfers }) 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 end @@ -327,12 +332,18 @@ defmodule Explorer.MicroserviceInterfaces.BENS do } = tx, names ) 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{ tx | 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), 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