Introduce a subaddress capable scanner type

This commit is contained in:
Luke Parker
2022-08-22 08:32:09 -04:00
parent 19f5fd8fe9
commit 5751204a98
5 changed files with 152 additions and 67 deletions

View File

@@ -4,15 +4,10 @@ use thiserror::Error;
use zeroize::Zeroize;
use curve25519_dalek::{
constants::ED25519_BASEPOINT_TABLE,
edwards::{EdwardsPoint, CompressedEdwardsY},
};
use curve25519_dalek::edwards::{EdwardsPoint, CompressedEdwardsY};
use base58_monero::base58::{encode_check, decode_check};
use crate::wallet::ViewPair;
#[derive(Clone, Copy, PartialEq, Eq, Debug, Zeroize)]
pub enum Network {
Mainnet,
@@ -130,16 +125,6 @@ pub struct Address {
pub view: EdwardsPoint,
}
impl ViewPair {
pub fn address(&self, network: Network, kind: AddressType) -> Address {
Address {
meta: AddressMeta { network, kind },
spend: self.spend,
view: &self.view * &ED25519_BASEPOINT_TABLE,
}
}
}
impl ToString for Address {
fn to_string(&self) -> String {
let mut data = vec![self.meta.to_byte()];