fix: Add tx_count, tx_types props in the response of address API v2 endpoints for compatibility with current version of the frontend (#11012)

production-blackfort
Victor Baranov 4 weeks ago committed by GitHub
parent b370c0014f
commit d3d768a5ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      apps/block_scout_web/lib/block_scout_web/microservice_interfaces/transaction_interpretation.ex
  2. 2
      apps/block_scout_web/lib/block_scout_web/views/api/v2/address_view.ex

@ -160,6 +160,8 @@ defmodule BlockScoutWeb.MicroserviceInterfaces.TransactionInterpretation do
value: transaction_with_meta.value,
method: Transaction.method_name(transaction_with_meta, Transaction.format_decoded_input(decoded_input)),
status: transaction_with_meta.status,
# todo: keep `tx_types` for compatibility with interpreter and remove when new interpreter is bound to `transaction_types` property
tx_types: TransactionView.transaction_types(transaction_with_meta),
transaction_types: TransactionView.transaction_types(transaction_with_meta),
raw_input: transaction_with_meta.input,
decoded_input: decoded_input_data,

@ -81,6 +81,8 @@ defmodule BlockScoutWeb.API.V2.AddressView do
def prepare_address({address, transaction_count}) do
nil
|> Helper.address_with_info(address, address.hash, true)
# todo: keep `tx_count` for compatibility with frontend and remove when new frontend is bound to `transaction_count` property
|> Map.put(:tx_count, to_string(transaction_count))
|> Map.put(:transaction_count, to_string(transaction_count))
|> Map.put(:coin_balance, if(address.fetched_coin_balance, do: address.fetched_coin_balance.value))
end

Loading…
Cancel
Save