From 23ddd3d94d0906731f3f5505c2318f6c601f379f Mon Sep 17 00:00:00 2001 From: 0xWoo Date: Thu, 12 Oct 2023 02:44:28 -0400 Subject: [PATCH] chore: multiple signers by remaining_accounts --- spl/src/memo.rs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/spl/src/memo.rs b/spl/src/memo.rs index 9075a3d586..9efa810e24 100644 --- a/spl/src/memo.rs +++ b/spl/src/memo.rs @@ -1,4 +1,3 @@ -use anchor_lang::solana_program::account_info::AccountInfo; use anchor_lang::solana_program::pubkey::Pubkey; use anchor_lang::Result; use anchor_lang::{context::CpiContext, Accounts}; @@ -6,19 +5,19 @@ use anchor_lang::{context::CpiContext, Accounts}; pub use spl_memo; pub use spl_memo::ID; -pub fn build_memo<'info>( - ctx: CpiContext<'_, '_, '_, 'info, BuildMemo<'info>>, - memo: &[u8], -) -> Result<()> { - let ix = spl_memo::build_memo(memo, &[ctx.accounts.signer.key]); - solana_program::program::invoke_signed(&ix, &[ctx.accounts.signer], ctx.signer_seeds) +pub fn build_memo<'info>(ctx: CpiContext<'_, '_, '_, 'info, BuildMemo>, memo: &[u8]) -> Result<()> { + let mut signer_pubkeys: Vec<&Pubkey> = vec![]; + for i in 0..ctx.remaining_accounts.len() { + signer_pubkeys.push(ctx.remaining_accounts[i].key); + } + + let ix = spl_memo::build_memo(memo, &signer_pubkeys); + solana_program::program::invoke_signed(&ix, &ctx.remaining_accounts, ctx.signer_seeds) .map_err(Into::into) } #[derive(Accounts)] -pub struct BuildMemo<'info> { - pub signer: AccountInfo<'info>, -} +pub struct BuildMemo {} #[derive(Clone)] pub struct Memo;