Is it just me or did the "metadata": {"address: Pubkey}
key-value pair from the generated json disappear when running anchor build
?
-
Never mind, I think it is a false alarm– Burger BobCommented Oct 17, 2022 at 14:04
-
2It's not a false alarm. It reminds you to deploy Solana Program first before using idl.json file somewhere else such as with the frontend code.– Abdullah QureshiCommented Oct 17, 2022 at 16:13
3 Answers
"metadata": {"address": "pubKey"}
may disappear when running anchor build
you will get it back once you run anchor deploy
.
Running anchor build
will remove the "metadata": {"address: Pubkey}
from the bridge_program.json
.
Running anchor test
will under the hood build and deploy your program, so it will remove the field from bridge_program.json
.
If you want to skip deployment when running anchor test
you will need to pass --skip-deployment
and --skip-build
.
anchor test --skip-build --skip-deploy
Writing this as it can be a fix of another related problem.
The issue was in my tests where I forgot to correctly rename the program declaration after renaming it
// forgot to change
const program = anchor.workspace.OlgProgramName as Program<OlgProgramName>;
// to
const program = anchor.workspace.NewProgramName as Program<NewProgramName>;