Skip to content

Commit 62766c8

Browse files
committed
Website: add RPC API documentation with CI validation
Add comprehensive documentation for the Mina Rust node's HTTP RPC endpoints, separate from the GraphQL API: - Create new api-and-data section and reorganize existing API documentation - Add RPC API reference page with all endpoint documentation - Add curl scripts for each RPC endpoint (17 scripts) - Add CI workflow to validate RPC endpoints against O1Labs node - Add rustdoc comments to RPC response structs in Rust code - Link documentation to Rust API docs for response structures - Fix broken links after documentation reorganization Closes #1743
1 parent 2dd8590 commit 62766c8

File tree

103 files changed

+1184
-46
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+1184
-46
lines changed

.github/scripts/test-block-producer-node-capabilities.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ for node_url in $bp_nodes; do
2222

2323
# Test network ID query using website script
2424
network_success=false
25-
if network_response=$(bash website/docs/developers/scripts/graphql-api/queries/curl/network-id.sh "$graphql_url" 2>&1); then
25+
if network_response=$(bash website/docs/developers/api-and-data/scripts/graphql-api/queries/curl/network-id.sh "$graphql_url" 2>&1); then
2626
if echo "$network_response" | jq -e '.data.networkID' > /dev/null 2>&1; then
2727
network_id=$(echo "$network_response" | jq -r '.data.networkID')
2828
echo "✅ Network ID query successful: $network_id"
@@ -36,7 +36,7 @@ for node_url in $bp_nodes; do
3636

3737
# Test best chain query using website script
3838
chain_success=false
39-
if chain_response=$(bash website/docs/developers/scripts/graphql-api/queries/curl/best-chain.sh "$graphql_url" 2>&1); then
39+
if chain_response=$(bash website/docs/developers/api-and-data/scripts/graphql-api/queries/curl/best-chain.sh "$graphql_url" 2>&1); then
4040
if echo "$chain_response" | jq -e '.data.bestChain[0].stateHash' > /dev/null 2>&1; then
4141
state_hash=$(echo "$chain_response" | jq -r '.data.bestChain[0].stateHash')
4242
echo "✅ Best chain query successful: ${state_hash:0:16}..."

.github/scripts/test-block-producer-node-connectivity.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ for node_url in $bp_nodes; do
3737
graphql_url="${node_url}graphql"
3838

3939
# Test daemon status query using the website script
40-
if response=$(bash website/docs/developers/scripts/graphql-api/queries/curl/daemon-status.sh "$graphql_url" 2>&1); then
40+
if response=$(bash website/docs/developers/api-and-data/scripts/graphql-api/queries/curl/daemon-status.sh "$graphql_url" 2>&1); then
4141
# Check if it's valid JSON
4242
if echo "$response" | jq . > /dev/null 2>&1; then
4343
# Check for GraphQL errors

.github/scripts/test-cli-graphql-commands.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ MINA_DIR="$(dirname "${MINA_BIN}")"
1414
export PATH="${MINA_DIR}:${PATH}"
1515

1616
SCRIPT_DIR="website/docs/developers/scripts/cli"
17-
QUERY_FILE="website/docs/developers/scripts/graphql-api/queries/query/sync-status.graphql"
17+
QUERY_FILE="website/docs/developers/api-and-data/scripts/graphql-api/queries/query/sync-status.graphql"
1818
GRAPHQL_NODE="${GRAPHQL_NODE:-https://mina-rust-plain-3.gcp.o1test.net/graphql}"
1919

2020
echo "Testing that 'mina internal graphql' commands are available..."

.github/scripts/test-graphql-api-local.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ echo ""
3232
# Test 1: Script and query file consistency
3333
echo "🔍 Testing consistency between bash scripts and GraphQL query files..."
3434

35-
script_dir="website/docs/developers/scripts/graphql-api/queries/curl"
36-
query_dir="website/docs/developers/scripts/graphql-api/queries/query"
35+
script_dir="website/docs/developers/api-and-data/scripts/graphql-api/queries/curl"
36+
query_dir="website/docs/developers/api-and-data/scripts/graphql-api/queries/query"
3737

3838
inconsistent=0
3939

@@ -88,7 +88,7 @@ echo ""
8888
echo "🔍 Testing GraphQL API command scripts..."
8989

9090
# Dynamically discover all bash scripts in the queries/curl directory (only test queries, not mutations)
91-
script_dir="website/docs/developers/scripts/graphql-api/queries/curl"
91+
script_dir="website/docs/developers/api-and-data/scripts/graphql-api/queries/curl"
9292

9393
if [ ! -d "$script_dir" ]; then
9494
echo "❌ Script directory not found: $script_dir"

.github/scripts/test-graphql-command-scripts.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ fi
2222
echo "🔍 Testing GraphQL API command scripts..."
2323

2424
# Dynamically discover all bash scripts in the queries/curl directory (only test queries, not mutations)
25-
script_dir="website/docs/developers/scripts/graphql-api/queries/curl"
25+
script_dir="website/docs/developers/api-and-data/scripts/graphql-api/queries/curl"
2626

2727
if [ ! -d "$script_dir" ]; then
2828
echo "❌ Script directory not found: $script_dir"

.github/scripts/test-plain-node-capabilities.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ for node_url in $plain_nodes; do
2222

2323
# Test network ID query using website script
2424
network_success=false
25-
if network_response=$(bash website/docs/developers/scripts/graphql-api/queries/curl/network-id.sh "$graphql_url" 2>&1); then
25+
if network_response=$(bash website/docs/developers/api-and-data/scripts/graphql-api/queries/curl/network-id.sh "$graphql_url" 2>&1); then
2626
if echo "$network_response" | jq -e '.data.networkID' > /dev/null 2>&1; then
2727
network_id=$(echo "$network_response" | jq -r '.data.networkID')
2828
echo "✅ Network ID query successful: $network_id"
@@ -36,7 +36,7 @@ for node_url in $plain_nodes; do
3636

3737
# Test best chain query using website script
3838
chain_success=false
39-
if chain_response=$(bash website/docs/developers/scripts/graphql-api/queries/curl/best-chain.sh "$graphql_url" 2>&1); then
39+
if chain_response=$(bash website/docs/developers/api-and-data/scripts/graphql-api/queries/curl/best-chain.sh "$graphql_url" 2>&1); then
4040
if echo "$chain_response" | jq -e '.data.bestChain[0].stateHash' > /dev/null 2>&1; then
4141
state_hash=$(echo "$chain_response" | jq -r '.data.bestChain[0].stateHash')
4242
echo "✅ Best chain query successful: ${state_hash:0:16}..."

.github/scripts/test-plain-node-connectivity.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ for node_url in $plain_nodes; do
3737
graphql_url="${node_url}graphql"
3838

3939
# Test daemon status query using the website script
40-
if response=$(bash website/docs/developers/scripts/graphql-api/queries/curl/daemon-status.sh "$graphql_url" 2>&1); then
40+
if response=$(bash website/docs/developers/api-and-data/scripts/graphql-api/queries/curl/daemon-status.sh "$graphql_url" 2>&1); then
4141
# Check if it's valid JSON
4242
if echo "$response" | jq . > /dev/null 2>&1; then
4343
# Check for GraphQL errors
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
# Test /accounts endpoint
4+
# Usage: $0 [RPC_ENDPOINT]
5+
6+
set -e
7+
8+
RPC_ENDPOINT="${1:-http://mina-rust-plain-3.gcp.o1test.net}"
9+
10+
echo "Testing /accounts endpoint..."
11+
response=$(website/docs/developers/api-and-data/scripts/rpc-api/curl/accounts.sh "$RPC_ENDPOINT")
12+
if echo "$response" | jq -e 'type == "array"' > /dev/null 2>&1; then
13+
account_count=$(echo "$response" | jq 'length')
14+
echo "Accounts: $account_count accounts"
15+
else
16+
echo "Accounts: FAILED - response is not an array"
17+
echo "Response: $response"
18+
exit 1
19+
fi
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
# Test /build_env endpoint
4+
# Usage: $0 [RPC_ENDPOINT]
5+
6+
set -e
7+
8+
RPC_ENDPOINT="${1:-http://mina-rust-plain-3.gcp.o1test.net}"
9+
10+
echo "Testing /build_env endpoint..."
11+
response=$(website/docs/developers/api-and-data/scripts/rpc-api/curl/build-env.sh "$RPC_ENDPOINT")
12+
echo "Response: $response"
13+
if echo "$response" | jq -e '.git.commit_hash' > /dev/null 2>&1; then
14+
commit_hash=$(echo "$response" | jq -r '.git.commit_hash')
15+
echo "Build env: commit_hash = $commit_hash"
16+
else
17+
echo "Build env: FAILED - no git.commit_hash in response"
18+
exit 1
19+
fi
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
# Test /discovery/bootstrap_stats endpoint
4+
# Usage: $0 [RPC_ENDPOINT]
5+
6+
set -e
7+
8+
RPC_ENDPOINT="${1:-http://mina-rust-plain-3.gcp.o1test.net}"
9+
10+
echo "Testing /discovery/bootstrap_stats endpoint..."
11+
response=$(website/docs/developers/api-and-data/scripts/rpc-api/curl/discovery-bootstrap-stats.sh "$RPC_ENDPOINT")
12+
if [ "$response" = "null" ]; then
13+
echo "Bootstrap stats: null (bootstrap complete or not started)"
14+
else
15+
echo "Bootstrap stats: available"
16+
echo "Response: $response"
17+
fi

0 commit comments

Comments
 (0)