Questions tagged [getprogramaccounts]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2 votes
1 answer
62 views

Get Holders timeout

I want get total holders of a token, this is my code : const accounts = await connection.getProgramAccounts( programId, { dataSlice: { // for amount data slice ...
iori's user avatar
  • 58
0 votes
1 answer
115 views

How to getProgramAccounts for Token 2022 Program?

I am trying to send get request as follows but it returns nothing... Can you please guide me how to fix this issue? and how to figure out the datasize and bytes for any program address... { jsonrpc:&...
kokiez's user avatar
  • 95
1 vote
1 answer
34 views

Can I change program data ID of the program account?

When fetching the program account using getAccountInfo rpc, it will return the following response: { "jsonrpc": "2.0", "result": { "context": { ...
johnhckuo's user avatar
  • 135
0 votes
1 answer
31 views

Find custom program accounts

How can I find all accounts of my wallet which is owned by a specific program? (Not any of the metaplex programs)
Muhit Raihan's user avatar
0 votes
0 answers
30 views

Implement get_program_accounts using BanksClient

BanksClient doesn't have a get_program_accounts method. Is there a way to mimic it?
KevinH's user avatar
  • 402
1 vote
1 answer
83 views

memcmp filter similar to LIKE %

say i have a PDA struct Foo { created_at: i64 } with a created_at unix sec timestamp field (ex: 1690004000). I want to filter all PDAs that were created in 1690000000. as far as i know ints are ...
amilkov's user avatar
  • 23
2 votes
1 answer
142 views

Get AccountInfo from ProgramId, or invoke program method using ProgramID

If I've programId (Pubkey) of a program, is it possible to get AccountInfo (or Program) object somehow? Or conversely, is it possible to somehow invoke a (view) method on program if its programId is ...
Sarfaraz Nawaz's user avatar
1 vote
1 answer
112 views

How to get Address Lookup Tables owned by given Pubkey via filtering the LookupTableProgramAccounts?

I want to retrieve the LookupTables of a certain Pubkey by filtering the LookupTableProgram accounts. Which filter do I need to set to filter for a given authority? let accounts = rpc_client ....
bamboofighter's user avatar
1 vote
1 answer
72 views

How to filter through boolean with getProgramAccounts?

I know how to filter a getProgramAccounts with a publicKey but I am struggling to do it with a boolean. I tried: { memcmp: { offset: 8 + 4, bytes: false, }, }, It gives me an error, ...
rudy rhatal's user avatar
4 votes
2 answers
134 views

How to sort accounts after a getProgramAccounts?

I use getProgramAccounts to get a big number of accounts. I would like to only get the first 5 accounts with the highest field score. I know that pagination and ordering is not supported officially, ...
rudy rhatal's user avatar
5 votes
1 answer
189 views

Limits of getProgramAccounts?

The official documentation does not mention the limits of getProgramAccounts, just that we should not abuse it. Can I get 50 accounts with 500 bytes each ? Or 5000 accounts with 500 bytes each ? I ...
rudy rhatal's user avatar
4 votes
1 answer
639 views

Borsh Deserialization error: Trying to access beyond buffer length

I've seen some similar threads regarding this problem but none have provided a stable solution. I get the following error when attempting to fetch and deserialize account data: Deserialization error: ...
Joey Meere's user avatar
2 votes
1 answer
129 views

What's the max return size of the getProgramAccounts call?

The docs just mention "If the results of a query are too large, the response will be truncated." What's the max data size of the query that can be returned? I understand I can do b64+zstd ...
Dev Bharel's user avatar
2 votes
1 answer
186 views

Can't find owner's tokens with Metaplex

I'm working on a front-end. I want to fetch all the NFT of a specific collection the user owns. I used to do: const tokens = await metaplex .nfts() .findAllByOwner({ owner: provider.publicKey }...
Dodecahedr0x's user avatar
1 vote
0 answers
16 views

Question about solana programs

Why is it recommended that solana programs check the validity of any account it reads, but does not modify?
Mehmet Ayd's user avatar
1 vote
1 answer
293 views

How to deserialize data from getProgramAccounts?

How can I deserialize data after a getProgramAccounts with JS ? const accounts = await provider.connection.getProgramAccounts(program.programId); console.log(accounts[0]) I see the log result: ...
rudy rhatal's user avatar
0 votes
2 answers
157 views

My sol stuck in prgram. How can I close program and recover it?

I was deploying program and by mistake I missed the keyword program and just typed solana deploy <PROGRAM_FILEPATH> which return the below program Id and there is no upgradeable authority. Now ...
Abdul Maajid's user avatar
0 votes
1 answer
93 views

How can I read tokens with an amount of 0 with getParsedProgramAccounts?

I am developing an application. I read the tokens by using getParsedProgramAccounts. In the last weeks I read the tokens with amount of 0 to see which were once connected with the program Id. However, ...
Kevin's user avatar
  • 1
3 votes
3 answers
542 views

How can I convert a number to a base58 string?

I need to convert a number (ex. 1, 2, 32, 43, etc) into a base58 string in order to use it in getProgramAccounts memcmp filters. I'm able to do this with strings, but I've been unable to find a ...
web3man's user avatar
  • 87
2 votes
2 answers
99 views

How to calculate offset for the Stake Program in getProgramAccounts

I'd like to come up with the right memcmp->offset filter to be used with getProgramAccounts. I am trying to query stake accounts associated with a voter. I spent a bunch of time looking up the ...
Arash's user avatar
  • 23
3 votes
1 answer
157 views

How can I use memcmp to get an account with a certain u32 value?

I'm trying to fetch all of a certain account that matches defined u32 values. My account struct looks something like this: #[account] pub struct Round { pub bump: u8, // 1 pub authority: ...
web3man's user avatar
  • 87
1 vote
1 answer
252 views

How can base64 encoded replies be requested for `getProgramAccounts`

I am currently using getProgramAccounts but receiving following error. { "jsonrpc":"2.0", "error":{ "code":-32600, "message":"...
gud's user avatar
  • 395
1 vote
1 answer
601 views

Rust Client - Get Serum liquidity pool info

I'd like to get account data from a Serum Liquidity Pool in my Solana Rust Client. I have chosen the path to do this in Rust, so please avoid asking why I don't do this in TypeScript. I have ...
CTKI's user avatar
  • 43
5 votes
2 answers
321 views

Can an RPC node maintain an index of accounts per a certain query?

For example, the getProgramAccounts RPC method allows one to query accounts. There are two parameters in particular which I think could be useful here: program-id memcap, which refers to a byte ...
agrippa's user avatar
  • 116
3 votes
2 answers
99 views

How the scope for memcmp works when the struct has multiple strings?

Let's imagine I have this account and I want to filter all the Program Accounts by the author: pub struct EntryBook { title: String, author: String } How would be the offset to target the ...
Silvestre Vivo's user avatar
0 votes
1 answer
52 views

Who does the search for `getProgramAccounts()` call?

Do the RPC nodes do the search or do they distribute it to the validator nodes? If it is RPC nodes, do they have to store the entire ledger to do this?
itsfarseen's user avatar
7 votes
1 answer
108 views

Do the `length` and `memcmp` filters of `getProgramAccounts()` reduce the scan space?

Do they use a linear search or do they have any search indexes in place for the length and memcmp filters? Or do they just save us from sending all the accounts over the network, and the CPU usage ...
itsfarseen's user avatar
7 votes
1 answer
111 views

What is the algorithmic complexity of the getProgramAccounts() call?

How does the getProgramAccounts() scale as the number of accounts stored on the chain grows?
itsfarseen's user avatar
1 vote
0 answers
63 views

What are the performance characteristics of the getProgramAccounts() call? Is it scalable as the chain grows? [closed]

What is the algorithmic complexity of a getProgramAccounts() call? Do the Solana nodes store all the accounts ever created? Do the nodes have to scan the entire ledger? Are there any indexes in place? ...
itsfarseen's user avatar