@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.cjs CHANGED
@@ -1128,11 +1128,39 @@ var AdminApiClient = class {
1128
1128
  async getNamespace(namespaceId) {
1129
1129
  return unwrap(await this.httpClient.get(`/admin-api/namespaces/${namespaceId}`));
1130
1130
  }
1131
+ /**
1132
+ * Who this node is — the account it writes as, the device it is, the key it
1133
+ * signs with, and the account root a second device pairs against.
1134
+ *
1135
+ * Takes no namespace, and that is the point: one root key is one account
1136
+ * everywhere, and a node signs with one key, so none of it varies by
1137
+ * namespace.
1138
+ */
1139
+ async getNodeIdentity() {
1140
+ return unwrap(await this.httpClient.get("/admin-api/identity"));
1141
+ }
1142
+ /**
1143
+ * @deprecated Use {@link getNodeIdentity} instead. Every field this returns is
1144
+ * node-level, so the namespace was only ever decoration — it now delegates to
1145
+ * the node-level route and reshapes the answer.
1146
+ *
1147
+ * Three consequences of that delegation, all visible to a caller who relied on
1148
+ * the old route's behaviour:
1149
+ *
1150
+ * - **No participation gate.** The namespace route answered 404 when this node
1151
+ * had never joined the namespace; this answers whatever the node's identity
1152
+ * is, regardless. If you were using it to ask "am I in this namespace?", ask
1153
+ * {@link listNamespaces} instead — that is the question you were really
1154
+ * asking.
1155
+ * - **`namespaceId` is echoed verbatim.** The old route resolved a subgroup id
1156
+ * to its root namespace and returned that; passing a subgroup id here gives
1157
+ * the subgroup id back.
1158
+ * - **404 means something else.** Previously "not my namespace", now "this node
1159
+ * holds no account root yet".
1160
+ */
1131
1161
  async getNamespaceIdentity(namespaceId) {
1132
- const r = await this.httpClient.get(
1133
- `/admin-api/namespaces/${namespaceId}/identity`
1134
- );
1135
- return r?.data ?? r;
1162
+ const node = await this.getNodeIdentity();
1163
+ return { namespaceId, publicKey: node.publicKey, account: node.accountId };
1136
1164
  }
1137
1165
  async listNamespacesForApplication(applicationId) {
1138
1166
  return unwrap(await this.httpClient.get(`/admin-api/namespaces/for-application/${applicationId}`));