Fix fetch_coin_balance query to compare between balances with values (#9638)

* Fix fetch_coin_balance query to compare between balances with non-nil values

* Review fix
pull/9635/head
Victor Baranov 8 months ago committed by GitHub
parent da5bd2fff3
commit 675fdebfc9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 32
      apps/block_scout_web/lib/block_scout_web/channels/address_channel.ex

@ -20,6 +20,7 @@
### Fixes
- [#9640](https://github.com/blockscout/blockscout/pull/9640) - Fix no function clause matching in `BENS.item_to_address_hash_strings/1`
- [#9638](https://github.com/blockscout/blockscout/pull/9638) - Fix fetch_coin_balance query to compare between balances with values
- [#9629](https://github.com/blockscout/blockscout/pull/9629) - Don't insert pbo for not inserted blocks
- [#9601](https://github.com/blockscout/blockscout/pull/9601) - Fix token instance transform for some unconventional tokens
- [#9597](https://github.com/blockscout/blockscout/pull/9597) - Update token transfers block_consensus by block_number

@ -193,11 +193,13 @@ defmodule BlockScoutWeb.AddressChannel do
) do
coin_balance = Chain.get_coin_balance(socket.assigns.address_hash, block_number)
rendered_coin_balance = AddressViewAPI.render("coin_balance.json", %{coin_balance: coin_balance})
if coin_balance.value && coin_balance.delta do
rendered_coin_balance = AddressViewAPI.render("coin_balance.json", %{coin_balance: coin_balance})
push(socket, "coin_balance", %{coin_balance: rendered_coin_balance})
push(socket, "coin_balance", %{coin_balance: rendered_coin_balance})
push_current_coin_balance(socket, block_number, coin_balance)
push_current_coin_balance(socket, block_number, coin_balance)
end
{:noreply, socket}
end
@ -207,19 +209,21 @@ defmodule BlockScoutWeb.AddressChannel do
Gettext.put_locale(BlockScoutWeb.Gettext, socket.assigns.locale)
rendered_coin_balance =
View.render_to_string(
AddressCoinBalanceView,
"_coin_balances.html",
conn: socket,
coin_balance: coin_balance
)
if coin_balance.value && coin_balance.delta do
rendered_coin_balance =
View.render_to_string(
AddressCoinBalanceView,
"_coin_balances.html",
conn: socket,
coin_balance: coin_balance
)
push(socket, "coin_balance", %{
coin_balance_html: rendered_coin_balance
})
push(socket, "coin_balance", %{
coin_balance_html: rendered_coin_balance
})
push_current_coin_balance(socket, block_number, coin_balance)
push_current_coin_balance(socket, block_number, coin_balance)
end
{:noreply, socket}
end

Loading…
Cancel
Save