Git Product home page Git Product logo

explorer-ui's Introduction

Polkascan Explorer UI

Polkascan dashboard Polkascan account page

Polkascan Explorer UI is a client-sided Angular based application that utilizes PolkADAPT and its Adapters to obtain data from multiple data sources. Its design is based on flat Material component design, styled in Polkascan branding.

Clone with submodules!

Use the following command to clone this repository and polkadapt submodule:

git clone --recurse-submodules <repository_url>

If you already cloned this repository, but without submodules, then you still need to initialize the submodules:

git submodule init
git submodule update

You need the submodule to build and run this application.

Configuration file

You will need to add a file named config.json in src/assets/. This file contains configuration per network for the used PolkADAPT adapters.

The order in which the networks are shown in the UI is also based on this configuration. It is advised to add multiple endpoints for fallback and custom switching capabilities.

Explorer UI can run on the Polkacan Explorer API or Subsquid endpoints. Or both. Make sure that explorerWsUrlArray and/or subsquid is added to your networks.

To use the Polkascan Explorer UI with the Polkascan Explorer API, see the installation section of the explorer bundle repos.

{
  "polkadot": {
    "substrateRpcUrlArray": ["wss://rpc.polkadot.io"],
    "explorerWsUrlArray": ["wss://mycustomnode.io/polkadot"],
    "coingecko": {
      "coinId": "polkadot"
    },
    "subsquid": {
      "archiveUrl": "https://polkadot.explorer.subsquid.io/graphql",
      "explorerUrl": "https://squid.subsquid.io/polkadot-explorer/graphql",
      "giantSquidExplorerUrl": "https://squid.subsquid.io/gs-explorer-polkadot/graphql",
      "giantSquidMainUrl": "https://squid.subsquid.io/gs-main-polkadot/graphql"
    }
  },
  "kusama": {
    "substrateRpcUrlArray": ["wss://kusama-rpc.polkadot.io", "wss://other-kusama-node.io"],
    "explorerWsUrlArray": ["wss://mycustomnode.io/kusama"],
    "coingecko": {
      "coinId": "kusama"
    },
    "subsquid": {
      "archiveUrl": "https://kusama.explorer.subsquid.io/graphql",
      "explorerUrl": "https://squid.subsquid.io/kusama-explorer/graphql",
      "giantSquidExplorerUrl": "https://squid.subsquid.io/gs-explorer-kusama/graphql",
      "giantSquidMainUrl": "https://squid.subsquid.io/gs-main-kusama/graphql"
    }
  }
}

Build and run with Docker

If you want a quick and easy way to run the application, you can build a Docker image with the included Dockerfile. In a shell, from this project's directory, run the following command to build the Docker image:

docker build -t explorer-ui .

To run the image and start a local webserver with the application:

docker run --rm -p 8000:80 explorer-ui

You can now open your web browser and navigate to http://localhost:8000/ to visit the application.

You can also use the hosted Docker image at Docker Hub, you only need to map a volume to overwrite the config.json in the container:

docker run --rm -it -p 80:80 -v /path/to/your/src/assets/config.json:/usr/share/nginx/html/assets/config.json polkascan/explorer-ui

Build manually

These are the instructions for a manual build. It is advised to use the latest Node LTS. Or at least the node version asked by Angular or Polkadot JS:

You need to install and build polkadapt before you install and build the application:

cd polkadapt
npm i
npm run build
cd ..
npm i
npm run build

The build artifacts will be stored in the dist/ directory.

Development server

For a dev server, open a terminal and run:

cd polkadapt
npm i
npm run build

When making changes in polkadapt source files you have to build again.

Now open a second terminal and run:

npm i
npm run start

Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

explorer-ui's People

Contributors

arjanz avatar kriekkop avatar wouterter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

explorer-ui's Issues

All Kusama session data past session 11260 is not available on Polkascan

When attempting to view Kusama session data for any session > 11260, the server returns the following CORS error: Cross Origin Resource Sharing error: MissingAllowOriginError

These URLs (for sessions > 11260) will trigger the CORs error
https://polkascan.io/kusama/session/session/11261
https://polkascan.io/kusama/session/session/11270

These URLs (for sessions <= 11260) work as expected
https://polkascan.io/kusama/session/session/11260
https://polkascan.io/kusama/session/session/11227

Screen Shot 2021-03-15 at 10 09 03 PM

Issue building docker container on M1

I keep coming across an error building the dockerfile on an M1 Pro.
This was due to not being able to install chromium for arm64.

 => ERROR [polkascan/explorer-ui builder  4/24] RUN npm i                                                          108.3s
------
 > [polkascan/explorer-ui builder  4/24] RUN npm i:
#0 79.88 npm WARN deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs
#0 107.6 npm notice 
#0 107.6 npm notice New minor version of npm available! 9.5.0 -> 9.6.0
#0 107.6 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v9.6.0>
#0 107.6 npm notice Run `npm install -g [email protected]` to update!
#0 107.6 npm notice 
#0 107.6 npm ERR! code 1
#0 107.6 npm ERR! path /app/polkadapt/node_modules/puppeteer
#0 107.6 npm ERR! command failed
#0 107.6 npm ERR! command sh -c node install.js
#0 107.6 npm ERR! The chromium binary is not available for arm64.
#0 107.6 npm ERR! If you are on Ubuntu, you can install with: 
#0 107.6 npm ERR! 
#0 107.6 npm ERR!  sudo apt install chromium
#0 107.6 npm ERR! 
#0 107.6 npm ERR! 
#0 107.6 npm ERR!  sudo apt install chromium-browser
#0 107.6 npm ERR! 
#0 107.6 npm ERR! ERROR: Failed to set up Chromium r1095492! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.
#0 107.6 npm ERR! Error
#0 107.6 npm ERR!     at handleArm64 (/app/polkadapt/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserFetcher.js:137:11)
#0 107.6 npm ERR!     at BrowserFetcher.download (/app/polkadapt/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserFetcher.js:284:13)
#0 107.6 npm ERR!     at async downloadBrowser (/app/polkadapt/node_modules/puppeteer/lib/cjs/puppeteer/node/install.js:61:5)
#0 107.6 
#0 107.6 npm ERR! A complete log of this run can be found in:
#0 107.6 npm ERR!     /root/.npm/_logs/2023-03-03T00_30_48_200Z-debug-0.log

See: https://stackoverflow.com/a/72291691/7101091
I was able to fix it using

diff --git a/explorer-ui/Dockerfile b/explorer-ui/Dockerfile
index 4a5c777..29afd6b 100644
--- a/explorer-ui/Dockerfile
+++ b/explorer-ui/Dockerfile
@@ -2,6 +2,12 @@
 
 FROM node:lts as builder
 
+RUN apt update
+RUN apt install -y chromium
+
+# skips puppeteer installing chrome and points to correct binary
+ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
+
 # The application depends on PolkADAPT, so we have to install and build PolkADAPT first.
 
 WORKDIR /app/polkadapt

Possible to run this UI and backend component on own infrastructure?

Hello, can I run polkascan and its supporting services myself? Something like what polkascan.io provides: give it an account and it lists the TX history for example: https://polkascan.io/polkadot/account/16ZL8yLyXv3V3L3z9ofR1ovFLziyXaN1DPq4yffMAZ9czzBD I'd like to download and install such an explorer on my own infrastructure. And I don't necessarily need the UI, but only a REST API. I looked through the various repos here, but didn't find clear answers.

Is there an "indexer" component that polls a DOT node, populates a DB, and provides an API to clients needing information such as account TX history, current block chain height, account balances etc.?

Improve search bar

The search bar should always be available, instead of showing it only on the dashboard as it is now. While typing, the search bar will show a preview with results for the user's search query.

pageSize is interchanged with blockLimit

See for example this account:

https://explorer-dev.polkascan.io/polkadot/account/16hp43x8DUZtU8L3cJy9Z8JMwTzuu8ZZRWqDZnpMhp464oEd

It creates this query, which uses the blockLimit for the pageSize :

query { getEventsByAccount( filters: { accountId: "0xfc4d6069cb980fcde6ef73a46f1894d66c152e9ddfac3a499cf6a1654ff5f55b" }, pageSize: 500000, blockLimitOffset: 13053521 ) { objects { blockNumber, eventIdx, attributeName, accountId, attributes, pallet, eventName, blockDatetime, sortValue, extrinsicIdx }, pageInfo { pageSize, pageNext, pagePrev, blockLimitOffset, blockLimitCount } } }

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.