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

> Crea il PDA Instance che ancora l'escrow dei Private Channels

Crea il PDA `Instance` che ancora l'escrow. Deve essere chiamato prima di qualsiasi
altra operazione.

## Seed del 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"]
```

## Account

| Account                          | Scrivibile | Firmatario | Descrizione                                                                 |
| -------------------------------- | -------- | ------ | --------------------------------------------------------------------------- |
| `payer`                          | ✓        | ✓      | Pagatore delle commissioni e del rent                                                    |
| `admin`                          |          | ✓      | Admin iniziale dell'istanza                                               |
| `instance_seed`                  |          | ✓      | keypair temporaneo usato solo per la derivazione del PDA; il suo pubkey diventa il seed |
| `instance`                       | ✓        |        | PDA Instance (derivato da `["instance", instance_seed.pubkey]`)            |
| `system_program`                 |          |        | System Program                                                              |
| `event_authority`                |          |        | PDA dell'autorità degli eventi                                                         |
| `private_channel_escrow_program` |          |        | Programma Escrow                                                              |

## Parametri

| Parametro | Tipo | Descrizione                                                                             |
| --------- | ---- | --------------------------------------------------------------------------------------- |
| `bump`    | `u8` | bump seed per il PDA dell'istanza. Opzionale: il client `Async` lo deriva automaticamente se omesso |

> L'IDL contiene un argomento `discriminator: u8` (valore `0`) che viene impostato automaticamente
> dal client generato e non deve essere passato manualmente.

## Note Importanti

- `instance_seed` è un keypair temporaneo, usato solo per derivare il PDA `Instance`.
  Il suo pubkey diventa il seed; il keypair stesso non viene memorizzato né riutilizzato.
- Usa `getCreateInstanceInstructionAsync`; deriva automaticamente `bump` e `instance`
  da `instance_seed` quando non vengono forniti. Passa il tuo `bump` solo se
  lo hai già calcolato tramite
  `Pubkey::find_program_address(&[b"instance", instance_seed_pubkey.as_ref()], &PROGRAM_ID)`
- Emette un evento tramite CPI `EmitEvent`
