4

Is it just me or did the "metadata": {"address: Pubkey} key-value pair from the generated json disappear when running anchor build?

2
  • Never mind, I think it is a false alarm
    – Burger Bob
    Commented Oct 17, 2022 at 14:04
  • 2
    It'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. Commented Oct 17, 2022 at 16:13

3 Answers 3

6

"metadata": {"address": "pubKey"} may disappear when running anchor build you will get it back once you run anchor deploy.

1

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.

0

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>;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.