cardano-wasm demo: staking (certificates, pool picker, stake witnesses) - #1290
Open
palas wants to merge 2 commits into
Open
cardano-wasm demo: staking (certificates, pool picker, stake witnesses)#1290palas wants to merge 2 commits into
palas wants to merge 2 commits into
Conversation
- per-wallet certificate menu: register / register+delegate / delegate-only / unregister; key deposit and refund reflected in the balance - live pool picker from Blockfrost /pools/extended, one page at a time (prev/next; no duplicates possible from shifting offsets) - delegation uses Blockfrost's hex pool id, with a golden-tested pure-Elm bech32 fallback decoder - signing attaches payment witnesses per input wallet and a stake witness (alsoSignWithStakeKey) per certificate wallet - README: full feature list
palas
requested review from
CarlosLopezDeLara,
carbolymer,
disassembler and
erikd
as code owners
August 12, 2026 00:21
palas
marked this pull request as draft
August 12, 2026 00:21
Contributor
There was a problem hiding this comment.
Pull request overview
Extends the cardano-wasm demo to support staking certificate flows and stake-pool selection, wiring the new functionality through Elm state/update/view and the JS cardano-wasm port boundary, with Blockfrost providing pool data.
Changes:
- Add certificate selection per wallet (register / delegate / unregister), include certificates in tx building, and account for key deposits/refunds in balance/change.
- Add a Blockfrost-backed, paginated pool picker modal and use pool hex ids for delegation.
- Update signing/fee estimation to include stake witnesses when certificates are present, and expand demo documentation.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| cardano-wasm/demo/web/ports.js | Build txs with certificates; include stake witnesses; improve top-level docs; adjust boot error handling. |
| cardano-wasm/demo/src/Wasm.elm | Encode certificates + stake witnesses into port requests; rebalance module layout. |
| cardano-wasm/demo/src/View.elm | Add certificate UI + certificate list; add pool picker modal + paging UI; show deposits in summary. |
| cardano-wasm/demo/src/Update.elm | Add certificate/pool-picker message handling; clear network-specific state on network switch. |
| cardano-wasm/demo/src/Types.elm | Introduce certificate/pool/picker types; extend model/msg for new flows. |
| cardano-wasm/demo/src/State.elm | Add deposit arithmetic, stake-witness accounting, certificate helpers, pool helpers, and small utilities. |
| cardano-wasm/demo/src/Ports.elm | Minor cleanup (doc removal). |
| cardano-wasm/demo/src/Net.elm | Minor doc tweak. |
| cardano-wasm/demo/src/Main.elm | Update module overview comment for Blockfrost/Bech32/Hex additions. |
| cardano-wasm/demo/src/Blockfrost.elm | Add /pools/extended fetch + decoding for pool picker. |
| cardano-wasm/demo/src/Bech32.elm | Add provisional bech32→hex decoder fallback for pool ids. |
| cardano-wasm/demo/README.md | Document the expanded demo feature set, including staking and pool picker. |
| .changes/20260718_cardano_wasm_demo_staking.yml | Add changelog fragment for the new demo feature. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- pin the pool's Blockfrost hex (and ticker) into the certificate at pick time instead of re-resolving it from the currently loaded picker page at estimate/sign time; drop the poolHex fallback path - stamp GotPools with the network and page it answers and drop stale replies, matching the GotUtxos landing-guard idiom - validate fully in Bech32.bech32ToHex (BIP-173 checksum, pool prefix, 28-byte payload, no mixed case); fix the fetchPools docstring (pages replace, not append) - show the pending menu choice while the pool picker is open and replace the wallet's certificate only on a confirmed pick, so cancelling rolls back and the DOM select stays in sync - decode and show metadata.ticker in the pool picker; search matches it - compute the pager's has-more flag at the fetch boundary; toast on retry without a project id; log pool fetches like other Blockfrost calls; use LogInfo for cert edits - ports.js: build the boot error message from DOM nodes/textContent instead of innerHTML; fail loudly on an empty payment-key list instead of wedging the wasm instance - docs: restore the Types/Ports module docstrings, pparams.js (not .json), certificate building in the Wasm module doc, the real stake-witness rule, and an honest certMenu comment
palas
marked this pull request as ready for review
August 12, 2026 02:29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds the following functionality to the
cardano-wasmdemo:Context
This is a follow up of: #1287
How to trust this PR
WASMCI action and serving it with a simple web-server.Checklist
.changes/