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/apps/block_scout_web/lib/phoenix/html/safe.ex

33 lines
675 B

alias Explorer.Chain
alias Explorer.Chain.{Address, Block, Data, Hash, Transaction}
defimpl Phoenix.HTML.Safe, for: Address do
def to_iodata(%@for{} = address) do
@for.checksum(address, true)
end
end
defimpl Phoenix.HTML.Safe, for: Transaction do
def to_iodata(%@for{hash: hash}) do
@protocol.to_iodata(hash)
end
end
defimpl Phoenix.HTML.Safe, for: Block do
def to_iodata(%@for{number: number}) do
@protocol.to_iodata(number)
end
end
defimpl Phoenix.HTML.Safe, for: Data do
def to_iodata(data) do
Chain.data_to_iodata(data)
end
end
defimpl Phoenix.HTML.Safe, for: Hash do
def to_iodata(hash) do
Chain.hash_to_iodata(hash)
end
end