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

management canister did file not found #263

Closed
letmejustputthishere opened this issue Jan 31, 2024 · 7 comments · Fixed by #264
Closed

management canister did file not found #263

letmejustputthishere opened this issue Jan 31, 2024 · 7 comments · Fixed by #264

Comments

@letmejustputthishere
Copy link
Member

this canister builds, and .dfx/local/canisters/idl/aaaaa-aa.did is being generated.

import Management "ic:aaaaa-aa";

actor class Main() {
	public func greet(name : Text) : async Text {
		ignore await Management.raw_rand();
		return "Hello, " # name # "!";
	};
};

the vscode extension wants the did in a different path though
file "/Users/moritz/projects/icrc7_launchpad/.dfx/local/lsp/aaaaa-aa.did" does not existMotoko(M0009)

dfx 0.16.0
motoko extension v0.14.8

@rvanasa
Copy link
Contributor

rvanasa commented Jan 31, 2024

Here is a workaround which we use in the base library (source code):

actor class Main() {
    let Management = (actor "aaaaa-aa" : actor {
        raw_rand : () -> async Blob;
    });

    public func greet(name : Text) : async Text {
        ignore await Management.raw_rand();
        return "Hello, " # name # "!";
    };
};

I'll see if there's any way we can solve this within the VS Code extension; otherwise it might be necessary to fix this in dfx or the Motoko compiler.

Update: it sounds as though there are already plans to address this on the replica end. I'll keep an eye on this in case anything else is needed from the extension.

@letmejustputthishere
Copy link
Member Author

thanks for the workaround. another way of solving this without having to rewrite the management canister interface is to simply copy the aaaaa-aa.did to .dfx/local/lsp

@ggreif
Copy link
Contributor

ggreif commented Feb 2, 2024

Some projects just check in the IC.mo file like this: https://github.com/sonicdex/motoko-token-canister/blob/main/src/token/Cap.mo#L9

@letmejustputthishere
Copy link
Member Author

yes, but then i have to generate the motoko bindings from the did file which adds friction

@rvanasa
Copy link
Contributor

rvanasa commented Feb 12, 2024

The extension now uses a default management canister Candid file as of v0.15.0. This should resolve the issue; otherwise, let me know and I'll take another look.

@letmejustputthishere
Copy link
Member Author

hey @rvanasa, i see your hardcoding the management canister did. is there a way to include it via git submodules or smth similar? i just recently opened a PR there to make working with it a bit more convenient

@rvanasa
Copy link
Contributor

rvanasa commented Feb 13, 2024

Thanks for the link! I set up a script to regenerate the Candid file from this URL before packaging the extension (#265).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants