钱包
获取钱包余额
检索Solana钱包地址的代币余额和SOL持有量。
GET
/
v1
/
wallet
/
{wallet}
/
balances
获取钱包余额
curl --request GET \
--url 'https://api.helius.xyz/v1/wallet/{wallet}/balances?api-key='import requests
url = "https://api.helius.xyz/v1/wallet/{wallet}/balances?api-key="
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.helius.xyz/v1/wallet/{wallet}/balances?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://api.helius.xyz/v1/wallet/{wallet}/balances?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://api.helius.xyz/v1/wallet/{wallet}/balances?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://api.helius.xyz/v1/wallet/{wallet}/balances?api-key=")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.helius.xyz/v1/wallet/{wallet}/balances?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{
"balances": [
{
"mint": "So11111111111111111111111111111111111111112",
"balance": 1.5,
"decimals": 9,
"tokenProgram": "spl-token",
"symbol": "SOL",
"name": "Solana",
"pricePerToken": 145.32,
"usdValue": 217.98,
"logoUri": "https://example.com/sol-logo.png"
}
],
"totalUsdValue": 217.98,
"pagination": {
"page": 1,
"limit": 100,
"hasMore": true
},
"nfts": [
{
"mint": "7Xq8wXyXVqfBPPqVJjPDwG9zN5wCVxBYZ6z7vPYBzr6F",
"compressed": false,
"name": "Degen Ape",
"imageUri": "https://example.com/nft.png",
"collectionName": "Degen Ape Academy",
"collectionAddress": "DegN1dXmU2uYa4n7U9qTh7YNYpK4u8L9qXx7XqYqJfGH"
}
]
}{
"error": "无效的钱包地址",
"code": 400,
"details": "'invalid-address'不是有效的Solana地址"
}{
"error": "需要API密钥。通过?api-key=xxx或X-Api-Key头传递",
"code": 401
}{
"error": "RATE_LIMIT_EXCEEDED",
"code": 429,
"details": "请求过多。请在 2 秒后重试。"
}{
"error": "INTERNAL_ERROR",
"code": 500,
"details": "发生意外错误。请重试。"
}每次请求花费 100 积分。
请求参数
string
默认值:"GQUtvPx89ZNCwmvQqFmH59bJcU8fW8siETpaxod7Aydz"
必填
Solana 钱包地址(base58 编码)
number
默认值:"1"
分页页码(以1为起始)
number
默认值:"100"
每页最大代币数量
boolean
默认值:"false"
包含余额为零的代币
boolean
默认值:"true"
结果中包含本地SOL
boolean
默认值:"false"
结果中包含NFT(最多100个,仅限第一页)
授权
ApiKeyQueryApiKeyHeader
作为查询参数传递的API密钥
路径参数
Solana 钱包地址(base58 编码)
Pattern:
^[1-9A-HJ-NP-Za-km-z]{32,44}$查询参数
分页的页码(从1开始)
必填范围:
x >= 1每页的最大代币数量
必填范围:
1 <= x <= 100包含零余额的代币
在结果中包含本地SOL
在结果中包含NFT(最多100个,仅限第一页)
响应
成功检索到钱包余额
当前页面的代币余额数组,包括本机SOL。 当showNative=true时,SOL作为第一个元素出现,铸币地址为So11111111111111111111111111111111111111112。 其他代币按美元价值排序 (降序)。
Show child attributes
Show child attributes
本页面余额的总美元价值(不是总投资组合价值)
示例:
217.98
分页元数据。用户必须使用页面参数手动请求更多页面。
Show child attributes
Show child attributes
NFT持有数组(仅在showNfts=true时包含,最多100个,仅限第一页)
Show child attributes
Show child attributes
此页面对您有帮助吗?
⌘I
获取钱包余额
curl --request GET \
--url 'https://api.helius.xyz/v1/wallet/{wallet}/balances?api-key='import requests
url = "https://api.helius.xyz/v1/wallet/{wallet}/balances?api-key="
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.helius.xyz/v1/wallet/{wallet}/balances?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://api.helius.xyz/v1/wallet/{wallet}/balances?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://api.helius.xyz/v1/wallet/{wallet}/balances?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://api.helius.xyz/v1/wallet/{wallet}/balances?api-key=")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.helius.xyz/v1/wallet/{wallet}/balances?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{
"balances": [
{
"mint": "So11111111111111111111111111111111111111112",
"balance": 1.5,
"decimals": 9,
"tokenProgram": "spl-token",
"symbol": "SOL",
"name": "Solana",
"pricePerToken": 145.32,
"usdValue": 217.98,
"logoUri": "https://example.com/sol-logo.png"
}
],
"totalUsdValue": 217.98,
"pagination": {
"page": 1,
"limit": 100,
"hasMore": true
},
"nfts": [
{
"mint": "7Xq8wXyXVqfBPPqVJjPDwG9zN5wCVxBYZ6z7vPYBzr6F",
"compressed": false,
"name": "Degen Ape",
"imageUri": "https://example.com/nft.png",
"collectionName": "Degen Ape Academy",
"collectionAddress": "DegN1dXmU2uYa4n7U9qTh7YNYpK4u8L9qXx7XqYqJfGH"
}
]
}{
"error": "无效的钱包地址",
"code": 400,
"details": "'invalid-address'不是有效的Solana地址"
}{
"error": "需要API密钥。通过?api-key=xxx或X-Api-Key头传递",
"code": 401
}{
"error": "RATE_LIMIT_EXCEEDED",
"code": 429,
"details": "请求过多。请在 2 秒后重试。"
}{
"error": "INTERNAL_ERROR",
"code": 500,
"details": "发生意外错误。请重试。"
}