@calimero-network/mero-js 11.0.0 → 12.0.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.mjs CHANGED
@@ -1062,11 +1062,39 @@ var AdminApiClient = class {
1062
1062
  async getNamespace(namespaceId) {
1063
1063
  return unwrap(await this.httpClient.get(`/admin-api/namespaces/${namespaceId}`));
1064
1064
  }
1065
+ /**
1066
+ * Who this node is — the account it writes as, the device it is, the key it
1067
+ * signs with, and the account root a second device pairs against.
1068
+ *
1069
+ * Takes no namespace, and that is the point: one root key is one account
1070
+ * everywhere, and a node signs with one key, so none of it varies by
1071
+ * namespace.
1072
+ */
1073
+ async getNodeIdentity() {
1074
+ return unwrap(await this.httpClient.get("/admin-api/identity"));
1075
+ }
1076
+ /**
1077
+ * @deprecated Use {@link getNodeIdentity} instead. Every field this returns is
1078
+ * node-level, so the namespace was only ever decoration — it now delegates to
1079
+ * the node-level route and reshapes the answer.
1080
+ *
1081
+ * Three consequences of that delegation, all visible to a caller who relied on
1082
+ * the old route's behaviour:
1083
+ *
1084
+ * - **No participation gate.** The namespace route answered 404 when this node
1085
+ * had never joined the namespace; this answers whatever the node's identity
1086
+ * is, regardless. If you were using it to ask "am I in this namespace?", ask
1087
+ * {@link listNamespaces} instead — that is the question you were really
1088
+ * asking.
1089
+ * - **`namespaceId` is echoed verbatim.** The old route resolved a subgroup id
1090
+ * to its root namespace and returned that; passing a subgroup id here gives
1091
+ * the subgroup id back.
1092
+ * - **404 means something else.** Previously "not my namespace", now "this node
1093
+ * holds no account root yet".
1094
+ */
1065
1095
  async getNamespaceIdentity(namespaceId) {
1066
- const r = await this.httpClient.get(
1067
- `/admin-api/namespaces/${namespaceId}/identity`
1068
- );
1069
- return r?.data ?? r;
1096
+ const node = await this.getNodeIdentity();
1097
+ return { namespaceId, publicKey: node.publicKey, account: node.accountId };
1070
1098
  }
1071
1099
  async listNamespacesForApplication(applicationId) {
1072
1100
  return unwrap(await this.httpClient.get(`/admin-api/namespaces/for-application/${applicationId}`));