Skip to content

Commit 3b19871

Browse files
authored
chore: small opt fn set_authority (solana-foundation#3675)
1 parent e5a87cc commit 3b19871

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

spl/src/token.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -304,15 +304,10 @@ pub fn set_authority<'info>(
304304
authority_type: spl_token::instruction::AuthorityType,
305305
new_authority: Option<Pubkey>,
306306
) -> Result<()> {
307-
let mut spl_new_authority: Option<&Pubkey> = None;
308-
if new_authority.is_some() {
309-
spl_new_authority = new_authority.as_ref()
310-
}
311-
312307
let ix = spl_token::instruction::set_authority(
313308
&spl_token::ID,
314309
ctx.accounts.account_or_mint.key,
315-
spl_new_authority,
310+
new_authority.as_ref(),
316311
authority_type,
317312
ctx.accounts.current_authority.key,
318313
&[], // TODO: Support multisig signers.

spl/src/token_2022.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -341,15 +341,10 @@ pub fn set_authority<'info>(
341341
authority_type: spl_token_2022::instruction::AuthorityType,
342342
new_authority: Option<Pubkey>,
343343
) -> Result<()> {
344-
let mut spl_new_authority: Option<&Pubkey> = None;
345-
if new_authority.is_some() {
346-
spl_new_authority = new_authority.as_ref()
347-
}
348-
349344
let ix = spl_token_2022::instruction::set_authority(
350345
ctx.program.key,
351346
ctx.accounts.account_or_mint.key,
352-
spl_new_authority,
347+
new_authority.as_ref(),
353348
authority_type,
354349
ctx.accounts.current_authority.key,
355350
&[], // TODO: Support multisig signers.

0 commit comments

Comments
 (0)