Blockchain explorer for Ethereum based network and a tool for inspecting and analyzing EVM based blockchains.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
blockscout/lib/explorer/forms/pending_transaction_form.ex

32 lines
871 B

defmodule Explorer.PendingTransactionForm do
@moduledoc "Format a pending Transaction for display."
import ExplorerWeb.Gettext
def build(transaction) do
Map.merge(transaction, %{
to_address_hash: transaction |> to_address_hash,
from_address_hash: transaction |> from_address_hash,
first_seen: transaction |> first_seen,
last_seen: transaction |> last_seen,
status: :pending,
formatted_status: gettext("Pending")
})
end
def to_address_hash(transaction) do
transaction.to_address && transaction.to_address.hash || nil
end
def from_address_hash(transaction) do
transaction.to_address && transaction.from_address.hash || nil
end
def first_seen(transaction) do
transaction.inserted_at |> Timex.from_now
end
def last_seen(transaction) do
transaction.updated_at |> Timex.from_now
end
end