From cc70332293c18f041b7a1f7333e631cb3d2931b5 Mon Sep 17 00:00:00 2001 From: bristinWild Date: Wed, 27 May 2026 15:52:53 +0530 Subject: [PATCH] fix: add mint_authority to amm and fix nightly fmt --- programs/amm/src/new_definition.rs | 1 + programs/token/core/src/lib.rs | 4 +--- programs/token/src/tests.rs | 25 +++++++++++++++++++------ 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/programs/amm/src/new_definition.rs b/programs/amm/src/new_definition.rs index 02ce020..45fbba1 100644 --- a/programs/amm/src/new_definition.rs +++ b/programs/amm/src/new_definition.rs @@ -206,6 +206,7 @@ pub fn new_definition( name: String::from("LP Token"), total_supply: MINIMUM_LIQUIDITY, metadata_id: None, + mint_authority: None, }); let call_token_lp_user = ChainedCall::new( diff --git a/programs/token/core/src/lib.rs b/programs/token/core/src/lib.rs index bf5af74..befa140 100644 --- a/programs/token/core/src/lib.rs +++ b/programs/token/core/src/lib.rs @@ -82,9 +82,7 @@ pub enum Instruction { /// /// Required accounts: /// - Token Definition account (initialized, authorized by current mint authority). - SetAuthority { - new_authority: Option<[u8; 32]>, - }, + SetAuthority { new_authority: Option<[u8; 32]> }, } #[derive(Serialize, Deserialize)] diff --git a/programs/token/src/tests.rs b/programs/token/src/tests.rs index d15d9a5..7182e0f 100644 --- a/programs/token/src/tests.rs +++ b/programs/token/src/tests.rs @@ -1320,12 +1320,10 @@ fn test_print_nft_success() { assert_eq!(post_printed.required_claim(), Some(Claim::Authorized)); } - #[cfg(test)] mod authority_tests { use super::*; - use crate::mint::mint; - use crate::set_authority::set_authority; + use crate::{mint::mint, set_authority::set_authority}; const AUTHORITY: [u8; 32] = [9_u8; 32]; const TOKEN_PROGRAM_ID: [u32; 8] = [5_u32; 8]; @@ -1402,7 +1400,12 @@ mod authority_tests { #[test] fn mint_with_authority_succeeds() { - let post_states = mint(def_with_authority(), holding_account(), 50_000, TOKEN_PROGRAM_ID); + let post_states = mint( + def_with_authority(), + holding_account(), + 50_000, + TOKEN_PROGRAM_ID, + ); let [def_post, holding_post] = post_states.try_into().unwrap(); let def = TokenDefinition::try_from(&def_post.account().data).unwrap(); @@ -1428,13 +1431,23 @@ mod authority_tests { #[test] #[should_panic(expected = "Mint authority has been revoked; this token has a fixed supply")] fn mint_with_revoked_authority_fails() { - let _ = mint(def_with_authority_revoked(), holding_account(), 50_000, TOKEN_PROGRAM_ID); + let _ = mint( + def_with_authority_revoked(), + holding_account(), + 50_000, + TOKEN_PROGRAM_ID, + ); } #[test] #[should_panic(expected = "Definition authorization is missing")] fn mint_without_is_authorized_fails() { - let _ = mint(def_without_auth_flag(), holding_account(), 50_000, TOKEN_PROGRAM_ID); + let _ = mint( + def_without_auth_flag(), + holding_account(), + 50_000, + TOKEN_PROGRAM_ID, + ); } #[test]