Skip to content

Commit

Permalink
client: Add mock feature documentation (#3323)
Browse files Browse the repository at this point in the history
  • Loading branch information
acheroncrypto authored Oct 20, 2024
1 parent 7edc3c9 commit 770dee3
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
//! // Create program
//! let program = client.program(my_program::ID)?;
//!
//! // Send a transaction
//! // Send transaction
//! let my_account_kp = Keypair::new();
//! program
//! .request()
Expand All @@ -40,7 +40,7 @@
//! .signer(&my_account_kp)
//! .send()?;
//!
//! // Fetch an account
//! // Fetch account
//! let my_account: MyAccount = program.account(my_account_kp.pubkey())?;
//! assert_eq!(my_account.field, 42);
//!
Expand All @@ -54,11 +54,20 @@
//!
//! # Features
//!
//! ## `async`
//!
//! The client is blocking by default. To enable asynchronous client, add `async` feature:
//!
//! ```toml
//! anchor-client = { version = "0.30.1 ", features = ["async"] }
//! ````
//!
//! ## `mock`
//!
//! This feature allows passing in a custom RPC client when creating program instances, which is
//! useful for mocking RPC responses, e.g. via [`RpcClient::new_mock`].
//!
//! [`RpcClient::new_mock`]: https://docs.rs/solana-client/2.0.8/solana_client/rpc_client/struct.RpcClient.html#method.new_mock

use anchor_lang::solana_program::program_error::ProgramError;
use anchor_lang::solana_program::pubkey::Pubkey;
Expand Down

0 comments on commit 770dee3

Please sign in to comment.