enhancedGetTokensAndNFTs
Learn how to use the enhancedGetTokensAndNFTs JSON-RPC method.
POST
/
#enhancedGetTokensAndNFTs
enhancedGetTokensAndNFTs
curl --request POST \
--url 'https://rpc.particle.network/solana/#enhancedGetTokensAndNFTs' \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"id": 1,
"chainId": 101,
"method": "enhancedGetTokensAndNFTs",
"params": [
{
"accountAddress": "6XU36wCxWobLx5Rtsb58kmgAJKVYmMVqy4SHXxENAyAe"
}
]
}
'import requests
url = "https://rpc.particle.network/solana/#enhancedGetTokensAndNFTs"
payload = {
"jsonrpc": "2.0",
"id": 1,
"chainId": 101,
"method": "enhancedGetTokensAndNFTs",
"params": [{ "accountAddress": "6XU36wCxWobLx5Rtsb58kmgAJKVYmMVqy4SHXxENAyAe" }]
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
jsonrpc: '2.0',
id: 1,
chainId: 101,
method: 'enhancedGetTokensAndNFTs',
params: [{accountAddress: '6XU36wCxWobLx5Rtsb58kmgAJKVYmMVqy4SHXxENAyAe'}]
})
};
fetch('https://rpc.particle.network/solana/#enhancedGetTokensAndNFTs', 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.particle.network/solana/#enhancedGetTokensAndNFTs",
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,
'chainId' => 101,
'method' => 'enhancedGetTokensAndNFTs',
'params' => [
[
'accountAddress' => '6XU36wCxWobLx5Rtsb58kmgAJKVYmMVqy4SHXxENAyAe'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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.particle.network/solana/#enhancedGetTokensAndNFTs"
payload := strings.NewReader("{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"chainId\": 101,\n \"method\": \"enhancedGetTokensAndNFTs\",\n \"params\": [\n {\n \"accountAddress\": \"6XU36wCxWobLx5Rtsb58kmgAJKVYmMVqy4SHXxENAyAe\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.particle.network/solana/#enhancedGetTokensAndNFTs")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"chainId\": 101,\n \"method\": \"enhancedGetTokensAndNFTs\",\n \"params\": [\n {\n \"accountAddress\": \"6XU36wCxWobLx5Rtsb58kmgAJKVYmMVqy4SHXxENAyAe\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://rpc.particle.network/solana/#enhancedGetTokensAndNFTs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"chainId\": 101,\n \"method\": \"enhancedGetTokensAndNFTs\",\n \"params\": [\n {\n \"accountAddress\": \"6XU36wCxWobLx5Rtsb58kmgAJKVYmMVqy4SHXxENAyAe\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"jsonrpc": "2.0",
"id": 1,
"chainId": 101,
"result": {
"lamports": 123,
"nfts": [
{
"mint": "<string>",
"address": "<string>",
"isSemiFungible": true,
"name": "<string>",
"symbol": "<string>",
"image": "<string>",
"sellerFeeBasisPoints": 123,
"metadata": {
"key": 123,
"updateAuthority": "<string>",
"mint": "<string>",
"data": {
"name": "<string>",
"symbol": "<string>",
"uri": "<string>",
"sellerFeeBasisPoints": 123,
"creators": [
{
"address": "<string>",
"verified": true,
"share": 123
}
],
"uriData": {}
},
"primarySaleHappened": true,
"isMutable": true,
"editionNonce": 123
}
}
],
"tokens": [
{
"decimals": 123,
"amount": 123,
"address": "<string>",
"mint": "<string>",
"name": "<string>",
"symbol": "<string>",
"image": "<string>"
}
]
}
}Contextualizing enhancedGetTokensAndNFTs
enhancedGetTokensAndNFTs, like its EVM counterpart,getTokensAndNFTs, retrieves a detailed list of tokens and NFTs that belong to a specific address. It takes:address- a base58-encoded string.- Object, optional:
parseMetadataUri- Boolean (falseby default).
Query example
JavaScript
const axios = require('axios');
(async () => {
const response = await axios.post('https://rpc.particle.network/solana', {
chainId: 103,
jsonrpc: '2.0',
id: 0,
method: 'enhancedGetTokensAndNFTs',
params: ['6XU36wCxWobLx5Rtsb58kmgAJKVYmMVqy4SHXxENAyAe', {
parseMetadataUri: true,
}],
}, {
auth: {
username: 'Your Project Id',
password: 'Your Project Server Key',
}
});
console.log(response.data);
})();
Authorizations
Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.
Body
application/json
Request to get tokens and NFTs for an account.
Version of the JSON-RPC protocol, should be 2.0.
Example:
"2.0"
The request identifier.
Example:
1
The blockchain chain ID.
Example:
101
API method being called.
Available options:
enhancedGetTokensAndNFTs Parameters for getting tokens and NFTs.
Account address details.
- Option 1
- Option 2
Show child attributes
Show child attributes
Response
200 - application/json
Successful response with tokens and NFTs information.
Was this page helpful?
⌘I
enhancedGetTokensAndNFTs
curl --request POST \
--url 'https://rpc.particle.network/solana/#enhancedGetTokensAndNFTs' \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"id": 1,
"chainId": 101,
"method": "enhancedGetTokensAndNFTs",
"params": [
{
"accountAddress": "6XU36wCxWobLx5Rtsb58kmgAJKVYmMVqy4SHXxENAyAe"
}
]
}
'import requests
url = "https://rpc.particle.network/solana/#enhancedGetTokensAndNFTs"
payload = {
"jsonrpc": "2.0",
"id": 1,
"chainId": 101,
"method": "enhancedGetTokensAndNFTs",
"params": [{ "accountAddress": "6XU36wCxWobLx5Rtsb58kmgAJKVYmMVqy4SHXxENAyAe" }]
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
jsonrpc: '2.0',
id: 1,
chainId: 101,
method: 'enhancedGetTokensAndNFTs',
params: [{accountAddress: '6XU36wCxWobLx5Rtsb58kmgAJKVYmMVqy4SHXxENAyAe'}]
})
};
fetch('https://rpc.particle.network/solana/#enhancedGetTokensAndNFTs', 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.particle.network/solana/#enhancedGetTokensAndNFTs",
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,
'chainId' => 101,
'method' => 'enhancedGetTokensAndNFTs',
'params' => [
[
'accountAddress' => '6XU36wCxWobLx5Rtsb58kmgAJKVYmMVqy4SHXxENAyAe'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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.particle.network/solana/#enhancedGetTokensAndNFTs"
payload := strings.NewReader("{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"chainId\": 101,\n \"method\": \"enhancedGetTokensAndNFTs\",\n \"params\": [\n {\n \"accountAddress\": \"6XU36wCxWobLx5Rtsb58kmgAJKVYmMVqy4SHXxENAyAe\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.particle.network/solana/#enhancedGetTokensAndNFTs")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"chainId\": 101,\n \"method\": \"enhancedGetTokensAndNFTs\",\n \"params\": [\n {\n \"accountAddress\": \"6XU36wCxWobLx5Rtsb58kmgAJKVYmMVqy4SHXxENAyAe\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://rpc.particle.network/solana/#enhancedGetTokensAndNFTs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"chainId\": 101,\n \"method\": \"enhancedGetTokensAndNFTs\",\n \"params\": [\n {\n \"accountAddress\": \"6XU36wCxWobLx5Rtsb58kmgAJKVYmMVqy4SHXxENAyAe\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"jsonrpc": "2.0",
"id": 1,
"chainId": 101,
"result": {
"lamports": 123,
"nfts": [
{
"mint": "<string>",
"address": "<string>",
"isSemiFungible": true,
"name": "<string>",
"symbol": "<string>",
"image": "<string>",
"sellerFeeBasisPoints": 123,
"metadata": {
"key": 123,
"updateAuthority": "<string>",
"mint": "<string>",
"data": {
"name": "<string>",
"symbol": "<string>",
"uri": "<string>",
"sellerFeeBasisPoints": 123,
"creators": [
{
"address": "<string>",
"verified": true,
"share": 123
}
],
"uriData": {}
},
"primarySaleHappened": true,
"isMutable": true,
"editionNonce": 123
}
}
],
"tokens": [
{
"decimals": 123,
"amount": 123,
"address": "<string>",
"mint": "<string>",
"name": "<string>",
"symbol": "<string>",
"image": "<string>"
}
]
}
}