Documentation Index
Fetch the complete documentation index at: https://docs.orbitflare.com/llms.txt
Use this file to discover all available pages before exploring further.
包含以下可选字段的配置对象:
交易数据的编码格式:
json - JSON 格式
jsonParsed - 带有解析交易数据的 JSON 格式
base58 - base-58 编码的二进制数据
base64 - base-64 编码的二进制数据
返回的交易详情级别:
full - 完整交易数据
signatures - 仅交易签名
none - 不包含交易数据
要查询的银行状态:
processed:最新区块(未确认)
confirmed:超级多数确认
finalized:超级多数最终确认
maxSupportedTransactionVersion
响应中返回的最大交易版本
如果未找到区块,返回 null。否则返回包含以下内容的对象:
上一个区块的 blockhash(base-58)
交易信息数组(如果 transactionDetails != “none”):
- 对于
full:完整的交易对象
- 对于
signatures:仅交易签名
奖励对象数组(如果 rewards = true):
pubkey: string - 公钥(base-58)
lamports: number - 奖励 lamports 数量
postBalance: number - 奖励后的账户余额
rewardType: string - 奖励类型
commission: number - 投票账户佣金(仅投票类型)
代码示例
基本请求
curl https://fra.rpc.orbitflare.com?api_key=YOUR-API-KEY -X POST -H "Content-Type: application/json" -d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getBlock",
"params": [
430,
{
"encoding": "json",
"transactionDetails": "full",
"rewards": true
}
]
}'
带解析交易数据的请求
curl https://fra.rpc.orbitflare.com?api_key=YOUR-API-KEY -X POST -H "Content-Type: application/json" -d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getBlock",
"params": [
430,
{
"encoding": "jsonParsed",
"transactionDetails": "full",
"rewards": true,
"maxSupportedTransactionVersion": 0
}
]
}'
使用 web3.js
import { Connection } from '@solana/web3.js';
const connection = new Connection('https://fra.rpc.orbitflare.com?api_key=YOUR-API-KEY');
const slot = 430;
const block = await connection.getBlock(
slot,
{
maxSupportedTransactionVersion: 0
}
);
注意事项
- 区块生产时间是基于创世区块时间和已经过的 slot 的估计值。
- 并非所有区块都包含奖励。
jsonParsed 编码会尝试根据已知的程序布局解析交易指令数据。
- 某些区块可能被跳过(未分配领导者或区块生产失败)。
- 区块数据可能会根据账本配置从节点中被修剪。
最佳实践
- 如果只需要交易签名,请使用
transactionDetails: "signatures"。
- 如果不需要奖励数据,请设置
rewards: false。
- 如果需要最新区块,请考虑先使用
getBlockHeight。
- 对于实时更新,请考虑使用 WebSocket 订阅。
常见错误
| 错误码 | 消息 | 解决方案 |
|---|
| -32004 | Block not available for slot | 区块已被修剪或跳过 |
| -32602 | Invalid param: WrongSize | 验证 slot 编号是否有效 |
| -32602 | Invalid param: Too large | 请求一个更近期的区块 |
| -32009 | Transaction version unsupported | 指定 maxSupportedTransactionVersion |