diff --git a/.vitepress/config.mts b/.vitepress/config.mts index 394216d..307d937 100644 --- a/.vitepress/config.mts +++ b/.vitepress/config.mts @@ -2,7 +2,7 @@ import { defineConfig } from 'vitepress' // https://vitepress.dev/reference/site-config export default defineConfig({ - title: "xcnft-pallet documentation", + title: "xcnft-pallet docs", description: "A comprehensive pallet for cross-chain NFTs on Polkadot", base: '/xcnft-docs/', head: [ @@ -16,17 +16,27 @@ export default defineConfig({ nav: [ { text: 'Home', link: '/' }, - { text: 'Implementation', link: '/markdown-examples' }, - { text: 'User guide', link: '/markdown-examples' } + { text: 'Implementation', link: '/implementation-guide/introduction' }, + { text: 'User guide', link: '/user-guide/intro' } ], sidebar: [ { - text: 'Examples', + text: 'Implementation guide', items: [ - { text: 'Markdown Examples', link: '/markdown-examples' }, - { text: 'Runtime API Examples', link: '/api-examples' } - ] + { text: 'Introduction', link: '/implementation-guide/introduction' }, + { text: 'xcnft for pallet_nfts', link: '/implementation-guide/pallet-nfts' }, + { text: 'xcnft for pallet_uniques', link: '/implementation-guide/pallet-uniques' } + ], + }, + { + text: 'User guide', + items: [ + { text: 'Getting Started', link: '/user-guide/intro' }, + { text: 'Pallet storage', link: '/user-guide/storage' }, + { text: 'Pallet errors and events', link: '/user-guide/errors-events' }, + { text: 'Pallet functionality', link: '/user-guide/functions' }, + ], } ], diff --git a/api-examples.md b/api-examples.md deleted file mode 100644 index 6bd8bb5..0000000 --- a/api-examples.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -outline: deep ---- - -# Runtime API Examples - -This page demonstrates usage of some of the runtime APIs provided by VitePress. - -The main `useData()` API can be used to access site, theme, and page data for the current page. It works in both `.md` and `.vue` files: - -```md - - -## Results - -### Theme Data -
{{ theme }}- -### Page Data -
{{ page }}- -### Page Frontmatter -
{{ frontmatter }}-``` - - - -## Results - -### Theme Data -
{{ theme }}- -### Page Data -
{{ page }}- -### Page Frontmatter -
{{ frontmatter }}- -## More - -Check out the documentation for the [full list of runtime APIs](https://vitepress.dev/reference/runtime-api#usedata). diff --git a/implementation-guide/introduction.md b/implementation-guide/introduction.md new file mode 100644 index 0000000..94f4890 --- /dev/null +++ b/implementation-guide/introduction.md @@ -0,0 +1,90 @@ +# Welcome fellow Parachain developer 🧙♂️ + +Following section will guide you through implementation of the xcNFT cross-chain pallet for non-fungible assets. + +## Before your journey begins 🧳 + +Before you begin with implementing this magical ✨ pallet into your Parachain, you must ensure, that you meet following pre-requirements: + +### Your Parachain should implement following pallets: + +**Substrate:** + - `frame-benchmarking` + - `frame-support` + - `frame-system` + +**Cumulus:** + - `cumulus-primitives-core` + - `cumulus-pallet-xcm` + +**XCMP:** + - `xcm` + +**SP:** + - `sp-runtime` + - `sp-std` + - `sp-core` + - `sp-io` + +**Substrate Pallets:** + - Either `pallet-nfts` or `pallet-uniques` depending on which pallet your Parachain uses + - `pallet-balances` + - `parachain-info` + +**Other pallets (Only needed for pallet_uniques xcnft version):** + - `enumflags2` + + +### You should also make choice of xcnft version: +- If your Parachain uses **pallet_nfts** head over to [xcnft for pallet_nfts]() section. +- If your Parachain uses **pallet_uniques** head over to [xcnft for pallet_uniques]() section. + +## Testing pallet functionality 🔎 + +Don't know whether this pallet is useful for your Parachain? + +No worries! + +**Try it out before you implement it!** + +### Follow these steps to create local testnet that implements xcNFT: + +1. Fork or clone [following repository](https://github.com/paraspell-research/polkadot-sdk) + +2. Download [Zombienet binary for your system](https://github.com/paritytech/zombienet/releases) + +3. Copy zombienet binary into binaries folder of the repository you just forked + +4. Compile Relay chain by: +- `cd polkadot` +- `cargo build --release` + +5. Compile first Parachain by: +- `cargo b -r -p parachain-template-node` + +6. Compile second Parachain by: +- `cargo b -r -p parachain-template-node-two` + +7. Launch zombienet localhost network by: +- `cd binaries` +- Choose config that you wish to test: + - `./zombienet-macos-arm64 -p native -c 1 spawn config-both.toml` launches network with 1 Relay chain, 1 Parachain with *pallet_nfts* and 1 Parachain with *pallet_uniques* (Best for testing pallet agnosticity) + - `./zombienet-macos-arm64 -p native -c 1 spawn config-nfts.toml` launches network with 1 Relay chain and 2 Parachains with *pallet_nfts* + - `./zombienet-macos-arm64 -p native -c 1 spawn config-uniques.toml` launches network with 1 Relay chain and 2 Parachains with *pallet_uniques* + +8. Once the network is launched, connect to one of the Relay chain nodes: + +![zombienet](https://github.com/user-attachments/assets/06f1d41e-55a7-4d7b-b7f3-f3e6fa276132) + +9. Open HRMP channels for both chains (Needed for allowing cross-chain communication): +- Navigate to `Extrinsics` tab select `Alice` account and go to `Decode` + - Paste following hash to Decode section: `0xff00fa05e8030000e90300000800000000040000` (This hash opens channel from chain 1000 to 1001) + - Move back to Submission and sign the call with Alice + - Paste following hash to Decode section `0xff00fa05e9030000e80300000800000000040000` (This hash opens channel from chain 1001 to 1000) + - Move back to Submission and sign the call with Alice + +10. Start interacting with chains by connecting to their WS endpoints from Zombienet console and try xcNFT out. + +Don't know which function does what? Unsure what storage stores what? + +Head over to [User guide](https://paraspell-research.github.io/xcnft-docs/user-guide/intro.html) section. \ No newline at end of file diff --git a/implementation-guide/pallet-nfts.md b/implementation-guide/pallet-nfts.md new file mode 100644 index 0000000..5d4e0da --- /dev/null +++ b/implementation-guide/pallet-nfts.md @@ -0,0 +1,60 @@ +# Welcome to the future of cross-chain NFTs on Polkadot 🪐 + +Your choice to implement xcNFT into your Parachain means a lot to us! Feel free to provide feedback or suggestions in form of issue in this [GitHub repository](https://github.com/paraspell-research/xcnft-pallet)! + +Don't yet know what xcNFT has to offer? Head to [User guide](https://paraspell-research.github.io/xcnft-docs/user-guide/intro.html) section for overview. + +**Let's get you started.** + +## Implementing xcNFT 👨💻 +Following subsection guides you through the implementation phase of xcNFT + +Here are the steps that you should follow: + +1. Copy code from the [following folder](https://github.com/paraspell-research/xcnft-pallet/tree/main/xcnft-pallet_nfts) into your Parachain's pallets folder. + +2. Setup dependencies in xcNFT's `cargo.toml` to latest versions and try to compile your Parachain's code. + +## Runtime setup ⚙️ + +xcNFT requires minimal runtime config: +``` +impl pallet_parachain_xcnft::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type WeightInfo = pallet_parachain_xcnft::weights::SubstrateWeight