Merge pull request #2468 from poanetwork/ab-fix-confirmation-for-non-consensus-blocks

fix confirmations for non consensus blocks
pull/2612/head
Victor Baranov 5 years ago committed by GitHub
commit cf95dcd154
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 6
      apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex
  3. 4
      apps/block_scout_web/lib/block_scout_web/views/wei_helpers.ex
  4. 1610
      apps/block_scout_web/priv/gettext/default.pot
  5. 1613
      apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po
  6. 2
      apps/block_scout_web/test/block_scout_web/features/viewing_addresses_test.exs
  7. 8
      apps/block_scout_web/test/block_scout_web/views/address_coin_balance_view_test.exs
  8. 2
      apps/block_scout_web/test/block_scout_web/views/block_view_test.exs
  9. 7
      apps/block_scout_web/test/block_scout_web/views/transaction_view_test.exs

@ -9,6 +9,7 @@
- [#2497](https://github.com/poanetwork/blockscout/pull/2497) - Add generic Ordered Cache behaviour and implementation
### Fixes
- [#2468](https://github.com/poanetwork/blockscout/pull/2468) - fix confirmations for non consensus blocks
- [#2610](https://github.com/poanetwork/blockscout/pull/2610) - use CoinGecko instead of CoinMarketcap for exchange rates
- [#2640](https://github.com/poanetwork/blockscout/pull/2640) - SVG network icons
- [#2635](https://github.com/poanetwork/blockscout/pull/2635) - optimize ERC721 inventory query

@ -135,12 +135,12 @@ defmodule BlockScoutWeb.TransactionView do
def confirmations(%Transaction{block: block}, named_arguments) when is_list(named_arguments) do
case block do
nil ->
0
%Block{consensus: true} ->
{:ok, confirmations} = Chain.confirmations(block, named_arguments)
BlockScoutWeb.Cldr.Number.to_string!(confirmations, format: "#,###")
_ ->
0
end
end

@ -35,7 +35,7 @@ defmodule BlockScoutWeb.WeiHelpers do
"10,000 Gwei"
iex> format_wei_value(%Wei{value: Decimal.new(1, 10, 21)}, :ether)
"10,000 POA"
"10,000 Ether"
# With formatting options
@ -43,7 +43,7 @@ defmodule BlockScoutWeb.WeiHelpers do
...> %Wei{value: Decimal.new(1000500000000000000)},
...> :ether
...> )
"1.0005 POA"
"1.0005 Ether"
iex> format_wei_value(
...> %Wei{value: Decimal.new(10)},

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -73,7 +73,7 @@ defmodule BlockScoutWeb.ViewingAddressesTest do
session
|> AddressPage.visit_page(address)
|> assert_text(AddressPage.balance(), "0.0000000000000005 POA")
|> assert_text(AddressPage.balance(), "0.0000000000000005 Ether")
end
describe "viewing contract creator" do

@ -8,13 +8,13 @@ defmodule BlockScoutWeb.AddressCoinBalanceViewTest do
test "format the wei value in ether" do
wei = Wei.from(Decimal.new(1_340_000_000), :gwei)
assert AddressCoinBalanceView.format(wei) == "1.34 POA"
assert AddressCoinBalanceView.format(wei) == "1.34 Ether"
end
test "format negative values" do
wei = Wei.from(Decimal.new(-1_340_000_000), :gwei)
assert AddressCoinBalanceView.format(wei) == "-1.34 POA"
assert AddressCoinBalanceView.format(wei) == "-1.34 Ether"
end
end
@ -50,13 +50,13 @@ defmodule BlockScoutWeb.AddressCoinBalanceViewTest do
test "format positive values" do
value = Decimal.new(1_340_000_000_000_000_000)
assert AddressCoinBalanceView.format_delta(value) == "1.34 POA"
assert AddressCoinBalanceView.format_delta(value) == "1.34 Ether"
end
test "format negative values" do
value = Decimal.new(-1_340_000_000_000_000_000)
assert AddressCoinBalanceView.format_delta(value) == "1.34 POA"
assert AddressCoinBalanceView.format_delta(value) == "1.34 Ether"
end
end
end

@ -91,7 +91,7 @@ defmodule BlockScoutWeb.BlockViewTest do
block = Repo.preload(block, :rewards)
assert BlockView.combined_rewards_value(block) == "3.000042 POA"
assert BlockView.combined_rewards_value(block) == "3.000042 Ether"
end
end
end

@ -136,7 +136,7 @@ defmodule BlockScoutWeb.TransactionViewTest do
gas_used: nil
)
expected_value = "Max of 0.009 POA"
expected_value = "Max of 0.009 Ether"
assert expected_value == TransactionView.formatted_fee(transaction, denomination: :ether)
end
@ -144,12 +144,9 @@ defmodule BlockScoutWeb.TransactionViewTest do
{:ok, gas_price} = Wei.cast(3_000_000_000)
transaction = build(:transaction, gas_price: gas_price, gas_used: Decimal.from_float(1_034_234.0))
expected_value = "0.003102702 POA"
expected_value = "0.003102702 Ether"
assert expected_value == TransactionView.formatted_fee(transaction, denomination: :ether)
end
test "with fee but no available exchange_rate" do
end
end
describe "formatted_status/1" do

Loading…
Cancel
Save