|
|
@ -17,7 +17,7 @@ defmodule BlockScoutWeb.MicroserviceInterfaces.TransactionInterpretation do |
|
|
|
@api_true api?: true |
|
|
|
@api_true api?: true |
|
|
|
@items_limit 50 |
|
|
|
@items_limit 50 |
|
|
|
|
|
|
|
|
|
|
|
@spec interpret(any) :: {:error, :disabled | binary} | {:ok, any} |
|
|
|
@spec interpret(Transaction.t()) :: {:error, :disabled | binary} | {:ok, any} |
|
|
|
def interpret(transaction) do |
|
|
|
def interpret(transaction) do |
|
|
|
if enabled?() do |
|
|
|
if enabled?() do |
|
|
|
url = interpret_url() |
|
|
|
url = interpret_url() |
|
|
@ -64,7 +64,7 @@ defmodule BlockScoutWeb.MicroserviceInterfaces.TransactionInterpretation do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
defp prepare_request_body(transaction) do |
|
|
|
defp prepare_request_body(transaction) do |
|
|
|
preloaded_transaction = |
|
|
|
transaction = |
|
|
|
Chain.select_repo(@api_true).preload(transaction, [ |
|
|
|
Chain.select_repo(@api_true).preload(transaction, [ |
|
|
|
:transaction_actions, |
|
|
|
:transaction_actions, |
|
|
|
to_address: [:names, :smart_contract], |
|
|
|
to_address: [:names, :smart_contract], |
|
|
@ -79,13 +79,12 @@ defmodule BlockScoutWeb.MicroserviceInterfaces.TransactionInterpretation do |
|
|
|
|
|
|
|
|
|
|
|
%{ |
|
|
|
%{ |
|
|
|
data: %{ |
|
|
|
data: %{ |
|
|
|
to: |
|
|
|
to: Helper.address_with_info(nil, transaction.to_address, transaction.to_address_hash, true), |
|
|
|
Helper.address_with_info(nil, preloaded_transaction.to_address, preloaded_transaction.to_address_hash, true), |
|
|
|
|
|
|
|
from: |
|
|
|
from: |
|
|
|
Helper.address_with_info( |
|
|
|
Helper.address_with_info( |
|
|
|
nil, |
|
|
|
nil, |
|
|
|
preloaded_transaction.from_address, |
|
|
|
transaction.from_address, |
|
|
|
preloaded_transaction.from_address_hash, |
|
|
|
transaction.from_address_hash, |
|
|
|
true |
|
|
|
true |
|
|
|
), |
|
|
|
), |
|
|
|
hash: transaction.hash, |
|
|
|
hash: transaction.hash, |
|
|
@ -97,7 +96,7 @@ defmodule BlockScoutWeb.MicroserviceInterfaces.TransactionInterpretation do |
|
|
|
tx_types: TransactionView.tx_types(transaction), |
|
|
|
tx_types: TransactionView.tx_types(transaction), |
|
|
|
raw_input: transaction.input, |
|
|
|
raw_input: transaction.input, |
|
|
|
decoded_input: decoded_input_data, |
|
|
|
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)} |
|
|
|
logs_data: %{items: prepare_logs(transaction)} |
|
|
|
} |
|
|
|
} |
|
|
|