2

I'm using the solana/web3.js library (I tried both Alchemy and Quicknode endpoints). When I try to filter the results on getSignaturesForAddress using minContextSlot passing a specific slot (for example, 173290599), it returns the same result as when I omit this option (i.e., all transactions without filtering).

I've tried using both Quicknode and Alchemy for the RPC connection. Here is the code:

const signatures = await this.solanaConnection.getSignaturesForAddress(pubKey, { minContextSlot: fromSlot });

2 Answers 2

1

This is some unclear behavior about how minContextSlot works. It's meant to check that the RPC node is at least up to a certain slot to avoid accessing stale data, and not as a filtering mechanism.

If you wanted to add the functionality, it would be really easy! You just need to add a new filtering parameter on the get_signatures_for_address RPC, and then change the highest_slot to that new parameter in this line: https://github.com/solana-labs/solana/blob/bd9b311c630a10bb5c16b567e51bd61c21aabff9/rpc/src/rpc.rs#L1591, so you'd do:

let request_slot = // something passed in to the function
blockstore.get_confirmed_signatures_for_address2(address, request_slot, before, until, limit)
0

If you wanted to implement it with the current API, you could use connection.getBlock(minSlot - j) with j=1.. until you hit a block, extract one of the transactions from it and pass its signature to until.

Or you choose the pragmatic version and filter the return value of getSignaturesForAddress using item.slot >= minSlot.

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.