@calimero-network/mero-js 23.7.0 → 23.8.2

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.
@@ -176,6 +176,21 @@ export interface CloudAccountRelay {
176
176
  peerId: string;
177
177
  relayUrl: string | null;
178
178
  fresh: boolean;
179
+ /**
180
+ * The relay's own account id: 64 lowercase hex, the executor a delegated
181
+ * write through this relay names.
182
+ *
183
+ * Null when the server did not say (older servers omit it) or sent anything
184
+ * that is not 64 lowercase hex — an executor that cannot be named is the
185
+ * same as none, and a malformed one would only fail later, at the node.
186
+ */
187
+ executorAccount: string | null;
188
+ /**
189
+ * True when the cloud has just assigned this relay to an account that had
190
+ * none (the assignment is sticky); false for relays the account already
191
+ * used, and on older servers that omit the field.
192
+ */
193
+ assigned: boolean;
179
194
  }
180
195
  export interface CloudNamespaceNode {
181
196
  peerId: string;
@@ -66,6 +66,10 @@ function teeRoleOf(row) {
66
66
  export function pickExecutingRelay(relays) {
67
67
  return (relays.find((r) => r.canExecute && r.relayUrl !== null && r.executorAccount !== null) ?? null);
68
68
  }
69
+ const ACCOUNT_HEX = /^[0-9a-f]{64}$/;
70
+ function accountHexOrNull(value) {
71
+ return typeof value === 'string' && ACCOUNT_HEX.test(value) ? value : null;
72
+ }
69
73
  /**
70
74
  * The cloud's refusals of {@link CloudClient.enableHaAsAccount} that a
71
75
  * person can do something about. Both are `409`s with `{"error": code}`.
@@ -497,6 +501,8 @@ export class CloudClient {
497
501
  peerId: String(row.peer_id ?? ''),
498
502
  relayUrl: row.relay_url ?? null,
499
503
  fresh: row.fresh === true,
504
+ executorAccount: accountHexOrNull(row.executor_account),
505
+ assigned: row.assigned === true,
500
506
  }));
501
507
  }
502
508
  /**