Documentation Index
Fetch the complete documentation index at: https://docs.chainstream.io/llms.txt
Use this file to discover all available pages before exploring further.
Code Export 기능은 현재 GraphQL 쿼리를 선택한 언어의 바로 쓸 수 있는 코드 스니펫으로 변환합니다. 생성된 코드에는 전체 HTTP 요청 설정 — 엔드포인트 URL, 인증 헤더, 쿼리 본문, variables — 가 포함되어 프로젝트에 그대로 붙여 넣을 수 있습니다.
지원 언어
| 언어 | 형식 | 용도 |
|---|
| cURL | Shell command | 빠른 터미널 테스트, CI/CD 스크립트 |
| Python | requests library | 백엔드 서비스, 데이터 파이프라인, Jupyter 노트북 |
| JavaScript | fetch API | 브라우저 앱, Node.js 서비스 |
| Go | net/http | 백엔드 마이크로서비스, CLI 도구 |
| Rust | reqwest crate | 고성능 서비스 |
| Ruby | net/http | Rails 앱, 스크립트 |
| PHP | cURL extension | PHP 백엔드, WordPress 플러그인 |
코드보내기
쿼리 작성
에디터에 쿼리를 입력하거나 불러옵니다. 보내기 전에 실행이 성공하는지 확인하세요.
Export Code 클릭
툴바의 Export Code 버튼을 클릭합니다. 언어 선택기와 생성된 스니펫이 있는 모달이 열립니다.
언어 선택
드롭다운에서 대상 언어를 고릅니다. 스니펫이 즉시 갱신됩니다.
스니펫 복사
Copy 버튼을 눌러 생성된 코드를 클립보드에 복사합니다.
보낸 코드는 현재 IDE 설정의 GraphQL 엔드포인트와 API key를 사용합니다. 사용자 지정 엔드포인트나 헤더를 설정했다면 생성 스니펫에도 반영됩니다.
예시 스니펫
아래는 간단한 DEXTrades 쿼리(Solana 최신 DEX 거래 10건)를 보낼 때 생성되는 스니펫 예시입니다.
query {
Solana {
DEXTrades(
limit: {count: 10}
orderBy: {descending: Block_Time}
) {
Block { Time }
Transaction { Hash }
Trade {
Buy { Currency { MintAddress } Amount PriceInUSD }
Sell { Currency { MintAddress } Amount }
Dex { ProtocolName }
}
}
}
}
cURL
Python
JavaScript
Go
Rust
curl -X POST "https://graphql.chainstream.io/graphql" \
-H "Content-Type: application/json" \
-H "X-API-KEY: your_api_key" \
-d '{
"query": "{ Solana { DEXTrades(limit: {count: 10}, orderBy: {descending: Block_Time}) { Block { Time } Transaction { Hash } Trade { Buy { Currency { MintAddress } Amount PriceInUSD } Sell { Currency { MintAddress } Amount } Dex { ProtocolName } } } } }"
}'
import requests
url = "https://graphql.chainstream.io/graphql"
headers = {
"Content-Type": "application/json",
"X-API-KEY": "your_api_key",
}
query = """
{
Solana {
DEXTrades(
limit: {count: 10}
orderBy: {descending: Block_Time}
) {
Block { Time }
Transaction { Hash }
Trade {
Buy { Currency { MintAddress } Amount PriceInUSD }
Sell { Currency { MintAddress } Amount }
Dex { ProtocolName }
}
}
}
}
"""
response = requests.post(url, json={"query": query}, headers=headers)
data = response.json()
print(data)
const response = await fetch("https://graphql.chainstream.io/graphql", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-KEY": "your_api_key",
},
body: JSON.stringify({
query: `{
Solana {
DEXTrades(
limit: {count: 10}
orderBy: {descending: Block_Time}
) {
Block { Time }
Transaction { Hash }
Trade {
Buy { Currency { MintAddress } Amount PriceInUSD }
Sell { Currency { MintAddress } Amount }
Dex { ProtocolName }
}
}
}
}`,
}),
});
const data = await response.json();
console.log(data);
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
payload := map[string]string{
"query": `{ Solana { DEXTrades(limit: {count: 10}, orderBy: {descending: Block_Time}) { Block { Time } Transaction { Hash } Trade { Buy { Currency { MintAddress } Amount PriceInUSD } Sell { Currency { MintAddress } Amount } Dex { ProtocolName } } } } }`,
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", "https://graphql.chainstream.io/graphql", bytes.NewBuffer(body))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-API-KEY", "your_api_key")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
result, _ := io.ReadAll(resp.Body)
fmt.Println(string(result))
}
use reqwest::header::{HeaderMap, HeaderValue, CONTENT_TYPE};
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let mut headers = HeaderMap::new();
headers.insert(CONTENT_TYPE, HeaderValue::from_static("application/json"));
headers.insert("X-API-KEY", HeaderValue::from_static("your_api_key"));
let body = json!({
"query": r#"{ Solana { DEXTrades(limit: {count: 10}, orderBy: {descending: Block_Time}) { Block { Time } Transaction { Hash } Trade { Buy { Currency { MintAddress } Amount PriceInUSD } Sell { Currency { MintAddress } Amount } Dex { ProtocolName } } } } }"#
});
let client = reqwest::Client::new();
let res = client
.post("https://graphql.chainstream.io/graphql")
.headers(headers)
.json(&body)
.send()
.await?;
println!("{}", res.text().await?);
Ok(())
}
보낸 코드에 포함되는 것
생성된 모든 스니펫에 포함됩니다.
| 구성 요소 | 설명 |
|---|
| Endpoint URL | https://graphql.chainstream.io/graphql |
| Authentication | IDE Headers 패널의 X-API-KEY 헤더 |
| Content-Type | application/json |
| Query body | 에디터의 전체 GraphQL 쿼리 |
| Variables | Variables 패널에 값이 있을 경우 포함 |
보낸 코드를 실행하기 전에 your_api_key를 실제 API key로 바꾸세요. 보안상 IDE는 보낸 스니펫에 실제 키를 넣지 않습니다.
- 보내기 전 테스트 — 먼저 IDE에서 쿼리를 실행해 동작을 확인하세요. 보낸 코드는 쿼리를 그대로 복사합니다.
- variables로 파라미터화 — 하드코딩 대신 GraphQL variables를 사용하세요. 보낸 코드에 쿼리와 함께
variables JSON이 포함됩니다.
- 의존성 확인 — Python은
requests, Rust는 reqwest, Go는 표준 라이브러리를 사용합니다. 프로젝트에 필요한 패키지가 설치되어 있는지 확인하세요.