Quantcast
Channel: How to pass a signer to the instruction that will be executed by a clockwork thread - Solana Stack Exchange
Viewing all articles
Browse latest Browse all 2

How to pass a signer to the instruction that will be executed by a clockwork thread

$
0
0

I get a signer privilege escalated error and I suspect that it is because I am incorrectly passing the signers to the executing thread instruction.

Here is roughly how MyContext looks like (including pda initialization):

pub struct MyContext<'info> {    #[account(        init,        seeds=[...],        bump=,        payer = creator,    )]    pub acc: Account<'info, MyAccount>,    #[account(mut)]    pub creator: Signer<'info>,    #[account(signer, address = thread.pubkey())]    pub thread: Account<'info, Thread>,}

This is how I invoke the associated MyContext instruction:

    const ix = await myProgram.methods        .myContextIx({...})        .accounts({            acc: acc,            creator: signer.publicKey,            thread: threadPubkey,        })        .instruction()    const thread_transaction = await threadProgram.methods        .threadCreate(            threadName,            {                programId: myProgram.programId,                accounts: ix.keys,                data: ix.data,            },            trigger        )        .accounts({            authority: signer.publicKey,            payer: signer.publicKey,            thread: threadPubkey,            systemProgram: anchor.web3.SystemProgram.programId,        })        .rpc();

So I am wondering how do I make a thread execute a designated instruction that requires another signer. In this case, both the thread and the creator account?

I can see from the thread_exec.rs source code, that the signer for the thread CPI instruction call is always going to be the thread account, so is it even possible to consider another signer?


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images