Skip to content

Commit

Permalink
WIP - InternalCapability
Browse files Browse the repository at this point in the history
  • Loading branch information
pacu committed Nov 18, 2024
1 parent 2a98a4f commit 3d2caf5
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
62 changes: 62 additions & 0 deletions zingolib/src/wallet/keys/ledger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ use std::io;
use secp256k1::{PublicKey, Secp256k1, SecretKey};
use crate::wallet::traits::ReadableWriteable;

use super::unified::InternalCapability;

/// Holds ledger things
#[derive(Debug)]
pub struct LedgerKeys {
Expand Down Expand Up @@ -82,4 +84,64 @@ impl ReadableWriteable for LedgerKeys {

Ok(())
}
}

impl InternalCapability for LedgerKeys {
fn get_ua_from_contained_transparent_receiver(
&self,
capability: super::unified::WalletCapability,
receiver: &zcash_primitives::legacy::TransparentAddress,
) -> Option<zcash_keys::address::UnifiedAddress> {
todo!()
}

fn addresses(&self, capability: super::unified::WalletCapability) -> &append_only_vec::AppendOnlyVec<zcash_keys::address::UnifiedAddress> {
todo!()
}

fn transparent_child_addresses(
&self,
capability: super::unified::WalletCapability
) -> &std::sync::Arc<append_only_vec::AppendOnlyVec<(usize, zcash_primitives::legacy::TransparentAddress)>> {
todo!()
}

fn new_address(
&self,
capability: super::unified::WalletCapability,
desired_receivers: super::unified::ReceiverSelection,
legacy_key: bool,
) -> Result<zcash_keys::address::UnifiedAddress, String> {
todo!()
}

fn generate_transparent_receiver(
&self,
capability: super::unified::WalletCapability,
// this should only be `true` when generating transparent addresses while loading from legacy keys (pre wallet version 29)
// legacy transparent keys are already derived to the external scope so setting `legacy_key` to `true` will skip this scope derivation
legacy_key: bool,
) -> Result<Option<zcash_primitives::legacy::TransparentAddress>, bip32::Error> {
todo!()
}

fn get_taddr_to_secretkey_map(
&self,
capability: super::unified::WalletCapability,
chain: &crate::config::ChainType,
) -> Result<std::collections::HashMap<String, secp256k1::SecretKey>, crate::wallet::error::KeyError> {
todo!()
}

fn first_sapling_address(&self, capability: super::unified::WalletCapability) -> sapling_crypto::PaymentAddress {
todo!()
}

fn get_trees_witness_trees(&self, capability: super::unified::WalletCapability) -> Option<crate::data::witness_trees::WitnessTrees> {
todo!()
}

fn can_view(&self, capability: super::unified::WalletCapability) -> super::unified::ReceiverSelection {
todo!()
}
}
1 change: 1 addition & 0 deletions zingolib/src/wallet/keys/unified.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ pub struct WalletCapability {
/// Cache of unified_addresses
unified_addresses: append_only_vec::AppendOnlyVec<UnifiedAddress>,
addresses_write_lock: AtomicBool,
capability: InternalCapability,
}
impl Default for WalletCapability {
fn default() -> Self {
Expand Down

0 comments on commit 3d2caf5

Please sign in to comment.