How to check if canister upgrade should succeed?

I want before upgrading a canister programmatically (by .install_code() of the management canister) possibly ask the user yes/no to upgrade where the question would be asked if and only if dfx deploy asks this question in the same situation.

In other words, if in this upgrade dfx deploy would ask confirmation, I also want to ask confirmation. If it does not ask, I also don’t want to ask.

The question should be the same as of dfx deploy (like: that function changed, old one is …, new one is …).

Also, how to upgrade the Candid interface of a canister programmatically (without using dfx deploy).

1 Like

Here’s how dfx determines if the interfaces are compatible. On CLI you can use didc subtype.

The candid interface is read form the candid:service custom section of the wasm. If you put the new candid file into the custom section it will be updated automatically

1 Like