-
Notifications
You must be signed in to change notification settings - Fork 2
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
Error while decoding response with Opcode.FUNC #3
Comments
Alexander, thanks for reporting. Let me take a look what is causing this problem. |
Alexander, we currently do not support func (22) and service types. I need to better analyze use case for that, between Java and Motoko/Rust. Can you share how do you want to use func type in Java? |
I do not need completely FUNC support on the java side.
Can we do some MOCK for FUNC reponse? (just text info/description of it). |
Yes, let me check how I can use some empty or static value and make it functional. |
I did some deep dive to the code where I have to make a change. I have already some features I want to push out this week in new release, I will let you know, when new release is out. |
Thank you for your support! |
Alexander, thank you for reporting all those bugs/issues! I started to work on that Function Candid serializer/deserializer. Did not touch that part of code for some time, so I need to analyze it, compare it with Rust implementation. But I am getting there! |
Almost there with func and service Candid implementations. Just have to manage certain use case scenarios, want to make it fully compatible with spec. I will drop some early release soon. |
Alexander, I dropped early beta of Candid library, pushed it to maven central. Tested some func and service scenarios but i need to ad more unit test and need to figure out how to nicely map it to Java classes. I created 2 new classes Func and Service in org.ic4j.types package, Func has 2 values Principal and name. So far it works with defined IDLValue, where you can define method signature List funcArgs = new ArrayList(); Func funcValue = new Func(Principal.fromString("w7x7r-cok77-xa"),"a"); args.add(IDLType.createType(Type.TEXT)); idlValue = IDLValue.create(funcValue, IDLType.createType(funcArgs,funcRets,funcModes)); maps to (func (text) -> (nat) query) You can test it with these gradle imports.
If you can share with me any Canister with your service so I can test it too? Let me know if you need any assistance to figure out how to use it or you are receiving any additional errors. Roman |
Hello! Great news! I will try this beta version. Canister ID: ryjl3-tyaaa-aaaaa-aaaba-cai Alexander |
Adding some goodies to the Agent ProxyBuilder, so developers can call functions dynamically based on value of Func Candid type. Will looks like this. I am going to drop new beta of Candid and Agent soon for testing.
ProxyBuiider can now also handle Func and Service types from Java Proxy interface.
|
Dropped new Beta version, both Candid and Agent. New features related to Func and Service. Tested your canister method, looks fine. Also added additional exception handling and debug error messages. This Is gradle import
and code I use to call your canister.
|
Hello! Thank you. It works great for me. |
Could you please help me to build IDLArgs for canister method:
You can try it on this canister: It works from command line: udtw4-baaaa-aaaah-abc3q-cai
For example this construction does not work:
Result: IDL error: unexpected IDL type when parsing Nat32 |
Hi Alexander, yes definitely, let me take a look how we can do it. If it will eventually require some fixes. |
Actually I just pushed out new beta release with Candid parser feature, this way we can properly map Java types to Candid. Right now it's often not 1 to 1 relationship, and that mapping must be written in your code, now this can be done automatically, just parsing Candid IDL file. I am still testing different scenarios, so this can be a good use case |
Hi Alexander, This should work. Because your type is nat32 we have to explicitly define IDL Type as a VEC of NAT32. Otherwise serializer doesn't have information about expected type and by default converts Integer to INT32. final List argsList = new ArrayList<>(); |
It works! Thank you. Now I see my mistake. I have used a wrong method:
Same method was in the documentation.
|
I pushed out Beta 4 of IC4J Candid and Agent. Added support for dynamic loading Candid IDL file, either directly from canister or from IDL file. Also added some additional functionality to ProxyBuilder. Now we can create FuncProxy object, that can have preloaded Candid signature of the calling method. So no need to manually construct it or use java POJO classes.
I tested it with your canister IDL , works well (I had to fix a few issues with our Candid parser, you are using name principal as an identifier, that collides with candid principal keyword, so IDL wraps it in double quotes :) ) But fixed now in our code. It's experimental feature for now, I need to run few more test and test performance with some additional caching , I do not want to load IDL file all the time. Gradle dependencies for this Beta are like this
Hopefully we will have final version 0.6.18 out sometimes this or next week. |
Hello!
Error while decoding bytes (response from canister):
Calling canister ID - "ryjl3-tyaaa-aaaaa-aaaba-cai"
Method:
Using parameters start = 0, length = 0;
Expecting response:
Best regards,
Alexander
The text was updated successfully, but these errors were encountered: