From da64d7e0f3298eb4f4537215c4a98c833b740e3e Mon Sep 17 00:00:00 2001 From: kevinheavey Date: Mon, 7 Oct 2024 13:38:27 +0400 Subject: [PATCH] fix to_base58_string --- sdk/signer/src/keypair.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sdk/signer/src/keypair.rs b/sdk/signer/src/keypair.rs index e2aef9608241f3..cf4896acafd1d1 100644 --- a/sdk/signer/src/keypair.rs +++ b/sdk/signer/src/keypair.rs @@ -64,7 +64,7 @@ impl Keypair { /// Returns this `Keypair` as a base58-encoded string pub fn to_base58_string(&self) -> String { - bs58::encode(&self.0.to_bytes()).into_string() + bs58::encode(&self.to_bytes()).into_string() } /// Gets this `Keypair`'s SecretKey @@ -363,4 +363,12 @@ mod tests { let keypair2 = keypair_from_seed(&[0u8; 32]).unwrap(); assert_eq!(keypair, keypair2); } + + #[test] + fn test_base58() { + let keypair = keypair_from_seed(&[0u8; 32]).unwrap(); + let as_base58 = keypair.to_base58_string(); + let parsed = Keypair::from_base58_string(&as_base58); + assert_eq!(keypair, parsed); + } }