5

I would like to get only fresh program accounts by context slot. But when I use the getProgramAccounts method with minContextSlot parameter, nothing happens, I just get the all program accounts.

1 Answer 1

1

minContextSlot will return the program accounts if the effective slot for the query is at least this value.

Eg if you pass in minContextSlot = 100, but the node only has the account state up until slot = 99, it'll return an error, forcing you to retry the query.

Not sure what you mean by "fresh program accounts", but if you're trying to query accounts that were created or modified after a certain slot, it's quite difficult to do this historically unless you've indexed all the account changes yourself.

You can do this going forward in time by listening to onProgramAccountChange via WS (messages can be dropped!) or listening to an accountsDB geyser plugin (expensive).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.