Skip to content

Expose the discovered wallet list and a useParties() hook #51

Description

@fernandomg

User story / Problem statement

Nothing exposes the wallets discovery found, or which one is connected. #3's acceptance criterion
"useConnect/CantonConnectProvider reflect the discovered wallet list and current selection" was
left unmet in #47: the list reaches CantonConnectConfig.walletPicker and nowhere else.

Two things need it:

  • A themed in-page picker (companion issue) has to render the entries, so it cannot be built
    without them.
  • Multi-account UI. useParty() returns the primary party only. A dApp showing a party switcher —
    the vesting app already has one — has to call sdk.listAccounts() itself and map the results. feat: adopt the dapp-sdk facade in canton-connect #47
    deliberately un-exported selectPrimaryAccount/toParty rather than make our internal mapping
    public API, on the grounds that the right answer is a hook we own.

Proposed solution

  • useParties() returning every account mapped to Party, so a switcher needs no access to our
    mapping helpers and the toParty precedence rule stays ours to change.
  • Expose the discovered entries and the current selection — most likely on the context value, since
    the picker is chosen before a session exists. Shape to be decided with the picker issue, so the two
    land coherently rather than inventing two overlapping surfaces.

Acceptance criteria

  • useParties() exists, returns all accounts as Party, and updates on accountsChanged
  • The discovered wallet entries and the current selection are readable from the public surface
  • The themed picker can be built against it without reaching into the SDK directly
  • selectPrimaryAccount and toParty stay internal — a consumer never needs them for this
  • JSDoc on the new exports, per CLAUDE.md

Metadata

Metadata

Assignees

Labels

area: connectcanton-connect: hooks, adapters, session, SDK facadeenhancementNew feature or requestpriority: mediumShould be addressed soon

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions