getProgramAccounts
curl --request POST \
--url 'https://rpc-mainnet.solanatracker.io/?api_key=' \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"id": "db16f277-1a22-41ff-9f85-f37e2cd77900",
"method": "getProgramAccounts",
"params": [
"4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T"
]
}
'import requests
url = "https://rpc-mainnet.solanatracker.io/?api_key="
payload = {
"jsonrpc": "2.0",
"id": "db16f277-1a22-41ff-9f85-f37e2cd77900",
"method": "getProgramAccounts",
"params": ["4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T"]
}
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: 'db16f277-1a22-41ff-9f85-f37e2cd77900',
method: 'getProgramAccounts',
params: ['4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T']
})
};
fetch('https://rpc-mainnet.solanatracker.io/?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://rpc-mainnet.solanatracker.io/?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' => 'db16f277-1a22-41ff-9f85-f37e2cd77900',
'method' => 'getProgramAccounts',
'params' => [
'4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T'
]
]),
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://rpc-mainnet.solanatracker.io/?api_key="
payload := strings.NewReader("{\n \"jsonrpc\": \"2.0\",\n \"id\": \"db16f277-1a22-41ff-9f85-f37e2cd77900\",\n \"method\": \"getProgramAccounts\",\n \"params\": [\n \"4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T\"\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://rpc-mainnet.solanatracker.io/?api_key=")
.header("Content-Type", "application/json")
.body("{\n \"jsonrpc\": \"2.0\",\n \"id\": \"db16f277-1a22-41ff-9f85-f37e2cd77900\",\n \"method\": \"getProgramAccounts\",\n \"params\": [\n \"4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://rpc-mainnet.solanatracker.io/?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\": \"db16f277-1a22-41ff-9f85-f37e2cd77900\",\n \"method\": \"getProgramAccounts\",\n \"params\": [\n \"4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"jsonrpc": "2.0",
"id": "db16f277-1a22-41ff-9f85-f37e2cd77900",
"result": [
{
"pubkey": "CxELquR1gPP8wHe33gZ4QxqGB3sZ9RSwsJ2KshVewkFY",
"account": {
"lamports": 15298080,
"owner": "4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T",
"data": [
"2R9jLfiAQ9bgdcw6h8s44439",
"base58"
],
"executable": false,
"rentEpoch": 28,
"space": 42
}
}
]
}{
"jsonrpc": "2.0",
"error": {
"code": -32602,
"message": "Invalid params",
"data": {}
},
"id": "db16f277-1a22-41ff-9f85-f37e2cd77900"
}{
"jsonrpc": "2.0",
"error": {
"code": -32001,
"message": "Unauthorized",
"data": {}
},
"id": "db16f277-1a22-41ff-9f85-f37e2cd77900"
}{
"jsonrpc": "2.0",
"error": {
"code": -32005,
"message": "Too many requests",
"data": {}
},
"id": "db16f277-1a22-41ff-9f85-f37e2cd77900"
}{
"jsonrpc": "2.0",
"error": {
"code": -32603,
"message": "Internal error",
"data": {}
},
"id": "db16f277-1a22-41ff-9f85-f37e2cd77900"
}{
"jsonrpc": "2.0",
"error": {
"code": -32002,
"message": "Service unavailable",
"data": {}
},
"id": "db16f277-1a22-41ff-9f85-f37e2cd77900"
}{
"jsonrpc": "2.0",
"error": {
"code": -32003,
"message": "Gateway timeout",
"data": {}
},
"id": "db16f277-1a22-41ff-9f85-f37e2cd77900"
}账户方法
getProgramAccounts
Runs the Solana RPC getProgramAccounts method.
POST
/
getProgramAccounts
curl --request POST \
--url 'https://rpc-mainnet.solanatracker.io/?api_key=' \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"id": "db16f277-1a22-41ff-9f85-f37e2cd77900",
"method": "getProgramAccounts",
"params": [
"4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T"
]
}
'import requests
url = "https://rpc-mainnet.solanatracker.io/?api_key="
payload = {
"jsonrpc": "2.0",
"id": "db16f277-1a22-41ff-9f85-f37e2cd77900",
"method": "getProgramAccounts",
"params": ["4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T"]
}
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: 'db16f277-1a22-41ff-9f85-f37e2cd77900',
method: 'getProgramAccounts',
params: ['4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T']
})
};
fetch('https://rpc-mainnet.solanatracker.io/?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://rpc-mainnet.solanatracker.io/?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' => 'db16f277-1a22-41ff-9f85-f37e2cd77900',
'method' => 'getProgramAccounts',
'params' => [
'4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T'
]
]),
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://rpc-mainnet.solanatracker.io/?api_key="
payload := strings.NewReader("{\n \"jsonrpc\": \"2.0\",\n \"id\": \"db16f277-1a22-41ff-9f85-f37e2cd77900\",\n \"method\": \"getProgramAccounts\",\n \"params\": [\n \"4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T\"\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://rpc-mainnet.solanatracker.io/?api_key=")
.header("Content-Type", "application/json")
.body("{\n \"jsonrpc\": \"2.0\",\n \"id\": \"db16f277-1a22-41ff-9f85-f37e2cd77900\",\n \"method\": \"getProgramAccounts\",\n \"params\": [\n \"4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://rpc-mainnet.solanatracker.io/?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\": \"db16f277-1a22-41ff-9f85-f37e2cd77900\",\n \"method\": \"getProgramAccounts\",\n \"params\": [\n \"4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"jsonrpc": "2.0",
"id": "db16f277-1a22-41ff-9f85-f37e2cd77900",
"result": [
{
"pubkey": "CxELquR1gPP8wHe33gZ4QxqGB3sZ9RSwsJ2KshVewkFY",
"account": {
"lamports": 15298080,
"owner": "4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T",
"data": [
"2R9jLfiAQ9bgdcw6h8s44439",
"base58"
],
"executable": false,
"rentEpoch": 28,
"space": 42
}
}
]
}{
"jsonrpc": "2.0",
"error": {
"code": -32602,
"message": "Invalid params",
"data": {}
},
"id": "db16f277-1a22-41ff-9f85-f37e2cd77900"
}{
"jsonrpc": "2.0",
"error": {
"code": -32001,
"message": "Unauthorized",
"data": {}
},
"id": "db16f277-1a22-41ff-9f85-f37e2cd77900"
}{
"jsonrpc": "2.0",
"error": {
"code": -32005,
"message": "Too many requests",
"data": {}
},
"id": "db16f277-1a22-41ff-9f85-f37e2cd77900"
}{
"jsonrpc": "2.0",
"error": {
"code": -32603,
"message": "Internal error",
"data": {}
},
"id": "db16f277-1a22-41ff-9f85-f37e2cd77900"
}{
"jsonrpc": "2.0",
"error": {
"code": -32002,
"message": "Service unavailable",
"data": {}
},
"id": "db16f277-1a22-41ff-9f85-f37e2cd77900"
}{
"jsonrpc": "2.0",
"error": {
"code": -32003,
"message": "Gateway timeout",
"data": {}
},
"id": "db16f277-1a22-41ff-9f85-f37e2cd77900"
}⚡ 由 Solana Ridge DB 提供支持通过 Ridge DB(我们专为 Solana 上的高性能账户检索而定制构建的客户端)获取更快的 Solana 账户数据。与标准 RPC 方法不同,Ridge DB 使用专门的索引,使查询程序账户的速度显著加快。它的与众不同之处:只需追踪新账户?使用
changedSince 获取在某个 slot 之后修改的账户,这样您就不必重新加载所有内容。使用游标分页可以高效检索所有匹配的账户,每次请求最多 10k 条。高负载注意事项此端点会将所有账户直接流式返回给您的客户端。虽然在大多数查询场景下表现良好,但在高负载或查询拥有数百万账户的程序(例如流动性池或协议拥有的账户)时,可能会返回错误。需要更高的可靠性? 请改用 getProgramAccountsV2。V2 方法包含分页支持,对于大型程序和高流量场景更加高效和可靠。
授权
请求体
application/json
The JSON-RPC protocol version.
可用选项:
2.0 示例:
"2.0"
A unique identifier for the request.
示例:
"1"
The name of the RPC method to invoke.
可用选项:
getProgramAccounts 示例:
"getProgramAccounts"
Parameters for the method.
The Solana program public key (address) to query accounts for, as a base-58 encoded string.
示例:
"4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T"
此页面对您有帮助吗?
⌘I