파싱된 이벤트
IDL 버전 목록
Parsed Events가 Solana 프로그램에 대해 보유한 모든 IDL 버전과 각 버전이 활성화된 슬롯을 나열합니다.
GET
/
v1
/
parsed-events
/
idl
/
{programId}
IDL 버전 목록 조회
curl --request GET \
--url 'https://mainnet.helius-rpc.com/v1/parsed-events/idl/{programId}?api-key='import requests
url = "https://mainnet.helius-rpc.com/v1/parsed-events/idl/{programId}?api-key="
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://mainnet.helius-rpc.com/v1/parsed-events/idl/{programId}?api-key=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://mainnet.helius-rpc.com/v1/parsed-events/idl/{programId}?api-key=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://mainnet.helius-rpc.com/v1/parsed-events/idl/{programId}?api-key="
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://mainnet.helius-rpc.com/v1/parsed-events/idl/{programId}?api-key=")
.asString();require 'uri'
require 'net/http'
url = URI("https://mainnet.helius-rpc.com/v1/parsed-events/idl/{programId}?api-key=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body[
{
"slot": 182747476,
"sources": [
"anchor"
]
},
{
"slot": 205509752,
"sources": [
"anchor"
]
},
{
"slot": 206074074,
"sources": [
"anchor"
]
}
]{
"error": "invalid program id: notanaddress: String is the wrong size"
}Unauthorized{
"error": "no IDLs found for program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
}이 페이지의 경로 매개변수, 응답 스키마 및 예시는 OpenAPI 정의에서 생성됩니다.
List IDL Versions는 Parsed Events와 Parsed Streams가 명령어를 디코딩할 때 사용하는 IDL 카탈로그에서 프로그램 인터페이스의 변경 이력을 반환합니다. 각 항목은 하나의 버전이며, 해당 버전이 활성화된 슬롯으로 식별됩니다. 항목은 오래된 순서대로 정렬되므로 마지막 항목이 현재 버전입니다.
응답의
시간 경과에 따른 변경 사항을 감지하려면 마지막으로 확인한 버전의
기타 오류는
slot 값을 Get IDL에 전달하면 해당 버전의 IDL 문서를 가져올 수 있습니다. Orb 탐색기는 이러한 엔드포인트를 사용하여 프로그램 IDL을 표시합니다.
사용 사례
- 인터페이스 변경 사항을 추적하세요. 의존하는 프로그램에 대해 List IDL Versions를 주기적으로 폴링하세요. 새 버전이 나타나면 Get IDL로 해당 버전과 이전 버전을 가져와 두 버전의
instructions을 비교하세요. 새로운 관리자 또는 권한 명령어가 추가되었다면 보안 검토를 수행하는 것이 좋습니다. - 카탈로그 적용 범위를 확인하세요.
404은 카탈로그에 해당 프로그램의 IDL이 없다는 의미입니다. SPL Token과 같은 프로그램은 대신 내장 디코더로 디코딩되며404도 반환합니다.
예시: 새 IDL 버전 감지
이 스크립트는 프로그램의 IDL 버전을 나열하고, 최신 버전 두 개를 가져온 다음, 추가되거나 제거된 명령어를 출력합니다.diff-idl-versions.js
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크레딧이 소모됩니다. 크레딧을 참고하세요.오류
| 상태 | 발생 조건 |
|---|---|
400 | programId이 유효한 base58 주소가 아닙니다. |
401 | API 키가 누락되었거나 유효하지 않습니다. 본문은 일반 텍스트인 Unauthorized입니다. |
404 | 카탈로그에 해당 프로그램의 IDL이 없습니다. |
error 메시지가 포함된 JSON 본문을 반환합니다. 예: {"error": "no IDLs found for program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"}.
요청 매개변수
string
필수
base58로 인코딩된 프로그램 주소입니다.
인증
경로 매개변수
base58로 인코딩된 프로그램 주소입니다.
예시:
"KLend2g3cP87fffoy8q1mQqGKjrxjC8boSyAYavgmjD"
이 페이지가 도움이 되었나요?
⌘I
IDL 버전 목록 조회
curl --request GET \
--url 'https://mainnet.helius-rpc.com/v1/parsed-events/idl/{programId}?api-key='import requests
url = "https://mainnet.helius-rpc.com/v1/parsed-events/idl/{programId}?api-key="
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://mainnet.helius-rpc.com/v1/parsed-events/idl/{programId}?api-key=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://mainnet.helius-rpc.com/v1/parsed-events/idl/{programId}?api-key=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://mainnet.helius-rpc.com/v1/parsed-events/idl/{programId}?api-key="
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://mainnet.helius-rpc.com/v1/parsed-events/idl/{programId}?api-key=")
.asString();require 'uri'
require 'net/http'
url = URI("https://mainnet.helius-rpc.com/v1/parsed-events/idl/{programId}?api-key=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body[
{
"slot": 182747476,
"sources": [
"anchor"
]
},
{
"slot": 205509752,
"sources": [
"anchor"
]
},
{
"slot": 206074074,
"sources": [
"anchor"
]
}
]{
"error": "invalid program id: notanaddress: String is the wrong size"
}Unauthorized{
"error": "no IDLs found for program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
}