diff --git a/programs/mpl-inscription/src/error.rs b/programs/mpl-inscription/src/error.rs index a1f3f5e..4547d90 100644 --- a/programs/mpl-inscription/src/error.rs +++ b/programs/mpl-inscription/src/error.rs @@ -75,6 +75,10 @@ pub enum MplInscriptionError { /// 16 - Authority Already Exists #[error("The authority already exists.")] AuthorityAlreadyExists, + + /// 17 - Remaining Associated Inscription Accounts + #[error("Cannot close Inscription accounts until all Associated Inscriptions are closed.")] + RemainingAssociatedInscriptionAccounts, } impl PrintProgramError for MplInscriptionError { diff --git a/programs/mpl-inscription/src/processor/close.rs b/programs/mpl-inscription/src/processor/close.rs index 9222e18..3f42155 100644 --- a/programs/mpl-inscription/src/processor/close.rs +++ b/programs/mpl-inscription/src/processor/close.rs @@ -120,6 +120,10 @@ pub(crate) fn process_close<'a>(accounts: &'a [AccountInfo<'a>], args: CloseArgs close_account_raw(ctx.accounts.payer, ctx.accounts.inscription_account)?; } None => { + if !inscription_metadata.associated_inscriptions.is_empty() { + return Err(MplInscriptionError::RemainingAssociatedInscriptionAccounts.into()); + } + let bump = assert_derivation( &crate::ID, ctx.accounts.inscription_metadata_account,