Skip to content

Commit

Permalink
fix(CLI): fund command now can accept a public strkey (#1020)
Browse files Browse the repository at this point in the history
fixes #1014

Co-authored-by: Tsachi Herman <[email protected]>
  • Loading branch information
willemneal and tsachiherman authored Oct 16, 2023
1 parent 2d9caec commit 2996835
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions cmd/soroban-cli/src/commands/config/identity/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,16 @@ impl Cmd {
}

pub fn public_key(&self) -> Result<stellar_strkey::ed25519::PublicKey, Error> {
Ok(stellar_strkey::ed25519::PublicKey::from_payload(
self.private_key()?.verifying_key().as_bytes(),
)?)
if let Some(Ok(key)) = self
.name
.as_deref()
.map(stellar_strkey::ed25519::PublicKey::from_string)
{
Ok(key)
} else {
Ok(stellar_strkey::ed25519::PublicKey::from_payload(
self.private_key()?.verifying_key().as_bytes(),
)?)
}
}
}

0 comments on commit 2996835

Please sign in to comment.