feat(connect): expose the party type on useParty - #165
Open
fernandomg wants to merge 2 commits into
Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
fernandomg
force-pushed
the
feat/5-party-type
branch
from
September 7, 2026 08:11
f06c7d5 to
65a0e37
Compare
- both are required on the CIP-0103 account entry and toParty dropped them - CIP-0103 names no signingProviderId values, so nothing is interpreted here - testing/party.ts builds the Party the suites used to spell out
- readPartyType reads the participant id over ledgerApi and compares namespaces, when asked - nothing runs at connect and the machine is untouched; a failed read rejects, the consumer decides - no held result or pending state: a plain async read a query layer can wrap later - docs: the party type seam, what the machine owns vs a hook, README and the wagmi mapping
fernandomg
force-pushed
the
feat/5-party-type
branch
from
September 7, 2026 15:08
65a0e37 to
70078b0
Compare
fernandomg
marked this pull request as ready for review
September 7, 2026 15:08
fernandomg
requested review from
gabitoesmiapodo
and
a balanced review from Copilot
and removed request for
Copilot
September 7, 2026 15:08
gabitoesmiapodo
approved these changes
Sep 7, 2026
gabitoesmiapodo
left a comment
Collaborator
There was a problem hiding this comment.
CC reported a few things not worth your time (but worth mine, it seems...), mostly very unlikely edge cases... nonsense crap.
So: LGTM.
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.
Summary
Closes #5
A Canton party is local or external: a local party's keys live on the participant hosting it, an external party signs for itself. A dApp cares because the reference gateway refuses
signMessagefor a local party, and today an app learns that only when the call fails.CIP-0103 does not say which kind an account is. This PR passes
namespaceandsigningProviderIdthrough onPartyas the wallet reports them and addsusePartyType, which answers when asked:readPartyType()reads the participant id throughledgerApiand compares its namespace with the party's. Nothing runs at connect; a failed read rejects and the consumer decides.Changes
PartycarriesnamespaceandsigningProviderIdas the wallet reports themusePartyType()returnsreadPartyType, resolving'local'or'external', andisReadyPartyTypeis exportedCLAUDE.mdstates what the machine owns and what a hook doesDeviations
Partyfield: a field would put a ledger read at connect for a fact only some consumers needreadPartyTypeis a plain async read, the shape a query layer (TanStack Query) wraps laterreadPartyType()and showing the kind inAccountMenuis its own issueactAs,readAsanddisclosedContractspass through verbatim; there are no connectors to keep consistentAcceptance criteria
Party/usePartyexpose the party type (local vs external), throughusePartyTypeuseExecutesupports the full external prepare→sign→execute cycledisclosedContractsandactAs/readAsscoping are threaded through execute calls where relevantTest plan
Automated tests
pnpm -C canton-connect test: local, external, refusal, malformed answer, no partyManual verification
pnpm run mint-tokenGET http://localhost:2975/v2/parties/participant-idwith it: 200 and{ "participantId": "participant::<namespace>" }GET http://localhost:2975/v2/parties: Carpincho's parties reportisLocal: trueunder their own namespace, the bootstrap operators under the participant's; the namespace is the signal,isLocalis notThe dApp does not consume the hook yet.
Breaking changes
Partygains two required fields,namespaceandsigningProviderId. AFakeSessionProvidergiven a hand-builtpartyneeds both.Checklist
Screenshots
None.