> ## 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.

# getInflationReward

> 返回一组地址在某个 epoch 的通胀奖励

## 参数

<ParamField query="addresses" type="array" required>
  要查询的地址数组，以 base-58 编码的字符串表示
</ParamField>

<ParamField query="config" type="object" optional>
  <Expandable title="config fields">
    <ParamField name="epoch" type="number" optional>
      奖励发生的 epoch。如果省略，将使用上一个 epoch
    </ParamField>

    <ParamField name="minContextSlot" type="number" optional>
      请求可被评估的最小 slot
    </ParamField>
  </Expandable>
</ParamField>

## 响应

<ResponseField name="result" type="array">
  <Expandable title="result elements">
    <ResponseField name="epoch" type="number">
      奖励发生的 epoch
    </ResponseField>

    <ResponseField name="effectiveSlot" type="number">
      奖励生效的 slot
    </ResponseField>

    <ResponseField name="amount" type="number">
      奖励金额（以 lamports 为单位）
    </ResponseField>

    <ResponseField name="postBalance" type="number">
      账户的奖励后余额（以 lamports 为单位）
    </ResponseField>

    <ResponseField name="commission" type="number | null">
      记入奖励时的投票账户佣金
    </ResponseField>
  </Expandable>
</ResponseField>

## 代码示例

### 基本请求

```bash theme={null}
curl http://fra.rpc.orbitflare.com?api_key=YOUR-API-KEY -X POST -H "Content-Type: application/json" -d '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getInflationReward",
  "params": [
    [
      "6dmNQ5jwLeLk5REvio1JcMshcbvkYMwy26sJ8pbkvStu",
      "BGsqMegLpV6n6Ve146sSX2dTjUMj3M92HnU8BbNRMhF2"
    ],
    {"epoch": 2}
  ]
}'
```

### 使用 web3.js

```typescript theme={null}
import { Connection } from '@solana/web3.js';

const connection = new Connection('http://fra.rpc.orbitflare.com?api_key=YOUR-API-KEY');
const addresses = [
  '6dmNQ5jwLeLk5REvio1JcMshcbvkYMwy26sJ8pbkvStu',
  'BGsqMegLpV6n6Ve146sSX2dTjUMj3M92HnU8BbNRMhF2'
];
const rewards = await connection.getInflationReward(addresses, 2);
console.log(rewards);
```

### 使用 Python

```python theme={null}
from solana.rpc.api import Client

client = Client("http://fra.rpc.orbitflare.com?api_key=YOUR-API-KEY")
addresses = [
    "6dmNQ5jwLeLk5REvio1JcMshcbvkYMwy26sJ8pbkvStu",
    "BGsqMegLpV6n6Ve146sSX2dTjUMj3M92HnU8BbNRMhF2"
]
response = client.get_inflation_reward(addresses, 2)
print(response)
```

## 注意事项

1. 返回一组地址的通胀奖励
2. 结果以与输入地址相同的顺序作为数组返回
3. 结果数组中的 null 值表示该地址未收到奖励
4. 佣金字段仅适用于验证者（普通账户为 null）
5. 奖励在每个 epoch 结束时计算

## 最佳实践

1. 提供有效地址列表以避免 null 响应
2. 如果需要历史奖励数据，请指定 epoch 参数
3. 适当处理响应数组中的 null 值
4. 使用此方法跟踪质押账户的奖励
5. 适当处理网络错误并重试
