Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions tools/ui/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@
.DS_Store
**/.DS_Store

# dfx temporary files
.dfx/
# icp-cli ephemeral state (local network + build cache).
# Persistent data such as mainnet canister id mappings lives in .icp/data/
# and IS committed.
.icp/cache/

# frontend code
node_modules/
dist/
ts-out/

.dfx
.icp/cache
3 changes: 3 additions & 0 deletions tools/ui/.icp/data/mappings/ic.ids.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"didjs": "a4gq6-oaaaa-aaaab-qaa4q-cai"
}
6 changes: 3 additions & 3 deletions tools/ui/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 15 additions & 5 deletions tools/ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,27 @@ The frontend `ui` fetches the Candid interface from the running canister (curren

## Build

You need `dfx`, `cargo`, `npm` and `wasm-opt` for building the canister.
You need [`icp`](https://cli.internetcomputer.org), `cargo`, `npm`, `wasm-opt` and
`ic-wasm` for building the canister. The frontend is bundled with [Vite](https://vite.dev).

```bash
cd ui/
npm install
dfx start --background
dfx canister create --all
dfx build
dfx canister install --all
icp network start -d # start a local replica in the background
icp deploy # build + deploy the didjs canister locally
```

To deploy to mainnet (the `ic` environment), which targets the existing
`a4gq6-oaaaa-aaaab-qaa4q-cai` canister:

```bash
icp deploy -e ic
```

Project configuration lives in `icp.yaml`. Canister id mappings are stored under
`.icp/`: the mainnet mapping (`.icp/data/mappings/ic.ids.json`) is committed, while
local replica state under `.icp/cache/` is ephemeral and git-ignored.

## Usage

Open the `ui` canister in a browser and supply the id parameter in the URL to render a specific canister,
Expand Down
5 changes: 0 additions & 5 deletions tools/ui/canister_ids.json

This file was deleted.

20 changes: 0 additions & 20 deletions tools/ui/dfx.json

This file was deleted.

11 changes: 11 additions & 0 deletions tools/ui/icp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
canisters:
- name: didjs
build:
steps:
- type: script
commands:
- npm run build
- cargo build --target wasm32-unknown-unknown --profile canister --package didjs
- wasm-opt --strip-debug -Oz target/wasm32-unknown-unknown/canister/didjs.wasm -o target/wasm32-unknown-unknown/canister/didjs_opt.wasm
- ic-wasm target/wasm32-unknown-unknown/canister/didjs_opt.wasm -o target/wasm32-unknown-unknown/canister/didjs_opt.wasm metadata candid:service -f src/didjs/didjs.did -v public
- cp target/wasm32-unknown-unknown/canister/didjs_opt.wasm "$ICP_WASM_OUTPUT_PATH"
1 change: 1 addition & 0 deletions tools/ui/src/candid.html → tools/ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -137,5 +137,6 @@ <h1 id="title">Candid UI</h1>
outputButton.click();
}
</script>
<script type="module" src="/src/index.ts"></script>
</body>
</html>
Loading
Loading