Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 2491b29

Browse files
author
Tyera Eulberg
authored
Add AuthorityType variant to use for mint close-authority adjustment (#3111)
1 parent c616db8 commit 2491b29

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

token/program-2022-test/tests/mint_close_authority.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ async fn set_authority() {
6767
.set_authority(
6868
token.get_address(),
6969
Some(&new_authority.pubkey()),
70-
instruction::AuthorityType::CloseAccount,
70+
instruction::AuthorityType::CloseMint,
7171
&wrong,
7272
)
7373
.await
@@ -87,7 +87,7 @@ async fn set_authority() {
8787
.set_authority(
8888
token.get_address(),
8989
Some(&new_authority.pubkey()),
90-
instruction::AuthorityType::CloseAccount,
90+
instruction::AuthorityType::CloseMint,
9191
&close_authority,
9292
)
9393
.await
@@ -104,7 +104,7 @@ async fn set_authority() {
104104
.set_authority(
105105
token.get_address(),
106106
None,
107-
instruction::AuthorityType::CloseAccount,
107+
instruction::AuthorityType::CloseMint,
108108
&new_authority,
109109
)
110110
.await
@@ -118,7 +118,7 @@ async fn set_authority() {
118118
.set_authority(
119119
token.get_address(),
120120
Some(&close_authority.pubkey()),
121-
instruction::AuthorityType::CloseAccount,
121+
instruction::AuthorityType::CloseMint,
122122
&new_authority,
123123
)
124124
.await
@@ -187,7 +187,7 @@ async fn fail_without_extension() {
187187
.set_authority(
188188
token.get_address(),
189189
Some(&close_authority),
190-
instruction::AuthorityType::CloseAccount,
190+
instruction::AuthorityType::CloseMint,
191191
&mint_authority,
192192
)
193193
.await

token/program-2022/src/instruction.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -915,12 +915,14 @@ pub enum AuthorityType {
915915
FreezeAccount,
916916
/// Owner of a given token account
917917
AccountOwner,
918-
/// Authority to close a mint or token account
918+
/// Authority to close a token account
919919
CloseAccount,
920920
/// Authority to set the transfer fee
921921
TransferFeeConfig,
922922
/// Authority to withdraw withheld tokens from a mint
923923
WithheldWithdraw,
924+
/// Authority to close a mint account
925+
CloseMint,
924926
}
925927

926928
impl AuthorityType {
@@ -932,6 +934,7 @@ impl AuthorityType {
932934
AuthorityType::CloseAccount => 3,
933935
AuthorityType::TransferFeeConfig => 4,
934936
AuthorityType::WithheldWithdraw => 5,
937+
AuthorityType::CloseMint => 6,
935938
}
936939
}
937940

@@ -943,6 +946,7 @@ impl AuthorityType {
943946
3 => Ok(AuthorityType::CloseAccount),
944947
4 => Ok(AuthorityType::TransferFeeConfig),
945948
5 => Ok(AuthorityType::WithheldWithdraw),
949+
6 => Ok(AuthorityType::CloseMint),
946950
_ => Err(TokenError::InvalidInstruction.into()),
947951
}
948952
}

token/program-2022/src/processor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ impl Processor {
610610
mint.base.freeze_authority = new_authority;
611611
mint.pack_base();
612612
}
613-
AuthorityType::CloseAccount => {
613+
AuthorityType::CloseMint => {
614614
let extension = mint.get_extension_mut::<MintCloseAuthority>()?;
615615
let maybe_close_authority: Option<Pubkey> = extension.close_authority.into();
616616
let close_authority =

0 commit comments

Comments
 (0)