Skip to content

Commit 91cd429

Browse files
marc0oloclaude
andcommitted
fix(frontend): address Copilot review comments and remove stale dfx artifacts
- Remove dfx-generated index.js, index.d.ts, and raw .did files from both declaration directories (ic_vetkeys_encrypted_maps_canister and ic_vetkeys_manager_canister). These used @dfinity/agent and dfx-specific env vars (DFX_NETWORK, CANISTER_ID_*) and are no longer needed now that the library uses @icp-sdk/core. - Fix encrypted_maps_canister.ts: split idlFactory (value import) from _SERVICE/AccessRights/ByteBuf/EncryptedMapData (type-only imports via import type). The .did.js module only exports idlFactory and init at runtime; importing types as values would fail under strict ESM. - Fix key_manager/index.ts: change import source from the raw Candid text file (.did) to the generated JS module (.did.js), and use import type for type-only symbols. - Fix make_did_bindings.sh: add explicit / path separator between DIR and NAME so the function is robust if DIR is passed without a trailing slash. - Fix provision-frontend-linux.sh: remove sudo from rustup install; sudo installs into root's home while subsequent steps add $HOME/.cargo/bin (runner's home) to PATH, causing cargo to not be found. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 343eb43 commit 91cd429

File tree

10 files changed

+7
-251
lines changed

10 files changed

+7
-251
lines changed

.github/workflows/provision-frontend-linux.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ npm install -g @icp-sdk/icp-cli @icp-sdk/ic-wasm
1010

1111
# Install rust
1212
wget --output-document install-rustup.sh "https://sh.rustup.rs"
13-
sudo bash install-rustup.sh -y
13+
bash install-rustup.sh -y
1414
rustup target add wasm32-unknown-unknown
1515

1616
# Set environment variables.

frontend/ic_vetkeys/make_did_bindings.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ function make_and_copy_declarations () {
55
NAME=$2
66
DID_FILE=$3
77

8-
pushd "$DIR""$NAME"
8+
pushd "$DIR/$NAME"
99
make extract-candid
1010
popd
1111

1212
rm -rf "src/declarations/$NAME"
1313
mkdir -p "src/declarations/$NAME"
14-
npx @icp-sdk/bindgen --did-file "$DIR$NAME/$DID_FILE" --out-dir "src/declarations/$NAME" --declarations-flat --force
14+
npx @icp-sdk/bindgen --did-file "$DIR/$NAME/$DID_FILE" --out-dir "src/declarations/$NAME" --declarations-flat --force
1515
}
1616

1717
make_and_copy_declarations "../../backend/rs/canisters/" "ic_vetkeys_manager_canister" "ic_vetkeys_manager_canister.did"

frontend/ic_vetkeys/src/declarations/ic_vetkeys_encrypted_maps_canister/ic_vetkeys_encrypted_maps_canister.did

Lines changed: 0 additions & 41 deletions
This file was deleted.

frontend/ic_vetkeys/src/declarations/ic_vetkeys_encrypted_maps_canister/index.d.ts

Lines changed: 0 additions & 50 deletions
This file was deleted.

frontend/ic_vetkeys/src/declarations/ic_vetkeys_encrypted_maps_canister/index.js

Lines changed: 0 additions & 42 deletions
This file was deleted.

frontend/ic_vetkeys/src/declarations/ic_vetkeys_manager_canister/ic_vetkeys_manager_canister.did

Lines changed: 0 additions & 19 deletions
This file was deleted.

frontend/ic_vetkeys/src/declarations/ic_vetkeys_manager_canister/index.d.ts

Lines changed: 0 additions & 50 deletions
This file was deleted.

frontend/ic_vetkeys/src/declarations/ic_vetkeys_manager_canister/index.js

Lines changed: 0 additions & 42 deletions
This file was deleted.

frontend/ic_vetkeys/src/encrypted_maps/encrypted_maps_canister.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Principal } from "@icp-sdk/core/principal";
22
import { Actor, ActorSubclass, HttpAgent } from "@icp-sdk/core/agent";
33
import { idlFactory } from "../declarations/ic_vetkeys_encrypted_maps_canister/ic_vetkeys_encrypted_maps_canister.did.js";
4-
import {
4+
import type {
55
_SERVICE as _DEFAULT_ENCRYPTED_MAPS_SERVICE,
66
AccessRights,
77
ByteBuf,

frontend/ic_vetkeys/src/key_manager/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ import {
1111
EncryptedVetKey,
1212
DerivedPublicKey,
1313
} from "../utils/utils";
14-
import {
14+
import type {
1515
AccessRights,
1616
ByteBuf,
17-
} from "../declarations/ic_vetkeys_manager_canister/ic_vetkeys_manager_canister.did";
17+
} from "../declarations/ic_vetkeys_manager_canister/ic_vetkeys_manager_canister.did.js";
1818

1919
export { DefaultKeyManagerClient } from "./key_manager_canister";
2020
export type {
2121
AccessRights,
2222
ByteBuf,
23-
} from "../declarations/ic_vetkeys_manager_canister/ic_vetkeys_manager_canister.did";
23+
} from "../declarations/ic_vetkeys_manager_canister/ic_vetkeys_manager_canister.did.js";
2424

2525
/**
2626
* The **`KeyManager`** frontend library facilitates interaction with a [**`KeyManager`-enabled canister**](https://docs.rs/ic-vetkeys/latest/ic_vetkeys/key_manager/struct.KeyManager.html) on the **Internet Computer (ICP)**.

0 commit comments

Comments
 (0)