SDK
import { Client } from '@solana-tracker/data-api';
const client = new Client({ apiKey: 'YOUR_API_KEY' });
const data = await client.getWalletTokensV2('CN8w8cuh87gZYjhpaPxbD78GTrBmUKmVysqgsC9uYu9i', {
sort: 'value', // Or 'amount' or 'change24h'.
minValue: 1, // Hides tokens worth less than $1.
limit: 100,
});
for (const row of data.holdings) {
console.log(data.tokens[row.mint]?.symbol, row.amount, row.usd, row.market?.market);
}
// client.iterateWalletTokensV2() walks every page.
curl --request GET \
--url https://data.solanatracker.io/v2/wallet/{wallet}/tokens \
--header 'x-api-key: <api-key>'import requests
url = "https://data.solanatracker.io/v2/wallet/{wallet}/tokens"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://data.solanatracker.io/v2/wallet/{wallet}/tokens', 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://data.solanatracker.io/v2/wallet/{wallet}/tokens",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$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://data.solanatracker.io/v2/wallet/{wallet}/tokens"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://data.solanatracker.io/v2/wallet/{wallet}/tokens")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://data.solanatracker.io/v2/wallet/{wallet}/tokens")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"wallet": "CN8w8cuh87gZYjhpaPxbD78GTrBmUKmVysqgsC9uYu9i",
"slot": 475880510,
"updatedAt": 1796067095507,
"holdings": [
{
"mint": "So11111111111111111111111111111111111111112",
"native": true,
"amount": 90.206855417,
"priceUsd": 70.59621911611814,
"usd": 6368.262931,
"change24h": {
"usd": -143.111131,
"percent": -2.2
},
"apy": null,
"yearlyUsd": null,
"accounts": [
"CN8w8cuh87gZYjhpaPxbD78GTrBmUKmVysqgsC9uYu9i"
],
"priceSol": 1,
"marketCapUsd": 41798032000.91,
"market": {
"pool": "3ucNos4NbumPLZNWztqGHNFFgkHeRMBQAVemeeomsUxv",
"market": "raydium-clmm",
"quoteToken": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"liquidityUsd": 5463752.959761908,
"buys": 9655901,
"sells": 5678715,
"lpBurn": 0,
"createdAt": null,
"mintAuthority": null,
"freezeAuthority": null,
"volume24hUsd": 15002704.633705806
}
},
{
"mint": "2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo",
"native": false,
"amount": 331.403437,
"priceUsd": 1.0001716013994661,
"usd": 331.460306,
"change24h": {
"usd": 0.047309,
"percent": 0.01
},
"apy": null,
"yearlyUsd": null,
"accounts": [
"CwqQ9ATCstxfuXK5KAMP6NZQk3yPeGukssdgZicK6V31"
],
"priceSol": 0.0141674952841,
"marketCapUsd": 688800917.2,
"market": {
"pool": "9tXiuRRw7kbejLhZXtxDxYs2REe43uH2e7k1kocgdM9B",
"market": "orca",
"quoteToken": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"liquidityUsd": 18880560.60595127,
"buys": 19790,
"sells": 36656,
"lpBurn": 0,
"createdAt": 1739746605000,
"mintAuthority": "DRXA1H9SjZPyPCEeuAWpfwk8GqVW6dZsKFAtdfpFwApX",
"freezeAuthority": "2apBGMsS6ti9RyF5TwQTDswXBWskiJP2LD4cUEDqYJjk",
"volume24hUsd": 2984713.513107223
}
},
{
"mint": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
"native": false,
"amount": 90.041275,
"priceUsd": 1,
"usd": 90.041275,
"change24h": {
"usd": 0,
"percent": 0
},
"apy": null,
"yearlyUsd": null,
"accounts": [
"4PdxHm2q9pijHw1L2d3s52TwheVfAGuBYtXTXdJESVSZ"
],
"priceSol": 0.0141650645392,
"marketCapUsd": 3839903778.2,
"market": {
"pool": "7XawhbbxtsRcQA8KTkHT9f9nc6d69UwqCDh6U5EEbEmX",
"market": "raydium",
"quoteToken": "So11111111111111111111111111111111111111112",
"liquidityUsd": 837422.2772992249,
"buys": 863564,
"sells": 785526,
"lpBurn": 0,
"createdAt": null,
"mintAuthority": "Q6XprfkF8RQQKoQVG33xT88H7wi8Uk1B1CC7YAs69Gi",
"freezeAuthority": "Q6XprfkF8RQQKoQVG33xT88H7wi8Uk1B1CC7YAs69Gi",
"volume24hUsd": 100712.71976680927
}
}
],
"tokens": {
"So11111111111111111111111111111111111111112": {
"name": "Wrapped SOL",
"symbol": "SOL",
"decimals": 9,
"image": "https://image.solanatracker.io/proxy?url=https://static.datapi.jup.ag/token-icons/79a96c7b893fd899512411dd07a8adf6f9e26dd135989f51d46ddb50f0b8bb6c.webp",
"supply": 592071820.902525,
"uri": null,
"description": null,
"creator": null,
"createdOn": null,
"twitter": null,
"telegram": null,
"website": null
},
"2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo": {
"name": "PayPal USD",
"symbol": "PYUSD",
"decimals": 6,
"image": "https://image.solanatracker.io/proxy?url=https://static.datapi.jup.ag/token-icons/0817b3345e648b1663385bac48eb086877635ee27639c3d5da2a4d9dfd8603b1.webp",
"supply": 688682738.280124,
"uri": "https://token-metadata.paxos.com/pyusd_metadata/prod/solana/pyusd_metadata.json",
"description": "PayPal USD is designed to contribute to the opportunity stablecoins offer for payments and is 100% backed by U.S. dollar deposits, short-term U.S Treasuries and similar cash equivalents. PayPal USD is redeemable 1:1 for U.S. dollars and is issued by Paxos Trust Company.",
"creator": null,
"createdOn": null,
"twitter": null,
"telegram": null,
"website": null
},
"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB": {
"name": "USDT",
"symbol": "USDT",
"decimals": 6,
"image": "https://image.solanatracker.io/proxy?url=https://static.datapi.jup.ag/token-icons/36574a5ee2cd469e059d070180985e59fbd57c82a54ea95763fab39973174100.webp",
"supply": 3839903778.200564,
"uri": null,
"description": null,
"creator": null,
"createdOn": null,
"twitter": null,
"telegram": null,
"website": null
}
},
"nextCursor": "eyJ2IjoyLCJhdCI6MTc5NjA2NzA5NTUwNywicyI6OTAuMDQxMjc1LCJ0IjoiRXM5dk1GcnphQ0VSbUpmckY0SDJGWUQ0S0NvTmtZMTFNY0NlOEJlbndOWUIiLCJxIjoidHx2YWx1ZXxkfDEifQ",
"hasNextPage": true
}{
"error": "Invalid sort. Valid options are: value, amount, change24h"
}{
"error": "<string>"
}{
"error": "Wallet data is temporarily unavailable, please retry"
}Wallet
Solana 钱包代币持仓 API V2
获取 Solana 钱包持有的所有代币及其 USD 价值、24 小时变化、市值、收益率和定价池,可按价值、数量或涨跌排序。
GET
/
v2
/
wallet
/
{wallet}
/
tokens
SDK
import { Client } from '@solana-tracker/data-api';
const client = new Client({ apiKey: 'YOUR_API_KEY' });
const data = await client.getWalletTokensV2('CN8w8cuh87gZYjhpaPxbD78GTrBmUKmVysqgsC9uYu9i', {
sort: 'value', // Or 'amount' or 'change24h'.
minValue: 1, // Hides tokens worth less than $1.
limit: 100,
});
for (const row of data.holdings) {
console.log(data.tokens[row.mint]?.symbol, row.amount, row.usd, row.market?.market);
}
// client.iterateWalletTokensV2() walks every page.
curl --request GET \
--url https://data.solanatracker.io/v2/wallet/{wallet}/tokens \
--header 'x-api-key: <api-key>'import requests
url = "https://data.solanatracker.io/v2/wallet/{wallet}/tokens"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://data.solanatracker.io/v2/wallet/{wallet}/tokens', 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://data.solanatracker.io/v2/wallet/{wallet}/tokens",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$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://data.solanatracker.io/v2/wallet/{wallet}/tokens"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://data.solanatracker.io/v2/wallet/{wallet}/tokens")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://data.solanatracker.io/v2/wallet/{wallet}/tokens")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"wallet": "CN8w8cuh87gZYjhpaPxbD78GTrBmUKmVysqgsC9uYu9i",
"slot": 475880510,
"updatedAt": 1796067095507,
"holdings": [
{
"mint": "So11111111111111111111111111111111111111112",
"native": true,
"amount": 90.206855417,
"priceUsd": 70.59621911611814,
"usd": 6368.262931,
"change24h": {
"usd": -143.111131,
"percent": -2.2
},
"apy": null,
"yearlyUsd": null,
"accounts": [
"CN8w8cuh87gZYjhpaPxbD78GTrBmUKmVysqgsC9uYu9i"
],
"priceSol": 1,
"marketCapUsd": 41798032000.91,
"market": {
"pool": "3ucNos4NbumPLZNWztqGHNFFgkHeRMBQAVemeeomsUxv",
"market": "raydium-clmm",
"quoteToken": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"liquidityUsd": 5463752.959761908,
"buys": 9655901,
"sells": 5678715,
"lpBurn": 0,
"createdAt": null,
"mintAuthority": null,
"freezeAuthority": null,
"volume24hUsd": 15002704.633705806
}
},
{
"mint": "2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo",
"native": false,
"amount": 331.403437,
"priceUsd": 1.0001716013994661,
"usd": 331.460306,
"change24h": {
"usd": 0.047309,
"percent": 0.01
},
"apy": null,
"yearlyUsd": null,
"accounts": [
"CwqQ9ATCstxfuXK5KAMP6NZQk3yPeGukssdgZicK6V31"
],
"priceSol": 0.0141674952841,
"marketCapUsd": 688800917.2,
"market": {
"pool": "9tXiuRRw7kbejLhZXtxDxYs2REe43uH2e7k1kocgdM9B",
"market": "orca",
"quoteToken": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"liquidityUsd": 18880560.60595127,
"buys": 19790,
"sells": 36656,
"lpBurn": 0,
"createdAt": 1739746605000,
"mintAuthority": "DRXA1H9SjZPyPCEeuAWpfwk8GqVW6dZsKFAtdfpFwApX",
"freezeAuthority": "2apBGMsS6ti9RyF5TwQTDswXBWskiJP2LD4cUEDqYJjk",
"volume24hUsd": 2984713.513107223
}
},
{
"mint": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
"native": false,
"amount": 90.041275,
"priceUsd": 1,
"usd": 90.041275,
"change24h": {
"usd": 0,
"percent": 0
},
"apy": null,
"yearlyUsd": null,
"accounts": [
"4PdxHm2q9pijHw1L2d3s52TwheVfAGuBYtXTXdJESVSZ"
],
"priceSol": 0.0141650645392,
"marketCapUsd": 3839903778.2,
"market": {
"pool": "7XawhbbxtsRcQA8KTkHT9f9nc6d69UwqCDh6U5EEbEmX",
"market": "raydium",
"quoteToken": "So11111111111111111111111111111111111111112",
"liquidityUsd": 837422.2772992249,
"buys": 863564,
"sells": 785526,
"lpBurn": 0,
"createdAt": null,
"mintAuthority": "Q6XprfkF8RQQKoQVG33xT88H7wi8Uk1B1CC7YAs69Gi",
"freezeAuthority": "Q6XprfkF8RQQKoQVG33xT88H7wi8Uk1B1CC7YAs69Gi",
"volume24hUsd": 100712.71976680927
}
}
],
"tokens": {
"So11111111111111111111111111111111111111112": {
"name": "Wrapped SOL",
"symbol": "SOL",
"decimals": 9,
"image": "https://image.solanatracker.io/proxy?url=https://static.datapi.jup.ag/token-icons/79a96c7b893fd899512411dd07a8adf6f9e26dd135989f51d46ddb50f0b8bb6c.webp",
"supply": 592071820.902525,
"uri": null,
"description": null,
"creator": null,
"createdOn": null,
"twitter": null,
"telegram": null,
"website": null
},
"2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo": {
"name": "PayPal USD",
"symbol": "PYUSD",
"decimals": 6,
"image": "https://image.solanatracker.io/proxy?url=https://static.datapi.jup.ag/token-icons/0817b3345e648b1663385bac48eb086877635ee27639c3d5da2a4d9dfd8603b1.webp",
"supply": 688682738.280124,
"uri": "https://token-metadata.paxos.com/pyusd_metadata/prod/solana/pyusd_metadata.json",
"description": "PayPal USD is designed to contribute to the opportunity stablecoins offer for payments and is 100% backed by U.S. dollar deposits, short-term U.S Treasuries and similar cash equivalents. PayPal USD is redeemable 1:1 for U.S. dollars and is issued by Paxos Trust Company.",
"creator": null,
"createdOn": null,
"twitter": null,
"telegram": null,
"website": null
},
"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB": {
"name": "USDT",
"symbol": "USDT",
"decimals": 6,
"image": "https://image.solanatracker.io/proxy?url=https://static.datapi.jup.ag/token-icons/36574a5ee2cd469e059d070180985e59fbd57c82a54ea95763fab39973174100.webp",
"supply": 3839903778.200564,
"uri": null,
"description": null,
"creator": null,
"createdOn": null,
"twitter": null,
"telegram": null,
"website": null
}
},
"nextCursor": "eyJ2IjoyLCJhdCI6MTc5NjA2NzA5NTUwNywicyI6OTAuMDQxMjc1LCJ0IjoiRXM5dk1GcnphQ0VSbUpmckY0SDJGWUQ0S0NvTmtZMTFNY0NlOEJlbndOWUIiLCJxIjoidHx2YWx1ZXxkfDEifQ",
"hasNextPage": true
}{
"error": "Invalid sort. Valid options are: value, amount, change24h"
}{
"error": "<string>"
}{
"error": "Wallet data is temporarily unavailable, please retry"
}钱包中的每个代币,每个代币一行。分布在多个代币账户中的余额会合并计算。钱包的 SOL 余额单独一行,
native: true;代币账户中的 wrapped SOL 是另外一行。
每行包含 USD 和 SOL 价格、价值、24 小时变化、市值,以及 market(价格来源的池子)。流动性质押代币和 JLP 等生息代币还带有 apy 和 yearlyUsd。代币名称、符号和 logo 在 tokens 中。
代表 DeFi 仓位的代币(例如 LP 代币、金库份额或借贷凭证)不在此列出,而是出现在 Get Wallet Positions 中,因此不会重复计算。
没有价格的代币 priceUsd 为 null,不计入净值并排在最后。使用 minValue 可隐藏小额余额。
分页。 将 nextCursor 作为 cursor 传入,直到 hasNextPage 为 false,并保持 sort、sortDirection 和 minValue 不变。请在约 2 分钟内获取所有页面:之后余额会刷新,行可能在页面之间移动。
SDK Example
import { Client } from '@solana-tracker/data-api';
const client = new Client({ apiKey: 'YOUR_API_KEY' });
const data = await client.getWalletTokensV2('CN8w8cuh87gZYjhpaPxbD78GTrBmUKmVysqgsC9uYu9i', {
sort: 'value', // Or 'amount' or 'change24h'.
minValue: 1, // Hides tokens worth less than $1.
limit: 100,
});
for (const row of data.holdings) {
console.log(data.tokens[row.mint]?.symbol, row.amount, row.usd, row.market?.market);
}
// client.iterateWalletTokensV2() walks every page.
查询参数
响应
一页钱包代币。
此页面对您有帮助吗?