anchor
anchor copied to clipboard
New Idl generation fails when seeds are generated using an external function
Consider the following example:
#[account(
init,
seeds = [
CONSTANT_SEED,
external_function(ix_param).as_slice()
],
bump,
space = 8 + size,
payer = payer
)]
IDL generation fails saying ix_param not found.
Yeah, it's because the new IDL generation stores PDA seeds in the IDL by default, but there is no way to store external_function
in the IDL.
Is there a way to fix it?
The client needs to be able to derive the address from the information based on the program's IDL to make it work. This depends on what you do inside your external_function
, but most of the time, you should be able to do that inline instead of calling a function.
You can also disable account resolution in Anchor.toml
:
[features]
resolution = false