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

feat: Add option to pass in rpc client when using anchor_client #3053

Merged
merged 14 commits into from
Jul 19, 2024

Conversation

cryptopapi997
Copy link
Contributor

Resolves #3050

Copy link

vercel bot commented Jun 26, 2024

@cryptopapi997 is attempting to deploy a commit to the coral-xyz Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Collaborator

@acheroncrypto acheroncrypto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not directly accept mocks (similar to new_mock_with_mocks), with a new feature called mock? I feel like this would be easier to discover and use.

@cryptopapi997
Copy link
Contributor Author

cryptopapi997 commented Jun 27, 2024

I feel like the way it's currently is more general, which in this case is a good thing because it means if the solana mock doesn't support a specific kind of operation anyone can spin up their own adapted mock version and pass it in. The docs for new_mock_with_mocks method themselves also say this

It is primarily for internal use, with limited customizability, and behaviors determined by internal Solana test cases. New users should consider implementing RpcSender themselves and constructing RpcClient with RpcClient::new_sender to get mock behavior.

Happy to rename the feature to mock though if you think that's more clear.

@cryptopapi997
Copy link
Contributor Author

wdyt @acheroncrypto ?

Copy link
Collaborator

@acheroncrypto acheroncrypto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to rename the feature to mock though if you think that's more clear.

Yeah, I think it's more clear.

Also, we might have to merge #3057 first as you mentioned in its description.

client/src/blocking.rs Outdated Show resolved Hide resolved
client/src/lib.rs Outdated Show resolved Hide resolved
client/src/nonblocking.rs Outdated Show resolved Hide resolved
@cryptopapi997
Copy link
Contributor Author

Addressed your comments and renamed it to mock. And yea, I agree best to merge this after #3057 just in case.

@cryptopapi997
Copy link
Contributor Author

Now that #3057 is merged we can go back to this one, just merged master into here. Feel free to take a look when you get a chance @acheroncrypto

client/src/lib.rs Outdated Show resolved Hide resolved
client/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@acheroncrypto acheroncrypto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, thanks!

@acheroncrypto acheroncrypto merged commit f8d0f52 into coral-xyz:master Jul 19, 2024
48 of 49 checks passed
@cryptopapi997 cryptopapi997 deleted the mock-rpc-client branch September 11, 2024 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for mock RPC Client in anchor_client
2 participants