Merge pull request #3274 from poanetwork/vb-remove-underscore-from-routes

Replace underscore with hyphen in routes
pull/3276/head
Victor Baranov 4 years ago committed by GitHub
commit 3685e95cc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 4
      apps/block_scout_web/lib/block_scout_web/api_router.ex
  3. 8
      apps/block_scout_web/lib/block_scout_web/router.ex
  4. 16
      apps/block_scout_web/lib/block_scout_web/templates/address/_tabs.html.eex
  5. 8
      apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex
  6. 2
      apps/block_scout_web/lib/block_scout_web/templates/tokens/instance/overview/_tabs.html.eex
  7. 6
      apps/block_scout_web/lib/block_scout_web/templates/tokens/overview/_tabs.html.eex
  8. 6
      apps/block_scout_web/lib/block_scout_web/templates/transaction/_tabs.html.eex
  9. 32
      apps/block_scout_web/lib/block_scout_web/views/address_view.ex
  10. 2
      apps/block_scout_web/lib/block_scout_web/views/api_docs_view.ex
  11. 2
      apps/block_scout_web/lib/block_scout_web/views/tab_helpers.ex
  12. 4
      apps/block_scout_web/lib/block_scout_web/views/tokens/instance/overview_view.ex
  13. 8
      apps/block_scout_web/lib/block_scout_web/views/tokens/overview_view.ex
  14. 2
      apps/block_scout_web/lib/block_scout_web/views/transaction_raw_trace_view.ex
  15. 8
      apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex
  16. 60
      apps/block_scout_web/lib/block_scout_web/web_router.ex
  17. 4
      apps/block_scout_web/priv/gettext/default.pot
  18. 4
      apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po
  19. 2
      apps/block_scout_web/test/block_scout_web/channels/address_channel_test.exs
  20. 4
      apps/block_scout_web/test/block_scout_web/controllers/address_controller_test.exs
  21. 4
      apps/block_scout_web/test/block_scout_web/controllers/address_transaction_controller_test.exs
  22. 50
      apps/block_scout_web/test/block_scout_web/controllers/api/rpc/eth_controller_test.exs
  23. 16
      apps/block_scout_web/test/block_scout_web/controllers/chain_controller_test.exs
  24. 4
      apps/block_scout_web/test/block_scout_web/controllers/tokens/token_controller_test.exs
  25. 4
      apps/block_scout_web/test/block_scout_web/controllers/transaction_controller_test.exs
  26. 2
      apps/block_scout_web/test/block_scout_web/features/pages/token_page.ex
  27. 2
      apps/block_scout_web/test/block_scout_web/features/pages/transaction_list_page.ex
  28. 6
      apps/block_scout_web/test/block_scout_web/views/api_docs_view_test.exs
  29. 20
      apps/block_scout_web/test/block_scout_web/views/tab_helpers_test.exs
  30. 6
      apps/block_scout_web/test/block_scout_web/views/tokens/overview_view_test.exs
  31. 4
      apps/block_scout_web/test/block_scout_web/views/transaction_view_test.exs
  32. 2
      apps/explorer/priv/repo/migrations/20181108205650_additional_internal_transaction_constraints.exs

@ -12,6 +12,7 @@
- [#3256](https://github.com/poanetwork/blockscout/pull/3256) - Fix for invisible validator address at block page and wrong alert text color at xDai
### Chore
- [#3274](https://github.com/poanetwork/blockscout/pull/3274) - Replace underscore with hyphen in routes in routes
- [#3260](https://github.com/poanetwork/blockscout/pull/3260) - Update NPM dependencies to fix known vulnerabilities
- [#3258](https://github.com/poanetwork/blockscout/pull/3258) - Token transfer: check that block exists before retrieving timestamp

@ -35,11 +35,11 @@ defmodule BlockScoutWeb.ApiRouter do
scope "/v1", as: :api_v1 do
get("/supply", V1.SupplyController, :supply)
post("/eth_rpc", RPC.EthController, :eth_request)
post("/eth-rpc", RPC.EthController, :eth_request)
end
# For backward compatibility. Should be removed
post("/eth_rpc", RPC.EthController, :eth_request)
post("/eth-rpc", RPC.EthController, :eth_request)
end
end

@ -45,16 +45,16 @@ defmodule BlockScoutWeb.Router do
else
scope "/", BlockScoutWeb do
pipe_through(:browser)
get("/api_docs", PageNotFoundController, :index)
get("/eth_rpc_api_docs", PageNotFoundController, :index)
get("/api-docs", PageNotFoundController, :index)
get("/eth-rpc-api-docs", PageNotFoundController, :index)
end
end
scope "/", BlockScoutWeb do
pipe_through(:browser)
get("/api_docs", APIDocsController, :index)
get("/eth_rpc_api_docs", APIDocsController, :eth_rpc)
get("/api-docs", APIDocsController, :index)
get("/eth-rpc-api-docs", APIDocsController, :eth_rpc)
end
url_params = Application.get_env(:block_scout_web, BlockScoutWeb.Endpoint)[:url]

@ -7,7 +7,7 @@
<%= if Chain.check_if_token_transfers_at_address(@address.hash) do %>
<%= link(
gettext("Token Transfers"),
class: "card-tab #{tab_status("token_transfers", @conn.request_path)}",
class: "card-tab #{tab_status("token-transfers", @conn.request_path)}",
"data-test": "token_transfers_tab_link",
to: address_token_transfers_path(@conn, :index, @address.hash)
) %>
@ -22,13 +22,13 @@
<% end %>
<%= link(
gettext("Internal Transactions"),
class: "card-tab #{tab_status("internal_transactions", @conn.request_path)}",
class: "card-tab #{tab_status("internal-transactions", @conn.request_path)}",
"data-test": "internal_transactions_tab_link",
to: address_internal_transaction_path(@conn, :index, @address.hash)
) %>
<%= link(
gettext("Coin Balance History"),
class: "card-tab #{tab_status("coin_balances", @conn.request_path)}",
class: "card-tab #{tab_status("coin-balances", @conn.request_path)}",
"data-test": "coin_balance_tab_link",
to: address_coin_balance_path(@conn, :index, @address.hash)
) %>
@ -60,7 +60,7 @@
<%= if has_decompiled_code?(@address) do %>
<%= link(
to: address_decompiled_contract_path(@conn, :index, @address.hash),
class: "card-tab #{tab_status("decompiled_contracts", @conn.request_path)}") do %>
class: "card-tab #{tab_status("decompiled-contracts", @conn.request_path)}") do %>
<%= gettext("Decompiled code") %>
<i class="far fa-check-circle"></i>
<% end %>
@ -69,28 +69,28 @@
<%= link(
gettext("Read Contract"),
to: address_read_contract_path(@conn, :index, @address.hash),
class: "card-tab #{tab_status("read_contract", @conn.request_path)}")
class: "card-tab #{tab_status("read-contract", @conn.request_path)}")
%>
<% end %>
<%= if smart_contract_is_proxy?(@address) do %>
<%= link(
gettext("Read Proxy"),
to: address_read_proxy_path(@conn, :index, @address.hash),
class: "card-tab #{tab_status("read_proxy", @conn.request_path)}")
class: "card-tab #{tab_status("read-proxy", @conn.request_path)}")
%>
<% end %>
<%= if smart_contract_with_write_functions?(@address) do %>
<%= link(
gettext("Write Contract"),
to: address_write_contract_path(@conn, :index, @address.hash),
class: "card-tab #{tab_status("write_contract", @conn.request_path)}")
class: "card-tab #{tab_status("write-contract", @conn.request_path)}")
%>
<% end %>
<%= if smart_contract_with_write_functions?(@address) && smart_contract_is_proxy?(@address) do %>
<%= link(
gettext("Write Proxy"),
to: address_write_proxy_path(@conn, :index, @address.hash),
class: "card-tab #{tab_status("write_proxy", @conn.request_path)}")
class: "card-tab #{tab_status("write-proxy", @conn.request_path)}")
%>
<% end %>
</div>

@ -60,7 +60,7 @@
<%= if variant !== EthereumJSONRPC.Besu do %>
<%= link(
gettext("Pending"),
class: "dropdown-item #{tab_status("pending_transactions", @conn.request_path)}",
class: "dropdown-item #{tab_status("pending-transactions", @conn.request_path)}",
"data-test": "pending_transactions_link",
to: pending_transaction_path(@conn, :index)
) %>
@ -91,7 +91,7 @@
) %>
<%= link(
gettext("Bridged"),
class: "dropdown-item #{tab_status("bridged_tokens", @conn.request_path)}",
class: "dropdown-item #{tab_status("bridged-tokens", @conn.request_path)}",
to: bridged_tokens_path(@conn, :index)
) %>
</div>
@ -123,12 +123,12 @@
) %>
<%= link(
gettext("RPC"),
class: "dropdown-item #{tab_status("api_docs", @conn.request_path)}",
class: "dropdown-item #{tab_status("api-docs", @conn.request_path)}",
to: api_url() <> api_docs_path(@conn, :index)
) %>
<%= link(
gettext("Eth RPC"),
class: "dropdown-item #{tab_status("eth_rpc_api_docs", @conn.request_path)}",
class: "dropdown-item #{tab_status("eth-rpc-api-docs", @conn.request_path)}",
to: api_url() <> api_docs_path(@conn, :eth_rpc)
) %>
</div>

@ -1,7 +1,7 @@
<div class="card-tabs js-card-tabs">
<%= link(
gettext("Token Transfers"),
class: "card-tab #{tab_status("token_transfers", @conn.request_path)}",
class: "card-tab #{tab_status("token-transfers", @conn.request_path)}",
to: token_instance_path(@conn, :show, @token.contract_address_hash, to_string(@token_instance.token_id))
)
%>

@ -1,13 +1,13 @@
<div class="card-tabs js-card-tabs">
<%= link(
gettext("Token Transfers"),
class: "card-tab #{tab_status("token_transfers", @conn.request_path)}",
class: "card-tab #{tab_status("token-transfers", @conn.request_path)}",
to: token_path(@conn, :show, @token.contract_address_hash)
)
%>
<%= link(
gettext("Token Holders"),
class: "card-tab #{tab_status("token_holders", @conn.request_path)}",
class: "card-tab #{tab_status("token-holders", @conn.request_path)}",
"data-test": "token_holders_tab",
to: token_holder_path(@conn, :index, Address.checksum(@token.contract_address_hash))
)
@ -24,7 +24,7 @@
<%= link(
gettext("Read Contract"),
to: token_read_contract_path(@conn, :index, Address.checksum(@token.contract_address_hash)),
class: "card-tab #{tab_status("read_contract", @conn.request_path)}")
class: "card-tab #{tab_status("read-contract", @conn.request_path)}")
%>
<% end %>
</div>

@ -2,14 +2,14 @@
<%= if @show_token_transfers do %>
<%= link(
gettext("Token Transfers"),
class: "card-tab #{tab_status("token_transfers", @conn.request_path)}",
class: "card-tab #{tab_status("token-transfers", @conn.request_path)}",
to: transaction_token_transfer_path(@conn, :index, @transaction)
)
%>
<% end %>
<%= link(
gettext("Internal Transactions"),
class: "card-tab #{tab_status("internal_transactions", @conn.request_path)}",
class: "card-tab #{tab_status("internal-transactions", @conn.request_path)}",
to: transaction_internal_transaction_path(@conn, :index, @transaction)
)
%>
@ -22,7 +22,7 @@
%>
<%= link(
gettext("Raw Trace"),
class: "card-tab #{tab_status("raw_trace", @conn.request_path)}",
class: "card-tab #{tab_status("raw-trace", @conn.request_path)}",
to: transaction_raw_trace_path(@conn, :index, @transaction)
) %>
</div>

@ -13,15 +13,15 @@ defmodule BlockScoutWeb.AddressView do
@dialyzer :no_match
@tabs [
"coin_balances",
"coin-balances",
"contracts",
"decompiled_contracts",
"internal_transactions",
"token_transfers",
"read_contract",
"read_proxy",
"write_contract",
"write_proxy",
"decompiled-contracts",
"internal-transactions",
"token-transfers",
"read-contract",
"read-proxy",
"write-contract",
"write-proxy",
"tokens",
"transactions",
"validations"
@ -341,16 +341,16 @@ defmodule BlockScoutWeb.AddressView do
end
defp tab_name(["tokens"]), do: gettext("Tokens")
defp tab_name(["internal-transactions"]), do: gettext("Internal Transactions")
defp tab_name(["transactions"]), do: gettext("Transactions")
defp tab_name(["internal_transactions"]), do: gettext("Internal Transactions")
defp tab_name(["token_transfers"]), do: gettext("Token Transfers")
defp tab_name(["token-transfers"]), do: gettext("Token Transfers")
defp tab_name(["contracts"]), do: gettext("Code")
defp tab_name(["decompiled_contracts"]), do: gettext("Decompiled Code")
defp tab_name(["read_contract"]), do: gettext("Read Contract")
defp tab_name(["read_proxy"]), do: gettext("Read Proxy")
defp tab_name(["write_contract"]), do: gettext("Write Contract")
defp tab_name(["write_proxy"]), do: gettext("Write Proxy")
defp tab_name(["coin_balances"]), do: gettext("Coin Balance History")
defp tab_name(["decompiled-contracts"]), do: gettext("Decompiled Code")
defp tab_name(["read-contract"]), do: gettext("Read Contract")
defp tab_name(["read-proxy"]), do: gettext("Read Proxy")
defp tab_name(["write-contract"]), do: gettext("Write Contract")
defp tab_name(["write-proxy"]), do: gettext("Write Proxy")
defp tab_name(["coin-balances"]), do: gettext("Coin Balance History")
defp tab_name(["validations"]), do: gettext("Blocks Validated")
defp tab_name(["logs"]), do: gettext("Logs")

@ -84,6 +84,6 @@ defmodule BlockScoutWeb.APIDocsView do
set_path
|> blockscout_url(is_api)
|> Path.join("api/eth_rpc")
|> Path.join("api/eth-rpc")
end
end

@ -42,6 +42,6 @@ defmodule BlockScoutWeb.TabHelpers do
false
"""
def tab_active?(tab_name, request_path) do
String.match?(request_path, ~r/\b#{tab_name}\b/)
String.match?(request_path, ~r/\/\b#{tab_name}\b/)
end
end

@ -6,7 +6,7 @@ defmodule BlockScoutWeb.Tokens.Instance.OverviewView do
import BlockScoutWeb.APIDocsView, only: [blockscout_url: 1, blockscout_url: 2]
@tabs ["token_transfers", "metadata"]
@tabs ["token-transfers", "metadata"]
def token_name?(%Token{name: nil}), do: false
def token_name?(%Token{name: _}), do: true
@ -95,6 +95,6 @@ defmodule BlockScoutWeb.Tokens.Instance.OverviewView do
image
end
defp tab_name(["token_transfers"]), do: gettext("Token Transfers")
defp tab_name(["token-transfers"]), do: gettext("Token Transfers")
defp tab_name(["metadata"]), do: gettext("Metadata")
end

@ -5,7 +5,7 @@ defmodule BlockScoutWeb.Tokens.OverviewView do
alias BlockScoutWeb.{CurrencyHelpers, LayoutView}
@tabs ["token_transfers", "token_holders", "read_contract", "inventory"]
@tabs ["token-transfers", "token-holders", "read-contract", "inventory"]
@etherscan_token_link "https://etherscan.io/token/"
@blockscout_base_link "https://blockscout.com/"
@ -34,9 +34,9 @@ defmodule BlockScoutWeb.Tokens.OverviewView do
|> tab_name()
end
defp tab_name(["token_transfers"]), do: gettext("Token Transfers")
defp tab_name(["token_holders"]), do: gettext("Token Holders")
defp tab_name(["read_contract"]), do: gettext("Read Contract")
defp tab_name(["token-transfers"]), do: gettext("Token Transfers")
defp tab_name(["token-holders"]), do: gettext("Token Holders")
defp tab_name(["read-contract"]), do: gettext("Read Contract")
defp tab_name(["inventory"]), do: gettext("Inventory")
def display_inventory?(%Token{type: "ERC-721"}), do: true

@ -5,7 +5,7 @@ defmodule BlockScoutWeb.TransactionRawTraceView do
alias Explorer.Chain.InternalTransaction
def render("scripts.html", %{conn: conn}) do
render_scripts(conn, "raw_trace/code_highlighting.js")
render_scripts(conn, "raw-trace/code_highlighting.js")
end
def raw_traces_with_lines(internal_transactions) do

@ -13,7 +13,7 @@ defmodule BlockScoutWeb.TransactionView do
import BlockScoutWeb.Gettext
import BlockScoutWeb.Tokens.Helpers
@tabs ["token_transfers", "internal_transactions", "logs", "raw_trace"]
@tabs ["token-transfers", "internal-transactions", "logs", "raw-trace"]
{:ok, burn_address_hash} = Chain.string_to_address_hash("0x0000000000000000000000000000000000000000")
@burn_address_hash burn_address_hash
@ -391,10 +391,10 @@ defmodule BlockScoutWeb.TransactionView do
|> tab_name()
end
defp tab_name(["token_transfers"]), do: gettext("Token Transfers")
defp tab_name(["internal_transactions"]), do: gettext("Internal Transactions")
defp tab_name(["token-transfers"]), do: gettext("Token Transfers")
defp tab_name(["internal-transactions"]), do: gettext("Internal Transactions")
defp tab_name(["logs"]), do: gettext("Logs")
defp tab_name(["raw_trace"]), do: gettext("Raw Trace")
defp tab_name(["raw-trace"]), do: gettext("Raw Trace")
defp get_token_transfer_type(token_transfers) do
token_transfers

@ -24,12 +24,12 @@ defmodule BlockScoutWeb.WebRouter do
resources("/", ChainController, only: [:show], singleton: true, as: :chain)
resources("/market_history_chart", Chain.MarketHistoryChartController,
resources("/market-history-chart", Chain.MarketHistoryChartController,
only: [:show],
singleton: true
)
resources("/transaction_history_chart", Chain.TransactionHistoryChartController,
resources("/transaction-history-chart", Chain.TransactionHistoryChartController,
only: [:show],
singleton: true
)
@ -42,22 +42,22 @@ defmodule BlockScoutWeb.WebRouter do
get("/uncles", BlockController, :uncle, as: :uncle)
resources("/pending_transactions", PendingTransactionController, only: [:index])
resources("/pending-transactions", PendingTransactionController, only: [:index])
resources("/recent_transactions", RecentTransactionsController, only: [:index])
resources("/recent-transactions", RecentTransactionsController, only: [:index])
get("/txs", TransactionController, :index)
resources "/tx", TransactionController, only: [:show] do
resources(
"/internal_transactions",
"/internal-transactions",
TransactionInternalTransactionController,
only: [:index],
as: :internal_transaction
)
resources(
"/raw_trace",
"/raw-trace",
TransactionRawTraceController,
only: [:index],
as: :raw_trace
@ -65,7 +65,7 @@ defmodule BlockScoutWeb.WebRouter do
resources("/logs", TransactionLogController, only: [:index], as: :log)
resources("/token_transfers", TransactionTokenTransferController,
resources("/token-transfers", TransactionTokenTransferController,
only: [:index],
as: :token_transfer
)
@ -75,13 +75,13 @@ defmodule BlockScoutWeb.WebRouter do
resources("/tokens", TokensController, only: [:index])
resources("/bridged_tokens", BridgedTokensController, only: [:index])
resources("/bridged-tokens", BridgedTokensController, only: [:index])
resources "/address", AddressController, only: [:show] do
resources("/transactions", AddressTransactionController, only: [:index], as: :transaction)
resources(
"/internal_transactions",
"/internal-transactions",
AddressInternalTransactionController,
only: [:index],
as: :internal_transaction
@ -102,7 +102,7 @@ defmodule BlockScoutWeb.WebRouter do
)
resources(
"/decompiled_contracts",
"/decompiled-contracts",
AddressDecompiledContractController,
only: [:index],
as: :decompiled_contract
@ -123,35 +123,35 @@ defmodule BlockScoutWeb.WebRouter do
)
resources(
"/read_contract",
"/read-contract",
AddressReadContractController,
only: [:index, :show],
as: :read_contract
)
resources(
"/read_proxy",
"/read-proxy",
AddressReadProxyController,
only: [:index, :show],
as: :read_proxy
)
resources(
"/write_contract",
"/write-contract",
AddressWriteContractController,
only: [:index, :show],
as: :write_contract
)
resources(
"/write_proxy",
"/write-proxy",
AddressWriteProxyController,
only: [:index, :show],
as: :write_proxy
)
resources(
"/token_transfers",
"/token-transfers",
AddressTokenTransferController,
only: [:index],
as: :token_transfers
@ -159,7 +159,7 @@ defmodule BlockScoutWeb.WebRouter do
resources("/tokens", AddressTokenController, only: [:index], as: :token) do
resources(
"/token_transfers",
"/token-transfers",
AddressTokenTransferController,
only: [:index],
as: :transfers
@ -167,21 +167,21 @@ defmodule BlockScoutWeb.WebRouter do
end
resources(
"/token_balances",
"/token-balances",
AddressTokenBalanceController,
only: [:index],
as: :token_balance
)
resources(
"/coin_balances",
"/coin-balances",
AddressCoinBalanceController,
only: [:index],
as: :coin_balance
)
resources(
"/coin_balances/by_day",
"/coin-balances/by-day",
AddressCoinBalanceByDayController,
only: [:index],
as: :coin_balance_by_day
@ -190,21 +190,21 @@ defmodule BlockScoutWeb.WebRouter do
resources "/tokens", Tokens.TokenController, only: [:show], as: :token do
resources(
"/token_transfers",
"/token-transfers",
Tokens.TransferController,
only: [:index],
as: :transfer
)
resources(
"/read_contract",
"/read-contract",
Tokens.ReadContractController,
only: [:index],
as: :read_contract
)
resources(
"/token_holders",
"/token-holders",
Tokens.HolderController,
only: [:index],
as: :holder
@ -224,7 +224,7 @@ defmodule BlockScoutWeb.WebRouter do
as: :instance
) do
resources(
"/token_transfers",
"/token-transfers",
Tokens.Instance.TransferController,
only: [:index],
as: :transfer
@ -240,27 +240,27 @@ defmodule BlockScoutWeb.WebRouter do
end
resources(
"/smart_contracts",
"/smart-contracts",
SmartContractController,
only: [:index, :show],
as: :smart_contract
)
get("/address_counters", AddressController, :address_counters)
get("/address-counters", AddressController, :address_counters)
get("/search", ChainController, :search)
get("/search_logs", AddressLogsController, :search_logs)
get("/search-logs", AddressLogsController, :search_logs)
get("/transactions_csv", AddressTransactionController, :transactions_csv)
get("/token_autocomplete", ChainController, :token_autocomplete)
get("/token-autocomplete", ChainController, :token_autocomplete)
get("/token_transfers_csv", AddressTransactionController, :token_transfers_csv)
get("/token-transfers-csv", AddressTransactionController, :token_transfers_csv)
get("/chain_blocks", ChainController, :chain_blocks, as: :chain_blocks)
get("/chain-blocks", ChainController, :chain_blocks, as: :chain_blocks)
get("/token_counters", Tokens.TokenController, :token_counters)
get("/token-counters", Tokens.TokenController, :token_counters)
get("/*path", PageNotFoundController, :index)
end

@ -1826,7 +1826,7 @@ msgstr ""
#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:19
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:11
#: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:6
#: lib/block_scout_web/views/address_view.ex:345
#: lib/block_scout_web/views/address_view.ex:344
#: lib/block_scout_web/views/transaction_view.ex:395
msgid "Internal Transactions"
msgstr ""
@ -1868,7 +1868,7 @@ msgstr ""
#: lib/block_scout_web/templates/block_transaction/index.html.eex:18
#: lib/block_scout_web/templates/chain/show.html.eex:195
#: lib/block_scout_web/templates/layout/_topnav.html.eex:50
#: lib/block_scout_web/views/address_view.ex:344
#: lib/block_scout_web/views/address_view.ex:345
msgid "Transactions"
msgstr ""

@ -1826,7 +1826,7 @@ msgstr ""
#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:19
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:11
#: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:6
#: lib/block_scout_web/views/address_view.ex:345
#: lib/block_scout_web/views/address_view.ex:344
#: lib/block_scout_web/views/transaction_view.ex:395
msgid "Internal Transactions"
msgstr ""
@ -1868,7 +1868,7 @@ msgstr ""
#: lib/block_scout_web/templates/block_transaction/index.html.eex:18
#: lib/block_scout_web/templates/chain/show.html.eex:195
#: lib/block_scout_web/templates/layout/_topnav.html.eex:50
#: lib/block_scout_web/views/address_view.ex:344
#: lib/block_scout_web/views/address_view.ex:345
msgid "Transactions"
msgstr ""

@ -40,7 +40,7 @@ defmodule BlockScoutWeb.AddressChannelTest do
assert_reply(ref, :ok, %{balance: sent_balance, balance_card: balance_card})
assert sent_balance == address.fetched_coin_balance.value
assert balance_card =~ "/address/#{address.hash}/token_balances"
assert balance_card =~ "/address/#{address.hash}/token-balances"
end
end

@ -76,11 +76,11 @@ defmodule BlockScoutWeb.AddressControllerTest do
end
end
describe "GET address_counters/2" do
describe "GET address-counters/2" do
test "returns address counters", %{conn: conn} do
address = insert(:address)
conn = get(conn, "/address_counters", %{"id" => Address.checksum(address.hash)})
conn = get(conn, "/address-counters", %{"id" => Address.checksum(address.hash)})
assert conn.status == 200
{:ok, response} = Jason.decode(conn.resp_body)

@ -157,7 +157,7 @@ defmodule BlockScoutWeb.AddressTransactionControllerTest do
end
end
describe "GET token_transfers_csv/2" do
describe "GET token-transfers-csv/2" do
test "exports token transfers to csv", %{conn: conn} do
address = insert(:address)
@ -169,7 +169,7 @@ defmodule BlockScoutWeb.AddressTransactionControllerTest do
insert(:token_transfer, transaction: transaction, from_address: address)
insert(:token_transfer, transaction: transaction, to_address: address)
conn = get(conn, "/token_transfers_csv", %{"address_id" => Address.checksum(address.hash)})
conn = get(conn, "/token-transfers-csv", %{"address_id" => Address.checksum(address.hash)})
assert conn.resp_body |> String.split("\n") |> Enum.count() == 4
end

@ -41,7 +41,7 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do
test "with an invalid address", %{conn: conn, api_params: api_params} do
assert response =
conn
|> post("/api/eth_rpc", params(api_params, [%{"address" => "badhash"}]))
|> post("/api/eth-rpc", params(api_params, [%{"address" => "badhash"}]))
|> json_response(200)
assert %{"error" => "invalid address"} = response
@ -53,7 +53,7 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do
assert response =
conn
|> post("/api/eth_rpc", params(api_params, [%{"address" => to_string(address.hash)}]))
|> post("/api/eth-rpc", params(api_params, [%{"address" => to_string(address.hash)}]))
|> json_response(200)
assert %{"result" => []} = response
@ -64,7 +64,7 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do
assert response =
conn
|> post("/api/eth_rpc", params(api_params, [%{"address" => to_string(address.hash)}]))
|> post("/api/eth-rpc", params(api_params, [%{"address" => to_string(address.hash)}]))
|> json_response(200)
assert %{"result" => []} = response
@ -82,7 +82,7 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do
assert response =
conn
|> post("/api/eth_rpc", params)
|> post("/api/eth-rpc", params)
|> json_response(200)
assert %{"result" => [%{"data" => "0x010101"}]} = response
@ -100,7 +100,7 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do
assert response =
conn
|> post("/api/eth_rpc", params)
|> post("/api/eth-rpc", params)
|> json_response(200)
assert %{"result" => [%{"data" => "0x010101"}]} = response
@ -119,7 +119,7 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do
assert response =
conn
|> post("/api/eth_rpc", params)
|> post("/api/eth-rpc", params)
|> json_response(200)
assert [%{"data" => "0x010101"}, %{"data" => "0x020202"}] = Enum.sort_by(response["result"], &Map.get(&1, "data"))
@ -141,7 +141,7 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do
assert response =
conn
|> post("/api/eth_rpc", params)
|> post("/api/eth-rpc", params)
|> json_response(200)
assert Enum.count(response["result"]) == 1000
@ -161,7 +161,7 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do
assert new_response =
conn
|> post("/api/eth_rpc", new_params)
|> post("/api/eth-rpc", new_params)
|> json_response(200)
assert Enum.count(response["result"]) == 1000
@ -202,7 +202,7 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do
assert response =
conn
|> post("/api/eth_rpc", params)
|> post("/api/eth-rpc", params)
|> json_response(200)
assert [%{"data" => "0x010101"}] = response["result"]
@ -238,7 +238,7 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do
assert response =
conn
|> post("/api/eth_rpc", params)
|> post("/api/eth-rpc", params)
|> json_response(200)
assert [%{"data" => "0x010101"}, %{"data" => "0x020202"}] = Enum.sort_by(response["result"], &Map.get(&1, "data"))
@ -270,7 +270,7 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do
assert response =
conn
|> post("/api/eth_rpc", params)
|> post("/api/eth-rpc", params)
|> json_response(200)
assert [%{"data" => "0x020202"}, %{"data" => "0x030303"}] = Enum.sort_by(response["result"], &Map.get(&1, "data"))
@ -298,7 +298,7 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do
assert response =
conn
|> post("/api/eth_rpc", params)
|> post("/api/eth-rpc", params)
|> json_response(200)
assert [%{"data" => "0x020202"}] = response["result"]
@ -327,7 +327,7 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do
assert response =
conn
|> post("/api/eth_rpc", params)
|> post("/api/eth-rpc", params)
|> json_response(200)
assert [%{"data" => "0x010101"}] = response["result"]
@ -360,7 +360,7 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do
assert response =
conn
|> post("/api/eth_rpc", params)
|> post("/api/eth-rpc", params)
|> json_response(200)
assert [%{"data" => "0x030303"}] = response["result"]
@ -381,7 +381,7 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do
test "with an invalid address", %{conn: conn, api_params: api_params} do
assert response =
conn
|> post("/api/eth_rpc", params(api_params, ["badHash"]))
|> post("/api/eth-rpc", params(api_params, ["badHash"]))
|> json_response(200)
assert %{"error" => "Query parameter 'address' is invalid"} = response
@ -392,7 +392,7 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do
assert response =
conn
|> post("/api/eth_rpc", params(api_params, [to_string(address.hash)]))
|> post("/api/eth-rpc", params(api_params, [to_string(address.hash)]))
|> json_response(200)
assert %{"error" => "Balance not found"} = response
@ -406,7 +406,7 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do
assert response =
conn
|> post("/api/eth_rpc", params(api_params, [to_string(address.hash)]))
|> post("/api/eth-rpc", params(api_params, [to_string(address.hash)]))
|> json_response(200)
assert %{"result" => "0x1"} = response
@ -420,7 +420,7 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do
assert response =
conn
|> post("/api/eth_rpc", params(api_params, [to_string(address.hash), "earliest"]))
|> post("/api/eth-rpc", params(api_params, [to_string(address.hash), "earliest"]))
|> json_response(200)
assert response["error"] == "Balance not found"
@ -434,7 +434,7 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do
assert response =
conn
|> post("/api/eth_rpc", params(api_params, [to_string(address.hash), "earliest"]))
|> post("/api/eth-rpc", params(api_params, [to_string(address.hash), "earliest"]))
|> json_response(200)
assert response["result"] == "0x1"
@ -448,7 +448,7 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do
assert response =
conn
|> post("/api/eth_rpc", params(api_params, [to_string(address.hash), "pending"]))
|> post("/api/eth-rpc", params(api_params, [to_string(address.hash), "pending"]))
|> json_response(200)
assert response["error"] == "Balance not found"
@ -462,7 +462,7 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do
assert response =
conn
|> post("/api/eth_rpc", params(api_params, [to_string(address.hash), "pending"]))
|> post("/api/eth-rpc", params(api_params, [to_string(address.hash), "pending"]))
|> json_response(200)
assert response["result"] == "0x1"
@ -477,7 +477,7 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do
assert response =
conn
|> post("/api/eth_rpc", params(api_params, [to_string(address.hash), "pending"]))
|> post("/api/eth-rpc", params(api_params, [to_string(address.hash), "pending"]))
|> json_response(200)
assert response["result"] == "0x1"
@ -492,7 +492,7 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do
assert response =
conn
|> post("/api/eth_rpc", params(api_params, [to_string(address.hash), "2"]))
|> post("/api/eth-rpc", params(api_params, [to_string(address.hash), "2"]))
|> json_response(200)
assert response["result"] == "0x2"
@ -505,7 +505,7 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do
assert response =
conn
|> post("/api/eth_rpc", params(api_params, [to_string(address.hash), "2"]))
|> post("/api/eth-rpc", params(api_params, [to_string(address.hash), "2"]))
|> json_response(200)
assert response["error"] == "Balance not found"
@ -527,7 +527,7 @@ defmodule BlockScoutWeb.API.RPC.EthControllerTest do
assert response =
conn
|> put_req_header("content-type", "application/json")
|> post("/api/eth_rpc", Jason.encode!(params))
|> post("/api/eth-rpc", Jason.encode!(params))
|> json_response(200)
assert [

@ -32,7 +32,7 @@ defmodule BlockScoutWeb.ChainControllerTest do
conn =
build_conn()
|> put_req_header("x-requested-with", "xmlhttprequest")
|> get("/chain_blocks")
|> get("/chain-blocks")
response = json_response(conn, 200)
@ -46,7 +46,7 @@ defmodule BlockScoutWeb.ChainControllerTest do
conn =
build_conn()
|> put_req_header("x-requested-with", "xmlhttprequest")
|> get("/chain_blocks")
|> get("/chain-blocks")
response = json_response(conn, 200)
@ -62,7 +62,7 @@ defmodule BlockScoutWeb.ChainControllerTest do
conn =
build_conn()
|> put_req_header("x-requested-with", "xmlhttprequest")
|> get("/chain_blocks")
|> get("/chain-blocks")
response = List.first(json_response(conn, 200)["blocks"])
@ -77,7 +77,7 @@ defmodule BlockScoutWeb.ChainControllerTest do
conn =
build_conn()
|> get("/token_autocomplete?q=magic")
|> get("/token-autocomplete?q=magic")
assert Enum.count(json_response(conn, 200)) == 1
end
@ -88,7 +88,7 @@ defmodule BlockScoutWeb.ChainControllerTest do
conn =
build_conn()
|> get("/token_autocomplete?q=magic")
|> get("/token-autocomplete?q=magic")
assert Enum.count(json_response(conn, 200)) == 2
end
@ -98,7 +98,7 @@ defmodule BlockScoutWeb.ChainControllerTest do
conn =
build_conn()
|> get("/token_autocomplete?q=sup")
|> get("/token-autocomplete?q=sup")
assert Enum.count(json_response(conn, 200)) == 1
end
@ -109,7 +109,7 @@ defmodule BlockScoutWeb.ChainControllerTest do
conn =
build_conn()
|> get("/token_autocomplete?q=mag")
|> get("/token-autocomplete?q=mag")
assert Enum.count(json_response(conn, 200)) == 2
end
@ -124,7 +124,7 @@ defmodule BlockScoutWeb.ChainControllerTest do
conn =
build_conn()
|> get("/token_autocomplete?q=mag")
|> get("/token-autocomplete?q=mag")
assert Enum.count(json_response(conn, 200)) == 4
end

@ -13,7 +13,7 @@ defmodule BlockScoutWeb.Tokens.TokenControllerTest do
end
end
describe "GET token_counters/2" do
describe "GET token-counters/2" do
test "returns token counters", %{conn: conn} do
contract_address = insert(:address)
@ -27,7 +27,7 @@ defmodule BlockScoutWeb.Tokens.TokenControllerTest do
token_id: token_id
)
conn = get(conn, "/token_counters", %{"id" => Address.checksum(contract_address.hash)})
conn = get(conn, "/token-counters", %{"id" => Address.checksum(contract_address.hash)})
assert conn.status == 200
{:ok, response} = Jason.decode(conn.resp_body)

@ -127,7 +127,7 @@ defmodule BlockScoutWeb.TransactionControllerTest do
assert html_response(conn, 422)
end
test "redirects to transactions/:transaction_id/token_transfers when there are token transfers", %{conn: conn} do
test "redirects to transactions/:transaction_id/token-transfers when there are token transfers", %{conn: conn} do
transaction = insert(:transaction)
insert(:token_transfer, transaction: transaction)
conn = get(conn, transaction_path(BlockScoutWeb.Endpoint, :show, transaction))
@ -135,7 +135,7 @@ defmodule BlockScoutWeb.TransactionControllerTest do
assert redirected_to(conn) =~ transaction_token_transfer_path(BlockScoutWeb.Endpoint, :index, transaction)
end
test "redirects to transactions/:transaction_id/internal_transactions when there are no token transfers", %{
test "redirects to transactions/:transaction_id/internal-transactions when there are no token transfers", %{
conn: conn
} do
transaction = insert(:transaction)

@ -10,7 +10,7 @@ defmodule BlockScoutWeb.TokenPage do
end
def visit_page(session, contract_address_hash) do
visit(session, "tokens/#{contract_address_hash}/token_holders")
visit(session, "tokens/#{contract_address_hash}/token-holders")
end
def token_holders_tab(count: count) do

@ -28,6 +28,6 @@ defmodule BlockScoutWeb.TransactionListPage do
end
def visit_pending_transactions_page(session) do
visit(session, "/pending_transactions")
visit(session, "/pending-transactions")
end
end

@ -86,7 +86,7 @@ defmodule BlockScoutWeb.ApiDocsViewTest do
url: [scheme: "https", host: "blockscout.com", port: 9999, api_path: "/chain/dog"]
)
assert APIDocsView.eth_rpc_api_url() == "https://blockscout.com/chain/dog/api/eth_rpc"
assert APIDocsView.eth_rpc_api_url() == "https://blockscout.com/chain/dog/api/eth-rpc"
end
test "does not add slash to empty path" do
@ -94,7 +94,7 @@ defmodule BlockScoutWeb.ApiDocsViewTest do
url: [scheme: "https", host: "blockscout.com", port: 9999, path: ""]
)
assert APIDocsView.eth_rpc_api_url() == "https://blockscout.com/api/eth_rpc"
assert APIDocsView.eth_rpc_api_url() == "https://blockscout.com/api/eth-rpc"
end
test "localhost return with port" do
@ -103,7 +103,7 @@ defmodule BlockScoutWeb.ApiDocsViewTest do
http: [port: 9999]
)
assert APIDocsView.eth_rpc_api_url() == "http://localhost:9999/api/eth_rpc"
assert APIDocsView.eth_rpc_api_url() == "http://localhost:9999/api/eth-rpc"
end
end
end

@ -7,15 +7,15 @@ defmodule BlockScoutWeb.TabHelpersTest do
describe "tab_status/2" do
test "returns \"active\" if the tab is active" do
tab_name = "token_transfers"
request_path = "/page/0xSom3tH1ng/token_transfers/?additional_params=blah"
tab_name = "token-transfers"
request_path = "/page/0xSom3tH1ng/token-transfers/?additional_params=blah"
assert TabHelpers.tab_status(tab_name, request_path) == "active"
end
test "returns nil if the tab is not active" do
tab_name = "internal_transactions"
request_path = "/page/0xSom3tH1ng/token_transfers/?additional_params=blah"
tab_name = "internal-transactions"
request_path = "/page/0xSom3tH1ng/token-transfers/?additional_params=blah"
assert TabHelpers.tab_status(tab_name, request_path) == nil
end
@ -23,16 +23,16 @@ defmodule BlockScoutWeb.TabHelpersTest do
describe "tab_active?/2" do
test "returns true if the tab name is in the path" do
tab_name = "token_transfers"
request_path = "/page/0xSom3tH1ng/token_transfers/?additional_params=blah"
tab_name = "token-transfers"
request_path = "/page/0xSom3tH1ng/token-transfers/?additional_params=blah"
assert TabHelpers.tab_active?(tab_name, request_path)
end
test "matches the tab name at any path level" do
tab_name_1 = "token_transfers"
tab_name_1 = "token-transfers"
tab_name_2 = "tokens"
request_path = "/page/0xSom3tH1ng/tokens/0xLuc4S/token_transfers/0xd4uMl1Gu1"
request_path = "/page/0xSom3tH1ng/tokens/0xLuc4S/token-transfers/0xd4uMl1Gu1"
assert TabHelpers.tab_active?(tab_name_1, request_path)
assert TabHelpers.tab_active?(tab_name_2, request_path)
@ -41,7 +41,7 @@ defmodule BlockScoutWeb.TabHelpersTest do
test "matches only the exact tab name to avoid ambiguity" do
tab_name = "transactions"
request_path_1 = "/page/0xSom3tH1ng/transactions"
request_path_2 = "/page/0xSom3tH1ng/internal_transactions"
request_path_2 = "/page/0xSom3tH1ng/internal-transactions"
assert TabHelpers.tab_active?(tab_name, request_path_1)
refute TabHelpers.tab_active?(tab_name, request_path_2)
@ -49,7 +49,7 @@ defmodule BlockScoutWeb.TabHelpersTest do
test "returns nil if the tab name is not in the path" do
tab_name = "internal_transactions"
request_path = "/page/0xSom3tH1ng/token_transfers/?additional_params=blah"
request_path = "/page/0xSom3tH1ng/token-transfers/?additional_params=blah"
refute TabHelpers.tab_active?(tab_name, request_path)
end

@ -47,19 +47,19 @@ defmodule BlockScoutWeb.Tokens.OverviewViewTest do
describe "current_tab_name/1" do
test "returns the correctly text for the token_transfers tab" do
token_transfers_path = "/page/0xSom3tH1ng/token_transfers/?additional_params=blah"
token_transfers_path = "/page/0xSom3tH1ng/token-transfers/?additional_params=blah"
assert OverviewView.current_tab_name(token_transfers_path) == "Token Transfers"
end
test "returns the correctly text for the token_holders tab" do
token_holders_path = "/page/0xSom3tH1ng/token_holders/?additional_params=blah"
token_holders_path = "/page/0xSom3tH1ng/token-holders/?additional_params=blah"
assert OverviewView.current_tab_name(token_holders_path) == "Token Holders"
end
test "returns the correctly text for the read_contract tab" do
read_contract_path = "/page/0xSom3tH1ng/read_contract/?additional_params=blah"
read_contract_path = "/page/0xSom3tH1ng/read-contract/?additional_params=blah"
assert OverviewView.current_tab_name(read_contract_path) == "Read Contract"
end

@ -243,8 +243,8 @@ defmodule BlockScoutWeb.TransactionViewTest do
describe "current_tab_name/1" do
test "generates the correct tab name" do
token_transfers_path = "/page/0xSom3tH1ng/token_transfers/?additional_params=blah"
internal_transactions_path = "/page/0xSom3tH1ng/internal_transactions/?additional_params=blah"
token_transfers_path = "/page/0xSom3tH1ng/token-transfers/?additional_params=blah"
internal_transactions_path = "/page/0xSom3tH1ng/internal-transactions/?additional_params=blah"
logs_path = "/page/0xSom3tH1ng/logs/?additional_params=blah"
assert TransactionView.current_tab_name(token_transfers_path) == "Token Transfers"

@ -9,7 +9,7 @@ defmodule Explorer.Repo.Migrations.AdditionalInternalTransactionConstraints do
```
NOTE: you may want to consider using `apps/explorer/priv/repo/migrations/scripts/20181108205650_large_additional_internal_transaction_constraints.sql`
instead if you are dealing with a very large number of transactions/internal_transactions.
instead if you are dealing with a very large number of transactions/internal-transactions.
"""
use Ecto.Migration

Loading…
Cancel
Save