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

# CreateInstance

> Tworzy PDA Instance, który zakotwicza escrow Private Channels

Tworzy PDA `Instance`, który zakotwicza escrow. Musi być wywołana przed jakąkolwiek
inną operacją.

## Seeds PDA

```
instance        -> ["instance", instance_seed: Pubkey]
allowed_mint    -> ["allowed_mint", instance_pda: Pubkey, mint: Pubkey]
operator        -> ["operator", instance_pda: Pubkey, operator: Pubkey]
event_authority -> ["event_authority"]
```

## Konta

| Konto                          | Zapisywalne | Podpisujący | Opis                                                                 |
| -------------------------------- | -------- | ------ | --------------------------------------------------------------------------- |
| `payer`                          | ✓        | ✓      | Płatnik opłat i rent                                                    |
| `admin`                          |          | ✓      | Początkowy administrator instancji                                               |
| `instance_seed`                  |          | ✓      | Jednorazowy keypair używany wyłącznie do derywacji PDA; jego pubkey staje się seed |
| `instance`                       | ✓        |        | PDA instancji (derywowany z `["instance", instance_seed.pubkey]`)            |
| `system_program`                 |          |        | System Program                                                              |
| `event_authority`                |          |        | PDA authority zdarzeń                                                         |
| `private_channel_escrow_program` |          |        | Program escrow                                                              |

## Parametry

| Parametr | Typ | Opis                                                                             |
| --------- | ---- | --------------------------------------------------------------------------------------- |
| `bump`    | `u8` | Bump seed dla PDA instancji. Opcjonalny: klient `Async` automatycznie go derywuje, jeśli nie zostanie podany |

> IDL zawiera argument `discriminator: u8` (wartość `0`), który jest automatycznie ustawiany
> przez wygenerowanego klienta i nie powinien być przekazywany ręcznie.

## Ważne uwagi

- `instance_seed` to jednorazowy keypair, używany wyłącznie do derywacji PDA `Instance`.
  Jego pubkey staje się seed; sam keypair nie jest przechowywany ani ponownie używany.
- Używaj `getCreateInstanceInstructionAsync`; automatycznie derywuje `bump` i `instance`
  z `instance_seed`, gdy nie są podane. Przekazuj własny `bump` tylko wtedy, gdy
  został już obliczony za pomocą
  `Pubkey::find_program_address(&[b"instance", instance_seed_pubkey.as_ref()], &PROGRAM_ID)`
- Emituje zdarzenie poprzez CPI `EmitEvent`
