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

# SVM Fonksiyonları

> Solana ve SVM Uyumlu Blokzincirleri için Fonksiyonlar

Bu fonksiyonlar, Solana ve SVM uyumlu blokzincirleri için SVM eklentisi
kullanılırken mevcuttur.

## system_program_id

`svm::system_program_id`, System Program'ın id değerini döndürür:
`11111111111111111111111111111111`.

```hcl
output "system_program_id" {
    value = svm::system_program_id()
}
// > 11111111111111111111111111111111
```

---

## default_pubkey

`svm::default_pubkey`, varsayılan bir genel anahtarı döndürür:
`11111111111111111111111111111111`.

```hcl
output "default_pubkey" {
    value = svm::default_pubkey()
}
// > 11111111111111111111111111111111
```

---

## get_instruction_data_from_idl_path

`svm::get_instruction_data_from_idl_path`, bir program çağrısı için kodlanmış
instruction data oluşturur ve sağlanan IDL dosyasına göre tür denetimi ile
serileştirme sağlar.

### Girdiler

| Ad               | Zorunlu | Tür          | Açıklama                                                 |
| ------------------ | -------- | ------------- | ----------------------------------------------------------- |
| `idl_path`         | zorunlu | string        | IDL `.json` dosyasının txtx.yml dosyasına göreli yolu |
| `instruction_name` | zorunlu | string        | Veri oluşturulacak talimatın adı            |
| `arguments`        | isteğe bağlı | array[string] | Veri oluşturulacak talimat argümanları              |

```hcl
output "data" {
    value = svm::get_instruction_data_from_idl_path("idl.json", "my_instruction", ["arg1", "arg2"])
}
// > data: 0xc3f1b80e7f9b443504000000617267310400000061726732
```

Bir Anchor IDL için veri, talimatın 8 baytlık ayırt edicisinden (burada
`c3f1b80e7f9b4435`, yani `sha256("global:my_instruction")` değerinin ilk 8 baytı)
ve ardından Borsh ile kodlanmış argümanlardan oluşur: her string, 4 baytlık
little-endian bir uzunluk ve UTF-8 baytlarından meydana gelir.

---

## get_instruction_data_from_idl

`svm::get_instruction_data_from_idl`, bir program çağrısı için kodlanmış
instruction data oluşturur ve sağlanan IDL verisine göre tür denetimi ile
serileştirme sağlar.

### Girdiler

| Ad               | Zorunlu | Tür              | Açıklama                                                             |
| ------------------ | -------- | ----------------- | ----------------------------------------------------------------------- |
| `idl`              | zorunlu | string \| SVM_IDL | Programın IDL'i                                                         |
| `instruction_name` | zorunlu | string            | IDL'de indekslendiği şekliyle, veri oluşturulacak talimatın adı |
| `arguments`        | isteğe bağlı | array[string]     | Veri oluşturulacak talimat argümanları                          |

```hcl
output "data" {
    value = svm::get_instruction_data_from_idl(variable.contract.idl, "my_instruction", ["arg1", "arg2"])
}
// > data: 0xc3f1b80e7f9b443504000000617267310400000061726732
```

---

## get_program_from_anchor_project

`svm::get_program_from_anchor_project`, bir Anchor projesindeki bir program için
program dağıtım çıktılarını (artifact) alır.

### Girdiler

| Ad           | Zorunlu | Tür   | Açıklama                              |
| -------------- | -------- | ------ | ---------------------------------------- |
| `program_name` | zorunlu | string | Dağıtılacak programın adı   |
| `keypair_path` | isteğe bağlı | string | Program keypair dosyasının konumu |
| `idl_path`     | isteğe bağlı | string | Program IDL dosyasının konumu     |
| `bin_path`     | isteğe bağlı | string | Program ikili (binary) dosyasının konumu  |

```hcl
variable "contract" {
    value = svm::get_program_from_anchor_project("my_program")
}
output "idl" {
    value = variable.contract.idl
}
```

---

## get_program_from_native_project

`svm::get_program_from_native_project`, Anchor kullanmayan bir program için
program dağıtım çıktılarını (artifact) alır.

### Girdiler

| Ad           | Zorunlu | Tür   | Açıklama                              |
| -------------- | -------- | ------ | ---------------------------------------- |
| `program_name` | zorunlu | string | Dağıtılacak programın adı   |
| `keypair_path` | isteğe bağlı | string | Program keypair dosyasının konumu |
| `idl_path`     | isteğe bağlı | string | Program IDL dosyasının konumu     |
| `bin_path`     | isteğe bağlı | string | Program ikili (binary) dosyasının konumu  |

```hcl
variable "contract" {
    value = svm::get_program_from_native_project("my_program")
}
output "idl" {
    value = variable.contract.idl
}
```

---

## sol_to_lamports

`svm::sol_to_lamports`, verilen SOL miktarını lamport birimine dönüştürür.

```hcl
output "lamports" {
    value = svm::sol_to_lamports(1.1)
}
// lamports: 1100000000
```

---

## lamports_to_sol

`svm::lamports_to_sol`, verilen lamport miktarını SOL birimine dönüştürür.

```hcl
output "sol" {
    value = svm::lamports_to_sol(1100000000)
}
// sol: 1.1
```

---

## find_pda

`svm::find_pda`, verilen program id'sini ve seed'leri kullanarak geçerli bir PDA bulur.

### Girdiler

| Ad         | Zorunlu | Tür          | Açıklama                                        |
| ------------ | -------- | ------------- | -------------------------------------------------- |
| `program_id` | zorunlu | string        | PDA'nın türetildiği programın adresi |
| `seeds`      | isteğe bağlı | array[string] | İsteğe bağlı seed dizisi (en fazla 16, her biri 32 bayt) |

```hcl
variable "pda" {
    value = svm::find_pda("3bv3j4GvMPjvvBX9QdoX27pVoWhDSXpwKZipFF1QiVr6", ["data"])
}
output "pda" {
    value = variable.pda.pda
}
output "bump" {
    value = variable.pda.bump_seed
}
// > pda: AAU8CSawL7uBQLt4QHdTtwsNuRQthNtYzhMVNx2bwuGC
// > bump: 254
```

---

## get_associated_token_account

`svm::get_associated_token_account`, verilen cüzdan ve token mint adresleri için
associated token account adresini hesaplar.

### Girdiler

| Ad                 | Zorunlu | Tür   | Açıklama                   |
| -------------------- | -------- | ------ | ----------------------------- |
| `wallet_address`     | zorunlu | string | Cüzdanın adresi     |
| `token_mint_address` | isteğe bağlı | string | Token mint adresi |

```hcl
variable "token_account" {
    value = svm::get_associated_token_account(signer.caller.address, "So11111111111111111111111111111111111111112")
}
```

---

## create_token_account_instruction

`svm::create_token_account_instruction`, bir associated token account oluşturmak
için ham talimat baytlarını oluşturur.

### Girdiler

| Ad                 | Zorunlu | Tür   | Açıklama                        |
| -------------------- | -------- | ------ | ---------------------------------- |
| `funding_address`    | zorunlu | string | Fonlama hesabının adresi |
| `wallet_address`     | zorunlu | string | Cüzdanın adresi          |
| `token_mint_address` | isteğe bağlı | string | Token mint adresi      |
| `token_program_id`   | isteğe bağlı | string | Token Program adresi   |

```hcl
action "call" "svm::process_instructions" {
    signers = [signer.caller]

    instruction {
        raw_bytes = svm::create_token_account_instruction(
            signer.caller.address, // funding address
            signer.caller.address, // wallet address
            variable.token_mint, // token mint address
            variable.token_program // token program id
        )
    }
}
```

---

## u64

`svm::u64`, bir u64 tam sayısının bayt dizisi temsilini oluşturur; PDA
türetiminde seed olarak kullanıma uygundur.

### Girdiler

| Ad    | Zorunlu | Tür    | Açıklama                                |
| ------- | -------- | ------- | ------------------------------------------ |
| `value` | zorunlu | integer | Bayt dizisine dönüştürülecek u64 tam sayısı |

```hcl
variable "pda" {
    value = svm::find_pda("3bv3j4GvMPjvvBX9QdoX27pVoWhDSXpwKZipFF1QiVr6", [svm::u64(1000000000)])
}
```

---

## i64

`svm::i64`, bir i64 tam sayısının bayt dizisi temsilini oluşturur; PDA
türetiminde seed olarak kullanıma uygundur.

### Girdiler

| Ad    | Zorunlu | Tür    | Açıklama                                |
| ------- | -------- | ------- | ------------------------------------------ |
| `value` | zorunlu | integer | Bayt dizisine dönüştürülecek i64 tam sayısı |

```hcl
variable "pda" {
    value = svm::find_pda("3bv3j4GvMPjvvBX9QdoX27pVoWhDSXpwKZipFF1QiVr6", [svm::i64(-1000000000)])
}
```
