@ -1,9 +1,7 @@
defmodule BlockScoutWeb.API.V2.TransactionControllerTest do
use BlockScoutWeb.ConnCase
import EthereumJSONRPC , only : [ integer_to_quantity : 1 ]
import Explorer.Chain , only : [ hash_to_lower_case_string : 1 ]
import Mox
alias BlockScoutWeb.Models.UserFromAuth
alias Explorer.Account.WatchlistAddress
@ -964,36 +962,6 @@ defmodule BlockScoutWeb.API.V2.TransactionControllerTest do
assert Address . checksum ( transaction . to_address_hash ) == json [ " to " ] [ " hash " ]
end
defp compare_item ( % Transaction { } = transaction , json , wl_names ) do
assert to_string ( transaction . hash ) == json [ " hash " ]
assert transaction . block_number == json [ " block " ]
assert to_string ( transaction . value . value ) == json [ " value " ]
assert Address . checksum ( transaction . from_address_hash ) == json [ " from " ] [ " hash " ]
assert Address . checksum ( transaction . to_address_hash ) == json [ " to " ] [ " hash " ]
assert json [ " to " ] [ " watchlist_names " ] ==
if ( wl_names [ transaction . to_address_hash ] ,
do : [
%{
" display_name " = > wl_names [ transaction . to_address_hash ] ,
" label " = > wl_names [ transaction . to_address_hash ]
}
] ,
else : [ ]
)
assert json [ " from " ] [ " watchlist_names " ] ==
if ( wl_names [ transaction . from_address_hash ] ,
do : [
%{
" display_name " = > wl_names [ transaction . from_address_hash ] ,
" label " = > wl_names [ transaction . from_address_hash ]
}
] ,
else : [ ]
)
end
defp compare_item ( % InternalTransaction { } = internal_tx , json ) do
assert internal_tx . block_number == json [ " block " ]
assert to_string ( internal_tx . gas ) == json [ " gas_limit " ]
@ -1029,10 +997,26 @@ defmodule BlockScoutWeb.API.V2.TransactionControllerTest do
assert Address . checksum ( transaction . to_address_hash ) == json [ " to " ] [ " hash " ]
assert json [ " to " ] [ " watchlist_names " ] ==
if ( wl_names [ transaction . to_address_hash ] , do : [ wl_names [ transaction . to_address_hash ] ] , else : [ ] )
if ( wl_names [ transaction . to_address_hash ] ,
do : [
%{
" display_name " = > wl_names [ transaction . to_address_hash ] ,
" label " = > wl_names [ transaction . to_address_hash ]
}
] ,
else : [ ]
)
assert json [ " from " ] [ " watchlist_names " ] ==
if ( wl_names [ transaction . from_address_hash ] , do : [ wl_names [ transaction . from_address_hash ] ] , else : [ ] )
if ( wl_names [ transaction . from_address_hash ] ,
do : [
%{
" display_name " = > wl_names [ transaction . from_address_hash ] ,
" label " = > wl_names [ transaction . from_address_hash ]
}
] ,
else : [ ]
)
end
defp check_paginated_response ( first_page_resp , second_page_resp , txs ) do