You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use anchor_lang::{prelude::*, solana_program::hash::hash};#[derive(AnchorSerialize,AnchorDeserialize,Clone,Debug)]pubstructInitializeThingWithNameArgs{pubname:String}#[account]#[derive(InitSpace)pubstructNameThing{#[max_len(200)]pubname:String}#[derive(Accounts)]#[instruction(args: InitializeThingWithNameArgs)]pubstructInitializeThingWithName<'info>{#[account(mut)]pubpayer:Signer<'info>,#[account( init, payer = payer, space = 8 + NameThing::INIT_SPACE, seeds = ["name".as_bytes(), &hash(&args.name.as_bytes()[..]).to_bytes()], bump)]pubname_pda:Box<Account<'info,NameThing>>,}
Compiling this will fail with:
error[E0425]: cannot find value `args` in this scope
|
68 | &hash(&args.name.as_bytes()[..]).to_bytes()
| ^^^^ not found in this scope
Error: Building IDL failed
Seems like you can't use args inside a function inside seeds when building IDL with resolution?
Consider the following instruction:
Compiling this will fail with:
Seems like you can't use args inside a function inside seeds when building IDL with resolution?
The following does seem to work:
The text was updated successfully, but these errors were encountered: