<%= get_flash(@conn, :info) %>
<%= get_flash(@conn, :error) %>
<%= render @view_module, @view_template, assigns %>diff --git a/README.md b/README.md index 7c0c1d3773..e9859f1dbd 100644 --- a/README.md +++ b/README.md @@ -102,7 +102,7 @@ Each OTP application has a restricted domain. |:------------------------|:--------------------|:------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `apps/ethereum_jsonrpc` | `:ethereum_jsonrpc` | `EthereumJSONRPC` | Ethereum JSONRPC client. It is allowed to know `Explorer`'s param format, but it cannot directly depend on `:explorer` | | `apps/explorer` | `:explorer` | `Explorer` | Storage for the indexed chain. Can read and write to the backing storage. MUST be able to boot in a read-only mode when run independently from `:indexer`, so cannot depend on `:indexer` as that would start `:indexer` indexing. | -| `apps/block_scout_web` | `:block_scout_web` | `ExplorerWeb` | Phoenix interface to `:explorer`. The minimum interface to allow web access should go in `:block_scout_web`. Any business rules or interface not tied directly to `Phoenix` or `Plug` should go in `:explorer`. MUST be able to boot in a read-only mode when run independently from `:indexer`, so cannot depend on `:indexer` as that would start `:indexer` indexing. | +| `apps/block_scout_web` | `:block_scout_web` | `BlockScoutWeb` | Phoenix interface to `:explorer`. The minimum interface to allow web access should go in `:block_scout_web`. Any business rules or interface not tied directly to `Phoenix` or `Plug` should go in `:explorer`. MUST be able to boot in a read-only mode when run independently from `:indexer`, so cannot depend on `:indexer` as that would start `:indexer` indexing. | | `apps/indexer` | `:indexer` | `Indexer` | Uses `:ethereum_jsonrpc` to index chain and batch import data into `:explorer`. Any process, `Task`, or `GenServer` that automatically reads from the chain and writes to `:explorer` should be in `:indexer`. This restricts automatic writes to `:indexer` and read-only mode can be achieved by not running `:indexer`. | diff --git a/apps/block_scout_web/config/config.exs b/apps/block_scout_web/config/config.exs index 1bc9e924f0..34482990e0 100644 --- a/apps/block_scout_web/config/config.exs +++ b/apps/block_scout_web/config/config.exs @@ -7,19 +7,19 @@ use Mix.Config # General application configuration config :block_scout_web, - namespace: ExplorerWeb, + namespace: BlockScoutWeb, ecto_repos: [Explorer.Repo] # Configures the endpoint -config :block_scout_web, ExplorerWeb.Endpoint, +config :block_scout_web, BlockScoutWeb.Endpoint, url: [host: "localhost"], - render_errors: [view: ExplorerWeb.ErrorView, accepts: ~w(html json)], - pubsub: [name: ExplorerWeb.PubSub, adapter: Phoenix.PubSub.PG2] + render_errors: [view: BlockScoutWeb.ErrorView, accepts: ~w(html json)], + pubsub: [name: BlockScoutWeb.PubSub, adapter: Phoenix.PubSub.PG2] # Configures gettext -config :block_scout_web, ExplorerWeb.Gettext, locales: ~w(en), default_locale: "en" +config :block_scout_web, BlockScoutWeb.Gettext, locales: ~w(en), default_locale: "en" -config :block_scout_web, ExplorerWeb.SocialMedia, +config :block_scout_web, BlockScoutWeb.SocialMedia, twitter: "PoaNetwork", telegram: "oraclesnetwork", facebook: "PoaNetwork", @@ -28,7 +28,7 @@ config :block_scout_web, ExplorerWeb.SocialMedia, config :ex_cldr, default_locale: "en", locales: ["en"], - gettext: ExplorerWeb.Gettext + gettext: BlockScoutWeb.Gettext # Import environment specific config. This must remain at the bottom # of this file so it overrides the configuration defined above. diff --git a/apps/block_scout_web/config/dev.exs b/apps/block_scout_web/config/dev.exs index ada8930441..371063d2a6 100644 --- a/apps/block_scout_web/config/dev.exs +++ b/apps/block_scout_web/config/dev.exs @@ -6,7 +6,7 @@ use Mix.Config # The watchers configuration can be used to run external # watchers to your application. For example, we use it # with webpack to recompile .js and .css sources. -config :block_scout_web, ExplorerWeb.Endpoint, +config :block_scout_web, BlockScoutWeb.Endpoint, http: [port: 4000], debug_errors: true, code_reloader: true, @@ -38,7 +38,7 @@ config :block_scout_web, ExplorerWeb.Endpoint, # different ports. # Watch static and templates for browser reloading. -config :block_scout_web, ExplorerWeb.Endpoint, +config :block_scout_web, BlockScoutWeb.Endpoint, live_reload: [ patterns: [ ~r{priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$}, diff --git a/apps/block_scout_web/config/dev.secret.exs.example b/apps/block_scout_web/config/dev.secret.exs.example index 48f5b910c4..3c358188f2 100644 --- a/apps/block_scout_web/config/dev.secret.exs.example +++ b/apps/block_scout_web/config/dev.secret.exs.example @@ -1,5 +1,5 @@ use Mix.Config # Configures the endpoint -config :block_scout_web, ExplorerWeb.Endpoint, +config :block_scout_web, BlockScoutWeb.Endpoint, secret_key_base: "RMgI4C1HSkxsEjdhtGMfwAHfyT6CKWXOgzCboJflfSm4jeAlic52io05KB6mqzc5" diff --git a/apps/block_scout_web/config/prod.exs b/apps/block_scout_web/config/prod.exs index ed2c1b9463..0a0ef2733e 100644 --- a/apps/block_scout_web/config/prod.exs +++ b/apps/block_scout_web/config/prod.exs @@ -3,7 +3,7 @@ use Mix.Config # For production, we often load configuration from external # sources, such as your system environment. For this reason, # you won't find the :http configuration below, but set inside -# ExplorerWeb.Endpoint.init/2 when load_from_system_env is +# BlockScoutWeb.Endpoint.init/2 when load_from_system_env is # true. Any dynamic configuration should be done there. # # Don't forget to configure the url host to something meaningful, @@ -13,7 +13,7 @@ use Mix.Config # containing the digested version of static files. This # manifest is generated by the mix phx.digest task # which you typically run after static files are built. -config :block_scout_web, ExplorerWeb.Endpoint, +config :block_scout_web, BlockScoutWeb.Endpoint, cache_static_manifest: "priv/static/cache_manifest.json", force_ssl: false, secret_key_base: System.get_env("SECRET_KEY_BASE"), diff --git a/apps/block_scout_web/config/test.exs b/apps/block_scout_web/config/test.exs index 65a4f53a2e..8bdd542e2d 100644 --- a/apps/block_scout_web/config/test.exs +++ b/apps/block_scout_web/config/test.exs @@ -4,7 +4,7 @@ config :block_scout_web, :sql_sandbox, true # We don't run a server during test. If one is required, # you can enable the server option below. -config :block_scout_web, ExplorerWeb.Endpoint, +config :block_scout_web, BlockScoutWeb.Endpoint, http: [port: 4001], secret_key_base: "27Swe6KtEtmN37WyEYRjKWyxYULNtrxlkCEKur4qoV+Lwtk8lafsR16ifz1XBBYj", server: true @@ -12,4 +12,4 @@ config :block_scout_web, ExplorerWeb.Endpoint, # Configure wallaby config :wallaby, screenshot_on_failure: true -config :block_scout_web, :fake_adapter, ExplorerWeb.FakeAdapter +config :block_scout_web, :fake_adapter, BlockScoutWeb.FakeAdapter diff --git a/apps/block_scout_web/lib/block_scout_web.ex b/apps/block_scout_web/lib/block_scout_web.ex index bd446da640..81809ce1f5 100644 --- a/apps/block_scout_web/lib/block_scout_web.ex +++ b/apps/block_scout_web/lib/block_scout_web.ex @@ -1,12 +1,12 @@ -defmodule ExplorerWeb do +defmodule BlockScoutWeb do @moduledoc """ The entrypoint for defining your web interface, such as controllers, views, channels and so on. This can be used in your application as: - use ExplorerWeb, :controller - use ExplorerWeb, :view + use BlockScoutWeb, :controller + use BlockScoutWeb, :view The definitions below will be executed for every view, controller, etc, so keep them short and clean, focused @@ -19,12 +19,12 @@ defmodule ExplorerWeb do def controller do quote do - use Phoenix.Controller, namespace: ExplorerWeb + use Phoenix.Controller, namespace: BlockScoutWeb - import ExplorerWeb.Controller - import ExplorerWeb.Router.Helpers - import ExplorerWeb.Gettext - import ExplorerWeb.ErrorHelpers + import BlockScoutWeb.Controller + import BlockScoutWeb.Router.Helpers + import BlockScoutWeb.Gettext + import BlockScoutWeb.ErrorHelpers import Plug.Conn end end @@ -33,7 +33,7 @@ defmodule ExplorerWeb do quote do use Phoenix.View, root: "lib/block_scout_web/templates", - namespace: ExplorerWeb + namespace: BlockScoutWeb # Import convenience functions from controllers import Phoenix.Controller, only: [get_flash: 2, view_module: 1] @@ -41,7 +41,7 @@ defmodule ExplorerWeb do # Use all HTML functionality (forms, tags, etc) use Phoenix.HTML - import ExplorerWeb.{ + import BlockScoutWeb.{ CurrencyHelpers, ErrorHelpers, Gettext, @@ -65,7 +65,7 @@ defmodule ExplorerWeb do quote do use Phoenix.Channel - import ExplorerWeb.Gettext + import BlockScoutWeb.Gettext end end diff --git a/apps/block_scout_web/lib/block_scout_web/application.ex b/apps/block_scout_web/lib/block_scout_web/application.ex index b253b333b2..d50709d1ab 100644 --- a/apps/block_scout_web/lib/block_scout_web/application.ex +++ b/apps/block_scout_web/lib/block_scout_web/application.ex @@ -1,11 +1,11 @@ -defmodule ExplorerWeb.Application do +defmodule BlockScoutWeb.Application do @moduledoc """ - Supervises `ExplorerWeb.Endpoint` in order to serve Web UI. + Supervises `BlockScoutWeb.Endpoint` in order to serve Web UI. """ use Application - alias ExplorerWeb.{Endpoint, EventHandler} + alias BlockScoutWeb.{Endpoint, EventHandler} def start(_type, _args) do import Supervisor.Spec @@ -21,7 +21,7 @@ defmodule ExplorerWeb.Application do # See https://hexdocs.pm/elixir/Supervisor.html # for other strategies and supported options - opts = [strategy: :one_for_one, name: ExplorerWeb.Supervisor] + opts = [strategy: :one_for_one, name: BlockScoutWeb.Supervisor] Supervisor.start_link(children, opts) end diff --git a/apps/block_scout_web/lib/block_scout_web/chain.ex b/apps/block_scout_web/lib/block_scout_web/chain.ex index e73cac7679..7f0a1af1e1 100644 --- a/apps/block_scout_web/lib/block_scout_web/chain.ex +++ b/apps/block_scout_web/lib/block_scout_web/chain.ex @@ -1,4 +1,4 @@ -defmodule ExplorerWeb.Chain do +defmodule BlockScoutWeb.Chain do @moduledoc """ Converts the `param` to the corresponding resource that uses that format of param. """ diff --git a/apps/block_scout_web/lib/block_scout_web/channels/address_channel.ex b/apps/block_scout_web/lib/block_scout_web/channels/address_channel.ex index 1c24c8d706..94345913d3 100644 --- a/apps/block_scout_web/lib/block_scout_web/channels/address_channel.ex +++ b/apps/block_scout_web/lib/block_scout_web/channels/address_channel.ex @@ -1,10 +1,10 @@ -defmodule ExplorerWeb.AddressChannel do +defmodule BlockScoutWeb.AddressChannel do @moduledoc """ Establishes pub/sub channel for address page live updates. """ - use ExplorerWeb, :channel + use BlockScoutWeb, :channel - alias ExplorerWeb.{AddressTransactionView, AddressView} + alias BlockScoutWeb.{AddressTransactionView, AddressView} alias Phoenix.View intercept(["balance_update", "count", "transaction"]) @@ -18,7 +18,7 @@ defmodule ExplorerWeb.AddressChannel do %{address: address, exchange_rate: exchange_rate}, socket ) do - Gettext.put_locale(ExplorerWeb.Gettext, socket.assigns.locale) + Gettext.put_locale(BlockScoutWeb.Gettext, socket.assigns.locale) rendered = View.render_to_string( @@ -34,7 +34,7 @@ defmodule ExplorerWeb.AddressChannel do end def handle_out("count", %{count: count}, socket) do - Gettext.put_locale(ExplorerWeb.Gettext, socket.assigns.locale) + Gettext.put_locale(BlockScoutWeb.Gettext, socket.assigns.locale) push(socket, "count", %{count: Cldr.Number.to_string!(count, format: "#,###")}) @@ -42,7 +42,7 @@ defmodule ExplorerWeb.AddressChannel do end def handle_out("transaction", %{address: address, transaction: transaction}, socket) do - Gettext.put_locale(ExplorerWeb.Gettext, socket.assigns.locale) + Gettext.put_locale(BlockScoutWeb.Gettext, socket.assigns.locale) rendered = View.render_to_string( diff --git a/apps/block_scout_web/lib/block_scout_web/channels/block_channel.ex b/apps/block_scout_web/lib/block_scout_web/channels/block_channel.ex index 9a6d7d51d7..eebd8ef09f 100644 --- a/apps/block_scout_web/lib/block_scout_web/channels/block_channel.ex +++ b/apps/block_scout_web/lib/block_scout_web/channels/block_channel.ex @@ -1,10 +1,10 @@ -defmodule ExplorerWeb.BlockChannel do +defmodule BlockScoutWeb.BlockChannel do @moduledoc """ Establishes pub/sub channel for live updates of block events. """ - use ExplorerWeb, :channel + use BlockScoutWeb, :channel - alias ExplorerWeb.{BlockView, ChainView} + alias BlockScoutWeb.{BlockView, ChainView} alias Phoenix.View intercept(["new_block"]) @@ -14,7 +14,7 @@ defmodule ExplorerWeb.BlockChannel do end def handle_out("new_block", %{block: block, average_block_time: average_block_time}, socket) do - Gettext.put_locale(ExplorerWeb.Gettext, socket.assigns.locale) + Gettext.put_locale(BlockScoutWeb.Gettext, socket.assigns.locale) rendered_block = View.render_to_string( diff --git a/apps/block_scout_web/lib/block_scout_web/channels/transaction_channel.ex b/apps/block_scout_web/lib/block_scout_web/channels/transaction_channel.ex index dfa8900302..b2747b9cdd 100644 --- a/apps/block_scout_web/lib/block_scout_web/channels/transaction_channel.ex +++ b/apps/block_scout_web/lib/block_scout_web/channels/transaction_channel.ex @@ -1,10 +1,10 @@ -defmodule ExplorerWeb.TransactionChannel do +defmodule BlockScoutWeb.TransactionChannel do @moduledoc """ Establishes pub/sub channel for live updates of transaction events. """ - use ExplorerWeb, :channel + use BlockScoutWeb, :channel - alias ExplorerWeb.TransactionView + alias BlockScoutWeb.TransactionView alias Phoenix.View intercept(["new_transaction"]) @@ -14,7 +14,7 @@ defmodule ExplorerWeb.TransactionChannel do end def handle_out("new_transaction", %{transaction: transaction}, socket) do - Gettext.put_locale(ExplorerWeb.Gettext, socket.assigns.locale) + Gettext.put_locale(BlockScoutWeb.Gettext, socket.assigns.locale) rendered_transaction = View.render_to_string( diff --git a/apps/block_scout_web/lib/block_scout_web/channels/user_socket.ex b/apps/block_scout_web/lib/block_scout_web/channels/user_socket.ex index c71abadfb3..d251a55441 100644 --- a/apps/block_scout_web/lib/block_scout_web/channels/user_socket.ex +++ b/apps/block_scout_web/lib/block_scout_web/channels/user_socket.ex @@ -1,9 +1,9 @@ -defmodule ExplorerWeb.UserSocket do +defmodule BlockScoutWeb.UserSocket do use Phoenix.Socket - channel("addresses:*", ExplorerWeb.AddressChannel) - channel("blocks:*", ExplorerWeb.BlockChannel) - channel("transactions:*", ExplorerWeb.TransactionChannel) + channel("addresses:*", BlockScoutWeb.AddressChannel) + channel("blocks:*", BlockScoutWeb.BlockChannel) + channel("transactions:*", BlockScoutWeb.TransactionChannel) transport(:websocket, Phoenix.Transports.WebSocket, timeout: 45_000) # transport :longpoll, Phoenix.Transports.LongPoll diff --git a/apps/block_scout_web/lib/block_scout_web/controller.ex b/apps/block_scout_web/lib/block_scout_web/controller.ex index 41290de3fa..f914e10b53 100644 --- a/apps/block_scout_web/lib/block_scout_web/controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controller.ex @@ -1,4 +1,4 @@ -defmodule ExplorerWeb.Controller do +defmodule BlockScoutWeb.Controller do @moduledoc """ Common controller error responses """ @@ -12,14 +12,14 @@ defmodule ExplorerWeb.Controller do def not_found(conn) do conn |> put_status(:not_found) - |> put_view(ExplorerWeb.ErrorView) + |> put_view(BlockScoutWeb.ErrorView) |> render("404.html") end def unprocessable_entity(conn) do conn |> put_status(:unprocessable_entity) - |> put_view(ExplorerWeb.ErrorView) + |> put_view(BlockScoutWeb.ErrorView) |> render("422.html") end end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_controller.ex index 5b88c8a2d9..377be35b3c 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_controller.ex @@ -1,7 +1,7 @@ -defmodule ExplorerWeb.AddressContractController do - use ExplorerWeb, :controller +defmodule BlockScoutWeb.AddressContractController do + use BlockScoutWeb, :controller - import ExplorerWeb.AddressController, only: [transaction_count: 1] + import BlockScoutWeb.AddressController, only: [transaction_count: 1] alias Explorer.{Chain, Market} alias Explorer.ExchangeRates.Token diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_verification_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_verification_controller.ex index e1973f4b5b..84bdd78500 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_verification_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_contract_verification_controller.ex @@ -1,5 +1,5 @@ -defmodule ExplorerWeb.AddressContractVerificationController do - use ExplorerWeb, :controller +defmodule BlockScoutWeb.AddressContractVerificationController do + use BlockScoutWeb, :controller alias Explorer.Chain.SmartContract alias Explorer.SmartContract.{Solidity.CompilerVersion, Publisher} diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_controller.ex index d82f30bcd9..e631a4f0aa 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_controller.ex @@ -1,5 +1,5 @@ -defmodule ExplorerWeb.AddressController do - use ExplorerWeb, :controller +defmodule BlockScoutWeb.AddressController do + use BlockScoutWeb, :controller alias Explorer.Chain alias Explorer.Chain.Address diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_internal_transaction_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_internal_transaction_controller.ex index 8c4b4853d5..cf70be275d 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_internal_transaction_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_internal_transaction_controller.ex @@ -1,12 +1,12 @@ -defmodule ExplorerWeb.AddressInternalTransactionController do +defmodule BlockScoutWeb.AddressInternalTransactionController do @moduledoc """ Manages the displaying of information about internal transactions as they relate to addresses """ - use ExplorerWeb, :controller + use BlockScoutWeb, :controller - import ExplorerWeb.AddressController, only: [transaction_count: 1] - import ExplorerWeb.Chain, only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1] + import BlockScoutWeb.AddressController, only: [transaction_count: 1] + import BlockScoutWeb.Chain, only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1] alias Explorer.{Chain, Market} alias Explorer.ExchangeRates.Token diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_read_contract_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_read_contract_controller.ex index 2879e9eca0..28b4ada396 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_read_contract_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_read_contract_controller.ex @@ -1,11 +1,11 @@ -defmodule ExplorerWeb.AddressReadContractController do - use ExplorerWeb, :controller +defmodule BlockScoutWeb.AddressReadContractController do + use BlockScoutWeb, :controller alias Explorer.{Chain, Market} alias Explorer.ExchangeRates.Token alias Explorer.SmartContract.Reader - import ExplorerWeb.AddressController, only: [transaction_count: 1] + import BlockScoutWeb.AddressController, only: [transaction_count: 1] def index(conn, %{"address_id" => address_hash_string}) do with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_transaction_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_transaction_controller.ex index 0fea25a906..5c406dcc63 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_transaction_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_transaction_controller.ex @@ -1,12 +1,12 @@ -defmodule ExplorerWeb.AddressTransactionController do +defmodule BlockScoutWeb.AddressTransactionController do @moduledoc """ Display all the Transactions that terminate at this Address. """ - use ExplorerWeb, :controller + use BlockScoutWeb, :controller - import ExplorerWeb.AddressController, only: [transaction_count: 1] - import ExplorerWeb.Chain, only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1] + import BlockScoutWeb.AddressController, only: [transaction_count: 1] + import BlockScoutWeb.Chain, only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1] alias Explorer.{Chain, Market} alias Explorer.ExchangeRates.Token diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/address_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/address_controller.ex index 23ba38f843..732f24022e 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/address_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/address_controller.ex @@ -1,5 +1,5 @@ -defmodule ExplorerWeb.API.RPC.AddressController do - use ExplorerWeb, :controller +defmodule BlockScoutWeb.API.RPC.AddressController do + use BlockScoutWeb, :controller alias Explorer.{Etherscan, Chain} alias Explorer.Chain.{Address, Wei} diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/block_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/block_controller.ex index 6bdcbd00c6..4e18a34b3a 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/block_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/block_controller.ex @@ -1,8 +1,8 @@ -defmodule ExplorerWeb.API.RPC.BlockController do - use ExplorerWeb, :controller +defmodule BlockScoutWeb.API.RPC.BlockController do + use BlockScoutWeb, :controller alias Explorer.Chain - alias ExplorerWeb.Chain, as: ChainWeb + alias BlockScoutWeb.Chain, as: ChainWeb def getblockreward(conn, params) do with {:block_param, {:ok, unsafe_block_number}} <- {:block_param, Map.fetch(params, "blockno")}, diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/rpc_translator.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/rpc_translator.ex index 9ce5f22752..8f5fd3ce14 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/rpc_translator.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/rpc_translator.ex @@ -1,4 +1,4 @@ -defmodule ExplorerWeb.API.RPC.RPCTranslator do +defmodule BlockScoutWeb.API.RPC.RPCTranslator do @moduledoc """ Converts an RPC-style request into a controller action. @@ -15,7 +15,7 @@ defmodule ExplorerWeb.API.RPC.RPCTranslator do import Plug.Conn - alias ExplorerWeb.API.RPC.RPCView + alias BlockScoutWeb.API.RPC.RPCView alias Plug.Conn alias Phoenix.Controller diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/v1/supply_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/v1/supply_controller.ex index a122a333df..6b3cf3edd6 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/api/v1/supply_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/v1/supply_controller.ex @@ -1,5 +1,5 @@ -defmodule ExplorerWeb.API.V1.SupplyController do - use ExplorerWeb, :controller +defmodule BlockScoutWeb.API.V1.SupplyController do + use BlockScoutWeb, :controller alias Explorer.Chain diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api_docs_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api_docs_controller.ex index c4ee235c22..1c5ba68229 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/api_docs_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api_docs_controller.ex @@ -1,7 +1,7 @@ -defmodule ExplorerWeb.APIDocsController do - use ExplorerWeb, :controller +defmodule BlockScoutWeb.APIDocsController do + use BlockScoutWeb, :controller - alias ExplorerWeb.Etherscan + alias BlockScoutWeb.Etherscan def index(conn, _params) do conn diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/block_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/block_controller.ex index 50d83c42d9..dc0aa7357d 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/block_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/block_controller.ex @@ -1,7 +1,7 @@ -defmodule ExplorerWeb.BlockController do - use ExplorerWeb, :controller +defmodule BlockScoutWeb.BlockController do + use BlockScoutWeb, :controller - import ExplorerWeb.Chain, only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1] + import BlockScoutWeb.Chain, only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1] alias Explorer.Chain diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/block_transaction_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/block_transaction_controller.ex index 8233510678..569ada51d4 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/block_transaction_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/block_transaction_controller.ex @@ -1,7 +1,7 @@ -defmodule ExplorerWeb.BlockTransactionController do - use ExplorerWeb, :controller +defmodule BlockScoutWeb.BlockTransactionController do + use BlockScoutWeb, :controller - import ExplorerWeb.Chain, + import BlockScoutWeb.Chain, only: [paging_options: 1, param_to_block_number: 1, next_page_params: 3, split_list_by_page: 1] alias Explorer.Chain diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/chain_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/chain_controller.ex index 6782d0ac4b..131a042f38 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/chain_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/chain_controller.ex @@ -1,5 +1,5 @@ -defmodule ExplorerWeb.ChainController do - use ExplorerWeb, :controller +defmodule BlockScoutWeb.ChainController do + use BlockScoutWeb, :controller alias Explorer.{Chain, PagingOptions, Repo} alias Explorer.Chain.{Address, Block, Transaction} @@ -42,7 +42,7 @@ defmodule ExplorerWeb.ChainController do def search(conn, %{"q" => query}) do query |> String.trim() - |> ExplorerWeb.Chain.from_param() + |> BlockScoutWeb.Chain.from_param() |> case do {:ok, item} -> redirect_search_results(conn, item) diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/pending_transaction_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/pending_transaction_controller.ex index 12e0906f92..7e04c1824a 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/pending_transaction_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/pending_transaction_controller.ex @@ -1,7 +1,7 @@ -defmodule ExplorerWeb.PendingTransactionController do - use ExplorerWeb, :controller +defmodule BlockScoutWeb.PendingTransactionController do + use BlockScoutWeb, :controller - import ExplorerWeb.Chain, only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1] + import BlockScoutWeb.Chain, only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1] alias Explorer.Chain diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/token_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/token_controller.ex index 9bd0434120..385f54fcc7 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/token_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/token_controller.ex @@ -1,9 +1,9 @@ -defmodule ExplorerWeb.TokenController do - use ExplorerWeb, :controller +defmodule BlockScoutWeb.TokenController do + use BlockScoutWeb, :controller alias Explorer.Chain - import ExplorerWeb.Chain, only: [split_list_by_page: 1, paging_options: 1, next_page_params: 3] + import BlockScoutWeb.Chain, only: [split_list_by_page: 1, paging_options: 1, next_page_params: 3] def show(conn, %{"id" => address_hash_string} = params) do with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/transaction_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/transaction_controller.ex index b988cb8974..af08d2c01c 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/transaction_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/transaction_controller.ex @@ -1,7 +1,7 @@ -defmodule ExplorerWeb.TransactionController do - use ExplorerWeb, :controller +defmodule BlockScoutWeb.TransactionController do + use BlockScoutWeb, :controller - import ExplorerWeb.Chain, only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1] + import BlockScoutWeb.Chain, only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1] alias Explorer.Chain diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/transaction_internal_transaction_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/transaction_internal_transaction_controller.ex index 8e8d7db1bd..8a89794834 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/transaction_internal_transaction_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/transaction_internal_transaction_controller.ex @@ -1,7 +1,7 @@ -defmodule ExplorerWeb.TransactionInternalTransactionController do - use ExplorerWeb, :controller +defmodule BlockScoutWeb.TransactionInternalTransactionController do + use BlockScoutWeb, :controller - import ExplorerWeb.Chain, only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1] + import BlockScoutWeb.Chain, only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1] alias Explorer.{Chain, Market} alias Explorer.ExchangeRates.Token diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/transaction_log_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/transaction_log_controller.ex index fcc69b9c85..d833d3cdca 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/transaction_log_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/transaction_log_controller.ex @@ -1,7 +1,7 @@ -defmodule ExplorerWeb.TransactionLogController do - use ExplorerWeb, :controller +defmodule BlockScoutWeb.TransactionLogController do + use BlockScoutWeb, :controller - import ExplorerWeb.Chain, only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1] + import BlockScoutWeb.Chain, only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1] alias Explorer.{Chain, Market} alias Explorer.ExchangeRates.Token diff --git a/apps/block_scout_web/lib/block_scout_web/csp_header.ex b/apps/block_scout_web/lib/block_scout_web/csp_header.ex index 5ab6565150..199ee9f189 100644 --- a/apps/block_scout_web/lib/block_scout_web/csp_header.ex +++ b/apps/block_scout_web/lib/block_scout_web/csp_header.ex @@ -1,4 +1,4 @@ -defmodule ExplorerWeb.CSPHeader do +defmodule BlockScoutWeb.CSPHeader do @moduledoc """ Plug to set content-security-policy with websocket endpoints """ diff --git a/apps/block_scout_web/lib/block_scout_web/endpoint.ex b/apps/block_scout_web/lib/block_scout_web/endpoint.ex index 58a533b425..ec014adf29 100644 --- a/apps/block_scout_web/lib/block_scout_web/endpoint.ex +++ b/apps/block_scout_web/lib/block_scout_web/endpoint.ex @@ -1,11 +1,11 @@ -defmodule ExplorerWeb.Endpoint do +defmodule BlockScoutWeb.Endpoint do use Phoenix.Endpoint, otp_app: :block_scout_web if Application.get_env(:block_scout_web, :sql_sandbox) do plug(Phoenix.Ecto.SQL.Sandbox, repo: Explorer.Repo) end - socket("/socket", ExplorerWeb.UserSocket) + socket("/socket", BlockScoutWeb.UserSocket) # Serve at "/" the static files from "priv/static" directory. # @@ -50,7 +50,7 @@ defmodule ExplorerWeb.Endpoint do signing_salt: "iC2ksJHS" ) - plug(ExplorerWeb.Router) + plug(BlockScoutWeb.Router) def init(_key, config) do if config[:load_from_system_env] do diff --git a/apps/block_scout_web/lib/block_scout_web/etherscan.ex b/apps/block_scout_web/lib/block_scout_web/etherscan.ex index 0d4b8807d4..9fc47e7056 100644 --- a/apps/block_scout_web/lib/block_scout_web/etherscan.ex +++ b/apps/block_scout_web/lib/block_scout_web/etherscan.ex @@ -1,4 +1,4 @@ -defmodule ExplorerWeb.Etherscan do +defmodule BlockScoutWeb.Etherscan do @moduledoc """ Documentation data for Etherscan-compatible API. """ diff --git a/apps/block_scout_web/lib/block_scout_web/event_handler.ex b/apps/block_scout_web/lib/block_scout_web/event_handler.ex index c752fbe12b..937a97d678 100644 --- a/apps/block_scout_web/lib/block_scout_web/event_handler.ex +++ b/apps/block_scout_web/lib/block_scout_web/event_handler.ex @@ -1,11 +1,11 @@ -defmodule ExplorerWeb.EventHandler do +defmodule BlockScoutWeb.EventHandler do @moduledoc """ Subscribing process for broadcast events from Chain context. """ use GenServer alias Explorer.Chain - alias ExplorerWeb.Notifier + alias BlockScoutWeb.Notifier # Client diff --git a/apps/block_scout_web/lib/block_scout_web/exchange_rates/usd.ex b/apps/block_scout_web/lib/block_scout_web/exchange_rates/usd.ex index 9cbcfc1a43..34b2a1f258 100644 --- a/apps/block_scout_web/lib/block_scout_web/exchange_rates/usd.ex +++ b/apps/block_scout_web/lib/block_scout_web/exchange_rates/usd.ex @@ -1,4 +1,4 @@ -defmodule ExplorerWeb.ExchangeRates.USD do +defmodule BlockScoutWeb.ExchangeRates.USD do @moduledoc """ Struct and associated conversion functions for USD currency """ diff --git a/apps/block_scout_web/lib/block_scout_web/gettext.ex b/apps/block_scout_web/lib/block_scout_web/gettext.ex index 1d13ea70a7..9b8a7833f2 100644 --- a/apps/block_scout_web/lib/block_scout_web/gettext.ex +++ b/apps/block_scout_web/lib/block_scout_web/gettext.ex @@ -1,11 +1,11 @@ -defmodule ExplorerWeb.Gettext do +defmodule BlockScoutWeb.Gettext do @moduledoc """ A module providing Internationalization with a gettext-based API. By using [Gettext](https://hexdocs.pm/gettext), your module gains a set of macros for translations, for example: - import ExplorerWeb.Gettext + import BlockScoutWeb.Gettext # Simple translation gettext "Here is the string to translate" diff --git a/apps/block_scout_web/lib/block_scout_web/notifier.ex b/apps/block_scout_web/lib/block_scout_web/notifier.ex index ad05bbc560..bd86c0cbbc 100644 --- a/apps/block_scout_web/lib/block_scout_web/notifier.ex +++ b/apps/block_scout_web/lib/block_scout_web/notifier.ex @@ -1,4 +1,4 @@ -defmodule ExplorerWeb.Notifier do +defmodule BlockScoutWeb.Notifier do @moduledoc """ Responds to events from EventHandler by sending appropriate channel updates to front-end. """ @@ -6,7 +6,7 @@ defmodule ExplorerWeb.Notifier do alias Explorer.{Chain, Market, Repo} alias Explorer.Chain.Address alias Explorer.ExchangeRates.Token - alias ExplorerWeb.Endpoint + alias BlockScoutWeb.Endpoint def handle_event({:chain_event, :addresses, addresses}) do address_count_module = Application.get_env(:block_scout_web, :fake_adapter) || Chain diff --git a/apps/block_scout_web/lib/block_scout_web/router.ex b/apps/block_scout_web/lib/block_scout_web/router.ex index cf06ea319d..ed86d78066 100644 --- a/apps/block_scout_web/lib/block_scout_web/router.ex +++ b/apps/block_scout_web/lib/block_scout_web/router.ex @@ -1,12 +1,12 @@ -defmodule ExplorerWeb.Router do - use ExplorerWeb, :router +defmodule BlockScoutWeb.Router do + use BlockScoutWeb, :router pipeline :browser do plug(:accepts, ["html"]) plug(:fetch_session) plug(:fetch_flash) plug(:protect_from_forgery) - plug(ExplorerWeb.CSPHeader) + plug(BlockScoutWeb.CSPHeader) end pipeline :api do @@ -14,19 +14,19 @@ defmodule ExplorerWeb.Router do end pipeline :set_locale do - plug(SetLocale, gettext: ExplorerWeb.Gettext, default_locale: "en") + plug(SetLocale, gettext: BlockScoutWeb.Gettext, default_locale: "en") end - scope "/api/v1", ExplorerWeb.API.V1, as: :api_v1 do + scope "/api/v1", BlockScoutWeb.API.V1, as: :api_v1 do pipe_through(:api) get("/supply", SupplyController, :supply) end - scope "/api", ExplorerWeb.API.RPC do + scope "/api", BlockScoutWeb.API.RPC do pipe_through(:api) - alias ExplorerWeb.API.RPC + alias BlockScoutWeb.API.RPC forward("/", RPCTranslator, %{ "block" => RPC.BlockController, @@ -34,13 +34,13 @@ defmodule ExplorerWeb.Router do }) end - scope "/", ExplorerWeb do + scope "/", BlockScoutWeb do pipe_through(:browser) pipe_through(:set_locale) resources("/", ChainController, only: [:show], singleton: true, as: :chain) end - scope "/:locale", ExplorerWeb do + scope "/:locale", BlockScoutWeb do pipe_through(:browser) pipe_through(:set_locale) resources("/", ChainController, only: [:show], singleton: true, as: :chain) diff --git a/apps/block_scout_web/lib/block_scout_web/social_media.ex b/apps/block_scout_web/lib/block_scout_web/social_media.ex index 56fdcac032..7c13c7a687 100644 --- a/apps/block_scout_web/lib/block_scout_web/social_media.ex +++ b/apps/block_scout_web/lib/block_scout_web/social_media.ex @@ -1,4 +1,4 @@ -defmodule ExplorerWeb.SocialMedia do +defmodule BlockScoutWeb.SocialMedia do @moduledoc """ This module provides social media links """ diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address/_link.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address/_link.html.eex index 1cce942e4d..67957947e9 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address/_link.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address/_link.html.eex @@ -1,5 +1,5 @@ <%= if @address_hash do %> - <%= link to: address_path(ExplorerWeb.Endpoint, :show, @locale, @address_hash), "data-address-hash": @address_hash, "data-test": "address_hash_link" do %> - <%= render ExplorerWeb.AddressView, "_responsive_hash.html", address_hash: @address_hash, contract: @contract %> + <%= link to: address_path(BlockScoutWeb.Endpoint, :show, @locale, @address_hash), "data-address-hash": @address_hash, "data-test": "address_hash_link" do %> + <%= render BlockScoutWeb.AddressView, "_responsive_hash.html", address_hash: @address_hash, contract: @contract %> <% end %> <% end %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address/_responsive_hash.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address/_responsive_hash.html.eex index fec0178526..ba4a1fc903 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address/_responsive_hash.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address/_responsive_hash.html.eex @@ -1,4 +1,4 @@ <%= @address_hash %> - <%= ExplorerWeb.AddressView.trimmed_hash(@address_hash) %> + <%= BlockScoutWeb.AddressView.trimmed_hash(@address_hash) %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address/overview.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address/overview.html.eex index 506c27ae79..4c0997ffe4 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address/overview.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address/overview.html.eex @@ -16,7 +16,7 @@
<%= gettext "Transfers" %>
@@ -69,11 +69,11 @@This API is provided for developers transitioning their applications from Etherscan to Explorer. It supports GET and POST requests.
<%= get_flash(@conn, :info) %>
<%= get_flash(@conn, :error) %>
<%= render @view_module, @view_template, assigns %><%= gettext("Showing %{count} Pending Transactions", count: @pending_transaction_count) %>
<%= for transaction <- @transactions do %> -- <%= render ExplorerWeb.TransactionView, "_link.html", locale: @locale, transaction_hash: @transfer.transaction_hash %> + <%= render BlockScoutWeb.TransactionView, "_link.html", locale: @locale, transaction_hash: @transfer.transaction_hash %>
- <%= render ExplorerWeb.AddressView, + <%= render BlockScoutWeb.AddressView, "_link.html", address_hash: to_string(@transfer.from_address_hash), - contract: ExplorerWeb.AddressView.contract?(@transfer.from_address), + contract: BlockScoutWeb.AddressView.contract?(@transfer.from_address), locale: @locale %> → - <%= render ExplorerWeb.AddressView, + <%= render BlockScoutWeb.AddressView, "_link.html", address_hash: to_string(@transfer.to_address_hash), - contract: ExplorerWeb.AddressView.contract?(@transfer.to_address), + contract: BlockScoutWeb.AddressView.contract?(@transfer.to_address), locale: @locale %> @@ -40,7 +40,7 @@ number: @transfer.transaction.block_number ), class: "mr-2 mr-sm-0 text-muted", - to: block_path(ExplorerWeb.Endpoint, :show, @locale, @transfer.transaction.block_number) + to: block_path(BlockScoutWeb.Endpoint, :show, @locale, @transfer.transaction.block_number) ) %><%= gettext("Showing") %> <%= Cldr.Number.to_string!(@transaction_estimated_count, format: "#,###") %> <%= gettext("Validated Transactions") %>
<%= for transaction <- @transactions do %> - <%= render ExplorerWeb.TransactionView, "_tile.html", locale: @locale, transaction: transaction %> + <%= render BlockScoutWeb.TransactionView, "_tile.html", locale: @locale, transaction: transaction %> <% end %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex index 98d4294818..38aab03bd8 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex @@ -8,17 +8,17 @@