@calimero-network/mero-react 9.1.3 → 9.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -2,10 +2,118 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import React__default, { CSSProperties, ReactNode } from 'react';
4
4
  import * as _calimero_network_mero_js from '@calimero-network/mero-js';
5
- import { MeroJs, TokenStore, SetMetadataRequest, SseEventData, GroupMembershipEventData, GroupMigrationEventData, Codec, AddGroupMembersRequest, GetBlobInfoResponseData, CreateContextRequest, CreateGroupInNamespaceRequest, CreateNamespaceRequest, CreateNamespaceInvitationRequest, CreateNamespaceInvitationResponseData, CreateRecursiveInvitationResponseData, GroupUpgradeStatusResponseData, GroupContextEntry, GroupInfo, CreateGroupInvitationRequest, MetadataRecord, JoinGroupRequest, JoinNamespaceRequest, MigrationStatus, MigrationStatusRollup, MemberMigrationStatusEntry, MigrateMyEntriesSummary, Namespace, SubgroupEntry, NamespaceIdentity, NodeIdentity, RemoveGroupMembersRequest, ReparentGroupRequest, ResyncContextRequest, SetDefaultCapabilitiesRequest, SetSubgroupVisibilityRequest, SetTeeAdmissionPolicyRequest, UpdateMemberRoleRequest, UpgradeGroupRequest, UploadBlobRequest, TokenData } from '@calimero-network/mero-js';
5
+ import { MeroClient, MeroJs, TokenStore, CloudClient, SignedGroupOpenInvitation, InviteRedeemer, SetMetadataRequest, SseEventData, GroupMembershipEventData, GroupMigrationEventData, Codec, AddGroupMembersRequest, GetBlobInfoResponseData, CreateContextRequest, CreateGroupInNamespaceRequest, CreateNamespaceRequest, CreateNamespaceInvitationRequest, CreateNamespaceInvitationResponseData, CreateRecursiveInvitationResponseData, GroupUpgradeStatusResponseData, GroupContextEntry, GroupInfo, CreateGroupInvitationRequest, MetadataRecord, ClassifiedError, JoinGroupRequest, JoinNamespaceRequest, MigrationStatus, MigrationStatusRollup, MemberMigrationStatusEntry, MigrateMyEntriesSummary, Namespace, SubgroupEntry, NamespaceIdentity, NodeIdentity, RedeemOutcome, RemoveGroupMembersRequest, ReparentGroupRequest, ResyncContextRequest, SetDefaultCapabilitiesRequest, SetSubgroupVisibilityRequest, SetTeeAdmissionPolicyRequest, UpdateMemberRoleRequest, UpgradeGroupRequest, UploadBlobRequest, TokenData } from '@calimero-network/mero-js';
6
6
  export * from '@calimero-network/mero-js';
7
7
  export { CAPABILITIES, Codec, DEFAULT_LOCAL_NODE_PORTS, DiscoverLocalNodesOptions, EphemeralClient, EphemeralEntry, MetadataRecord, discoverLocalNodes, hasCap, localNodeUrl, nodeEndpoint, probeNodeHealth, withCap, withoutCap } from '@calimero-network/mero-js';
8
8
 
9
+ /**
10
+ * The delegated half of connecting: an account, a certified device, and a relay
11
+ * that writes on their behalf.
12
+ *
13
+ * Kept deliberately apart from the node-login path in `MeroContext`. That path
14
+ * is a redirect flow with token adoption, single-use refresh tokens and node-URL
15
+ * trust validation — none of which applies here, because there is no session
16
+ * token at all. A delegated client authenticates every request from a warrant it
17
+ * signs itself. Weaving the two together would put a token-rotation decision in
18
+ * front of a flow that has no tokens.
19
+ *
20
+ * Per-tab on purpose. The record lives in `sessionStorage`, so two tabs can hold
21
+ * two different connections — one a node you run, one a relay you do not — with
22
+ * the same application code in both.
23
+ */
24
+
25
+ /**
26
+ * What a delegated connection needs to be rebuilt after a reload.
27
+ *
28
+ * `deviceSecret` is here because the device key is what signs warrants, and a
29
+ * reload that could not sign would be a dead session. It is a per-tab secret for
30
+ * a certificate the account can revoke — not the account root, which never
31
+ * leaves the wallet's origin.
32
+ */
33
+ /**
34
+ * What the wallet certified: an account, a device it trusts, and the key that
35
+ * device signs with. Everything except somewhere to send the result.
36
+ *
37
+ * Split out of {@link DelegatedSession} because it is reachable one step
38
+ * earlier. An account that has just enrolled holds exactly this and no relay —
39
+ * it is a member of nothing, so the cloud has no relay to name — and this is the
40
+ * input that resolves one from an invitation instead.
41
+ */
42
+ interface DelegatedCredential {
43
+ /** The author's account id, hex. */
44
+ account: string;
45
+ /** The author's `AccountProof<DeviceCert>`, hex borsh. */
46
+ credential: string;
47
+ /** The certified device's ed25519 signing secret, hex. */
48
+ deviceSecret: string;
49
+ }
50
+ interface DelegatedSession extends DelegatedCredential {
51
+ /**
52
+ * The relay to write through — a node origin, or `null` for none yet.
53
+ *
54
+ * **`null` is a logged-in state, not a broken one.** A brand-new account is a
55
+ * member of nothing, so the cloud names no relay for it — and that is the
56
+ * normal condition of an account that has just been created, because being
57
+ * signed in is how you come to be invited in the first place. Refusing to
58
+ * connect without a relay locked a new account out of the only path that
59
+ * would earn it one.
60
+ *
61
+ * What it does NOT mean is that writes quietly do nothing. There is no
62
+ * client at all without a URL ({@link buildDelegatedClient} returns `null`),
63
+ * so `mero` stays `null`, the session is authenticated, and anything reaching
64
+ * for `rpc.execute` is told the relay is missing. A placeholder URL would be
65
+ * the one unacceptable answer: it would look connected and refuse every
66
+ * warrant.
67
+ */
68
+ relayUrl: string | null;
69
+ }
70
+ /**
71
+ * The enrolled credential, whether or not a relay was ever found for it.
72
+ *
73
+ * A connected session is authoritative: it carries the same three fields and a
74
+ * relay, so it is read first and the standalone record is the fallback. Without
75
+ * that order a stale record from an earlier enrolment could out-rank the account
76
+ * actually connected.
77
+ */
78
+ declare function readDelegatedCredential(): DelegatedCredential | null;
79
+ declare function saveDelegatedCredential(c: DelegatedCredential): void;
80
+ declare function clearDelegatedCredential(): void;
81
+ /**
82
+ * Pin a relay's device signing key, hex (32 bytes), learned out of band.
83
+ *
84
+ * `login()` binds the session to this key, and it must never be read from the
85
+ * relay being logged in to — the answering party would choose what the device
86
+ * signs about. Until the cloud publishes it (mdma#312), it comes from the
87
+ * relay's operator.
88
+ */
89
+ declare function pinRelayNodeKey(relayUrl: string, nodeKey: string): void;
90
+ /** The pinned key for a relay, or `null` if none was pinned. */
91
+ declare function readPinnedRelayNodeKey(relayUrl: string): string | null;
92
+ interface RelayMap {
93
+ namespaces: Record<string, string>;
94
+ contexts: Record<string, string>;
95
+ }
96
+ declare function readRelayMap(account: string): RelayMap;
97
+ /** Record the relay that admitted this account to a namespace (and, when known, the context it came for). */
98
+ declare function rememberRelay(account: string, relayUrl: string, at: {
99
+ namespaceId?: string;
100
+ contextId?: string;
101
+ }): void;
102
+ /** The relay that serves a context, if this account has learned it. */
103
+ declare function relayForContext(account: string, contextId: string): string | null;
104
+ type ListedContext = Awaited<ReturnType<MeroClient['admin']['getContexts']>>['contexts'][number];
105
+ /**
106
+ * This account's contexts on every relay it knows, each tagged with the relay
107
+ * that listed it — and that relay recorded as the one serving it.
108
+ *
109
+ * Each relay answers only for itself and only for this caller, so the union is
110
+ * exactly the account's contexts across relays. A relay that cannot be reached
111
+ * or logged in to is skipped (its contexts simply do not appear), not fatal.
112
+ */
113
+ declare function listDelegatedContexts(s: DelegatedSession): Promise<Array<ListedContext & {
114
+ relayUrl: string;
115
+ }>>;
116
+
9
117
  /**
10
118
  * Types for mero-react
11
119
  */
@@ -100,8 +208,20 @@ interface ContextDiscoveryState {
100
208
  * Mero context value exposed by useMero hook
101
209
  */
102
210
  interface MeroContextValue {
103
- /** The MeroJs instance (null if not connected) */
104
- mero: MeroJs | null;
211
+ /**
212
+ * The connected client, or null.
213
+ *
214
+ * Two shapes, because there are two ways to connect: a node login yields a
215
+ * `MeroJs`, an account + relay connection yields a relay-transport
216
+ * `MeroClient`. Both expose `rpc` as an `ExecuteTransport`, which is what a
217
+ * generated ABI client depends on — so application logic is identical across
218
+ * the two and needs no branch.
219
+ *
220
+ * The union is deliberately not flattened behind a cast. A relay client has
221
+ * no `admin`, so code reaching for one should not typecheck as though it
222
+ * were there; narrow with {@link MeroContextValue.isDelegated} first.
223
+ */
224
+ mero: MeroJs | MeroClient | null;
105
225
  /** Whether the user is authenticated */
106
226
  isAuthenticated: boolean;
107
227
  /** Whether the connection is online */
@@ -116,6 +236,40 @@ interface MeroContextValue {
116
236
  contextIdentity: string | null;
117
237
  /** Connect to a node URL and start auth flow */
118
238
  connectToNode: (url: string) => void;
239
+ /**
240
+ * Adopt a delegated connection: an account, a device that account certified,
241
+ * and a relay that writes on its behalf.
242
+ *
243
+ * Installs the relay client immediately — there is no redirect and no token to
244
+ * wait for, because every request carries its own warrant.
245
+ */
246
+ connectWithAccount: (session: DelegatedSession) => void;
247
+ /**
248
+ * Whether the connection is delegated (account + relay) rather than a node
249
+ * login. True means `mero` is a relay-transport client, authenticated by the
250
+ * account's device certificate: `rpc` writes under warrants, and `admin` and
251
+ * `events` answer caller-scoped — this account's own contexts and namespaces,
252
+ * and events only for contexts it is a member of.
253
+ */
254
+ isDelegated: boolean;
255
+ /**
256
+ * What this connection may do, so an app asks WHAT IS ALLOWED instead of
257
+ * which transport it runs on. A node login can do everything; an account on
258
+ * a relay can create contexts (delegated creation) but not namespaces or
259
+ * invitations — those are a node's own operations today. A capability that
260
+ * later becomes available to accounts turns true here with no app change.
261
+ */
262
+ can: MeroCapabilities;
263
+ /**
264
+ * The app's registry identity, as the provider was given it. An account
265
+ * founding a namespace names this application for it, since a namespace
266
+ * founded through a relay starts with none.
267
+ */
268
+ app: {
269
+ packageName?: string;
270
+ packageVersion?: string;
271
+ registryUrl?: string;
272
+ };
119
273
  /** Logout and clear tokens */
120
274
  logout: () => void;
121
275
  /** Loading state */
@@ -155,6 +309,15 @@ interface MeroProviderConfig {
155
309
  */
156
310
  tokenStore?: TokenStore;
157
311
  }
312
+ /** See {@link MeroContextValue.can}. */
313
+ interface MeroCapabilities {
314
+ /** Found a namespace. */
315
+ readonly createNamespace: boolean;
316
+ /** Create a context inside a namespace this connection belongs to. */
317
+ readonly createContext: boolean;
318
+ /** Mint an invitation to a namespace. */
319
+ readonly invite: boolean;
320
+ }
158
321
 
159
322
  declare const MeroContext: React__default.Context<MeroContextValue | null>;
160
323
  interface MeroProviderProps extends MeroProviderConfig {
@@ -273,6 +436,36 @@ interface ConnectButtonProps {
273
436
  */
274
437
  declare function ConnectButton({ connectionType, className, style, theme, logoOnly, label, }: ConnectButtonProps): react_jsx_runtime.JSX.Element;
275
438
 
439
+ interface ConnectButtonAccountProps {
440
+ className?: string;
441
+ style?: React__default.CSSProperties;
442
+ theme?: MeroTheme;
443
+ /**
444
+ * Overrides for local development. An app in production passes none of this,
445
+ * and the pane asks the person for nothing at all.
446
+ *
447
+ * Nothing here is a value an end user could know, which is precisely why none
448
+ * of it is a form field any more:
449
+ *
450
+ * - the **relay** is discovered — the certificate the enrolment returns proves
451
+ * the cloud's account→relay lookup, so there is nothing to type and a prefill
452
+ * would only be a staler second source of truth;
453
+ * - the **context** is chosen after connecting, from the account's own contexts,
454
+ * which `admin.getContexts()` answers caller-scoped through the request proof.
455
+ */
456
+ defaults?: {
457
+ /**
458
+ * Point enrolment at a wallet other than the hosted one.
459
+ *
460
+ * Exists for working ON the wallet: a wallet served from `localhost:8090`
461
+ * cannot be reached through the hosted URL, and without this the only way to
462
+ * test a wallet change would be to deploy it.
463
+ */
464
+ walletUrl?: string;
465
+ };
466
+ }
467
+ declare function ConnectButtonAccount({ className, style, theme, defaults, }: ConnectButtonAccountProps): react_jsx_runtime.JSX.Element;
468
+
276
469
  interface LoginModalProps {
277
470
  /** Callback when user connects */
278
471
  onConnect: (url: string) => void;
@@ -336,6 +529,507 @@ interface MigrationAdminPanelProps {
336
529
  */
337
530
  declare function MigrationAdminPanel({ namespaceId, pollIntervalMs, className }: MigrationAdminPanelProps): react_jsx_runtime.JSX.Element;
338
531
 
532
+ /**
533
+ * Resolving a relay from an INVITATION rather than from an account.
534
+ *
535
+ * # The gap this closes
536
+ *
537
+ * `ConnectButtonAccount` finds a relay by asking the cloud what serves the
538
+ * *account* (`CloudClient.getAccountRelays`). A freshly enrolled account is a
539
+ * member of nothing, so that read correctly answers `[]` and the button
540
+ * correctly refuses to connect: there is nowhere to write, and a typed guess
541
+ * would be a node that refuses every warrant.
542
+ *
543
+ * But a newcomer is not stuck — they are holding an invitation, and an
544
+ * invitation names a namespace. `CloudClient.getNamespaceRouting` answers which
545
+ * nodes serve *that namespace*, and it is deliberately anonymous: a joiner has
546
+ * no cloud session, and needing one is exactly what this path exists to avoid.
547
+ * So the bootstrap order is namespace first, account second — admission is what
548
+ * makes `getAccountRelays` answer at all, not the other way round.
549
+ *
550
+ * # Two sources, one intersection, and why it must not be skipped
551
+ *
552
+ * The invitation's `admitters` list sits INSIDE the body the group admin
553
+ * signed, so it is authorization: merod answers `403` to an `/admit` from a node
554
+ * that list does not name, whatever else is true of it. The cloud's list is
555
+ * every node currently assigned to the namespace — it cannot know which
556
+ * invitation the caller holds, so it cannot filter by the signed list, and a
557
+ * node assigned *after* the invitation was minted looks perfect in every field
558
+ * the cloud reports and still refuses the claim.
559
+ *
560
+ * Intersecting here is therefore not belt-and-braces: it is the check that
561
+ * turns an unexplainable `403` into "your invitation names none of these nodes,
562
+ * ask for a fresh one". It is never relaxed to make a flow work.
563
+ *
564
+ * # `servable` and `canAdmit` are advisory; `writable` is information
565
+ *
566
+ * `servable` and `canAdmit` are derived from assignment heartbeats, and a lapsed
567
+ * heartbeat is not the same fact as a node that will refuse. Measured against
568
+ * prod: the cloud reported `servable: false, canAdmit: false, fresh: false` for a
569
+ * node whose `/admin-api/health` answered `{"status":"alive"}` and which had just
570
+ * minted the invitation being claimed. Gating on them meant refusing to knock on
571
+ * an open door, so a node with an address is tried and the NODE decides —
572
+ * `admit_join` re-verifies the invitation, the signature and the admitters list,
573
+ * so asking loosens nothing and a refusal names its own cause. `stale` on the
574
+ * result says the attempt rests on advisory data.
575
+ *
576
+ * `writable` — and its per-node form, `canExecute` — is about `CAN_AUTHOR_ON_BEHALF`,
577
+ * which admission does **not** require: relaying a join the joiner signed is not
578
+ * authoring on anyone's behalf. So a non-writable namespace is not a refusal
579
+ * here; it is reported on the result, because it is precisely why the writes
580
+ * would fail *after* connecting, and a caller that cannot tell the two apart
581
+ * sends the user to the wrong place.
582
+ */
583
+
584
+ /**
585
+ * Which step could not be completed. Each one needs a different action from the
586
+ * person, which is why this is an enum and not a message.
587
+ *
588
+ * - `admitters-lookup` — the cloud read itself failed (offline, 5xx, a refused
589
+ * routing proof). Nothing has been learned about the namespace.
590
+ * - `no-nodes` — the read succeeded and the cloud lists nothing. The namespace
591
+ * has no fleet assignment, so there is no cloud node to admit through; the
592
+ * invitation's admitters are somebody's self-hosted or desktop node, which the
593
+ * cloud neither knows nor routes to.
594
+ * - `not-invited` — nodes serve the namespace, and the invitation names none of
595
+ * them. Terminal for this invitation: ask for a fresh one.
596
+ * - `invited-unreachable` — a named node exists but cannot take a join now (no
597
+ * fresh heartbeat, or the cloud reports the namespace as not servable). A
598
+ * wait, not a wrong invitation.
599
+ * - `no-relay-url` — a named node can admit but the cloud knows no address for
600
+ * it, so there is nothing to connect through afterwards. Also a wait: it is
601
+ * the shape a node reports before its first heartbeat lands.
602
+ */
603
+ type RelayResolutionStep = 'admitters-lookup' | 'no-nodes' | 'not-invited' | 'invited-unreachable' | 'no-relay-url';
604
+ /** A relay that can take this invitation's join, and connect afterwards. */
605
+ interface ResolvedInvitationRelay {
606
+ readonly ok: true;
607
+ /** The node origin to connect through. */
608
+ readonly relayUrl: string;
609
+ /** Where to POST the signed join — the cloud's own, never rebuilt when given. */
610
+ readonly admitUrl: string;
611
+ /** The admitter's account, as the cloud reported it. */
612
+ readonly admitterAccount: string | null;
613
+ readonly peerId: string;
614
+ /**
615
+ * Whether this node can also run delegated writes (`CAN_AUTHOR_ON_BEHALF`).
616
+ *
617
+ * `false` is not a failure of admission — see the module note. It means the
618
+ * connection that follows will read and receive events but have its intents
619
+ * refused, which an admin grants away, so it is worth saying out loud.
620
+ */
621
+ readonly writable: boolean;
622
+ /** Whether the chosen node's heartbeat for this namespace has lapsed. */
623
+ readonly stale: boolean;
624
+ }
625
+ interface RelayResolutionFailure {
626
+ readonly ok: false;
627
+ readonly step: RelayResolutionStep;
628
+ /** What to go and do about it, in one sentence. */
629
+ readonly reason: string;
630
+ }
631
+ type ResolveRelayResult = ResolvedInvitationRelay | RelayResolutionFailure;
632
+ interface ResolveRelayFromInvitationInput {
633
+ /** The namespace the invitation admits you to, 64 hex. */
634
+ readonly namespaceId: string;
635
+ /**
636
+ * The invitation's signed `admitters` — `invitation.invitation.admitters`.
637
+ *
638
+ * An EMPTY list is the legacy "admission by broadcast" shape, where any ready
639
+ * peer may admit, and is treated as such. Omitting the field and passing an
640
+ * empty array are therefore the same thing on purpose: there is no spelling
641
+ * here that means "nobody may admit", because an invitation cannot say that.
642
+ */
643
+ readonly admitters?: readonly string[];
644
+ /** The delegated credential — an `AccountProof<DeviceCert>`, hex. */
645
+ readonly credential: string;
646
+ /** The certified device's ed25519 signing secret, hex. */
647
+ readonly deviceSecret: string;
648
+ /** Point at a cloud other than the hosted manager. For local rigs. */
649
+ readonly cloudBaseUrl?: string;
650
+ /** Injected in tests. Anything with the one method this needs. */
651
+ readonly cloud?: Pick<CloudClient, 'getNamespaceRouting'>;
652
+ }
653
+ /**
654
+ * Normalise a hex account for comparison: lower-cased, `0x` stripped.
655
+ *
656
+ * Both sides are hex for the same 32 bytes, and a spelling mismatch would
657
+ * present as "your invitation does not name this node" — a refusal that looks
658
+ * like policy and is really formatting.
659
+ */
660
+ declare function normaliseAccount(account: string | null | undefined): string | null;
661
+ /**
662
+ * Resolve a relay to bootstrap through, from an invitation and nothing else.
663
+ *
664
+ * Reads the cloud's routing for the namespace, intersects it with the
665
+ * invitation's signed `admitters`, and returns the node to use — or which step
666
+ * stopped it and what that means. It performs no admission and mints no keys:
667
+ * the credential passed in is the one the wallet already certified.
668
+ */
669
+ declare function resolveRelayFromInvitation(input: ResolveRelayFromInvitationInput): Promise<ResolveRelayResult>;
670
+
671
+ /**
672
+ * Present a signed join to ONE named node.
673
+ *
674
+ * This is the whole of admission for a caller with no node of its own: sign the
675
+ * membership op with the device key the account certified, and POST it to a node
676
+ * the invitation named as an admitter.
677
+ *
678
+ * POST /admin-api/namespaces/{namespaceId}/admit
679
+ * { "invitation": SignedGroupOpenInvitation, "signedOp": "<hex borsh SignedNamespaceOp>" }
680
+ *
681
+ * Verified against core at rc.43 — `crates/server/src/admin/handlers/namespaces/
682
+ * admit_join.rs`, request type `AdmitJoinApiRequest` in
683
+ * `crates/server/primitives/src/admin/mod.rs`. The handler also refuses a
684
+ * mismatch between the invitation's `group_id` and the namespace in the path, so
685
+ * the two are never allowed to disagree here.
686
+ *
687
+ * ## Why it needs no token and no proof
688
+ *
689
+ * The joiner's signature IS the authorization. The op is signed by the device
690
+ * key named in the credential it carries, and every peer checks
691
+ * `signer == credential.statement.sign_pk` before applying a join — so an
692
+ * admitter can carry this and can never author it: it cannot admit a different
693
+ * account, change the group, or grant a role. It can refuse, and that is all.
694
+ * This is also why the fleet ingress leaves the route unauthenticated, and why
695
+ * this posts with `fetch` rather than through `AdminApiClient`, which is built
696
+ * around a node credential this caller does not have.
697
+ *
698
+ * ## Why it lives here and not in mero-js
699
+ *
700
+ * Two reasons. `mero-js` is read-only for this change by instruction, and the
701
+ * shape that is actually useful to a caller is the one that hands back a
702
+ * {@link DelegatedSession} — the node that admitted you is the node to connect
703
+ * through — which is `mero-react`'s concern. The pieces that are pure SDK, the
704
+ * borsh op layout and the request type, are used from `mero-js` unchanged and
705
+ * are not reimplemented here.
706
+ *
707
+ * ## Why the op has no parents
708
+ *
709
+ * A keyholder holds no node, so it has no view of the namespace DAG and cannot
710
+ * name its heads. Empty parents is the only thing it *can* sign, and the direct
711
+ * admission path exists precisely for callers in that position.
712
+ */
713
+
714
+ /** Which step failed, when one did. */
715
+ type JoinWithNodeStep =
716
+ /** The op could not be signed. Local, deterministic, and nothing was sent. */
717
+ 'sign'
718
+ /** The node refused it, or could not be reached. */
719
+ | 'admit';
720
+ interface JoinWithNodeSuccess {
721
+ readonly ok: true;
722
+ /**
723
+ * Whether the admitter said it published the op.
724
+ *
725
+ * NOT "you are a member": membership lands when peers apply the op, which the
726
+ * admitter neither performs nor waits for.
727
+ */
728
+ readonly published: boolean;
729
+ /**
730
+ * The session to connect with — the admitting node, used immediately.
731
+ *
732
+ * Deliberately not waiting for `getAccountRelays` to answer: the fleet writes
733
+ * the account's recovery envelope asynchronously, so the cloud lookup lags the
734
+ * admission by an unpredictable amount. The node that just carried the join is
735
+ * known to serve this namespace right now, which is a better answer than a
736
+ * lookup that will agree later.
737
+ */
738
+ readonly session: DelegatedSession;
739
+ }
740
+ interface JoinWithNodeFailure {
741
+ readonly ok: false;
742
+ readonly step: JoinWithNodeStep;
743
+ readonly reason: string;
744
+ /** The HTTP status, when the node answered with one. */
745
+ readonly status?: number;
746
+ }
747
+ type JoinWithNodeResult = JoinWithNodeSuccess | JoinWithNodeFailure;
748
+ interface JoinWithNodeInput {
749
+ /**
750
+ * The node to present the join to — its admin API origin.
751
+ *
752
+ * The primary parameter, so all three sources of a node URL feed one method:
753
+ * one carried by the invitation (core emits only libp2p multiaddrs today —
754
+ * see `resolve_admitter_addrs`, a node cannot know the URL its admin API is
755
+ * proxied on — so this is the seam for when invitations carry a claim URL),
756
+ * one resolved from the cloud's `/admitters` lookup, and one an operator
757
+ * simply knows.
758
+ */
759
+ readonly nodeUrl: string;
760
+ /**
761
+ * The exact URL to POST to, when something already knows it.
762
+ *
763
+ * The cloud hands back a ready-made `admit_url` which need not be a path on
764
+ * `nodeUrl`'s origin, and rebuilding it from a guess is how a working
765
+ * admission becomes a 404. Omitted, the documented route on `nodeUrl` is used.
766
+ */
767
+ readonly admitUrl?: string;
768
+ /** The namespace being joined, 64 hex. Must match the invitation's group. */
769
+ readonly namespaceId: string;
770
+ /**
771
+ * The invitation, exactly as the inviter's node returned it.
772
+ *
773
+ * Passed through unchanged and never rebuilt field by field: the signature
774
+ * covers the body, and re-modelling it through a local type drops the unsigned
775
+ * bootstrap fields and invalidates the signature with them.
776
+ */
777
+ readonly invitation: SignedGroupOpenInvitation;
778
+ /** The enrolled account, its certificate, and the device secret that signs. */
779
+ readonly credential: DelegatedCredential;
780
+ /** Injected in tests. */
781
+ readonly deps?: {
782
+ readonly fetch?: typeof fetch;
783
+ readonly nonce?: () => Promise<bigint>;
784
+ };
785
+ }
786
+ /**
787
+ * Sign the membership op and present it to `nodeUrl`.
788
+ *
789
+ * Resolves rather than throws for every expected refusal, because they are
790
+ * different things for the person to do: a malformed op is final, an unreachable
791
+ * node is a retry, and a 409 means pick another admitter.
792
+ */
793
+ declare function joinWithNode(input: JoinWithNodeInput): Promise<JoinWithNodeResult>;
794
+
795
+ /**
796
+ * Bootstrapping an account that is a member of nothing, from an invitation.
797
+ *
798
+ * # The one missing step
799
+ *
800
+ * A freshly enrolled account holds a certified device and belongs to no
801
+ * namespace, so `CloudClient.getAccountRelays` answers `[]` — correctly, because
802
+ * nothing serves an account that is a member of nothing. It is still signed in;
803
+ * what it has no way to do is write. An invitation is what changes that, and the
804
+ * chain is:
805
+ *
806
+ * invitation → namespaceId → a node URL
807
+ * → POST the signed join to that node → the account is a member
808
+ * → that same node is the relay, from this moment
809
+ * → a fleet relay writes the recovery envelope asynchronously,
810
+ * and getAccountRelays() agrees from then on
811
+ *
812
+ * The session does not wait for the cloud to catch up. The node that carried the
813
+ * join is known to serve the namespace now; the lookup will agree later.
814
+ *
815
+ * # Where the node URL comes from, in preference order
816
+ *
817
+ * 1. one passed in — an operator's, or one a future invitation carries. Core
818
+ * today emits only libp2p multiaddrs on an invitation (`resolve_admitter_addrs`)
819
+ * because a node cannot know the URL its admin API is proxied on, so there is
820
+ * nothing to read off the invitation yet and this is the seam for when there
821
+ * is;
822
+ * 2. the cloud's `/api/cloud/namespaces/{ns}/admitters`, intersected with the
823
+ * invitation's signed `admitters` — see `resolveRelayFromInvitation`.
824
+ *
825
+ * # Nothing here is minted, weakened or worked around
826
+ *
827
+ * The credential and the device secret come from the enrolment the wallet
828
+ * already performed. The op is signed by that device key, which is what stops an
829
+ * admitter substituting a different member. The admitters intersection is done in
830
+ * `resolveRelayFromInvitation` and is never relaxed.
831
+ */
832
+
833
+ /**
834
+ * Which step failed. One exhaustive list to branch on: the relay-resolution
835
+ * steps, the two `joinWithNode` reports, and the one only a hook can hit.
836
+ *
837
+ * - `no-credential` — this tab holds no enrolled account, so there is nothing to
838
+ * admit. Only {@link useDelegatedBootstrap} can report it;
839
+ * `bootstrapFromInvitation` is handed the credential as an argument.
840
+ */
841
+ type BootstrapStep = RelayResolutionStep | JoinWithNodeStep | 'no-credential';
842
+ interface BootstrapSuccess {
843
+ readonly ok: true;
844
+ /** The session to connect with — hand it straight to `connectWithAccount`. */
845
+ readonly session: DelegatedSession;
846
+ /**
847
+ * How the node was chosen, when the cloud chose it.
848
+ *
849
+ * `null` when the caller named the node itself, because then there was no
850
+ * routing read to report — not because anything was skipped.
851
+ */
852
+ readonly relay: ResolvedInvitationRelay | null;
853
+ /**
854
+ * Whether the admitter said it published the op.
855
+ *
856
+ * NOT "you are a member": membership lands when peers apply the op, which the
857
+ * admitter neither performs nor waits for. `false` with no error means the node
858
+ * took the call and did not publish — worth surfacing rather than treating as
859
+ * success.
860
+ */
861
+ readonly published: boolean;
862
+ }
863
+ interface BootstrapFailure {
864
+ readonly ok: false;
865
+ readonly step: BootstrapStep;
866
+ readonly reason: string;
867
+ /** The HTTP status, when the failing step was an HTTP call. */
868
+ readonly status?: number;
869
+ }
870
+ type BootstrapResult = BootstrapSuccess | BootstrapFailure;
871
+ interface BootstrapFromInvitationInput {
872
+ /** The namespace the invitation admits you to, 64 hex. */
873
+ readonly namespaceId: string;
874
+ /** The invitation, exactly as the inviter's node returned it. */
875
+ readonly invitation: SignedGroupOpenInvitation;
876
+ /** The enrolled account, its certificate, and the device secret. */
877
+ readonly credential: DelegatedCredential;
878
+ /**
879
+ * A node to present the join to, skipping the cloud lookup.
880
+ *
881
+ * Use it when something already knows the node — an operator, a local rig, or
882
+ * an invitation that carries a claim URL once core emits one. Without it the
883
+ * cloud's admitters lookup answers, and the invitation's signed list is what
884
+ * narrows the answer.
885
+ */
886
+ readonly nodeUrl?: string;
887
+ /** Point at a cloud other than the hosted manager. For local rigs. */
888
+ readonly cloudBaseUrl?: string;
889
+ /** Injected in tests. */
890
+ readonly deps?: {
891
+ readonly resolve?: typeof resolveRelayFromInvitation;
892
+ readonly join?: typeof joinWithNode;
893
+ readonly fetch?: typeof fetch;
894
+ readonly nonce?: () => Promise<bigint>;
895
+ };
896
+ }
897
+ /**
898
+ * Resolve a node from the invitation, present the signed join to it, and return
899
+ * the session to connect with.
900
+ *
901
+ * Never throws for an expected failure: every one of them is a different thing
902
+ * for the person to do, so they come back as `{ ok: false, step, reason }`. A
903
+ * generic "could not join" is exactly what this shape exists to prevent.
904
+ */
905
+ declare function bootstrapFromInvitation(input: BootstrapFromInvitationInput): Promise<BootstrapResult>;
906
+
907
+ /**
908
+ * The delegated connect path, entered from an invitation instead of an account.
909
+ *
910
+ * `ConnectButtonAccount` enrols the device and then asks the cloud which relays
911
+ * serve the ACCOUNT. For a first-time account that answer is `[]` and there is
912
+ * nothing to connect to — correctly, since nothing yet serves an account that is
913
+ * a member of nothing. This hook is the other door into the same connection: it
914
+ * takes an invitation, resolves a relay from the NAMESPACE, presents the signed
915
+ * join, and then connects through the node that carried it.
916
+ *
917
+ * It is `MeroContext`'s own `connectWithAccount` at the end, not a second
918
+ * connection mechanism — the only difference is how the relay was found.
919
+ */
920
+
921
+ interface UseDelegatedBootstrapOptions {
922
+ /** Point at a cloud other than the hosted manager. For local rigs. */
923
+ readonly cloudBaseUrl?: string;
924
+ }
925
+ interface UseDelegatedBootstrapResult {
926
+ /** The enrolled account and its certificate, or `null` if none was ever held. */
927
+ readonly credential: DelegatedCredential | null;
928
+ /**
929
+ * Whether this account is signed in with nowhere to write.
930
+ *
931
+ * True means: an enrolled credential is held and no relay is known for it, so
932
+ * the account→relay lookup has nothing and an invitation is what changes that.
933
+ * Being signed in is NOT the missing part — that is the whole point, since you
934
+ * have to be signed in to be invited.
935
+ *
936
+ * False covers "already has a relay" and "never enrolled", which need the two
937
+ * other entry points rather than this one.
938
+ */
939
+ readonly needsBootstrap: boolean;
940
+ readonly running: boolean;
941
+ /** The last attempt's outcome, kept so a UI can name the failing step. */
942
+ readonly result: BootstrapResult | null;
943
+ /**
944
+ * Admit this account to the invitation's namespace and connect through the
945
+ * admitting node.
946
+ *
947
+ * Resolves rather than throws for every expected refusal: the step names are
948
+ * the point, because an empty intersection, an unreachable admitter and a
949
+ * namespace with no fleet assignment need three different actions.
950
+ */
951
+ readonly bootstrap: (input: {
952
+ readonly namespaceId: string;
953
+ readonly invitation: SignedGroupOpenInvitation;
954
+ /**
955
+ * A node to present the join to, skipping the cloud lookup — an operator's,
956
+ * a local rig's, or one a future invitation carries.
957
+ */
958
+ readonly nodeUrl?: string;
959
+ /** The context the invitation is for, so its relay is known before any listing. */
960
+ readonly contextId?: string;
961
+ }) => Promise<BootstrapResult>;
962
+ }
963
+ declare function useDelegatedBootstrap(options?: UseDelegatedBootstrapOptions): UseDelegatedBootstrapResult;
964
+
965
+ /**
966
+ * An account's governance through the relay that serves its namespace: create
967
+ * a context, and the group ops a private context (a DM) needs.
968
+ *
969
+ * A thin layer over mero-js's `RelayClient.createContext` / `govern` (core's
970
+ * `/admin-api/groups/{group}/context-intents` and `.../governance-intents`),
971
+ * adding what only this package knows: which relay serves the namespace (the
972
+ * relay map), and the nonce bookkeeping across page loads.
973
+ *
974
+ * Nodes check the AUTHOR's rights (CAN_CREATE_CONTEXT, CAN_CREATE_SUBGROUP,
975
+ * MANAGE_MEMBERS…), never the relay's; the relay only needs standing to act.
976
+ */
977
+
978
+ interface CreateDelegatedContextRequest {
979
+ readonly namespaceId: string;
980
+ /** The group to create it in; the namespace itself when omitted. */
981
+ readonly groupId?: string;
982
+ readonly applicationId: string;
983
+ readonly initializationParams?: number[];
984
+ readonly name?: string;
985
+ }
986
+ declare function createDelegatedContext(s: DelegatedSession, req: CreateDelegatedContextRequest, deps?: {
987
+ fetch?: typeof fetch;
988
+ }): Promise<{
989
+ contextId: string;
990
+ }>;
991
+
992
+ interface JoinInvitationInput {
993
+ readonly namespaceId: string;
994
+ readonly contextId: string;
995
+ readonly invitation: SignedGroupOpenInvitation;
996
+ }
997
+ type JoinInvitationStep = BootstrapFailure['step'] | 'node-join';
998
+ type JoinInvitationResult = {
999
+ readonly ok: true;
1000
+ } | {
1001
+ readonly ok: false;
1002
+ readonly step: JoinInvitationStep;
1003
+ /** What went wrong, in words a person can act on. */
1004
+ readonly reason: string;
1005
+ /** True when no retry can succeed: a fresh invitation is the only cure. */
1006
+ readonly final: boolean;
1007
+ /** The HTTP status of the refusal, when there was one. */
1008
+ readonly status?: number;
1009
+ };
1010
+ /**
1011
+ * Whether a node's join failure means the invitation itself will never work.
1012
+ *
1013
+ * Errs toward false: a dropped invitation is unrecoverable for the user, a
1014
+ * retried one costs a round trip, so a timeout or anything unfamiliar keeps
1015
+ * it. Phrases, not bare words — `"invalid"` alone would also match an
1016
+ * "invalid response" from a proxy, a transient failure.
1017
+ */
1018
+ declare function isFinalInvitationError(message: string | undefined | null): boolean;
1019
+ declare function useJoinInvitation(): {
1020
+ joinInvitation: (input: JoinInvitationInput) => Promise<JoinInvitationResult>;
1021
+ joining: boolean;
1022
+ /** The namespaces this connection is a member of: a node's own, or an account's across its relays. */
1023
+ memberships: () => Promise<string[]>;
1024
+ /**
1025
+ * The `{ join, memberships }` pair mero-js's `redeemInvitation` drives, for
1026
+ * whichever connection this is, so an app redeems an invitation (join once,
1027
+ * then check membership) with no transport of its own. `join` throws on a
1028
+ * refusal, carrying its HTTP status for the outcome's reason.
1029
+ */
1030
+ invitationRedeemer: (input: JoinInvitationInput) => InviteRedeemer;
1031
+ };
1032
+
339
1033
  interface UseEphemeralOptions<T> {
340
1034
  /** Encoding for the presence slice. Defaults to JSON. */
341
1035
  codec?: Codec<T>;
@@ -387,6 +1081,19 @@ declare function useEphemeral<T>(contextId: string | null, options?: UseEphemera
387
1081
  * `name` to keep the current name.
388
1082
  */
389
1083
  type SetMetadataInput = SetMetadataRequest;
1084
+ /** Options a mutation hook that can fail meaningfully accepts. */
1085
+ interface MutationOptions {
1086
+ /**
1087
+ * Rethrow a failed request from the action, after recording it in `error`
1088
+ * and `failure`.
1089
+ *
1090
+ * By default an action resolves `null` on failure, which a caller awaiting it
1091
+ * cannot tell apart from "not connected" — and a `catch` around it never
1092
+ * runs, so a refused join reads as a successful one. Set this when the
1093
+ * caller branches on the outcome.
1094
+ */
1095
+ throwOnError?: boolean;
1096
+ }
390
1097
  /**
391
1098
  * Execute RPC methods against a context.
392
1099
  * Tracks loading/error state. Unmount-safe.
@@ -461,7 +1168,33 @@ declare function useGroupCapabilities(groupId?: string | null, memberId?: string
461
1168
  };
462
1169
  declare function useContextDiscovery(options: ContextDiscoveryOptions): ContextDiscoveryState;
463
1170
  declare function useCreateContext(): {
464
- createContext: (request: CreateContextRequest) => Promise<_calimero_network_mero_js.CreateContextResponseData | null>;
1171
+ createContext: (request: CreateContextRequest) => Promise<{
1172
+ contextId: string;
1173
+ } | null>;
1174
+ loading: boolean;
1175
+ error: Error | null;
1176
+ };
1177
+ interface CreatePrivateContextRequest {
1178
+ readonly namespaceId: string;
1179
+ readonly applicationId: string;
1180
+ /** The accounts that share it with you, and nobody else — e.g. the other person of a DM. */
1181
+ readonly members: readonly string[];
1182
+ readonly initializationParams?: number[];
1183
+ }
1184
+ /**
1185
+ * Create a context only you and `members` are in (a DM, a small room): its own
1186
+ * restricted group in the namespace, members added directly — they are in the
1187
+ * namespace already, so nobody is invited. Same call on either connection:
1188
+ *
1189
+ * - a node login makes the group, adds the members and creates the context
1190
+ * with its own admin calls (as mero-chat's DMs do);
1191
+ * - an account has the relay serving the namespace do the same three steps,
1192
+ * each under its own warrant (delegated/create-context.ts).
1193
+ */
1194
+ declare function useCreatePrivateContext(): {
1195
+ createPrivateContext: (request: CreatePrivateContextRequest) => Promise<{
1196
+ contextId: string;
1197
+ } | null>;
465
1198
  loading: boolean;
466
1199
  error: Error | null;
467
1200
  };
@@ -470,13 +1203,23 @@ declare function useDeleteContext(): {
470
1203
  loading: boolean;
471
1204
  error: Error | null;
472
1205
  };
473
- declare function useJoinContext(): {
1206
+ /**
1207
+ * Join a context. `failure` says what kind of refusal a failed join was, and
1208
+ * whether trying again later could work; pass `{ throwOnError: true }` to have
1209
+ * `joinContext` reject instead of resolving `null`.
1210
+ */
1211
+ declare function useJoinContext(options?: MutationOptions): {
474
1212
  joinContext: (contextId: string) => Promise<_calimero_network_mero_js.JoinContextResponseData | null>;
475
1213
  loading: boolean;
476
1214
  error: Error | null;
1215
+ failure: ClassifiedError | null;
477
1216
  };
478
1217
  declare function useJoinSubgroupInheritance(): {
479
- joinSubgroupInheritance: (groupId: string) => Promise<_calimero_network_mero_js.JoinSubgroupInheritanceResponseData | null>;
1218
+ joinSubgroupInheritance: (groupId: string) => Promise<{
1219
+ groupId: string;
1220
+ memberPublicKey: string;
1221
+ wasInherited: boolean;
1222
+ } | null>;
480
1223
  loading: boolean;
481
1224
  error: Error | null;
482
1225
  };
@@ -493,7 +1236,9 @@ declare function useGroupInfo(groupId?: string | null): {
493
1236
  refetch: () => Promise<void>;
494
1237
  };
495
1238
  declare function useDeleteGroup(): {
496
- deleteGroup: (groupId: string) => Promise<_calimero_network_mero_js.DeleteGroupResponseData | null>;
1239
+ deleteGroup: (groupId: string) => Promise<{
1240
+ groupId: string;
1241
+ } | _calimero_network_mero_js.DeleteGroupResponseData | null>;
497
1242
  loading: boolean;
498
1243
  error: Error | null;
499
1244
  };
@@ -566,7 +1311,10 @@ declare function useNamespacesForApplication(applicationId?: string | null): {
566
1311
  refetch: () => Promise<void>;
567
1312
  };
568
1313
  declare function useCreateNamespace(): {
569
- createNamespace: (request: CreateNamespaceRequest) => Promise<_calimero_network_mero_js.CreateNamespaceResponseData | null>;
1314
+ createNamespace: (request: CreateNamespaceRequest) => Promise<{
1315
+ namespaceId: string;
1316
+ teeEnabled: boolean;
1317
+ } | _calimero_network_mero_js.CreateNamespaceResponseData | null>;
570
1318
  loading: boolean;
571
1319
  error: Error | null;
572
1320
  };
@@ -580,13 +1328,44 @@ declare function useCreateNamespaceInvitation(): {
580
1328
  loading: boolean;
581
1329
  error: Error | null;
582
1330
  };
583
- declare function useJoinNamespace(): {
1331
+ /**
1332
+ * Join a namespace by invitation. `failure` says what kind of refusal a failed
1333
+ * join was, and whether trying again later could work; pass
1334
+ * `{ throwOnError: true }` to have `joinNamespace` reject instead of resolving
1335
+ * `null`.
1336
+ *
1337
+ * To follow an invitation link, prefer {@link useRedeemInvitation}: it also
1338
+ * recognises a join that landed although its request failed.
1339
+ */
1340
+ declare function useJoinNamespace(options?: MutationOptions): {
584
1341
  joinNamespace: (namespaceId: string, request: JoinNamespaceRequest) => Promise<_calimero_network_mero_js.JoinNamespaceResponseData | null>;
585
1342
  loading: boolean;
586
1343
  error: Error | null;
1344
+ failure: ClassifiedError | null;
1345
+ };
1346
+ /**
1347
+ * Follow an invitation: join its namespace once, then check membership, and
1348
+ * report what happened as a {@link RedeemOutcome}.
1349
+ *
1350
+ * Unlike {@link useJoinNamespace}, a request that failed but whose join landed
1351
+ * anyway — the desktop proxy aborts at 30s, a join with no member online takes
1352
+ * longer — is `already-member`, not a failure. `shouldRetain(outcome)` from
1353
+ * mero-js says whether to keep the invitation for another attempt.
1354
+ *
1355
+ * `redeem` resolves `null` only when there is no client to send it through.
1356
+ */
1357
+ declare function useRedeemInvitation(): {
1358
+ redeem: (namespaceId: string, invitation: JoinNamespaceRequest["invitation"], options?: {
1359
+ groupName?: string;
1360
+ teamName?: string;
1361
+ }) => Promise<RedeemOutcome | null>;
1362
+ outcome: RedeemOutcome | null;
1363
+ loading: boolean;
587
1364
  };
588
1365
  declare function useCreateGroupInNamespace(): {
589
- createGroupInNamespace: (namespaceId: string, request?: CreateGroupInNamespaceRequest) => Promise<_calimero_network_mero_js.CreateGroupInNamespaceResponseData | null>;
1366
+ createGroupInNamespace: (namespaceId: string, request?: CreateGroupInNamespaceRequest) => Promise<{
1367
+ groupId: string;
1368
+ } | null>;
590
1369
  loading: boolean;
591
1370
  error: Error | null;
592
1371
  };
@@ -602,17 +1381,23 @@ declare function useNamespaceGroups(namespaceId?: string | null): {
602
1381
  * Both are 32-byte strings, so passing a key names nobody and raises nothing.
603
1382
  */
604
1383
  declare function useUpdateMemberRole(): {
605
- updateMemberRole: (groupId: string, identity: string, request: UpdateMemberRoleRequest) => Promise<void | null>;
1384
+ updateMemberRole: (groupId: string, identity: string, request: UpdateMemberRoleRequest) => Promise<void | {
1385
+ groupId: string;
1386
+ } | null>;
606
1387
  loading: boolean;
607
1388
  error: Error | null;
608
1389
  };
609
1390
  declare function useSetDefaultCapabilities(): {
610
- setDefaultCapabilities: (groupId: string, request: SetDefaultCapabilitiesRequest) => Promise<void | null>;
1391
+ setDefaultCapabilities: (groupId: string, request: SetDefaultCapabilitiesRequest) => Promise<void | {
1392
+ groupId: string;
1393
+ } | null>;
611
1394
  loading: boolean;
612
1395
  error: Error | null;
613
1396
  };
614
1397
  declare function useSetSubgroupVisibility(): {
615
- setSubgroupVisibility: (groupId: string, request: SetSubgroupVisibilityRequest) => Promise<void | null>;
1398
+ setSubgroupVisibility: (groupId: string, request: SetSubgroupVisibilityRequest) => Promise<void | {
1399
+ groupId: string;
1400
+ } | null>;
616
1401
  loading: boolean;
617
1402
  error: Error | null;
618
1403
  };
@@ -634,7 +1419,9 @@ declare function useSetTeeAdmissionPolicy(): {
634
1419
  error: Error | null;
635
1420
  };
636
1421
  declare function useSetGroupMetadata(): {
637
- setGroupMetadata: (groupId: string, request: SetMetadataInput) => Promise<void | null>;
1422
+ setGroupMetadata: (groupId: string, request: SetMetadataInput) => Promise<void | {
1423
+ groupId: string;
1424
+ } | null>;
638
1425
  loading: boolean;
639
1426
  error: Error | null;
640
1427
  };
@@ -644,12 +1431,16 @@ declare function useSetGroupMetadata(): {
644
1431
  * Both are 32-byte strings, so passing a key names nobody and raises nothing.
645
1432
  */
646
1433
  declare function useSetMemberMetadata(): {
647
- setMemberMetadata: (groupId: string, identity: string, request: SetMetadataInput) => Promise<void | null>;
1434
+ setMemberMetadata: (groupId: string, identity: string, request: SetMetadataInput) => Promise<void | {
1435
+ groupId: string;
1436
+ } | null>;
648
1437
  loading: boolean;
649
1438
  error: Error | null;
650
1439
  };
651
1440
  declare function useSetContextMetadata(): {
652
- setContextMetadata: (groupId: string, contextId: string, request: SetMetadataInput) => Promise<void | null>;
1441
+ setContextMetadata: (groupId: string, contextId: string, request: SetMetadataInput) => Promise<void | {
1442
+ groupId: string;
1443
+ } | null>;
653
1444
  loading: boolean;
654
1445
  error: Error | null;
655
1446
  };
@@ -704,7 +1495,9 @@ declare function useRetryGroupUpgrade(): {
704
1495
  };
705
1496
  /** Move `childGroupId` under a new parent. */
706
1497
  declare function useReparentGroup(): {
707
- reparentGroup: (childGroupId: string, request: ReparentGroupRequest) => Promise<_calimero_network_mero_js.ReparentGroupResponseData | null>;
1498
+ reparentGroup: (childGroupId: string, request: ReparentGroupRequest) => Promise<{
1499
+ reparented: boolean;
1500
+ } | null>;
708
1501
  loading: boolean;
709
1502
  error: Error | null;
710
1503
  };
@@ -715,7 +1508,9 @@ declare function useSubgroups(groupId?: string | null): {
715
1508
  refetch: () => Promise<void>;
716
1509
  };
717
1510
  declare function useDetachContextFromGroup(): {
718
- detachContextFromGroup: (groupId: string, contextId: string) => Promise<void | null>;
1511
+ detachContextFromGroup: (groupId: string, contextId: string) => Promise<void | {
1512
+ groupId: string;
1513
+ } | null>;
719
1514
  loading: boolean;
720
1515
  error: Error | null;
721
1516
  };
@@ -1018,4 +1813,4 @@ declare function clearContextIdentity(): void;
1018
1813
  */
1019
1814
  declare function clearAllStorage(): void;
1020
1815
 
1021
- export { type AppContext, AppMode, type ApplicationContextRecord, type BlobHookOptions, CalimeroLogo, type CalimeroLogoProps, ConnectButton, type ConnectButtonProps, ConnectionType, type ContextDiscoveryOptions, type ContextDiscoveryState, type CustomConnectionConfig, DEFAULT_MIGRATION_POLL_INTERVAL_MS, type ExecutionResult, LoginModal, type LoginModalProps, MERO_CSS_VARS, MeroContext, type MeroContextValue, MeroProvider, type MeroProviderConfig, type MeroProviderProps, type MeroTheme, MigrationAdminPanel, type MigrationAdminPanelProps, MigrationPendingBanner, type MigrationPendingBannerProps, type ResolvedMeroTheme, type SetMetadataInput, type SubscriptionEventData, type SubscriptionInput, type UseBlobUrlOptions, type UseEphemeralOptions, type UseEphemeralResult, clearAllStorage, clearApplicationId, clearContextId, clearContextIdentity, clearNodeUrl, clearTokenNodeUrl, cssVar, defaultMeroTheme, getApplicationId, getContextId, getContextIdentity, getNodeUrl, getTokenNodeUrl, localStorageTokenStorage, resolveMeroTheme, setApplicationId, setContextId, setContextIdentity, setNodeUrl, setTokenNodeUrl, themeToCssVars, useAddGroupMembers, useAppVersion, useApplicationContexts, useBlobInfo, useBlobUrl, useContextDiscovery, useContextGroup, useContexts, useCreateContext, useCreateGroupInNamespace, useCreateNamespace, useCreateNamespaceInvitation, useDefaultCapabilities, useDeleteContext, useDeleteGroup, useDeleteNamespace, useDetachContextFromGroup, useEphemeral, useExecute, useGroupAppVersion, useGroupCapabilities, useGroupContexts, useGroupInfo, useGroupInvitations, useGroupMembers, useGroupMetadata, useGroupUpgradeStatus, useInstallFromRegistry, useJoinContext, useJoinGroup, useJoinNamespace, useJoinSubgroupInheritance, useLatestVersion, useMemberMetadata, useMero, useMigrationEvents, useMigrationStatus, useMyAuthoredMigration, useNamespace, useNamespaceGroups, useNamespaceIdentity, useNamespaces, useNamespacesForApplication, useNodeIdentity, useRemoveGroupMembers, useReparentGroup, useResyncContext, useRetryGroupUpgrade, useSetContextMetadata, useSetDefaultCapabilities, useSetGroupMetadata, useSetMemberMetadata, useSetSubgroupVisibility, useSetTeeAdmissionPolicy, useSubgroupVisibility, useSubgroups, useSubscription, useSyncGroup, useUpdateMemberRole, useUpgradeGroup, useUploadBlob };
1816
+ export { type AppContext, AppMode, type ApplicationContextRecord, type BlobHookOptions, type BootstrapFailure, type BootstrapFromInvitationInput, type BootstrapResult, type BootstrapStep, type BootstrapSuccess, CalimeroLogo, type CalimeroLogoProps, ConnectButton, ConnectButtonAccount, type ConnectButtonAccountProps, type ConnectButtonProps, ConnectionType, type ContextDiscoveryOptions, type ContextDiscoveryState, type CreatePrivateContextRequest, type CustomConnectionConfig, DEFAULT_MIGRATION_POLL_INTERVAL_MS, type DelegatedCredential, type DelegatedSession, type ExecutionResult, type JoinInvitationInput, type JoinInvitationResult, type JoinInvitationStep, type JoinWithNodeFailure, type JoinWithNodeInput, type JoinWithNodeResult, type JoinWithNodeStep, type JoinWithNodeSuccess, LoginModal, type LoginModalProps, MERO_CSS_VARS, type MeroCapabilities, MeroContext, type MeroContextValue, MeroProvider, type MeroProviderConfig, type MeroProviderProps, type MeroTheme, MigrationAdminPanel, type MigrationAdminPanelProps, MigrationPendingBanner, type MigrationPendingBannerProps, type MutationOptions, type RelayResolutionFailure, type RelayResolutionStep, type ResolveRelayFromInvitationInput, type ResolveRelayResult, type ResolvedInvitationRelay, type ResolvedMeroTheme, type SetMetadataInput, type SubscriptionEventData, type SubscriptionInput, type UseBlobUrlOptions, type UseDelegatedBootstrapOptions, type UseDelegatedBootstrapResult, type UseEphemeralOptions, type UseEphemeralResult, bootstrapFromInvitation, clearAllStorage, clearApplicationId, clearContextId, clearContextIdentity, clearDelegatedCredential, clearNodeUrl, clearTokenNodeUrl, createDelegatedContext, cssVar, defaultMeroTheme, getApplicationId, getContextId, getContextIdentity, getNodeUrl, getTokenNodeUrl, isFinalInvitationError, joinWithNode, listDelegatedContexts, localStorageTokenStorage, normaliseAccount, pinRelayNodeKey, readDelegatedCredential, readPinnedRelayNodeKey, readRelayMap, relayForContext, rememberRelay, resolveMeroTheme, resolveRelayFromInvitation, saveDelegatedCredential, setApplicationId, setContextId, setContextIdentity, setNodeUrl, setTokenNodeUrl, themeToCssVars, useAddGroupMembers, useAppVersion, useApplicationContexts, useBlobInfo, useBlobUrl, useContextDiscovery, useContextGroup, useContexts, useCreateContext, useCreateGroupInNamespace, useCreateNamespace, useCreateNamespaceInvitation, useCreatePrivateContext, useDefaultCapabilities, useDelegatedBootstrap, useDeleteContext, useDeleteGroup, useDeleteNamespace, useDetachContextFromGroup, useEphemeral, useExecute, useGroupAppVersion, useGroupCapabilities, useGroupContexts, useGroupInfo, useGroupInvitations, useGroupMembers, useGroupMetadata, useGroupUpgradeStatus, useInstallFromRegistry, useJoinContext, useJoinGroup, useJoinInvitation, useJoinNamespace, useJoinSubgroupInheritance, useLatestVersion, useMemberMetadata, useMero, useMigrationEvents, useMigrationStatus, useMyAuthoredMigration, useNamespace, useNamespaceGroups, useNamespaceIdentity, useNamespaces, useNamespacesForApplication, useNodeIdentity, useRedeemInvitation, useRemoveGroupMembers, useReparentGroup, useResyncContext, useRetryGroupUpgrade, useSetContextMetadata, useSetDefaultCapabilities, useSetGroupMetadata, useSetMemberMetadata, useSetSubgroupVisibility, useSetTeeAdmissionPolicy, useSubgroupVisibility, useSubgroups, useSubscription, useSyncGroup, useUpdateMemberRole, useUpgradeGroup, useUploadBlob };