Let's say updateAccount instruction accepts following accounts
#[account()]
pub payer: Signer<'info>,
#[account(mut), constraint = optional_ata.mint = treasury_ata.mint]
pub optional_ata: Option<Account<'info, TokenAccount>>
Now, if I call this method in ts without using optional account,
await program.methods
.updateAccount({num: 10})
.accounts({
payer: signer.publicKey,
})
it raises
Error: Invalid arguments: optionalAta not provided.
This method raises
await program.methods
.updateAccount({num: 10})
.accounts({
payer: signer.publicKey,
optionalAta: null,
})
this error
Error: Wrong input type for account "optionalAta" in the instruction accounts object for instruction "updateAccount". Expected PublicKey or string.
I am using anchor version 0.26.0 where this update took.
What is the correct way to handle optional accounts when calling the method?