mirror of
https://github.com/aljazceru/cdk.git
synced 2026-02-08 22:55:54 +01:00
feat: nostr_signing key as p2pk key
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user