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

Relatively new composite queries candid format is not supported in IC-PY #111

Open
bodily11 opened this issue May 17, 2024 · 6 comments
Open

Comments

@bodily11
Copy link

Is IC-PY still being maintained? Is there a way to get new composite query functionality added to the candid parsing?

Also interested in putting in a plug for #63. If you use a variable to define a candid value and include it inline (meaning within parentheses in a function) then the candid parser fails.

Thanks.

@Myse1f
Copy link
Contributor

Myse1f commented May 18, 2024

Added the composite query parsing in #112

For #63 I dont really understand. Could you give me an example and the error occur?

@bodily11
Copy link
Author

A good example for #63 is:

authn_method_confirm: (IdentityNumber, confirmation_code: text) -> (variant {Ok; Err: AuthnMethodConfirmationError;});

See how "confirmation_code" is defined inline? This is from the Internet Identity canister: rdmx6-jaaaa-aaaaa-aaadq-cai.

If I delete "confirmation_code:" then it parses correctly, but can't handle what I'm calling inline naming/variable definitions.

@bodily11
Copy link
Author

#113 is relevant here as well. I tried to pull the candid for the II canister, but got an error that it didn't have the tmp_hack call anymore. So I copy/pasted the candid locally, but then got the #63 error. So I deleted the inline parameter names, and then I was finally able to parse the candid.

@Myse1f
Copy link
Contributor

Myse1f commented May 18, 2024

From the official Candid spec, I don't see such grammar to define func arguments inline. Seems the candid from II is manually documented. I suggest to modify the candid to match the grammar.

@bodily11
Copy link
Author

Interesting. Ok, I'll dig a bit more on this.

@chenyan-dfinity
Copy link

I cannot reproduce this locally. I tried the following did file

type Balances = vec record {
    0: text;
    1: nat64;
};
service : {
  authn_method_confirm: (Balances, confirmation_code: text) -> (variant {Ok; Err: text});
}

didc parsed it correctly. Are you using the latest candid parser?

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

No branches or pull requests

3 participants