├── .nvmrc
├── .dockerignore
├── .eslintignore
├── src
├── styles
│ ├── scss
│ │ ├── _hero.scss
│ │ ├── styles.scss
│ │ ├── _buttons.scss
│ │ └── _anchor_underline.scss
│ ├── global.css
│ ├── fonts.css
│ ├── tailwind-preset.css
│ ├── language-tabs.css
│ └── tailwind-custom.css
├── images
│ ├── favicon.png
│ ├── docs
│ │ ├── runtime
│ │ │ ├── frame-arch.png
│ │ │ ├── frame-runtime.png
│ │ │ ├── benchmarking-on-finalize-blocktime.png
│ │ │ └── benchmarking-multi-variables-regression.png
│ │ ├── concepts
│ │ │ ├── frame-runtime.png
│ │ │ ├── off-chain-workers-v2.png
│ │ │ └── substrate-runtime-client.png
│ │ ├── advanced
│ │ │ ├── consensus-ghost.png
│ │ │ ├── try-runtime-ext-1.png
│ │ │ ├── try-runtime-ext-2.png
│ │ │ └── consensus-longest-chain.png
│ │ ├── getting-started
│ │ │ ├── substrate-arch.png
│ │ │ └── technical-freedom.png
│ │ └── tools
│ │ │ └── mem-profiling-memory-graph.png
│ ├── regular
│ │ └── playground-hero.png
│ ├── backgrounds
│ │ ├── backgroundOne.png
│ │ └── backgroundTwo.png
│ ├── tutorials
│ │ ├── 09-cumulus
│ │ │ ├── favicon.png
│ │ │ ├── forceLease.png
│ │ │ ├── parachains.png
│ │ │ ├── parachain-bid.png
│ │ │ ├── session-keys.png
│ │ │ ├── crowdloan-sucess.png
│ │ │ ├── paraid-reserve.png
│ │ │ ├── crowdloan-success.png
│ │ │ ├── crowdloan-contribute.png
│ │ │ ├── parachain-crowdloan.png
│ │ │ ├── parathread-onboarding.png
│ │ │ ├── parathread-register.png
│ │ │ ├── polkadot-launch-log.png
│ │ │ ├── register-parathread.png
│ │ │ ├── parachain-active-lease.png
│ │ │ ├── parachain-registration-sudo.png
│ │ │ ├── parachain-summary-screenshot.png
│ │ │ ├── parathread-register-success.png
│ │ │ └── polkadot-apps-with-2-parachains.png
│ │ ├── 07-add-a-pallet
│ │ │ ├── set-name.png
│ │ │ ├── name-of-bob.png
│ │ │ ├── name-of-alice.png
│ │ │ ├── clear-name-error.png
│ │ │ └── kill-name-bad-origin.png
│ │ ├── 10-frontier-workshop
│ │ │ ├── rpc.png
│ │ │ ├── pallet-evm.png
│ │ │ ├── block-import.png
│ │ │ ├── pallet-ethereum.png
│ │ │ └── starting-point.png
│ │ ├── tutorial-card-images
│ │ │ ├── tuts-3.jpg
│ │ │ ├── tuts-4.jpg
│ │ │ ├── tuts-1.jpeg
│ │ │ ├── tuts-10.jpeg
│ │ │ ├── tuts-11.jpeg
│ │ │ ├── tuts-12.jpeg
│ │ │ ├── tuts-13.jpeg
│ │ │ ├── tuts-2.jpeg
│ │ │ ├── tuts-5.jpeg
│ │ │ ├── tuts-6.jpeg
│ │ │ ├── tuts-7.jpeg
│ │ │ ├── tuts-8.jpeg
│ │ │ └── tuts-9.jpeg
│ │ ├── 01-create-your-first-chain
│ │ │ ├── forks.png
│ │ │ ├── balances.png
│ │ │ ├── chain-data.png
│ │ │ ├── metadata.png
│ │ │ ├── dave-account.png
│ │ │ ├── event-panel.png
│ │ │ ├── accts-prefunded.png
│ │ │ ├── apps-transfer.png
│ │ │ ├── balance-result.png
│ │ │ ├── blockchain-top.png
│ │ │ ├── transfer-filled.png
│ │ │ └── interactor-events.png
│ │ ├── 02-proof-of-existence
│ │ │ ├── file-hash.png
│ │ │ ├── poe-claimed.png
│ │ │ ├── frame-runtime.png
│ │ │ ├── poe-component.png
│ │ │ ├── front-end-template.png
│ │ │ └── front-end-template-balance-transfer.png
│ │ ├── 04-forkless-upgrade
│ │ │ ├── node-diagram.png
│ │ │ ├── sudo-upgrade.png
│ │ │ ├── version-101.png
│ │ │ ├── scheduled-upgrade.png
│ │ │ └── scheduled-upgrade-success.png
│ │ ├── 08-ink-workshop
│ │ │ └── Part I
│ │ │ │ ├── send-as.png
│ │ │ │ ├── flipper-false.png
│ │ │ │ ├── flipper-true.png
│ │ │ │ ├── flipper-call-page.png
│ │ │ │ ├── flipper-code-events.png
│ │ │ │ ├── send-as-transaction.png
│ │ │ │ ├── start-canvas-node.png
│ │ │ │ ├── start-substrate-ui.png
│ │ │ │ ├── flipper-upload-events.png
│ │ │ │ ├── canvas-connect-to-local.png
│ │ │ │ ├── flipper-instantiate-01.png
│ │ │ │ ├── flipper-instantiate-02.png
│ │ │ │ └── flipper-instantiate-03.png
│ │ ├── 06-visualize-node-metrics
│ │ │ └── grafana.png
│ │ ├── 11-kitties-workshop
│ │ │ ├── kitties-tutorial.png
│ │ │ └── kitty-transfer-shot.png
│ │ ├── 03-permissioned-network
│ │ │ ├── dave_claim_node.png
│ │ │ ├── add_well_known_node.png
│ │ │ ├── dave_add_connections.png
│ │ │ ├── get_well_known_nodes.png
│ │ │ └── charlie_add_connections.png
│ │ └── 05-private-network
│ │ │ ├── polkadot-list-networks.png
│ │ │ ├── private-network-accounts.png
│ │ │ ├── private-network-no-blocks.png
│ │ │ ├── private-network-apps-keygen.png
│ │ │ ├── private-network-select-network.png
│ │ │ ├── private-network-custom-endpoint.png
│ │ │ ├── private-network-displays-blocks.png
│ │ │ ├── private-network-apps-insert-key-aura.png
│ │ │ ├── private-network-apps-insert-key-gran.png
│ │ │ └── private-network-top-left-network-icon.png
│ ├── photos
│ │ └── homepage
│ │ │ └── connect-with-the-community.jpg
│ └── svgs
│ │ ├── arrow-down.svg
│ │ ├── flag.svg
│ │ ├── diamond-purple.svg
│ │ ├── diamond-green.svg
│ │ ├── fe-template.svg
│ │ ├── note.svg
│ │ ├── feedback-icon.svg
│ │ ├── diamond-yellow.svg
│ │ ├── arrow-more.svg
│ │ ├── docs-icon.svg
│ │ ├── search.svg
│ │ ├── close-icon.svg
│ │ ├── stack-overflow-original.svg
│ │ ├── advice.svg
│ │ ├── stack-overflow-white.svg
│ │ ├── external-icon.svg
│ │ ├── twitter.svg
│ │ ├── node-template.svg
│ │ ├── information.svg
│ │ ├── tuts.svg
│ │ ├── ide-code.svg
│ │ ├── calendar.svg
│ │ ├── copy-text.svg
│ │ ├── grad-hat.svg
│ │ ├── htg.svg
│ │ ├── element-white.svg
│ │ ├── element-original.svg
│ │ ├── docs-nav-icon.svg
│ │ └── grants-dollar.svg
├── components
│ ├── Buttons
│ │ ├── index.tsx
│ │ ├── SecondaryButton.tsx
│ │ ├── PrimaryButton.tsx
│ │ ├── PrimaryFixedButton.tsx
│ │ └── TextButton.tsx
│ ├── search-ui
│ │ ├── index.tsx
│ │ ├── SearchDocs.tsx
│ │ ├── SearchInput.tsx
│ │ ├── SearchSectionLabel.tsx
│ │ ├── SearchResultsContainer.tsx
│ │ └── SearchResult.tsx
│ ├── Hooks
│ │ ├── use-lunr-index.tsx
│ │ ├── use-site-metadata.tsx
│ │ ├── use-scroll-listener.tsx
│ │ ├── use-active-hash.tsx
│ │ └── use-component-visible.tsx
│ ├── layout
│ │ ├── Section.tsx
│ │ └── homepage
│ │ │ └── DocCard.tsx
│ ├── DocsComponents
│ │ ├── index.tsx
│ │ ├── RelevantSkills.tsx
│ │ ├── ExternalLink.tsx
│ │ ├── SkillsYouGain.tsx
│ │ ├── DarkButton.tsx
│ │ ├── Objectives.tsx
│ │ ├── AccentButton.tsx
│ │ ├── NextButton.tsx
│ │ ├── PreviousButton.tsx
│ │ ├── MdxLink.tsx
│ │ ├── FeedbackWidget.tsx
│ │ ├── RelatedMaterialBlock.tsx
│ │ ├── FastTrackPlayground.tsx
│ │ ├── BottomButtons.tsx
│ │ └── Message.tsx
│ ├── MobileMenus
│ │ ├── MobileNavItem.tsx
│ │ └── MobileDropDown.tsx
│ ├── BreadCrumbNav.tsx
│ ├── GithubEditButton.tsx
│ ├── LastUpdateGithub.tsx
│ ├── Header
│ │ ├── NavListItem.tsx
│ │ └── SubMenuItem.tsx
│ ├── Layout.tsx
│ ├── DocTag.tsx
│ ├── VersionControl.tsx
│ ├── SlideDownNav.tsx
│ ├── DifficultyMeter.tsx
│ ├── site
│ │ └── Banner.js
│ ├── DocsButton.tsx
│ └── ThemeToggle.tsx
├── utils
│ └── browser.js
├── hooks
│ ├── use-session-storage.js
│ └── use-banner.js
└── pages
│ └── 404.tsx
├── static
├── img
│ ├── sub.gif
│ └── substrate_og.png
├── fonts
│ ├── poppins
│ │ └── Poppins-ExtraBold.ttf
│ └── karla
│ │ ├── Karla-VariableFont_wght.ttf
│ │ └── Karla-Italic-VariableFont_wght.ttf
├── assets
│ ├── tutorials
│ │ ├── ink-workshop
│ │ │ ├── send-as.png
│ │ │ ├── flipper-false.png
│ │ │ ├── flipper-true.png
│ │ │ ├── start-canvas-node.png
│ │ │ ├── send-as-transaction.png
│ │ │ ├── canvas-connect-to-local.png
│ │ │ ├── flipper-instantiate-01.png
│ │ │ ├── flipper-instantiate-02.png
│ │ │ ├── flipper-instantiate-03.png
│ │ │ ├── 1.1-finished-code.rs
│ │ │ ├── 1.2-finished-code.rs
│ │ │ ├── 1.3-finished-code.rs
│ │ │ ├── 1.2-template.rs
│ │ │ ├── 1.3-template.rs
│ │ │ ├── 1.4-finished-code.rs
│ │ │ ├── 1.4-template.rs
│ │ │ ├── 2.1-finished-code.rs
│ │ │ ├── 2.1-template.rs
│ │ │ ├── 1.5-finished-code.rs
│ │ │ ├── 1.5-template.rs
│ │ │ └── 1.6-finished-code.rs
│ │ ├── cumulus
│ │ │ └── polkadot-launch-config
│ │ │ │ └── relay-3-validators--2paras-1collator.json
│ │ └── kitties-tutorial
│ │ │ ├── 01-basic-setup.rs
│ │ │ └── 02-create-kitties.rs
│ └── contribute-templates
│ │ └── how-to-template.md
└── security.txt
├── example.env.development
├── example.env.production
├── postcss.config.js
├── .prettierrc.js
├── .prettierignore
├── .yarnrc.yml
├── decs.d.ts
├── .editorconfig
├── Dockerfile
├── netlify.toml
├── .github
├── ISSUE_TEMPLATE
│ ├── config.yml
│ ├── bug-template-code.yaml
│ ├── content-template.yaml
│ ├── feedback-template.yaml
│ ├── bug-template-site.yaml
│ └── broken-link.yaml
└── workflows
│ ├── check-links.yml
│ └── codeql-analysis.yml
├── content
└── banners
│ ├── stack-exchange.md
│ └── __readme__.md
├── tsconfig.json
├── gatsby-node
├── on-create-node.js
├── create-resolvers.js
└── create-redirects.js
├── gatsby-node.js
├── gatsby-ssr.js
├── tailwind.config.js
├── .gitignore
├── .eslintrc.js
├── lunr
└── create-index.js
├── v3
├── how-to-guides
│ ├── 05-storage-migrations
│ │ └── b-steps-with-polkadotjs-apps
│ │ │ └── index.mdx
│ ├── index.mdx
│ └── 02-pallet-design
│ │ └── f-tight-coupling
│ │ └── index.mdx
└── docs
│ ├── 06-tools
│ └── 0-landing-page
│ │ └── index.mdx
│ ├── 05-integrate
│ └── b-client-libraries
│ │ └── index.mdx
│ └── 01-getting-started
│ └── b-architecture
│ └── index.mdx
└── gatsby-browser.js
/.nvmrc:
--------------------------------------------------------------------------------
1 | lts/fermium
2 |
--------------------------------------------------------------------------------
/.dockerignore:
--------------------------------------------------------------------------------
1 | .cache/
2 | node_modules/
3 | public/
4 |
--------------------------------------------------------------------------------
/.eslintignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | public/
3 | .cache/
4 |
--------------------------------------------------------------------------------
/src/styles/scss/_hero.scss:
--------------------------------------------------------------------------------
1 | .doc-hero {
2 | svg {
3 | cursor: default;
4 | }
5 | }
--------------------------------------------------------------------------------
/static/img/sub.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/static/img/sub.gif
--------------------------------------------------------------------------------
/src/images/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/favicon.png
--------------------------------------------------------------------------------
/static/img/substrate_og.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/static/img/substrate_og.png
--------------------------------------------------------------------------------
/example.env.development:
--------------------------------------------------------------------------------
1 | # GATSBY_IO_URL=http://localhost:8000
2 | # GATSBY_DOCS_URL=http://localhost:8001
3 |
--------------------------------------------------------------------------------
/example.env.production:
--------------------------------------------------------------------------------
1 | # GATSBY_IO_URL=https://substrate.io
2 | # GATSBY_DOCS_URL=https://docs.substrate.io
3 |
--------------------------------------------------------------------------------
/src/images/docs/runtime/frame-arch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/docs/runtime/frame-arch.png
--------------------------------------------------------------------------------
/src/images/regular/playground-hero.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/regular/playground-hero.png
--------------------------------------------------------------------------------
/src/images/backgrounds/backgroundOne.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/backgrounds/backgroundOne.png
--------------------------------------------------------------------------------
/src/images/backgrounds/backgroundTwo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/backgrounds/backgroundTwo.png
--------------------------------------------------------------------------------
/src/images/docs/concepts/frame-runtime.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/docs/concepts/frame-runtime.png
--------------------------------------------------------------------------------
/src/images/docs/runtime/frame-runtime.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/docs/runtime/frame-runtime.png
--------------------------------------------------------------------------------
/src/styles/scss/styles.scss:
--------------------------------------------------------------------------------
1 | @import 'aos/dist/aos.css';
2 | @import 'buttons';
3 | @import 'anchor_underline';
4 | @import 'hero';
5 |
--------------------------------------------------------------------------------
/static/fonts/poppins/Poppins-ExtraBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/static/fonts/poppins/Poppins-ExtraBold.ttf
--------------------------------------------------------------------------------
/src/images/docs/advanced/consensus-ghost.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/docs/advanced/consensus-ghost.png
--------------------------------------------------------------------------------
/src/images/tutorials/09-cumulus/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/09-cumulus/favicon.png
--------------------------------------------------------------------------------
/src/images/docs/advanced/try-runtime-ext-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/docs/advanced/try-runtime-ext-1.png
--------------------------------------------------------------------------------
/src/images/docs/advanced/try-runtime-ext-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/docs/advanced/try-runtime-ext-2.png
--------------------------------------------------------------------------------
/src/images/tutorials/09-cumulus/forceLease.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/09-cumulus/forceLease.png
--------------------------------------------------------------------------------
/src/images/tutorials/09-cumulus/parachains.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/09-cumulus/parachains.png
--------------------------------------------------------------------------------
/static/fonts/karla/Karla-VariableFont_wght.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/static/fonts/karla/Karla-VariableFont_wght.ttf
--------------------------------------------------------------------------------
/src/images/docs/concepts/off-chain-workers-v2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/docs/concepts/off-chain-workers-v2.png
--------------------------------------------------------------------------------
/src/images/tutorials/07-add-a-pallet/set-name.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/07-add-a-pallet/set-name.png
--------------------------------------------------------------------------------
/src/images/tutorials/09-cumulus/parachain-bid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/09-cumulus/parachain-bid.png
--------------------------------------------------------------------------------
/src/images/tutorials/09-cumulus/session-keys.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/09-cumulus/session-keys.png
--------------------------------------------------------------------------------
/src/images/tutorials/10-frontier-workshop/rpc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/10-frontier-workshop/rpc.png
--------------------------------------------------------------------------------
/static/assets/tutorials/ink-workshop/send-as.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/static/assets/tutorials/ink-workshop/send-as.png
--------------------------------------------------------------------------------
/src/images/docs/advanced/consensus-longest-chain.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/docs/advanced/consensus-longest-chain.png
--------------------------------------------------------------------------------
/src/images/docs/getting-started/substrate-arch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/docs/getting-started/substrate-arch.png
--------------------------------------------------------------------------------
/src/images/docs/tools/mem-profiling-memory-graph.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/docs/tools/mem-profiling-memory-graph.png
--------------------------------------------------------------------------------
/src/images/tutorials/07-add-a-pallet/name-of-bob.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/07-add-a-pallet/name-of-bob.png
--------------------------------------------------------------------------------
/src/images/tutorials/09-cumulus/crowdloan-sucess.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/09-cumulus/crowdloan-sucess.png
--------------------------------------------------------------------------------
/src/images/tutorials/09-cumulus/paraid-reserve.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/09-cumulus/paraid-reserve.png
--------------------------------------------------------------------------------
/src/images/tutorials/tutorial-card-images/tuts-3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/tutorial-card-images/tuts-3.jpg
--------------------------------------------------------------------------------
/src/images/tutorials/tutorial-card-images/tuts-4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/tutorial-card-images/tuts-4.jpg
--------------------------------------------------------------------------------
/src/images/docs/concepts/substrate-runtime-client.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/docs/concepts/substrate-runtime-client.png
--------------------------------------------------------------------------------
/src/images/docs/getting-started/technical-freedom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/docs/getting-started/technical-freedom.png
--------------------------------------------------------------------------------
/src/images/tutorials/07-add-a-pallet/name-of-alice.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/07-add-a-pallet/name-of-alice.png
--------------------------------------------------------------------------------
/src/images/tutorials/09-cumulus/crowdloan-success.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/09-cumulus/crowdloan-success.png
--------------------------------------------------------------------------------
/src/images/tutorials/tutorial-card-images/tuts-1.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/tutorial-card-images/tuts-1.jpeg
--------------------------------------------------------------------------------
/src/images/tutorials/tutorial-card-images/tuts-10.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/tutorial-card-images/tuts-10.jpeg
--------------------------------------------------------------------------------
/src/images/tutorials/tutorial-card-images/tuts-11.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/tutorial-card-images/tuts-11.jpeg
--------------------------------------------------------------------------------
/src/images/tutorials/tutorial-card-images/tuts-12.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/tutorial-card-images/tuts-12.jpeg
--------------------------------------------------------------------------------
/src/images/tutorials/tutorial-card-images/tuts-13.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/tutorial-card-images/tuts-13.jpeg
--------------------------------------------------------------------------------
/src/images/tutorials/tutorial-card-images/tuts-2.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/tutorial-card-images/tuts-2.jpeg
--------------------------------------------------------------------------------
/src/images/tutorials/tutorial-card-images/tuts-5.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/tutorial-card-images/tuts-5.jpeg
--------------------------------------------------------------------------------
/src/images/tutorials/tutorial-card-images/tuts-6.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/tutorial-card-images/tuts-6.jpeg
--------------------------------------------------------------------------------
/src/images/tutorials/tutorial-card-images/tuts-7.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/tutorial-card-images/tuts-7.jpeg
--------------------------------------------------------------------------------
/src/images/tutorials/tutorial-card-images/tuts-8.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/tutorial-card-images/tuts-8.jpeg
--------------------------------------------------------------------------------
/src/images/tutorials/tutorial-card-images/tuts-9.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/tutorial-card-images/tuts-9.jpeg
--------------------------------------------------------------------------------
/static/assets/tutorials/ink-workshop/flipper-false.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/static/assets/tutorials/ink-workshop/flipper-false.png
--------------------------------------------------------------------------------
/static/assets/tutorials/ink-workshop/flipper-true.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/static/assets/tutorials/ink-workshop/flipper-true.png
--------------------------------------------------------------------------------
/static/fonts/karla/Karla-Italic-VariableFont_wght.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/static/fonts/karla/Karla-Italic-VariableFont_wght.ttf
--------------------------------------------------------------------------------
/src/images/photos/homepage/connect-with-the-community.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/photos/homepage/connect-with-the-community.jpg
--------------------------------------------------------------------------------
/src/images/tutorials/01-create-your-first-chain/forks.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/01-create-your-first-chain/forks.png
--------------------------------------------------------------------------------
/src/images/tutorials/02-proof-of-existence/file-hash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/02-proof-of-existence/file-hash.png
--------------------------------------------------------------------------------
/src/images/tutorials/04-forkless-upgrade/node-diagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/04-forkless-upgrade/node-diagram.png
--------------------------------------------------------------------------------
/src/images/tutorials/04-forkless-upgrade/sudo-upgrade.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/04-forkless-upgrade/sudo-upgrade.png
--------------------------------------------------------------------------------
/src/images/tutorials/04-forkless-upgrade/version-101.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/04-forkless-upgrade/version-101.png
--------------------------------------------------------------------------------
/src/images/tutorials/07-add-a-pallet/clear-name-error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/07-add-a-pallet/clear-name-error.png
--------------------------------------------------------------------------------
/src/images/tutorials/08-ink-workshop/Part I/send-as.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/08-ink-workshop/Part I/send-as.png
--------------------------------------------------------------------------------
/src/images/tutorials/09-cumulus/crowdloan-contribute.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/09-cumulus/crowdloan-contribute.png
--------------------------------------------------------------------------------
/src/images/tutorials/09-cumulus/parachain-crowdloan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/09-cumulus/parachain-crowdloan.png
--------------------------------------------------------------------------------
/src/images/tutorials/09-cumulus/parathread-onboarding.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/09-cumulus/parathread-onboarding.png
--------------------------------------------------------------------------------
/src/images/tutorials/09-cumulus/parathread-register.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/09-cumulus/parathread-register.png
--------------------------------------------------------------------------------
/src/images/tutorials/09-cumulus/polkadot-launch-log.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/09-cumulus/polkadot-launch-log.png
--------------------------------------------------------------------------------
/src/images/tutorials/09-cumulus/register-parathread.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/09-cumulus/register-parathread.png
--------------------------------------------------------------------------------
/src/images/tutorials/10-frontier-workshop/pallet-evm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/10-frontier-workshop/pallet-evm.png
--------------------------------------------------------------------------------
/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: [
3 | require('postcss-import'),
4 | require('tailwindcss'),
5 | require('autoprefixer'),
6 | ],
7 | }
8 |
--------------------------------------------------------------------------------
/src/images/tutorials/02-proof-of-existence/poe-claimed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/02-proof-of-existence/poe-claimed.png
--------------------------------------------------------------------------------
/src/images/tutorials/06-visualize-node-metrics/grafana.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/06-visualize-node-metrics/grafana.png
--------------------------------------------------------------------------------
/src/images/tutorials/09-cumulus/parachain-active-lease.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/09-cumulus/parachain-active-lease.png
--------------------------------------------------------------------------------
/src/images/tutorials/10-frontier-workshop/block-import.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/10-frontier-workshop/block-import.png
--------------------------------------------------------------------------------
/static/assets/tutorials/ink-workshop/start-canvas-node.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/static/assets/tutorials/ink-workshop/start-canvas-node.png
--------------------------------------------------------------------------------
/src/images/docs/runtime/benchmarking-on-finalize-blocktime.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/docs/runtime/benchmarking-on-finalize-blocktime.png
--------------------------------------------------------------------------------
/src/images/tutorials/01-create-your-first-chain/balances.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/01-create-your-first-chain/balances.png
--------------------------------------------------------------------------------
/src/images/tutorials/01-create-your-first-chain/chain-data.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/01-create-your-first-chain/chain-data.png
--------------------------------------------------------------------------------
/src/images/tutorials/01-create-your-first-chain/metadata.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/01-create-your-first-chain/metadata.png
--------------------------------------------------------------------------------
/src/images/tutorials/02-proof-of-existence/frame-runtime.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/02-proof-of-existence/frame-runtime.png
--------------------------------------------------------------------------------
/src/images/tutorials/02-proof-of-existence/poe-component.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/02-proof-of-existence/poe-component.png
--------------------------------------------------------------------------------
/src/images/tutorials/04-forkless-upgrade/scheduled-upgrade.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/04-forkless-upgrade/scheduled-upgrade.png
--------------------------------------------------------------------------------
/src/images/tutorials/07-add-a-pallet/kill-name-bad-origin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/07-add-a-pallet/kill-name-bad-origin.png
--------------------------------------------------------------------------------
/src/images/tutorials/08-ink-workshop/Part I/flipper-false.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/08-ink-workshop/Part I/flipper-false.png
--------------------------------------------------------------------------------
/src/images/tutorials/08-ink-workshop/Part I/flipper-true.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/08-ink-workshop/Part I/flipper-true.png
--------------------------------------------------------------------------------
/src/images/tutorials/10-frontier-workshop/pallet-ethereum.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/10-frontier-workshop/pallet-ethereum.png
--------------------------------------------------------------------------------
/src/images/tutorials/10-frontier-workshop/starting-point.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/10-frontier-workshop/starting-point.png
--------------------------------------------------------------------------------
/src/images/tutorials/11-kitties-workshop/kitties-tutorial.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/11-kitties-workshop/kitties-tutorial.png
--------------------------------------------------------------------------------
/static/assets/tutorials/ink-workshop/send-as-transaction.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/static/assets/tutorials/ink-workshop/send-as-transaction.png
--------------------------------------------------------------------------------
/src/components/Buttons/index.tsx:
--------------------------------------------------------------------------------
1 | export * from './PrimaryButton'
2 | export * from './SecondaryButton'
3 | export * from './TextButton'
4 | export * from './PrimaryFixedButton'
5 |
--------------------------------------------------------------------------------
/src/images/tutorials/01-create-your-first-chain/dave-account.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/01-create-your-first-chain/dave-account.png
--------------------------------------------------------------------------------
/src/images/tutorials/01-create-your-first-chain/event-panel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/01-create-your-first-chain/event-panel.png
--------------------------------------------------------------------------------
/src/images/tutorials/03-permissioned-network/dave_claim_node.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/03-permissioned-network/dave_claim_node.png
--------------------------------------------------------------------------------
/src/images/tutorials/09-cumulus/parachain-registration-sudo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/09-cumulus/parachain-registration-sudo.png
--------------------------------------------------------------------------------
/src/images/tutorials/09-cumulus/parachain-summary-screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/09-cumulus/parachain-summary-screenshot.png
--------------------------------------------------------------------------------
/src/images/tutorials/09-cumulus/parathread-register-success.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/09-cumulus/parathread-register-success.png
--------------------------------------------------------------------------------
/src/images/tutorials/11-kitties-workshop/kitty-transfer-shot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/11-kitties-workshop/kitty-transfer-shot.png
--------------------------------------------------------------------------------
/static/assets/tutorials/ink-workshop/canvas-connect-to-local.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/static/assets/tutorials/ink-workshop/canvas-connect-to-local.png
--------------------------------------------------------------------------------
/static/assets/tutorials/ink-workshop/flipper-instantiate-01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/static/assets/tutorials/ink-workshop/flipper-instantiate-01.png
--------------------------------------------------------------------------------
/static/assets/tutorials/ink-workshop/flipper-instantiate-02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/static/assets/tutorials/ink-workshop/flipper-instantiate-02.png
--------------------------------------------------------------------------------
/static/assets/tutorials/ink-workshop/flipper-instantiate-03.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/static/assets/tutorials/ink-workshop/flipper-instantiate-03.png
--------------------------------------------------------------------------------
/src/images/docs/runtime/benchmarking-multi-variables-regression.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/docs/runtime/benchmarking-multi-variables-regression.png
--------------------------------------------------------------------------------
/src/images/tutorials/01-create-your-first-chain/accts-prefunded.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/01-create-your-first-chain/accts-prefunded.png
--------------------------------------------------------------------------------
/src/images/tutorials/01-create-your-first-chain/apps-transfer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/01-create-your-first-chain/apps-transfer.png
--------------------------------------------------------------------------------
/src/images/tutorials/01-create-your-first-chain/balance-result.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/01-create-your-first-chain/balance-result.png
--------------------------------------------------------------------------------
/src/images/tutorials/01-create-your-first-chain/blockchain-top.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/01-create-your-first-chain/blockchain-top.png
--------------------------------------------------------------------------------
/src/images/tutorials/01-create-your-first-chain/transfer-filled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/01-create-your-first-chain/transfer-filled.png
--------------------------------------------------------------------------------
/src/images/tutorials/02-proof-of-existence/front-end-template.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/02-proof-of-existence/front-end-template.png
--------------------------------------------------------------------------------
/src/images/tutorials/05-private-network/polkadot-list-networks.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/05-private-network/polkadot-list-networks.png
--------------------------------------------------------------------------------
/src/images/tutorials/08-ink-workshop/Part I/flipper-call-page.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/08-ink-workshop/Part I/flipper-call-page.png
--------------------------------------------------------------------------------
/src/images/tutorials/08-ink-workshop/Part I/flipper-code-events.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/08-ink-workshop/Part I/flipper-code-events.png
--------------------------------------------------------------------------------
/src/images/tutorials/08-ink-workshop/Part I/send-as-transaction.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/08-ink-workshop/Part I/send-as-transaction.png
--------------------------------------------------------------------------------
/src/images/tutorials/08-ink-workshop/Part I/start-canvas-node.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/08-ink-workshop/Part I/start-canvas-node.png
--------------------------------------------------------------------------------
/src/images/tutorials/08-ink-workshop/Part I/start-substrate-ui.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/08-ink-workshop/Part I/start-substrate-ui.png
--------------------------------------------------------------------------------
/src/images/tutorials/09-cumulus/polkadot-apps-with-2-parachains.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/09-cumulus/polkadot-apps-with-2-parachains.png
--------------------------------------------------------------------------------
/src/images/tutorials/01-create-your-first-chain/interactor-events.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/01-create-your-first-chain/interactor-events.png
--------------------------------------------------------------------------------
/src/images/tutorials/03-permissioned-network/add_well_known_node.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/03-permissioned-network/add_well_known_node.png
--------------------------------------------------------------------------------
/src/images/tutorials/03-permissioned-network/dave_add_connections.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/03-permissioned-network/dave_add_connections.png
--------------------------------------------------------------------------------
/src/images/tutorials/03-permissioned-network/get_well_known_nodes.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/03-permissioned-network/get_well_known_nodes.png
--------------------------------------------------------------------------------
/src/images/tutorials/05-private-network/private-network-accounts.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/05-private-network/private-network-accounts.png
--------------------------------------------------------------------------------
/src/images/tutorials/05-private-network/private-network-no-blocks.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/05-private-network/private-network-no-blocks.png
--------------------------------------------------------------------------------
/src/images/tutorials/08-ink-workshop/Part I/flipper-upload-events.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/08-ink-workshop/Part I/flipper-upload-events.png
--------------------------------------------------------------------------------
/src/images/tutorials/03-permissioned-network/charlie_add_connections.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/03-permissioned-network/charlie_add_connections.png
--------------------------------------------------------------------------------
/src/images/tutorials/04-forkless-upgrade/scheduled-upgrade-success.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/04-forkless-upgrade/scheduled-upgrade-success.png
--------------------------------------------------------------------------------
/src/images/tutorials/05-private-network/private-network-apps-keygen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/05-private-network/private-network-apps-keygen.png
--------------------------------------------------------------------------------
/src/images/tutorials/08-ink-workshop/Part I/canvas-connect-to-local.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/08-ink-workshop/Part I/canvas-connect-to-local.png
--------------------------------------------------------------------------------
/src/images/tutorials/08-ink-workshop/Part I/flipper-instantiate-01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/08-ink-workshop/Part I/flipper-instantiate-01.png
--------------------------------------------------------------------------------
/src/images/tutorials/08-ink-workshop/Part I/flipper-instantiate-02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/08-ink-workshop/Part I/flipper-instantiate-02.png
--------------------------------------------------------------------------------
/src/images/tutorials/08-ink-workshop/Part I/flipper-instantiate-03.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/08-ink-workshop/Part I/flipper-instantiate-03.png
--------------------------------------------------------------------------------
/src/images/tutorials/05-private-network/private-network-select-network.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/05-private-network/private-network-select-network.png
--------------------------------------------------------------------------------
/src/images/tutorials/05-private-network/private-network-custom-endpoint.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/05-private-network/private-network-custom-endpoint.png
--------------------------------------------------------------------------------
/src/images/tutorials/05-private-network/private-network-displays-blocks.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/05-private-network/private-network-displays-blocks.png
--------------------------------------------------------------------------------
/.prettierrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | arrowParens: 'avoid',
3 | endOfLine: 'lf',
4 | semi: false,
5 | singleQuote: true,
6 | trailingComma: 'es5',
7 | tabWidth: 2, // 2 spaces, not true tabs
8 | }
9 |
--------------------------------------------------------------------------------
/src/images/tutorials/02-proof-of-existence/front-end-template-balance-transfer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/02-proof-of-existence/front-end-template-balance-transfer.png
--------------------------------------------------------------------------------
/src/images/tutorials/05-private-network/private-network-apps-insert-key-aura.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/05-private-network/private-network-apps-insert-key-aura.png
--------------------------------------------------------------------------------
/src/images/tutorials/05-private-network/private-network-apps-insert-key-gran.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/05-private-network/private-network-apps-insert-key-gran.png
--------------------------------------------------------------------------------
/src/images/tutorials/05-private-network/private-network-top-left-network-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoR/substrate-docs/main/src/images/tutorials/05-private-network/private-network-top-left-network-icon.png
--------------------------------------------------------------------------------
/.prettierignore:
--------------------------------------------------------------------------------
1 | # Ignore build/dev artifacts:
2 | .cache
3 | node_modules
4 | public
5 | package.json
6 | package-lock.json
7 |
8 | # Ignore files that don't need *text* formatting
9 | src/images
10 | static/img
--------------------------------------------------------------------------------
/.yarnrc.yml:
--------------------------------------------------------------------------------
1 | nodeLinker: node-modules
2 |
3 | plugins:
4 | - path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
5 | spec: "@yarnpkg/plugin-interactive-tools"
6 |
7 | yarnPath: .yarn/releases/yarn-3.0.2.cjs
8 |
--------------------------------------------------------------------------------
/static/security.txt:
--------------------------------------------------------------------------------
1 | Contact: bugbounty@parity.io
2 | Preferred-Languages: en
3 | Canonical: https://www.parity.io/.well-known/security.txt
4 | Policy: https://www.parity.io/bug-bounty/
5 | Hiring: https://www.parity.io/jobs/
--------------------------------------------------------------------------------
/decs.d.ts:
--------------------------------------------------------------------------------
1 | declare module '*.png'
2 | declare module '*.svg'
3 | declare module '*.jpg'
4 | declare module '*.jpeg'
5 | declare module 'gatsby-plugin-gdpr-cookies'
6 | declare module 'mdx-utils'
7 | declare module 'prism-react-renderer/prism'
8 |
--------------------------------------------------------------------------------
/src/components/search-ui/index.tsx:
--------------------------------------------------------------------------------
1 | export * from './SearchDocs'
2 | export * from './SearchModal'
3 | export * from './SearchSectionLabel'
4 | export * from './SearchResult'
5 | export * from './SearchInput'
6 | export * from './SearchResultsContainer'
7 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style=space
5 | indent_size=2
6 | tab_width=2
7 | end_of_line=lf
8 | charset=utf-8
9 | insert_final_newline=true
10 | trim_trailing_whitespace=true
11 |
12 | [*.{rs, toml}]
13 | indent_style=tab
14 | indent_size=tab
15 |
--------------------------------------------------------------------------------
/src/utils/browser.js:
--------------------------------------------------------------------------------
1 | import { browserName, browserVersion } from 'react-device-detect'
2 |
3 | export const isBrowser = typeof window !== 'undefined'
4 |
5 | export const browser = { name: browserName, version: browserVersion }
6 |
7 | export const isSafari = browserName === 'Safari'
8 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM node:14 AS builder
2 | EXPOSE 9000
3 |
4 | WORKDIR /app
5 | COPY . .
6 | RUN echo "GATSBY_IO_URL=https://www.substrate.io\nGATSBY_DOCS_URL=http://localhost:9000" \
7 | > .env.production
8 | RUN yarn install && yarn build
9 | CMD ["yarn", "gatsby", "serve", "-H", "0.0.0.0"]
10 |
--------------------------------------------------------------------------------
/src/images/svgs/arrow-down.svg:
--------------------------------------------------------------------------------
1 |
8 |
9 |
--------------------------------------------------------------------------------
/src/images/svgs/flag.svg:
--------------------------------------------------------------------------------
1 |
7 |
8 |
--------------------------------------------------------------------------------
/src/images/svgs/diamond-purple.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/styles/global.css:
--------------------------------------------------------------------------------
1 | /* import fonts locally to remove cross-site dependency */
2 | @import 'fonts';
3 |
4 | @import 'tailwindcss/base';
5 | @import 'tailwindcss/components';
6 | @import 'tailwindcss/utilities';
7 |
8 | /* GLOBAL Substrate platform preset */
9 | @import './tailwind-preset.css';
10 | /* custom project styles */
11 | @import './tailwind-custom.css';
12 |
--------------------------------------------------------------------------------
/src/images/svgs/diamond-green.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/netlify.toml:
--------------------------------------------------------------------------------
1 | [context.production]
2 | command = "yarn build && cp .netlify/_redirects public/_redirects"
3 | publish = "public/"
4 |
5 | [context.deploy-preview]
6 | command = "yarn build && cp .netlify/_redirects public/_redirects"
7 | publish = "public/"
8 |
9 | [context.develop]
10 | command = "yarn build && cp .netlify/_redirects public/_redirects"
11 | publish = "public/"
12 |
--------------------------------------------------------------------------------
/src/images/svgs/fe-template.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/images/svgs/note.svg:
--------------------------------------------------------------------------------
1 |
7 |
8 |
--------------------------------------------------------------------------------
/src/components/Hooks/use-lunr-index.tsx:
--------------------------------------------------------------------------------
1 | import { graphql, useStaticQuery } from 'gatsby'
2 | import { Index } from 'lunr'
3 |
4 | export const useLunrIndex = () => {
5 | const { LunrIndex } = useStaticQuery(
6 | graphql`
7 | {
8 | LunrIndex
9 | }
10 | `
11 | )
12 | const index = Index.load(LunrIndex.index)
13 | const { store } = LunrIndex
14 | return { store, index }
15 | }
16 |
--------------------------------------------------------------------------------
/src/components/layout/Section.tsx:
--------------------------------------------------------------------------------
1 | import cx from 'classnames'
2 | import React from 'react'
3 |
4 | interface SectionProps {
5 | children: React.ReactNode
6 | styles?: string
7 | }
8 |
9 | export default function Layout({ children, styles }: SectionProps) {
10 | const sectionClass = 'container mb-20 px-4 lg:px-10'
11 |
12 | return
13 | }
14 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | blank_issues_enabled: true
2 | contact_links:
3 | - name: StackOverflow [tagged substrate]
4 | url: https://stackoverflow.com/questions/tagged/substrate
5 | about: Please seek support and ask questions on StackOverflow and tag them `substrate`.
6 | - name: Substrate Community Chat
7 | url: https://matrix.to/#/#substrate-technical:matrix.org
8 | about: Join the community chat!
9 |
--------------------------------------------------------------------------------
/content/banners/stack-exchange.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "StackExchange Forum"
3 | active: false
4 | ---
5 |
6 | The Substrate community is campaigning for a dedicated [StackExchange](https://area51.stackexchange.com/proposals/126136/substrate-blockchain-framework) forum!
7 |
8 | **Please help us by following and committing to your desire for it [here.](https://area51.stackexchange.com/proposals/126136/substrate-blockchain-framework)**
9 |
--------------------------------------------------------------------------------
/src/images/svgs/feedback-icon.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/images/svgs/diamond-yellow.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/images/svgs/arrow-more.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "module": "commonjs",
4 | "target": "esnext",
5 | "jsx": "preserve",
6 | "lib": ["dom", "esnext"],
7 | "strict": true,
8 | "noEmit": true,
9 | "isolatedModules": true,
10 | "esModuleInterop": true,
11 | "noUnusedLocals": false,
12 | "strictNullChecks": false,
13 | "resolveJsonModule": true
14 | },
15 | "include": ["**/*.ts", "**/*.tsx", "decs.d.ts"],
16 | "exclude": ["node_modules", "public", ".cache"]
17 | }
18 |
--------------------------------------------------------------------------------
/src/components/DocsComponents/index.tsx:
--------------------------------------------------------------------------------
1 | export * from './Message'
2 | export * from './NextButton'
3 | export * from './PreviousButton'
4 | export * from './RelatedMaterialBlock'
5 | export * from './Objectives'
6 | export * from './TutorialObjective'
7 | export * from './RelevantSkills'
8 | export * from './SkillsYouGain'
9 | export * from './AccentButton'
10 | export * from './DarkButton'
11 | export * from './FastTrackPlayground'
12 | export * from './BottomButtons'
13 | export * from './ExternalLink'
14 | export * from './FeedbackWidget'
15 | export * from './MdxLink'
16 |
--------------------------------------------------------------------------------
/src/images/svgs/docs-icon.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/components/DocsComponents/RelevantSkills.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | interface RelevantSkillsProps {
4 | data: string[]
5 | }
6 |
7 | export function RelevantSkills({ data }: RelevantSkillsProps) {
8 | return (
9 |
10 | {data.map((str, index) => (
11 |
15 | {str}
16 |
17 | ))}
18 |
19 | )
20 | }
21 |
--------------------------------------------------------------------------------
/src/images/svgs/search.svg:
--------------------------------------------------------------------------------
1 |
11 |
12 |
--------------------------------------------------------------------------------
/src/components/DocsComponents/ExternalLink.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import Icon from '../Icon'
3 |
4 | interface ExternalLinkProps {
5 | url: string
6 | children: React.ReactNode
7 | }
8 |
9 | export function ExternalLink(props: ExternalLinkProps) {
10 | return (
11 |
17 | {props.children}
18 |
22 |
23 | )
24 | }
25 |
--------------------------------------------------------------------------------
/src/styles/fonts.css:
--------------------------------------------------------------------------------
1 | /* using font-display: block; flash of invisible text (FOIT) */
2 |
3 | @font-face {
4 | font-family: 'Karla';
5 | src: url('/fonts/karla/Karla-VariableFont_wght.ttf') format('truetype');
6 | font-display: block;
7 | font-weight: 100 800;
8 | }
9 |
10 | @font-face {
11 | font-family: 'Karla';
12 | src: url('/fonts/karla/Karla-Italic-VariableFont_wght.ttf') format('truetype');
13 | font-display: block;
14 | font-style: italic;
15 | }
16 |
17 | @font-face {
18 | font-family: 'Poppins';
19 | src: url('/fonts/poppins/Poppins-ExtraBold.ttf') format('truetype');
20 | font-display: block;
21 | font-weight: 800;
22 | }
23 |
--------------------------------------------------------------------------------
/src/images/svgs/close-icon.svg:
--------------------------------------------------------------------------------
1 |
7 |
8 |
--------------------------------------------------------------------------------
/src/components/DocsComponents/SkillsYouGain.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | interface SkillsYouGainProps {
4 | data: string[]
5 | }
6 |
7 | export function SkillsYouGain({ data }: SkillsYouGainProps) {
8 | return (
9 |
10 |
Skills you will gain:
11 | {data.map((str, index) => (
12 |
16 | {str}
17 |
18 | ))}
19 |
20 | )
21 | }
22 |
--------------------------------------------------------------------------------
/src/hooks/use-session-storage.js:
--------------------------------------------------------------------------------
1 | import { useEffect, useState } from 'react'
2 |
3 | import { isBrowser } from '../utils/browser'
4 |
5 | function getSessionStorageOrDefault(key, defaultValue) {
6 | const stored = isBrowser && window.sessionStorage.getItem(key)
7 | if (!stored) {
8 | return defaultValue
9 | }
10 | return JSON.parse(stored)
11 | }
12 |
13 | export function useSessionStorage(key, defaultValue) {
14 | const [value, setValue] = useState(
15 | getSessionStorageOrDefault(key, defaultValue)
16 | )
17 |
18 | useEffect(() => {
19 | window.sessionStorage.setItem(key, JSON.stringify(value))
20 | }, [key, value])
21 |
22 | return [value, setValue]
23 | }
24 |
--------------------------------------------------------------------------------
/src/components/DocsComponents/DarkButton.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import Link from '../Link'
3 |
4 | interface DarkButtonProps {
5 | text: string
6 | link: string
7 | }
8 | export function DarkButton({ text, link }: DarkButtonProps) {
9 | return (
10 | <>
11 |
12 |
13 |
14 | {text}
15 |
16 |
17 |
18 | >
19 | )
20 | }
21 |
--------------------------------------------------------------------------------
/src/images/svgs/stack-overflow-original.svg:
--------------------------------------------------------------------------------
1 |
7 |
11 |
15 |
--------------------------------------------------------------------------------
/src/images/svgs/advice.svg:
--------------------------------------------------------------------------------
1 |
7 |
8 |
--------------------------------------------------------------------------------
/src/images/svgs/stack-overflow-white.svg:
--------------------------------------------------------------------------------
1 |
8 |
9 |
12 |
15 |
16 |
--------------------------------------------------------------------------------
/static/assets/tutorials/ink-workshop/1.1-finished-code.rs:
--------------------------------------------------------------------------------
1 | #![cfg_attr(not(feature = "std"), no_std)]
2 |
3 | use ink_lang as ink;
4 |
5 | #[ink::contract]
6 | mod incrementer {
7 | #[ink(storage)]
8 | pub struct Incrementer {
9 | // Storage Declaration
10 | }
11 |
12 | impl Incrementer {
13 | #[ink(constructor)]
14 | pub fn new(init_value: i32) -> Self {
15 | // Contract Constructor
16 | Self{}
17 | }
18 |
19 | #[ink(message)]
20 | pub fn get(&self) {
21 | // Contract Message
22 | }
23 | }
24 |
25 | #[cfg(test)]
26 | mod tests {
27 | use super::*;
28 | use ink_lang as ink;
29 |
30 | #[ink::test]
31 | fn default_works() {
32 | // Test Your Contract
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/gatsby-node/on-create-node.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable @typescript-eslint/no-var-requires */
2 | const { createFilePath } = require('gatsby-source-filesystem')
3 |
4 | const addSlugFieldToMarkdown = ({ node, getNode, actions }) => {
5 | const { createNodeField } = actions
6 | const filepaths = createFilePath({ node, getNode, basePath: `pages` })
7 | .split('/')
8 | .filter(pathElement => pathElement)
9 | const slugPath = filepaths[filepaths.length - 1]
10 | const slug =
11 | node.frontmatter && node.frontmatter.slug ? node.frontmatter.slug : slugPath
12 | createNodeField({
13 | node,
14 | name: `slug`,
15 | value: slug,
16 | })
17 | }
18 |
19 | module.exports = {
20 | addSlugFieldToMarkdown,
21 | }
22 |
--------------------------------------------------------------------------------
/src/components/DocsComponents/Objectives.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import ReactMarkdown from 'react-markdown'
3 |
4 | interface ObjectivesProps {
5 | data: { title: string; description: string }[]
6 | }
7 |
8 | export function Objectives({ data }: ObjectivesProps) {
9 | return (
10 | <>
11 |
12 | {data.map((item, index) => (
13 |
14 |
15 |
{item.title}
16 |
17 |
{item.description}
18 |
19 | ))}
20 |
21 | >
22 | )
23 | }
24 |
--------------------------------------------------------------------------------
/src/images/svgs/external-icon.svg:
--------------------------------------------------------------------------------
1 |
7 |
8 |
--------------------------------------------------------------------------------
/src/images/svgs/twitter.svg:
--------------------------------------------------------------------------------
1 |
7 |
10 |
--------------------------------------------------------------------------------
/src/images/svgs/node-template.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/content/banners/__readme__.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Example Banner Title (optional)"
3 | active: false
4 | ---
5 |
6 | DO NOT delete or rename this readme file and follow the instructions bellow:
7 |
8 | 1. This is a Markdown template you can copy and rename to add a new banner (eg.: "campaign-name.md").
9 |
10 | 2. Allowed markup is only plain text, **strong** and [link](https://example.com).
11 |
12 | 3. Paragraphs can be used instead of new lines.
13 |
14 | 4. Keep in mind to be short as possible (max 160 characters) as the Banner UI could get quite big.
15 |
16 | 5. One banner is optimal but the UI supports two if really needed. In such a case they will be stacked in the Banner UI in an alphabetical order.
17 |
18 | 6. You can archive banners by setting "active: false" to exclude it from the Banner UI.
19 |
--------------------------------------------------------------------------------
/src/hooks/use-banner.js:
--------------------------------------------------------------------------------
1 | import { graphql, useStaticQuery } from 'gatsby'
2 |
3 | export const useBanner = () => {
4 | const {
5 | allMarkdownRemark: { edges: banners },
6 | } = useStaticQuery(
7 | graphql`
8 | query {
9 | allMarkdownRemark(
10 | filter: {
11 | fileAbsolutePath: { regex: "//(banner)./(?!(__readme__))/" }
12 | frontmatter: { active: { eq: true } }
13 | }
14 | sort: { fields: fields___slug, order: ASC }
15 | limit: 2
16 | ) {
17 | edges {
18 | node {
19 | html
20 | frontmatter {
21 | title
22 | }
23 | }
24 | }
25 | }
26 | }
27 | `
28 | )
29 |
30 | return { banners }
31 | }
32 |
--------------------------------------------------------------------------------
/src/components/Hooks/use-site-metadata.tsx:
--------------------------------------------------------------------------------
1 | import { graphql, useStaticQuery } from 'gatsby'
2 |
3 | export const useSiteMetadata = () => {
4 | const {
5 | site: { siteMetadata },
6 | } = useStaticQuery(
7 | graphql`
8 | query {
9 | site {
10 | siteMetadata {
11 | title
12 | description
13 | image_og
14 | siteUrl
15 | author
16 | pressEmail
17 | email
18 | twitter
19 | linkedIn
20 | element
21 | github
22 | telegram
23 | gitter
24 | stackOverflow
25 | keywords
26 | substrateIO
27 | terms
28 | privacy
29 | }
30 | }
31 | }
32 | `
33 | )
34 | return { siteMetadata }
35 | }
36 |
--------------------------------------------------------------------------------
/src/components/Hooks/use-scroll-listener.tsx:
--------------------------------------------------------------------------------
1 | import { createContext, useState, useEffect } from 'react'
2 |
3 | export default function useScrollListener() {
4 | const [data, setData] = useState({
5 | x: 0,
6 | y: 0,
7 | lastX: 0,
8 | lastY: 0,
9 | })
10 |
11 | // set up event listeners
12 | useEffect(() => {
13 | const handleScroll = () => {
14 | setData(last => {
15 | return {
16 | x: window.scrollX,
17 | y: window.scrollY,
18 | lastX: last.x,
19 | lastY: last.y,
20 | }
21 | })
22 | }
23 |
24 | handleScroll()
25 | window.addEventListener('scroll', handleScroll)
26 |
27 | return () => {
28 | window.removeEventListener('scroll', handleScroll)
29 | }
30 | }, [])
31 |
32 | return data
33 | }
34 |
35 | export const ScrollContext = createContext(null)
36 |
--------------------------------------------------------------------------------
/src/images/svgs/information.svg:
--------------------------------------------------------------------------------
1 |
7 |
8 |
--------------------------------------------------------------------------------
/src/images/svgs/tuts.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/src/components/DocsComponents/AccentButton.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import Link from '../../components/Link'
3 |
4 | interface AccentButtonProps {
5 | text: string
6 | link: string
7 | }
8 | export function AccentButton({ text, link }: AccentButtonProps) {
9 | return (
10 | <>
11 |
12 |
13 |
14 | {text}
15 |
16 |
17 |
18 | >
19 | )
20 | }
21 |
--------------------------------------------------------------------------------
/gatsby-node/create-resolvers.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable @typescript-eslint/no-var-requires */
2 | /* eslint-disable security/detect-non-literal-require */
3 |
4 | const { GraphQLJSONObject } = require('graphql-type-json')
5 | const { createIndexLunr } = require(`./../lunr/create-index.js`)
6 |
7 | const createMdxResolvers = props => {
8 | const { cache, createResolvers } = props
9 |
10 | createResolvers({
11 | Query: {
12 | LunrIndex: {
13 | type: GraphQLJSONObject,
14 | // eslint-disable-next-line @typescript-eslint/no-unused-vars
15 | resolve: (source, args, context, info) => {
16 | const docNodes = context.nodeModel.getAllNodes({
17 | type: `Mdx`,
18 | })
19 | return createIndexLunr(docNodes, cache)
20 | },
21 | },
22 | },
23 | })
24 | }
25 |
26 | module.exports = {
27 | createMdxResolvers,
28 | }
29 |
--------------------------------------------------------------------------------
/src/images/svgs/ide-code.svg:
--------------------------------------------------------------------------------
1 |
7 |
8 |
--------------------------------------------------------------------------------
/src/components/MobileMenus/MobileNavItem.tsx:
--------------------------------------------------------------------------------
1 | import React, { useState, useEffect } from 'react'
2 | import Link from '../Link'
3 |
4 | interface MobileNavItemProps {
5 | external: boolean
6 | link: string
7 | title: string
8 | }
9 |
10 | export default function MobileNavItem({ link, title }: MobileNavItemProps) {
11 | const [isActive, setIsActive] = useState(false)
12 | useEffect(() => {
13 | if (location.pathname === link) {
14 | setIsActive(true)
15 | } else {
16 | setIsActive(false)
17 | }
18 | }, [])
19 | const styles =
20 | 'text-black dark:text-white hover:no-underline px-6 py-3 text-lg hover:font-bold'
21 | const activeStyles = () => (isActive ? `font-bold` : `font-medium`)
22 | return (
23 |
24 |
25 | {title}
26 |
27 |
28 | )
29 | }
30 |
--------------------------------------------------------------------------------
/src/components/DocsComponents/NextButton.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import Link from '../Link'
3 |
4 | interface NextButtonProps {
5 | text: string
6 | link: string
7 | }
8 | export function NextButton({ text, link }: NextButtonProps) {
9 | return (
10 | <>
11 |
12 |
13 |
14 |
15 | Next - {text}
16 |
17 |
18 |
19 |
20 | >
21 | )
22 | }
23 |
--------------------------------------------------------------------------------
/src/components/Hooks/use-active-hash.tsx:
--------------------------------------------------------------------------------
1 | import { useEffect, useState } from 'react'
2 |
3 | export const useActiveHash = (itemIds: string[], rootMargin?: string) => {
4 | const [activeHash, setActiveHash] = useState(``)
5 | useEffect(() => {
6 | const observer = new IntersectionObserver(
7 | entries => {
8 | entries.forEach(entry => {
9 | if (entry.isIntersecting) {
10 | setActiveHash(entry.target.id)
11 | }
12 | })
13 | },
14 | { rootMargin: rootMargin || `-100px 0px -80% 0px` }
15 | )
16 | itemIds.forEach((id: string) => {
17 | const el = document.getElementById(id)
18 | el
19 | ? observer.observe(document.getElementById(id))
20 | : console.warn(
21 | `Unknown ID: ${id}. We don't support h1 tag (#) in markdown article.`
22 | )
23 | })
24 | }, [])
25 | return activeHash
26 | }
27 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug-template-code.yaml:
--------------------------------------------------------------------------------
1 | name: Code Bug Report
2 | description: Let us know about an issue you experienced with building based on the Tutorials and
3 | How-to Guides
4 | labels: ['bug 🐛']
5 | body:
6 | - type: markdown
7 | attributes:
8 | value: |
9 | Thank you so much for taking the time to report a problem!
10 | - type: textarea
11 | id: bug
12 | attributes:
13 | label: Bug report for compiling, code snippets, templates, etc.
14 | description: What happened?
15 | placeholder: Describe the problem.
16 | validations:
17 | required: true
18 | - type: textarea
19 | id: steps
20 | attributes:
21 | label: Steps to reproduce the problem
22 | description: Provide the steps that led to the discovery of the issue.
23 | placeholder: Describe what you were doing so we can reproduce the problem.
24 | validations:
25 | required: false
26 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/content-template.yaml:
--------------------------------------------------------------------------------
1 | name: Request New or Edited Content
2 | description: Submit your requests and suggestions to help us improve!
3 | labels: ['new content 💡✍️']
4 | body:
5 | - type: markdown
6 | attributes:
7 | value: |
8 | Thank you so much for taking the time to request new or modified content!
9 | - type: textarea
10 | id: content
11 | attributes:
12 | label: Content request
13 | description: What lead you to make this request? What action should we take on it?
14 | placeholder: Describe what you would like to see added or changed.
15 | validations:
16 | required: true
17 | - type: dropdown
18 | id: help
19 | attributes:
20 | label: Are you willing to help with this request?
21 | multiple: true
22 | options:
23 | - Yes!
24 | - No.
25 | - Maybe (please elaborate above)
26 | validations:
27 | required: true
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feedback-template.yaml:
--------------------------------------------------------------------------------
1 | name: Feedback Form
2 | description: Submit your feedback to help us improve!
3 | labels: ['feedback 📝']
4 | body:
5 | - type: markdown
6 | attributes:
7 | value: |
8 | Thank you so much for taking the time to submit your feedback!
9 | - type: dropdown
10 | id: browsers
11 | attributes:
12 | label: What browsers are you seeing the problem on?
13 | multiple: true
14 | options:
15 | - Firefox
16 | - Chrome
17 | - Safari
18 | - Microsoft Edge
19 | - Other (please write below)
20 | validations:
21 | required: false
22 | - type: textarea
23 | id: feedback
24 | attributes:
25 | label: Feedback
26 | description: Did something go wrong or do you have a suggestion for improving this site?
27 | placeholder: Describe what you would like to see changed.
28 | validations:
29 | required: true
30 |
--------------------------------------------------------------------------------
/src/images/svgs/calendar.svg:
--------------------------------------------------------------------------------
1 |
7 |
8 |
--------------------------------------------------------------------------------
/gatsby-node.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable @typescript-eslint/no-var-requires */
2 | const { createPageRedirects } = require('./gatsby-node/create-redirects.js')
3 |
4 | const {
5 | createDocPages,
6 | createHowToGuidePages,
7 | createTutorialPages,
8 | } = require('./gatsby-node/create-pages.js')
9 |
10 | exports.createPages = async props => {
11 | createPageRedirects(props)
12 | await Promise.all([createDocPages(props)])
13 | await Promise.all([createHowToGuidePages(props)])
14 | await Promise.all([createTutorialPages(props)])
15 | }
16 |
17 | const { addSlugFieldToMarkdown } = require('./gatsby-node/on-create-node.js')
18 |
19 | exports.onCreateNode = props => {
20 | const { node } = props
21 | if (node.internal.type === `MarkdownRemark`) {
22 | addSlugFieldToMarkdown(props)
23 | }
24 | }
25 |
26 | const { createMdxResolvers } = require('./gatsby-node/create-resolvers.js')
27 |
28 | exports.createResolvers = props => {
29 | createMdxResolvers(props)
30 | }
31 |
--------------------------------------------------------------------------------
/src/components/BreadCrumbNav.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import Link from './Link'
3 |
4 | interface BreadCrumbNavProps {
5 | section: string
6 | sectionURL: string
7 | title: string
8 | }
9 | export default function BreadCrumbNav(props: BreadCrumbNavProps) {
10 | return (
11 | <>
12 |
13 | Developers Home
14 | »
15 |
16 | {props.section === 'how to guides'
17 | ? 'How-to Guide'
18 | : props.section === 'tutorials'
19 | ? 'Tutorials'
20 | : 'Docs'}
21 |
22 | »
23 |
24 | {props.title}
25 |
26 |
27 | >
28 | )
29 | }
30 |
--------------------------------------------------------------------------------
/src/images/svgs/copy-text.svg:
--------------------------------------------------------------------------------
1 |
8 |
12 |
--------------------------------------------------------------------------------
/static/assets/tutorials/ink-workshop/1.2-finished-code.rs:
--------------------------------------------------------------------------------
1 |
2 | #![cfg_attr(not(feature = "std"), no_std)]
3 |
4 | use ink_lang as ink;
5 |
6 | #[ink::contract]
7 | mod incrementer {
8 | #[ink(storage)]
9 | pub struct Incrementer {
10 | value: i32,
11 | }
12 |
13 | impl Incrementer {
14 | #[ink(constructor)]
15 | pub fn new(init_value: i32) -> Self {
16 | Self {
17 | value: init_value,
18 | }
19 | }
20 |
21 | #[ink(constructor)]
22 | pub fn default() -> Self {
23 | Self {
24 | value: 0,
25 | }
26 | }
27 |
28 | #[ink(message)]
29 | pub fn get(&self) {
30 | // Contract Message
31 | }
32 | }
33 |
34 | #[cfg(test)]
35 | mod tests {
36 | use super::*;
37 | use ink_lang as ink;
38 |
39 | #[ink::test]
40 | fn default_works() {
41 | Incrementer::default();
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/components/DocsComponents/PreviousButton.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import Link from '../Link'
3 | import Icon from '../Icon'
4 |
5 | interface PreviousButtonProps {
6 | text: string
7 | link: string
8 | }
9 | export function PreviousButton({ text, link }: PreviousButtonProps) {
10 | return (
11 | <>
12 |
13 |
14 |
15 |
19 |
20 | Back - {text}
21 |
22 |
23 |
24 |
25 | >
26 | )
27 | }
28 |
--------------------------------------------------------------------------------
/src/components/DocsComponents/MdxLink.tsx:
--------------------------------------------------------------------------------
1 | import * as React from 'react'
2 | import Link from '../Link'
3 | import { ExternalLink } from '../DocsComponents'
4 |
5 | const isHash = (str: string) => /^#/.test(str)
6 | const isInternal = (to: string) => /^\/(?!\/)/.test(to)
7 | const isFile = (to: string) => /\..+$/.test(to)
8 | const isRustDocs = (to: string) => /rustdocs/.test(to)
9 |
10 | interface MdxLinkProps {
11 | href: string
12 | children: React.ReactNode
13 | props: React.ReactNode
14 | }
15 |
16 | export function MdxLink({ href, children, ...props }: MdxLinkProps) {
17 | if (isRustDocs(href) || isHash(href) || !isInternal(href) || isFile(href)) {
18 | if (isHash(href)) {
19 | return (
20 |
21 | {children}
22 |
23 | )
24 | } else {
25 | return {children}
26 | }
27 | } else {
28 | return (
29 |
30 | {children}
31 |
32 | )
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/static/assets/tutorials/ink-workshop/1.3-finished-code.rs:
--------------------------------------------------------------------------------
1 |
2 | #![cfg_attr(not(feature = "std"), no_std)]
3 |
4 | use ink_lang as ink;
5 |
6 | #[ink::contract]
7 | mod incrementer {
8 |
9 | #[ink(storage)]
10 | pub struct Incrementer {
11 | value: i32,
12 | }
13 |
14 | impl Incrementer {
15 | #[ink(constructor)]
16 | pub fn new(init_value: i32) -> Self {
17 | Self {
18 | value: init_value
19 | }
20 | }
21 |
22 | #[ink(constructor)]
23 | pub fn default() -> Self {
24 | Self {
25 | value: 0
26 | }
27 | }
28 |
29 | #[ink(message)]
30 | pub fn get(&self) -> i32 {
31 | self.value
32 | }
33 | }
34 |
35 | #[cfg(test)]
36 | mod tests {
37 | use super::*;
38 | use ink_lang as ink;
39 |
40 | #[ink::test]
41 | fn default_works() {
42 | let contract = Incrementer::default();
43 | assert_eq!(contract.get(), 0);
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/components/Hooks/use-component-visible.tsx:
--------------------------------------------------------------------------------
1 | import { useState, useEffect, useRef } from 'react'
2 |
3 | function useComponentVisible(initialIsVisible: boolean) {
4 | const [isComponentVisible, setIsComponentVisible] = useState(initialIsVisible)
5 | const ref = useRef(null)
6 |
7 | const handleHideDropdown = (event: KeyboardEvent) => {
8 | if (event.key === 'Escape') {
9 | setIsComponentVisible(false)
10 | }
11 | }
12 |
13 | const handleClickOutside = (event: MouseEvent) => {
14 | if (ref.current && !ref.current.contains(event.target)) {
15 | setIsComponentVisible(false)
16 | }
17 | }
18 |
19 | useEffect(() => {
20 | document.addEventListener('keydown', handleHideDropdown, true)
21 | document.addEventListener('click', handleClickOutside, true)
22 | return () => {
23 | document.removeEventListener('keydown', handleHideDropdown, true)
24 | document.removeEventListener('click', handleClickOutside, true)
25 | }
26 | })
27 |
28 | return { ref, isComponentVisible, setIsComponentVisible }
29 | }
30 | export default useComponentVisible
31 |
--------------------------------------------------------------------------------
/src/images/svgs/grad-hat.svg:
--------------------------------------------------------------------------------
1 |
7 |
8 |
--------------------------------------------------------------------------------
/src/images/svgs/htg.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/static/assets/tutorials/ink-workshop/1.2-template.rs:
--------------------------------------------------------------------------------
1 |
2 | #![cfg_attr(not(feature = "std"), no_std)]
3 |
4 | use ink_lang as ink;
5 |
6 | #[ink::contract]
7 | mod incrementer {
8 |
9 | #[ink(storage)]
10 | pub struct Incrementer {
11 | // ACTION: Create a storage value called `value` which holds a `i32`
12 | }
13 |
14 | impl Incrementer {
15 | #[ink(constructor)]
16 | pub fn new(init_value: i32) -> Self {
17 | // ACTION: Create a new `Incrementer` and set its `value` to `init_value`
18 | }
19 |
20 | // ACTION: Create a second constructor function named `default`.
21 | // It has no input, and creates a new `Incrementer` with its `value`
22 | // set to `0`.
23 |
24 | #[ink(message)]
25 | pub fn get(&self) {
26 | // Contract Message
27 | }
28 | }
29 |
30 | #[cfg(test)]
31 | mod tests {
32 | use super::*;
33 | use ink_lang as ink;
34 |
35 | #[ink::test]
36 | fn default_works() {
37 | Incrementer::default();
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/static/assets/tutorials/ink-workshop/1.3-template.rs:
--------------------------------------------------------------------------------
1 |
2 | #![cfg_attr(not(feature = "std"), no_std)]
3 |
4 | use ink_lang as ink;
5 |
6 | #[ink::contract]
7 | mod incrementer {
8 |
9 | #[ink(storage)]
10 | pub struct Incrementer {
11 | value: i32,
12 | }
13 |
14 | impl Incrementer {
15 | #[ink(constructor)]
16 | pub fn new(init_value: i32) -> Self {
17 | Self {
18 | value: init_value
19 | }
20 | }
21 |
22 | #[ink(constructor)]
23 | pub fn default() -> Self {
24 | Self {
25 | value: 0
26 | }
27 | }
28 |
29 | #[ink(message)]
30 | // ACTION: Update this function to return an i32.
31 | pub fn get(&self) {
32 | // ACTION: Return the `value`.
33 | }
34 | }
35 |
36 | #[cfg(test)]
37 | mod tests {
38 | use super::*;
39 | use ink_lang as ink;
40 |
41 | #[ink::test]
42 | fn default_works() {
43 | let contract = Incrementer::default();
44 | assert_eq!(contract.get(), 0);
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/images/svgs/element-white.svg:
--------------------------------------------------------------------------------
1 |
8 |
12 |
16 |
20 |
24 |
--------------------------------------------------------------------------------
/src/components/GithubEditButton.tsx:
--------------------------------------------------------------------------------
1 | import React, { useState, useEffect } from 'react'
2 | import Icon from '../components/Icon'
3 |
4 | interface GithuEditButtonProps {
5 | absolutePath: string
6 | }
7 | export default function GithubEditButton(props: GithuEditButtonProps) {
8 | const githubSlug =
9 | 'https://github.com/substrate-developer-hub/substrate-docs/edit/main'
10 |
11 | const [url, setUrl] = useState('')
12 | useEffect(() => {
13 | setUrl(
14 | `${githubSlug}${props.absolutePath.substr(
15 | props.absolutePath.indexOf('/v')
16 | )}`
17 | )
18 | }, [])
19 |
20 | return (
21 |
37 | )
38 | }
39 |
--------------------------------------------------------------------------------
/src/images/svgs/element-original.svg:
--------------------------------------------------------------------------------
1 |
7 |
11 |
15 |
19 |
23 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug-template-site.yaml:
--------------------------------------------------------------------------------
1 | name: Website Bug Report
2 | description: Let us know about an issue you experienced on https://docs.substrate.io/
3 | labels: ['bug 🐛', 'web-dev 🕸']
4 | body:
5 | - type: markdown
6 | attributes:
7 | value: |
8 | Thank you so much for taking the time to report a problem!
9 | - type: dropdown
10 | id: browsers
11 | attributes:
12 | label: What browsers are you seeing the problem on?
13 | multiple: true
14 | options:
15 | - Firefox
16 | - Chrome
17 | - Safari
18 | - Microsoft Edge
19 | - Other (please write below)
20 | validations:
21 | required: false
22 | - type: textarea
23 | id: bug
24 | attributes:
25 | label: Bug report for the website
26 | description: What happened?
27 | placeholder: Describe the problem.
28 | validations:
29 | required: true
30 | - type: textarea
31 | id: steps
32 | attributes:
33 | label: Steps to reproduce the problem
34 | description: Provide the steps that led to the discovery of the issue.
35 | placeholder: Describe what you were doing so we can reproduce the problem.
36 | validations:
37 | required: false
38 |
--------------------------------------------------------------------------------
/src/components/LastUpdateGithub.tsx:
--------------------------------------------------------------------------------
1 | import React, { useState, useEffect } from 'react'
2 | import moment from 'moment'
3 |
4 | interface LastUpdateGithubProps {
5 | absolutePath: string
6 | }
7 | export default function LastUpdateGithub({
8 | absolutePath,
9 | }: LastUpdateGithubProps) {
10 | const githubLink = `https://api.github.com/repos/substrate-developer-hub/substrate-docs/commits?path=${absolutePath.substr(
11 | absolutePath.indexOf('/v')
12 | )}`
13 | const [date, setDate] = useState('')
14 | const [sha, setSHA] = useState('')
15 | const [link, setLink] = useState('')
16 | useEffect(() => {
17 | fetch(githubLink)
18 | .then(response => response.json())
19 | .then(resultData => {
20 | if (resultData.length > 0) {
21 | setDate(
22 | moment(resultData[0].commit.author.date).format('MMMM DD, YYYY')
23 | )
24 | setSHA(resultData[0].sha.slice(0, 7))
25 | setLink(resultData[0].html_url)
26 | }
27 | })
28 | }, [])
29 | return (
30 |
38 | )
39 | }
40 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/broken-link.yaml:
--------------------------------------------------------------------------------
1 | name: Broken link
2 | description: Report a broken link to help us fix them.
3 | labels: ["broken link ❌"]
4 | body:
5 | - type: markdown
6 | attributes:
7 | value: |
8 | Found a broken link? Thanks for helping us identify them. Please fill in the sections below and hit the "Submit new issue" button when you're done.
9 | - type: textarea
10 | id: url
11 | attributes:
12 | label: Broken Link
13 | description: What link lead to a 404?
14 | placeholder: The URL that you clicked leading to a 404 or improper page.
15 | validations:
16 | required: true
17 | - type: textarea
18 | id: behavior
19 | attributes:
20 | label: Expected Location
21 | description: Where was the link you clicked supposed to go?
22 | placeholder: The URL of where you expected it to go (if you know it).
23 | validations:
24 | required: false
25 | - type: textarea
26 | id: other
27 | attributes:
28 | label: Context and Origin
29 | description: Was this found in a Google search? Embedded in a blog or other documentation? Other?
30 | placeholder: Help us understand where we should look to fix this outside the devhub.
31 | validations:
32 | required: false
33 |
--------------------------------------------------------------------------------
/gatsby-ssr.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | import { ThemeProvider } from './src/contexts/ThemeContext'
4 |
5 | const MagicScriptTag = () => {
6 | const codeToRunOnClient = `
7 | (function() {
8 | function getInitialColorMode() {
9 | const persistedColorPreference = localStorage.theme;
10 | const hasPersistedPreference = typeof persistedColorPreference === 'string';
11 |
12 | if (hasPersistedPreference) {
13 | return persistedColorPreference;
14 | }
15 |
16 | const mql = window.matchMedia('(prefers-color-scheme: dark)');
17 | const hasMediaQueryPreference = typeof mql.matches === 'boolean';
18 |
19 | if (hasMediaQueryPreference) {
20 | return mql.matches ? 'dark' : 'light';
21 | }
22 |
23 | return 'light';
24 | }
25 | const colorMode = getInitialColorMode();
26 | document.documentElement.classList.add(colorMode);
27 | })()
28 | `
29 | return
30 | }
31 |
32 | export const onRenderBody = ({ setPreBodyComponents }) => {
33 | setPreBodyComponents( )
34 | }
35 |
36 | export const wrapRootElement = ({ element }) => (
37 | {element}
38 | )
39 |
--------------------------------------------------------------------------------
/src/pages/404.tsx:
--------------------------------------------------------------------------------
1 | import * as React from 'react'
2 | import Layout from '../components/Layout'
3 | import SEO from '../components/SEO'
4 | import { PrimaryFixedButton } from '../components/Buttons'
5 |
6 | export default function NotFoundPage() {
7 | return (
8 |
9 |
10 |
11 |
12 |
13 | 404
14 |
15 |
16 | {`Something's missing`}
17 |
18 |
19 |
22 |
23 |
24 | Report a broken link
25 |
26 |
27 |
28 |
29 |
30 |
31 | )
32 | }
33 |
--------------------------------------------------------------------------------
/src/components/DocsComponents/FeedbackWidget.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import Icon from '../Icon'
3 | import { SecondaryButton } from '../Buttons'
4 |
5 | export function FeedbackWidget() {
6 | const githubLink =
7 | 'https://github.com/substrate-developer-hub/substrate-docs/issues/new/choose'
8 | return (
9 |
10 |
11 |
15 |
16 | Run into problems?
17 |
18 |
19 |
20 |
24 |
25 |
26 | Let us Know
27 |
28 |
32 |
36 |
37 |
38 |
39 | )
40 | }
41 |
--------------------------------------------------------------------------------
/src/components/search-ui/SearchDocs.tsx:
--------------------------------------------------------------------------------
1 | import React, { useEffect } from 'react'
2 | import Icon from '../Icon'
3 | import useComponentVisible from '../Hooks/use-component-visible'
4 | import { SearchModal } from '../search-ui'
5 |
6 | export function SearchDocs() {
7 | const { ref, isComponentVisible, setIsComponentVisible } =
8 | useComponentVisible(false)
9 | useEffect(() => {
10 | isComponentVisible
11 | ? (document.body.style.overflow = `hidden`)
12 | : (document.body.style.overflow = `unset`)
13 | }, [isComponentVisible])
14 | return (
15 | <>
16 | setIsComponentVisible(!isComponentVisible)}
18 | className="flex items-center justify-between p-2 border-b-2 border-substrateGray cursor-text active:outline-none focus:outline-none"
19 | >
20 |
21 | Search Documentation
22 |
23 |
27 |
28 | {isComponentVisible && (
29 |
30 | )}
31 | >
32 | )
33 | }
34 |
--------------------------------------------------------------------------------
/src/components/DocsComponents/RelatedMaterialBlock.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import Link from '../Link'
3 |
4 | interface RelatedMaterialBlockProps {
5 | title: string
6 | text: string
7 | link: string
8 | linkText: string
9 | }
10 |
11 | export function RelatedMaterialBlock({
12 | title,
13 | text,
14 | link,
15 | linkText,
16 | }: RelatedMaterialBlockProps) {
17 | return (
18 | <>
19 |
20 |
21 |
{title}
22 |
{text}
23 |
24 |
28 | {linkText}
29 |
30 | ➔
31 |
32 |
33 |
34 | >
35 | )
36 | }
37 |
--------------------------------------------------------------------------------
/src/components/Header/NavListItem.tsx:
--------------------------------------------------------------------------------
1 | import React, { useState, useEffect } from 'react'
2 | // import { Link } from 'gatsby'
3 | import Link from '../Link'
4 |
5 | interface NavListItemProps {
6 | external: boolean
7 | link: string
8 | title: string
9 | }
10 |
11 | export default function NavListItem({ link, title }: NavListItemProps) {
12 | const [isCurrent, setIsCurrent] = useState(false)
13 | const styles =
14 | 'whitespace-nowrap pl-6 pr-12 py-2 focus:outline-none focus:bg-substrateBlueBg hover:text-substrateGreen hover:underline dark:text-white font-medium'
15 | useEffect(() => {
16 | if (
17 | link === location.pathname ||
18 | (location.pathname === '/v3/getting-started/overview' &&
19 | title === 'Docs') ||
20 | (location.pathname.includes('how-to-guides') &&
21 | title === 'How-to Guides') ||
22 | (location.pathname.includes('tutorials') && title === 'Tutorials')
23 | ) {
24 | setIsCurrent(true)
25 | }
26 | }, [])
27 | return (
28 |
29 |
36 | {title}
37 |
38 |
39 | )
40 | }
41 |
--------------------------------------------------------------------------------
/src/components/DocsComponents/FastTrackPlayground.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | interface FastTrackPlaygroundProps {
4 | description: string
5 | playgroundLink: string
6 | header: string
7 | }
8 |
9 | export function FastTrackPlayground({
10 | header,
11 | description,
12 | playgroundLink,
13 | }: FastTrackPlaygroundProps) {
14 | return (
15 | <>
16 |
17 |
18 |
19 | {header}
20 |
21 |
22 |
35 |
36 | >
37 | )
38 | }
39 |
--------------------------------------------------------------------------------
/tailwind.config.js:
--------------------------------------------------------------------------------
1 | /* docs.substrate.io config */
2 |
3 | module.exports = {
4 | presets: [require('./tailwind-preset.js')],
5 | theme: {
6 | extend: {
7 | colors: {
8 | mdxYellow: {
9 | DEFAULT: '#FFEED6',
10 | dark: '#EEF300',
11 | },
12 | mdxGreen: {
13 | DEFAULT: '#D6FACA',
14 | dark: '#D4F9EC',
15 | },
16 | mdxRed: {
17 | DEFAULT: '#FFE1D9',
18 | dark: '#F2606A',
19 | },
20 | mdxLightBg: '#FAFBFC',
21 | substrateDarkThemeGrey: '#3A424E',
22 | substrateGray: {
23 | darkest: '#21232d',
24 | },
25 | substrateGreen: {
26 | light: '#D4F9EC',
27 | light2: '#AEF3DC',
28 | dark: '#22B577',
29 | },
30 | substrateBlackish: '#242A35',
31 | substrateDarkest: '#181A22',
32 | substrateDarkThemeLightGrey: '#F8FAF9',
33 | substrateSubtleGrey: '#E0E0E0',
34 | substrateDarkThemeBlue: '#0094FF',
35 | polkaPink: '#E6007A',
36 | transparentWhite: 'rgba(255, 255, 255, 0.1)',
37 | transparentDarkest: 'rgba(24, 26, 34, 0.1)',
38 | },
39 | boxShadow: {
40 | xxl: '0 0 25px 0 rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.04)',
41 | },
42 | },
43 | },
44 | plugins: [],
45 | }
46 |
--------------------------------------------------------------------------------
/src/components/Layout.tsx:
--------------------------------------------------------------------------------
1 | import React, { useEffect } from 'react'
2 | import AOS from 'aos'
3 | import { MDXProvider } from '@mdx-js/react'
4 | import {
5 | Message,
6 | PreviousButton,
7 | NextButton,
8 | RelatedMaterialBlock,
9 | Objectives,
10 | TutorialObjective,
11 | RelevantSkills,
12 | SkillsYouGain,
13 | AccentButton,
14 | DarkButton,
15 | FastTrackPlayground,
16 | ExternalLink,
17 | MdxLink,
18 | } from './DocsComponents'
19 | import Header from './Header/Header'
20 | import Footer from './Footer'
21 | import Banner from './site/Banner'
22 |
23 | const components = {
24 | a: MdxLink,
25 | Message,
26 | PreviousButton,
27 | NextButton,
28 | RelatedMaterialBlock,
29 | Objectives,
30 | TutorialObjective,
31 | RelevantSkills,
32 | SkillsYouGain,
33 | AccentButton,
34 | DarkButton,
35 | FastTrackPlayground,
36 | ExternalLink,
37 | }
38 |
39 | const Layout = ({ children }: any) => {
40 | useEffect(() => {
41 | AOS.init({
42 | disable: 'mobile',
43 | duration: 600,
44 | })
45 | }, [])
46 |
47 | return (
48 |
49 |
50 |
51 |
52 | {children}
53 |
54 |
55 |
56 | )
57 | }
58 |
59 | export default Layout
60 |
--------------------------------------------------------------------------------
/src/components/Buttons/SecondaryButton.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import Link from '../Link'
3 |
4 | interface SecondaryButtonProps {
5 | link: string
6 | children: React.ReactNode
7 | external?: boolean
8 | cta?: boolean
9 | }
10 | export function SecondaryButton(props: SecondaryButtonProps) {
11 | const paddingSize = () => (props.cta ? `py-4 px-8` : `py-2 px-5`)
12 | const textSize = () => (props.cta ? `text-xl` : `text-lg`)
13 | return (
14 | <>
15 | {props.external ? (
16 |
17 |
20 |
21 | {props.children}
22 |
23 |
24 |
25 | ) : (
26 |
27 |
30 |
31 | {props.children}
32 |
33 |
34 |
35 | )}
36 | >
37 | )
38 | }
39 |
--------------------------------------------------------------------------------
/src/images/svgs/docs-nav-icon.svg:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/src/components/search-ui/SearchInput.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import Icon from '../Icon'
3 |
4 | interface SearchInputProps {
5 | query: string
6 | setQuery: (param: string) => void
7 | closeModal: (param: boolean) => void
8 | }
9 | export function SearchInput({ query, setQuery, closeModal }: SearchInputProps) {
10 | return (
11 |
12 |
13 |
17 | setQuery(e.target.value)}
23 | autoFocus
24 | />
25 |
26 |
closeModal(false)}
28 | className="flex items-center justify-center p-1 mb-2 rounded h-8 w-8 bg-substrateGray-light dark:bg-gray-700"
29 | >
30 |
34 |
35 |
36 | )
37 | }
38 |
--------------------------------------------------------------------------------
/src/styles/scss/_buttons.scss:
--------------------------------------------------------------------------------
1 | $substrateGreen: #24cc85;
2 | $button-radius: 5px;
3 |
4 | .primary {
5 | text-align: center;
6 | display: inline-block;
7 | position: relative;
8 | text-decoration: none;
9 | color: white;
10 | text-transform: capitalize;
11 | background-color: $substrateGreen;
12 | font: {
13 | family: 'Karla', sans-serif;
14 | weight: 700;
15 | size: 20px;
16 | }
17 | padding: 15px 0px;
18 | border-radius: $button-radius;
19 | overflow: hidden;
20 | overflow: hidden;
21 | text-overflow: ellipsis;
22 | white-space: nowrap;
23 | }
24 |
25 | .primary.small {
26 | width: 150px;
27 | }
28 |
29 | .primary.medium {
30 | width: 280px;
31 | }
32 |
33 | .primary.large {
34 | width: 340px;
35 | }
36 |
37 | .primary.xlarge {
38 | width: 420px;
39 | }
40 |
41 | .primary.effect {
42 | transition: all 0.2s linear 0s;
43 |
44 | &:before {
45 | content: '\2794';
46 | font-size: 14px;
47 | display: flex;
48 | align-items: center;
49 | justify-content: center;
50 | position: absolute;
51 | top: 0;
52 | right: -30px;
53 | width: 24px;
54 | height: 100%;
55 | background-color: #22b577;
56 | border-radius: 0px $button-radius $button-radius 0px;
57 | transition: all 0.2s linear 0s;
58 | text-align: center;
59 | }
60 |
61 | &:hover {
62 | text-indent: -30px;
63 |
64 | &:before {
65 | right: 0;
66 | text-indent: 0px;
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/src/components/Buttons/PrimaryButton.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import Link from '../Link'
3 |
4 | interface PrimaryButtonProps {
5 | link: string
6 | children: string
7 | external?: boolean
8 | cta?: boolean
9 | }
10 | export function PrimaryButton(props: PrimaryButtonProps) {
11 | const textSize = () => (props.cta ? `text-xl` : `text-lg`)
12 | const padding = () => (props.cta ? `py-3 px-8` : `py-1 px-7`)
13 | return (
14 | <>
15 | {props.external ? (
16 |
22 |
23 | {props.children}
24 |
25 |
26 | ) : (
27 |
31 |
32 | {props.children}
33 |
34 |
35 | )}
36 | >
37 | )
38 | }
39 |
--------------------------------------------------------------------------------
/src/styles/scss/_anchor_underline.scss:
--------------------------------------------------------------------------------
1 | // Footer Anchor Tags
2 | .underline-anchor a {
3 | position: relative;
4 | color: white;
5 | text-decoration: none;
6 | }
7 |
8 | .underline-anchor a:hover {
9 | color: white;
10 | }
11 |
12 | .underline-anchor a::before {
13 | content: '';
14 | position: absolute;
15 | display: block;
16 | width: 100%;
17 | height: 1px;
18 | bottom: 0;
19 | left: 0;
20 | background-color: white;
21 | transform: scaleX(0);
22 | transform-origin: top left;
23 | transition: transform 0.3s ease;
24 | }
25 |
26 | .underline-anchor a:hover::before {
27 | transform: scaleX(1);
28 | }
29 |
30 |
31 | // Markdown Anchor Tags
32 | .mdx-anchor a {
33 | position: relative;
34 | @apply text-substrateBlue dark:text-substrateBlue-light;
35 | text-decoration: none;
36 | }
37 |
38 | .mdx-anchor a:hover {
39 | @apply text-substrateBlue dark:text-substrateBlue-light;
40 | }
41 |
42 | .mdx-anchor a::before {
43 | content: '';
44 | position: absolute;
45 | display: block;
46 | width: 100%;
47 | height: 1px;
48 | bottom: 0;
49 | left: 0;
50 | @apply bg-substrateBlue dark:bg-substrateBlue-light;
51 | transform: scaleX(0);
52 | transform-origin: top left;
53 | transition: transform 0.3s ease;
54 | }
55 |
56 | .mdx-anchor a.md-button:hover::before {
57 | transform: scaleX(0);
58 | }
59 | .mdx-anchor a.anchor:hover::before {
60 | transform: scaleX(0);
61 | }
62 | .mdx-anchor a:hover::before {
63 | transform: scaleX(1);
64 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 |
8 | # Runtime data
9 | pids
10 | *.pid
11 | *.seed
12 | *.pid.lock
13 |
14 | # Directory for instrumented libs generated by jscoverage/JSCover
15 | lib-cov
16 |
17 | # Coverage directory used by tools like istanbul
18 | coverage
19 |
20 | # nyc test coverage
21 | .nyc_output
22 |
23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
24 | .grunt
25 |
26 | # Bower dependency directory (https://bower.io/)
27 | bower_components
28 |
29 | # node-waf configuration
30 | .lock-wscript
31 |
32 | # Compiled binary addons (http://nodejs.org/api/addons.html)
33 | build/Release
34 |
35 | # Dependency directories
36 | node_modules/
37 | jspm_packages/
38 |
39 | # Typescript v1 declaration files
40 | typings/
41 |
42 | # Optional npm cache directory
43 | .npm
44 |
45 | # Optional eslint cache
46 | .eslintcache
47 |
48 | # Optional REPL history
49 | .node_repl_history
50 |
51 | # Output of 'npm pack'
52 | *.tgz
53 |
54 | # dotenv environment variable files
55 | .env*
56 |
57 | # gatsby files
58 | .cache/
59 | public
60 |
61 | # Mac files
62 | .DS_Store
63 |
64 | # Yarn, not using zero-installs
65 | # ref: https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
66 | yarn-error.log
67 | .pnp/
68 | .pnp.*
69 | .yarn/*
70 | !.yarn/patches
71 | !.yarn/plugins
72 | !.yarn/releases
73 | !.yarn/sdks
74 | !.yarn/versions
75 | # Yarn Integrity file
76 | .yarn-integrity
77 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | parser: '@typescript-eslint/parser',
3 | extends: [
4 | 'eslint:recommended',
5 | 'plugin:react/recommended',
6 | 'plugin:@typescript-eslint/recommended',
7 | 'plugin:prettier/recommended',
8 | 'prettier',
9 | // Those are some additional security-related lints.
10 | // There's a chance those will introduce some false positives to our CI,
11 | // but the stakes are rather high here, so better safe than sorry
12 | 'plugin:security/recommended',
13 | ],
14 | settings: {
15 | react: {
16 | version: 'detect',
17 | },
18 | },
19 | env: {
20 | browser: true,
21 | node: true,
22 | es6: true,
23 | },
24 | plugins: ['@typescript-eslint', 'react', 'prettier'],
25 | parserOptions: {
26 | ecmaFeatures: {
27 | jsx: true,
28 | },
29 | ecmaVersion: 2018,
30 | sourceType: 'module',
31 | },
32 | rules: {
33 | // Disable prop-types as we use TypeScript for type checking
34 | 'react/prop-types': 'off',
35 | '@typescript-eslint/explicit-function-return-type': 'off',
36 | '@typescript-eslint/explicit-module-boundary-types': 'off',
37 | // Enable prettier rules
38 | 'prettier/prettier': 'error',
39 | // interface start with capital I
40 | '@typescript-eslint/interface-name-prefix': 'off',
41 | // allow "any" as type
42 | '@typescript-eslint/no-explicit-any': 'off',
43 | // allow @ts-ignore for testing purposes
44 | '@typescript-eslint/ban-ts-ignore': 'off',
45 | },
46 | }
47 |
--------------------------------------------------------------------------------
/static/assets/tutorials/ink-workshop/1.4-finished-code.rs:
--------------------------------------------------------------------------------
1 |
2 | #![cfg_attr(not(feature = "std"), no_std)]
3 |
4 | use ink_lang as ink;
5 |
6 | #[ink::contract]
7 | mod incrementer {
8 |
9 | #[ink(storage)]
10 | pub struct Incrementer {
11 | value: i32,
12 | }
13 |
14 | impl Incrementer {
15 | #[ink(constructor)]
16 | pub fn new(init_value: i32) -> Self {
17 | Self {
18 | value: init_value,
19 | }
20 | }
21 |
22 | #[ink(constructor)]
23 | pub fn default() -> Self {
24 | Self {
25 | value: 0,
26 | }
27 | }
28 |
29 | #[ink(message)]
30 | pub fn get(&self) -> i32 {
31 | self.value
32 | }
33 |
34 | #[ink(message)]
35 | pub fn inc(&mut self, by: i32) {
36 | self.value += by;
37 | }
38 | }
39 |
40 | #[cfg(test)]
41 | mod tests {
42 | use super::*;
43 | use ink_lang as ink;
44 |
45 | #[ink::test]
46 | fn default_works() {
47 | let contract = Incrementer::default();
48 | assert_eq!(contract.get(), 0);
49 | }
50 |
51 | #[ink::test]
52 | fn it_works() {
53 | let mut contract = Incrementer::new(42);
54 | assert_eq!(contract.get(), 42);
55 | contract.inc(5);
56 | assert_eq!(contract.get(), 47);
57 | contract.inc(-50);
58 | assert_eq!(contract.get(), -3);
59 | }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/static/assets/tutorials/ink-workshop/1.4-template.rs:
--------------------------------------------------------------------------------
1 |
2 | #![cfg_attr(not(feature = "std"), no_std)]
3 |
4 | use ink_lang as ink;
5 |
6 | #[ink::contract]
7 | mod incrementer {
8 |
9 | #[ink(storage)]
10 | pub struct Incrementer {
11 | value: i32,
12 | }
13 |
14 | impl Incrementer {
15 | #[ink(constructor)]
16 | pub fn new(init_value: i32) -> Self {
17 | Self {
18 | value: init_value,
19 | }
20 | }
21 |
22 | #[ink(constructor)]
23 | pub fn default() -> Self {
24 | Self {
25 | value: 0,
26 | }
27 | }
28 |
29 | #[ink(message)]
30 | pub fn get(&self) -> i32 {
31 | self.value
32 | }
33 |
34 | #[ink(message)]
35 | pub fn inc(&mut self, by: i32) {
36 | // ACTION: Simply increment `value` by `by`
37 | }
38 | }
39 |
40 | #[cfg(test)]
41 | mod tests {
42 | use super::*;
43 | use ink_lang as ink;
44 |
45 | #[ink::test]
46 | fn default_works() {
47 | let contract = Incrementer::default();
48 | assert_eq!(contract.get(), 0);
49 | }
50 |
51 | #[ink::test]
52 | fn it_works() {
53 | let mut contract = Incrementer::new(42);
54 | assert_eq!(contract.get(), 42);
55 | contract.inc(5);
56 | assert_eq!(contract.get(), 47);
57 | contract.inc(-50);
58 | assert_eq!(contract.get(), -3);
59 | }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/.github/workflows/check-links.yml:
--------------------------------------------------------------------------------
1 | name: Check Links
2 |
3 | on:
4 | pull_request:
5 | # With this setting, when we open a PR to `main` and `develop, it will run the linkchecking.
6 | # This also includes every commit to an open PR to `main` and `develop`.
7 | # ref:
8 | # - https://github.com/open-telemetry/opentelemetry-python/issues/1370
9 | # - https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#pull_request
10 | branches: [ main, develop ]
11 |
12 | jobs:
13 | build-website-image:
14 | runs-on: ubuntu-latest
15 | environment: test
16 | steps:
17 | - name: Docker Login
18 | uses: docker/login-action@v1.10.0
19 | with:
20 | username: ${{ secrets.DOCKERHUB_USER }}
21 | password: ${{ secrets.DOCKERHUB_TOKEN }}
22 | - name: Checkout repo
23 | uses: actions/checkout@v2
24 | - name: Build & push image
25 | run: |
26 | docker build -t paritytechno/substrate-docs .
27 | docker push paritytechno/substrate-docs
28 |
29 | check-links:
30 | needs: build-website-image
31 | runs-on: ubuntu-latest
32 | environment: test
33 | services:
34 | gatsby-app:
35 | image: paritytechno/substrate-docs
36 | ports:
37 | - 9000:9000
38 | steps:
39 | - name: Checkout repo
40 | uses: actions/checkout@v2
41 | - name: Take a 6s nap to ensure gatsby-app ready
42 | run: sleep 6
43 | - name: Run `broken-link-check`
44 | run: |
45 | yarn install
46 | yarn checklinks
47 |
--------------------------------------------------------------------------------
/src/components/Buttons/PrimaryFixedButton.tsx:
--------------------------------------------------------------------------------
1 | import cx from 'classnames'
2 | import React from 'react'
3 | import Link from '../Link'
4 | import Icon from '../../components/Icon'
5 |
6 | interface PrimaryFixedButtonProps {
7 | children: React.ReactNode
8 | link?: string
9 | fullWidth?: boolean
10 | onClick?: any
11 | hero?: boolean
12 | }
13 |
14 | export function PrimaryFixedButton({
15 | children,
16 | link,
17 | fullWidth = false,
18 | onClick,
19 | hero = false,
20 | }: PrimaryFixedButtonProps) {
21 | return (
22 |
23 |
32 |
38 | {children}
39 |
40 |
49 |
50 |
51 |
52 |
53 | )
54 | }
55 |
--------------------------------------------------------------------------------
/src/styles/tailwind-preset.css:
--------------------------------------------------------------------------------
1 | html {
2 | @apply bg-white antialiased font-body;
3 | }
4 |
5 | body {
6 | @apply bg-white text-substrateDark dark:text-white text-base;
7 | background: transparent;
8 | }
9 |
10 | html.dark,
11 | body.dark {
12 | @apply bg-darkBackground;
13 | }
14 |
15 | main.main-container {
16 | min-height: calc(100vh - 394px);
17 | }
18 |
19 | /* Headings */
20 | h1,
21 | h2,
22 | h3,
23 | h4,
24 | h5,
25 | h6 {
26 | @apply font-body font-bold;
27 | }
28 |
29 | h1,
30 | .h1 {
31 | @apply font-body font-extrabold mb-3 text-2xl md:text-4xl xl:text-6xl;
32 | line-height: 1.2;
33 | }
34 |
35 | h2,
36 | .h2 {
37 | @apply mb-4 text-4xl;
38 | }
39 |
40 | h3,
41 | .h3 {
42 | @apply mb-5 text-3xl;
43 | }
44 |
45 | h4,
46 | .h4 {
47 | @apply mb-6 text-lg md:text-2xl;
48 | }
49 |
50 | h5,
51 | .h5 {
52 | @apply text-xl;
53 | }
54 |
55 | h6 {
56 | @apply mb-10 text-lg;
57 | }
58 |
59 | /* Paragraphs */
60 | p {
61 | @apply mb-6 font-normal;
62 | }
63 |
64 | strong {
65 | @apply font-medium;
66 | }
67 |
68 | /* Blockquotes */
69 | blockquote {
70 | @apply mb-4 px-8 font-body italic text-xl;
71 | }
72 |
73 | /* Horizontal Rules */
74 | hr {
75 | @apply mb-6 border-t dark:border-gray-700;
76 | }
77 |
78 | /* Lists */
79 | dl,
80 | ol,
81 | ul {
82 | @apply mb-0 ml-2 list-outside;
83 | }
84 |
85 | li {
86 | @apply mb-1 font-normal;
87 | }
88 |
89 | /* Definition Lists */
90 | dl {
91 | dt {
92 | @apply font-semibold;
93 | }
94 |
95 | dd {
96 | @apply ml-6;
97 | }
98 | }
99 |
100 | /* Ordered Lists */
101 | ol {
102 | @apply list-decimal;
103 | }
104 |
105 | /* Unordered Lists */
106 | ul {
107 | @apply list-disc;
108 | }
109 |
--------------------------------------------------------------------------------
/static/assets/contribute-templates/how-to-template.md:
--------------------------------------------------------------------------------
1 | # Guide title [answers "How do I ...?]
2 |
3 | Replace this paragraph with an overview that provides a brief summary of what this guide is about and why it's useful.
4 | The overview section can be more than one paragraph. It does not require any heading before the text.
5 |
6 | ## Use cases [optional - if it is redundant, leave it out]
7 |
8 | Remove this section if it repeats the guide title or information covered in the overview section. Include this section if it adds value. For example, if a single use case requires more explanation that provided in the guide title or in the overview, use this section to provide the more detailed explanation.
9 |
10 | ## Before you begin [required if there are prerequisites]
11 |
12 | Replace this template content with an introductory sentence and list of prerequisites similar to the following.
13 |
14 | Before you begin, verify the following requirements:
15 |
16 | - What should someone **have** before reading this article?
17 |
18 | - What should someone **know** before reading this article?
19 |
20 | - What should someone **do** before reading this article?
21 |
22 | ## Steps [use a more descriptive heading as needed]
23 |
24 | Replace this paragraph with at least one introductory sentence and provide a stem clause that leads into the first step. For example, use the following this pattern.
25 |
26 | To submit an article:
27 |
28 | 1. Open ...
29 |
30 | ## Examples [required - link to at least one example]
31 |
32 | Replace this paragraph with an introductory sentence followed by a link to at least one working example that corresponds with the information covered in this guide.
33 |
34 | ## Related resources [optional - add links as needed]
35 |
36 | Replace this paragraph with a list of links to other materials.
37 |
--------------------------------------------------------------------------------
/static/assets/tutorials/cumulus/polkadot-launch-config/relay-3-validators--2paras-1collator.json:
--------------------------------------------------------------------------------
1 | {
2 | "relaychain": {
3 | "bin": "./bin/polkadot",
4 | "chain": "rococo-local",
5 | "nodes": [
6 | {
7 | "name": "alice",
8 | "wsPort": 9944,
9 | "port": 30444
10 | },
11 | {
12 | "name": "bob",
13 | "wsPort": 9955,
14 | "port": 30555
15 | },
16 | {
17 | "name": "charlie",
18 | "wsPort": 9966,
19 | "port": 30666
20 | }
21 | ],
22 | "genesis": {
23 | "runtime": {
24 | "runtime_genesis_config": {
25 | "parachainsConfiguration": {
26 | "config": {
27 | "validation_upgrade_frequency": 1,
28 | "validation_upgrade_delay": 1
29 | }
30 | }
31 | }
32 | }
33 | }
34 | },
35 | "parachains": [
36 | {
37 | "bin": "./bin/polkadot-collator",
38 | "id": "2000",
39 | "balance": "1000000000000000000000",
40 | "nodes": [
41 | {
42 | "wsPort": 9988,
43 | "port": 31200,
44 | "name": "alice",
45 | "flags": ["--", "--execution=wasm"]
46 | }
47 | ]
48 | },
49 | {
50 | "bin": "./bin/polkadot-collator",
51 | "id": "3000",
52 | "balance": "1000000000000000000000",
53 | "nodes": [
54 | {
55 | "wsPort": 9999,
56 | "port": 31300,
57 | "name": "alice",
58 | "flags": ["--", "--execution=wasm"]
59 | }
60 | ]
61 | }
62 | ],
63 | "hrmpChannels": [
64 | {
65 | "sender": 2000,
66 | "recipient": 3000,
67 | "maxCapacity": 8,
68 | "maxMessageSize": 512
69 | }
70 | ],
71 | "types": {},
72 | "finalization": false
73 | }
74 |
--------------------------------------------------------------------------------
/src/components/DocsComponents/BottomButtons.tsx:
--------------------------------------------------------------------------------
1 | import React, { useState, useEffect } from 'react'
2 | import { PreviousButton, NextButton } from '../DocsComponents'
3 |
4 | interface BottomButtonsProps {
5 | menu: { name: string; items: { title: string; link: string }[] }[]
6 | pageSlug: string
7 | }
8 | interface buttonProps {
9 | title: string
10 | link: string
11 | }
12 |
13 | export function BottomButtons({ menu, pageSlug }: BottomButtonsProps) {
14 | const [nextButton, setNextButton] = useState()
15 | const [prevButton, setPrevButton] = useState()
16 | useEffect(() => {
17 | const pages: { title: string; link: string }[] = []
18 | menu.forEach(menuItems => {
19 | menuItems.items.forEach(item => {
20 | if (!item.link.includes('#')) {
21 | pages.push(item)
22 | }
23 | })
24 | })
25 | pages.map((cur, index) => {
26 | if (cur.link === `${pageSlug}/`) {
27 | if (index === 0) {
28 | setNextButton(pages[index + 1])
29 | setPrevButton(null)
30 | } else if (index === pages.length - 1) {
31 | setPrevButton(pages[index - 1])
32 | setNextButton(null)
33 | } else {
34 | setNextButton(pages[index + 1])
35 | setPrevButton(pages[index - 1])
36 | }
37 | }
38 | })
39 | }, [])
40 | return (
41 |
46 | {prevButton && (
47 |
48 | )}
49 | {nextButton && (
50 |
51 | )}
52 |
53 | )
54 | }
55 |
--------------------------------------------------------------------------------
/src/images/svgs/grants-dollar.svg:
--------------------------------------------------------------------------------
1 |
7 |
8 |
--------------------------------------------------------------------------------
/lunr/create-index.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable @typescript-eslint/no-var-requires */
2 | /* eslint-disable security/detect-non-literal-require */
3 |
4 | const lunr = require('lunr')
5 | const remark = require('remark')
6 | const strip = require('strip-markdown')
7 |
8 | const createIndexLunr = async (docNodes, cache) => {
9 | const cacheKey = `IndexLunr`
10 | const cached = await cache.get(cacheKey)
11 | if (cached) {
12 | return cached
13 | }
14 | const documents = []
15 | const store = {}
16 |
17 | for (const node of docNodes) {
18 | const slug = node.frontmatter.slug
19 | const section = node.frontmatter.section
20 | const category = node.frontmatter.category
21 | const title = node.frontmatter.title
22 | const keywords = node.frontmatter.keywords
23 |
24 | var body
25 | remark()
26 | .use(strip)
27 | .process(node.rawBody, function (err, file) {
28 | if (err) throw err
29 | body = file
30 | })
31 | documents.push({
32 | slug: slug,
33 | title: title,
34 | section: section,
35 | category: category,
36 | keywords: keywords,
37 | content: body,
38 | })
39 | // eslint-disable-next-line security/detect-object-injection
40 | store[slug] = {
41 | title,
42 | section,
43 | category,
44 | keywords,
45 | }
46 | }
47 | const index = lunr(function () {
48 | console.log('Updating Lunr Search Index')
49 | this.ref(`slug`)
50 | this.field(`title`)
51 | this.field(`section`)
52 | this.field(`category`)
53 | this.field(`keywords`)
54 | this.field(`content`)
55 |
56 | for (const doc of documents) {
57 | this.add(doc)
58 | }
59 | })
60 | const json = { index: index.toJSON(), store }
61 | await cache.set(cacheKey, json)
62 | return json
63 | }
64 |
65 | module.exports = {
66 | createIndexLunr,
67 | }
68 |
--------------------------------------------------------------------------------
/src/components/Buttons/TextButton.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import Link from '../Link'
3 | import Icon from '../Icon'
4 |
5 | interface TextButtonProps {
6 | link: string
7 | children: string
8 | className?: string
9 | accent?: boolean
10 | cta?: boolean
11 | external?: boolean
12 | }
13 |
14 | export function TextButton(props: TextButtonProps) {
15 | const textSize = () => (props.cta ? 'text-xl' : 'text-lg')
16 | const accentStyle = () =>
17 | props.accent
18 | ? `text-substrateGreen dark:text-substrateGreen border-substrateGreen`
19 | : `border-substrateDark dark:border-white`
20 | return (
21 | <>
22 | {props.external ? (
23 |
37 | ) : (
38 |
39 |
40 |
43 | {props.children}
44 |
{' '}
45 |
48 |
49 |
50 |
51 |
52 | )}
53 | >
54 | )
55 | }
56 |
--------------------------------------------------------------------------------
/src/components/search-ui/SearchSectionLabel.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | interface LabelProps {
4 | index: number
5 | section: {
6 | docs: boolean
7 | tuts: boolean
8 | htgs: boolean
9 | }
10 | setSection: any
11 | children: React.ReactNode
12 | prevState?: {
13 | docs: boolean
14 | tuts: boolean
15 | htgs: boolean
16 | }
17 | }
18 |
19 | export function SearchSectionLabel({
20 | index,
21 | section,
22 | setSection,
23 | children,
24 | }: LabelProps) {
25 | const handleChange = () => {
26 | if (index === 0) {
27 | setSection((prevState: LabelProps) => ({
28 | ...prevState,
29 | docs: !section.docs,
30 | }))
31 | } else if (index === 1) {
32 | setSection((prevState: LabelProps) => ({
33 | ...prevState,
34 | tuts: !section.tuts,
35 | }))
36 | } else if (index === 2) {
37 | setSection((prevState: LabelProps) => ({
38 | ...prevState,
39 | htgs: !section.htgs,
40 | }))
41 | }
42 | }
43 | const checked = () => {
44 | if (index === 0) {
45 | return section.docs
46 | } else if (index === 1) {
47 | return section.tuts
48 | } else if (index === 2) {
49 | return section.htgs
50 | }
51 | }
52 | return (
53 | <>
54 |
59 | handleChange()}
64 | />
65 |
66 | {children}
67 |
68 |
69 | >
70 | )
71 | }
72 |
--------------------------------------------------------------------------------
/src/components/layout/homepage/DocCard.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import cx from 'classnames'
3 | import Link from '../../Link'
4 | import Icon from '../../Icon'
5 |
6 | interface DocCardProps {
7 | title: string
8 | text: string
9 | link: string
10 | cta: string
11 | iconName: string
12 | animationDelay?: number
13 | }
14 |
15 | export default function DocCard({
16 | title,
17 | text,
18 | link,
19 | cta,
20 | iconName,
21 | animationDelay,
22 | }: DocCardProps) {
23 | return (
24 |
25 |
32 |
33 |
37 |
38 |
39 |
{title}
40 |
{text}
41 |
42 |
43 |
46 | {cta}
47 |
48 |
54 | ➔
55 |
56 |
57 |
58 |
59 | )
60 | }
61 |
--------------------------------------------------------------------------------
/src/components/DocTag.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | interface DocTagProps {
4 | difficulty: number
5 | duration?: string
6 | }
7 |
8 | export default function DocTag(props: DocTagProps) {
9 | return (
10 | <>
11 |
12 |
13 | {props.difficulty === 1
14 | ? 'Beginner'
15 | : props.difficulty === 2
16 | ? 'Intermediate'
17 | : props.difficulty === 3
18 | ? 'Advanced'
19 | : null}
20 |
21 | {props.duration && (
22 |
23 |
30 |
31 |
32 | {props.duration}
33 |
34 | )}
35 |
36 | >
37 | )
38 | }
39 |
--------------------------------------------------------------------------------
/static/assets/tutorials/ink-workshop/2.1-finished-code.rs:
--------------------------------------------------------------------------------
1 | #![cfg_attr(not(feature = "std"), no_std)]
2 |
3 | use ink_lang as ink;
4 |
5 | #[ink::contract]
6 | mod erc20 {
7 | #[cfg(not(feature = "ink-as-dependency"))]
8 | #[ink(storage)]
9 | pub struct Erc20 {
10 | /// The total supply.
11 | total_supply: Balance,
12 | /// The balance of each user.
13 | balances: ink_storage::collections::HashMap,
14 | }
15 |
16 | impl Erc20 {
17 | #[ink(constructor)]
18 | pub fn new(initial_supply: Balance) -> Self {
19 | let mut balances = ink_storage::collections::HashMap::new();
20 | balances.insert(Self::env().caller(), initial_supply);
21 | Self {
22 | total_supply: initial_supply,
23 | balances
24 | }
25 | }
26 |
27 | #[ink(message)]
28 | pub fn total_supply(&self) -> Balance {
29 | self.total_supply
30 | }
31 |
32 | #[ink(message)]
33 | pub fn balance_of(&self, owner: AccountId) -> Balance {
34 | self.balance_of_or_zero(&owner)
35 | }
36 |
37 | fn balance_of_or_zero(&self, owner: &AccountId) -> Balance {
38 | *self.balances.get(owner).unwrap_or(&0)
39 | }
40 | }
41 |
42 | #[cfg(test)]
43 | mod tests {
44 | use super::*;
45 |
46 | use ink_lang as ink;
47 |
48 | #[ink::test]
49 | fn new_works() {
50 | let contract = Erc20::new(777);
51 | assert_eq!(contract.total_supply(), 777);
52 | }
53 |
54 | #[ink::test]
55 | fn balance_works() {
56 | let contract = Erc20::new(100);
57 | assert_eq!(contract.total_supply(), 100);
58 | assert_eq!(contract.balance_of(AccountId::from([0x1; 32])), 100);
59 | assert_eq!(contract.balance_of(AccountId::from([0x0; 32])), 0);
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/styles/language-tabs.css:
--------------------------------------------------------------------------------
1 | .gatsby-highlight {
2 | position: relative;
3 | -webkit-overflow-scrolling: touch;
4 | }
5 |
6 | .gatsby-highlight pre {
7 | background-color: #eef1fe;
8 | }
9 |
10 | .gatsby-highlight pre[class*='language-'] {
11 | -webkit-overflow-scrolling: touch;
12 | padding: 2rem 1rem;
13 | border-radius: 0.25rem;
14 | }
15 |
16 | .gatsby-highlight pre[class*='language-']::before {
17 | background: #eef1fe;
18 | border-radius: 0 0 0.25rem 0.25rem;
19 | color: black;
20 | font-family: 'Karla', 'sans-serif';
21 | font-size: 10px;
22 | letter-spacing: 0.025rem;
23 | padding: 0.01rem 0.5rem;
24 | position: absolute;
25 | right: 16px;
26 | text-align: right;
27 | text-transform: uppercase;
28 | top: 0;
29 | }
30 |
31 | .gatsby-highlight pre[class~='language-javascript']::before {
32 | content: 'js';
33 | background: #eef1fe;
34 | color: black;
35 | }
36 |
37 | .gatsby-highlight pre[class~='language-js']::before {
38 | content: 'js';
39 | background: #eef1fe;
40 | color: black;
41 | }
42 |
43 | .gatsby-highlight pre[class~='language-html']::before {
44 | content: 'html';
45 | background: white;
46 | color: #eef1fe;
47 | }
48 |
49 | .gatsby-highlight pre[class~='language-css']::before {
50 | content: 'css';
51 | background: #eef1fe;
52 | color: white;
53 | }
54 |
55 | .gatsby-highlight pre[class~='language-rust']::before {
56 | content: 'rust';
57 | background: #eef1fe;
58 | color: black;
59 | }
60 |
61 | .gatsby-highlight pre[class~='language-json']::before {
62 | content: 'JSON';
63 | background: #eef1fe;
64 | color: black;
65 | }
66 |
67 | .gatsby-highlight pre[class~='language-bash']::before {
68 | content: 'bash';
69 | background: #eef1fe;
70 | color: black;
71 | }
72 |
73 | .gatsby-highlight pre[class~='language-powershell']::before {
74 | content: 'PowerShell';
75 | background: #eef1fe;
76 | color: black;
77 | }
--------------------------------------------------------------------------------
/src/styles/tailwind-custom.css:
--------------------------------------------------------------------------------
1 | /* project specific tailwind styles */
2 |
3 | @layer utilities {
4 | @variants responsive {
5 | .text-shadow {
6 | text-shadow: 1px 0px 0px #242a35;
7 | }
8 | .text-shadow-md {
9 | text-shadow: 4px 4px 8px #242a35;
10 | }
11 | .text-shadow-lg {
12 | text-shadow: 15px 15px 30px #242a35;
13 | }
14 | .text-shadow-none {
15 | text-shadow: none;
16 | }
17 | }
18 | }
19 | /* 404 title */
20 |
21 | @supports (-webkit-text-stroke: 1px black) {
22 | .four-oh-four-title {
23 | @apply font-extrabold;
24 | -webkit-text-stroke: 2px #24cc85;
25 | -webkit-text-fill-color: transparent;
26 | }
27 | }
28 |
29 | /* Scroll Margin top 100px */
30 | @layer utilities {
31 | @variants responsive {
32 | .scroll-margin-top-100 {
33 | scroll-margin-top: 100px;
34 | }
35 | }
36 | }
37 |
38 | /* utils */
39 |
40 | .-mt-36-px {
41 | margin-top: calc(-9rem - 1px);
42 | }
43 |
44 | .border-3 {
45 | border-width: 3px;
46 | }
47 |
48 | /* Links underline animation */
49 | .underline-animate a {
50 | @apply text-substrateBlue dark:text-substrateDarkThemeBlue;
51 | display: inline-block;
52 | position: relative;
53 | }
54 |
55 | .underline-animate a::after {
56 | background: none repeat scroll 0 0 transparent;
57 | bottom: 0;
58 | content: '';
59 | display: block;
60 | height: 2px;
61 | left: 0;
62 | position: absolute;
63 | @apply bg-substrateBlue dark:text-substrateDarkThemeBlue;
64 | transition: width 0.3s ease 0s, left 0.3s ease 0s;
65 | width: 0;
66 | }
67 |
68 | .underline-animate a:hover::after {
69 | width: 100%;
70 | left: 0;
71 | }
72 |
73 | /* Thinner underline animation */
74 |
75 | .underline-animate-thin a::after {
76 | height: 1px;
77 | }
78 |
79 | /* Banner */
80 |
81 | .banner p {
82 | @apply mb-0;
83 | }
84 |
85 | .banner strong {
86 | @apply font-bold;
87 | }
88 |
89 | .banner a {
90 | @apply text-substrateDarkThemeBlue dark:text-substrateBlue;
91 | }
92 |
--------------------------------------------------------------------------------
/v3/how-to-guides/05-storage-migrations/b-steps-with-polkadotjs-apps/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Trigger a Migration
3 | slug: /how-to-guides/v3/storage-migrations/trigger-with-apps
4 | keywords:
5 | - storage migration
6 | - runtime
7 | - advanced
8 | version: '3.0'
9 | section: how to guides
10 | category: storage migrations
11 | ---
12 |
13 |
31 |
32 | ## Steps
33 |
34 | ### 1. Add custom types
35 |
36 | In the Polkadot-js apps UI, go to `Settings > Developer` to add your custom types from `types.json`. You can either upload the file directly or paste the types right into the UI. Save it to add them.
37 |
38 | ### 2. Upload your runtime
39 |
40 | In `Developer > Sudo`, make a `system.setCode` call by uploading your runtime (for example, `./target/release/wbuild/node-template-runtime/node_template_runtime.compact.wasm`).
41 |
42 | Check the _"with weight override"_ toggle to ignore block weights and set it to some arbitrary value.
43 |
44 | ### 3. Trigger the call
45 |
46 | Hit _"Submit Sudo Unchecked"_ and sign the transaction to trigger the call.
47 |
48 | ## Examples
49 |
50 | - [Migrating the Nicks pallet](https://github.com/substrate-developer-hub/migration-example/pull/2/files) example
51 |
52 | ## Resources
53 |
54 | #### Other
55 |
56 | - [Polkadot JS documentation](https://polkadot.js.org/docs/)
57 | - Hosted [Polkadot-JS Apps UI](https://polkadot.js.org/apps/)
58 |
--------------------------------------------------------------------------------
/src/components/MobileMenus/MobileDropDown.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import cx from 'classnames'
3 | import useComponentVisible from '../Hooks/use-component-visible'
4 | import Link from '../Link'
5 |
6 | interface MobileDropDownProps {
7 | external: boolean
8 | title: string
9 | items: { linkTitle: string; link: string; external: boolean }[]
10 | }
11 |
12 | export default function MobileDropDown({ title, items }: MobileDropDownProps) {
13 | const { isComponentVisible, setIsComponentVisible } =
14 | useComponentVisible(false)
15 | return (
16 |
17 |
setIsComponentVisible(!isComponentVisible)}
19 | className={`px-6 py-3 hover:font-bold text-black dark:text-white cursor-pointer ${
20 | isComponentVisible ? 'font-bold' : 'font-medium'
21 | }`}
22 | >
23 |
24 |
{title}
25 |
35 |
36 |
37 |
38 |
39 | {isComponentVisible ? (
40 | <>
41 | {items.map((each, index) => {
42 | const itemStyles =
43 | 'block font-medium hover:font-bold pl-12 mb-0 py-3'
44 | return (
45 |
46 |
{each.linkTitle}
47 |
48 | )
49 | })}
50 | >
51 | ) : null}
52 |
53 | )
54 | }
55 |
--------------------------------------------------------------------------------
/src/components/VersionControl.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | // import { Link } from '../components/Link'
3 | // import useComponentVisible from './Hooks/use-component-visible'
4 | import GithubEditButton from './GithubEditButton'
5 | import Icon from '../components/Icon'
6 |
7 | interface VersionControlProps {
8 | version: string
9 | slug: string
10 | absolutePath: string
11 | }
12 | export default function VersionControl({
13 | version,
14 | absolutePath,
15 | }: VersionControlProps) {
16 | // const { ref, isComponentVisible, setIsComponentVisible } =
17 | // useComponentVisible(false)
18 | // const [pathName, setPathName] = useState('')
19 | // useEffect(() => {
20 | // const str = location.pathname.substr(location.pathname.indexOf('v') + 2)
21 | // setPathName(str)
22 | // })
23 | return (
24 |
25 |
setIsComponentVisible(!isComponentVisible)}
27 | className="relative flex items-center justify-end text-sm font-medium"
28 | >
29 |
30 |
{`Version ${version}`}
31 | {/* {isComponentVisible && (
32 |
33 |
34 |
35 |
36 | Version 3.0
37 |
38 |
39 |
40 |
41 | Version 4.0
42 |
43 |
44 |
45 |
46 | )} */}
47 |
48 |
49 |
50 | )
51 | }
52 |
--------------------------------------------------------------------------------
/gatsby-browser.js:
--------------------------------------------------------------------------------
1 | import './src/styles/global.css'
2 | import './src/styles/language-tabs.css'
3 | import './src/styles/markdown.css'
4 | import './src/styles/scss/styles.scss'
5 |
6 | import React from 'react'
7 | import { MDXProvider } from '@mdx-js/react'
8 | import { preToCodeBlock } from 'mdx-utils'
9 | import Code from './src/components/Code'
10 |
11 | import { ThemeProvider } from './src/contexts/ThemeContext'
12 |
13 | const components = {
14 | pre: preProps => {
15 | const props = preToCodeBlock(preProps)
16 | if (props) {
17 | return
18 | }
19 | return
20 | },
21 | wrapper: ({ children }) => <>{children}>,
22 | }
23 |
24 | export const wrapRootElement = ({ element }) => (
25 | {element}
26 | )
27 |
28 | export const wrapPageElement = ({ element }) => (
29 | {element}
30 | )
31 |
32 | export const onRouteUpdate = ({ location }) => scrollToAnchor(location)
33 |
34 | /**
35 | *
36 | * @desc - a function to jump to the correct scroll position
37 | * @param {Object} location -
38 | * @param {Number} [mainNavHeight] - the height of any persistent nav -> document.querySelector(`nav`)
39 | */
40 | function scrollToAnchor(location, mainNavHeight = 100) {
41 | // Check for location so build does not fail
42 |
43 | if (location && location.hash) {
44 | // Fix scrolling for ids starting with numbers
45 | // https://stackoverflow.com/a/20306237/1268612
46 | const hash = location.hash.replace(/^#(\d)/, '#\\3$1')
47 | const item = document.querySelector(`${hash}`)
48 |
49 | if (item)
50 | window.scrollTo({
51 | top: item.offsetTop - mainNavHeight,
52 | behavior: 'instant',
53 | })
54 | }
55 |
56 | const bypassPages = ['/', '/tutorials/v3/', '/rustdocs/', '/playground/']
57 | if (location && !location.hash && bypassPages.includes(location.pathname)) {
58 | window.scrollTo(0, 0)
59 | }
60 |
61 | return true
62 | }
63 |
--------------------------------------------------------------------------------
/static/assets/tutorials/ink-workshop/2.1-template.rs:
--------------------------------------------------------------------------------
1 | #![cfg_attr(not(feature = "std"), no_std)]
2 |
3 | use ink_lang as ink;
4 |
5 | #[ink::contract]
6 | mod erc20 {
7 | #[cfg(not(feature = "ink-as-dependency"))]
8 | #[ink(storage)]
9 | pub struct Erc20 {
10 | /// The total supply.
11 | total_supply: Balance,
12 | /// The balance of each user.
13 | balances: ink_storage::collections::HashMap,
14 | }
15 |
16 | impl Erc20 {
17 | #[ink(constructor)]
18 | pub fn new(initial_supply: Balance) -> Self {
19 | // ACTION: `set` the total supply to `initial_supply`
20 | // ACTION: `insert` the `initial_supply` as the `caller` balance
21 | }
22 |
23 | #[ink(message)]
24 | pub fn total_supply(&self) -> Balance {
25 | // ACTION: Return the total supply
26 | }
27 |
28 | #[ink(message)]
29 | pub fn balance_of(&self, owner: AccountId) -> Balance {
30 | // ACTION: Return the balance of `owner`
31 | // HINT: Use `balance_of_or_zero` to get the `owner` balance
32 | }
33 |
34 | fn balance_of_or_zero(&self, owner: &AccountId) -> Balance {
35 | // ACTION: `get` the balance of `owner`, then `unwrap_or` fallback to 0
36 | // ACTION: Return the balance
37 | }
38 | }
39 |
40 | #[cfg(test)]
41 | mod tests {
42 | use super::*;
43 |
44 | use ink_lang as ink;
45 |
46 | #[ink::test]
47 | fn new_works() {
48 | let contract = Erc20::new(777);
49 | assert_eq!(contract.total_supply(), 777);
50 | }
51 |
52 | #[ink::test]
53 | fn balance_works() {
54 | let contract = Erc20::new(100);
55 | assert_eq!(contract.total_supply(), 100);
56 | assert_eq!(contract.balance_of(AccountId::from([0x1; 32])), 100);
57 | assert_eq!(contract.balance_of(AccountId::from([0x0; 32])), 0);
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/components/SlideDownNav.tsx:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react'
2 | import Link from './Link'
3 |
4 | interface SlideDownNavProps {
5 | section: { name: string; items: { title: string; link: string }[] }
6 | current: boolean
7 | pathname: string
8 | hashLink: string
9 | }
10 |
11 | export default function SlideDownNav({
12 | section,
13 | current,
14 | pathname,
15 | hashLink,
16 | }: SlideDownNavProps) {
17 | const [isOpen, setIsOpen] = useState(current)
18 |
19 | return (
20 | <>
21 | setIsOpen(!isOpen)}
23 | className="flex items-center justify-between px-4 sm:px-20 lg:px-4 py-3 bg-substrateGray-light lg:dark:bg-substrateDark dark:bg-darkBackground cursor-pointer"
24 | >
25 |
26 | {section.name}
27 |
28 |
38 |
39 |
40 |
41 |
42 | {isOpen &&
43 | section.items.map((item, index) => {
44 | const active = item.link === pathname || item.link === hashLink
45 | return (
46 |
47 |
52 | {item.title}
53 |
54 |
55 | )
56 | })}
57 |
58 | >
59 | )
60 | }
61 |
--------------------------------------------------------------------------------
/src/components/DifficultyMeter.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | interface DifficultyMeterProps {
4 | difficulty: number
5 | }
6 |
7 | export default function DifficultyMeter({ difficulty }: DifficultyMeterProps) {
8 | return (
9 | <>
10 | {difficulty === 1 ? (
11 | <>
12 | Beginner
13 |
14 |
15 |
16 |
17 |
18 | >
19 | ) : difficulty === 2 ? (
20 | <>
21 |
22 | Intermediate
23 |
24 |
25 |
26 |
27 |
28 |
29 | >
30 | ) : difficulty === 3 ? (
31 | <>
32 | Advance
33 |
34 |
35 |
36 |
37 |
38 | >
39 | ) : null}
40 | >
41 | )
42 | }
43 |
--------------------------------------------------------------------------------
/src/components/DocsComponents/Message.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import cx from 'classnames'
3 | import ReactMarkdown from 'react-markdown'
4 | import Icon from '../Icon'
5 | import { MdxLink } from '../DocsComponents'
6 |
7 | interface MessageProps {
8 | type: string
9 | title: string
10 | text: string
11 | }
12 |
13 | export function Message({ type, title, text }: MessageProps) {
14 | const iconStyles = 'fill-current text-substrateDark dark:text-substrateWhite'
15 | return (
16 |
29 |
30 |
31 | {type === 'yellow' || type === 'red' ? (
32 |
33 | ) : type === 'green' ? (
34 |
35 | ) : type === 'gray' ? (
36 |
37 | ) : null}
38 |
39 |
40 | {title}
41 |
42 |
43 |
44 |
49 | {text}
50 |
51 |
52 |
53 | )
54 | }
55 |
--------------------------------------------------------------------------------
/src/components/site/Banner.js:
--------------------------------------------------------------------------------
1 | import cx from 'classnames'
2 | import React, { Fragment } from 'react'
3 |
4 | import { useBanner } from '../../hooks/use-banner'
5 | import { useSessionStorage } from '../../hooks/use-session-storage'
6 | import Icon from '../Icon'
7 |
8 | const Banner = () => {
9 | const [isBannerOpen, setIsBannerOpen] = useSessionStorage('banner', true)
10 | const { banners } = useBanner()
11 | const hasActiveBanner = banners.length > 0
12 |
13 | return (
14 | <>
15 | {hasActiveBanner && isBannerOpen && (
16 |
21 | {banners.map(
22 | (
23 | {
24 | node: {
25 | html,
26 | frontmatter: { title },
27 | },
28 | },
29 | idx
30 | ) => (
31 |
32 | {idx > 0 && (
33 |
34 | )}
35 |
36 |
37 | {title}
38 |
39 |
43 |
44 |
45 | )
46 | )}
47 |
48 |
setIsBannerOpen(false)}
51 | >
52 |
53 |
54 |
55 | )}
56 | >
57 | )
58 | }
59 |
60 | export default Banner
61 |
--------------------------------------------------------------------------------
/v3/how-to-guides/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Substrate How-to Guides
3 | slug: /how-to-guides/v3
4 | version: '3.0'
5 | section: how to guides
6 | category: overview
7 | hideNav: true
8 | ---
9 |
10 | Substrate how-to guides are in-depth guides for developers with some prior knowledge of Substrate and a
11 | specific goal they want to achieve. Learn more about contributing to these guides [here](/v3/contribute/templates).
12 |
13 | ## Browse categories
14 |
15 |
21 |
26 |
31 |
36 |
41 |
46 |
51 |
56 |
--------------------------------------------------------------------------------
/src/components/DocsButton.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import Link from './Link'
3 |
4 | export default function DocsButton() {
5 | return (
6 |
7 |
8 |
15 |
16 |
17 |
18 |
23 |
24 | Docs
25 |
26 |
27 | )
28 | }
29 |
--------------------------------------------------------------------------------
/src/components/ThemeToggle.tsx:
--------------------------------------------------------------------------------
1 | import React, { useContext } from 'react'
2 | import { ThemeContext } from '../contexts/ThemeContext'
3 |
4 | export default function ThemeToggle() {
5 | const { colorMode, setColorMode } = useContext(ThemeContext)
6 |
7 | function toggleTheme() {
8 | if (colorMode === 'dark') setColorMode('light')
9 | if (colorMode === 'light') setColorMode('dark')
10 | }
11 |
12 | if (!colorMode) {
13 | return null
14 | }
15 |
16 | return (
17 |
21 | {colorMode === 'dark' ? (
22 |
30 | Moon
31 |
32 |
33 | ) : (
34 |
42 | Sun
43 |
44 |
45 | )}
46 |
47 | )
48 | }
49 |
--------------------------------------------------------------------------------
/src/components/search-ui/SearchResultsContainer.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { SearchResult } from '../search-ui'
3 |
4 | interface SearchResultsContainerProps {
5 | results: {
6 | category: string
7 | section: string
8 | title: string
9 | slug: string
10 | }[]
11 | query: string
12 | setQuery: (param: string) => void
13 | }
14 | export function SearchResultsContainer({
15 | results,
16 | query,
17 | setQuery,
18 | }: SearchResultsContainerProps) {
19 | const suggestedTerms = [
20 | 'Runtime',
21 | 'Storage',
22 | 'FRAME',
23 | 'Weights',
24 | 'Pallet Design',
25 | ]
26 |
27 | return (
28 |
29 |
34 | {results.length} RESULTS
35 |
36 |
37 | {query.length === 0 ? (
38 |
39 | {suggestedTerms.map((term, index) => (
40 |
setQuery(term)}
43 | key={index}
44 | >
45 |
46 |
47 | ))}
48 |
49 | ) : (
50 |
51 | {results.length > 0 ? (
52 |
53 | {results.map((result, index) => {
54 | return (
55 |
56 |
62 |
63 | )
64 | })}
65 |
66 | ) : (
67 |
68 |
69 |
70 | )}
71 |
72 | )}
73 |
74 |
75 | )
76 | }
77 |
--------------------------------------------------------------------------------
/static/assets/tutorials/ink-workshop/1.5-finished-code.rs:
--------------------------------------------------------------------------------
1 |
2 | #![cfg_attr(not(feature = "std"), no_std)]
3 |
4 | use ink_lang as ink;
5 |
6 | #[ink::contract]
7 | mod incrementer {
8 |
9 | #[ink(storage)]
10 | pub struct Incrementer {
11 | value: i32,
12 | my_value: ink_storage::collections::HashMap,
13 | }
14 |
15 | impl Incrementer {
16 | #[ink(constructor)]
17 | pub fn new(init_value: i32) -> Self {
18 | Self {
19 | value: init_value,
20 | my_value: ink_storage::collections::HashMap::new(),
21 | }
22 | }
23 |
24 | #[ink(constructor)]
25 | pub fn default() -> Self {
26 | Self {
27 | value: 0,
28 | my_value: Default::default(),
29 | }
30 | }
31 |
32 | #[ink(message)]
33 | pub fn get(&self) -> i32 {
34 | self.value
35 | }
36 |
37 | #[ink(message)]
38 | pub fn inc(&mut self, by: i32) {
39 | self.value += by;
40 | }
41 |
42 | #[ink(message)]
43 | pub fn get_mine(&self) -> i32 {
44 | self.my_value_or_zero(&self.env().caller())
45 | }
46 |
47 | fn my_value_or_zero(&self, of: &AccountId) -> i32 {
48 | *self.my_value.get(of).unwrap_or(&0)
49 | }
50 | }
51 |
52 | #[cfg(test)]
53 | mod tests {
54 | use super::*;
55 |
56 | use ink_lang as ink;
57 |
58 | #[ink::test]
59 | fn default_works() {
60 | let contract = Incrementer::default();
61 | assert_eq!(contract.get(), 0);
62 | }
63 |
64 | #[ink::test]
65 | fn it_works() {
66 | let mut contract = Incrementer::new(42);
67 | assert_eq!(contract.get(), 42);
68 | contract.inc(5);
69 | assert_eq!(contract.get(), 47);
70 | contract.inc(-50);
71 | assert_eq!(contract.get(), -3);
72 | }
73 |
74 | #[ink::test]
75 | fn my_value_works() {
76 | let contract = Incrementer::new(11);
77 | assert_eq!(contract.get(), 11);
78 | assert_eq!(contract.get_mine(), 0);
79 | }
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/src/components/search-ui/SearchResult.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import Link from '../Link'
3 |
4 | interface SearchResultProps {
5 | slug?: string
6 | section?: string
7 | category?: string
8 | title: string
9 | noLink?: boolean
10 | error?: boolean
11 | }
12 | export function SearchResult({
13 | slug,
14 | section,
15 | category,
16 | title,
17 | noLink,
18 | error,
19 | }: SearchResultProps) {
20 | return (
21 | <>
22 | {noLink || error ? (
23 |
24 |
31 |
32 | {section}
33 |
34 |
41 | {category} {noLink || error ? '' : '-'} {title}
42 |
43 |
44 |
45 | ) : (
46 |
47 |
54 |
55 | {section}
56 |
57 |
64 | {category} {noLink || error ? '' : '-'} {title}
65 |
66 |
67 |
68 | )}
69 | >
70 | )
71 | }
72 |
--------------------------------------------------------------------------------
/v3/how-to-guides/02-pallet-design/f-tight-coupling/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Tightly Coupling a Pallet
3 | slug: /how-to-guides/v3/pallet-design/tight-coupling
4 | version: '3.0'
5 | section: how to guides
6 | category: pallet design
7 | keywords: []
8 | ---
9 |
10 |
30 |
31 | ## Steps
32 |
33 | ### 1. Configure your workspace
34 |
35 | Assume you want to use a pallet called `special-pallet`, which is a pallet in your
36 | local workspace. Import it by providing its path in your pallet's `Cargo.toml` file:
37 |
38 | ```toml
39 | special-pallet = { path = '../special-pallet', default-features = false }
40 | ```
41 |
42 | ### 2. Add a trait bound to your pallet
43 |
44 | Now all you need to do is create a trait bound around your pallet's configuration trait:
45 |
46 | ```rust
47 | pub trait Config: frame_system::Config + special_pallet::Config {
48 | // --snip--
49 | }
50 | ```
51 |
52 | ### 3. Use getter function
53 |
54 | In order to use a method from `special_pallet`, call it the following way:
55 |
56 | ```rust
57 | // Get the members from the vec-set pallet
58 | let who = special_pallet::Pallet::::get();
59 | ```
60 |
61 | The above snippet assumes that `special_pallet` contains a method called `get()`.
62 |
63 | ## Examples
64 |
65 | - FRAME's [Bounties](https://github.com/paritytech/substrate/tree/master/frame/bounties)
66 | and [Tipping](https://github.com/paritytech/substrate/tree/master/frame/tips) pallets with the Treasury pallet
67 |
68 | ## Resources
69 |
70 | - [Pallet Coupling](/v3/runtime/pallet-coupling)
71 | - A how-to guide on [Loosely Coupling two pallets](../loose-coupling)
72 |
--------------------------------------------------------------------------------
/v3/docs/06-tools/0-landing-page/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Explore Tools
3 | slug: /v3/tools
4 | version: '3.0'
5 | section: docs
6 | category: tools
7 | keywords: []
8 | ---
9 |
10 | While there are some tools that are documented more extensively, such as [Subkey](/v3/tools/subkey),
11 | [Memory Profiling](/v3/tools/memory-profiling) and [Try Runtime](/v3/tools/try-runtime), there exists a
12 | number of additional tools which are yet to be integrated into Substrate's documentation hub. This page
13 | provides an overview of what these tools are and what they do.
14 |
15 |
22 |
28 |
34 |
40 |
46 |
52 |
58 |
--------------------------------------------------------------------------------
/static/assets/tutorials/ink-workshop/1.5-template.rs:
--------------------------------------------------------------------------------
1 |
2 | #![cfg_attr(not(feature = "std"), no_std)]
3 |
4 | use ink_lang as ink;
5 |
6 | #[ink::contract]
7 | mod incrementer {
8 |
9 | #[ink(storage)]
10 | pub struct Incrementer {
11 | value: i32,
12 | // ACTION: Add a `HashMap` from `AccountId` to `i32` named `my_value`
13 | }
14 |
15 | impl Incrementer {
16 | #[ink(constructor)]
17 | pub fn new(init_value: i32) -> Self {
18 | Self {
19 | value: init_value,
20 | // ACTION: Set initial `my_value`
21 | }
22 | }
23 |
24 | #[ink(constructor)]
25 | pub fn default() -> Self {
26 | Self {
27 | value: 0,
28 | // ACTION: Set initial `my_value`
29 | }
30 | }
31 |
32 | #[ink(message)]
33 | pub fn get(&self) -> i32 {
34 | self.value
35 | }
36 |
37 | #[ink(message)]
38 | pub fn inc(&mut self, by: i32) {
39 | self.value += by;
40 | }
41 |
42 | #[ink(message)]
43 | pub fn get_mine(&self) -> i32 {
44 | // ACTION: Get `my_value` using `my_value_or_zero` on `&self.env().caller()`
45 | // ACTION: Return `my_value`
46 | }
47 |
48 | fn my_value_or_zero(&self, of: &AccountId) -> i32 {
49 | // ACTION: `get` and return the value of `of` and `unwrap_or` return 0
50 | }
51 | }
52 |
53 | #[cfg(test)]
54 | mod tests {
55 | use super::*;
56 |
57 | // Alias `ink_lang` so we can use `ink::test`.
58 | use ink_lang as ink;
59 |
60 | #[ink::test]
61 | fn default_works() {
62 | let contract = Incrementer::default();
63 | assert_eq!(contract.get(), 0);
64 | }
65 |
66 | #[ink::test]
67 | fn it_works() {
68 | let mut contract = Incrementer::new(42);
69 | assert_eq!(contract.get(), 42);
70 | contract.inc(5);
71 | assert_eq!(contract.get(), 47);
72 | contract.inc(-50);
73 | assert_eq!(contract.get(), -3);
74 | }
75 |
76 | // Use `ink::test` to initialize accounts.
77 | #[ink::test]
78 | fn my_value_works() {
79 | let contract = Incrementer::new(11);
80 | assert_eq!(contract.get(), 11);
81 | assert_eq!(contract.get_mine(), 0);
82 | }
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/static/assets/tutorials/kitties-tutorial/01-basic-setup.rs:
--------------------------------------------------------------------------------
1 | #![cfg_attr(not(feature = "std"), no_std)]
2 |
3 | pub use pallet::*;
4 |
5 | #[frame_support::pallet]
6 | pub mod pallet {
7 | use frame_support::{sp_runtime::traits::{Hash, Zero},
8 | dispatch::{DispatchResultWithPostInfo, DispatchResult},
9 | traits::{Currency, ExistenceRequirement, Randomness},
10 | pallet_prelude::*};
11 | use frame_system::pallet_prelude::*;
12 | use sp_io::hashing::blake2_128;
13 |
14 | // TODO Part II: Struct for holding Kitty information.
15 |
16 | // TODO Part II: Enum and implementation to handle Gender type in Kitty struct.
17 |
18 | #[pallet::pallet]
19 | #[pallet::generate_store(pub(super) trait Store)]
20 | pub struct Pallet(_);
21 |
22 | /// Configure the pallet by specifying the parameters and types it depends on.
23 | #[pallet::config]
24 | pub trait Config: frame_system::Config {
25 | /// Because this pallet emits events, it depends on the runtime's definition of an event.
26 | type Event: From> + IsType<::Event>;
27 |
28 | /// The Currency handler for the Kitties pallet.
29 | type Currency: Currency;
30 |
31 | // TODO Part II: Specify the custom types for our runtime.
32 |
33 | }
34 |
35 | // Errors.
36 | #[pallet::error]
37 | pub enum Error {
38 | // TODO Part III
39 | }
40 |
41 | #[pallet::event]
42 | #[pallet::generate_deposit(pub(super) fn deposit_event)]
43 | pub enum Event {
44 | // TODO Part III
45 | }
46 |
47 | // ACTION: Storage item to keep a count of all existing Kitties.
48 |
49 | // TODO Part II: Remaining storage items.
50 |
51 | // TODO Part III: Our pallet's genesis configuration.
52 |
53 | #[pallet::call]
54 | impl Pallet {
55 |
56 | // TODO Part III: create_kitty
57 |
58 | // TODO Part III: set_price
59 |
60 | // TODO Part III: transfer
61 |
62 | // TODO Part III: buy_kitty
63 |
64 | // TODO Part III: breed_kitty
65 | }
66 |
67 | // TODO Parts II: helper function for Kitty struct
68 |
69 | impl Pallet {
70 | // TODO Part III: helper functions for dispatchable functions
71 |
72 | // TODO: increment_nonce, random_hash, mint, transfer_from
73 |
74 | }
75 | }
--------------------------------------------------------------------------------
/v3/docs/05-integrate/b-client-libraries/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Client Libraries
3 | slug: /v3/integration/client-libraries
4 | version: '3.0'
5 | section: docs
6 | category: tools
7 | keywords: []
8 | ---
9 |
10 | There are a number of language-specific client libraries that can be used to interact with
11 | Substrate-based blockchains. In general, the capabilities that these libraries expose are
12 | implemented on top of the Substrate remote procedure call (RPC) API.
13 |
14 | ## JavaScript
15 |
16 | The Polkadot JS team maintains a rich set of tools for interacting with Substrate-based blockchains.
17 | Refer to [the main Polkadot JS page](../polkadot-js) to learn more about that suite of tools.
18 |
19 | Parity also maintains [`txwrapper`](https://github.com/paritytech/txwrapper), which is a Javascript
20 | library for offline generation of Substrate transactions.
21 |
22 | ## Go
23 |
24 | [The Go Substrate RPC Client](https://github.com/centrifuge/go-substrate-rpc-client/), AKA GSRPC, is
25 | maintained by [Centrifuge](https://centrifuge.io/).
26 |
27 | ## C#
28 |
29 | [Polkadot API DotNet](https://github.com/usetech-llc/polkadot_api_dotnet) is a Substrate RPC client
30 | library for .Net programmers. It is maintained by [Usetech](https://usetech.com/blockchain/).
31 | [SubstrateNetApi](https://github.com/dotmog/SubstrateNetApi) .NET Standard API ([nuget](https://www.nuget.org/packages/SubstrateNetApi)) allowing full substrate integration in Unity3D for gaming development, [starter template project](https://github.com/darkfriend77/Unity3DExample). It is maintained by [DOTMog Team](https://www.dotmog.com/).
32 |
33 | ## C++
34 |
35 | [Usetech](https://usetech.com/blockchain/) also maintains Polkadot API CPP, which is a C++ library
36 | for interacting with the Substrate RPC.
37 |
38 | ## Rust
39 |
40 | Parity maintains [`substrate-subxt`](https://github.com/paritytech/substrate-subxt), which is a Rust
41 | library specifically designed for submitting extrinsics to Substrate blockchains. The
42 | [the Substrate API Client](https://github.com/scs/substrate-api-client) is another Substrate client
43 | library for Rust that is maintained by Supercomputing Systems; its API is more general-purpose than
44 | `substrate-subxt`.
45 |
46 | ## Python
47 |
48 | [py-substrate-interface](https://github.com/polkascan/py-substrate-interface) is a Python
49 | library for interacting with the Substrate RPC. It supports a wide range of capabilities and
50 | powers the [Polkascan multi-chain block explorer](https://polkascan.io/). This library is
51 | maintained by [Polkascan Foundation](https://polkascan.org/).
52 |
--------------------------------------------------------------------------------
/v3/docs/01-getting-started/b-architecture/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Architecture
3 | slug: /v3/getting-started/architecture
4 | version: '3.0'
5 | section: docs
6 | category: getting started
7 | keywords: []
8 | ---
9 |
10 | 
11 |
12 | The Substrate client is an application that runs a Substrate-based blockchain node. It consists of several components
13 | that include, but are not limited to, the following:
14 |
15 | - **Storage**: used to persist the evolving state of a Substrate blockchain. The
16 | blockchain network allows participants to reach trustless [consensus](/v3/advanced/consensus) about the
17 | state of storage. Substrate ships with a simple and highly efficient
18 | [key-value storage mechanism](/v3/advanced/storage).
19 | - **Runtime**: the logic that defines how blocks are processed, including state transition logic. In Substrate, runtime code is
20 | compiled to [Wasm](/v3/getting-started/glossary#webassembly-wasm) and becomes part of the blockchain's
21 | storage state. This enables one of the defining features of a Substrate-based blockchain:
22 | [forkless runtime upgrades](/v3/runtime/upgrades#forkless-runtime-upgrades). Substrate clients may also
23 | include a "native runtime" that is compiled for the same platform as the client itself (as opposed to Wasm). The
24 | component of the client that dispatches calls to the runtime is known as the
25 | [executor](/v3/advanced/executor), whose role is to select between the native code and interpreted Wasm. Although the
26 | native runtime may offer a performance advantage, the executor will select to interpret the Wasm runtime if it
27 | implements a newer [version](/v3/runtime/upgrades#runtime-versioning).
28 | - **Peer-to-peer network**: the capabilities that allow the client to communicate with other network participants. Substrate uses
29 | the Rust implementation of the [`libp2p` network stack](https://libp2p.io/) to achieve this.
30 | - **Consensus**: the logic that allows network participants to agree on the state of the blockchain.
31 | Substrate makes it possible to supply custom consensus engines and also ships with several consensus mechanisms that
32 | have been built on top of [Web3 Foundation research](https://w3f-research.readthedocs.io/en/latest/index.html).
33 | - **RPC** (remote procedure call): the capabilities that allow blockchain users to interact with the network. Substrate provides
34 | HTTP and WebSocket RPC servers.
35 | - **Telemetry**: client metrics that are exposed by the embedded [Prometheus](https://prometheus.io/) server.
36 |
--------------------------------------------------------------------------------
/src/components/Header/SubMenuItem.tsx:
--------------------------------------------------------------------------------
1 | import React, { useEffect } from 'react'
2 | import useComponentVisible from '../Hooks/use-component-visible'
3 | import NavListItem from './NavListItem'
4 |
5 | interface SubMenuItemProps {
6 | data: {
7 | linkTitle: string
8 | link: string
9 | external: boolean
10 | items?: { linkTitle: string; link: string; external: boolean }[]
11 | }
12 | setItemNavOpen: (param: boolean) => void
13 | }
14 |
15 | export default function SubMenuItem({
16 | data,
17 | setItemNavOpen,
18 | }: SubMenuItemProps) {
19 | const { ref, isComponentVisible, setIsComponentVisible } =
20 | useComponentVisible(false)
21 | useEffect(() => {
22 | isComponentVisible ? setItemNavOpen(true) : setItemNavOpen(false)
23 | }, [isComponentVisible])
24 | return (
25 | <>
26 | setIsComponentVisible(!isComponentVisible)}
29 | className={`pl-6 py-2 pr-24 text-black dark:text-white cursor-pointer ${
30 | isComponentVisible
31 | ? 'bg-substrateGreen-light underline dark:bg-substrateGreen-dark hover:text-black'
32 | : 'hover:text-substrateGreen hover:underline'
33 | }`}
34 | >
35 |
{data.linkTitle}
36 |
37 |
51 |
52 |
53 |
54 |
55 | {isComponentVisible ? (
56 | <>
57 |
58 | {data.items.map((item, index) => {
59 | return (
60 |
61 |
66 |
67 | )
68 | })}
69 |
70 | >
71 | ) : null}
72 | >
73 | )
74 | }
75 |
--------------------------------------------------------------------------------
/static/assets/tutorials/kitties-tutorial/02-create-kitties.rs:
--------------------------------------------------------------------------------
1 | #![cfg_attr(not(feature = "std"), no_std)]
2 |
3 | pub use pallet::*;
4 |
5 | #[frame_support::pallet]
6 | pub mod pallet {
7 | use frame_support::pallet_prelude::*;
8 | use frame_system::pallet_prelude::*;
9 | use frame_support::{
10 | sp_runtime::traits::Hash,
11 | traits::{ Randomness, Currency, tokens::ExistenceRequirement },
12 | transactional
13 | };
14 | use sp_io::hashing::blake2_128;
15 | use scale_info::TypeInfo;
16 |
17 | #[cfg(feature = "std")]
18 | use frame_support::serde::{Deserialize, Serialize};
19 |
20 | // ACTION #1: Write a Struct to hold Kitty information.
21 |
22 | // ACTION #2: Enum declaration for Gender.
23 |
24 | // ACTION #3: Implementation to handle Gender type in Kitty struct.
25 |
26 | #[pallet::pallet]
27 | #[pallet::generate_store(pub(super) trait Store)]
28 | pub struct Pallet(_);
29 |
30 | /// Configure the pallet by specifying the parameters and types it depends on.
31 | #[pallet::config]
32 | pub trait Config: frame_system::Config {
33 | /// Because this pallet emits events, it depends on the runtime's definition of an event.
34 | type Event: From> + IsType<::Event>;
35 |
36 | /// The Currency handler for the Kitties pallet.
37 | type Currency: Currency;
38 |
39 | // ACTION #5: Specify the type for Randomness we want to specify for runtime.
40 |
41 | // ACTION #9: Add MaxKittyOwned constant
42 | }
43 |
44 | // Errors.
45 | #[pallet::error]
46 | pub enum Error {
47 | // TODO Part III
48 | }
49 |
50 | // Events.
51 | #[pallet::event]
52 | #[pallet::generate_deposit(pub(super) fn deposit_event)]
53 | pub enum Event {
54 | // TODO Part III
55 | }
56 |
57 | #[pallet::storage]
58 | #[pallet::getter(fn all_kitties_count)]
59 | pub(super) type KittyCnt = StorageValue<_, u64, ValueQuery>;
60 |
61 | // ACTION #7: Remaining storage items.
62 |
63 | // TODO Part IV: Our pallet's genesis configuration.
64 |
65 | #[pallet::call]
66 | impl Pallet {
67 |
68 | // TODO Part III: create_kitty
69 |
70 | // TODO Part IV: set_price
71 |
72 | // TODO Part IV: transfer
73 |
74 | // TODO Part IV: buy_kitty
75 |
76 | // TODO Part IV: breed_kitty
77 | }
78 |
79 | //** Our helper functions.**//
80 |
81 | impl Pallet {
82 |
83 | // ACTION #4: helper function for Kitty struct
84 |
85 | // TODO Part III: helper functions for dispatchable functions
86 |
87 | // ACTION #6: funtion to randomly generate DNA
88 |
89 | // TODO Part III: mint
90 |
91 | // TODO Part IV: transfer_kitty_to
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/gatsby-node/create-redirects.js:
--------------------------------------------------------------------------------
1 | // This param is used when `/[tutorials, how-to-guides]/` are then redirected to
2 | // `/[tutorials, how-to-guides]//`.
3 | const defaultVersion = 'v3'
4 |
5 | const redirects = [
6 | {
7 | fromPath: '/tutorials/',
8 | toPath: `/tutorials/${defaultVersion}/`,
9 | },
10 | {
11 | fromPath: '/how-to-guides/',
12 | toPath: `/how-to-guides/${defaultVersion}/`,
13 | },
14 | {
15 | fromPath: '/v3/',
16 | toPath: '/v3/getting-started/overview/',
17 | },
18 | {
19 | fromPath: '/v3/getting-started/',
20 | toPath: '/v3/getting-started/overview/',
21 | },
22 | {
23 | fromPath: '/v3/concepts/',
24 | toPath: '/v3/concepts/runtime/',
25 | },
26 | {
27 | fromPath: '/v3/runtime/',
28 | toPath: '/v3/runtime/frame/',
29 | },
30 | {
31 | fromPath: '/v3/integration/',
32 | toPath: '/v3/integration/polkadot-js/',
33 | },
34 | {
35 | fromPath: '/v3/advanced/',
36 | toPath: '/v3/advanced/account-info/',
37 | },
38 | {
39 | fromPath: '/tutorials/v3/kitties/',
40 | toPath: `/tutorials/v3/kitties/pt1/`,
41 | },
42 | {
43 | fromPath: '/tutorials/v3/cumulus/',
44 | toPath: `/tutorials/v3/cumulus/start-relay/`,
45 | },
46 | {
47 | fromPath: '/how-to-guides/basics/',
48 | toPath: `/how-to-guides/v3/basics/pallet-integration/`,
49 | },
50 | {
51 | fromPath: '/how-to-guides/pallet-design/',
52 | toPath: `/how-to-guides/v3/pallet-design/contracts-pallet/`,
53 | },
54 | {
55 | fromPath: '/how-to-guides/weights/',
56 | toPath: `/how-to-guides/v3/weights/calculate-fees/`,
57 | },
58 | {
59 | fromPath: '/how-to-guides/testing/',
60 | toPath: `/how-to-guides/v3/testing/basics/`,
61 | },
62 | {
63 | fromPath: '/how-to-guides/storage-migrations/',
64 | toPath: `/how-to-guides/v3/storage-migrations/basics/`,
65 | },
66 | {
67 | fromPath: '/how-to-guides/consensus/',
68 | toPath: `/how-to-guides/v3/consensus/pow/`,
69 | },
70 | {
71 | fromPath: '/how-to-guides/parachains/',
72 | toPath: `/how-to-guides/v3/parachains/connect/`,
73 | },
74 | {
75 | fromPath: '/how-to-guides/tools/',
76 | toPath: `/how-to-guides/v3/tools/try-runtime/`,
77 | },
78 | ]
79 |
80 | const createPageRedirects = ({ actions }) => {
81 | const { createRedirect } = actions
82 |
83 | redirects.forEach(({ fromPath, toPath }) => {
84 | createRedirect({
85 | fromPath,
86 | toPath,
87 | isPermanent: true,
88 | redirectInBrowser: true,
89 | force: true,
90 | statusCode: 301,
91 | })
92 | })
93 | }
94 |
95 | module.exports = {
96 | createPageRedirects,
97 | }
98 |
--------------------------------------------------------------------------------
/static/assets/tutorials/ink-workshop/1.6-finished-code.rs:
--------------------------------------------------------------------------------
1 |
2 | #![cfg_attr(not(feature = "std"), no_std)]
3 |
4 | use ink_lang as ink;
5 |
6 | #[ink::contract]
7 | mod incrementer {
8 | #[ink(storage)]
9 | pub struct Incrementer {
10 | value: i32,
11 | my_value: ink_storage::collections::HashMap,
12 | }
13 |
14 | impl Incrementer {
15 | #[ink(constructor)]
16 | pub fn new(init_value: i32) -> Self {
17 | Self {
18 | value: init_value,
19 | my_value: ink_storage::collections::HashMap::new(),
20 | }
21 | }
22 |
23 | #[ink(constructor)]
24 | pub fn default() -> Self {
25 | Self {
26 | value: 0,
27 | my_value: Default::default(),
28 | }
29 | }
30 |
31 | #[ink(message)]
32 | pub fn get(&self) -> i32 {
33 | self.value
34 | }
35 |
36 | #[ink(message)]
37 | pub fn inc(&mut self, by: i32) {
38 | self.value += by;
39 | }
40 |
41 | #[ink(message)]
42 | pub fn get_mine(&self) -> i32 {
43 | self.my_value_or_zero(&self.env().caller())
44 | }
45 |
46 | #[ink(message)]
47 | pub fn inc_mine(&mut self, by: i32) {
48 | let caller = self.env().caller();
49 | let my_value = self.my_value_or_zero(&caller);
50 | self.my_value.insert(caller, my_value + by);
51 | }
52 |
53 | fn my_value_or_zero(&self, of: &AccountId) -> i32 {
54 | *self.my_value.get(of).unwrap_or(&0)
55 | }
56 | }
57 |
58 | #[cfg(test)]
59 | mod tests {
60 | use super::*;
61 |
62 | use ink_lang as ink;
63 |
64 | #[ink::test]
65 | fn default_works() {
66 | let contract = Incrementer::default();
67 | assert_eq!(contract.get(), 0);
68 | }
69 |
70 | #[ink::test]
71 | fn it_works() {
72 | let mut contract = Incrementer::new(42);
73 | assert_eq!(contract.get(), 42);
74 | contract.inc(5);
75 | assert_eq!(contract.get(), 47);
76 | contract.inc(-50);
77 | assert_eq!(contract.get(), -3);
78 | }
79 |
80 | #[ink::test]
81 | fn my_value_works() {
82 | let mut contract = Incrementer::new(11);
83 | assert_eq!(contract.get(), 11);
84 | assert_eq!(contract.get_mine(), 0);
85 | contract.inc_mine(5);
86 | assert_eq!(contract.get_mine(), 5);
87 | contract.inc_mine(10);
88 | assert_eq!(contract.get_mine(), 15);
89 | }
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/.github/workflows/codeql-analysis.yml:
--------------------------------------------------------------------------------
1 | # For most projects, this workflow file will not need changing; you simply need
2 | # to commit it to your repository.
3 | #
4 | # You may wish to alter this file to override the set of languages analyzed,
5 | # or to provide custom queries or build logic.
6 | #
7 | # ******** NOTE ********
8 | # We have attempted to detect the languages in your repository. Please check
9 | # the `language` matrix defined below to confirm you have the correct set of
10 | # supported CodeQL languages.
11 | #
12 | name: "CodeQL"
13 |
14 | on:
15 | push:
16 | branches: [ main ]
17 | pull_request:
18 | # The branches below must be a subset of the branches above
19 | branches: [ main ]
20 | schedule:
21 | - cron: '21 11 * * 5'
22 |
23 | jobs:
24 | analyze:
25 | name: Analyze
26 | runs-on: ubuntu-latest
27 | permissions:
28 | actions: read
29 | contents: read
30 | security-events: write
31 |
32 | strategy:
33 | fail-fast: false
34 | matrix:
35 | language: [ 'javascript' ]
36 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
37 | # Learn more:
38 | # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
39 |
40 | steps:
41 | - name: Checkout repository
42 | uses: actions/checkout@v2
43 |
44 | # Initializes the CodeQL tools for scanning.
45 | - name: Initialize CodeQL
46 | uses: github/codeql-action/init@v1
47 | with:
48 | languages: ${{ matrix.language }}
49 | # If you wish to specify custom queries, you can do so here or in a config file.
50 | # By default, queries listed here will override any specified in a config file.
51 | # Prefix the list here with "+" to use these queries and those in the config file.
52 | # queries: ./path/to/local/query, your-org/your-repo/queries@main
53 |
54 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
55 | # If this step fails, then you should remove it and run the build manually (see below)
56 | - name: Autobuild
57 | uses: github/codeql-action/autobuild@v1
58 |
59 | # ℹ️ Command-line programs to run using the OS shell.
60 | # 📚 https://git.io/JvXDl
61 |
62 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
63 | # and modify them (or add more) to build your code if your project
64 | # uses a compiled language
65 |
66 | #- run: |
67 | # make bootstrap
68 | # make release
69 |
70 | - name: Perform CodeQL Analysis
71 | uses: github/codeql-action/analyze@v1
72 |
--------------------------------------------------------------------------------