Skip to content

Commit

Permalink
refactor: make try_pubkey asynchronous and update error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
incubator4 committed Feb 12, 2025
1 parent 8fad6b4 commit 1f34b98
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,12 @@ impl Into<SignerError> for GcpSignerError {
}

impl solana_sdk::signer::Signer for GcpSigner {
fn try_pubkey(&self) -> Result<Pubkey, solana_sdk::signer::SignerError> {
#[tokio::main]
async fn try_pubkey(&self) -> Result<Pubkey, SignerError> {
// Assuming you have a way to block on the future
let pubkey = tokio::runtime::Runtime::new()
.unwrap()
.block_on(self.get_pubkey())
let pubkey = self
.get_pubkey()
.await
.map_err(|e| SignerError::Custom(e.to_string()))?;

let clean_b64 = pubkey
Expand All @@ -133,7 +134,7 @@ impl solana_sdk::signer::Signer for GcpSigner {
fn try_sign_message(
&self,
_message: &[u8],
) -> Result<solana_sdk::signature::Signature, solana_sdk::signer::SignerError> {
) -> Result<solana_sdk::signature::Signature, SignerError> {
todo!()
}

Expand Down

0 comments on commit 1f34b98

Please sign in to comment.