Skip to content

Commit 7f7db12

Browse files
committed
Using different examples than those used with plain nodes
1 parent a287934 commit 7f7db12

File tree

5 files changed

+53
-18
lines changed

5 files changed

+53
-18
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ bestChain(maxLength: 1) { stateHash protocolState { consensusState { blockHeight } } creator } }
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ bestChain(maxLength: 1) { transactions { userCommands { amount fee from to } } } }
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
# Usage: $0 GRAPHQL_ENDPOINT
3+
# GRAPHQL_ENDPOINT: GraphQL endpoint URL (required, must end with /graphql)
4+
# Example: https://mina-rust-bp-1.gcp.o1test.net/graphql
5+
6+
if [ -z "$1" ]; then
7+
echo "Error: GRAPHQL_ENDPOINT is required"
8+
echo "Usage: $0 GRAPHQL_ENDPOINT"
9+
exit 1
10+
fi
11+
12+
GRAPHQL_ENDPOINT="$1"
13+
14+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
15+
# Read the query and create JSON payload using jq for proper escaping
16+
QUERY=$(< "$SCRIPT_DIR/queries/best-chain-block.graphql")
17+
JSON_PAYLOAD=$(echo "{}" | jq --arg query "$QUERY" '.query = $query')
18+
curl -s -X POST "$GRAPHQL_ENDPOINT" \
19+
-H "Content-Type: application/json" \
20+
-d "$JSON_PAYLOAD"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
# Usage: $0 GRAPHQL_ENDPOINT
3+
# GRAPHQL_ENDPOINT: GraphQL endpoint URL (required, must end with /graphql)
4+
# Example: https://mina-rust-bp-1.gcp.o1test.net/graphql
5+
6+
if [ -z "$1" ]; then
7+
echo "Error: GRAPHQL_ENDPOINT is required"
8+
echo "Usage: $0 GRAPHQL_ENDPOINT"
9+
exit 1
10+
fi
11+
12+
GRAPHQL_ENDPOINT="$1"
13+
14+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
15+
# Read the query and create JSON payload using jq for proper escaping
16+
QUERY=$(< "$SCRIPT_DIR/queries/best-chain-transactions.graphql")
17+
JSON_PAYLOAD=$(echo "{}" | jq --arg query "$QUERY" '.query = $query')
18+
curl -s -X POST "$GRAPHQL_ENDPOINT" \
19+
-H "Content-Type: application/json" \
20+
-d "$JSON_PAYLOAD"

website/docs/node-operators/infrastructure/block-producers.mdx

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ sidebar_position: 5
66

77
import CodeBlock from "@theme/CodeBlock";
88
import BlockProducerNodesList from "!!raw-loader!../../developers/scripts/infrastructure/block-producer-nodes.txt";
9-
import QueryDaemonStatus from "!!raw-loader!../../developers/scripts/infrastructure/query-daemon-status.sh";
10-
import QueryBlockHeight from "!!raw-loader!../../developers/scripts/infrastructure/query-block-height.sh";
11-
import QueryPeers from "!!raw-loader!../../developers/scripts/infrastructure/query-peers.sh";
9+
import QueryBestChainBlock from "!!raw-loader!../../developers/scripts/infrastructure/query-best-chain-block.sh";
10+
import QueryBestChainTransactions from "!!raw-loader!../../developers/scripts/infrastructure/query-best-chain-transactions.sh";
1211
import TestGraphQLEndpoint from "!!raw-loader!../../developers/scripts/infrastructure/test-graphql-endpoint.sh";
1312

1413
# Block Producers
@@ -37,33 +36,27 @@ The following block producer nodes are officially maintained by o1Labs:
3736

3837
## Using Block Producer Nodes
3938

40-
### GraphQL API Access
39+
### Latest canonical block information
4140

42-
Block producer nodes provide GraphQL API endpoints for querying network state:
41+
Query the latest canonical block to get block height, state hash, and block
42+
creator:
4343

4444
<CodeBlock
4545
language="bash"
46-
title="website/docs/developers/scripts/infrastructure/query-daemon-status.sh"
46+
title="website/docs/developers/scripts/infrastructure/query-best-chain-block.sh"
4747
>
48-
{QueryDaemonStatus}
48+
{QueryBestChainBlock}
4949
</CodeBlock>
5050

51-
### Network Information
51+
### Transaction information
5252

53-
You can query various network information:
53+
Check transactions in the latest block:
5454

5555
<CodeBlock
5656
language="bash"
57-
title="website/docs/developers/scripts/infrastructure/query-block-height.sh"
57+
title="website/docs/developers/scripts/infrastructure/query-best-chain-transactions.sh"
5858
>
59-
{QueryBlockHeight}
60-
</CodeBlock>
61-
62-
<CodeBlock
63-
language="bash"
64-
title="website/docs/developers/scripts/infrastructure/query-peers.sh"
65-
>
66-
{QueryPeers}
59+
{QueryBestChainTransactions}
6760
</CodeBlock>
6861

6962
## API Capabilities

0 commit comments

Comments
 (0)