|
|
@ -6,215 +6,274 @@ defmodule Explorer.TransactionFormTest do |
|
|
|
describe "build/1" do |
|
|
|
describe "build/1" do |
|
|
|
test "returns a successful transaction when there is a successful receipt" do |
|
|
|
test "returns a successful transaction when there is a successful receipt" do |
|
|
|
insert(:block, number: 24) |
|
|
|
insert(:block, number: 24) |
|
|
|
time = Timex.now |> Timex.shift(hours: -2) |
|
|
|
time = Timex.now() |> Timex.shift(hours: -2) |
|
|
|
block = insert(:block, %{ |
|
|
|
|
|
|
|
number: 1, |
|
|
|
block = |
|
|
|
gas_used: 99523, |
|
|
|
insert(:block, %{ |
|
|
|
timestamp: time, |
|
|
|
number: 1, |
|
|
|
}) |
|
|
|
gas_used: 99523, |
|
|
|
|
|
|
|
timestamp: time |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
transaction = |
|
|
|
transaction = |
|
|
|
insert(:transaction, |
|
|
|
insert( |
|
|
|
|
|
|
|
:transaction, |
|
|
|
inserted_at: Timex.parse!("1970-01-01T00:00:18-00:00", "{ISO:Extended}"), |
|
|
|
inserted_at: Timex.parse!("1970-01-01T00:00:18-00:00", "{ISO:Extended}"), |
|
|
|
updated_at: Timex.parse!("1980-01-01T00:00:18-00:00", "{ISO:Extended}")) |
|
|
|
updated_at: Timex.parse!("1980-01-01T00:00:18-00:00", "{ISO:Extended}") |
|
|
|
|
|
|
|
) |
|
|
|
|> with_block(block) |
|
|
|
|> with_block(block) |
|
|
|
|> with_addresses(%{to: "0xsleepypuppy", from: "0xilovefrogs"}) |
|
|
|
|> with_addresses(%{to: "0xsleepypuppy", from: "0xilovefrogs"}) |
|
|
|
|
|
|
|
|
|
|
|
insert(:receipt, status: 1, transaction: transaction) |
|
|
|
insert(:receipt, status: 1, transaction: transaction) |
|
|
|
|
|
|
|
|
|
|
|
form = transaction |> Repo.preload([:block, :to_address, :from_address, :receipt]) |> TransactionForm.build() |
|
|
|
form = |
|
|
|
|
|
|
|
transaction |> Repo.preload([:block, :to_address, :from_address, :receipt]) |
|
|
|
|
|
|
|
|> TransactionForm.build() |
|
|
|
|
|
|
|
|
|
|
|
formatted_timestamp = block.timestamp |> Timex.format!("%b-%d-%Y %H:%M:%S %p %Z", :strftime) |
|
|
|
formatted_timestamp = block.timestamp |> Timex.format!("%b-%d-%Y %H:%M:%S %p %Z", :strftime) |
|
|
|
|
|
|
|
|
|
|
|
assert(form == %{ |
|
|
|
assert( |
|
|
|
block_number: 1, |
|
|
|
form == %{ |
|
|
|
age: "2 hours ago", |
|
|
|
block_number: 1, |
|
|
|
formatted_age: "2 hours ago (#{formatted_timestamp})", |
|
|
|
age: "2 hours ago", |
|
|
|
formatted_timestamp: formatted_timestamp, |
|
|
|
formatted_age: "2 hours ago (#{formatted_timestamp})", |
|
|
|
cumulative_gas_used: "99,523", |
|
|
|
formatted_timestamp: formatted_timestamp, |
|
|
|
to_address_hash: "0xsleepypuppy", |
|
|
|
cumulative_gas_used: "99,523", |
|
|
|
from_address_hash: "0xilovefrogs", |
|
|
|
to_address_hash: "0xsleepypuppy", |
|
|
|
confirmations: 23, |
|
|
|
from_address_hash: "0xilovefrogs", |
|
|
|
status: :success, |
|
|
|
confirmations: 23, |
|
|
|
formatted_status: "Success", |
|
|
|
status: :success, |
|
|
|
first_seen: "48 years ago", |
|
|
|
formatted_status: "Success", |
|
|
|
last_seen: "38 years ago", |
|
|
|
first_seen: "48 years ago", |
|
|
|
}) |
|
|
|
last_seen: "38 years ago" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
test "returns a failed transaction when there is a failed receipt" do |
|
|
|
test "returns a failed transaction when there is a failed receipt" do |
|
|
|
insert(:block, number: 24) |
|
|
|
insert(:block, number: 24) |
|
|
|
time = Timex.now |> Timex.shift(hours: -2) |
|
|
|
time = Timex.now() |> Timex.shift(hours: -2) |
|
|
|
block = insert(:block, %{ |
|
|
|
|
|
|
|
number: 1, |
|
|
|
block = |
|
|
|
gas_used: 99523, |
|
|
|
insert(:block, %{ |
|
|
|
timestamp: time, |
|
|
|
number: 1, |
|
|
|
}) |
|
|
|
gas_used: 99523, |
|
|
|
|
|
|
|
timestamp: time |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
transaction = |
|
|
|
transaction = |
|
|
|
insert(:transaction, |
|
|
|
insert( |
|
|
|
|
|
|
|
:transaction, |
|
|
|
gas: 155, |
|
|
|
gas: 155, |
|
|
|
inserted_at: Timex.parse!("1970-01-01T00:00:18-00:00", "{ISO:Extended}"), |
|
|
|
inserted_at: Timex.parse!("1970-01-01T00:00:18-00:00", "{ISO:Extended}"), |
|
|
|
updated_at: Timex.parse!("1980-01-01T00:00:18-00:00", "{ISO:Extended}")) |
|
|
|
updated_at: Timex.parse!("1980-01-01T00:00:18-00:00", "{ISO:Extended}") |
|
|
|
|
|
|
|
) |
|
|
|
|> with_block(block) |
|
|
|
|> with_block(block) |
|
|
|
|> with_addresses(%{to: "0xsleepypuppy", from: "0xilovefrogs"}) |
|
|
|
|> with_addresses(%{to: "0xsleepypuppy", from: "0xilovefrogs"}) |
|
|
|
|
|
|
|
|
|
|
|
insert(:receipt, status: 0, gas_used: 100, transaction: transaction) |
|
|
|
insert(:receipt, status: 0, gas_used: 100, transaction: transaction) |
|
|
|
|
|
|
|
|
|
|
|
form = transaction |> Repo.preload([:block, :to_address, :from_address, :receipt]) |> TransactionForm.build() |
|
|
|
form = |
|
|
|
|
|
|
|
transaction |> Repo.preload([:block, :to_address, :from_address, :receipt]) |
|
|
|
|
|
|
|
|> TransactionForm.build() |
|
|
|
|
|
|
|
|
|
|
|
formatted_timestamp = block.timestamp |> Timex.format!("%b-%d-%Y %H:%M:%S %p %Z", :strftime) |
|
|
|
formatted_timestamp = block.timestamp |> Timex.format!("%b-%d-%Y %H:%M:%S %p %Z", :strftime) |
|
|
|
|
|
|
|
|
|
|
|
assert(form == %{ |
|
|
|
assert( |
|
|
|
block_number: 1, |
|
|
|
form == %{ |
|
|
|
age: "2 hours ago", |
|
|
|
block_number: 1, |
|
|
|
formatted_age: "2 hours ago (#{formatted_timestamp})", |
|
|
|
age: "2 hours ago", |
|
|
|
formatted_timestamp: formatted_timestamp, |
|
|
|
formatted_age: "2 hours ago (#{formatted_timestamp})", |
|
|
|
cumulative_gas_used: "99,523", |
|
|
|
formatted_timestamp: formatted_timestamp, |
|
|
|
to_address_hash: "0xsleepypuppy", |
|
|
|
cumulative_gas_used: "99,523", |
|
|
|
from_address_hash: "0xilovefrogs", |
|
|
|
to_address_hash: "0xsleepypuppy", |
|
|
|
confirmations: 23, |
|
|
|
from_address_hash: "0xilovefrogs", |
|
|
|
status: :failed, |
|
|
|
confirmations: 23, |
|
|
|
formatted_status: "Failed", |
|
|
|
status: :failed, |
|
|
|
first_seen: "48 years ago", |
|
|
|
formatted_status: "Failed", |
|
|
|
last_seen: "38 years ago", |
|
|
|
first_seen: "48 years ago", |
|
|
|
}) |
|
|
|
last_seen: "38 years ago" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
test "returns a out of gas transaction when the gas matches the gas used" do |
|
|
|
test "returns a out of gas transaction when the gas matches the gas used" do |
|
|
|
insert(:block, number: 24) |
|
|
|
insert(:block, number: 24) |
|
|
|
time = Timex.now |> Timex.shift(hours: -2) |
|
|
|
time = Timex.now() |> Timex.shift(hours: -2) |
|
|
|
block = insert(:block, %{ |
|
|
|
|
|
|
|
number: 1, |
|
|
|
block = |
|
|
|
gas_used: 99523, |
|
|
|
insert(:block, %{ |
|
|
|
timestamp: time, |
|
|
|
number: 1, |
|
|
|
}) |
|
|
|
gas_used: 99523, |
|
|
|
|
|
|
|
timestamp: time |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
transaction = |
|
|
|
transaction = |
|
|
|
insert(:transaction, |
|
|
|
insert( |
|
|
|
|
|
|
|
:transaction, |
|
|
|
gas: 555, |
|
|
|
gas: 555, |
|
|
|
inserted_at: Timex.parse!("1970-01-01T00:00:18-00:00", "{ISO:Extended}"), |
|
|
|
inserted_at: Timex.parse!("1970-01-01T00:00:18-00:00", "{ISO:Extended}"), |
|
|
|
updated_at: Timex.parse!("1980-01-01T00:00:18-00:00", "{ISO:Extended}")) |
|
|
|
updated_at: Timex.parse!("1980-01-01T00:00:18-00:00", "{ISO:Extended}") |
|
|
|
|
|
|
|
) |
|
|
|
|> with_block(block) |
|
|
|
|> with_block(block) |
|
|
|
|> with_addresses(%{to: "0xsleepypuppy", from: "0xilovefrogs"}) |
|
|
|
|> with_addresses(%{to: "0xsleepypuppy", from: "0xilovefrogs"}) |
|
|
|
|
|
|
|
|
|
|
|
insert(:receipt, status: 0, gas_used: 555, transaction: transaction) |
|
|
|
insert(:receipt, status: 0, gas_used: 555, transaction: transaction) |
|
|
|
|
|
|
|
|
|
|
|
form = transaction |> Repo.preload([:block, :to_address, :from_address, :receipt]) |> TransactionForm.build() |
|
|
|
form = |
|
|
|
|
|
|
|
transaction |> Repo.preload([:block, :to_address, :from_address, :receipt]) |
|
|
|
|
|
|
|
|> TransactionForm.build() |
|
|
|
|
|
|
|
|
|
|
|
formatted_timestamp = block.timestamp |> Timex.format!("%b-%d-%Y %H:%M:%S %p %Z", :strftime) |
|
|
|
formatted_timestamp = block.timestamp |> Timex.format!("%b-%d-%Y %H:%M:%S %p %Z", :strftime) |
|
|
|
|
|
|
|
|
|
|
|
assert(form == %{ |
|
|
|
assert( |
|
|
|
block_number: 1, |
|
|
|
form == %{ |
|
|
|
age: "2 hours ago", |
|
|
|
block_number: 1, |
|
|
|
formatted_age: "2 hours ago (#{formatted_timestamp})", |
|
|
|
age: "2 hours ago", |
|
|
|
formatted_timestamp: formatted_timestamp, |
|
|
|
formatted_age: "2 hours ago (#{formatted_timestamp})", |
|
|
|
cumulative_gas_used: "99,523", |
|
|
|
formatted_timestamp: formatted_timestamp, |
|
|
|
to_address_hash: "0xsleepypuppy", |
|
|
|
cumulative_gas_used: "99,523", |
|
|
|
from_address_hash: "0xilovefrogs", |
|
|
|
to_address_hash: "0xsleepypuppy", |
|
|
|
confirmations: 23, |
|
|
|
from_address_hash: "0xilovefrogs", |
|
|
|
status: :out_of_gas, |
|
|
|
confirmations: 23, |
|
|
|
formatted_status: "Out of Gas", |
|
|
|
status: :out_of_gas, |
|
|
|
first_seen: "48 years ago", |
|
|
|
formatted_status: "Out of Gas", |
|
|
|
last_seen: "38 years ago", |
|
|
|
first_seen: "48 years ago", |
|
|
|
}) |
|
|
|
last_seen: "38 years ago" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
test "returns a pending transaction when there is no receipt" do |
|
|
|
test "returns a pending transaction when there is no receipt" do |
|
|
|
insert(:block, number: 24) |
|
|
|
insert(:block, number: 24) |
|
|
|
time = Timex.now |> Timex.shift(hours: -2) |
|
|
|
time = Timex.now() |> Timex.shift(hours: -2) |
|
|
|
block = insert(:block, %{ |
|
|
|
|
|
|
|
number: 1, |
|
|
|
block = |
|
|
|
gas_used: 99523, |
|
|
|
insert(:block, %{ |
|
|
|
timestamp: time, |
|
|
|
number: 1, |
|
|
|
}) |
|
|
|
gas_used: 99523, |
|
|
|
|
|
|
|
timestamp: time |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
transaction = |
|
|
|
transaction = |
|
|
|
insert(:transaction, |
|
|
|
insert( |
|
|
|
|
|
|
|
:transaction, |
|
|
|
inserted_at: Timex.parse!("1970-01-01T00:00:18-00:00", "{ISO:Extended}"), |
|
|
|
inserted_at: Timex.parse!("1970-01-01T00:00:18-00:00", "{ISO:Extended}"), |
|
|
|
updated_at: Timex.parse!("1980-01-01T00:00:18-00:00", "{ISO:Extended}")) |
|
|
|
updated_at: Timex.parse!("1980-01-01T00:00:18-00:00", "{ISO:Extended}") |
|
|
|
|
|
|
|
) |
|
|
|
|> with_block(block) |
|
|
|
|> with_block(block) |
|
|
|
|> with_addresses(%{to: "0xsleepypuppy", from: "0xilovefrogs"}) |
|
|
|
|> with_addresses(%{to: "0xsleepypuppy", from: "0xilovefrogs"}) |
|
|
|
|> Repo.preload([:block, :to_address, :from_address, :receipt]) |
|
|
|
|> Repo.preload([:block, :to_address, :from_address, :receipt]) |
|
|
|
|
|
|
|
|
|
|
|
form = TransactionForm.build(transaction) |
|
|
|
form = TransactionForm.build(transaction) |
|
|
|
formatted_timestamp = block.timestamp |> Timex.format!("%b-%d-%Y %H:%M:%S %p %Z", :strftime) |
|
|
|
formatted_timestamp = block.timestamp |> Timex.format!("%b-%d-%Y %H:%M:%S %p %Z", :strftime) |
|
|
|
|
|
|
|
|
|
|
|
assert(form == %{ |
|
|
|
assert( |
|
|
|
block_number: 1, |
|
|
|
form == %{ |
|
|
|
age: "2 hours ago", |
|
|
|
block_number: 1, |
|
|
|
formatted_age: "2 hours ago (#{formatted_timestamp})", |
|
|
|
age: "2 hours ago", |
|
|
|
formatted_timestamp: formatted_timestamp, |
|
|
|
formatted_age: "2 hours ago (#{formatted_timestamp})", |
|
|
|
cumulative_gas_used: "99,523", |
|
|
|
formatted_timestamp: formatted_timestamp, |
|
|
|
to_address_hash: "0xsleepypuppy", |
|
|
|
cumulative_gas_used: "99,523", |
|
|
|
from_address_hash: "0xilovefrogs", |
|
|
|
to_address_hash: "0xsleepypuppy", |
|
|
|
confirmations: 23, |
|
|
|
from_address_hash: "0xilovefrogs", |
|
|
|
status: :pending, |
|
|
|
confirmations: 23, |
|
|
|
formatted_status: "Pending", |
|
|
|
status: :pending, |
|
|
|
first_seen: "48 years ago", |
|
|
|
formatted_status: "Pending", |
|
|
|
last_seen: "38 years ago", |
|
|
|
first_seen: "48 years ago", |
|
|
|
}) |
|
|
|
last_seen: "38 years ago" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
test "returns a pending transaction when there is no block" do |
|
|
|
test "returns a pending transaction when there is no block" do |
|
|
|
transaction = insert( |
|
|
|
transaction = |
|
|
|
:transaction, |
|
|
|
insert( |
|
|
|
inserted_at: Timex.parse!("1970-01-01T00:00:18-00:00", "{ISO:Extended}"), |
|
|
|
:transaction, |
|
|
|
updated_at: Timex.parse!("1980-01-01T00:00:18-00:00", "{ISO:Extended}")) |
|
|
|
inserted_at: Timex.parse!("1970-01-01T00:00:18-00:00", "{ISO:Extended}"), |
|
|
|
|> with_addresses(%{to: "0xchadmuska", from: "0xtonyhawk"}) |
|
|
|
updated_at: Timex.parse!("1980-01-01T00:00:18-00:00", "{ISO:Extended}") |
|
|
|
|> Repo.preload([:to_address, :from_address]) |
|
|
|
) |
|
|
|
|
|
|
|
|> with_addresses(%{to: "0xchadmuska", from: "0xtonyhawk"}) |
|
|
|
|
|
|
|
|> Repo.preload([:to_address, :from_address]) |
|
|
|
|
|
|
|
|
|
|
|
form = TransactionForm.build(transaction) |
|
|
|
form = TransactionForm.build(transaction) |
|
|
|
|
|
|
|
|
|
|
|
assert(form == %{ |
|
|
|
assert( |
|
|
|
block_number: "", |
|
|
|
form == %{ |
|
|
|
age: "Pending", |
|
|
|
block_number: "", |
|
|
|
formatted_age: "Pending", |
|
|
|
age: "Pending", |
|
|
|
formatted_timestamp: "Pending", |
|
|
|
formatted_age: "Pending", |
|
|
|
cumulative_gas_used: "Pending", |
|
|
|
formatted_timestamp: "Pending", |
|
|
|
to_address_hash: "0xchadmuska", |
|
|
|
cumulative_gas_used: "Pending", |
|
|
|
from_address_hash: "0xtonyhawk", |
|
|
|
to_address_hash: "0xchadmuska", |
|
|
|
confirmations: 0, |
|
|
|
from_address_hash: "0xtonyhawk", |
|
|
|
status: :pending, |
|
|
|
confirmations: 0, |
|
|
|
formatted_status: "Pending", |
|
|
|
status: :pending, |
|
|
|
first_seen: "48 years ago", |
|
|
|
formatted_status: "Pending", |
|
|
|
last_seen: "38 years ago", |
|
|
|
first_seen: "48 years ago", |
|
|
|
}) |
|
|
|
last_seen: "38 years ago" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
test "works when there are no addresses" do |
|
|
|
test "works when there are no addresses" do |
|
|
|
transaction = insert( |
|
|
|
transaction = |
|
|
|
:transaction, |
|
|
|
insert( |
|
|
|
inserted_at: Timex.parse!("1970-01-01T00:00:18-00:00", "{ISO:Extended}"), |
|
|
|
:transaction, |
|
|
|
updated_at: Timex.parse!("1980-01-01T00:00:18-00:00", "{ISO:Extended}")) |
|
|
|
inserted_at: Timex.parse!("1970-01-01T00:00:18-00:00", "{ISO:Extended}"), |
|
|
|
|> Repo.preload([:block, :to_address, :from_address]) |
|
|
|
updated_at: Timex.parse!("1980-01-01T00:00:18-00:00", "{ISO:Extended}") |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|> Repo.preload([:block, :to_address, :from_address]) |
|
|
|
|
|
|
|
|
|
|
|
form = TransactionForm.build(transaction) |
|
|
|
form = TransactionForm.build(transaction) |
|
|
|
|
|
|
|
|
|
|
|
assert(form == %{ |
|
|
|
assert( |
|
|
|
block_number: "", |
|
|
|
form == %{ |
|
|
|
age: "Pending", |
|
|
|
block_number: "", |
|
|
|
formatted_age: "Pending", |
|
|
|
age: "Pending", |
|
|
|
formatted_timestamp: "Pending", |
|
|
|
formatted_age: "Pending", |
|
|
|
cumulative_gas_used: "Pending", |
|
|
|
formatted_timestamp: "Pending", |
|
|
|
to_address_hash: nil, |
|
|
|
cumulative_gas_used: "Pending", |
|
|
|
from_address_hash: nil, |
|
|
|
to_address_hash: nil, |
|
|
|
confirmations: 0, |
|
|
|
from_address_hash: nil, |
|
|
|
status: :pending, |
|
|
|
confirmations: 0, |
|
|
|
formatted_status: "Pending", |
|
|
|
status: :pending, |
|
|
|
first_seen: "48 years ago", |
|
|
|
formatted_status: "Pending", |
|
|
|
last_seen: "38 years ago", |
|
|
|
first_seen: "48 years ago", |
|
|
|
}) |
|
|
|
last_seen: "38 years ago" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
describe "build_and_merge/1" do |
|
|
|
describe "build_and_merge/1" do |
|
|
|
test "it returns a merged map of a transaction and its built data" do |
|
|
|
test "it returns a merged map of a transaction and its built data" do |
|
|
|
insert(:block, number: 24) |
|
|
|
insert(:block, number: 24) |
|
|
|
time = Timex.now |> Timex.shift(hours: -2) |
|
|
|
time = Timex.now() |> Timex.shift(hours: -2) |
|
|
|
block = insert(:block, %{ |
|
|
|
|
|
|
|
number: 1, |
|
|
|
block = |
|
|
|
gas_used: 99523, |
|
|
|
insert(:block, %{ |
|
|
|
timestamp: time, |
|
|
|
number: 1, |
|
|
|
}) |
|
|
|
gas_used: 99523, |
|
|
|
|
|
|
|
timestamp: time |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
transaction = |
|
|
|
transaction = |
|
|
|
insert(:transaction, |
|
|
|
insert( |
|
|
|
|
|
|
|
:transaction, |
|
|
|
hash: "0xkittenpower", |
|
|
|
hash: "0xkittenpower", |
|
|
|
inserted_at: Timex.parse!("1970-01-01T00:00:18-00:00", "{ISO:Extended}"), |
|
|
|
inserted_at: Timex.parse!("1970-01-01T00:00:18-00:00", "{ISO:Extended}"), |
|
|
|
updated_at: Timex.parse!("1980-01-01T00:00:18-00:00", "{ISO:Extended}"), |
|
|
|
updated_at: Timex.parse!("1980-01-01T00:00:18-00:00", "{ISO:Extended}"), |
|
|
|
gas: 555) |
|
|
|
gas: 555 |
|
|
|
|
|
|
|
) |
|
|
|
|> with_block(block) |
|
|
|
|> with_block(block) |
|
|
|
|> with_addresses(%{to: "0xsleepypuppy", from: "0xilovefrogs"}) |
|
|
|
|> with_addresses(%{to: "0xsleepypuppy", from: "0xilovefrogs"}) |
|
|
|
|
|
|
|
|
|
|
|
insert(:receipt, status: 0, gas_used: 555, transaction: transaction) |
|
|
|
insert(:receipt, status: 0, gas_used: 555, transaction: transaction) |
|
|
|
|
|
|
|
|
|
|
|
form = transaction |> Repo.preload([:block, :to_address, :from_address, :receipt]) |> TransactionForm.build_and_merge() |
|
|
|
form = |
|
|
|
|
|
|
|
transaction |> Repo.preload([:block, :to_address, :from_address, :receipt]) |
|
|
|
|
|
|
|
|> TransactionForm.build_and_merge() |
|
|
|
|
|
|
|
|
|
|
|
assert form.hash == "0xkittenpower" |
|
|
|
assert form.hash == "0xkittenpower" |
|
|
|
assert form.block_number == 1 |
|
|
|
assert form.block_number == 1 |
|
|
|