> ## 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 정의에서 생성됩니다.

IDL 가져오기는 특정 슬롯 시점의 프로그램 IDL, 즉 `slot` 또는 그 이전에 활성화된 최신 버전을 반환합니다. `slot`은 버전과 정확히 일치할 필요가 없으므로 기록상의 어떤 시점이든 전달할 수 있습니다. 특정 버전 하나를 가져오려면 [IDL 버전 목록](https://www.helius.dev/docs/ko/api-reference/parsed-events/idl-versions.md)의 `slot`을 전달하세요.

IDL은 Parsed Events와 [Parsed Streams](https://www.helius.dev/docs/ko/parsed-streams.md)가 명령어를 디코딩하는 데 사용하는 동일한 카탈로그에서 가져옵니다. [Orb 탐색기](https://www.helius.dev/docs/ko/orb/explore-programs.md)는 이러한 엔드포인트를 사용하여 프로그램 IDL을 표시합니다.

## 사용 사례

* **올바른 인터페이스로 기록을 디코딩합니다.** 트랜잭션이 실행될 때 적용되던 IDL을 가져오려면 해당 트랜잭션의 슬롯을 전달하세요. 프로그램의 명령어와 계정은 시간이 지나면서 변경되므로 현재 IDL로는 이전 트랜잭션을 잘못 해석할 수 있습니다.
* **필터에 사용할 정확한 이름을 찾습니다.** [트랜잭션 기록 스캔](https://www.helius.dev/docs/ko/api-reference/parsed-events/scan.md) `match.programs[].instructions`은 IDL에 표기된 명령어 이름을 받습니다.
* **인터페이스 변경 사항을 검토합니다.** 두 버전을 가져와 `instructions`을 비교하면 업그레이드에서 추가되거나 제거된 항목을 확인할 수 있습니다. [IDL 버전 목록](https://www.helius.dev/docs/ko/api-reference/parsed-events/idl-versions.md#예시-새-idl-버전-감지)의 예시를 참조하세요.

## IDL 형식

응답은 저장된 그대로의 IDL 문서입니다. 카탈로그의 프로그램은 두 가지 Anchor 형식 중 하나를 사용하며, 한 프로그램의 여러 버전에서 두 형식을 모두 사용할 수도 있습니다. 내용을 읽기 전에 어떤 형식을 받았는지 확인하세요.

| | 레거시 Anchor(0.30 이전) | Anchor 0.30+ |
| - | - | - |
| 프로그램 이름 및 버전 | 최상위 `name` 및 `version` | `metadata.name` 및 `metadata.version` |
| 프로그램 주소 | 최상위 `address` 없음 | 최상위 `address` |
| 명령어 판별자 | 포함되지 않음 | `instructions[].discriminator` |
| 명령어 계정 플래그 | `isMut`, `isSigner` | `writable`, `signer` |

두 형식 모두 `instructions`을 포함합니다. 대부분의 IDL에는 `accounts`, `types`, `errors`도 있으며, 많은 IDL에 `events`이 있습니다.

## 크레딧

각 요청에는 **10크레딧**이 필요하며 모든 요금제에서 사용할 수 있습니다. [크레딧](https://www.helius.dev/docs/ko/billing/credits.md#파싱된-이벤트)을 참조하세요.

## 오류

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

그 밖의 오류는 `{"error": "no IDL found for program KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD at or before slot 1"}` 같은 `error` 메시지가 포함된 JSON 본문을 반환합니다.

## 요청 매개변수

**programId** `string` *required*

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

**slot** `number` *required*

조회할 슬롯입니다. 버전의 활성화 슬롯과 일치할 필요는 없습니다. 정확한 버전을 가져오려면 IDL 버전 목록의 `slot`을 전달하고, 트랜잭션이 실행될 때 적용되던 IDL을 가져오려면 해당 트랜잭션의 슬롯을 전달하세요.


## OpenAPI

````yaml ko/openapi/parsed-events.yaml GET /v1/parsed-events/idl/{programId}/{slot}
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}/{slot}:
    get:
      tags:
        - 파싱된 이벤트
      summary: IDL 가져오기
      description: 특정 슬롯에서 프로그램에 적용되던 IDL을 가져옵니다. 이는 `slot` 또는 그 이전에 활성화된 최신 버전입니다.
      operationId: getIdlParsedEvents
      parameters:
        - $ref: '#/components/parameters/ProgramId'
        - name: slot
          in: path
          required: true
          description: >-
            조회할 슬롯입니다. 버전의 활성화 슬롯과 일치할 필요는 없습니다. IDL 버전 목록의 `slot`을 전달하면 해당 버전을
            정확히 가져오고, 트랜잭션의 슬롯을 전달하면 트랜잭션 실행 시점에 적용되던 IDL을 가져옵니다.
          schema:
            type: integer
            format: uint64
            minimum: 0
            example: 205509752
      responses:
        '200':
          description: >-
            저장된 그대로의 IDL 문서입니다. 레거시 Anchor 형식과 Anchor 0.30+ 형식이 모두 사용되므로, 읽기 전에
            어떤 형식을 받았는지 확인하세요.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Idl'
              examples:
                Legacy Anchor IDL:
                  summary: 슬롯 182747476의 Kamino Lend(명령어 1개와 오류 1개로 축약)
                  value:
                    name: kamino_lending
                    version: 0.1.0
                    instructions:
                      - name: refreshObligation
                        accounts:
                          - name: lendingMarket
                            isMut: false
                            isSigner: false
                          - name: obligation
                            isMut: true
                            isSigner: false
                        args: []
                    errors:
                      - code: 6000
                        name: InvalidMarketAuthority
                        msg: Market authority is invalid
                Anchor 0.30+ IDL:
                  summary: 슬롯 454326107의 Pump AMM(명령어 1개와 오류 1개로 축약)
                  value:
                    address: pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA
                    metadata:
                      name: pump_amm
                      version: 0.1.0
                      spec: 0.1.0
                      description: Created with Anchor
                    instructions:
                      - name: toggle_boost
                        discriminator:
                          - 117
                          - 161
                          - 160
                          - 74
                          - 223
                          - 137
                          - 118
                          - 99
                        accounts:
                          - name: admin
                            signer: true
                            relations:
                              - global_config
                          - name: global_config
                            writable: true
                        args:
                          - name: enabled
                            type: bool
                    errors:
                      - code: 6000
                        name: FeeBasisPointsExceedsMaximum
        '400':
          $ref: '#/components/responses/IdlBadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          description: 카탈로그에 해당 프로그램의 IDL이 없거나 `slot` 또는 그 이전에 활성화된 버전이 없습니다.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                default:
                  value:
                    error: >-
                      no IDL found for program
                      KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD at or before
                      slot 1
components:
  parameters:
    ProgramId:
      name: programId
      in: path
      required: true
      description: base58로 인코딩된 프로그램 주소입니다.
      schema:
        type: string
        example: KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD
  schemas:
    Idl:
      type: object
      additionalProperties: true
      description: >-
        저장된 그대로 반환되는 IDL 문서입니다. 두 가지 형식이 사용됩니다:


        - **레거시 Anchor**(0.30 이전): 최상위 `name`과 `version`을 사용합니다. 명령어 계정은
        `isMut`와 `isSigner`를 사용합니다.

        - **Anchor 0.30+**: 최상위 `address`와 `metadata`(`name`, `version`, `spec`,
        `description`)를 사용합니다. 명령어에는 `discriminator`가 포함되며, 명령어 계정은 `writable`과
        `signer`를 사용합니다.


        두 형식 모두 `instructions`를 포함합니다. 대부분의 IDL에는 `accounts`, `types`, `errors`도
        있으며, 많은 IDL에 `events`가 있습니다. 한 프로그램의 여러 버전이 서로 다른 형식을 사용할 수 있습니다.
    ErrorResponse:
      type: object
      description: Request-level error response.
      properties:
        error:
          type: string
          description: Error message.
  responses:
    IdlBadRequest:
      description: '`programId`가 유효한 주소가 아니거나 `slot`이 부호 없는 64비트 정수가 아닙니다.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            Invalid program ID:
              value:
                error: 'invalid program id: notanaddress: String is the wrong size'
            Invalid slot:
              value:
                error: 'invalid activation slot: abc: invalid digit found in string'
    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.