I am struggling to successfully create a PDA account (pdaUSER) paid for by another PDA account.
I am doing it like this, and it does not work:
invoke_signed(
&system_instruction::create_account(
&pdaGLOBAL.key,
&pdaUSER.key,
rentUSER,
SIZE_USER.into(),
&program_id,
),
&[
pdaGLOBAL.clone(),
pdaUSER.clone(),
],
&[&[&seedUSER, &[bumpUSER]]]
)?;
The balance of pdaGLOBAL is 100 SOL.
On the other hand, when I pay for pdaUSER creation with the address that signed the transaction, just a regular solana account. It works fine, like this:
invoke_signed(
&system_instruction::create_account(
&owner.key,
&pdaUSER.key,
rentUSER,
SIZE_USER.into(),
&program_id,
),
&[
owner.clone(),
pdaUSER.clone(),
],
&[&[&seedUSER, &[bumpUSER]]]
)?;
Do I need to provide
&[&[&seedGLOBAL, &[bumpGLOBAL]]],
&[&[&seedUSER, &[bumpUSER]]],
instead? Or something entirely different altogether?
Thanks for your help.