Token & NFT (DAS)
getTokenAccounts
Ambil semua akun token SPL yang dimiliki oleh alamat dompet, termasuk saldo token, alamat mint, dan metadata akun, dengan paginasi
POST
/
getTokenAccounts
curl --request POST \
--url 'https://mainnet.helius-rpc.com/?api-key=' \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"id": "1",
"method": "getTokenAccounts",
"params": {
"owner": "86xCnPeV69n6t3DnyGvkKobf9FdN2H9oiVDdaMpo2MMY"
}
}
'import requests
url = "https://mainnet.helius-rpc.com/?api-key="
payload = {
"jsonrpc": "2.0",
"id": "1",
"method": "getTokenAccounts",
"params": { "owner": "86xCnPeV69n6t3DnyGvkKobf9FdN2H9oiVDdaMpo2MMY" }
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
jsonrpc: '2.0',
id: '1',
method: 'getTokenAccounts',
params: {owner: '86xCnPeV69n6t3DnyGvkKobf9FdN2H9oiVDdaMpo2MMY'}
})
};
fetch('https://mainnet.helius-rpc.com/?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/?api-key=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'jsonrpc' => '2.0',
'id' => '1',
'method' => 'getTokenAccounts',
'params' => [
'owner' => '86xCnPeV69n6t3DnyGvkKobf9FdN2H9oiVDdaMpo2MMY'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://mainnet.helius-rpc.com/?api-key="
payload := strings.NewReader("{\n \"jsonrpc\": \"2.0\",\n \"id\": \"1\",\n \"method\": \"getTokenAccounts\",\n \"params\": {\n \"owner\": \"86xCnPeV69n6t3DnyGvkKobf9FdN2H9oiVDdaMpo2MMY\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://mainnet.helius-rpc.com/?api-key=")
.header("Content-Type", "application/json")
.body("{\n \"jsonrpc\": \"2.0\",\n \"id\": \"1\",\n \"method\": \"getTokenAccounts\",\n \"params\": {\n \"owner\": \"86xCnPeV69n6t3DnyGvkKobf9FdN2H9oiVDdaMpo2MMY\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://mainnet.helius-rpc.com/?api-key=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"jsonrpc\": \"2.0\",\n \"id\": \"1\",\n \"method\": \"getTokenAccounts\",\n \"params\": {\n \"owner\": \"86xCnPeV69n6t3DnyGvkKobf9FdN2H9oiVDdaMpo2MMY\"\n }\n}"
response = http.request(request)
puts response.read_body{
"last_indexed_slot": 365750752,
"total": 2,
"limit": 100,
"cursor": "<string>",
"token_accounts": [
{
"address": "<string>",
"mint": "<string>",
"owner": "<string>",
"amount": 123,
"delegated_amount": 123,
"frozen": true,
"burnt": "<unknown>"
}
]
}{
"jsonrpc": "2.0",
"error": {
"code": -32602,
"message": "Parameter permintaan tidak valid."
},
"id": "1"
}{
"jsonrpc": "2.0",
"error": {
"code": -32001,
"message": "Autentikasi gagal. Kunci API tidak ada atau tidak valid."
},
"id": "1"
}{
"jsonrpc": "2.0",
"error": {
"code": -32003,
"message": "Anda tidak memiliki izin untuk mengakses sumber daya ini."
},
"id": "1"
}{
"jsonrpc": "2.0",
"error": {
"code": -32004,
"message": "Sumber daya yang diminta tidak ditemukan."
},
"id": "1"
}{
"jsonrpc": "2.0",
"error": {
"code": -32029,
"message": "Batas laju terlampaui. Silakan coba lagi nanti."
},
"id": "1"
}{
"jsonrpc": "2.0",
"error": {
"code": -32000,
"message": "Terjadi kesalahan tak terduga pada server."
},
"id": "1"
}Parameter Permintaan
string
Kunci alamat mint.
string
Kunci alamat pemilik.
number
Halaman hasil yang akan dikembalikan.
number
Jumlah maksimum aset yang akan dikembalikan.
string
Kursor yang digunakan untuk paginasi.
string
Mengembalikan hasil sebelum kursor yang ditentukan.
string
Mengembalikan hasil setelah kursor yang ditentukan.
object
boolean
Jika true, tampilkan akun dengan saldo token kosong.
Otorisasi
Body
application/json
Versi protokol JSON-RPC.
Opsi yang tersedia:
2.0 ID untuk mengidentifikasi permintaan.
Contoh:
"1"
Nama metode yang akan dipanggil.
Opsi yang tersedia:
getTokenAccounts Show child attributes
Show child attributes
Respons
Respons berhasil
Semua data hingga dan termasuk slot ini dijamin telah diindeks.
Contoh:
365750752
Jumlah hasil yang ditemukan untuk permintaan tersebut.
Contoh:
2
Jumlah maksimum hasil yang diminta.
Contoh:
100
Kursor yang digunakan untuk paginasi.
Larik akun token.
Show child attributes
Show child attributes
Apakah halaman ini membantu?
⌘I
getTokenAccounts
curl --request POST \
--url 'https://mainnet.helius-rpc.com/?api-key=' \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"id": "1",
"method": "getTokenAccounts",
"params": {
"owner": "86xCnPeV69n6t3DnyGvkKobf9FdN2H9oiVDdaMpo2MMY"
}
}
'import requests
url = "https://mainnet.helius-rpc.com/?api-key="
payload = {
"jsonrpc": "2.0",
"id": "1",
"method": "getTokenAccounts",
"params": { "owner": "86xCnPeV69n6t3DnyGvkKobf9FdN2H9oiVDdaMpo2MMY" }
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
jsonrpc: '2.0',
id: '1',
method: 'getTokenAccounts',
params: {owner: '86xCnPeV69n6t3DnyGvkKobf9FdN2H9oiVDdaMpo2MMY'}
})
};
fetch('https://mainnet.helius-rpc.com/?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/?api-key=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'jsonrpc' => '2.0',
'id' => '1',
'method' => 'getTokenAccounts',
'params' => [
'owner' => '86xCnPeV69n6t3DnyGvkKobf9FdN2H9oiVDdaMpo2MMY'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://mainnet.helius-rpc.com/?api-key="
payload := strings.NewReader("{\n \"jsonrpc\": \"2.0\",\n \"id\": \"1\",\n \"method\": \"getTokenAccounts\",\n \"params\": {\n \"owner\": \"86xCnPeV69n6t3DnyGvkKobf9FdN2H9oiVDdaMpo2MMY\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://mainnet.helius-rpc.com/?api-key=")
.header("Content-Type", "application/json")
.body("{\n \"jsonrpc\": \"2.0\",\n \"id\": \"1\",\n \"method\": \"getTokenAccounts\",\n \"params\": {\n \"owner\": \"86xCnPeV69n6t3DnyGvkKobf9FdN2H9oiVDdaMpo2MMY\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://mainnet.helius-rpc.com/?api-key=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"jsonrpc\": \"2.0\",\n \"id\": \"1\",\n \"method\": \"getTokenAccounts\",\n \"params\": {\n \"owner\": \"86xCnPeV69n6t3DnyGvkKobf9FdN2H9oiVDdaMpo2MMY\"\n }\n}"
response = http.request(request)
puts response.read_body{
"last_indexed_slot": 365750752,
"total": 2,
"limit": 100,
"cursor": "<string>",
"token_accounts": [
{
"address": "<string>",
"mint": "<string>",
"owner": "<string>",
"amount": 123,
"delegated_amount": 123,
"frozen": true,
"burnt": "<unknown>"
}
]
}{
"jsonrpc": "2.0",
"error": {
"code": -32602,
"message": "Parameter permintaan tidak valid."
},
"id": "1"
}{
"jsonrpc": "2.0",
"error": {
"code": -32001,
"message": "Autentikasi gagal. Kunci API tidak ada atau tidak valid."
},
"id": "1"
}{
"jsonrpc": "2.0",
"error": {
"code": -32003,
"message": "Anda tidak memiliki izin untuk mengakses sumber daya ini."
},
"id": "1"
}{
"jsonrpc": "2.0",
"error": {
"code": -32004,
"message": "Sumber daya yang diminta tidak ditemukan."
},
"id": "1"
}{
"jsonrpc": "2.0",
"error": {
"code": -32029,
"message": "Batas laju terlampaui. Silakan coba lagi nanti."
},
"id": "1"
}{
"jsonrpc": "2.0",
"error": {
"code": -32000,
"message": "Terjadi kesalahan tak terduga pada server."
},
"id": "1"
}