If there is a possibility to ask the asset canister ({“type”: “assets”} in dfx.json) for it’s cycles balance programmatically?
I would like to monitor cycles balance in Prometheus.
Currently all my Motoko canisters has a public query method to return cycles using ExperimentalCycles module.
Is there is a way to do it with asset canisters?
Only way I know is to get it using “dfx” command line.
I am thinking… I can fork “certified-assets” repo and add additional logic to it…
For any canister you can add the blackhole canister as an additional controller and then anyone can query the cycle balance through that canister.
In fact, that should be considered best practice for anyone who don’t mind the public to see this data. And then pages like ic.rocks (pinging @wang) can display cycle balances, maybe even graph them over time…
It’s because in Papyrs I implement the canister status on the backend side while in Cycles.watch it’s on the frontend side
If you want to do it on the backend side, and then expose it through a custom actor function, you can use canister_status basically summarized as following:
let ic = actor "aaaaa-aa";
await ic.canister_status({canister_id = canisterId});
// here expose the results you need through an actor function
If you want to do it on the frontend side without exposing a custom function in your own canister you can also instantiate the IC and query directly the canister_status