diff --git a/apps/block_scout_web/lib/block_scout_web/microservice_interfaces/transaction_interpretation.ex b/apps/block_scout_web/lib/block_scout_web/microservice_interfaces/transaction_interpretation.ex index 8ad149081d..30a7f95be0 100644 --- a/apps/block_scout_web/lib/block_scout_web/microservice_interfaces/transaction_interpretation.ex +++ b/apps/block_scout_web/lib/block_scout_web/microservice_interfaces/transaction_interpretation.ex @@ -17,7 +17,7 @@ defmodule BlockScoutWeb.MicroserviceInterfaces.TransactionInterpretation do @api_true api?: true @items_limit 50 - @spec interpret(any) :: {:error, :disabled | binary} | {:ok, any} + @spec interpret(Transaction.t()) :: {:error, :disabled | binary} | {:ok, any} def interpret(transaction) do if enabled?() do url = interpret_url() @@ -64,7 +64,7 @@ defmodule BlockScoutWeb.MicroserviceInterfaces.TransactionInterpretation do end defp prepare_request_body(transaction) do - preloaded_transaction = + transaction = Chain.select_repo(@api_true).preload(transaction, [ :transaction_actions, to_address: [:names, :smart_contract], @@ -79,13 +79,12 @@ defmodule BlockScoutWeb.MicroserviceInterfaces.TransactionInterpretation do %{ data: %{ - to: - Helper.address_with_info(nil, preloaded_transaction.to_address, preloaded_transaction.to_address_hash, true), + to: Helper.address_with_info(nil, transaction.to_address, transaction.to_address_hash, true), from: Helper.address_with_info( nil, - preloaded_transaction.from_address, - preloaded_transaction.from_address_hash, + transaction.from_address, + transaction.from_address_hash, true ), hash: transaction.hash, @@ -97,7 +96,7 @@ defmodule BlockScoutWeb.MicroserviceInterfaces.TransactionInterpretation do tx_types: TransactionView.tx_types(transaction), raw_input: transaction.input, decoded_input: decoded_input_data, - token_transfers: prepare_token_transfers(preloaded_transaction, decoded_input) + token_transfers: prepare_token_transfers(transaction, decoded_input) }, logs_data: %{items: prepare_logs(transaction)} } diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/v2/transaction_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/v2/transaction_view.ex index 3314b06e58..a94cecbcf5 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/api/v2/transaction_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/api/v2/transaction_view.ex @@ -720,15 +720,17 @@ defmodule BlockScoutWeb.API.V2.TransactionView do @spec tx_types( Explorer.Chain.Transaction.t(), - list, - :coin_transfer - | :contract_call - | :contract_creation - | :rootstock_bridge - | :rootstock_remasc - | :token_creation - | :token_transfer - ) :: list + [tx_type], + tx_type + ) :: [tx_type] + when tx_type: + :coin_transfer + | :contract_call + | :contract_creation + | :rootstock_bridge + | :rootstock_remasc + | :token_creation + | :token_transfer def tx_types(tx, types \\ [], stage \\ :token_transfer) def tx_types(%Transaction{token_transfers: token_transfers} = tx, types, :token_transfer) do diff --git a/config/runtime.exs b/config/runtime.exs index 8fe99566ef..3b530be178 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -133,8 +133,8 @@ config :block_scout_web, BlockScoutWeb.Chain.Address.CoinBalance, config :block_scout_web, BlockScoutWeb.API.V2, enabled: ConfigHelper.parse_bool_env_var("API_V2_ENABLED", "true") config :block_scout_web, BlockScoutWeb.MicroserviceInterfaces.TransactionInterpretation, - service_url: System.get_env("MICROSERVICE_TX_INTERPRETATION_URL"), - enabled: ConfigHelper.parse_bool_env_var("MICROSERVICE_TX_INTERPRETATION_ENABLED") + service_url: System.get_env("MICROSERVICE_TRANSACTION_INTERPRETATION_URL"), + enabled: ConfigHelper.parse_bool_env_var("MICROSERVICE_TRANSACTION_INTERPRETATION_ENABLED") # Configures Ueberauth's Auth0 auth provider config :ueberauth, Ueberauth.Strategy.Auth0.OAuth,