Merge branch 'master' into feature/#1476-add-styles-for-POSDAO-network

* master:
  use literal nul
  use null value
  add CHANGELOG entry
  fix failing in rpc if balance is empty
pull/1704/head
Gabriel Rodriguez Alsina 6 years ago
commit 6d0abb89d6
  1. 1
      CHANGELOG.md
  2. 8
      apps/block_scout_web/lib/block_scout_web/views/api/rpc/address_view.ex

@ -14,6 +14,7 @@
- [#1688](https://github.com/poanetwork/blockscout/pull/1688) - do not fail if failure reason is atom
- [#1692](https://github.com/poanetwork/blockscout/pull/1692) - exclude decompiled smart contract from encoding
- [#1684](https://github.com/poanetwork/blockscout/pull/1684) - Discard child block with parent_hash not matching hash of imported block
- [#1697](https://github.com/poanetwork/blockscout/pull/1697) - fix failing in rpc if balance is empty
### Chore

@ -9,7 +9,7 @@ defmodule BlockScoutWeb.API.RPC.AddressView do
end
def render("balance.json", %{addresses: [address]}) do
RPCView.render("show.json", data: "#{address.fetched_coin_balance.value}")
RPCView.render("show.json", data: balance(address))
end
def render("balance.json", assigns) do
@ -21,7 +21,7 @@ defmodule BlockScoutWeb.API.RPC.AddressView do
Enum.map(addresses, fn address ->
%{
"account" => "#{address.hash}",
"balance" => "#{address.fetched_coin_balance.value}"
"balance" => balance(address)
}
end)
@ -157,4 +157,8 @@ defmodule BlockScoutWeb.API.RPC.AddressView do
"symbol" => token.symbol
}
end
defp balance(address) do
address.fetched_coin_balance && address.fetched_coin_balance.value && "#{address.fetched_coin_balance.value}"
end
end

Loading…
Cancel
Save