I’ve added cycle cost calculation and cycle auto-attaching for the IC management canister functions. It’s available in the ic
mops package version 2.1.0
in the Call
module (docs here).
For exmple, instead of hardcoded cycle costs:
await (with cycles = 230_949_972_000) IC.http_request(args)
You can do:
import IC "mo:ic/Call";
...
await IC.httpRequest(args)
It will calculate the minimum amount of cycles needed for the call and auto-attach them.
Check out all available functions in the docs.
Cost functions are also exposed, in the inner Cost
module.
moc
with version at least 0.14.10
is needed!
Thanks to @ZenVoich for your assistance!
Any feedback is greatly appreciated! Let me know if you have questions or suggestions how to improve or what functionality is missing.