dfinity / motoko

Simple high-level language for writing Internet Computer canisters

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Check IDL

q-uint opened this issue · comments

I stumbled upon this while clicking through on links from the candid repo:
https://github.com/dfinity/motoko/blob/master/design/IDL-Motoko.md?plain=1#L309-L318

Is there are reason that this has been removed? Are there other ways of doing this?

I currently assign the service from the Motoko bind (generated by didc) to an actor class which does some type checking for me.

@chenyan-dfinity I hope you don't mind being tagged here.

You can do this directly in motoko code, i.e., import External "canister:canister_name_in_dfx". You can also use didc to generate the Motoko bind explicitly. Both approaches should work.

Thank you @chenyan-dfinity!

I will use the didc way for now, I don't want to rely too much on dfx. I will play around with --actor-idl and --actor-alias directly to get import X "canister:name" to work.

If you do it manually, you can also use import X "ic:canister-id", and put canister-id.did in the actor-idl directory. This way, you don't need to pass in --actor-alias.