Repository navigation
feat(maturity): allow disbursing to an address book entry - #395
Merged
Merged
Conversation
|
✅ No security or compliance issues detected. Reviewed everything up to 1fb0432. Security Overview
Detected Code Changes
|
Lets a neuron's available maturity be disbursed to any saved address in the user's address book, in addition to the existing "my accounts" flow. ICP entries pass through `toAccountIdentifier`; ICRC-1 entries are decoded and passed through `toAccount` (principal + subaccount). UX mirrors the Send ICP toggle: when the address book has entries, the modal defaults to the address-book picker; users can flip back to their own subaccounts at any time.
yhabib
force-pushed
the
feat/disburse-maturity-address-book
branch
from
June 9, 2026 12:20
1fb0432 to
fd10a25
Compare
📊 Build Bundle StatsThe latest build generated the following assets: |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the neuron “Disburse maturity” flow to support selecting a destination from the user’s address book, enabling disbursement to either an ICP account identifier or an ICRC-1 account (principal + optional subaccount).
Changes:
- Expanded
useDisburseMaturityto accept a typed destination (icpvsicrc1) and route the governance call accordingly. - Added an address-book toggle + selector to
DisburseMaturityModal, including auto-toggle behavior and an empty-state link to settings. - Introduced a new validation error string for the “toggle on but no destination selected” case.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/governance-app-frontend/src/i18n/en/modals/neuronDetail.json | Adds a new validation error string for missing destination selection. |
| src/governance-app-frontend/src/features/stakes/hooks/useDisburseMaturity.ts | Adds destination typing, routes governance call based on destination kind, and invalidates balance cache for resolved destination. |
| src/governance-app-frontend/src/features/stakes/components/DisburseMaturityModal.tsx | Adds address-book-based destination selection UI and confirm-time decoding for ICRC-1 entries. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
When the subaccounts advanced feature is disabled, turning the address book toggle off left the destination section blank and silently disbursed to the main account. Render a read-only main-account field in that case so the destination is always visible.
Prevent confirming before the address book finishes loading and the auto-toggle engages, which would otherwise disburse to the main account instead of the intended saved destination.
…book opt-in Drop the auto-on toggle so the account/main-account picker stays the primary action; the address book is now opt-in via the toggle. Disburse is still blocked until the address book finishes loading.
Wrap decodeIcrcAccount in the confirm handler so a malformed address book entry surfaces a validation error instead of crashing the modal. Normalize the ICRC subaccount once (32-byte guard) so the forwarded destination and the balance-invalidation key stay consistent.
yhabib
marked this pull request as ready for review
July 1, 2026 10:00
|
✅ No security or compliance issues detected. Reviewed everything up to dcb8e0c. Security Overview
Detected Code Changes
|
Drop the showDestinationSection gate so the destination is always shown: the main-account read-only field and the empty-address-book settings link now appear even when subaccounts are disabled and the address book is empty.
bjoernek
approved these changes
Jul 1, 2026
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.
Motivation
Disburse maturity only targeted the user's own accounts or subaccounts. The address book is already wired into the Send ICP flow, so reusing it here lets users disburse to any saved destination without retyping addresses.
Changes
useDisburseMaturityhook to accept either an ICP account identifier or an ICRC-1 account (principal + optional subaccount) as the destination.toAccountIdentifierand ICRC-1 entries through the structuredtoAccountparam on the governance canister call.noDestinationandinvalidDestinationerror strings.