Hey, is it possible to fetch the candid file of a remote (running) canister A (different project) so I can import it somehow in my own motoko project and the appropriate actor for canister A will be generated with all the methods/types from the imported candid file in my project?
@Dustin To get the candid directly from the canister the rust canister developer currently has to provide a __get_candid_interface_tmp_hack method that serves the did file themselves. See the repo links in the last couple of posts above. (Motoko canisters do this by default.)
Thanks @Ori. Just to make sure I understand correctly: Motoko canisters by default have their did available via __get_candid_interface_tmp_hack. Rust canisters have to explicitly make it available via adding a __get_candid_interface_tmp_hack. So if the owner of a Rust canister doesn’t declare the method, there is no way to get the candid directly from the canister?
Correct. There are other ways for rust developers to provide the candid (see GitHub - chenyan2002/ic-repl) but again they’d have to do this on their end.
At some point rust canisters could have this by default too, but there isn’t a direct binding for rust types so assumptions have to be made on how to map them. The didc command line tool https://github.com/dfinity/candid/tree/master/tools/didc now provides a binding this way though so it may be a step toward that default being enabled. @chenyan may have more info on this.
You could also check the canister directory here, where you can search by any canister id, did files are under the Canisters tab: https://k7gat-daaaa-aaaae-qaahq-cai.ic0.app
It’ll pick up the candid as above alongside candid provided in listings, so rust devs can add candid manually to a listing here if they prefer.