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

# IDL 버전 목록

> Parsed Events가 Solana 프로그램에 대해 보유한 모든 IDL 버전과 각 버전이 활성화된 슬롯을 나열합니다.

이 페이지의 경로 매개변수, 응답 스키마 및 예시는 OpenAPI 정의에서 생성됩니다.

List IDL Versions는 Parsed Events와 [Parsed Streams](https://www.helius.dev/docs/ko/parsed-streams.md)가 명령어를 디코딩할 때 사용하는 IDL 카탈로그에서 프로그램 인터페이스의 변경 이력을 반환합니다. 각 항목은 하나의 버전이며, 해당 버전이 활성화된 슬롯으로 식별됩니다. 항목은 오래된 순서대로 정렬되므로 마지막 항목이 현재 버전입니다.

응답의 `slot` 값을 [Get IDL](https://www.helius.dev/docs/ko/api-reference/parsed-events/idl.md)에 전달하면 해당 버전의 IDL 문서를 가져올 수 있습니다. [Orb 탐색기](https://www.helius.dev/docs/ko/orb/explore-programs.md)는 이러한 엔드포인트를 사용하여 프로그램 IDL을 표시합니다.

## 사용 사례

* **인터페이스 변경 사항을 추적하세요.** 의존하는 프로그램에 대해 List IDL Versions를 주기적으로 폴링하세요. 새 버전이 나타나면 Get IDL로 해당 버전과 이전 버전을 가져와 두 버전의 `instructions`을 비교하세요. 새로운 관리자 또는 권한 명령어가 추가되었다면 보안 검토를 수행하는 것이 좋습니다.
* **카탈로그 적용 범위를 확인하세요.** `404`은 카탈로그에 해당 프로그램의 IDL이 없다는 의미입니다. SPL Token과 같은 프로그램은 대신 내장 디코더로 디코딩되며 `404`도 반환합니다.

## 예시: 새 IDL 버전 감지

이 스크립트는 프로그램의 IDL 버전을 나열하고, 최신 버전 두 개를 가져온 다음, 추가되거나 제거된 명령어를 출력합니다.

```javascript diff-idl-versions.js theme={"system"}
const API_KEY = process.env.HELIUS_API_KEY;

if (!API_KEY) {
  console.error("Missing HELIUS_API_KEY.");
  process.exit(1);
}

const BASE = "https://mainnet.helius-rpc.com/v1/parsed-events/idl";
const PROGRAM_ID = "KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD";

async function get(path) {
  const response = await fetch(`${BASE}/${path}?api-key=${API_KEY}`);
  if (!response.ok) {
    throw new Error(`HTTP ${response.status}: ${await response.text()}`);
  }
  return response.json();
}

const versions = await get(PROGRAM_ID);
if (versions.length < 2) {
  console.log("Fewer than two IDL versions; nothing to compare.");
  process.exit(0);
}

const [previous, latest] = versions.slice(-2);
const [before, after] = await Promise.all([
  get(`${PROGRAM_ID}/${previous.slot}`),
  get(`${PROGRAM_ID}/${latest.slot}`),
]);

const names = (idl) => new Set(idl.instructions.map((ix) => ix.name));
const beforeNames = names(before);
const afterNames = names(after);

console.log(`Comparing slot ${previous.slot} with slot ${latest.slot}`);
console.log("Added:", [...afterNames].filter((name) => !beforeNames.has(name)));
console.log("Removed:", [...beforeNames].filter((name) => !afterNames.has(name)));
```

시간 경과에 따른 변경 사항을 감지하려면 마지막으로 확인한 버전의 `slot` 값을 저장하고 폴링할 때마다 이 값과 비교하세요.

## 크레딧

각 요청에는 **10크레딧**이 소모되며 모든 요금제에서 사용할 수 있습니다. 위 예시는 요청을 세 번 보내므로 30크레딧이 소모됩니다. [크레딧](https://www.helius.dev/docs/ko/billing/credits.md#파싱된-이벤트)을 참고하세요.

## 오류

| 상태 | 발생 조건 |
| - | - |
| `400` | `programId`이 유효한 base58 주소가 아닙니다. |
| `401` | API 키가 누락되었거나 유효하지 않습니다. 본문은 일반 텍스트인 `Unauthorized`입니다. |
| `404` | 카탈로그에 해당 프로그램의 IDL이 없습니다. |

기타 오류는 `error` 메시지가 포함된 JSON 본문을 반환합니다. 예: `{"error": "no IDLs found for program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"}`.

## 요청 매개변수

**programId** `string` *required*

base58로 인코딩된 프로그램 주소입니다.


## OpenAPI

````yaml ko/openapi/parsed-events.yaml GET /v1/parsed-events/idl/{programId}
openapi: 3.0.3
info:
  title: 파싱된 이벤트
  version: 0.1.0
  description: 파싱된 이벤트로 Solana 거래 및 파싱된 거래 기록을 파싱합니다.
servers:
  - url: https://mainnet.helius-rpc.com
security:
  - ApiKeyQuery: []
paths:
  /v1/parsed-events/idl/{programId}:
    get:
      tags:
        - 파싱된 이벤트
      summary: IDL 버전 목록 조회
      description: >-
        Parsed Events가 프로그램에 대해 보유한 모든 IDL 버전을 오래된 순서대로 나열합니다. 각 버전은 활성화된 슬롯으로
        식별됩니다.
      operationId: listIdlVersionsParsedEvents
      parameters:
        - $ref: '#/components/parameters/ProgramId'
      responses:
        '200':
          description: 프로그램의 IDL 버전이며, `slot`을 기준으로 오름차순 정렬됩니다.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/IdlVersion'
              examples:
                default:
                  summary: Kamino Lend(43개 버전 중 처음 3개)
                  value:
                    - slot: 182747476
                      sources:
                        - anchor
                    - slot: 205509752
                      sources:
                        - anchor
                    - slot: 206074074
                      sources:
                        - anchor
        '400':
          description: '`programId`가 유효한 주소가 아닙니다.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                default:
                  value:
                    error: 'invalid program id: notanaddress: String is the wrong size'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          description: >-
            카탈로그에 해당 프로그램의 IDL이 없습니다. SPL Token처럼 Parsed Events가 기본 제공 디코더로
            디코딩하는 프로그램은 `404`를 반환합니다.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                default:
                  value:
                    error: >-
                      no IDLs found for program
                      TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
components:
  parameters:
    ProgramId:
      name: programId
      in: path
      required: true
      description: base58로 인코딩된 프로그램 주소입니다.
      schema:
        type: string
        example: KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD
  schemas:
    IdlVersion:
      type: object
      description: 프로그램의 IDL 버전 하나입니다.
      required:
        - slot
        - sources
      properties:
        slot:
          type: integer
          format: uint64
          description: 이 IDL 버전이 활성화된 슬롯입니다. 이 버전을 가져오려면 IDL 가져오기에 전달하세요.
        sources:
          type: array
          description: >-
            Parsed Events가 이 버전을 찾은 위치입니다. 값에는 `anchor`, `program_metadata`,
            `github` 등이 있으며 더 추가될 수 있습니다. 하나의 버전에 소스가 여러 개 있을 수 있습니다.
          items:
            type: string
    ErrorResponse:
      type: object
      description: Request-level error response.
      properties:
        error:
          type: string
          description: Error message.
  responses:
    Unauthorized:
      description: API 키가 없거나 유효하지 않습니다. 본문은 일반 텍스트입니다.
      content:
        text/plain:
          schema:
            type: string
          examples:
            default:
              value: Unauthorized
  securitySchemes:
    ApiKeyQuery:
      type: apiKey
      in: query
      name: api-key

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.