Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for mock RPC Client in anchor_client #3050

Closed
cryptopapi997 opened this issue Jun 26, 2024 · 3 comments · Fixed by #3053
Closed

Add support for mock RPC Client in anchor_client #3050

cryptopapi997 opened this issue Jun 26, 2024 · 3 comments · Fixed by #3053
Labels
client enhancement New feature or request

Comments

@cryptopapi997
Copy link
Contributor

Solana client has a a feature that allows you to generate and use a mock rpc client, which is supremely useful when doing unit tests. Anchor client (as far as I can tell) doesn't support this when using RequestBuilder and instead always uses the passed cluster under the hood:

(https://github.com/coral-xyz/anchor/blob/master/client/src/lib.rs#L641)
(https://github.com/coral-xyz/anchor/blob/master/client/src/lib.rs#L650)
... and more

It would be cool if we could pass in an RPCClient instead of a cluster when creating a client to allow for mocking.

@acheroncrypto acheroncrypto added enhancement New feature or request client labels Jun 26, 2024
@acheroncrypto
Copy link
Collaborator

I agree, mocking is useful, and this would be a nice feature to have.

@cryptopapi997
Copy link
Contributor Author

Sweet, working on a PR rn.

@cryptopapi997
Copy link
Contributor Author

Done, feel free to take a look @acheroncrypto #3053

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants