Skip to content

Commit

Permalink
wallet example
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyan-dfinity committed May 3, 2021
1 parent 733a806 commit f448de3
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ assert _ == result;

install.sh
```
#!/usr/bin/ic-repl -r ic
#!/usr/bin/ic-repl
call "aaaaa-aa".provisional_create_canister_with_cycles(record { settings: null; amount: null });
let id = _;
call "aaaaa-aa".install_code(
Expand All @@ -62,6 +62,42 @@ call "aaaaa-aa".canister_status(id);
call id.canister_id.greet("test");
```

wallet.sh
```
#!/usr/bin/ic-repl
import wallet = "rwlgt-iiaaa-aaaaa-aaaaa-cai" : "wallet.did";
call wallet.wallet_create_canister(
record {
cycles = 824_567_85 : nat64;
settings = record {
controller = null;
freezing_threshold = null;
memory_allocation = null;
compute_allocation = null;
};
},
)
let id = _;
encode "aaaaa-aa".install_code(
record {
arg = encode ();
wasm_module = file "your_wasm_file.wasm";
mode = variant { install };
canister_id = id.canister_id; // TODO
},
);
let msg = _;
call wallet.wallet_call(
record {
args = msg;
cycles = 0;
method_name = "install_code";
canister = principal "aaaaa-aa";
},
);
call id.canister_id.greet("test");
```

## Notes for Rust canisters

`ic-repl` relies on the `__get_candid_interface_tmp_hack` canister method to fetch the Candid interface. The default
Expand Down

0 comments on commit f448de3

Please sign in to comment.