diff --git a/.gitignore b/.gitignore index b40fa3a..86b0956 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,8 @@ # Generated files .docusaurus .cache-loader +/docs/sage/rpc +# Generated RPC pages from before the Sage docs moved to docs/sage /docs/rpc # Misc diff --git a/.prettierignore b/.prettierignore index 43f85f9..de7d40d 100644 --- a/.prettierignore +++ b/.prettierignore @@ -3,4 +3,5 @@ build .docusaurus pnpm-lock.yaml src/openapi.json +docs/sage/rpc docs/rpc diff --git a/README.md b/README.md index 7529ec9..70ffb56 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ pnpm install pnpm start ``` -`pnpm start` and `pnpm build` both generate the RPC reference pages first. The generated pages go to `docs/rpc`, which is gitignored. To regenerate them on their own, run `pnpm gen-api-docs`. +`pnpm start` and `pnpm build` both generate the RPC reference pages first. The generated pages go to `docs/sage/rpc`, which is gitignored. To regenerate them on their own, run `pnpm gen-api-docs`. Before opening a PR, run: diff --git a/docs/config.md b/docs/sage/config.md similarity index 99% rename from docs/config.md rename to docs/sage/config.md index 582e36c..79ae2ac 100644 --- a/docs/config.md +++ b/docs/sage/config.md @@ -1,5 +1,5 @@ --- -slug: /config +slug: /sage/config --- # Config diff --git a/docs/files.md b/docs/sage/files.md similarity index 71% rename from docs/files.md rename to docs/sage/files.md index 789e5f0..18e1ce4 100644 --- a/docs/files.md +++ b/docs/sage/files.md @@ -1,5 +1,5 @@ --- -slug: /files +slug: /sage/files --- import Tabs from '@theme/Tabs'; @@ -21,13 +21,13 @@ The username `Alice` is a placeholder, and must be replaced by your actual usern ## Files -| Name | Description | -| --------------- | --------------------------------------------------------------------------------------- | -| `config.toml` | The main configuration file used by the app. See [Config](/config). | -| `keys.bin` | A binary encoding of all imported keys. | -| `logs` | Logs emitted by the backend of the app. | -| `networks.toml` | Information about blockchain networks (ie mainnet or testnet11). See [Config](/config). | -| `peers` | Binary files that store previous peer connections. | -| `ssl` | The SSL certificate used for full node connections and the RPC. | -| `wallets` | SQLite databases for each network and key pair. | -| `wallets.toml` | Configuration for each imported wallet. See [Config](/config). | +| Name | Description | +| --------------- | -------------------------------------------------------------------------------------------- | +| `config.toml` | The main configuration file used by the app. See [Config](/sage/config). | +| `keys.bin` | A binary encoding of all imported keys. | +| `logs` | Logs emitted by the backend of the app. | +| `networks.toml` | Information about blockchain networks (ie mainnet or testnet11). See [Config](/sage/config). | +| `peers` | Binary files that store previous peer connections. | +| `ssl` | The SSL certificate used for full node connections and the RPC. | +| `wallets` | SQLite databases for each network and key pair. | +| `wallets.toml` | Configuration for each imported wallet. See [Config](/sage/config). | diff --git a/docs/index.md b/docs/sage/index.md similarity index 85% rename from docs/index.md rename to docs/sage/index.md index b01ec39..42a2539 100644 --- a/docs/index.md +++ b/docs/sage/index.md @@ -1,5 +1,5 @@ --- -slug: /getting-started +slug: /sage/getting-started --- import Tabs from '@theme/Tabs'; @@ -7,7 +7,7 @@ import TabItem from '@theme/TabItem'; # Getting Started -The goal of this website is to provide documentation for Sage and the Wallet SDK it's built with. It will cover a wide range of topics, from configuring and using Sage and its RPCs to building your own applications that utilize the Wallet SDK library to connect to the Chia blockchain. +This section covers Sage itself: building it from source, where it stores its files, how to configure it, and how to use its RPC. If you want to build your own application on the Chia blockchain, see the [Wallet SDK](/sdk) docs, which cover the Rust library Sage is built with. :::info If you are looking for download instructions for the app, visit the [Sage Website](https://sagewallet.net). diff --git a/docs/rpc-setup.md b/docs/sage/rpc-setup.md similarity index 98% rename from docs/rpc-setup.md rename to docs/sage/rpc-setup.md index 245b1e0..a0b7f0f 100644 --- a/docs/rpc-setup.md +++ b/docs/sage/rpc-setup.md @@ -1,6 +1,6 @@ --- title: Setup -slug: /rpc/setup +slug: /sage/rpc/setup --- # RPC Setup @@ -37,7 +37,7 @@ Do not run the command line RPC server at the same time as the GUI. They may ove ## SSL Certificate -The CLI will load the certificate automatically, but if you want to connect to the RPC server from your own client (for example, in a Node.js app), you can find the SSL certificate on the [Files](/files) page. +The CLI will load the certificate automatically, but if you want to connect to the RPC server from your own client (for example, in a Node.js app), you can find the SSL certificate on the [Files](/sage/files) page. Here is an example of how you need to connect: diff --git a/docs/sdk/index.md b/docs/sdk/index.md index 94baa26..0353bc5 100644 --- a/docs/sdk/index.md +++ b/docs/sdk/index.md @@ -5,7 +5,7 @@ title: Quick Start # Wallet SDK -The Chia Wallet SDK is a Rust library for building applications that interact with the Chia blockchain. It provides high-level abstractions for creating transactions, managing coins, and working with Chia primitives like CATs, NFTs, and Vaults. +The Chia Wallet SDK is a Rust library for building applications that interact with the Chia blockchain. It provides high-level abstractions for creating transactions, managing coins, and working with Chia primitives like CATs, NFTs, and Vaults. It's the same library [Sage](/sage/getting-started) is built on. :::info This documentation assumes familiarity with Chia blockchain concepts such as coins, puzzles, conditions, and singletons. For background, see the [Chia Documentation](https://docs.chia.net) and [Chialisp Documentation](https://chialisp.com). diff --git a/docusaurus.config.ts b/docusaurus.config.ts index 564db89..8d98321 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -28,10 +28,19 @@ const config: Config = { docs: { sidebarPath: "./sidebars.ts", routeBasePath: "", + // Skip RPC pages generated at docs/rpc before the Sage docs moved to + // docs/sage, so stale local output isn't built alongside the new pages. + exclude: [ + "**/_*.{js,jsx,ts,tsx,md,mdx}", + "**/_*/**", + "**/*.test.{js,jsx,ts,tsx}", + "**/__tests__/**", + "rpc/**", + ], docItemComponent: "@theme/ApiItem", // Generated RPC pages have no source file to edit. editUrl: ({ docPath }) => - docPath.startsWith("rpc/") + docPath.startsWith("sage/rpc/") ? undefined : `https://github.com/xch-dev/docs/tree/main/docs/${docPath}`, }, @@ -43,6 +52,17 @@ const config: Config = { ], ], plugins: [ + [ + "@docusaurus/plugin-client-redirects", + { + redirects: [{ from: "/sage", to: "/sage/getting-started" }], + // Sage pages used to be served without the /sage prefix. + createRedirects: (existingPath: string) => + existingPath.startsWith("/sage/") + ? [existingPath.slice("/sage".length)] + : undefined, + }, + ], [ "docusaurus-plugin-openapi-docs", { @@ -51,7 +71,7 @@ const config: Config = { config: { sage_rpc: { specPath: "src/openapi.json", - outputDir: "docs/rpc/", + outputDir: "docs/sage/rpc/", sidebarOptions: { groupPathsBy: "tag", }, @@ -82,9 +102,15 @@ const config: Config = { items: [ { type: "docSidebar", - sidebarId: "sidebar", + sidebarId: "sage", + position: "left", + label: "Sage", + }, + { + type: "docSidebar", + sidebarId: "sdk", position: "left", - label: "Docs", + label: "Wallet SDK", }, { href: "https://github.com/xch-dev/docs", diff --git a/package.json b/package.json index 53edcc7..6f6d730 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ }, "dependencies": { "@docusaurus/core": "3.10.2", + "@docusaurus/plugin-client-redirects": "3.10.2", "@docusaurus/preset-classic": "3.10.2", "@easyops-cn/docusaurus-search-local": "^0.55.3", "@mdx-js/react": "^3.1.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 96a5b4a..f58f991 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -173,6 +173,9 @@ importers: '@docusaurus/core': specifier: 3.10.2 version: 3.10.2(@mdx-js/react@3.1.1(@types/react@19.3.0)(react@19.3.1))(clean-css@5.3.3)(cssnano@6.1.2(postcss@8.5.32))(csso@5.0.5)(debug@4.4.3(supports-color@8.1.1))(html-minifier-terser@7.2.0)(postcss@8.5.32)(react-dom@19.3.1(react@19.3.1))(react@19.3.1)(supports-color@8.1.1)(svgo@3.3.5)(typescript@5.9.3) + '@docusaurus/plugin-client-redirects': + specifier: 3.10.2 + version: 3.10.2(@mdx-js/react@3.1.1(@types/react@19.3.0)(react@19.3.1))(clean-css@5.3.3)(cssnano@6.1.2(postcss@8.5.32))(csso@5.0.5)(debug@4.4.3(supports-color@8.1.1))(html-minifier-terser@7.2.0)(postcss@8.5.32)(react-dom@19.3.1(react@19.3.1))(react@19.3.1)(supports-color@8.1.1)(svgo@3.3.5)(typescript@5.9.3) '@docusaurus/preset-classic': specifier: 3.10.2 version: 3.10.2(@algolia/client-search@5.61.0)(@mdx-js/react@3.1.1(@types/react@19.3.0)(react@19.3.1))(@types/react@19.3.0)(clean-css@5.3.3)(cssnano@6.1.2(postcss@8.5.32))(csso@5.0.5)(debug@4.4.3(supports-color@8.1.1))(html-minifier-terser@7.2.0)(postcss@8.5.32)(react-dom@19.3.1(react@19.3.1))(react@19.3.1)(search-insights@2.17.3)(supports-color@8.1.1)(svgo@3.3.5)(typescript@5.9.3) @@ -1277,6 +1280,13 @@ packages: react: '*' react-dom: '*' + '@docusaurus/plugin-client-redirects@3.10.2': + resolution: {integrity: sha512-z5I5ttCXw+8y2gHVZvqAMmUw4Rb0ZzKA5eCPk87SfM/jCKOTvE24yDpPAwwipvug96ij7mOwEHXWw8G4LlWdGA==} + engines: {node: '>=20.0'} + peerDependencies: + react: ^18.0.0 || ^19.0.0 + react-dom: ^18.0.0 || ^19.0.0 + '@docusaurus/plugin-content-blog@3.10.2': resolution: {integrity: sha512-0cbEnNKf0InmLkhj/+nVRmqEnWEoOE8Mh+2x1qOXI0qYpCnphq4RXknVJ8BvybKRXqYVvbmdMfiJSup+k4tm5w==} engines: {node: '>=20.0'} @@ -7674,6 +7684,47 @@ snapshots: - uglify-js - webpack-cli + '@docusaurus/plugin-client-redirects@3.10.2(@mdx-js/react@3.1.1(@types/react@19.3.0)(react@19.3.1))(clean-css@5.3.3)(cssnano@6.1.2(postcss@8.5.32))(csso@5.0.5)(debug@4.4.3(supports-color@8.1.1))(html-minifier-terser@7.2.0)(postcss@8.5.32)(react-dom@19.3.1(react@19.3.1))(react@19.3.1)(supports-color@8.1.1)(svgo@3.3.5)(typescript@5.9.3)': + dependencies: + '@docusaurus/core': 3.10.2(@mdx-js/react@3.1.1(@types/react@19.3.0)(react@19.3.1))(clean-css@5.3.3)(cssnano@6.1.2(postcss@8.5.32))(csso@5.0.5)(debug@4.4.3(supports-color@8.1.1))(html-minifier-terser@7.2.0)(postcss@8.5.32)(react-dom@19.3.1(react@19.3.1))(react@19.3.1)(supports-color@8.1.1)(svgo@3.3.5)(typescript@5.9.3) + '@docusaurus/logger': 3.10.2 + '@docusaurus/utils': 3.10.2(clean-css@5.3.3)(cssnano@6.1.2(postcss@8.5.32))(csso@5.0.5)(html-minifier-terser@7.2.0)(postcss@8.5.32)(react-dom@19.3.1(react@19.3.1))(react@19.3.1)(supports-color@8.1.1)(svgo@3.3.5) + '@docusaurus/utils-common': 3.10.2(clean-css@5.3.3)(cssnano@6.1.2(postcss@8.5.32))(csso@5.0.5)(html-minifier-terser@7.2.0)(postcss@8.5.32)(react-dom@19.3.1(react@19.3.1))(react@19.3.1)(supports-color@8.1.1)(svgo@3.3.5) + '@docusaurus/utils-validation': 3.10.2(clean-css@5.3.3)(cssnano@6.1.2(postcss@8.5.32))(csso@5.0.5)(html-minifier-terser@7.2.0)(postcss@8.5.32)(react-dom@19.3.1(react@19.3.1))(react@19.3.1)(supports-color@8.1.1)(svgo@3.3.5) + eta: 2.2.0 + fs-extra: 11.4.1 + lodash: 4.18.1 + react: 19.3.1 + react-dom: 19.3.1(react@19.3.1) + tslib: 2.9.1 + transitivePeerDependencies: + - '@docusaurus/faster' + - '@mdx-js/react' + - '@minify-html/node' + - '@napi-rs/image' + - '@parcel/css' + - '@rspack/core' + - '@swc/core' + - '@swc/css' + - '@swc/html' + - bufferutil + - clean-css + - cssnano + - csso + - debug + - esbuild + - html-minifier-terser + - imagemin + - lightningcss + - postcss + - sharp + - supports-color + - svgo + - typescript + - uglify-js + - utf-8-validate + - webpack-cli + '@docusaurus/plugin-content-blog@3.10.2(@docusaurus/plugin-content-docs@3.10.2(@mdx-js/react@3.1.1(@types/react@19.3.0)(react@19.3.1))(clean-css@5.3.3)(cssnano@6.1.2(postcss@8.5.32))(csso@5.0.5)(debug@4.4.3(supports-color@8.1.1))(html-minifier-terser@7.2.0)(postcss@8.5.32)(react-dom@19.3.1(react@19.3.1))(react@19.3.1)(supports-color@8.1.1)(svgo@3.3.5)(typescript@5.9.3))(@mdx-js/react@3.1.1(@types/react@19.3.0)(react@19.3.1))(clean-css@5.3.3)(cssnano@6.1.2(postcss@8.5.32))(csso@5.0.5)(debug@4.4.3(supports-color@8.1.1))(html-minifier-terser@7.2.0)(postcss@8.5.32)(react-dom@19.3.1(react@19.3.1))(react@19.3.1)(supports-color@8.1.1)(svgo@3.3.5)(typescript@5.9.3)': dependencies: '@docusaurus/core': 3.10.2(@mdx-js/react@3.1.1(@types/react@19.3.0)(react@19.3.1))(clean-css@5.3.3)(cssnano@6.1.2(postcss@8.5.32))(csso@5.0.5)(debug@4.4.3(supports-color@8.1.1))(html-minifier-terser@7.2.0)(postcss@8.5.32)(react-dom@19.3.1(react@19.3.1))(react@19.3.1)(supports-color@8.1.1)(svgo@3.3.5)(typescript@5.9.3) diff --git a/sidebars.ts b/sidebars.ts index f70e9d9..fb8a0fc 100644 --- a/sidebars.ts +++ b/sidebars.ts @@ -1,48 +1,48 @@ import type { SidebarsConfig } from "@docusaurus/plugin-content-docs"; -import apiSidebarModule from "./docs/rpc/sidebar"; +import apiSidebarModule from "./docs/sage/rpc/sidebar"; const sidebars: SidebarsConfig = { - sidebar: [ - { type: "doc", id: "index" }, - { type: "doc", id: "files" }, - { type: "doc", id: "config" }, + sage: [ + { type: "doc", id: "sage/index" }, + { type: "doc", id: "sage/files" }, + { type: "doc", id: "sage/config" }, { type: "category", label: "RPC", - items: [{ type: "doc", id: "rpc-setup" }, ...apiSidebarModule.slice(1)], + items: [ + apiSidebarModule[0], + { type: "doc", id: "sage/rpc-setup" }, + ...apiSidebarModule.slice(1), + ], }, + ], + sdk: [ + { type: "doc", id: "sdk/index", label: "Quick Start" }, + { type: "doc", id: "sdk/spend-context", label: "SpendContext" }, + { type: "doc", id: "sdk/actions", label: "Action System" }, + { type: "doc", id: "sdk/connectivity", label: "Connectivity" }, { type: "category", - label: "Wallet SDK", + label: "Primitives", items: [ - { type: "doc", id: "sdk/index", label: "Quick Start" }, - { type: "doc", id: "sdk/spend-context", label: "SpendContext" }, - { type: "doc", id: "sdk/actions", label: "Action System" }, - { type: "doc", id: "sdk/connectivity", label: "Connectivity" }, { - type: "category", - label: "Primitives", - items: [ - { - type: "doc", - id: "sdk/primitives/standard", - label: "Standard (XCH)", - }, - { type: "doc", id: "sdk/primitives/cat", label: "CAT" }, - { type: "doc", id: "sdk/primitives/nft", label: "NFT" }, - { - type: "doc", - id: "sdk/primitives/other", - label: "Other Primitives", - }, - ], + type: "doc", + id: "sdk/primitives/standard", + label: "Standard (XCH)", + }, + { type: "doc", id: "sdk/primitives/cat", label: "CAT" }, + { type: "doc", id: "sdk/primitives/nft", label: "NFT" }, + { + type: "doc", + id: "sdk/primitives/other", + label: "Other Primitives", }, - { type: "doc", id: "sdk/offers", label: "Offers" }, - { type: "doc", id: "sdk/testing", label: "Testing" }, - { type: "doc", id: "sdk/patterns", label: "Application Patterns" }, - { type: "doc", id: "sdk/troubleshooting", label: "Troubleshooting" }, ], }, + { type: "doc", id: "sdk/offers", label: "Offers" }, + { type: "doc", id: "sdk/testing", label: "Testing" }, + { type: "doc", id: "sdk/patterns", label: "Application Patterns" }, + { type: "doc", id: "sdk/troubleshooting", label: "Troubleshooting" }, ], }; diff --git a/src/pages/index.module.css b/src/pages/index.module.css index 9f71a5d..d7a2d7b 100644 --- a/src/pages/index.module.css +++ b/src/pages/index.module.css @@ -20,4 +20,6 @@ display: flex; align-items: center; justify-content: center; + flex-wrap: wrap; + gap: 1rem; } diff --git a/src/pages/index.tsx b/src/pages/index.tsx index e88e0af..f9a7845 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -20,9 +20,12 @@ function HomepageHeader() {