-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove Bip44Address, AddressWithUnspentOutputs::{key_index, internal} (…
…#2070) * Remove Bip44Address, AddressWithUnspentOutputs::{key_index, internal} * Clippy
- Loading branch information
Showing
8 changed files
with
13 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,18 @@ | ||
// Copyright 2021 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use std::hash::Hash; | ||
|
||
use getset::{Getters, Setters}; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use crate::{ | ||
types::{ | ||
self, | ||
block::{address::Bech32Address, output::OutputId}, | ||
}, | ||
utils::ConvertTo, | ||
}; | ||
|
||
/// A BIP44 address. | ||
#[derive(Debug, Getters, Setters, Clone, Serialize, Deserialize, Eq, PartialEq, Hash)] | ||
#[serde(rename_all = "camelCase")] | ||
#[getset(get = "pub")] | ||
pub struct Bip44Address { | ||
/// The address. | ||
pub(crate) address: Bech32Address, | ||
/// The address key index. | ||
#[getset(set = "pub(crate)")] | ||
pub(crate) key_index: u32, | ||
/// Determines if an address is a public or an internal (change) address. | ||
#[getset(set = "pub(crate)")] | ||
pub(crate) internal: bool, | ||
} | ||
|
||
impl Bip44Address { | ||
pub fn into_bech32(self) -> Bech32Address { | ||
self.address | ||
} | ||
} | ||
|
||
impl ConvertTo<Bech32Address> for Bip44Address { | ||
fn convert(self) -> Result<Bech32Address, types::block::Error> { | ||
Ok(self.address) | ||
} | ||
|
||
fn convert_unchecked(self) -> Bech32Address { | ||
self.address | ||
} | ||
} | ||
use crate::types::block::{address::Bech32Address, output::OutputId}; | ||
|
||
/// An account address with unspent output_ids for unspent outputs. | ||
#[derive(Debug, Getters, Setters, Clone, Serialize, Deserialize, Eq, PartialEq)] | ||
#[serde(rename_all = "camelCase")] | ||
#[getset(get = "pub")] | ||
pub struct AddressWithUnspentOutputs { | ||
pub(crate) struct AddressWithUnspentOutputs { | ||
/// The address. | ||
pub(crate) address: Bech32Address, | ||
/// The address key index. | ||
#[getset(set = "pub(crate)")] | ||
pub(crate) key_index: u32, | ||
/// Determines if an address is a public or an internal (change) address. | ||
#[getset(set = "pub(crate)")] | ||
pub(crate) internal: bool, | ||
/// Output ids | ||
pub(crate) output_ids: Vec<OutputId>, | ||
} | ||
|
||
impl AddressWithUnspentOutputs { | ||
pub fn into_bech32(self) -> Bech32Address { | ||
self.address | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters