near-jsonrpc-skill
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseNEAR JSON-RPC Skill
NEAR JSON-RPC Skill
Use this skill to run NEAR JSON-RPC operations through + JSON-RPC.
uxcReuse the skill for shared execution and error-handling guidance.
uxc使用本技能通过 + JSON-RPC执行NEAR JSON-RPC操作。
uxc复用技能以获得共享执行逻辑和错误处理指引。
uxcPrerequisites
前提条件
- is installed and available in
uxc.PATH - Network access to a working NEAR RPC provider.
- This skill defaults to , which is listed on the official NEAR RPC providers page.
https://free.rpc.fastnear.com - Access to the curated NEAR OpenRPC schema URL:
https://raw.githubusercontent.com/holon-run/uxc/main/skills/near-jsonrpc-skill/references/near-public.openrpc.json
- 已安装且其路径已添加至
uxc环境变量。PATH - 能够访问可用的NEAR RPC提供商网络。
- 本技能默认使用,该提供商已列入NEAR官方RPC提供商页面。
https://free.rpc.fastnear.com - 能够访问经过整理的NEAR OpenRPC schema URL:
https://raw.githubusercontent.com/holon-run/uxc/main/skills/near-jsonrpc-skill/references/near-public.openrpc.json
Scope
适用范围
This skill covers a safe read-first NEAR RPC surface:
- chain status
- account state query
- finalized block lookup
- chunk lookup by chunk hash
- gas price lookup
- validator set lookup
This skill does not cover:
- transaction submission methods
- signing or wallet flows
- archival assumptions for very old blocks or chunks
- deprecated or
near.orgpublic RPC endpointspagoda.co
本技能覆盖NEAR RPC的安全只读操作范围:
- 链状态查询
- 账户状态查询
- 最终区块查询
- 按区块哈希查询chunk
- 燃气价格查询
- 验证者集合查询
本技能不包含以下内容:
- 交易提交方法
- 签名或钱包流程
- 对极旧区块或chunk的归档查询
- 已废弃的或
near.org公共RPC端点pagoda.co
Endpoint And Schema
端点与Schema
This skill uses the public FastNear mainnet RPC by default:
https://free.rpc.fastnear.com
The operation surface comes from the curated NEAR OpenRPC schema in this repo:
https://raw.githubusercontent.com/holon-run/uxc/main/skills/near-jsonrpc-skill/references/near-public.openrpc.json
uxcrpc.discover--schema-urlThe official NEAR docs now treat and RPC endpoints as deprecated. Do not use those old hosts as the default for new automation.
near.orgpagoda.coIf 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.
本技能默认使用FastNear公共主网RPC:
https://free.rpc.fastnear.com
操作范围来自本仓库中经过整理的NEAR OpenRPC schema:
https://raw.githubusercontent.com/holon-run/uxc/main/skills/near-jsonrpc-skill/references/near-public.openrpc.json
uxcrpc.discover--schema-urlNEAR官方文档现已将和 RPC端点标记为废弃。请勿将这些旧主机作为新自动化流程的默认选择。
near.orgpagoda.co如果用户已从NEAR官方提供商页面选定了偏好的提供商,请重新关联命令至该提供商,而非复用已废弃的端点。
Authentication
认证
The default FastNear public RPC used by this skill does not require authentication.
If the user switches to a private NEAR provider, verify its auth model before reusing this skill unchanged.
本技能使用的默认FastNear公共RPC无需认证。
如果用户切换至私有NEAR提供商,在未修改本技能的情况下复用前,请确认其认证模型。
Core Workflow
核心工作流程
-
Use the fixed link command by default:
command -v near-jsonrpc-cli- If missing, create it:
uxc link near-jsonrpc-cli https://free.rpc.fastnear.com --schema-url https://raw.githubusercontent.com/holon-run/uxc/main/skills/near-jsonrpc-skill/references/near-public.openrpc.json near-jsonrpc-cli -h
-
Inspect operation help first, then run known read methods:
near-jsonrpc-cli -hnear-jsonrpc-cli query -hnear-jsonrpc-cli gas_price -hnear-jsonrpc-cli statusnear-jsonrpc-cli gas_price --input-json '{"block_id":null}'
-
Prefer narrow validation before deeper queries:
near-jsonrpc-cli statusnear-jsonrpc-cli block '{"finality":"final"}'near-jsonrpc-cli query '{"request_type":"view_account","finality":"final","account_id":"near"}'
-
Use object JSON for request objects, andwhen a method expects positional null/default params:
--input-json- object request:
near-jsonrpc-cli chunk '{"chunk_id":"75cewvnKFLrJshoUft1tiUC9GriuxWTc4bWezjy2MoPR"}' - positional null/default encoded from an object payload:
near-jsonrpc-cli gas_price --input-json '{"block_id":null}'near-jsonrpc-cli validators --input-json '{"epoch_reference":null}'
- object request:
-
默认使用固定关联命令:
command -v near-jsonrpc-cli- 若该命令不存在,则创建:
uxc link near-jsonrpc-cli https://free.rpc.fastnear.com --schema-url https://raw.githubusercontent.com/holon-run/uxc/main/skills/near-jsonrpc-skill/references/near-public.openrpc.json near-jsonrpc-cli -h
-
先查看操作帮助,再运行已知的只读方法:
near-jsonrpc-cli -hnear-jsonrpc-cli query -hnear-jsonrpc-cli gas_price -hnear-jsonrpc-cli statusnear-jsonrpc-cli gas_price --input-json '{"block_id":null}'
-
在执行深度查询前优先进行窄范围验证:
near-jsonrpc-cli statusnear-jsonrpc-cli block '{"finality":"final"}'near-jsonrpc-cli query '{"request_type":"view_account","finality":"final","account_id":"near"}'
-
请求对象使用JSON格式,当方法需要位置参数为null或默认值时,使用:
--input-json- 对象请求示例:
near-jsonrpc-cli chunk '{"chunk_id":"75cewvnKFLrJshoUft1tiUC9GriuxWTc4bWezjy2MoPR"}' - 从对象负载编码位置参数为null/默认值的示例:
near-jsonrpc-cli gas_price --input-json '{"block_id":null}'near-jsonrpc-cli validators --input-json '{"epoch_reference":null}'
- 对象请求示例:
Recommended Read Operations
推荐只读操作
statusqueryblockchunkgas_pricevalidators
statusqueryblockchunkgas_pricevalidators
Guardrails
防护机制
- Keep automation on the JSON output envelope; do not use .
--text - Parse stable fields first: ,
ok,kind,protocol,data.error - Stay on the read-only method surface by default.
- The fixed schema is required because FastNear is not directly discoverable by UXC; do not drop from the linked command unless the provider proves it exposes usable OpenRPC or
--schema-url.rpc.discover - Do not use this skill for transaction submission, signing, or wallet-authenticated flows.
- The official NEAR docs mark the old and
near.orgpublic RPC endpoints as deprecated. Prefer providers from the official RPC providers page instead.pagoda.co - Public providers can differ in archival retention and rate limits. If or older
chunklookups fail with unknown or garbage-collected errors, switch to a provider that explicitly supports the needed history.block - For methods such as and
gas_pricethat expect positional params, usevalidatorsinstead of array payloads; UXC CLI positional JSON accepts objects, not arrays.--input-json '{"...":null}' - is equivalent to
near-jsonrpc-cli <operation> ....uxc https://free.rpc.fastnear.com --schema-url <near_openrpc_schema> <operation> ...
- 自动化流程应使用JSON输出格式;请勿使用参数。
--text - 优先解析稳定字段:、
ok、kind、protocol、data。error - 默认仅使用只读方法接口。
- 由于FastNear无法被UXC直接发现,因此必须使用固定schema;除非提供商证明其暴露了可用的OpenRPC或接口,否则请勿从关联命令中移除
rpc.discover参数。--schema-url - 请勿使用本技能进行交易提交、签名或钱包认证流程。
- NEAR官方文档已将旧的和
near.org公共RPC端点标记为废弃。请优先选择官方RPC提供商页面中的提供商。pagoda.co - 不同公共提供商的归档保留时长和速率限制可能不同。如果或旧
chunk查询因未知或垃圾回收错误失败,请切换至明确支持所需历史数据的提供商。block - 对于和
gas_price等需要位置参数的方法,请使用validators而非数组负载;UXC CLI的位置参数JSON仅接受对象,不接受数组。--input-json '{"...":null}' - 等价于
near-jsonrpc-cli <operation> ...。uxc https://free.rpc.fastnear.com --schema-url <near_openrpc_schema> <operation> ...
References
参考资料
- Usage patterns:
references/usage-patterns.md - Curated OpenRPC schema:
references/near-public.openrpc.json - NEAR RPC introduction: https://docs.near.org/api/rpc/introduction
- NEAR RPC providers: https://docs.near.org/api/rpc/providers
- 使用模式:
references/usage-patterns.md - 整理后的OpenRPC schema:
references/near-public.openrpc.json - NEAR RPC介绍:https://docs.near.org/api/rpc/introduction
- NEAR RPC提供商:https://docs.near.org/api/rpc/providers