Skip to content

Commit

Permalink
Add getter
Browse files Browse the repository at this point in the history
  • Loading branch information
thibault-martinez committed Nov 8, 2023
1 parent 449c103 commit 49a2656
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion sdk/src/types/block/address/implicit_account_creation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::types::block::address::Ed25519Address;
/// [`AccountOutput`](crate::types::block::output::AccountOutput).
#[derive(Copy, Clone, Display, Eq, PartialEq, Ord, PartialOrd, Hash, FromStr, AsRef, Deref, From, Packable)]
#[as_ref(forward)]
pub struct ImplicitAccountCreationAddress(pub(crate) Ed25519Address);
pub struct ImplicitAccountCreationAddress(Ed25519Address);

impl ImplicitAccountCreationAddress {
/// The [`Address`](crate::types::block::address::Address) kind of an [`ImplicitAccountCreationAddress`].
Expand All @@ -24,6 +24,11 @@ impl ImplicitAccountCreationAddress {
pub fn new(address: [u8; Self::LENGTH]) -> Self {
Self(Ed25519Address::new(address))
}

/// Returns the inner [`Ed25519Address`] of the [`ImplicitAccountCreationAddress`].
pub fn ed25519_address(&self) -> &Ed25519Address {
&self.0
}
}

impl core::fmt::Debug for ImplicitAccountCreationAddress {
Expand Down
4 changes: 2 additions & 2 deletions sdk/src/types/block/address/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ impl Address {
}
// TODO maybe shouldn't be a semantic error but this function currently returns a TransactionFailureReason.
(Self::Anchor(_), _) => return Err(TransactionFailureReason::SemanticValidationFailed),
(Self::ImplicitAccountCreation(ImplicitAccountCreationAddress(ed25519_address)), _) => {
return Self::from(ed25519_address.clone()).unlock(unlock, context);
(Self::ImplicitAccountCreation(address), _) => {
return Self::from(address.ed25519_address().clone()).unlock(unlock, context);
}
_ => return Err(TransactionFailureReason::InvalidInputUnlock),
}
Expand Down

0 comments on commit 49a2656

Please sign in to comment.