diff --git a/sdk/src/client/api/block_builder/input_selection/mod.rs b/sdk/src/client/api/block_builder/input_selection/mod.rs index ba4ed047ab..dd4c60fd6f 100644 --- a/sdk/src/client/api/block_builder/input_selection/mod.rs +++ b/sdk/src/client/api/block_builder/input_selection/mod.rs @@ -19,7 +19,7 @@ pub use self::{burn::Burn, error::Error, requirement::Requirement}; use crate::{ client::{api::types::RemainderData, secret::types::InputSigningData}, types::block::{ - address::{AccountAddress, Address, AnchorAddress, NftAddress}, + address::{AccountAddress, Address, NftAddress}, input::INPUT_COUNT_RANGE, output::{ AccountOutput, ChainId, FoundryOutput, NativeTokensBuilder, NftOutput, Output, OutputId, OUTPUT_COUNT_RANGE, @@ -63,15 +63,16 @@ impl InputSelection { .output .required_and_unlocked_address(self.slot_index, input.output_id())? .0; + let required_address = if let Address::Restricted(restricted) = &required_address { + restricted.address() + } else { + &required_address + }; match required_address { - Address::Ed25519(_) => Ok(None), Address::Account(account_address) => Ok(Some(Requirement::Account(*account_address.account_id()))), Address::Nft(nft_address) => Ok(Some(Requirement::Nft(*nft_address.nft_id()))), - Address::Anchor(_) => Err(Error::UnsupportedAddressType(AnchorAddress::KIND)), - Address::ImplicitAccountCreation(_) => Ok(None), - Address::Restricted(_) => Ok(None), - _ => todo!("What do we do here?"), + _ => Ok(None), } } @@ -236,12 +237,17 @@ impl InputSelection { // PANIC: safe to unwrap as non basic/account/foundry/nft outputs are already filtered out. .unwrap() .0; + let required_address = if let Address::Restricted(restricted) = &required_address { + restricted.address() + } else { + &required_address + }; match required_address { + Address::Anchor(_) => false, Address::ImplicitAccountCreation(implicit_account_creation) => self .addresses .contains(&Address::from(*implicit_account_creation.ed25519_address())), - Address::Restricted(restricted) => self.addresses.contains(restricted.address()), _ => self.addresses.contains(&required_address), } }) diff --git a/sdk/tests/client/input_selection/basic_outputs.rs b/sdk/tests/client/input_selection/basic_outputs.rs index 10af45e799..4fac367de0 100644 --- a/sdk/tests/client/input_selection/basic_outputs.rs +++ b/sdk/tests/client/input_selection/basic_outputs.rs @@ -1853,7 +1853,7 @@ fn restricted_account() { let restricted = Address::from(RestrictedAddress::new(account_address.clone()).unwrap()); let inputs = build_inputs([ - Basic(2_000_000, restricted, None, None, None, None, None, None), + Basic(3_000_000, restricted, None, None, None, None, None, None), Account( 2_000_000, account_id_1,