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

# getBlocksWithLimit

> Verilen slottan itibaren onaylanmış blokların listesini döndürür

## Parametreler

<ParamField query="startSlot" type="number" required>
  Başlangıç slotu (dahil)
</ParamField>

<ParamField query="limit" type="number" required>
  Döndürülecek maksimum blok sayısı
</ParamField>

<ParamField query="config" type="object" optional>
  Aşağıdaki isteğe bağlı alanları içeren yapılandırma nesnesi:

  <Expandable title="config fields">
    <ParamField query="commitment" type="string" optional>
      Kullanılacak onay seviyesi:

      * `processed`: En son blok (onaylanmamış)
      * `confirmed`: Süper çoğunluk tarafından onaylanmış
      * `finalized`: Süper çoğunluk tarafından sonuçlandırılmış
    </ParamField>
  </Expandable>
</ParamField>

## Yanıt

<ResponseField name="result" type="array">
  Artan sırayla blok slotları dizisi
</ResponseField>

## Kod Örnekleri

### Temel İstek

```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": "getBlocksWithLimit",
  "params": [
    100000000,
    10
  ]
}'
```

### Onay Seviyesiyle İstek

```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": "getBlocksWithLimit",
  "params": [
    100000000,
    10,
    {
      "commitment": "finalized"
    }
  ]
}'
```

### web3.js Kullanımı

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

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

// Get 10 blocks starting from slot
const blocks = await connection.getBlocksWithLimit(100000000, 10);
console.log('Blocks:', blocks);

// Get finalized blocks
const finalizedBlocks = await connection.getBlocksWithLimit(100000000, 10, 'finalized');
console.log('Finalized blocks:', finalizedBlocks);
```

## Notlar

1. Belirtilen slottan itibaren onaylanmış blokları döndürür
2. Sonuçlar artan sırayla döndürülür
3. Limit, döndürülecek maksimum blok sayısını kontrol eder
4. Bazı slotlar atlanmış olabilir (blok üretilmemiş)
5. Mevcut durumdan okuduğu için yanıt anında gelir

## En İyi Uygulamalar

1. İhtiyacınıza göre uygun onay seviyesini kullanın:
   * En son bloklar için `processed`
   * Yüksek olasılıklı kesinlik için `confirmed`
   * Garantili kesinlik için `finalized`
2. Zaman aşımını önlemek için limiti makul tutun
3. `getBlocks` yerine sayfalama için bu metodu kullanın
4. RPC yükünü azaltmak için uygun durumlarda sonuçları önbelleğe alın
5. Uygulama mantığınızda atlanan slotları yönetin

## Yaygın Hatalar

| Kod    | Mesaj                                 | Çözüm                                               |
| ------ | ------------------------------------- | --------------------------------------------------- |
| -32602 | Invalid param: limit must be positive | Limitin 0'dan büyük olduğundan emin olun            |
| -32602 | Invalid param: limit too large        | Limit boyutunu küçültün                             |
| -32601 | Method not found                      | Bir Solana RPC düğümüne bağlı olduğunuzu doğrulayın |
| -32007 | Block information unavailable         | Düğüm başlatılıyor veya slot çok eski olabilir      |

## Kullanım Senaryoları

1. **Blok Sayfalama**
   ```typescript theme={null}
   async function getBlocksPaginated(startSlot: number, pageSize: number) {
     const blocks = await connection.getBlocksWithLimit(startSlot, pageSize);
     const lastBlock = blocks[blocks.length - 1];
     
     return {
       blocks,
       nextStartSlot: lastBlock ? lastBlock + 1 : null
     };
   }
   ```

2. **Son Blok Geçmişi**
   ```typescript theme={null}
   async function getRecentBlocks(count: number) {
     const currentSlot = await connection.getSlot();
     const blocks = await connection.getBlocksWithLimit(currentSlot - count, count);
     
     return blocks.map(slot => ({
       slot,
       timestamp: new Date() // Add actual timestamp if available
     }));
   }
   ```

3. **Blok Akışı**
   ```typescript theme={null}
   async function* streamBlocks(startSlot: number, batchSize: number) {
     let currentSlot = startSlot;
     
     while (true) {
       const blocks = await connection.getBlocksWithLimit(currentSlot, batchSize);
       if (blocks.length === 0) {
         break;
       }
       
       yield blocks;
       currentSlot = blocks[blocks.length - 1] + 1;
     }
   }
   ```
