Merge branch 'master' into ab-fix-first-page-for-uncles-and-reorgs

pull/2564/head
Ayrat Badykov 5 years ago committed by GitHub
commit 017029d86d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      CHANGELOG.md
  2. 2
      apps/block_scout_web/lib/block_scout_web/templates/api_docs/eth_rpc.html.eex
  3. 2
      apps/block_scout_web/lib/block_scout_web/templates/api_docs/index.html.eex
  4. 1
      apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex
  5. 4
      apps/block_scout_web/lib/block_scout_web/templates/layout/app.html.eex
  6. 14
      apps/block_scout_web/lib/block_scout_web/views/api_docs_view.ex
  7. 16
      apps/block_scout_web/priv/gettext/default.pot
  8. 64
      apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po
  9. 36
      apps/block_scout_web/test/block_scout_web/views/api_docs_view_test.exs
  10. 6
      apps/explorer/lib/explorer/chain/supply/rsk.ex
  11. 12
      apps/explorer/test/explorer/chain/supply/rsk_test.exs

@ -20,6 +20,9 @@
- [#2403](https://github.com/poanetwork/blockscout/pull/2403) - Return gasPrice field at the result of gettxinfo method - [#2403](https://github.com/poanetwork/blockscout/pull/2403) - Return gasPrice field at the result of gettxinfo method
### Fixes ### Fixes
- [#2562](https://github.com/poanetwork/blockscout/pull/2562) - Fix dark theme flickering
- [#2560](https://github.com/poanetwork/blockscout/pull/2560) - fix slash before not empty path in docs
- [#2559](https://github.com/poanetwork/blockscout/pull/2559) - fix rsk total supply for empty exchange rate
- [#2553](https://github.com/poanetwork/blockscout/pull/2553) - Dark theme import to the end of sass - [#2553](https://github.com/poanetwork/blockscout/pull/2553) - Dark theme import to the end of sass
- [#2550](https://github.com/poanetwork/blockscout/pull/2550) - correctly encode decimal values for frontend - [#2550](https://github.com/poanetwork/blockscout/pull/2550) - correctly encode decimal values for frontend
- [#2549](https://github.com/poanetwork/blockscout/pull/2549) - Fix wrong colour of tooltip - [#2549](https://github.com/poanetwork/blockscout/pull/2549) - Fix wrong colour of tooltip

@ -2,7 +2,7 @@
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
<h1 class="card-title margin-bottom-sm"><%= gettext("ETH RPC API Documentation") %></h2> <h1 class="card-title margin-bottom-sm"><%= gettext("ETH RPC API Documentation") %></h2>
<p class="api-text-monospace" data-endpoint-url="<%= blockscout_url() %>api/eth_rpc">[ <%= gettext "Base URL:" %> <%= blockscout_url() %>api/eth_rpc ]</p> <p class="api-text-monospace" data-endpoint-url="<%= eth_rpc_api_url() %>">[ <%= gettext "Base URL:" %> <%= eth_rpc_api_url()%> ]</p>
<p class="card-subtitle margin-bottom-0"> <p class="card-subtitle margin-bottom-0">
<%= gettext "This API is provided to support some rpc methods in the exact format specified for ethereum nodes, which can be found " %> <%= gettext "This API is provided to support some rpc methods in the exact format specified for ethereum nodes, which can be found " %>

@ -2,7 +2,7 @@
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
<h1 class="card-title margin-bottom-sm"><%= gettext("API Documentation") %></h2> <h1 class="card-title margin-bottom-sm"><%= gettext("API Documentation") %></h2>
<p class="api-text-monospace" data-endpoint-url="<%= blockscout_url() %>api">[ <%= gettext "Base URL:" %> <%= blockscout_url() %>api ]</p> <p class="api-text-monospace" data-endpoint-url="<%= api_url() %>">[ <%= gettext "Base URL:" %> <%= api_url()%> ]</p>
<p class="card-subtitle margin-bottom-0"><%= gettext "This API is provided for developers transitioning their applications from Etherscan to BlockScout. It supports GET and POST requests." %></p> <p class="card-subtitle margin-bottom-0"><%= gettext "This API is provided for developers transitioning their applications from Etherscan to BlockScout. It supports GET and POST requests." %></p>
</div> </div>
<div class="api-anchors-list"> <div class="api-anchors-list">

@ -159,6 +159,5 @@
if (localStorage.getItem("current-color-mode") === "dark") { if (localStorage.getItem("current-color-mode") === "dark") {
var modeChanger = document.getElementById("dark-mode-changer"); var modeChanger = document.getElementById("dark-mode-changer");
modeChanger.className += " " + "dark-mode-changer--dark"; modeChanger.className += " " + "dark-mode-changer--dark";
document.body.className += " " + "dark-theme-applied";
} }
</script> </script>

@ -23,9 +23,13 @@
<body> <body>
<script> <script>
function applyDarkMode() {
if (localStorage.getItem("current-color-mode") === "dark") { if (localStorage.getItem("current-color-mode") === "dark") {
document.body.className += " " + "dark-theme-applied";
document.body.style.backgroundColor = "#1c1d31"; document.body.style.backgroundColor = "#1c1d31";
} }
}
window.onload = applyDarkMode()
</script> </script>
<div class="layout-container"> <div class="layout-container">
<%= if not Explorer.Chain.finished_indexing?() do %> <%= if not Explorer.Chain.finished_indexing?() do %>

@ -46,4 +46,18 @@ defmodule BlockScoutWeb.APIDocsView do
Endpoint.url() Endpoint.url()
end end
end end
def api_url do
handle_slash("api")
end
def eth_rpc_api_url do
handle_slash("api/eth_rpc")
end
defp handle_slash(path) do
base_url = blockscout_url()
Path.join(base_url, path)
end
end end

@ -62,7 +62,7 @@ msgid "(query)"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/layout/app.html.eex:38 #: lib/block_scout_web/templates/layout/app.html.eex:42
msgid "- We're indexing this chain right now. Some of the counts may be inaccurate." msgid "- We're indexing this chain right now. Some of the counts may be inaccurate."
msgstr "" msgstr ""
@ -157,7 +157,7 @@ msgid "Block Height: %{height}"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/layout/app.html.eex:53 #: lib/block_scout_web/templates/layout/app.html.eex:57
msgid "Block Mined, awaiting import..." msgid "Block Mined, awaiting import..."
msgstr "" msgstr ""
@ -184,7 +184,7 @@ msgid "Blocks"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/layout/app.html.eex:52 #: lib/block_scout_web/templates/layout/app.html.eex:56
msgid "Blocks Indexed" msgid "Blocks Indexed"
msgstr "" msgstr ""
@ -376,7 +376,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address/_balance_card.html.eex:15 #: lib/block_scout_web/templates/address/_balance_card.html.eex:15
#: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:20 #: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:20
#: lib/block_scout_web/templates/layout/app.html.eex:58 #: lib/block_scout_web/templates/layout/app.html.eex:62
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20 #: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20
#: lib/block_scout_web/templates/transaction/_tile.html.eex:29 #: lib/block_scout_web/templates/transaction/_tile.html.eex:29
#: lib/block_scout_web/templates/transaction/overview.html.eex:179 #: lib/block_scout_web/templates/transaction/overview.html.eex:179
@ -457,7 +457,7 @@ msgid "IN"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/layout/app.html.eex:54 #: lib/block_scout_web/templates/layout/app.html.eex:58
msgid "Indexing Tokens" msgid "Indexing Tokens"
msgstr "" msgstr ""
@ -489,7 +489,7 @@ msgid "Inventory"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/layout/app.html.eex:55 #: lib/block_scout_web/templates/layout/app.html.eex:59
msgid "Less than" msgid "Less than"
msgstr "" msgstr ""
@ -510,7 +510,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:31 #: lib/block_scout_web/templates/chain/show.html.eex:31
#: lib/block_scout_web/templates/layout/app.html.eex:56 #: lib/block_scout_web/templates/layout/app.html.eex:60
#: lib/block_scout_web/views/address_view.ex:121 #: lib/block_scout_web/views/address_view.ex:121
#: lib/block_scout_web/views/address_view.ex:121 #: lib/block_scout_web/views/address_view.ex:121
msgid "Market Cap" msgid "Market Cap"
@ -629,7 +629,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:24 #: lib/block_scout_web/templates/chain/show.html.eex:24
#: lib/block_scout_web/templates/layout/app.html.eex:57 #: lib/block_scout_web/templates/layout/app.html.eex:61
msgid "Price" msgid "Price"
msgstr "" msgstr ""

@ -62,7 +62,7 @@ msgid "(query)"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/layout/app.html.eex:38 #: lib/block_scout_web/templates/layout/app.html.eex:42
msgid "- We're indexing this chain right now. Some of the counts may be inaccurate." msgid "- We're indexing this chain right now. Some of the counts may be inaccurate."
msgstr "" msgstr ""
@ -136,8 +136,8 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/block/_link.html.eex:2 #: lib/block_scout_web/templates/block/_link.html.eex:2
#: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:29 #: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:28
#: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:40 #: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:39
msgid "Block #%{number}" msgid "Block #%{number}"
msgstr "" msgstr ""
@ -157,7 +157,7 @@ msgid "Block Height: %{height}"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/layout/app.html.eex:53 #: lib/block_scout_web/templates/layout/app.html.eex:57
msgid "Block Mined, awaiting import..." msgid "Block Mined, awaiting import..."
msgstr "" msgstr ""
@ -184,7 +184,7 @@ msgid "Blocks"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/layout/app.html.eex:52 #: lib/block_scout_web/templates/layout/app.html.eex:56
msgid "Blocks Indexed" msgid "Blocks Indexed"
msgstr "" msgstr ""
@ -211,10 +211,10 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:37 #: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:37
#: lib/block_scout_web/templates/address/overview.html.eex:146 #: lib/block_scout_web/templates/address/overview.html.eex:145
#: lib/block_scout_web/templates/address/overview.html.eex:154 #: lib/block_scout_web/templates/address/overview.html.eex:153
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:107 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:106
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:115 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:114
msgid "Close" msgid "Close"
msgstr "" msgstr ""
@ -375,12 +375,12 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address/_balance_card.html.eex:15 #: lib/block_scout_web/templates/address/_balance_card.html.eex:15
#: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:21 #: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:20
#: lib/block_scout_web/templates/layout/app.html.eex:58 #: lib/block_scout_web/templates/layout/app.html.eex:62
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20 #: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:20
#: lib/block_scout_web/templates/transaction/_tile.html.eex:30 #: lib/block_scout_web/templates/transaction/_tile.html.eex:29
#: lib/block_scout_web/templates/transaction/overview.html.eex:179 #: lib/block_scout_web/templates/transaction/overview.html.eex:179
#: lib/block_scout_web/templates/transaction/overview.html.eex:211 #: lib/block_scout_web/templates/transaction/overview.html.eex:209
#: lib/block_scout_web/views/wei_helpers.ex:78 #: lib/block_scout_web/views/wei_helpers.ex:78
msgid "Ether" msgid "Ether"
msgstr "POA" msgstr "POA"
@ -451,13 +451,13 @@ msgid "Hash"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:39 #: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:38
#: lib/block_scout_web/templates/transaction/_tile.html.eex:74 #: lib/block_scout_web/templates/transaction/_tile.html.eex:72
msgid "IN" msgid "IN"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/layout/app.html.eex:54 #: lib/block_scout_web/templates/layout/app.html.eex:58
msgid "Indexing Tokens" msgid "Indexing Tokens"
msgstr "" msgstr ""
@ -489,12 +489,12 @@ msgid "Inventory"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/layout/app.html.eex:55 #: lib/block_scout_web/templates/layout/app.html.eex:59
msgid "Less than" msgid "Less than"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:239 #: lib/block_scout_web/templates/transaction/overview.html.eex:237
msgid "Limit" msgid "Limit"
msgstr "" msgstr ""
@ -510,7 +510,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:31 #: lib/block_scout_web/templates/chain/show.html.eex:31
#: lib/block_scout_web/templates/layout/app.html.eex:56 #: lib/block_scout_web/templates/layout/app.html.eex:60
#: lib/block_scout_web/views/address_view.ex:121 #: lib/block_scout_web/views/address_view.ex:121
#: lib/block_scout_web/views/address_view.ex:121 #: lib/block_scout_web/views/address_view.ex:121
msgid "Market Cap" msgid "Market Cap"
@ -578,8 +578,8 @@ msgid "Nonce"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:37 #: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:36
#: lib/block_scout_web/templates/transaction/_tile.html.eex:70 #: lib/block_scout_web/templates/transaction/_tile.html.eex:68
msgid "OUT" msgid "OUT"
msgstr "" msgstr ""
@ -629,15 +629,15 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/chain/show.html.eex:24 #: lib/block_scout_web/templates/chain/show.html.eex:24
#: lib/block_scout_web/templates/layout/app.html.eex:57 #: lib/block_scout_web/templates/layout/app.html.eex:61
msgid "Price" msgid "Price"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:33 #: lib/block_scout_web/templates/address/overview.html.eex:33
#: lib/block_scout_web/templates/address/overview.html.eex:145 #: lib/block_scout_web/templates/address/overview.html.eex:144
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:36 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:36
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:106 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:105
msgid "QR Code" msgid "QR Code"
msgstr "" msgstr ""
@ -709,7 +709,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:21 #: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:21
#: lib/block_scout_web/templates/transaction/_tile.html.eex:34 #: lib/block_scout_web/templates/transaction/_tile.html.eex:32
#: lib/block_scout_web/templates/transaction/overview.html.eex:84 #: lib/block_scout_web/templates/transaction/overview.html.eex:84
msgid "TX Fee" msgid "TX Fee"
msgstr "" msgstr ""
@ -915,7 +915,7 @@ msgid "Unique Token"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:233 #: lib/block_scout_web/templates/transaction/overview.html.eex:231
msgid "Used" msgid "Used"
msgstr "" msgstr ""
@ -936,7 +936,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:179 #: lib/block_scout_web/templates/transaction/overview.html.eex:179
#: lib/block_scout_web/templates/transaction/overview.html.eex:211 #: lib/block_scout_web/templates/transaction/overview.html.eex:209
msgid "Value" msgid "Value"
msgstr "" msgstr ""
@ -957,12 +957,12 @@ msgid "View Contract"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/_tile.html.eex:55 #: lib/block_scout_web/templates/transaction/_tile.html.eex:53
msgid "View Less Transfers" msgid "View Less Transfers"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/_tile.html.eex:54 #: lib/block_scout_web/templates/transaction/_tile.html.eex:52
msgid "View More Transfers" msgid "View More Transfers"
msgstr "" msgstr ""
@ -1002,7 +1002,7 @@ msgid "Yes"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:113 #: lib/block_scout_web/templates/address/overview.html.eex:112
msgid "at" msgid "at"
msgstr "" msgstr ""
@ -1450,7 +1450,7 @@ msgid "Incoming Transactions"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/address/overview.html.eex:121 #: lib/block_scout_web/templates/address/overview.html.eex:120
msgid "Error: Could not determine contract creator." msgid "Error: Could not determine contract creator."
msgstr "" msgstr ""
@ -1513,7 +1513,7 @@ msgid "View All Transactions"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:229 #: lib/block_scout_web/templates/transaction/overview.html.eex:227
msgid "Gas" msgid "Gas"
msgstr "" msgstr ""

@ -28,4 +28,40 @@ defmodule BlockScoutWeb.ApiDocsViewTest do
assert APIDocsView.blockscout_url() == "https://blockscout.com/chain/dog" assert APIDocsView.blockscout_url() == "https://blockscout.com/chain/dog"
end end
end end
describe "api_url/1" do
test "adds slash before path" do
Application.put_env(:block_scout_web, BlockScoutWeb.Endpoint,
url: [scheme: "https", host: "blockscout.com", port: 9999, path: "/chain/dog"]
)
assert APIDocsView.api_url() == "https://blockscout.com/chain/dog/api"
end
test "does not add slash to empty path" do
Application.put_env(:block_scout_web, BlockScoutWeb.Endpoint,
url: [scheme: "https", host: "blockscout.com", port: 9999, path: ""]
)
assert APIDocsView.api_url() == "https://blockscout.com/api"
end
end
describe "eth_rpc_api_url/1" do
test "adds slash before path" do
Application.put_env(:block_scout_web, BlockScoutWeb.Endpoint,
url: [scheme: "https", host: "blockscout.com", port: 9999, path: "/chain/dog"]
)
assert APIDocsView.eth_rpc_api_url() == "https://blockscout.com/chain/dog/api/eth_rpc"
end
test "does not add slash to empty path" do
Application.put_env(:block_scout_web, BlockScoutWeb.Endpoint,
url: [scheme: "https", host: "blockscout.com", port: 9999, path: ""]
)
assert APIDocsView.eth_rpc_api_url() == "https://blockscout.com/api/eth_rpc"
end
end
end end

@ -17,12 +17,14 @@ defmodule Explorer.Chain.Supply.RSK do
@cache_name :rsk_balance @cache_name :rsk_balance
@balance_key :balance @balance_key :balance
def market_cap(exchange_rate) do def market_cap(%{usd_value: usd_value}) when not is_nil(usd_value) do
btc = circulating() btc = circulating()
Decimal.mult(btc, exchange_rate.usd_value) Decimal.mult(btc, usd_value)
end end
def market_cap(_), do: Decimal.new(0)
@doc "Equivalent to getting the circulating value " @doc "Equivalent to getting the circulating value "
def supply_for_days(days) do def supply_for_days(days) do
now = Timex.now() now = Timex.now()

@ -24,7 +24,17 @@ defmodule Explorer.Chain.Supply.RSKTest do
exchange_rate = %{Token.null() | usd_value: Decimal.new(1_000_000)} exchange_rate = %{Token.null() | usd_value: Decimal.new(1_000_000)}
assert Decimal.equal?(RSK.market_cap(exchange_rate), Decimal.new(100.0000)) assert Decimal.equal?(RSK.market_cap(exchange_rate), Decimal.from_float(100.0000))
end
test "returns zero when exchange_rate is empty" do
assert RSK.market_cap(nil) == Decimal.new(0)
end
test "returns zero when usd_value is nil" do
exchange_rate = %{Token.null() | usd_value: nil}
assert RSK.market_cap(exchange_rate) == Decimal.new(0)
end end
end end

Loading…
Cancel
Save