enostr: rename to_bech to npub

a bit more clear as to what this is
This commit is contained in:
William Casarin
2025-04-22 10:46:51 -07:00
parent 88aa78dc03
commit ba4198eeec
5 changed files with 5 additions and 5 deletions

View File

@@ -178,7 +178,7 @@ impl TokenSerializable for Pubkey {
fn serialize_tokens(&self, writer: &mut tokenator::TokenWriter) {
writer.write_token(PUBKEY_TOKEN);
let Some(bech) = self.to_bech() else {
let Some(bech) = self.npub() else {
tracing::error!("Could not convert pubkey to bech: {}", self.hex());
return;
};

View File

@@ -115,7 +115,7 @@ impl Pubkey {
}
}
pub fn to_bech(&self) -> Option<String> {
pub fn npub(&self) -> Option<String> {
bech32::encode::<bech32::Bech32>(HRP_NPUB, &self.0).ok()
}
}