Trying to invoke init_module via aptos move run #197
-
Discord user IDshadyr6 Describe your question in detail.I'm working on a defi staking platform which has a init function as a non entry function. When I'm trying to run that function I'm getting an error.
this is my function. What error, if any, are you getting?
What have you tried or looked at? Or how can we reproduce the error?N/A Which operating system are you using?N/A Which SDK or tool are you using? (if any)N/A Describe your environment or tooling in detailNo response |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You can test it however by running unit tests in your Move module. Here's a basic example. View this after to see the assert statements. |
Beta Was this translation helpful? Give feedback.
init_module
is like a constructor. It only runs once (when your package is deployed). You can't invoke it via the API (you can only do this with functions marked with thepublic entry
visibility). Here's the documentation.You can test it however by running unit tests in your Move module. Here's a basic example. View this after to see the assert statements.