anchor icon indicating copy to clipboard operation
anchor copied to clipboard

Add support for mock RPC Client in anchor_client

Open cryptopapi997 opened this issue 8 months ago • 3 comments

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.

cryptopapi997 avatar Jun 26 '24 10:06 cryptopapi997