feat: nostr_signing key as p2pk key

This commit is contained in:
thesimplekid
2024-05-20 11:46:16 +01:00
parent 226a10ca1f
commit 762713692b
2 changed files with 14 additions and 3 deletions

View File

@@ -38,6 +38,14 @@ impl TryFrom<PublicKey> for nostr_sdk::PublicKey {
}
}
#[cfg(feature = "nostr")]
impl TryFrom<&PublicKey> for nostr_sdk::PublicKey {
type Error = Error;
fn try_from(pubkey: &PublicKey) -> Result<Self, Self::Error> {
Ok(nostr_sdk::PublicKey::from_slice(&pubkey.to_bytes())?)
}
}
#[cfg(feature = "nostr")]
impl TryFrom<nostr_sdk::PublicKey> for PublicKey {
type Error = Error;
@@ -95,7 +103,7 @@ impl PublicKey {
}
#[inline]
pub fn x_only_pubkey(&self) -> XOnlyPublicKey {
pub fn x_only_public_key(&self) -> XOnlyPublicKey {
self.inner.x_only_public_key().0
}

View File

@@ -1176,7 +1176,7 @@ impl Wallet {
let verifying_key = nostr_signing_key.public_key();
let nostr_pubkey =
nostr_sdk::PublicKey::from_hex(verifying_key.x_only_pubkey().to_string())?;
nostr_sdk::PublicKey::from_hex(verifying_key.x_only_public_key().to_string())?;
let filter = match self
.localstore
@@ -1215,7 +1215,10 @@ impl Wallet {
let mut total_received = Amount::ZERO;
for token in tokens.iter() {
match self.receive(token, None, None).await {
match self
.receive(token, Some(vec![nostr_signing_key.clone()]), None)
.await
{
Ok(amount) => total_received += amount,
Err(err) => {
tracing::error!("Could not receive token: {}", err);