I am attempting to create a function that receives lamports, and if it does, to execute some code. Both the sending and receiving accounts are owned by the system program. The receiving wallet is NOT the PDA address.
I am getting the following error:
Error: AnchorError occurred. Error Code: InstructionFallbackNotFound. Error Number: 101. Error Message: Fallback functions are not supported.
Here is the rust code:
pub fn receive_solana(ctx: Context<SendSol>) -> Result<()> {
| let cpi_context = CpiContext::new(
| | ctx.accounts.system_program.to_account_info(),
| | system_program::Transfer {
| | | from: ctx.accounts.sender.to_account_info(),
| | | to: ctx.accounts.receiver.to_account_info(),
| | });
| system_program::transfer(cpi_context, 10000000)?;
|
| Ok(())
}
#[derive(Accounts)]
pub struct SendSol<'info> {
sender: Signer<'info>,
/// CHECK:
receiver: AccountInfo<'info>,
system_program: Program<'info, System>,
}
And here is the TS:
it("Receives Sol!", async () => {
const receiver = new anchor.web3.PublicKey('REDACTED ADDRESS STRING');
await gameLogicProgram.methods
.receiveSolana() //new anchor.BN(100000000))
.accounts({
sender : provider.wallet.publicKey,
receiver : receiver,
systemProgram: anchor.web3.SystemProgram.programId,
})
.signers([provider.wallet.payer])
.rpc();
});
Has anyone else encountered this, or understand what is the source of the error?