fix: Missing clauses in MetadataPreloader functions (#10439)

* Missing clause in MetadataPreloader.alter_address

* Update clause for alter_address

* Add nil clause for item_to_address_hash_strings
pull/10462/head
Victor Baranov 4 months ago committed by GitHub
parent 4c36b8a82c
commit 158720ea20
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 10
      apps/explorer/lib/explorer/chain/address/metadata_preloader.ex

@ -127,6 +127,8 @@ defmodule Explorer.Chain.Address.MetadataPreloader do
end)
end
defp item_to_address_hash_strings(nil), do: []
defp item_to_address_hash_strings(%Transaction{
to_address_hash: to_address_hash,
created_contract_address_hash: created_contract_address_hash,
@ -285,14 +287,16 @@ defmodule Explorer.Chain.Address.MetadataPreloader do
alter_address(address, address.hash, names, field_to_put_info)
end
defp alter_address(_, nil, _names, _field) do
nil
end
defp alter_address(address, nil, _names, _field), do: address
defp alter_address(%NotLoaded{}, address_hash, names, field) do
%{field => names[Address.checksum(address_hash)]}
end
defp alter_address(nil, address_hash, names, field) do
%{field => names[Address.checksum(address_hash)]}
end
defp alter_address(%Address{} = address, address_hash, names, :ens_domain_name) do
%Address{address | ens_domain_name: names[Address.checksum(address_hash)]}
end

Loading…
Cancel
Save