diff --git a/Cargo.lock b/Cargo.lock index cbf4f29912..1c719ddb1e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -229,6 +229,7 @@ dependencies = [ "solana-faucet", "solana-rpc-client", "solana-sdk", + "solana-signer", "syn 1.0.109", "tar", "toml 0.7.8", @@ -250,6 +251,7 @@ dependencies = [ "solana-rpc-client", "solana-rpc-client-api", "solana-sdk", + "solana-signer", "thiserror 1.0.66", "tokio", "url", diff --git a/Cargo.toml b/Cargo.toml index 62500be082..ada2dab70c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,5 +16,8 @@ resolver = "2" [profile.release] lto = true +[workspace.dependencies] +solana-signer = "2" + [profile.release.package.anchor-cli] codegen-units = 1 diff --git a/cli/Cargo.toml b/cli/Cargo.toml index a1448a115c..be28b97b4a 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -40,6 +40,7 @@ solana-cli-config = "2" solana-faucet = "2" solana-rpc-client = "2" solana-sdk = "2" +solana-signer.workspace = true syn = { version = "1.0.60", features = ["full", "extra-traits"] } tar = "0.4.35" toml = "0.7.6" diff --git a/cli/src/config.rs b/cli/src/config.rs index e9b2e760c2..fbf7a7dbd4 100644 --- a/cli/src/config.rs +++ b/cli/src/config.rs @@ -12,7 +12,8 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer}; use solana_cli_config::{Config as SolanaConfig, CONFIG_FILE}; use solana_sdk::clock::Slot; use solana_sdk::pubkey::Pubkey; -use solana_sdk::signature::{Keypair, Signer}; +use solana_sdk::signature::Keypair; +use solana_signer::Signer; use std::collections::{BTreeMap, HashMap}; use std::convert::TryFrom; use std::fs::{self, File}; diff --git a/cli/src/lib.rs b/cli/src/lib.rs index b8ad661b77..930a21ef2d 100644 --- a/cli/src/lib.rs +++ b/cli/src/lib.rs @@ -28,9 +28,8 @@ use solana_sdk::compute_budget::ComputeBudgetInstruction; use solana_sdk::instruction::{AccountMeta, Instruction}; use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Keypair; -use solana_sdk::signature::Signer; -use solana_sdk::signer::EncodableKey; use solana_sdk::transaction::Transaction; +use solana_signer::{EncodableKey, Signer}; use std::collections::BTreeMap; use std::collections::HashMap; use std::collections::HashSet; diff --git a/cli/src/rust_template.rs b/cli/src/rust_template.rs index 18a9c35709..2d184527e5 100644 --- a/cli/src/rust_template.rs +++ b/cli/src/rust_template.rs @@ -8,8 +8,8 @@ use heck::{ToLowerCamelCase, ToPascalCase, ToSnakeCase}; use solana_sdk::{ pubkey::Pubkey, signature::{read_keypair_file, write_keypair_file, Keypair}, - signer::Signer, }; +use solana_signer::Signer; use std::{ fmt::Write as _, fs::{self, File}, diff --git a/client/Cargo.toml b/client/Cargo.toml index ac2044e935..d7eebec0b1 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -27,6 +27,7 @@ solana-rpc-client = "2" solana-rpc-client-api = "2" solana-account = "2" solana-sdk = "2" +solana-signer.workspace = true thiserror = "1" tokio = { version = "1", features = ["rt", "sync"] } url = "2" diff --git a/client/example/Cargo.toml b/client/example/Cargo.toml index b167a8f0c8..d6fbd6cca1 100644 --- a/client/example/Cargo.toml +++ b/client/example/Cargo.toml @@ -21,3 +21,4 @@ clap = { version = "4.2.4", features = ["derive"] } shellexpand = "2.1.0" solana-sdk = "2" tokio = { version = "1", features = ["full"] } +solana-signer = "2" \ No newline at end of file diff --git a/client/example/src/blocking.rs b/client/example/src/blocking.rs index eaf7a01b28..25af63408e 100644 --- a/client/example/src/blocking.rs +++ b/client/example/src/blocking.rs @@ -1,5 +1,5 @@ use anchor_client::solana_sdk::pubkey::Pubkey; -use anchor_client::solana_sdk::signature::{Keypair, Signer}; +use anchor_client::solana_sdk::signature::Keypair; use anchor_client::solana_sdk::system_instruction; use anchor_client::{Client, Cluster}; use anyhow::Result; @@ -7,6 +7,7 @@ use clap::Parser; use solana_sdk::commitment_config::CommitmentConfig; use solana_sdk::signature::read_keypair_file; use solana_sdk::system_program; +use solana_signer::Signer; // 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; diff --git a/client/example/src/nonblocking.rs b/client/example/src/nonblocking.rs index 4c7b0fd66b..ba40e071fc 100644 --- a/client/example/src/nonblocking.rs +++ b/client/example/src/nonblocking.rs @@ -1,5 +1,5 @@ use anchor_client::solana_sdk::pubkey::Pubkey; -use anchor_client::solana_sdk::signature::{Keypair, Signer}; +use anchor_client::solana_sdk::signature::Keypair; use anchor_client::solana_sdk::system_instruction; use anchor_client::{Client, Cluster}; use anyhow::Result; @@ -7,6 +7,7 @@ use clap::Parser; use solana_sdk::commitment_config::CommitmentConfig; use solana_sdk::signature::read_keypair_file; use solana_sdk::system_program; +use solana_signer::Signer; // 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; diff --git a/client/src/blocking.rs b/client/src/blocking.rs index 9bfbeae5bd..2529be4d75 100644 --- a/client/src/blocking.rs +++ b/client/src/blocking.rs @@ -8,9 +8,9 @@ use solana_rpc_client::nonblocking::rpc_client::RpcClient as AsyncRpcClient; use solana_rpc_client::rpc_client::RpcClient; use solana_rpc_client_api::{config::RpcSendTransactionConfig, filter::RpcFilterType}; use solana_sdk::{ - commitment_config::CommitmentConfig, signature::Signature, signer::Signer, - transaction::Transaction, + commitment_config::CommitmentConfig, signature::Signature, transaction::Transaction, }; +use solana_signer::Signer; use std::{marker::PhantomData, ops::Deref, sync::Arc}; use tokio::{ runtime::{Builder, Handle}, diff --git a/client/src/lib.rs b/client/src/lib.rs index 652f96cafa..ef1f9d00e5 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -90,8 +90,9 @@ use solana_rpc_client_api::{ use solana_sdk::commitment_config::CommitmentConfig; use solana_sdk::hash::Hash; use solana_sdk::instruction::{AccountMeta, Instruction}; -use solana_sdk::signature::{Signature, Signer}; +use solana_sdk::signature::Signature; use solana_sdk::transaction::Transaction; +use solana_signer::{Signer, SignerError}; use std::iter::Map; use std::marker::PhantomData; use std::ops::Deref; @@ -184,7 +185,7 @@ impl Signer for DynSigner { self.0.pubkey() } - fn try_pubkey(&self) -> Result { + fn try_pubkey(&self) -> Result { self.0.try_pubkey() } @@ -195,7 +196,7 @@ impl Signer for DynSigner { fn try_sign_message( &self, message: &[u8], - ) -> Result { + ) -> Result { self.0.try_sign_message(message) } diff --git a/client/src/nonblocking.rs b/client/src/nonblocking.rs index a534a7eb42..81f4d5c95d 100644 --- a/client/src/nonblocking.rs +++ b/client/src/nonblocking.rs @@ -6,9 +6,9 @@ use anchor_lang::{prelude::Pubkey, AccountDeserialize, Discriminator}; use solana_rpc_client::nonblocking::rpc_client::RpcClient as AsyncRpcClient; use solana_rpc_client_api::{config::RpcSendTransactionConfig, filter::RpcFilterType}; use solana_sdk::{ - commitment_config::CommitmentConfig, signature::Signature, signer::Signer, - transaction::Transaction, + commitment_config::CommitmentConfig, signature::Signature, transaction::Transaction, }; +use solana_signer::Signer; use std::{marker::PhantomData, ops::Deref, sync::Arc}; use tokio::sync::RwLock; diff --git a/docs/content/docs/clients/rust.mdx b/docs/content/docs/clients/rust.mdx index dc0ba0546d..e8b4962b73 100644 --- a/docs/content/docs/clients/rust.mdx +++ b/docs/content/docs/clients/rust.mdx @@ -173,8 +173,9 @@ use anchor_client::{ solana_client::rpc_client::RpcClient, solana_sdk::{ commitment_config::CommitmentConfig, native_token::LAMPORTS_PER_SOL, signature::Keypair, - signer::Signer, system_program, + system_program, }, + solana_signer::Signer, Client, Cluster, }; use anchor_lang::prelude::*; diff --git a/docs/content/docs/features/declare-program.mdx b/docs/content/docs/features/declare-program.mdx index dff77c940f..c685ca7552 100644 --- a/docs/content/docs/features/declare-program.mdx +++ b/docs/content/docs/features/declare-program.mdx @@ -593,8 +593,9 @@ use anchor_client::{ solana_client::rpc_client::RpcClient, solana_sdk::{ commitment_config::CommitmentConfig, native_token::LAMPORTS_PER_SOL, signature::Keypair, - signer::Signer, system_program, + system_program, }, + solana_signer::Signer, Client, Cluster, }; use anchor_lang::prelude::*; diff --git a/tests/bench/bench.json b/tests/bench/bench.json index 2301c2ebdc..05532c6cde 100644 --- a/tests/bench/bench.json +++ b/tests/bench/bench.json @@ -1398,9 +1398,9 @@ }, "stackMemory": { "account_info1": 46, - "account_info2": 80, - "account_info4": 80, - "account_info8": 80, + "account_info2": 88, + "account_info4": 88, + "account_info8": 88, "account_empty_init1": 88, "account_empty_init2": 88, "account_empty_init4": 88, diff --git a/tests/zero-copy/programs/zero-copy/tests/compute_unit_test.rs b/tests/zero-copy/programs/zero-copy/tests/compute_unit_test.rs index 593620ca46..a9d339bb81 100644 --- a/tests/zero-copy/programs/zero-copy/tests/compute_unit_test.rs +++ b/tests/zero-copy/programs/zero-copy/tests/compute_unit_test.rs @@ -7,9 +7,10 @@ use { solana_sdk::{ commitment_config::CommitmentConfig, pubkey::Pubkey, - signature::{Keypair, Signer}, + signature::Keypair, transaction::Transaction, }, + solana_signer::Signer, Client, Cluster, }, solana_program_test::{tokio, ProgramTest},