-
Notifications
You must be signed in to change notification settings - Fork 7
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
Using outArgs.getArgs().get(0).getValue().toString(), but get a wrong value #2
Comments
Thank you for reporting this issue. Let me check your use case and fix the problem. |
Can you please share with me IDL of the canister you are calling from Java? |
|
Aah, you are returning Variant type, which wraps Principal value. In such case we are wrapping variant elements as a Java map type. So you have to get Ok item from the Map. I added Variant test echoVariant in our ICTest JUnit test (already checked in). It handles Variant Result similar to yours
So you get value as a Map and then you retrieve Principal value.
We also serializing and deserializing IC variants to Java Enum type. You can find the sample in our Internet Identity package. |
I use outargs getArgs(). get(0). getValue(). Tostring() gets the result and refers to Querytest. However, the final data obtained is inconsistent with the data recorded in canisters.
QyeryTest:
canister response:
java result:
The text was updated successfully, but these errors were encountered: