Token instance metadata retriever refinement: process metadata if only image URL is passed to tokenURI

pull/3128/head
Victor Baranov 4 years ago
parent ed2105dc58
commit 0eb253dd2f
  1. 1
      CHANGELOG.md
  2. 2
      apps/block_scout_web/mix.exs
  3. 2
      apps/ethereum_jsonrpc/mix.exs
  4. 12
      apps/explorer/lib/explorer/token/instance_metadata_retriever.ex
  5. 2
      apps/explorer/mix.exs
  6. 2
      mix.lock

@ -3,6 +3,7 @@
### Features
### Fixes
- [#3128](https://github.com/poanetwork/blockscout/pull/3128) - Token instance metadata retriever refinement: process metadata if only image URL is passed to token URI
- [#3126](https://github.com/poanetwork/blockscout/pull/3126) - Fetch balance only for blocks which are greater or equal block with FIRST_BLOCK number
- [#3122](https://github.com/poanetwork/blockscout/pull/3122) - Exclude balance percentage calculation for burn address on accounts page
- [#3121](https://github.com/poanetwork/blockscout/pull/3121) - Geth: handle response from eth_getblockbyhash JSON RPC method without totalDifficulty (uncle blocks)

@ -90,7 +90,7 @@ defmodule BlockScoutWeb.Mixfile do
{:floki, "~> 0.20.1", only: :test},
{:flow, "~> 0.12"},
{:gettext, "~> 0.16.1"},
{:httpoison, "~> 1.0"},
{:httpoison, "~> 1.6"},
{:indexer, in_umbrella: true, runtime: false},
# JSON parser and generator
{:jason, "~> 1.0"},

@ -70,7 +70,7 @@ defmodule EthereumJsonrpc.MixProject do
# Code coverage
{:excoveralls, "~> 0.10.0", only: [:test], github: "KronicDeth/excoveralls", branch: "circle-workflows"},
# JSONRPC HTTP Post calls
{:httpoison, "~> 1.0"},
{:httpoison, "~> 1.6"},
# Decode/Encode JSON for JSONRPC
{:jason, "~> 1.0"},
# Log errors and application output to separate files

@ -98,10 +98,16 @@ defmodule Explorer.Token.InstanceMetadataRetriever do
defp fetch_metadata(token_uri) do
case HTTPoison.get(token_uri) do
{:ok, %Response{body: body, status_code: 200}} ->
{:ok, json} = decode_json(body)
{:ok, %Response{body: body, status_code: 200, headers: headers}} ->
if Enum.member?(headers, {"Content-Type", "image/png"}) do
json = %{"image" => %{"type" => "image", "description" => token_uri}}
check_type(json)
check_type(json)
else
{:ok, json} = decode_json(body)
check_type(json)
end
{:ok, %Response{body: body}} ->
{:error, body}

@ -84,7 +84,7 @@ defmodule Explorer.Mixfile do
# Code coverage
{:excoveralls, "~> 0.10.0", only: [:test], github: "KronicDeth/excoveralls", branch: "circle-workflows"},
{:exvcr, "~> 0.10", only: :test},
{:httpoison, "~> 1.0"},
{:httpoison, "~> 1.6"},
{:jason, "~> 1.0"},
{:junit_formatter, ">= 0.0.0", only: [:test], runtime: false},
# Log errors and application output to separate files

@ -55,7 +55,7 @@
"gettext": {:hex, :gettext, "0.16.1", "e2130b25eebcbe02bb343b119a07ae2c7e28bd4b146c4a154da2ffb2b3507af2", [:mix], [], "hexpm", "dd3a7ea5e3e87ee9df29452dd9560709b4c7cc8141537d0b070155038d92bdf1"},
"hackney": {:hex, :hackney, "1.15.2", "07e33c794f8f8964ee86cebec1a8ed88db5070e52e904b8f12209773c1036085", [:rebar3], [{:certifi, "2.5.1", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "6.0.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "1.1.5", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm", "e0100f8ef7d1124222c11ad362c857d3df7cb5f4204054f9f0f4a728666591fc"},
"html_entities": {:hex, :html_entities, "0.4.0", "f2fee876858cf6aaa9db608820a3209e45a087c5177332799592142b50e89a6b", [:mix], [], "hexpm", "3e3d7156a272950373ce5a4018b1490bea26676f8d6a7d409f6fac8568b8cb9a"},
"httpoison": {:hex, :httpoison, "1.0.0", "1f02f827148d945d40b24f0b0a89afe40bfe037171a6cf70f2486976d86921cd", [:mix], [{:hackney, "~> 1.8", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "07967c56199f716ce9adb27415ccea1bd76c44f777dd0a6d4166c3d932f37fdf"},
"httpoison": {:hex, :httpoison, "1.6.2", "ace7c8d3a361cebccbed19c283c349b3d26991eff73a1eaaa8abae2e3c8089b6", [:mix], [{:hackney, "~> 1.15 and >= 1.15.2", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "aa2c74bd271af34239a3948779612f87df2422c2fdcfdbcec28d9c105f0773fe"},
"idna": {:hex, :idna, "6.0.0", "689c46cbcdf3524c44d5f3dde8001f364cd7608a99556d8fbd8239a5798d4c10", [:rebar3], [{:unicode_util_compat, "0.4.1", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "4bdd305eb64e18b0273864920695cb18d7a2021f31a11b9c5fbcd9a253f936e2"},
"jason": {:hex, :jason, "1.1.2", "b03dedea67a99223a2eaf9f1264ce37154564de899fd3d8b9a21b1a6fd64afe7", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fdf843bca858203ae1de16da2ee206f53416bbda5dc8c9e78f43243de4bc3afe"},
"jsx": {:hex, :jsx, "2.8.3", "a05252d381885240744d955fbe3cf810504eb2567164824e19303ea59eef62cf", [:mix, :rebar3], [], "hexpm", "fc3499fed7a726995aa659143a248534adc754ebd16ccd437cd93b649a95091f"},

Loading…
Cancel
Save