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/param.ex

35 lines
692 B

alias Explorer.Chain.{Address, Block, Hash, Transaction}
defimpl Phoenix.Param, for: Transaction do
def to_param(%@for{hash: hash}) do
@protocol.to_param(hash)
end
end
defimpl Phoenix.Param, for: Address do
def to_param(%@for{} = address) do
@for.checksum(address)
end
end
defimpl Phoenix.Param, for: Block do
def to_param(%@for{consensus: true, number: number}) do
to_string(number)
end
def to_param(%@for{consensus: false, hash: hash}) do
to_string(hash)
end
end
defimpl Phoenix.Param, for: Hash do
def to_param(hash) do
to_string(hash)
end
end
defimpl Phoenix.Param, for: Decimal do
def to_param(decimal) do
to_string(decimal)
end
end