feat(frontend): wallet send (ICP/ICVC) + shorten send-path principal#25
Open
bjoernek wants to merge 6 commits into
Open
feat(frontend): wallet send (ICP/ICVC) + shorten send-path principal#25bjoernek wants to merge 6 commits into
bjoernek wants to merge 6 commits into
Conversation
…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.
|
✅ No security or compliance issues detected. Reviewed everything up to 4c6d651. Security Overview
Detected Code Changes
|
…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.
yhabib
approved these changes
Jun 19, 2026
|
|
||
| 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 }); |
Contributor
There was a problem hiding this comment.
this is the same as the one above, do we need it?
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.
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:
icrc1_fee, checksamount + fee ≤ balance)confirm()showing amount/recipient/feeicrc1_transferas the signed-in user, then refreshes balances2. Beautify the "Redeem from this principal" note
The full principal overflowed the box. Now displayed shortened (same
5…5style as the top-right chip); clicking still copies the full principal (copyPrincipal()).Frontend-only — no canister/wasm change.
node --checkclean. Ships on the next frontend re-deploy.🤖 Generated with Claude Code