← Back to Pull requests

Add the accounts, send and approvals pages (step 13b) #16

Closed
unknown closed this pull request without merging on Oct 22, 2026 07:04 UTC
View on GitHub
unknown unknown commented on Oct 21, 2026 20:15 UTC
Author

<!-- claude-projects-attribution: {"github_login":"b3hr4d"} -->
_Requested by Behrad · project thread_

Before: the wallet's pages could claim the wallet and say who you are to it, and nothing more. Accounts, transfers, approvals, join requests and upgrades were command-line calls.

After: the start page shows a member the wallet's accounts with their balances and the address each receives at, and lets an owner add an ICP, ICRC-1 token or Bitcoin account. Someone signed in who is not a member asks to join there and gets an eight-digit code to check with an owner. A member asks whether a new version is available, and an owner proposes the upgrade. /send lets an owner propose a transfer and run it when the policy lets it through at once, and /approvals lists the open actions, join requests with their code, with Approve, Reject and Run buttons as the member's role allows. This finishes step 13.

How: three new React modules (accounts.tsx, send.tsx, approvals.tsx) plus the join request and new-version sections, all through ic-reactor as in #15. Every read is a certified call, a token's symbol, decimals and fee included, which come from its ledger's icrc1_metadata through bindings of a three-line ICRC-1 interface in ui/candid/icrc1.did. Amounts are typed and shown exactly with ic-reactor's parseUnits and formatUnits. Each write invalidates only the reads it changes, so proposing does not re-read every balance. The wallet embeds and certifies send.html and approvals.html at /send and /approvals.

Worth your review

  • What a page costs. Measured on icp-cli's local network, signed in as an owner: the start page with an ICP, an ICRC-1 and a Bitcoin account costs the wallet about 75M cycles, /send about 27M and /approvals about 35M. A balance is the wallet's balance update, which calls the ledger or the Bitcoin canister, read once per page and again on "Refresh the balance". On mainnet the Bitcoin canister also charges its own fee for each Bitcoin balance.

  • New versions on a button. The design said the page asks for a new version whenever a member opens it. That is an update that calls the release channel and canister_info on every visit, so the start page asks only on "Check for a new version". docs/design.md says so now.

  • The join code is eight digits from the SHA-256 of the asking principal's text, shown on the new device and next to its request on the approvals page. Someone who sends a request at the same time gets a different code, so the owner approves the device in front of them.

  • Sending is two steps: Propose, then Send now. Under the default policy a transfer is ready at once, and the second click is the point where the money moves. No fee or memo fields: a ledger takes its own fee, and Bitcoin pays the median rate, as the wallet's fee = null does. A transfer proposed from the command line with its own fee shows that fee to approvers, since a Bitcoin transfer spends it on top of the amount.

  • A refusal says why. A call the wallet's guards reject (a viewer approving, say) used to show "the call may have gone through", since a reject can follow a state change in general. The wallet rejects only in guards, before the method runs, so the page now shows the wallet's reason.

  • Approvers see everything an action sets. Under each open action's sentence, the approvals page lists what the sentence leaves out: every rule of a proposed policy with its approvals, wait and daily limits, an extension's permissions and budgets, the new version's Wasm hash, and a transfer's memo. Actions proposed from the command line can set all of these.

  • A one-minute clock margin. The page offers Run once an action's timelock ends by the browser's clock, give or take a minute; if it is still early, the wallet refuses and says until when.

  • Not in this step: pages to manage members (they change through join requests and the command line), to propose a policy or an extension, and history (the wallet does not implement history yet). ICP addresses are shown as ICRC-1 text; some exchanges want the older account identifier.
  • Tests. 15 new Node tests in ui/, 24 in all: the join code against Node's own SHA-256, typed amounts (exact base units, too many decimals, zero and negative amounts, grouping and exponents refused), a ledger's metadata with and without a fee or usable decimals, and what an action and its state say, including a fee the proposal sets, what each kind of action sets beyond its sentence, the account a transfer sends from, and the clock margin. The wallet's page tests and the PocketIC page test now cover /send, /send.html, /approvals and /approvals.html (14 paths, before and after the claim and an upgrade).

    I clicked through it on icp-cli's local network in headless Chromium, with a stand-in for the Internet Identity sign-in that signs as a fixed Ed25519 key (the passkey step still does not run headless) and every other byte as built. The run claimed a wallet from its claim link, added an ICP account, a cycles-ledger account and a regtest Bitcoin account. It sent the wallet 10 ICP and mined a block to its Bitcoin address, and both balances went up on "Refresh the balance". It refused an amount with 9 decimals, sent 1.5 ICP and showed the ledger block it landed in, and showed the wallet's refusal of a bad address. A second identity asked to join and showed the same code as the owner's approvals page. The owner approved and ran the request, after which that identity saw the accounts as a viewer and the send page told it only owners send. No console errors, page errors or CSP violations. "Check for a new version" showed the channel's error, since try-local.sh points the wallet at a ledger as its channel. After Codex's review, a second run delayed the propose call and switched From mid-call, and the confirmation still named the account the wallet proposed from. A policy, an upgrade and a transfer with a fee and memo, proposed from the command line, showed in full on the approvals page.

    The whole CI battery passes locally: the ui job's steps, the wallet unit tests, the interface check, the factory unit tests, and the PocketIC tests with the upgrade from #15's wallet.

    🤖 Generated with Claude Code

    https://claude.ai/code/session_013Vgh2De8Zarye1iDyGSRbe

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: b3hr4d Review duration: 648m
    All Vouch review confidence checks passed
    Residual risk 0.23 = Change Risk (0.57) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.57 · 650 lines diff across 8 files
    0.57
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #16"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 57% (MEDIUM) · Higher = larger blast radius
    57%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 22.5% · Safe to merge
    22.5%