Two canisters demonstrating Candid-encoded arguments and replies.
The callee accepts a Candid-encoded text name and returns a
record { greeting: text }. The caller uses CandidCallFuture-style
encoding to make a typed inter-canister call and forwards the result.
- Zig 0.15+
- icp-cli
zig buildThis produces zig-out/bin/callee.wasm and zig-out/bin/caller.wasm.
icp network start --background
icp deploy callee
CALLEE=$(icp canister status -i callee)
icp canister create caller
icp canister install caller --args-format hex --args "$(echo -n $CALLEE | xxd -p)"Query the callee directly (returns record { greeting = "hello, world!" }):
icp canister call callee greet '("world")' -o autoMake the caller call into the callee:
icp canister call caller call_greet --args-format hex "" -o autozig build callee
icp canister install callee --mode upgrade
zig build caller
icp canister install caller --mode upgradeOr rebuild and upgrade everything:
icp deploy --upgrade-unchanged