Customized Polkadot.js Apps fork for GHOST Mainnet & CASPER Testnet. Pre-configured RPC, GHOST dark theme, and upstream-sync ready.
Go to file
Thibaut Sardan 0091fc6e57
Add attestation to claims (#2734)
* init

* Attest component

* Add top notification bar

* better english

* back to 3 steps

* clean up

* in the middle of the refactoring

* Make TS pass

* Clea up some comments

* isPreclaimed

* isOldClaimProcess

* Attest vs Claim (#2737)

* Choose between Claim and Attest

* fix lint

* fix flow between claim and attest (#2738)

* Jaco's comments + Fetch StatementKind (#2741)

* Fix small bug in flow

* Add condition for the warning banner (#2742)

* prevent crash for older chains

* with useEffect

* should work

* back to something simple

* remove hoc

* fix CI

* Add ETH address field for non preclaimed addresses (#2746)

* Eth field

* fix

* remove stray logs

* Update packages/page-claims/src/index.tsx

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

* Update packages/page-claims/src/index.tsx

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

* Update packages/apps/src/overlays/Attest.tsx

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

* Show the amount of token that will be claimed (#2747)

* show amount in attest

* fix isApiReady

* fix lint

* Use counter instead of overlay (#2750)

* Use counter instead of overlay

* Add warning to claim (#2752)

* add warning

* css cleanup

* fix unused const

Co-authored-by: Thibaut Sardan <33178835+Tbaut@users.noreply.github.com>

* Update packages/page-claims/src/Warning.tsx

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

* Update packages/page-claims/src/index.tsx

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

* Update packages/page-claims/src/index.tsx

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

* Update packages/page-claims/src/index.tsx

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

* Update packages/page-claims/src/index.tsx

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

* address comment shortcut

* set Ethereum address outside transfor and fix typos

* lint

* extract claims.preclaims to a hook

* address comments EthereumAddress type and avoid casting

* Missing isUnsigned

* use AddressMini in warning

* use a proper step for eth address field

* Add loading state

* remove log

* unwrapOrNull

* Update packages/page-claims/src/Warning.tsx

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

* fix for account plural translation

* lint

* Add getStatement function

* nits

* Fix lint

* Update packages/page-claims/src/Warning.tsx

Co-authored-by: Jaco Greeff <jacogr@gmail.com>

* add statement

* statement component

* address comment unWrapOr

* test styling with long md

* add md to jest

* Update packages/page-claims/src/Statement.tsx

Co-authored-by: Amaury Martiny <amaury.martiny@protonmail.com>

* copy text before

* lint

* Remove EthreumAddress type to avoid unexpected behaviors (#2796)

* remove EthreumAddress type

* createType when needed

* revert

* typo

* Enhance UX for claim process (#2797)

* update content

* init

* comment

* Add HTML components for statements (#2798)

* Add HTML components for statements

* Update packages/page-claims/src/statements/saft.tsx

* Update to final statements

* More nits

* Nits

* OnSuccess

* prevent display of empty statement when attested

* Small fixmes

* Update packages/page-claims/src/index.tsx

* fix isError not being red as expected

* remove word-break

* statement text in black

* attestation for -> accounc balance

* Update packages/page-claims/src/Statement.tsx

Co-authored-by: Logan Saether <x@logansaether.com>

* margin left instead of space

* I agree

* Use iframe

* update saft to QmXEkMahfhHJPzT3RjkXiZVFi77ZeVeuxtAjhojGRNYckz

* remove hash and duplications (#2814)

Co-authored-by: Amaury Martiny <amaury.martiny@protonmail.com>
Co-authored-by: Jaco Greeff <jacogr@gmail.com>
Co-authored-by: Logan Saether <x@logansaether.com>
2020-05-26 11:49:12 +02:00
.github/workflows Cloudflare dnslink (#2791) 2020-05-21 23:10:44 +02:00
.vscode Remove non-working CI cache (#2387) 2020-03-15 08:21:12 +01:00
.yarn Bump berry (#2715) 2020-05-11 12:15:49 +02:00
docker Add ENV support to the generated site (#2450) 2020-04-25 08:29:59 +02:00
packages Add attestation to claims (#2734) 2020-05-26 11:49:12 +02:00
scripts Bumps w/ eslint (#2802) 2020-05-24 19:41:14 +02:00
test UI support for simple payouts (#2509) 2020-04-08 16:39:32 +02:00
.123trigger Update .123trigger 2020-05-21 23:46:26 +02:00
.babelrc.js Support enumerable accounts (#102) 2018-06-25 18:02:47 +02:00
.codeclimate.yml Merge next into master (#529) 2018-12-21 17:17:26 +01:00
.dockerignore Add ENV support to the generated site (#2450) 2020-04-25 08:29:59 +02:00
.editorconfig Initial commit 2018-04-17 17:02:30 +02:00
.env-example Add ENV support to the generated site (#2450) 2020-04-25 08:29:59 +02:00
.eslintignore Bump berry (#2715) 2020-05-11 12:15:49 +02:00
.eslintrc.js Adjust deps for new hooks rules (#2757) 2020-05-16 10:45:54 +02:00
.gitignore Add ENV support to the generated site (#2450) 2020-04-25 08:29:59 +02:00
.npmignore Initial commit 2018-04-17 17:02:30 +02:00
.nvmrc Merge next into master (#529) 2018-12-21 17:17:26 +01:00
.stylelintrc Add stylelint (testing impacts) (#2524) 2020-04-07 10:49:30 +02:00
.yarnrc.yml Remove non-working CI cache (#2387) 2020-03-15 08:21:12 +01:00
babel.config.js UI support for simple payouts (#2509) 2020-04-08 16:39:32 +02:00
BOUNTIES.md Additional requests for working on bounties (#1704) 2019-10-07 17:06:24 +02:00
CHANGELOG.md 0.42 (#2793) 2020-05-22 08:39:17 +02:00
CONTRIBUTING.md Don't pass UI_MODE/UI_THEME via env (#769) 2019-02-28 16:36:50 +01:00
Dockerfile Add ENV support to the generated site (#2450) 2020-04-25 08:29:59 +02:00
env.sh Add ENV support to the generated site (#2450) 2020-04-25 08:29:59 +02:00
i18next-scanner.config.js Publish electron apps on release (#2780) 2020-05-20 18:19:58 +02:00
I18N.md Move i18n app to settings (discoverability) (#2679) 2020-05-02 13:46:10 +02:00
jest.config.js UI support for simple payouts (#2509) 2020-04-08 16:39:32 +02:00
lerna.json [CI Skip] 0.43.0-beta.10 2020-05-26 08:08:05 +00:00
LICENSE Merge next into master (#529) 2018-12-21 17:17:26 +01:00
package.json Bump API (#2813) 2020-05-26 10:00:22 +02:00
README.md s/inps/ipns/ 2020-05-22 08:52:01 +02:00
tsconfig.json Basic Electron App setup (#2765) 2020-05-20 13:29:25 +02:00
types.json Small init changes (static state) (#663) 2019-01-31 18:02:47 +01:00
yarn.lock [CI Skip] 0.43.0-beta.10 2020-05-26 08:08:05 +00:00

polkadotjs license maintainability

@polkadot/apps

A Portal into the Polkadot and Substrate networks. Provides a view and interaction layer from a browser.

This can be accessed as a hosted application via https://polkadot.js.org/apps/ or you can access the IPFS hosted version via https://polkadot.js.org/apps/ipfs (via hash) or https://dotapps.io (via ipns) to explore any of the supported Polkadot and Substrate chains.

If you run one or more IPFS node(s), pinning the UI (which only getes updated on releases) will make it faster for you and others. You can find details about that below in the IPFS chapter below.

Important If you are a chain developer and would like to add support for your chain to the UI, all the local configuration (API types, settings, logos) can be customized in the apps-config package, complete with instructions of what goes where.

overview

The repo is split into a number of packages, each representing an application. These are -

  • apps This is the main entry point. It handles the selection sidebar and routing to the specific application being displayed.
  • apps-electron Desktop app running apps.
  • page-accounts A basic account management app.
  • page-address-book A basic address management app.
  • page-democracy A basic voting app, allowing votes on activate proposals and referenda.
  • page-explorer A simple block explorer. It only shows the most recent blocks, updating as they become available.
  • page-extrinsics Submission of extrinsics to a node.
  • page-js An online code editor with @polkadot-js/api access to the currently connected node.
  • page-settings A basic settings management app, allowing choice of language, node to connect to, and theme
  • page-staking A basic staking management app, allowing staking and nominations.
  • page-storage A simple node storage query application. Multiple queries can be queued and updates as new values become available.
  • page-toolbox Submission of raw data to RPC endpoints and utility hashing functions.
  • page-transfer A basic account management app, allowing transfer of Units/DOTs between accounts.

In addition the following libraries are also included in the repo. These are to be moved to the @polkadot/ui repository once it reaches a base level of stability and usability. (At this point with the framework being tested on the apps above, it makes development easier having it close)

  • react-components A reactive (using RxJS) application framework with a number of useful shared components.
  • react-signer Signer implementation for apps.
  • react-query Base components that use the RxJS Observable APIs

Development

Contributions are welcome!

To start off, this repo (along with others in the @polkadot family) uses yarn workspaces to organize the code. As such, after cloning dependencies should be installed via yarn, not via npm, the latter will result in broken dependencies.

To get started -

  1. Clone the repo locally, via git clone https://github.com/polkadot-js/apps <optional local path>
  2. Ensure that you have a recent LTS version of Node.js, for development purposes Node >=10.13.0 is recommended.
  3. Ensure that you have a recent version of Yarn, for development purposes Yarn >=1.10.1 is required.
  4. Install the dependencies by running yarn
  5. Ready! Now you can launch the UI (assuming you have a local Polkadot Node running), via yarn run start
  6. Access the UI via http://localhost:3000

I want to code around

There is a base template available page-123code that acts as a simple starting point for adding additional apps to the UI. Alternatively if you just want some place where you can write some code, it does the trick.

While it is hidden from the sidebar, it is accessible via http://127.0.0.1:3000/#/123code

Be sure to follow the page-123code/README.md instructions.

Docker

You can run a docker container via -

docker run --rm -it --name polkadot-ui -e WS_URL=ws://someip:9944 -p 80:80 chevdor/polkadot-ui:latest

To build a docker container containing local changes -

docker build -t chevdor/polkadot-ui .

When using these Docker commands, you can access the UI via http://localhost:80 (or just http://localhost)

IPFS

IPFS allows sharing files in a decentralized manner in a similar fashion the polkadot network exchanges blocks. IPFS works best when many nodes seed the same data. Nodes can seed specific data by pinning them.

You can pin with the following command:

curl -s https://polkadot.js.org/apps/ipfs/pin.json | jq -jr .IpfsHash | xargs -0 -I CID ipfs pin add --progress CID

Here is a script you can save as /usr/local/bin/polkadotjs-ipfs-pin.sh:

#!/usr/bin/env bash

IPFS='/usr/local/bin/ipfs'
curl -s https://polkadot.js.org/apps/ipfs/pin.json | jq -jr .IpfsHash | xargs -0 -I CID $IPFS pin add --progress CID

I suggest to run the script once. The output should be similar to (the CID/Hash will very likely be different though):

$ /usr/local/bin/polkadotjs-ipfs-pin.sh 
pinned QmNYAbzaE8kRAf68YiN3ZuUxgdwroeav3JhicsHsG5b2oW recursively

Now that you know the CID (hash), you can check whether the data is already pinned or not:

$ ipfs pin ls | grep QmNYAbzaE8kRAf68YiN3ZuUxgdwroeav3JhicsHsG5b2oW
QmNYAbzaE8kRAf68YiN3ZuUxgdwroeav3JhicsHsG5b2oW recursive

Now that we know it works, we can automate that with a cron task. Run crontab -e. If you see only comments, append the following to the file and save:

SHELL=/bin/bash
HOME=/
0 * * * * /usr/local/bin/polkadotjs-ipfs-pin.sh >/dev/null 2>&1

Now our script will run every hours at minute '0' (8:00, 9:00, etc...). To check, we can unpin temporarily:

$ ipfs pin rm QmNYAbzaE8kRAf68YiN3ZuUxgdwroeav3JhicsHsG5b2oW
unpinned QmNYAbzaE8kRAf68YiN3ZuUxgdwroeav3JhicsHsG5b2oW

Now asking for the CID confirms that is it not there.

$ ipfs pin ls QmNYAbzaE8kRAf68YiN3ZuUxgdwroeav3JhicsHsG5b2oW
Error: path 'QmNYAbzaE8kRAf68YiN3ZuUxgdwroeav3JhicsHsG5b2oW' is not pinned

Wait until the your cron task runs and try again:

$ ipfs pin ls QmNYAbzaE8kRAf68YiN3ZuUxgdwroeav3JhicsHsG5b2oW
QmNYAbzaE8kRAf68YiN3ZuUxgdwroeav3JhicsHsG5b2oW recursive

Tada! This is now automatic and you may forget it.

If you are curious and want to know how many people seed the UI on IPFS, here is the magic command (it may take a while to return the answer as ipfs will search for about 1 minute):

ipfs dht findprovs QmTejwB7mJPBHBoqubjzHSgSxfLMcjnZA3LFefqoQc87VJ | wc -l

If you are current about the content of what you just pinned, you may use the following command:

$ ipfs ls QmTejwB7mJPBHBoqubjzHSgSxfLMcjnZA3LFefqoQc87VJ
QmPJGyqVCcXm238noz7TZDByyGa35qqc8g6sfyXF3KDXZ3 38078   favicon.ico
QmdouVsVE9rMVB84Cy1ehVi1LAGW1fKcqqQxSEjgxJrv7H 668     index.html
QmWHcGf1JCFZCYjZsw52vM5RiJVbcNpX1fo2NyoBKBvtuf -       ipfs/
QmT6NwDsJzMyBs6bMq845nMumeJWbixBfNXA9hdAhAMdSG -       locales/
QmcgiZpwvpT1E1dkSS3zr5je89rZRVocNKPebgWhn3JVTC 2178582 main.ce05dfca.js
QmdnEtuhFDyw5Tjr82bFPzyveFrbkYjJAnUvBvzwT18YGG 337     manifest.json
QmW7gDKHbmtD7sRTqsvyo84bDpyYPZR3w1wQo8pme2q5HC -       next/
Qmd8UnRQiBobm4qb6dhiC1HoQ7SvwZrWJenoN3JPEV3iiF 480594  polkadotjs.3af757ad.js
QmUfXPMfNys8Y8dekuankBx7BHiSAjALCpBDKH6F5DdcNm 628284  react.0cecb00d.css
QmSEgXdQbC1ek9Td1mHy3BRvJpfWHm9zQYegTgAUj1QC4g 924156  react.8f083b49.js
QmfGBgFe2aqf83Wv21m9k5DH2ew89CDj4tydoxJWdK6NNL 1552    runtime.3d77e510.js
QmYPa8jcHH7gfopMALr5XTW4i1QM2xgVBe3NeP11y3tErA -       static/
QmeYBC5EgbccC8NEwXC2rvbd93YiHtTM5xYzqCDohXerDf 859984  vendor.8b793a81.js