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

# getBalance

> Sağlanan açık anahtarın hesabının bakiyesini döndürür

## Parametreler

<ParamField query="pubkey" type="string" required>
  Sorgulanacak hesabın açık anahtarı (base-58 kodlu dize)
</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>

    <ParamField query="minContextSlot" type="number" optional>
      İsteğin değerlendirilebileceği minimum slot
    </ParamField>
  </Expandable>
</ParamField>

## Yanıt

<ResponseField name="result" type="object">
  <Expandable title="result fields">
    <ResponseField name="context" type="object">
      <ResponseField name="slot" type="number">
        İsteğin işlendiği slot
      </ResponseField>
    </ResponseField>

    <ResponseField name="value" type="number">
      Bu hesaba atanan lamport sayısı
    </ResponseField>
  </Expandable>
</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": "getBalance",
  "params": [
    "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri"
  ]
}'
```

### 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": "getBalance",
  "params": [
    "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri",
    {
      "commitment": "finalized"
    }
  ]
}'
```

### web3.js Kullanımı

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

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

const balance = await connection.getBalance(
  publicKey,
  'confirmed'
);

console.log(`Balance: ${balance / 1e9} SOL`);
```

## Notlar

1. Bakiye lamport cinsinden döndürülür (1 SOL = 1.000.000.000 lamport)
2. Yeni hesaplar için bakiye 0 olacaktır
3. Bakiye, stake için devredilen SOL dahil tüm SOL tokenlerini içerir
4. 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:
   * Arayüz güncellemeleri için `processed`
   * Çoğu işlem için `confirmed`
   * Kritik işlemler için `finalized`
2. Kullanıcılara gösterirken lamportları SOL'a çevirmek için 1e9'a bölün
3. Daha fazla hesap ayrıntısına ihtiyacınız varsa `getAccountInfo` kullanmayı düşünün

## Yaygın Hatalar

| Kod    | Mesaj                                    | Çözüm                                            |
| ------ | ---------------------------------------- | ------------------------------------------------ |
| -32602 | Invalid param: WrongSize                 | Açık anahtarın geçerli olduğunu doğrulayın       |
| -32602 | Invalid param: not base58 encoded string | Açık anahtarın base58 kodlu olduğundan emin olun |
| -32007 | Account not found                        | Hesap mevcut değil (bakiye 0 olacaktır)          |
