Skip to content
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

Feature: Download canister .did and .most #3709

Open
vporton opened this issue Mar 31, 2024 · 4 comments
Open

Feature: Download canister .did and .most #3709

vporton opened this issue Mar 31, 2024 · 4 comments
Labels
needs-triage This ticket needs investigation.

Comments

@vporton
Copy link
Contributor

vporton commented Mar 31, 2024

Please add a command to download canister's .did and .most.

Currently I do my code hacky:

%.install: %.wasm FORCE
	dfx canister create $(*F)
	dfx canister install --network=$(NETWORK) -m install --wasm=$< $(*F)

%.upgrade: %.wasm %.most FORCE
	mkdir -p $(DFXDIR)/.dfx/local/canisters/$(*F)
	cp -f $*.most $(DFXDIR)/.dfx/local/canisters/$(*F)/ # hack!
	cp -f $*.did $(DFXDIR)/.dfx/local/canisters/$(*F)/constructor.did # hack!
	dfx canister install --network=$(NETWORK) -m upgrade --wasm=$< $(*F)

I want to use moc --stable-compatible explicitly to avoid hacks, what is possible only when I get direct access to such canister data.

@chenyan-dfinity
Copy link
Contributor

To get it from deployed canisters: dfx canister metadata <canister_id> motoko:stable-types.
To get it from wasm: ic-wasm <my.wasm> metadata motoko:stable-types.

If you want to make it everything explicit and scriptable, I encourage you to try ic-repl.

@vporton
Copy link
Contributor Author

vporton commented Apr 1, 2024

OK, dfx canister metadata <canister_id> motoko:stable-types gives .did. But how to get .most? (And I don't really understand what is the distinction between .did and .most.)

Also, the following demonstrates that stresser does have main shared method, but it is missing in the actor:

$ dfx canister metadata stresser motoko:stable-types && dfx canister call stresser main '()'
// Version: 1.0.0
actor {
  
};
Error: Failed update call.
Caused by: Failed update call.
  The replica returned a replica error: reject code CanisterReject, reject message IC0501: Canister bkyz2-fmaaa-aaaaa-qaaaq-cai is out of cycles, error code None
$ dfx --version
dfx 0.18.0

@chenyan-dfinity
Copy link
Contributor

motoko:stable-types gives you .most. candid:service gives you .did

@lwshang
Copy link
Contributor

lwshang commented Apr 12, 2024

This doesn't seem to be an issue with Rust CDK but rather with general development using dfx.

@lwshang lwshang closed this as completed Apr 12, 2024
@adamspofford-dfinity adamspofford-dfinity transferred this issue from dfinity/cdk-rs Apr 12, 2024
@adamspofford-dfinity adamspofford-dfinity added the needs-triage This ticket needs investigation. label Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-triage This ticket needs investigation.
Projects
None yet
Development

No branches or pull requests

4 participants