Merge pull request #5381 from blockscout/np-fix-exchange-rates-error

Fix Jason encode error
pull/5397/head
Victor Baranov 3 years ago committed by GitHub
commit f67aaf85c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 2
      apps/block_scout_web/lib/block_scout_web/notifier.ex
  3. 4
      apps/block_scout_web/test/block_scout_web/channels/exchange_rate_channel_test.exs

@ -7,6 +7,7 @@
### Fixes ### Fixes
- [#5383](https://github.com/blockscout/blockscout/pull/5383) - Fix reload transactions button - [#5383](https://github.com/blockscout/blockscout/pull/5383) - Fix reload transactions button
- [#5381](https://github.com/blockscout/blockscout/pull/5381) - Fix exchange rate broadcast error
- [#5375](https://github.com/blockscout/blockscout/pull/5375) - Fix pending transactions fetcher - [#5375](https://github.com/blockscout/blockscout/pull/5375) - Fix pending transactions fetcher
- [#5374](https://github.com/blockscout/blockscout/pull/5374) - Return all ERC-1155's token instances in tokenList api endpoint - [#5374](https://github.com/blockscout/blockscout/pull/5374) - Return all ERC-1155's token instances in tokenList api endpoint
- [#5342](https://github.com/blockscout/blockscout/pull/5342) - Fix 500 error on NF token page with nil metadata - [#5342](https://github.com/blockscout/blockscout/pull/5342) - Fix 500 error on NF token page with nil metadata

@ -105,7 +105,7 @@ defmodule BlockScoutWeb.Notifier do
%{exchange_rate | available_supply: nil, market_cap_usd: RSK.market_cap(exchange_rate)} %{exchange_rate | available_supply: nil, market_cap_usd: RSK.market_cap(exchange_rate)}
_ -> _ ->
exchange_rate Map.from_struct(exchange_rate)
end end
Endpoint.broadcast("exchange_rate:new_rate", "new_rate", %{ Endpoint.broadcast("exchange_rate:new_rate", "new_rate", %{

@ -20,7 +20,7 @@ defmodule BlockScoutWeb.ExchangeRateChannelTest do
ExchangeRates.init([]) ExchangeRates.init([])
token = %Token{ token = %{
available_supply: Decimal.new("1000000.0"), available_supply: Decimal.new("1000000.0"),
total_supply: Decimal.new("1000000.0"), total_supply: Decimal.new("1000000.0"),
btc_value: Decimal.new("1.000"), btc_value: Decimal.new("1.000"),
@ -53,7 +53,7 @@ defmodule BlockScoutWeb.ExchangeRateChannelTest do
receive do receive do
%Phoenix.Socket.Broadcast{topic: ^topic, event: "new_rate", payload: payload} -> %Phoenix.Socket.Broadcast{topic: ^topic, event: "new_rate", payload: payload} ->
assert payload.exchange_rate == token assert payload.exchange_rate == Map.from_struct(token)
assert payload.market_history_data == [] assert payload.market_history_data == []
after after
:timer.seconds(5) -> :timer.seconds(5) ->

Loading…
Cancel
Save