Skip to content

Commit

Permalink
fix to_base58_string
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinheavey committed Oct 15, 2024
1 parent c0decd0 commit da64d7e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion sdk/signer/src/keypair.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
}

0 comments on commit da64d7e

Please sign in to comment.