{"id":18284868,"url":"https://github.com/samlet/subs.fe","last_synced_at":"2025-04-09T05:47:46.531Z","repository":{"id":95955699,"uuid":"289495737","full_name":"samlet/subs.fe","owner":"samlet","description":"substrate front end","archived":false,"fork":false,"pushed_at":"2020-08-22T13:49:44.000Z","size":241,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-15T00:28:41.430Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/samlet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-22T13:46:05.000Z","updated_at":"2020-08-22T13:49:47.000Z","dependencies_parsed_at":"2023-03-24T06:34:18.158Z","dependency_job_id":null,"html_url":"https://github.com/samlet/subs.fe","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samlet%2Fsubs.fe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samlet%2Fsubs.fe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samlet%2Fsubs.fe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samlet%2Fsubs.fe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samlet","download_url":"https://codeload.github.com/samlet/subs.fe/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247987108,"owners_count":21028891,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T13:14:49.481Z","updated_at":"2025-04-09T05:47:46.499Z","avatar_url":"https://github.com/samlet.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Substrate Front End Template\n\nThis template allows you to create a front-end application that connects to a\n[Substrate](https://github.com/paritytech/substrate) node back-end with minimal\nconfiguration. To learn about Substrate itself, visit the\n[Substrate Developer Hub](https://substrate.dev).\n\nThe template is built with [Create React App](https://github.com/facebook/create-react-app)\nand [Polkadot js API](https://polkadot.js.org/api/). Familiarity with these tools\nwill be helpful, but the template strives to be self-explanatory. To learn how\nthis template was built, visit the\n[Substrate Front-End Tutorial](https://substrate.dev/docs/en/tutorials/substrate-front-end/).\n\n## Using The Template\n\n### Installation\n\nThe codebase is installed using [git](https://git-scm.com/) and [yarn](https://yarnpkg.com/). This tutorial assumes you have installed yarn globally prior to installing it within the subdirectories. For the most recent version and how to install yarn, please refer to [yarn](https://yarnpkg.com/) documentation and installation guides. \n\n```bash\n# Clone the repository\ngit clone https://github.com/substrate-developer-hub/substrate-front-end-template.git\ncd ./substrate-front-end-template\nyarn install\n```\n\n## Usage\n\nYou can start the template in development mode to connect to a locally running node\n\n```bash\nyarn start\n```\n\nYou can also build the app in production mode,\n\n```bash\nyarn build\n```\nand open `build/index.html` in your favorite browser.\n\n## Configuration\n\nThe template's configuration is stored in the `src/config` directory, with\n`common.json` being loaded first, then the environment-specific json file,\nand finally environment variables, with precedence.\n\n* `development.json` affects the development environment\n* `test.json` affects the test environment, triggered in `yarn test` command.\n* `production.json` affects the production environment, triggered in\n`yarn build` command.\n\nSome environment variables are read and integrated in the template `config` object,\nincluding:\n\n* `REACT_APP_PROVIDER_SOCKET` overriding `config[PROVIDER_SOCKET]`\n* `REACT_APP_DEVELOPMENT_KEYRING` overriding `config[DEVELOPMENT_KEYRING]`\n\nMore on [React environment variables](https://create-react-app.dev/docs/adding-custom-environment-variables).\n\nWhen writing and deploying your own front end, you should configure:\n\n* `CUSTOM_TYPES` in `src/config/common.json`. See\n  [Extending types](https://polkadot.js.org/api/start/types.extend.html).\n* `PROVIDER_SOCKET` in `src/config/production.json` pointing to your own\n  deployed node.\n* `DEVELOPMENT_KEYRING` in `src/config/common.json` be set to `false`.\n  See [Keyring](https://polkadot.js.org/api/start/keyring.html).\n\n### Specifying Connecting Node\n\nThere are two ways to specify it:\n\n* With `PROVIDER_SOCKET` in `{common, development, production}.json`.\n* With `rpc=\u003cws or wss connection\u003e` query paramter after the URL. This overrides the above setting.\n\n## Reusable Components\n\n### useSubstrate Custom Hook\n\nThe custom hook `useSubstrate` provides access to the Polkadot js API and thus the\nkeyring and the blockchain itself. Specifically it exposes this API.\n\n```js\n{\n  socket,\n  types,\n  keyring,\n  keyringState,\n  api,\n  apiState,\n}\n```\n\n- `socket` - The remote provider socket it is connecting to.\n- `types` - The custom types used in the connected node.\n- `keyring` - A keyring of accounts available to the user.\n- `keyringState` - One of `\"READY\"` or `\"ERROR\"` states. `keyring` is valid\nonly when `keyringState === \"READY\"`.\n- `api` - The remote api to the connected node.\n- `apiState` - One of `\"CONNECTING\"`, `\"READY\"`, or `\"ERROR\"` states. `api` is valid\nonly when `apiState === \"READY\"`.\n\n\n### TxButton Component\n\nThe [TxButton](./src/substrate-lib/components/TxButton.js) handles basic\n[query](https://polkadot.js.org/api/start/api.query.html) and\n[transaction](https://polkadot.js.org/api/start/api.tx.html) requests to the\nconnected node. You can reuse this component for a wide variety of queries and\ntransactions. See [src/Transfer.js](./src/Transfer.js) for a transaction example\nand [src/ChainState.js](./src/ChainState.js) for a query example.\n\n### Account Selector\n\nThe [Account Selector](./src/AccountSelector.js) provides the user with a unified way to\nselect their account from a keyring. If the Balances module is installed in the runtime,\nit also displays the user's token balance. It is included in the template already.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamlet%2Fsubs.fe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamlet%2Fsubs.fe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamlet%2Fsubs.fe/lists"}