Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docs-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ jobs:
- uses: jdx/mise-action@v3
- run: mise run docs:format-spellcheck-dictionary-check
- run: mise run docs:lint
- run: pnpm build
- run: mise run docs:build
9 changes: 2 additions & 7 deletions .github/workflows/docs-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,8 @@ jobs:
working-directory: ./docs
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 20
package-manager-cache: false
- run: corepack enable
- run: pnpm i --frozen-lockfile
- run: pnpm build
- uses: jdx/mise-action@v3
- run: mise run docs:build

- name: Deploy
uses: cloudflare/wrangler-action@v3
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/docs-rpc-auto-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This workflow, run daily, updates the Forest RPC reference docs, and submits a PR with the changes.
name: Update Forest RPC reference docs

on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"

jobs:
update-docs:
runs-on: ubuntu-slim
Comment thread
LesnyRumcajs marked this conversation as resolved.
steps:
- uses: actions/checkout@v6
- name: Generate OpenRPC specifications
run: |
cd docs/scripts
./generate-openrpc-specs.sh docker
# This is needed in order to have the commits signed.
- uses: actions/create-github-app-token@v2
id: generate-token
with:
app-id: ${{ secrets.LESHY_APP_ID }}
private-key: ${{ secrets.LESHY_APP_PRIVATE_KEY }}
- name: Create Pull Request
uses: peter-evans/create-pull-request@v8
with:
base: main
branch: leshy/update-forest-rpc-docs
token: ${{ steps.generate-token.outputs.token }}
commit-message: Update Forest RPC reference docs
sign-commits: true
title: "[automated] Update Forest RPC reference docs"
add-paths: |
docs/openrpc-specs/
body: |
### Changes
- Updates Forest RPC reference docs to the latest commit in the `main` branch.
- Regenerates OpenRPC specifications (v0, v1, v2) from latest Forest code.
3 changes: 3 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
# Docusaurus Build Directory
/build/

# Generated RPC reference data
/src/data/rpc-methods.json

### Docusaurus.Node Stack ###
# Logs
logs
Expand Down
14 changes: 14 additions & 0 deletions docs/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# OpenRPC specification files (auto-generated from Forest)
openrpc-specs/

# Lock files
pnpm-lock.yaml
package-lock.json
yarn.lock

# Build output
build/
.docusaurus/

# Generated data
src/data/rpc-methods.json
4 changes: 0 additions & 4 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ Follows the [Diátaxis](https://diataxis.fr/) framework for structuring document

These docs are automatically generated from the Forest CLI. See [script](/docs/docs/users/reference/cli.sh).

#### JSON-RPC Docs

We use the OpenRPC document from Forest to populate the documentation for each method. For this we use `@metamask/docusaurus-openrpc`.

### Developer Docs

Available at `/developers`, source code is located in `docs/developers`. Comprised of a collection of documents aimed at contributors. May be relevant to power users.
Expand Down
8 changes: 8 additions & 0 deletions docs/docs/users/reference/json-rpc/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"label": "JSON-RPC",
"position": 4,
"link": {
"type": "generated-index",
"description": "Forest JSON-RPC API documentation including schema explorer and method reference."
}
}
30 changes: 30 additions & 0 deletions docs/docs/users/reference/json-rpc/methods.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
title: Methods Reference
sidebar_position: 2
---

import RPCReference from "@site/src/components/RPCReference";

# JSON-RPC Methods Reference

This page provides a comprehensive reference for all RPC methods supported by Forest across multiple API versions. You can search, filter by namespace, switch between API versions, and expand individual methods to see detailed parameter and return type information.

:::info

This reference is automatically generated from the OpenRPC specifications in the repository. For the interactive schema explorer, see the [Schema Explorer](./schema.mdx) page.

:::

## API Versions

Forest supports multiple RPC API versions:

- **V0** - Deprecated API
- **V1** - Stable API - Recommended for production use
- **V2** - Experimental API

Use the version selector to switch between versions and see the methods available in each.

---

<RPCReference />
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
---
title: JSON-RPC Overview
sidebar_position: 3
title: Overview
sidebar_position: 0
---

# JSON-RPC Overview

:::warning

This API is still a WIP, with more methods being added continuously.

:::

:::note

Need a specific method? Let us know on
Expand Down Expand Up @@ -39,7 +33,7 @@ An FIP to establish a canonical RPC API specification for general use [has been

## Connecting To A Node

By default, Forest exposes the RPC API on `localhost:2345`. See [CLI docs](./cli.md) for configuration options.
By default, Forest exposes the RPC API on `localhost:2345`. See [CLI docs](../cli.md) for configuration options.

### Authentication

Expand All @@ -49,7 +43,6 @@ Access control is implemented for certain methods. Levels of access include:
- Write
- Admin

Authentication is performed via [JWT Tokens](../knowledge_base/jwt_handling.md). When starting Forest use `--save-token
<FILE>` to store an `Admin` token,
Authentication is performed via [JWT Tokens](../../knowledge_base/jwt_handling.md). When starting Forest use `--save-token <FILE>` to store an `Admin` token,
otherwise the token will be printed in the logs during startup. With this token you can call the methods `AuthNew`
to generate additional tokens as needed.
103 changes: 103 additions & 0 deletions docs/docs/users/reference/json-rpc/schema.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
---
title: Schema Explorer
sidebar_position: 1
---

export const style = {
fontSize: "1.3em",
textDecoration: "underline",
};

export const versionStyle = {
display: "flex",
flexDirection: "column",
gap: "1rem",
marginBottom: "2rem",
};

export const versionCard = {
padding: "1rem",
border: "1px solid var(--ifm-color-emphasis-300)",
borderRadius: "8px",
backgroundColor: "var(--ifm-background-surface-color)",
};

# JSON-RPC Schema Explorer

Forest implements multiple API versions, each with its own OpenRPC specification. Use the interactive schema explorer to browse available methods, parameters, and return types for each version.

## API Versions

<div style={versionStyle}>
<div style={versionCard}>
<h3>RPC v0 API</h3>
<p>Deprecated API</p>
<a
href="https://playground.open-rpc.org/?uiSchema[appBar][ui:darkMode]=true&uiSchema[appBar][ui:examplesDropdown]=false&uiSchema[appBar][ui:splitView]=false&uiSchema[appBar][ui:input]=false&uiSchema[appBar][ui:title]=Forest%20RPC%20v0&schemaUrl=https://raw.githubusercontent.com/ChainSafe/forest/main/docs/openrpc-specs/v0.json"
target="_blank"
rel="noopener noreferrer"
style={style}
>
👉 View v0 Spec in Schema Explorer
</a>
<br />
<a
href="https://raw.githubusercontent.com/ChainSafe/forest/main/docs/openrpc-specs/v0.json"
target="_blank"
rel="noopener noreferrer"
>
📄 Raw v0 Spec (JSON)
</a>
</div>

<div style={versionCard}>
<h3>RPC v1 API</h3>
<p>Stable API - Recommended for production use</p>
<a
href="https://playground.open-rpc.org/?uiSchema[appBar][ui:darkMode]=true&uiSchema[appBar][ui:examplesDropdown]=false&uiSchema[appBar][ui:splitView]=false&uiSchema[appBar][ui:input]=false&uiSchema[appBar][ui:title]=Forest%20RPC%20v1&schemaUrl=https://raw.githubusercontent.com/ChainSafe/forest/main/docs/openrpc-specs/v1.json"
target="_blank"
rel="noopener noreferrer"
style={style}
>
👉 View v1 Spec in Schema Explorer
</a>
<br />
<a
href="https://raw.githubusercontent.com/ChainSafe/forest/main/docs/openrpc-specs/v1.json"
target="_blank"
rel="noopener noreferrer"
>
📄 Raw v1 Spec (JSON)
</a>
</div>

<div style={versionCard}>
<h3>RPC v2 API</h3>
<p>Experimental API</p>
<a
href="https://playground.open-rpc.org/?uiSchema[appBar][ui:darkMode]=true&uiSchema[appBar][ui:examplesDropdown]=false&uiSchema[appBar][ui:splitView]=false&uiSchema[appBar][ui:input]=false&uiSchema[appBar][ui:title]=Forest%20RPC%20v2&schemaUrl=https://raw.githubusercontent.com/ChainSafe/forest/main/docs/openrpc-specs/v2.json"
target="_blank"
rel="noopener noreferrer"
style={style}
>
👉 View v2 Spec in Schema Explorer
</a>
<br />
<a
href="https://raw.githubusercontent.com/ChainSafe/forest/main/docs/openrpc-specs/v2.json"
target="_blank"
rel="noopener noreferrer"
>
📄 Raw v2 Spec (JSON)
Comment thread
LesnyRumcajs marked this conversation as resolved.
</a>
</div>
</div>

:::tip
For a searchable, filterable reference of all RPC methods, see the [Methods Reference](./methods.mdx) page.
:::

#### References

- [OpenRPC Specification](https://spec.open-rpc.org/)
- [JSON Schema](https://json-schema.org/)
23 changes: 0 additions & 23 deletions docs/docs/users/reference/json_rpc.mdx

This file was deleted.

Loading
Loading