|
| 1 | +--- |
| 2 | +name: near-jsonrpc-skill |
| 3 | +description: Operate NEAR JSON-RPC reads through UXC with a public provider default, provider-override guidance, and read-only guardrails. |
| 4 | +--- |
| 5 | + |
| 6 | +# NEAR JSON-RPC Skill |
| 7 | + |
| 8 | +Use this skill to run NEAR JSON-RPC operations through `uxc` + JSON-RPC. |
| 9 | + |
| 10 | +Reuse the `uxc` skill for shared execution and error-handling guidance. |
| 11 | + |
| 12 | +## Prerequisites |
| 13 | + |
| 14 | +- `uxc` is installed and available in `PATH`. |
| 15 | +- Network access to a working NEAR RPC provider. |
| 16 | +- This skill defaults to `https://free.rpc.fastnear.com`, which is listed on the official NEAR RPC providers page. |
| 17 | + |
| 18 | +## Scope |
| 19 | + |
| 20 | +This skill covers a safe read-first NEAR RPC surface: |
| 21 | + |
| 22 | +- chain status |
| 23 | +- account state query |
| 24 | +- finalized block lookup |
| 25 | +- chunk lookup by chunk hash |
| 26 | +- gas price lookup |
| 27 | +- validator set lookup |
| 28 | + |
| 29 | +This skill does **not** cover: |
| 30 | + |
| 31 | +- transaction submission methods |
| 32 | +- signing or wallet flows |
| 33 | +- archival assumptions for very old blocks or chunks |
| 34 | +- deprecated `near.org` or `pagoda.co` public RPC endpoints |
| 35 | + |
| 36 | +## Endpoint And Provider Choice |
| 37 | + |
| 38 | +This skill uses the public FastNear mainnet RPC by default: |
| 39 | + |
| 40 | +- `https://free.rpc.fastnear.com` |
| 41 | + |
| 42 | +The official NEAR docs now treat `near.org` and `pagoda.co` RPC endpoints as deprecated. Do not use those old hosts as the default for new automation. |
| 43 | + |
| 44 | +If the user already has a preferred provider from the official NEAR providers page, relink the same command to that provider instead of reusing the deprecated endpoints. |
| 45 | + |
| 46 | +## Authentication |
| 47 | + |
| 48 | +The default FastNear public RPC used by this skill does not require authentication. |
| 49 | + |
| 50 | +If the user switches to a private NEAR provider, verify its auth model before reusing this skill unchanged. |
| 51 | + |
| 52 | +## Core Workflow |
| 53 | + |
| 54 | +1. Use the fixed link command by default: |
| 55 | + - `command -v near-jsonrpc-cli` |
| 56 | + - If missing, create it: |
| 57 | + `uxc link near-jsonrpc-cli https://free.rpc.fastnear.com` |
| 58 | + - `near-jsonrpc-cli -h` |
| 59 | + |
| 60 | +2. Inspect host help first, then run known read methods: |
| 61 | + - `near-jsonrpc-cli -h` |
| 62 | + - `near-jsonrpc-cli status` |
| 63 | + - `near-jsonrpc-cli gas_price '[null]'` |
| 64 | + |
| 65 | +3. Prefer narrow validation before deeper queries: |
| 66 | + - `near-jsonrpc-cli status` |
| 67 | + - `near-jsonrpc-cli block '{"finality":"final"}'` |
| 68 | + - `near-jsonrpc-cli query '{"request_type":"view_account","finality":"final","account_id":"near"}'` |
| 69 | + |
| 70 | +4. Execute with positional JSON for structured params: |
| 71 | + - `near-jsonrpc-cli gas_price '[null]'` |
| 72 | + - `near-jsonrpc-cli validators '[null]'` |
| 73 | + - `near-jsonrpc-cli chunk '{"chunk_id":"75cewvnKFLrJshoUft1tiUC9GriuxWTc4bWezjy2MoPR"}'` |
| 74 | + |
| 75 | +## Recommended Read Operations |
| 76 | + |
| 77 | +- `status` |
| 78 | +- `query` |
| 79 | +- `block` |
| 80 | +- `chunk` |
| 81 | +- `gas_price` |
| 82 | +- `validators` |
| 83 | + |
| 84 | +## Guardrails |
| 85 | + |
| 86 | +- Keep automation on the JSON output envelope; do not use `--text`. |
| 87 | +- Parse stable fields first: `ok`, `kind`, `protocol`, `data`, `error`. |
| 88 | +- Stay on the read-only method surface by default. |
| 89 | +- Do not use this skill for transaction submission, signing, or wallet-authenticated flows. |
| 90 | +- The official NEAR docs mark the old `near.org` and `pagoda.co` public RPC endpoints as deprecated. Prefer providers from the official RPC providers page instead. |
| 91 | +- Public providers can differ in archival retention and rate limits. If `chunk` or older `block` lookups fail with unknown or garbage-collected errors, switch to a provider that explicitly supports the needed history. |
| 92 | +- `near-jsonrpc-cli <operation> ...` is equivalent to `uxc https://free.rpc.fastnear.com <operation> ...`. |
| 93 | + |
| 94 | +## References |
| 95 | + |
| 96 | +- Usage patterns: `references/usage-patterns.md` |
| 97 | +- NEAR RPC introduction: https://docs.near.org/api/rpc/introduction |
| 98 | +- NEAR RPC providers: https://docs.near.org/api/rpc/providers |
0 commit comments