Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Inter-canister call example

Two canisters: caller makes an inter-canister call to callee.

Prerequisites

Build

zig build

This produces zig-out/bin/callee.wasm and zig-out/bin/caller.wasm.

Deploy

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)"

Test

Query the callee directly:

icp canister call callee greet --args-format hex "" -o auto

Make the caller call into the callee (returns "hello from callee"):

icp canister call caller call_greet --args-format hex "" -o auto

Rebuild and upgrade

After changing source code, rebuild and upgrade a single canister:

zig build callee
icp canister install callee --mode upgrade

zig build caller
icp canister install caller --mode upgrade

Or rebuild and upgrade everything:

icp deploy --upgrade-unchanged