-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
impl signer now includes deref impl signer #2706
base: master
Are you sure you want to change the base?
impl signer now includes deref impl signer #2706
Conversation
@cavemanloverboy is attempting to deploy a commit to the coral-xyz Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that
Signer
is implemented for allDeref<Target = impl Signer>
withinsolana-sdk
, we can remove this from the client without introducing breaking changes.
Unfortunately not because solana-labs/solana#32181 requires ^1.17
but we still support 1.16
.
Also, nonblocking client needs to be updated too.
updated |
Yes, I think it's better to wait until |
🫡 |
this may be ready to go soon |
bump |
/// Auxiliary data structure to align the types of the Solana CLI utils with Anchor client. | ||
/// Client<C> implementation requires <C: Clone + Deref<Target = impl Signer>> which does not comply with Box<dyn Signer> | ||
/// that's used when loaded Signer from keypair file. This struct is used to wrap the usage. | ||
pub struct DynSigner(pub Arc<dyn Signer>); | ||
// /// Auxiliary data structure to align the types of the Solana CLI utils with Anchor client. | ||
// /// Client<C> implementation requires <C: Clone + impl Signer> which does not comply with Box<dyn Signer> | ||
// /// that's used when loaded Signer from keypair file. This struct is used to wrap the usage. | ||
// pub struct DynSigner(pub Arc<dyn Signer>); | ||
|
||
impl Signer for DynSigner { | ||
fn pubkey(&self) -> Pubkey { | ||
self.0.pubkey() | ||
} | ||
// impl Signer for DynSigner { | ||
// fn pubkey(&self) -> Pubkey { | ||
// self.0.pubkey() | ||
// } | ||
|
||
fn try_pubkey(&self) -> Result<Pubkey, solana_sdk::signer::SignerError> { | ||
self.0.try_pubkey() | ||
} | ||
// fn try_pubkey(&self) -> Result<Pubkey, solana_sdk::signer::SignerError> { | ||
// self.0.try_pubkey() | ||
// } | ||
|
||
fn sign_message(&self, message: &[u8]) -> solana_sdk::signature::Signature { | ||
self.0.sign_message(message) | ||
} | ||
// fn sign_message(&self, message: &[u8]) -> solana_sdk::signature::Signature { | ||
// self.0.sign_message(message) | ||
// } | ||
|
||
fn try_sign_message( | ||
&self, | ||
message: &[u8], | ||
) -> Result<solana_sdk::signature::Signature, solana_sdk::signer::SignerError> { | ||
self.0.try_sign_message(message) | ||
} | ||
// fn try_sign_message( | ||
// &self, | ||
// message: &[u8], | ||
// ) -> Result<solana_sdk::signature::Signature, solana_sdk::signer::SignerError> { | ||
// self.0.try_sign_message(message) | ||
// } | ||
|
||
fn is_interactive(&self) -> bool { | ||
self.0.is_interactive() | ||
} | ||
} | ||
// fn is_interactive(&self) -> bool { | ||
// self.0.is_interactive() | ||
// } | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing DynSigner
is no longer required? If so, we should remove it instead of commenting it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed. i'll take a look at this again
Now that
Signer
is implemented for allDeref<Target = impl Signer>
withinsolana-sdk
, we can remove this from the client without introducing breaking changes. This simplifies the code and allowsrust-analyzer
to better infer types.