I finally solved the issue!
The problem was with how I defined the checkBalance function in Motoko. I had written:
public shared query func checkBalance(): async Nat {
return currentValue;
};
While this looks fine, it caused the method to not appear in the Candid UI and failed in dfx canister call as well.
Fix: I read the documentation on Query functions and removed the return keyword and simply returned the value directly like this:
public shared query func checkBalance(): Nat {
currentValue;
};
After making the fix, I also ran these commands to ensure a clean redeploy:
dfx stop
rm -rf .dfx
dfx start --clean
dfx deploy
Now everything works perfectly! The solution was so much more simple than I made it out to be. Hope this helps someone facing the same issue!