Skip to content

feat(frontend): wallet send (ICP/ICVC) + shorten send-path principal#25

Open
bjoernek wants to merge 6 commits into
mainfrom
feat/wallet-send-and-principal-chip
Open

feat(frontend): wallet send (ICP/ICVC) + shorten send-path principal#25
bjoernek wants to merge 6 commits into
mainfrom
feat/wallet-send-and-principal-chip

Conversation

@bjoernek

Copy link
Copy Markdown
Collaborator

Two usability gaps surfaced by the per-origin sign-in flow.

1. Send / withdraw from the Wallet view

With per-origin II, a holder sends ICVC to their dapp-scoped principal and redeems for ICP — but then the ICP (and any leftover ICVC) was stuck there, no way out via the UI. Adds a Send card to the Wallet tab:

  • token selector (ICP / ICVC), recipient principal, amount + MAX
  • fee-aware validation (icrc1_fee, checks amount + fee ≤ balance)
  • an irreversible-action confirm() showing amount/recipient/fee
  • icrc1_transfer as the signed-in user, then refreshes balances

2. Beautify the "Redeem from this principal" note

The full principal overflowed the box. Now displayed shortened (same 5…5 style as the top-right chip); clicking still copies the full principal (copyPrincipal()).

Frontend-only — no canister/wasm change. node --check clean. Ships on the next frontend re-deploy.

🤖 Generated with Claude Code

…rincipal

Two gaps in the per-origin flow:
1. A user who sent ICVC to their per-origin principal and redeemed had no way
   to move the resulting ICP (or leftover ICVC) back out — stuck. Add a Send
   card to the Wallet view: token selector (ICP/ICVC), recipient principal,
   amount + MAX, fee-aware validation, an irreversible-action confirm, then
   icrc1_transfer as the signed-in user; refreshes balances on success.
2. The 'Redeem from this principal' note showed the full principal (overflowed
   the box). Display it shortened (like the top-right chip) — click still
   copies the FULL principal via copyPrincipal().

Frontend-only; no canister change. Ships on the next frontend re-deploy.
@bjoernek bjoernek requested a review from a team as a code owner June 19, 2026 13:21
@zeropath-ai

zeropath-ai Bot commented Jun 19, 2026

Copy link
Copy Markdown

No security or compliance issues detected. Reviewed everything up to 4c6d651.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► src/frontend/index.html
    Add Send card UI
    Update principal display and copy functionality
► src/frontend/js/app.js
    Add ICP legacy transfer interface
    Implement send functionality for ICP and ICVC
    Add send confirmation modal
    Update balance display for send form
► src/frontend/js/idl.js
    Define ICP legacy transfer IDL

bjoernek added 5 commits June 19, 2026 15:45
…via legacy transfer)

Feedback on the wallet send preview:
1) Show the redeem-from principal as an inline copy-chip (same style as the
   top-right), with its own 'Copied!' tooltip — clearer affordance, no block/
   newline. copyPrincipal() now takes a tooltip id; still copies the FULL
   principal.
2) Send is token-aware: ICVC (ICRC-1) -> principal via icrc1_transfer; ICP ->
   principal OR a 64-hex account identifier via the ICP ledger's legacy
   transfer (added to idl.js). Account IDs are CRC32-checksum-validated to catch
   typos before an irreversible send. Recipient label/placeholder switch per token.
…tect)

Simpler + clearer per review: for ICP the recipient is just the account
identifier (the address format exchanges/NNS use), sent via legacy transfer;
ICVC stays principal (ICRC-1). No on-the-fly format detection.
Per review, the wallet Send used an ugly browser confirm(). Replace it with a
styled #send-modal matching the redemption modal (amount / to / network fee +
Cancel/Confirm, Escape-to-close, focus on Cancel). handleSend now stages the
transfer + opens the modal; confirmSend executes it.
… send)

confirmRedeem closed the modal immediately and spun the main button; now it
disables the in-modal Confirm button + shows progress + closes on completion,
same as confirmSend. Disabling synchronously on click also guards against a
double-click double-submit.
e8sToDisplay used minimumFractionDigits:0, so a fractional ICVC balance like
5.9996 rendered as '6' (no decimals) on the wallet cards while ICP showed
decimals. Show exactly the requested number of places (minFrac = decimals), so
the top balances read e.g. '6.00'. The Send-card balance stays at 4 places.
Comment thread src/frontend/js/app.js

icvcLedger = Actor.createActor(ledgerIdl, { agent, canisterId: CONFIG.ICVC_LEDGER_ID });
icpLedger = Actor.createActor(ledgerIdl, { agent, canisterId: CONFIG.ICP_LEDGER_ID });
icpLegacy = Actor.createActor(icpLegacyIdl, { agent, canisterId: CONFIG.ICP_LEDGER_ID });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the same as the one above, do we need it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants