> ## Documentation Index
> Fetch the complete documentation index at: https://solana.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> This page is part of the Solana developer documentation at https://solana.com/developers/docs. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get the page as Markdown.
> Index of all pages: https://solana.com/llms.txt. Per-section indexes such as https://solana.com/developers/docs/payments/llms.txt are smaller; prefer them when working on one task.
> Coding agents: install the official Solana skill for current APIs and conventions with `npx skills add https://github.com/solana-foundation/solana-dev-skill` (also served at https://solana.com/SKILL.md).
> Code in the cookbook and task pages comes from tested example files. Prefer it over writing API calls from memory.

# İşlemler

> TypeScript'te LiteSVM ile işlemleri çalıştırın ve simüle edin

İşlemleri göndermek, simüle etmek ve yönetmek için kullanılan metotlar.

## sendTransaction

```typescript
sendTransaction(tx: Transaction): TransactionMetadata | FailedTransactionMetadata
```

Bir işlemi çalıştırır. Başarılı olursa `TransactionMetadata`, başarısız olursa
`FailedTransactionMetadata` döndürür. Hangisini aldığınızı
`instanceof FailedTransactionMetadata` ile kontrol edebilirsiniz. Başarısız bir sonucun hatayı veren `err()` ve
loglar dahil metadata'sını veren `meta()` metotları vardır.

```typescript
import { FailedTransactionMetadata } from "litesvm";

const result = client.svm.sendTransaction(signedTx);

if (result instanceof FailedTransactionMetadata) {
  // Check for errors
  console.error("Transaction failed:", result.err());
  console.error("Logs:", result.meta().logs());
} else {
  // Access result properties (note: these are getter functions)
  console.log("Signature:", result.signature());
  console.log("Compute units:", result.computeUnitsConsumed());
  console.log("Logs:", result.logs());
}
```

<Info>
  `FailedTransactionMetadata`, `@solana/kit-plugin-litesvm` tarafından kurulan
  `litesvm` paketinden gelir. İçe aktarabilmek için `npm install litesvm` ile
  paketi kendi bağımlılıklarınıza ekleyin.
</Info>

<Warning>
  `err()`, `computeUnitsConsumed()`,
  `logs()` ve `signature()` gibi işlem sonucu özellikleri birer **getter fonksiyonudur**, özellik değildir. Her zaman
  parantezlerle çağırın.
</Warning>

### TransactionMetadata Metotları

| Metot                   | Dönüş Değeri                 | Açıklama                 |
| ------------------------ | ----------------------- | --------------------------- |
| `signature()`            | `Uint8Array`            | İşlem imzası baytları |
| `computeUnitsConsumed()` | `bigint`                | Kullanılan hesaplama birimleri          |
| `logs()`                 | `string[]`              | Program logları                |
| `innerInstructions()`    | `InnerInstruction[]`    | İç (CPI) talimatlar    |
| `returnData()`           | `TransactionReturnData` | Programların döndürdüğü veriler   |
| `prettyLogs()`           | `string`                | Renkli biçimlendirilmiş loglar  |

## simulateTransaction

```typescript
simulateTransaction(tx: Transaction): SimulatedTransactionInfo | FailedTransactionMetadata
```

Durumu değiştirmeden bir işlemi simüle eder.

```typescript
import { FailedTransactionMetadata } from "litesvm";

const simResult = client.svm.simulateTransaction(signedTx);

if (simResult instanceof FailedTransactionMetadata) {
  console.error("Simulation failed:", simResult.err());
  console.error("Logs:", simResult.meta().logs());
} else {
  // Use .meta() to get TransactionMetadata
  const meta = simResult.meta();
  console.log("Would use", meta.computeUnitsConsumed(), "compute units");
  console.log("Logs:", meta.logs());

  // Get post-execution account states
  const postAccounts = simResult.postAccounts();
  console.log("Post-state accounts:", postAccounts);
}
```

<Info>
  Simülasyon durumu değiştirmez. İşlemleri göndermeden önce kontrol etmek için kullanın.
</Info>

## Blockhash Yönetimi

### latestBlockhash

```typescript
latestBlockhash(): Blockhash
```

Geçerli blockhash'i alır.

```typescript
const blockhash = client.svm.latestBlockhash();
console.log("Blockhash:", blockhash);
```

### getLatestBlockhash (client.rpc üzerinden)

İşlemleri manuel olarak oluşturmak için geçerlilik süresi bilgisiyle birlikte blockhash'i alır.
Hem `blockhash` hem de `lastValidBlockHeight` değerini döndürdüğü için RPC yardımcısını kullanın.

```typescript
import {
  createTransactionMessage,
  setTransactionMessageLifetimeUsingBlockhash
} from "@solana/kit";

const { value: blockhashLifetime } = await client.rpc
  .getLatestBlockhash()
  .send();

const tx = setTransactionMessageLifetimeUsingBlockhash(
  blockhashLifetime,
  createTransactionMessage({ version: 0 })
);
```

<Info>
  `systemProgram()` veya `tokenProgram()` gibi program eklentilerini kullanırken
  blockhash'i kendiniz almanız gerekmez — `client.sendTransaction()` (ve
  talimat zincirlerindeki `.sendTransaction()` yardımcısı) bunu sizin için halleder.
</Info>

### expireBlockhash

```typescript
expireBlockhash(): void
```

Yeni bir blockhash'e geçer. Blockhash süresinin dolması senaryolarını test etmek için kullanışlıdır.

```typescript
const oldBlockhash = client.svm.latestBlockhash();
client.svm.expireBlockhash();
const newBlockhash = client.svm.latestBlockhash();

console.log("Old:", oldBlockhash);
console.log("New:", newBlockhash);
// Blockhashes will be different
```

## İşlem Geçmişi

İşlemleri gönderdikten sonra geri almak için işlem geçmişini etkinleştirin:

```typescript
// Enable history storage (stores last N transactions)
client.svm.withTransactionHistory(100n);

// Send a transaction
const result = client.svm.sendTransaction(signedTx);

// Later, retrieve it by signature (base58 string)
// Note: getTransaction expects a base58-encoded signature string
```
