curl versions working fine
curl http://api.mainnet-beta.solana.com -X POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0",
"id": 1,
"method": "getProgramAccounts",
"params": [
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
{
"encoding": "jsonParsed",
"filters": [
{
"dataSize": 165
},
{
"memcmp": {
"offset": 32,
"bytes": "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg"
}
}
]
}
]
}
'
Rust version failed
Cargo.toml
[package]
name = "poc"
version = "0.1.0"
edition = "2021"
[dependencies]
solana-client = "1.10.19"
solana-sdk = "1.10.19"
spl-token = "3.3.0"
main.rs
use solana_client::{
rpc_client::RpcClient,
rpc_filter::{RpcFilterType, Memcmp, MemcmpEncodedBytes, MemcmpEncoding},
rpc_config::RpcProgramAccountsConfig,
};
use solana_sdk::{commitment_config::CommitmentConfig, bs58};
use spl_token;
fn main() {
const MY_WALLET_ADDRESS: &str = "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg";
let rpc_url = String::from("http://api.mainnet-beta.solana.com");
let connection = RpcClient::new_with_commitment(rpc_url, CommitmentConfig::confirmed());
let filters = Some(vec![
RpcFilterType::Memcmp(Memcmp {
offset: 32,
bytes: MemcmpEncodedBytes::Base58(
bs58::encode(MY_WALLET_ADDRESS).into_string(),
),
encoding: Some(MemcmpEncoding::Binary),
}),
RpcFilterType::DataSize(165),
]);
let accounts = connection.get_program_accounts_with_config(
&spl_token::ID,
RpcProgramAccountsConfig {
filters,
..RpcProgramAccountsConfig::default()
},
).unwrap();
println!("Found {:?} token account(s) for wallet {MY_WALLET_ADDRESS}: ", accounts.len());
for (i, account) in accounts.iter().enumerate() {
println!("-- Token Account Address {:?}: {:?} --", i, account);
}
}
thread 'main' panicked at 'called
Result::unwrap()
on anErr
value: ClientError { request: Some(GetProgramAccounts), kind: RpcError(RpcResponseError { code: -32010, message: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA excluded from account secondary indexes; this RPC method unavailable for key", data: Empty }) }', src/main.rs:32:7
This look identical to me, not sure what causing this. I did read through discord and github which said provider remove Tokenkeg...
support due to high resource used but incase curl
is working fine so I don't think that's the case?