@calimero-network/mero-react 9.6.4 → 9.7.1

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
@@ -162,10 +162,18 @@ function isLoopback(relayUrl) {
162
162
  var TRUSTED_RELAY_PROFILE = "locked-read-only";
163
163
  var MIN_RELAY_RELEASE = "2.3.99";
164
164
  var loadedDcap;
165
+ function dcapVerifyFrom(mod) {
166
+ const ns = mod;
167
+ const verify = typeof ns.verify === "function" ? ns.verify : ns.default?.verify;
168
+ if (typeof verify !== "function") {
169
+ throw new TypeError("@phala/dcap-qvl loaded without a verify function");
170
+ }
171
+ return verify;
172
+ }
165
173
  function relayQuoteVerifier(relayUrl) {
166
174
  const verify = async (attestation) => {
167
175
  loadedDcap ?? (loadedDcap = import('@phala/dcap-qvl').then(
168
- ({ verify: dcapVerify }) => dcapVerify,
176
+ (mod) => dcapVerifyFrom(mod),
169
177
  (error) => {
170
178
  loadedDcap = void 0;
171
179
  throw error;
@@ -423,10 +431,13 @@ async function foundDelegatedNamespace(s, req = {}, deps = {}) {
423
431
  const known = Object.entries(readRelayMap(s.account).namespaces).find(
424
432
  ([, url]) => url.replace(/\/+$/, "") === relay
425
433
  )?.[0];
426
- if (!known) {
427
- throw new Error("join a namespace on this relay first: its executor account is learned from one you are in");
434
+ const named = s.executorAccount && s.relayUrl && s.relayUrl.replace(/\/+$/, "") === relay ? s.executorAccount : null;
435
+ if (!named && !known) {
436
+ throw new Error(
437
+ "the executor account of this relay is not known: join a namespace on it first, or connect with the relay's executor account (the cloud shows it beside the relay)"
438
+ );
428
439
  }
429
- const { executorAccount } = await client(s, relay, governanceNonce(relay, known), deps.fetch).describeGovernance(known);
440
+ const executorAccount = named ?? (await client(s, relay, governanceNonce(relay, known), deps.fetch).describeGovernance(known)).executorAccount;
430
441
  let next = BigInt(Date.now());
431
442
  const founded = await client(s, relay, { next: async () => next++ }, deps.fetch).foundNamespace({
432
443
  executorAccount,