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

# getInflationRate

> Возвращает текущий уровень инфляции сети

## Параметры

Этот метод не принимает никаких параметров.

## Ответ

<ResponseField name="result" type="object">
  <Expandable title="Поля результата">
    <ResponseField name="total" type="number">
      Общий уровень инфляции в процентах
    </ResponseField>

    <ResponseField name="validator" type="number">
      Уровень инфляции, выделяемый валидаторам, в процентах
    </ResponseField>

    <ResponseField name="foundation" type="number">
      Уровень инфляции, выделяемый фонду, в процентах
    </ResponseField>

    <ResponseField name="epoch" type="number">
      Текущий номер эпохи
    </ResponseField>
  </Expandable>
</ResponseField>

## Примеры кода

### Базовый запрос

```bash theme={null}
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": "getInflationRate"
}'
```

### Использование web3.js

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

const connection = new Connection('https://fra.rpc.orbitflare.com?api_key=YOUR-API-KEY');

// Get current inflation rate
const inflationRate = await connection.getInflationRate();
console.log('Total inflation:', inflationRate.total);
console.log('Validator inflation:', inflationRate.validator);
console.log('Foundation inflation:', inflationRate.foundation);
console.log('Current epoch:', inflationRate.epoch);

// Calculate staking APY
async function calculateStakingAPY(totalStaked: number, totalSupply: number) {
  const inflationRate = await connection.getInflationRate();
  const validatorAPY = (inflationRate.validator * totalSupply) / totalStaked;
  
  return {
    validatorAPY,
    totalInflation: inflationRate.total,
    validatorInflation: inflationRate.validator,
    foundationInflation: inflationRate.foundation,
    epoch: inflationRate.epoch
  };
}
```

## Примечания

1. Возвращает текущий уровень инфляции и его распределение
2. Общая инфляция разделена между валидаторами и фондом
3. Уровни инфляции выражены в процентах
4. Ответ приходит немедленно, так как читается из текущего состояния
5. Уровни инфляции могут меняться между эпохами

## Рекомендации

1. Используйте этот метод для понимания текущей инфляции сети
2. Кэшируйте результаты там, где это уместно, для снижения нагрузки на RPC
3. Учитывайте влияние инфляции на вознаграждения за стейкинг
4. Отслеживайте изменения в уровнях инфляции
5. Используйте совместно с другими методами, связанными с инфляцией

## Распространённые ошибки

| Код    | Сообщение                         | Решение                                                   |
| ------ | --------------------------------- | --------------------------------------------------------- |
| -32601 | Method not found                  | Убедитесь, что вы подключены к узлу Solana RPC            |
| -32007 | Inflation information unavailable | Узел может выполнять начальную загрузку или синхронизацию |

## Сценарии использования

1. **Отслеживание инфляции**
   ```typescript theme={null}
   interface InflationHistory {
     epoch: number;
     total: number;
     validator: number;
     foundation: number;
     timestamp: number;
   }

   async function trackInflationHistory(
     epochs: number = 10
   ): Promise<InflationHistory[]> {
     const history: InflationHistory[] = [];
     const currentEpoch = (await connection.getEpochInfo()).epoch;
     
     for (let i = 0; i < epochs; i++) {
       const epoch = currentEpoch - i;
       const inflationRate = await connection.getInflationRate();
       
       history.push({
         epoch: inflationRate.epoch,
         total: inflationRate.total,
         validator: inflationRate.validator,
         foundation: inflationRate.foundation,
         timestamp: Date.now()
       });
       
       // Add delay to avoid rate limiting
       await new Promise(resolve => setTimeout(resolve, 1000));
     }
     
     return history;
   }
   ```

2. **Анализ стейкинга**
   ```typescript theme={null}
   interface StakingMetrics {
     currentAPY: number;
     projectedAPY: number;
     totalStaked: number;
     totalSupply: number;
     inflationRate: number;
     validatorInflation: number;
   }

   async function analyzeStakingMetrics(): Promise<StakingMetrics> {
     const inflationRate = await connection.getInflationRate();
     const supply = await connection.getSupply();
     const voteAccounts = await connection.getVoteAccounts();
     
     const totalStaked = voteAccounts.current
       .concat(voteAccounts.delinquent)
       .reduce((sum, account) => sum + account.activatedStake, 0);
     
     const currentAPY = (inflationRate.validator * supply.value.total) / totalStaked;
     
     // Project future APY based on current trends
     const projectedAPY = currentAPY * 0.95; // Assuming 5% decrease
     
     return {
       currentAPY,
       projectedAPY,
       totalStaked,
       totalSupply: supply.value.total,
       inflationRate: inflationRate.total,
       validatorInflation: inflationRate.validator
     };
   }
   ```

3. **Оповещения об инфляции**
   ```typescript theme={null}
   interface InflationAlert {
     type: 'high' | 'low' | 'change';
     message: string;
     currentRate: number;
     previousRate: number;
     difference: number;
   }

   class InflationMonitor {
     private previousRate: number | null = null;
     private threshold: number;
     
     constructor(threshold: number = 0.01) {
       this.threshold = threshold;
     }
     
     async checkInflation(): Promise<InflationAlert[]> {
       const inflationRate = await connection.getInflationRate();
       const alerts: InflationAlert[] = [];
       
       if (this.previousRate !== null) {
         const difference = Math.abs(inflationRate.total - this.previousRate);
         
         if (difference > this.threshold) {
           alerts.push({
             type: 'change',
             message: `Inflation rate changed by ${difference.toFixed(4)}`,
             currentRate: inflationRate.total,
             previousRate: this.previousRate,
             difference
           });
         }
       }
       
       // Check for unusually high or low rates
       if (inflationRate.total > 0.08) { // 8% threshold
         alerts.push({
           type: 'high',
           message: `Inflation rate is unusually high: ${inflationRate.total}`,
           currentRate: inflationRate.total,
           previousRate: this.previousRate || inflationRate.total,
           difference: 0
         });
       }
       
       if (inflationRate.total < 0.01) { // 1% threshold
         alerts.push({
           type: 'low',
           message: `Inflation rate is unusually low: ${inflationRate.total}`,
           currentRate: inflationRate.total,
           previousRate: this.previousRate || inflationRate.total,
           difference: 0
         });
       }
       
       this.previousRate = inflationRate.total;
       return alerts;
     }
   }
   ```
