mirror of
https://github.com/aljazceru/notedeck.git
synced 2025-12-19 01:24:21 +01:00
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 }
|
||||
|
||||
Reference in New Issue
Block a user