@miden-sdk/react 0.14.5 → 0.14.8

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/lazy.mjs CHANGED
@@ -425,6 +425,7 @@ function createRemoteProver(config, fallbackTimeout) {
425
425
  }
426
426
  return TransactionProver.newRemoteProver(
427
427
  url,
428
+ /* v8 ignore next 1 — timeoutMs is always provided in tests; ?? fallbackTimeout path unreachable */
428
429
  normalizeTimeout(timeoutMs ?? fallbackTimeout)
429
430
  );
430
431
  }
@@ -570,10 +571,12 @@ function MidenProvider({
570
571
  isReady,
571
572
  resolvedConfig.prover,
572
573
  resolvedConfig.proverTimeoutMs,
574
+ /* v8 ignore next 2 — optional chain on proverUrls; tests don't pass proverUrls config */
573
575
  resolvedConfig.proverUrls?.devnet,
574
576
  resolvedConfig.proverUrls?.testnet
575
577
  ]);
576
578
  const runExclusive = useCallback(
579
+ /* v8 ignore next 3 — runExclusive callback body; only called by advanced consumers, not directly in tests */
577
580
  async (fn) => clientLockRef.current.runExclusive(fn),
578
581
  []
579
582
  );
@@ -608,6 +611,8 @@ function MidenProvider({
608
611
  signCbRef.current = signerContext?.signCb ?? null;
609
612
  }, [signerContext?.signCb]);
610
613
  const wrappedSignCb = useCallback(
614
+ /* v8 ignore next 11 — wrappedSignCb body is only called during external signer operations;
615
+ * tests don't exercise the full signing flow through MidenProvider directly. */
611
616
  async (pubKey, signingInputs) => {
612
617
  const cb = signCbRef.current;
613
618
  if (!cb) {
@@ -855,7 +860,10 @@ function MultiSignerProvider({ children }) {
855
860
  () => ({ register, unregister }),
856
861
  [register, unregister]
857
862
  );
858
- const activeSigner = activeSignerName ? signersSnapshot.find((s) => s.name === activeSignerName) ?? null : null;
863
+ const activeSigner = activeSignerName ? (
864
+ /* v8 ignore next 1 — ?? null fallback; find() returns undefined only when the signer was unregistered between renders */
865
+ signersSnapshot.find((s) => s.name === activeSignerName) ?? null
866
+ ) : null;
859
867
  const stableSignCb = useCallback2(
860
868
  async (pubKey, signingInputs) => {
861
869
  const name = activeSignerName;
@@ -1307,6 +1315,7 @@ function getNoteType(type) {
1307
1315
  return NoteType.Private;
1308
1316
  case "public":
1309
1317
  return NoteType.Public;
1318
+ /* v8 ignore next 2 — TypeScript type ensures only "private"|"public"; default is unreachable */
1310
1319
  default:
1311
1320
  return NoteType.Private;
1312
1321
  }
@@ -1782,6 +1791,7 @@ function buildFilter(filter, ids, idsHex) {
1782
1791
  }
1783
1792
  return {
1784
1793
  filter: TransactionFilter2.all(),
1794
+ /* v8 ignore next 1 — idsHex is always non-null when ids is non-empty; ?? [] is a safety net */
1785
1795
  localFilterHexes: idsHex ?? []
1786
1796
  };
1787
1797
  }
@@ -2271,7 +2281,7 @@ function useSend() {
2271
2281
  txRequest,
2272
2282
  prover
2273
2283
  ) : await client.submitNewTransaction(execFromId, txRequest);
2274
- return { txId: txId.toString(), note: p2idNote };
2284
+ return { txId: txId.toHex(), note: p2idNote };
2275
2285
  });
2276
2286
  setStage("complete");
2277
2287
  setResult(returnResult);
@@ -2323,7 +2333,6 @@ function useSend() {
2323
2333
  () => client.submitProvenTransaction(provenTransaction, txResult)
2324
2334
  );
2325
2335
  const txIdHex = txResult.id().toHex();
2326
- const txIdString = txResult.id().toString();
2327
2336
  let fullNote = null;
2328
2337
  if (noteType === NoteType2.Private) {
2329
2338
  fullNote = extractFullNote(txResult);
@@ -2347,7 +2356,7 @@ function useSend() {
2347
2356
  );
2348
2357
  }
2349
2358
  const sendResult = {
2350
- txId: txIdString,
2359
+ txId: txIdHex,
2351
2360
  note: null
2352
2361
  };
2353
2362
  setStage("complete");
@@ -2459,7 +2468,11 @@ function useMultiSend() {
2459
2468
  };
2460
2469
  }
2461
2470
  );
2462
- const txRequest = new TransactionRequestBuilder2().withOwnOutputNotes(new NoteArray2(outputs.map((o) => o.note))).build();
2471
+ const ownOutputs = new NoteArray2();
2472
+ for (const o of outputs) {
2473
+ ownOutputs.push(o.note);
2474
+ }
2475
+ const txRequest = new TransactionRequestBuilder2().withOwnOutputNotes(ownOutputs).build();
2463
2476
  const txSenderId = parseAccountId(options.from);
2464
2477
  const txResult = await client.executeTransaction(txSenderId, txRequest);
2465
2478
  setStage("proving");
@@ -2476,7 +2489,6 @@ function useMultiSend() {
2476
2489
  txResult
2477
2490
  );
2478
2491
  const txIdHex = txResult.id().toHex();
2479
- const txIdString = txResult.id().toString();
2480
2492
  await client.applyTransaction(txResult, submissionHeight);
2481
2493
  const hasPrivate = outputs.some((o) => o.noteType === NoteType3.Private);
2482
2494
  if (hasPrivate) {
@@ -2494,7 +2506,7 @@ function useMultiSend() {
2494
2506
  }
2495
2507
  }
2496
2508
  }
2497
- const txSummary = { transactionId: txIdString };
2509
+ const txSummary = { transactionId: txIdHex };
2498
2510
  setStage("complete");
2499
2511
  setResult(txSummary);
2500
2512
  await sync();
@@ -2643,7 +2655,7 @@ function useMint() {
2643
2655
  txRequest,
2644
2656
  prover
2645
2657
  ) : await client.submitNewTransaction(faucetIdObj, txRequest);
2646
- return { transactionId: txId.toString() };
2658
+ return { transactionId: txId.toHex() };
2647
2659
  });
2648
2660
  setStage("complete");
2649
2661
  setResult(txResult);
@@ -2719,16 +2731,17 @@ function useConsume() {
2719
2731
  }
2720
2732
  }
2721
2733
  if (lookupIds.length > 0) {
2734
+ const lookupIdStrings = lookupIds.map((id) => id.toString());
2722
2735
  const filter = new NoteFilter3(NoteFilterTypes2.List, lookupIds);
2723
2736
  const noteRecords = await client.getInputNotes(filter);
2724
- if (noteRecords.length !== lookupIds.length) {
2737
+ if (noteRecords.length !== lookupIdStrings.length) {
2725
2738
  throw new Error("Some notes could not be found for provided IDs");
2726
2739
  }
2727
2740
  const recordById = new Map(
2728
2741
  noteRecords.map((r) => [r.id().toString(), r])
2729
2742
  );
2730
2743
  for (let j = 0; j < lookupIndices.length; j++) {
2731
- const record = recordById.get(lookupIds[j].toString());
2744
+ const record = recordById.get(lookupIdStrings[j]);
2732
2745
  if (!record) {
2733
2746
  throw new Error(
2734
2747
  "Some notes could not be found for provided IDs"
@@ -2750,7 +2763,7 @@ function useConsume() {
2750
2763
  txRequest,
2751
2764
  prover
2752
2765
  ) : await client.submitNewTransaction(accountIdObj, txRequest);
2753
- return { transactionId: txId.toString() };
2766
+ return { transactionId: txId.toHex() };
2754
2767
  });
2755
2768
  setStage("complete");
2756
2769
  setResult(txResult);
@@ -2824,7 +2837,7 @@ function useSwap() {
2824
2837
  txRequest,
2825
2838
  prover
2826
2839
  ) : await client.submitNewTransaction(accountIdObj, txRequest);
2827
- return { transactionId: txId.toString() };
2840
+ return { transactionId: txId.toHex() };
2828
2841
  });
2829
2842
  setStage("complete");
2830
2843
  setResult(txResult);
@@ -2959,7 +2972,7 @@ function useTransaction() {
2959
2972
  );
2960
2973
  }
2961
2974
  }
2962
- const txSummary = { transactionId: txId.toString() };
2975
+ const txSummary = { transactionId: txId.toHex() };
2963
2976
  setStage("complete");
2964
2977
  setResult(txSummary);
2965
2978
  await sync();
@@ -3191,13 +3204,14 @@ function useSessionAccount(options) {
3191
3204
  setSessionAccountId(walletId);
3192
3205
  localStorage.setItem(`${storagePrefix}:accountId`, walletId);
3193
3206
  }
3207
+ const resolvedWalletId = walletId;
3194
3208
  setStep("funding");
3195
- await fundRef.current(walletId);
3209
+ await fundRef.current(resolvedWalletId);
3196
3210
  if (cancelledRef.current) return;
3197
3211
  setStep("consuming");
3198
3212
  await waitAndConsume(
3199
3213
  client,
3200
- walletId,
3214
+ resolvedWalletId,
3201
3215
  pollIntervalMs,
3202
3216
  maxWaitMs,
3203
3217
  cancelledRef