I'm getting This error
Is initialized!:
Error: Signature verification failed
at Transaction.serialize (node_modules/@solana/web3.js/src/transaction.ts:736:13)
at AnchorProvider.sendAndConfirm (node_modules/@project-serum/anchor/src/provider.ts:145:22)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at Object.rpc [as initialize] (node_modules/@project-serum/anchor/src/program/namespace/rpc.ts:29:16)
with this tests
describe("testContract", () => {
// Configure the client to use the local cluster.
anchor.setProvider(anchor.AnchorProvider.env());
const program = anchor.workspace.TestContract as Program<TestContract>;
it("Is initialized!", async () => {
// Add your test here.
const key = new PublicKey("U4NHM8DNT3kCNrRtB9ymgt1mcR6RBaHwUHWLoxM4KTF")
const tx = await program.methods.initialize().accounts( {
sender : key
}).rpc();
console.log("Your transaction signature", tx);
});
});
And the contract is correct and was working before I added an account field to it
#[program]
pub mod test_contract {
use super::*;
pub fn initialize(ctx: Context<Initialize>) -> Result<()> {
let hi = &ctx.accounts.sender.to_account_info().key();
msg!("{}",hi);
Ok(())
}
}
#[derive(Accounts)]
pub struct Initialize<'info> {
///CHECK : Not dangerous
#[account(mut, signer)]
pub sender: AccountInfo<'info>,
}