-
Notifications
You must be signed in to change notification settings - Fork 9
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
return values not working as expected #86
Comments
Well, an action is not meant to return a value. The following link may help improve your understanding of writing contracts in AssemblyScript |
action return values is a feature now supported by antelope in the c++ CDT, I thought this feature was available? |
Use |
@learnforpractice can you explain how to use |
import {
Name,
check,
Encoder,
setActionReturnValue,
Contract,
printString,
} from "asm-chain";
@packer
class MyData {
constructor(
public name: string
){}
}
@contract
class MyContract extends Contract{
@action("test")
test(): void {
let data = new MyData("Hello,World");
setActionReturnValue(Encoder.pack(data));
}
} |
Part of the code is generated by the compiler, so ignore such warnings if the code can be compiled. |
Is it possible to improve that? it's not very clear as a developer. |
Yes, you can implement |
I'm getting compile errors when trying to return a class structure from an action result. I get similar errors if it's just a packer class (not a table) and I also get an error if I try to return a class that does not derive from packer. Returning basic types like boolean seems to work.
The text was updated successfully, but these errors were encountered: