Giter Site home page Giter Site logo

Address 404 page about blockscout HOT 6 CLOSED

blockscout avatar blockscout commented on April 30, 2024
Address 404 page

from blockscout.

Comments (6)

jimmay5469 avatar jimmay5469 commented on April 30, 2024

I'm updating this as I don't believe a 404 page is the right approach. I believe what we should actually show is a 0 balance Address with no transactions to/from it.

from blockscout.

acravenho avatar acravenho commented on April 30, 2024

@jimmay5469 That's correct. A user should see the full page with 0 balances.

from blockscout.

 avatar commented on April 30, 2024

I can handle this issue.

from blockscout.

 avatar commented on April 30, 2024

Have you guys already started working on it? @acravenho

from blockscout.

acravenho avatar acravenho commented on April 30, 2024

@Lokraan No, we haven't started working on this yet. That would be great!

from blockscout.

 avatar commented on April 30, 2024

@acravenho

I have a solution that utilizes this function to get addresses:

def find_or_insert_address_from_hash(%Hash{byte_count: unquote(Hash.Address.byte_count())} = hash) do
    case Chain.hash_to_address(hash) do
      {:ok, address} ->
        {:ok, address}

      {:error, :not_found} ->
        Chain.create_address(%{hash: to_string(hash)})

      :error ->
        :error
    end
  end

As a result of this AddressView.contract?/1 throws an error because the created address has this: smart_contract: #Ecto.Association.NotLoaded<association :smart_contract is not loaded>. I am able to solve this by setting smart_contract to :nil in the by passing the value into the changeset, but I was wondering why contract_code gets set to :nil when smart_contract doesn't?

%Explorer.Chain.Address{__meta__: #Ecto.Schema.Metadata<:loaded, "addresses">, contract_code: nil, contracts_creation_internal_transaction: #Ecto.Association.NotLoaded<association :contracts_creation_internal_transaction is not loaded>, fetched_coin_balance: nil, fetched_coin_balance_block_number: nil, hash: %Explorer.Chain.Hash{byte_count: 20, bytes: <<203, 188, 213, 172, 134, 249, 165, 14, 19, 49, 54, 51, 178, 98, 225, 111, 105, 90, 144, 195>>}, inserted_at: #DateTime<2018-10-13 02:14:20.341184Z>, names: #Ecto.Association.NotLoaded<association :names is not loaded>, smart_contract: #Ecto.Association.NotLoaded<association :smart_contract is not loaded>, token: #Ecto.Association.NotLoaded<association :token is not loaded>, updated_at: #DateTime<2018-10-13 02:14:20.341192Z>}

from blockscout.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.