Open bodily11 opened 6 months ago
If the __get_candid_interface_tmp_hack
cannot work anymore, caller should provide the candid.
It would be fantastic if we could automatically try the "__get_candid_interface_tmp_hack", if that doesn't work, do the raw state call and try to parse for the candid, and then if that fails, then we can display an error.
I thought there no way we can encode the argument without the structure defination. ic-py
uses the candid to parse it to python defination and then it know how to encode the argument.
I believe there is a new way for canisters to provide their candid (some kind of raw state call, and then parsing it to get the provided candid). I think this is what the dashboard.internetcomputer.org is doing with the II canister.
See more info here: https://forum.dfinity.org/t/get-candid-interface-tmp-hack-gives-ic503-error/24992/4?u=bob11
Ah yep. I'd like to do something like this: https://github.com/dfinity/agent-js/blob/21e8d2b/packages/agent/src/fetch_candid.ts#L14
This is the error when you try to pull the candid directly using the tmp_hack method.
Exception: Canister reject the call: IC0536: Error from Canister rdmx6-jaaaa-aaaaa-aaadq-cai: Canister has no query method '__get_candid_interface_tmp_hack'
If you check on the dashboard, https://dashboard.internetcomputer.org/canister/rdmx6-jaaaa-aaaaa-aaadq-cai, they are still able to pull the candid for the canister. I believe they are doing a raw state call and then parsing the candid from the return object.
I use the Canister(agent=agent, canister_id=canister_id) syntax all the time (super easy/helpful). It would be fantastic if we could automatically try the "__get_candid_interface_tmp_hack", if that doesn't work, do the raw state call and try to parse for the candid, and then if that fails, then we can display an error.
Thoughts?