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

# Jetstream Protokol Referansı

> OrbitFlare Jetstream için Protocol Buffer belirtimi

## Mevcut Uç Noktalar

Jetstream, tüm OrbitFlare bölgelerinde kullanılabilir. En düşük gecikme için altyapınıza en yakın bölgeye bağlanın.

<Tabs>
  <Tab title="US">
    | Şehir          | Bölge Kodu | Uç Nokta                              |
    | -------------- | ---------- | ------------------------------------- |
    | New York       | `ny`       | `http://ny.jetstream.orbitflare.com`  |
    | Salt Lake City | `slc`      | `http://slc.jetstream.orbitflare.com` |
  </Tab>

  <Tab title="Europe">
    | Şehir               | Bölge Kodu | Uç Nokta                               |
    | ------------------- | ---------- | -------------------------------------- |
    | Frankfurt           | `fra`      | `http://fra.jetstream.orbitflare.com`  |
    | Amsterdam           | `ams`      | `http://ams.jetstream.orbitflare.com`  |
    | London              | `lon`      | `http://lon.jetstream.orbitflare.com`  |
    | Dublin              | `dub`      | `http://dub.jetstream.orbitflare.com`  |
    | Siauliai, Lithuania | `siau`     | `http://siau.jetstream.orbitflare.com` |
  </Tab>

  <Tab title="Asia Pacific">
    | Şehir     | Bölge Kodu | Uç Nokta                              |
    | --------- | ---------- | ------------------------------------- |
    | Tokyo     | `jp`       | `http://jp.jetstream.orbitflare.com`  |
    | Singapore | `sgp`      | `http://sgp.jetstream.orbitflare.com` |
  </Tab>
</Tabs>

<Note>
  Jetstream, gRPC bağlantıları için düz `http://` kullanır (`https://` değil). gRPC, HTTP/2 üzerinde kendi taşıma güvenliği müzakeresini kullanır. `https://` yalnızca özel düğümünüz bunu açıkça gerektiriyorsa kullanın.
</Note>

## Protocol Buffer Belirtimi

Bu belge, OrbitFlare Jetstream tarafından kullanılan Protocol Buffer (protobuf) belirtimini özetlemektedir. Tam belirtim [GitHub depomuzdaki](https://github.com/orbitflare/jetstream-client-example/blob/main/jetstream_protos/protos/jetstream.proto) belgede bulunabilir.

### Hizmet Tanımı

```protobuf theme={null}
syntax = "proto3";

import "google/protobuf/timestamp.proto";
package jetstream;

// ============= Service Definition =============
service Jetstream {
  // Subscribe to data streams with filtering support
  rpc Subscribe(stream SubscribeRequest) returns (stream SubscribeUpdate) {}
  // Subscribe to data streams with filtering support and parsed instructions
  rpc SubscribeParsed(stream SubscribeParsedRequest) returns (stream SubscribeUpdateParsedTransaction) {}
  // Basic ping/pong for connection testing
  rpc Ping(PingRequest) returns (PongResponse) {}
  // Get information about current state
  rpc GetVersion(GetVersionRequest) returns (GetVersionResponse) {}
}
```

### İstek Mesajları

#### SubscribeRequest

Veri güncellemelerine abone olmak için ana istek mesajı:

```protobuf theme={null}
message SubscribeRequest {
  map<string, SubscribeRequestFilterTransactions> transactions = 1;
  map<string, SubscribeRequestFilterAccounts> accounts = 2;
  optional SubscribeRequestPing ping = 4;
}
```

#### İşlem Filtreleme

```protobuf theme={null}
message SubscribeRequestFilterTransactions {
  repeated string account_include = 1;
  repeated string account_exclude = 2;
  repeated string account_required = 3;
}
```

#### Hesap Filtreleme

```protobuf theme={null}
message SubscribeRequestFilterAccounts {
  repeated string account = 1;
  repeated string owner = 2;
  repeated SubscribeRequestFilterAccountsFilter filters = 3;
}

message SubscribeRequestFilterAccountsFilter {
  oneof filter {
    SubscribeRequestFilterAccountsFilterMemcmp memcmp = 1;
    uint64 datasize = 2;
    SubscribeRequestFilterAccountsFilterLamports lamports = 3;
  }
}

message SubscribeRequestFilterAccountsFilterMemcmp {
  uint64 offset = 1;
  oneof data {
    bytes bytes = 2;
    string base58 = 3;
    string base64 = 4;
  }
}

message SubscribeRequestFilterAccountsFilterLamports {
  oneof cmp {
    uint64 eq = 1;
    uint64 ne = 2;
    uint64 lt = 3;
    uint64 gt = 4;
  }
}
```

#### Ping İsteği

```protobuf theme={null}
message SubscribeRequestPing {
  int32 id = 1;
}
```

### Yanıt Mesajları

#### SubscribeUpdate

Güncellemeleri içeren ana yanıt mesajı:

```protobuf theme={null}
message SubscribeUpdate {
  repeated string filters = 1;
  google.protobuf.Timestamp created_at = 2;
  oneof update_oneof {
    SubscribeUpdateTransaction transaction = 3;
    SubscribeUpdateAccount account = 4;
    SubscribeUpdatePing ping = 5;
    SubscribeUpdatePong pong = 6;
  }
}
```

#### İşlem Güncellemesi

```protobuf theme={null}
message SubscribeUpdateTransaction {
  SubscribeUpdateTransactionInfo transaction = 1;
  uint64 slot = 2;
}

message SubscribeUpdateTransactionInfo {
  bytes signature = 1;
  uint64 slot = 2;
  uint32 num_required_signatures = 3;
  uint32 num_readonly_signed_accounts = 4;
  uint32 num_readonly_unsigned_accounts = 5;
  bytes recent_blockhash = 6;
  repeated bytes signatures = 7;
  repeated bytes account_keys = 8;
  repeated CompiledInstruction instructions = 9;
  repeated MessageAddressTableLookup address_table_lookups = 10;
}
```

#### Hesap Güncellemesi

```protobuf theme={null}
message SubscribeUpdateAccount {
  SubscribeUpdateAccountInfo account = 1;
  uint64 slot = 2;
  bool is_startup = 3;
}

message SubscribeUpdateAccountInfo {
  bytes pubkey = 1;
  uint64 lamports = 2;
  bytes owner = 3;
  bool executable = 4;
  uint64 rent_epoch = 5;
  bytes data = 6;
  uint64 write_version = 7;
  optional bytes txn_signature = 8;
}
```

#### Ping/Pong Güncellemeleri

```protobuf theme={null}
message SubscribeUpdatePing {}

message SubscribeUpdatePong {
  int32 id = 1;
}
```

#### Paylaşılan Türler

```protobuf theme={null}
message MessageAddressTableLookup {
  bytes account_key = 1;
  bytes writable_indexes = 2;
  bytes readonly_indexes = 3;
}

message CompiledInstruction {
  uint32 program_id_index = 1;
  bytes accounts = 2;
  bytes data = 3;
}
```

### Ayrıştırılmış Talimat Desteği

#### Ayrıştırılmış İstek

```protobuf theme={null}
message SubscribeParsedRequest {
  optional SubscribeRequestPing ping = 1;
}
```

#### Ayrıştırılmış İşlem Güncellemesi

```protobuf theme={null}
message SubscribeUpdateParsedTransaction {
  bytes signature = 1;
  uint64 slot = 2;
  SubscribeUpdateAccount account = 3;
  bytes recent_blockhash = 4;
  repeated bytes signatures = 5;
  repeated Instruction instructions = 6;
}
```

#### Talimat Türleri

```protobuf theme={null}
message Instruction {
  oneof instruction_oneof {
    Initialize initialize = 1;
    SetParams set_params = 2;
    Create create = 3;
    Buy buy = 4;
    Sell sell = 5;
    Withdraw withdraw = 6;
  }
}

message Initialize {}

message SetParams {
  bytes fee_recipient = 1;
  uint64 initial_virtual_token_reserves = 2;
  uint64 initial_virtual_sol_reserves = 3;
  uint64 initial_real_token_reserves = 4;
  uint64 token_total_supply = 5;
  uint64 fee_basis_points = 6;
}

message Create {
  string name = 1;
  string symbol = 2;
  string uri = 3;
}

message Buy {
  uint64 amount = 1;
  uint64 max_sol_cost = 2;
}

message Sell {
  uint64 amount = 1;
  uint64 min_sol_output = 2;
}

message Withdraw {}
```

### Akışsız Metotlar

```protobuf theme={null}
message PingRequest {
  int32 count = 1;
}

message PongResponse {
  int32 count = 1;
}

message GetVersionRequest {}

message GetVersionResponse {
  string version = 1;
}

message GetSlotResponse {
  uint64 slot = 1;
}
```

## Protokolü Kullanma

Jetstream için bir istemci uygularken şunları yapmanız gerekecektir:

1. Protobuf tanımından istemci kodu oluşturma
2. Veri akışı için Subscribe RPC metodunu uygulama
3. Ayrıştırılmış talimat desteği için SubscribeParsed kullanma
4. Bağlantı sağlık kontrolleri için Ping/Pong kullanma
5. Sunucu uyumluluğunu kontrol etmek için GetVersion kullanma
6. Farklı türdeki güncellemeleri işleme (işlemler, hesaplar, pong'lar)

### Kod Oluşturma

TypeScript/JavaScript için:

```bash theme={null}
protoc --plugin=protoc-gen-ts_proto=./node_modules/.bin/protoc-gen-ts_proto \
  --ts_proto_out=. \
  --ts_proto_opt=esModuleInterop=true \
  jetstream.proto
```

Rust için:

```bash theme={null}
protoc --rust_out=. jetstream.proto
```

## En İyi Uygulamalar

1. **Sürüm Uyumluluğu**
   * Protokol uyumluluğunu kontrol etmek için GetVersion kullanın
   * Beta sürümlerindeki kırıcı değişiklikler için izleyin
   * Yükseltme yaparken kapsamlı test yapın

2. **Hata İşleme**
   * Tüm mesaj türleri için uygun hata işleme uygulayın
   * Bağlantı hatalarını zarif bir şekilde yönetin
   * İşlemeden önce mesaj alanlarını doğrulayın

3. **Bağlantı Yönetimi**
   * Bağlantı sağlık kontrolleri için Ping/Pong kullanın
   * Otomatik yeniden bağlanma mantığı uygulayın
   * Uygun zaman aşımı değerleri belirleyin

4. **Performans**
   * Gereksiz veriyi en aza indirmek için uygun filtreler kullanın
   * Büyük veri kümeleri için hesap filtrelemesini düşünün
   * Özellikle hesap aboneliklerinde kaynak kullanımını izleyin
   * Gerektiğinde ayrıştırılmış talimat desteği için SubscribeParsed kullanın

## Ayrıca Bakınız

<CardGroup cols={2}>
  <Card title="Jetstream Genel Bakış" icon="bolt" href="/tr/data-streaming/jetstream">
    Başlangıç kılavuzu, örnekler ve filtreleme belgeleri.
  </Card>

  <Card title="Değişiklik Günlüğü" icon="clock-rotate-left" href="/tr/data-streaming/jetstream-changelog">
    Sürüm geçmişi ve protokol güncellemeleri.
  </Card>
</CardGroup>

## Destek

Protokol belirtimi veya uygulama ayrıntıları hakkındaki teknik sorularınız için [GitHub depomuzu](https://github.com/orbitflare/jetstream-client-example) ziyaret edin veya [Discord topluluğumuza](https://discord.gg/orbitflare) katılın.
