diff --git a/sdk/src/types/block/address/implicit_account_creation.rs b/sdk/src/types/block/address/implicit_account_creation.rs index ecb900e7ab..2d27681af5 100644 --- a/sdk/src/types/block/address/implicit_account_creation.rs +++ b/sdk/src/types/block/address/implicit_account_creation.rs @@ -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 { diff --git a/sdk/src/types/block/address/mod.rs b/sdk/src/types/block/address/mod.rs index 626eeb43ca..96f2bda0ca 100644 --- a/sdk/src/types/block/address/mod.rs +++ b/sdk/src/types/block/address/mod.rs @@ -134,7 +134,7 @@ impl Address { context.unlocked_addresses.insert(self.clone()); } - (Self::Ed25519(_ed25519_address), Unlock::Reference(_unlock)) => { + (Self::Ed25519(_), Unlock::Reference(_)) => { // TODO actually check that it was unlocked by the same signature. if !context.unlocked_addresses.contains(self) { return Err(TransactionFailureReason::InvalidInputUnlock); @@ -168,6 +168,9 @@ 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(address), _) => { + return Self::from(*address.ed25519_address()).unlock(unlock, context); + } _ => return Err(TransactionFailureReason::InvalidInputUnlock), }