Skip to content

Commit 1d0da3e

Browse files
committed
fix: target the network, not an environment, in synced icp commands
1 parent e7c1656 commit 1d0da3e

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

‎docs/guides/frontends/static-site/verifying-contents.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ that produce the served directory).
6565
an *update* call, so the reply is consensus-backed and trustworthy:
6666

6767
```sh
68-
icp canister call <canister-id> state_hash '()' -e ic
68+
icp canister call <canister-id> state_hash '()' -n ic
6969
# (blob "\81\50\a6\5e…")
7070
```
7171

‎scripts/sync-static-site.mjs‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,16 @@ const PROSE_RULES = [
8686
// `dfx` is banned in this repo (AGENTS.md "Never"), and a command reaches a
8787
// reader from inside a fence, where the prose rules deliberately do not go. Only
8888
// this exact shape is rewritten, checked against `icp canister call` in icp-cli
89-
// v1.5.0: <CANISTER> accepts a principal, `-e` selects the network, and the
90-
// argument has to be written out, because `icp canister call` with no argument
91-
// opens an interactive prompt instead of sending an empty one. dfx infers `()`;
92-
// icp does not, so the rewrite adds it. Any other `dfx` occurrence fails the
93-
// sync rather than being guessed at.
89+
// v1.5.0: <CANISTER> accepts a principal, and the argument has to be written
90+
// out, because `icp canister call` with no argument opens an interactive prompt
91+
// instead of sending an empty one. dfx infers `()`; icp does not, so the rewrite
92+
// adds it. `--network ic` becomes `-n ic`, which names a network the way dfx's
93+
// flag does. The environment flag is not the translation: `-e` resolves a
94+
// canister name out of a local project, and these pages target a canister by
95+
// principal, from wherever the reader happens to be. Any other `dfx` occurrence
96+
// fails the sync rather than being guessed at.
9497
const DFX_CALL = /^(\s*)dfx canister call (\S+) (\S+) --network ic[ \t]*$/gm;
95-
const rewriteDfx = (text) => text.replace(DFX_CALL, "$1icp canister call $2 $3 '()' -e ic");
98+
const rewriteDfx = (text) => text.replace(DFX_CALL, "$1icp canister call $2 $3 '()' -n ic");
9699

97100
// Prose means prose: not a fenced block, not the frontmatter, and within a line,
98101
// not an inline code span and not a link destination. A rule that reached into

0 commit comments

Comments
 (0)