Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ solana-cpi = "3.0.0"
solana-define-syscall = "3.0.0"
solana-faucet = "3.0.0"
solana-feature-gate-interface = "3.0.0"
solana-hash = "3.0.0"
solana-instruction = "3.0.0"
solana-instructions-sysvar = "3.0.0"
solana-invoke = "0.5.0"
Expand Down
10 changes: 10 additions & 0 deletions client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,24 @@ serde = { version = "1", features = ["derive"] }
solana-account.workspace = true
solana-account-decoder.workspace = true
solana-commitment-config.workspace = true
solana-hash.workspace = true
solana-instruction.workspace = true
solana-keypair.workspace = true
solana-program.workspace = true
solana-pubkey.workspace = true
solana-pubsub-client.workspace = true
solana-rpc-client.workspace = true
solana-rpc-client-api.workspace = true
solana-signature.workspace = true
solana-signer.workspace = true
solana-system-interface.workspace = true
solana-transaction.workspace = true
thiserror = "1"
tokio = { version = "1", features = ["rt", "sync"] }
url = "2"

[dev-dependencies]
solana-pubkey.workspace = true
my-program = { path = "../examples/tutorial/basic-1/programs/basic-1", package = "basic-1", features = [
"no-entrypoint",
] }
4 changes: 0 additions & 4 deletions client/example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,4 @@ events = { path = "../../tests/events/programs/events", features = ["no-entrypoi
anyhow = "1.0.32"
clap = { version = "4.2.4", features = ["derive"] }
shellexpand = "2.1.0"
solana-commitment-config = "3.0.0"
solana-sdk = "3.0.0"
solana-signer = "3.0.0"
solana-system-interface = "2.0.0"
tokio = { version = "1", features = ["full"] }
13 changes: 7 additions & 6 deletions client/example/src/blocking.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
use anchor_client::solana_commitment_config::CommitmentConfig;
use anchor_client::solana_keypair::{read_keypair_file, Keypair};
use anchor_client::solana_pubkey::Pubkey;
use anchor_client::solana_signer::Signer;
use anchor_client::solana_system_interface::{
instruction as system_instruction, program as system_program,
};
use anchor_client::{Client, Cluster};
use anyhow::Result;
use clap::Parser;
use solana_commitment_config::CommitmentConfig;
use solana_sdk::pubkey::Pubkey;
use solana_sdk::signature::read_keypair_file;
use solana_sdk::signature::{Keypair, Signer};
use solana_system_interface::instruction as system_instruction;
use solana_system_interface::program as system_program;
// The `accounts` and `instructions` modules are generated by the framework.
use basic_2::accounts as basic_2_accounts;
use basic_2::instruction as basic_2_instruction;
Expand Down
2 changes: 1 addition & 1 deletion client/example/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use anyhow::Result;
use clap::Parser;
use solana_sdk::pubkey::Pubkey;
use anchor_client::solana_pubkey::Pubkey;

#[cfg(not(feature = "async"))]
mod blocking;
Expand Down
13 changes: 7 additions & 6 deletions client/example/src/nonblocking.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
use anchor_client::solana_commitment_config::CommitmentConfig;
use anchor_client::solana_keypair::{read_keypair_file, Keypair};
use anchor_client::solana_pubkey::Pubkey;
use anchor_client::solana_signer::Signer;
use anchor_client::solana_system_interface::{
instruction as system_instruction, program as system_program,
};
use anchor_client::{Client, Cluster};
use anyhow::Result;
use clap::Parser;
use solana_commitment_config::CommitmentConfig;
use solana_sdk::pubkey::Pubkey;
use solana_sdk::signature::read_keypair_file;
use solana_sdk::signature::{Keypair, Signer};
use solana_system_interface::instruction as system_instruction;
use solana_system_interface::program as system_program;
// The `accounts` and `instructions` modules are generated by the framework.
use basic_2::accounts as basic_2_accounts;
use basic_2::instruction as basic_2_instruction;
Expand Down
24 changes: 14 additions & 10 deletions client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@
//!
//! A simple example that creates a client, sends a transaction and fetches an account:
//!
//! ```ignore
//! ```no_run
//! use std::rc::Rc;
//!
//! use anchor_client::{
//! solana_sdk::{
//! signature::{read_keypair_file, Keypair},
//! signer::Signer,
//! system_program,
//! },
//! solana_keypair::{read_keypair_file, Keypair},
//! solana_signer::Signer,
//! solana_system_interface::program as system_program,
//! Client, Cluster,
//! };
//! use my_program::{accounts, instruction, MyAccount};
Expand All @@ -33,16 +31,16 @@
//! .request()
//! .accounts(accounts::Initialize {
//! my_account: my_account_kp.pubkey(),
//! payer: program.payer(),
//! user: program.payer(),
//! system_program: system_program::ID,
//! })
//! .args(instruction::Initialize { field: 42 })
//! .args(instruction::Initialize { data: 42 })
//! .signer(&my_account_kp)
//! .send()?;
//!
//! // Fetch account
//! let my_account: MyAccount = program.account(my_account_kp.pubkey())?;
//! assert_eq!(my_account.field, 42);
//! assert_eq!(my_account.data, 42);
//!
//! Ok(())
//! }
Expand Down Expand Up @@ -76,8 +74,8 @@ use futures::{Future, StreamExt};
use regex::Regex;
use solana_account_decoder::{UiAccount, UiAccountEncoding};
use solana_commitment_config::CommitmentConfig;
use solana_hash::Hash;
use solana_instruction::{AccountMeta, Instruction};
use solana_program::hash::Hash;
use solana_pubsub_client::nonblocking::pubsub_client::{PubsubClient, PubsubClientError};
use solana_rpc_client::nonblocking::rpc_client::RpcClient as AsyncRpcClient;
use solana_rpc_client_api::{
Expand Down Expand Up @@ -112,7 +110,13 @@ pub use anchor_lang;
pub use cluster::Cluster;
#[cfg(feature = "async")]
pub use nonblocking::ThreadSafeSigner;

pub use solana_account_decoder;
pub use solana_commitment_config;
pub use solana_keypair;
pub use solana_pubkey;
pub use solana_signer;
pub use solana_system_interface;
Comment on lines +115 to +119
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I had already made a PR (#4211) that exports the types used by our public API. Whether we should export crates that the client doesn't actually use (but people might find convenient) is another question, and the answer is not immediately clear to me when we consider our new approach of minimizing bulk exports.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I'm inclined to say it makes sense to do this, at least for the bare minimum types which are necessary to create a client (especially when these crates are already in anchor-clients dep graph, unlike in the case of re-exporting the entire solana-sdk)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Closing in favour of #4211


mod cluster;

Expand Down
2 changes: 2 additions & 0 deletions examples/tutorial/basic-1/programs/basic-1/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ name = "basic_1"
no-entrypoint = []
cpi = ["no-entrypoint"]
idl-build = ["anchor-lang/idl-build"]
anchor-debug = ["anchor-lang/anchor-debug"]
no-log-ix-name = []

[dependencies]
anchor-lang = { path = "../../../../../lang" }
3 changes: 3 additions & 0 deletions examples/tutorial/basic-1/programs/basic-1/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// FIXME: This lint is being triggered somewhere in macro output
#![expect(clippy::diverging_sub_expression)]

use anchor_lang::prelude::*;

declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS");
Expand Down