propagate current account
Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
@@ -16,6 +16,20 @@ pub struct Keypair {
|
||||
pub secret_key: Option<SecretKey>,
|
||||
}
|
||||
|
||||
pub struct KeypairUnowned<'a> {
|
||||
pub pubkey: &'a Pubkey,
|
||||
pub secret_key: Option<&'a SecretKey>,
|
||||
}
|
||||
|
||||
impl<'a> From<&'a Keypair> for KeypairUnowned<'a> {
|
||||
fn from(value: &'a Keypair) -> Self {
|
||||
Self {
|
||||
pubkey: &value.pubkey,
|
||||
secret_key: value.secret_key.as_ref(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Keypair {
|
||||
pub fn from_secret(secret_key: SecretKey) -> Self {
|
||||
let cloned_secret_key = secret_key.clone();
|
||||
@@ -70,6 +84,15 @@ impl<'a> FilledKeypair<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> From<FilledKeypair<'a>> for KeypairUnowned<'a> {
|
||||
fn from(value: FilledKeypair<'a>) -> Self {
|
||||
Self {
|
||||
pubkey: value.pubkey,
|
||||
secret_key: Some(value.secret_key),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl FullKeypair {
|
||||
pub fn new(pubkey: Pubkey, secret_key: SecretKey) -> Self {
|
||||
FullKeypair { pubkey, secret_key }
|
||||
|
||||
@@ -11,7 +11,7 @@ pub use client::{ClientMessage, EventClientMessage};
|
||||
pub use error::Error;
|
||||
pub use ewebsock;
|
||||
pub use filter::Filter;
|
||||
pub use keypair::{FilledKeypair, FullKeypair, Keypair, SerializableKeypair};
|
||||
pub use keypair::{FilledKeypair, FullKeypair, Keypair, KeypairUnowned, SerializableKeypair};
|
||||
pub use nostr::SecretKey;
|
||||
pub use note::{Note, NoteId};
|
||||
pub use profile::Profile;
|
||||
|
||||
Reference in New Issue
Block a user