|
|
@ -38,10 +38,22 @@ defmodule BlockScoutWeb.TransactionInternalTransactionControllerTest do |
|
|
|
transaction = |
|
|
|
transaction = |
|
|
|
:transaction |
|
|
|
:transaction |
|
|
|
|> insert() |
|
|
|
|> insert() |
|
|
|
|> with_block() |
|
|
|
|> with_block(insert(:block, number: 1)) |
|
|
|
|
|
|
|
|
|
|
|
expected_internal_transaction = insert(:internal_transaction, transaction: transaction, index: 0) |
|
|
|
expected_internal_transaction = |
|
|
|
insert(:internal_transaction, transaction: transaction, index: 1) |
|
|
|
insert(:internal_transaction, |
|
|
|
|
|
|
|
transaction: transaction, |
|
|
|
|
|
|
|
index: 0, |
|
|
|
|
|
|
|
block_number: transaction.block_number, |
|
|
|
|
|
|
|
transaction_index: transaction.index |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
insert(:internal_transaction, |
|
|
|
|
|
|
|
transaction: transaction, |
|
|
|
|
|
|
|
index: 1, |
|
|
|
|
|
|
|
transaction_index: transaction.index, |
|
|
|
|
|
|
|
block_number: transaction.block_number |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
path = transaction_internal_transaction_path(BlockScoutWeb.Endpoint, :index, transaction.hash) |
|
|
|
path = transaction_internal_transaction_path(BlockScoutWeb.Endpoint, :index, transaction.hash) |
|
|
|
|
|
|
|
|
|
|
@ -71,11 +83,16 @@ defmodule BlockScoutWeb.TransactionInternalTransactionControllerTest do |
|
|
|
:transaction |
|
|
|
:transaction |
|
|
|
|> insert(to_address: nil) |
|
|
|
|> insert(to_address: nil) |
|
|
|
|> with_contract_creation(contract_address) |
|
|
|
|> with_contract_creation(contract_address) |
|
|
|
|> with_block() |
|
|
|
|> with_block(insert(:block, number: 7000)) |
|
|
|
|
|
|
|
|
|
|
|
internal_transaction = |
|
|
|
internal_transaction = |
|
|
|
:internal_transaction_create |
|
|
|
:internal_transaction_create |
|
|
|
|> insert(transaction: transaction, index: 0) |
|
|
|
|> insert( |
|
|
|
|
|
|
|
transaction: transaction, |
|
|
|
|
|
|
|
index: 0, |
|
|
|
|
|
|
|
block_number: transaction.block_number, |
|
|
|
|
|
|
|
transaction_index: transaction.index |
|
|
|
|
|
|
|
) |
|
|
|
|> with_contract_creation(contract_address) |
|
|
|
|> with_contract_creation(contract_address) |
|
|
|
|
|
|
|
|
|
|
|
conn = |
|
|
|
conn = |
|
|
@ -95,13 +112,26 @@ defmodule BlockScoutWeb.TransactionInternalTransactionControllerTest do |
|
|
|
transaction = |
|
|
|
transaction = |
|
|
|
:transaction |
|
|
|
:transaction |
|
|
|
|> insert() |
|
|
|
|> insert() |
|
|
|
|> with_block() |
|
|
|
|> with_block(insert(:block, number: 7000)) |
|
|
|
|
|
|
|
|
|
|
|
%InternalTransaction{index: index} = insert(:internal_transaction, transaction: transaction, index: 0) |
|
|
|
%InternalTransaction{index: index} = |
|
|
|
|
|
|
|
insert(:internal_transaction, |
|
|
|
|
|
|
|
transaction: transaction, |
|
|
|
|
|
|
|
index: 0, |
|
|
|
|
|
|
|
block_number: transaction.block_number, |
|
|
|
|
|
|
|
transaction_index: transaction.index |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
second_page_indexes = |
|
|
|
second_page_indexes = |
|
|
|
1..50 |
|
|
|
1..50 |
|
|
|
|> Enum.map(fn index -> insert(:internal_transaction, transaction: transaction, index: index) end) |
|
|
|
|> Enum.map(fn index -> |
|
|
|
|
|
|
|
insert(:internal_transaction, |
|
|
|
|
|
|
|
transaction: transaction, |
|
|
|
|
|
|
|
index: index, |
|
|
|
|
|
|
|
block_number: transaction.block_number, |
|
|
|
|
|
|
|
transaction_index: transaction.index |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
end) |
|
|
|
|> Enum.map(& &1.index) |
|
|
|
|> Enum.map(& &1.index) |
|
|
|
|
|
|
|
|
|
|
|
conn = |
|
|
|
conn = |
|
|
@ -117,7 +147,7 @@ defmodule BlockScoutWeb.TransactionInternalTransactionControllerTest do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
test "next_page_params exist if not on last page", %{conn: conn} do |
|
|
|
test "next_page_params exist if not on last page", %{conn: conn} do |
|
|
|
block = %Block{number: number} = insert(:block) |
|
|
|
block = %Block{number: number} = insert(:block, number: 7000) |
|
|
|
|
|
|
|
|
|
|
|
transaction = |
|
|
|
transaction = |
|
|
|
%Transaction{index: transaction_index} = |
|
|
|
%Transaction{index: transaction_index} = |
|
|
@ -130,7 +160,9 @@ defmodule BlockScoutWeb.TransactionInternalTransactionControllerTest do |
|
|
|
insert( |
|
|
|
insert( |
|
|
|
:internal_transaction, |
|
|
|
:internal_transaction, |
|
|
|
transaction: transaction, |
|
|
|
transaction: transaction, |
|
|
|
index: index |
|
|
|
index: index, |
|
|
|
|
|
|
|
block_number: transaction.block_number, |
|
|
|
|
|
|
|
transaction_index: transaction.index |
|
|
|
) |
|
|
|
) |
|
|
|
end) |
|
|
|
end) |
|
|
|
|
|
|
|
|
|
|
@ -144,14 +176,16 @@ defmodule BlockScoutWeb.TransactionInternalTransactionControllerTest do |
|
|
|
transaction = |
|
|
|
transaction = |
|
|
|
:transaction |
|
|
|
:transaction |
|
|
|
|> insert() |
|
|
|
|> insert() |
|
|
|
|> with_block() |
|
|
|
|> with_block(insert(:block, number: 7000)) |
|
|
|
|
|
|
|
|
|
|
|
1..2 |
|
|
|
1..2 |
|
|
|
|> Enum.map(fn index -> |
|
|
|
|> Enum.map(fn index -> |
|
|
|
insert( |
|
|
|
insert( |
|
|
|
:internal_transaction, |
|
|
|
:internal_transaction, |
|
|
|
transaction: transaction, |
|
|
|
transaction: transaction, |
|
|
|
index: index |
|
|
|
index: index, |
|
|
|
|
|
|
|
block_number: transaction.block_number, |
|
|
|
|
|
|
|
transaction_index: transaction.index |
|
|
|
) |
|
|
|
) |
|
|
|
end) |
|
|
|
end) |
|
|
|
|
|
|
|
|
|
|
|