-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It's not clear how to handle Program Id in a build and deployment process #866
Comments
After first deploy, you can use address in declare_id and upgrade the contract If you don't want to upgrade contract, use the anchor_spl::token::ID in Contract and remove declare_id macro |
This should be mostly addressed by #695. |
Thanks @perlish @armaniferrante
but if I do it with pure solana CLI, my IDL file isn't updated with:
|
|
Hi, this issue probably falls into the "documentation" category. I'm new to Solana and Anchor and I'm trying to follow your "A Minimal Example" article
We start with a
lib.rs
file which among others contains this line:Then we go
anchor build
, the resulting./target/idl/basic_0.json
file looks like that:Then we go
anchor build
and./target/idl/basic_0.json
changes to:We also get a log:
So the program id, of the newly deployed program was added to the IDL file. But it conflicts with the
declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS");
fromlib.rs
.I tried to remove
declare_id!
line, but the compiler doesn't like it:declare_id!
macro and why do we have to declare the Program Id up front if it's only known upon deployment?Thanks
The text was updated successfully, but these errors were encountered: