key is pubkey hard coded
let key = Pubkey::from_str("7ErNjJnJySrLQVuScmgxA6xsaw9sxfihXy8necaSBt6h").unwrap();
invoke(
&transfer(&buyer.key(), &key.key(), lottery.ticket_price),
&[
buyer.to_account_info(),
key.to_account_info(),
ctx.accounts.system_program.to_account_info(),
],
)?;
ERROR:
the method to_account_info
exists for struct Pubkey
, but its trait bounds were not satisfied
–> src/lib.rs:56:21
|
56 | key.to_account_info(),
| ^^^^^^^^^^^^^^^ method cannot be called on Pubkey
due to unsatisfied trait bounds
–> src/pubkey.rs:87:1
|
= note: doesn’t satisfy _: AsRef<AccountInfo<'_>>
|
= note: doesn’t satisfy _: ToAccountInfo<'_>
|
= note: the following trait bounds were not satisfied:
anchor_lang::prelude::Pubkey: AsRef<anchor_lang::prelude::AccountInfo<'_>>
which is required by anchor_lang::prelude::Pubkey: anchor_lang::ToAccountInfo<'_>
Requirement:
Transfer the SOL to Vault Pubkey and from there to PDA account, as i am new to anchor it is hard to fix